Skip to content

Commit

Permalink
Merge pull request #1202 from simonbaird/use-branch-name-for-version
Browse files Browse the repository at this point in the history
Derive version from branch in TAP docker file
  • Loading branch information
simonbaird authored Dec 8, 2023
2 parents 9df1182 + d10ca98 commit 23e2e64
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Dockerfile.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 23e2e64

Please sign in to comment.