From d10ca98ef8d5fa5999fc7587e77c8af7baec4889 Mon Sep 17 00:00:00 2001 From: Simon Baird Date: Fri, 8 Dec 2023 13:37:28 -0500 Subject: [PATCH] Derive version from branch in TAP docker file Previously it was hard coded. If we instead derive it from the branch name it means the same docker file can be used for different release branches. --- Dockerfile.dist | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile.dist b/Dockerfile.dist index feaf5ed59..da50ea473 100644 --- a/Dockerfile.dist +++ b/Dockerfile.dist @@ -50,14 +50,15 @@ FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_1.21@sha256 ARG TARGETOS ARG TARGETARCH -# Todo: Figure what version to use and how to provide it -ARG EC_VERSION=v0.1-alpha - COPY . /build RUN cd /build && go mod download +# Derive the "version" from the branch name, e.g. in the branch +# "redhat-v0.1-alpha" the version will be "v0.1-alpha" RUN cd /build && \ + GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) && \ + EC_VERSION=${GIT_BRANCH#"redhat-"} && \ GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \ -trimpath \ -mod=readonly \