Skip to content

Commit

Permalink
change version to lowercase as uppercase version env exist in parent …
Browse files Browse the repository at this point in the history
…dockerfile of go-toolset

Signed-off-by: ehearneredhat <[email protected]>
  • Loading branch information
ehearneRedHat committed Aug 9, 2024
1 parent 4a5f266 commit 9bd754c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ jobs:
- name: Set Authorino version
id: authorino-version
run: |
echo "VERSION=latest" >> $GITHUB_ENV
echo "version=latest" >> $GITHUB_ENV
- name: Set Authorino git sha
id: authorino-git-sha
run: |
if [[ ${GITHUB_REF_NAME/\//-} =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]]; then
echo "VERSION=${GITHUB_REF_NAME/\//-}" >> $GITHUB_ENV
echo "version=${GITHUB_REF_NAME/\//-}" >> $GITHUB_ENV
else
echo "GIT_SHA=${{ github.sha }}" >> $GITHUB_ENV
fi
Expand All @@ -63,7 +63,7 @@ jobs:
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
build-args: |
GIT_SHA=${{ env.GIT_SHA }}
VERSION=${{ env.VERSION }}
version=${{ env.VERSION }}
DIRTY=${{ env.DIRTY }}
containerfiles: |
./Dockerfile
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ FROM registry.access.redhat.com/ubi9/go-toolset:1.21 AS builder
USER root
WORKDIR /usr/src/authorino
COPY ./ ./
ARG VERSION
ENV VERSION=${VERSION:-unknown}
ARG version
ENV version=${version:-unknown}
ARG GIT_SHA
ENV GIT_SHA=${GIT_SHA:-unknown}
ARG DIRTY
ENV DIRTY=${DIRTY:-unknown}
RUN CGO_ENABLED=0 GO111MODULE=on go build -a -ldflags "-X main.version=${VERSION} -X main.gitSHA=${GIT_SHA} -X main.dirty=${DIRTY}" -o /usr/bin/authorino main.go
RUN CGO_ENABLED=0 GO111MODULE=on go build -a -ldflags "-X main.version=${version} -X main.gitSHA=${GIT_SHA} -X main.dirty=${DIRTY}" -o /usr/bin/authorino main.go

# Use Red Hat minimal base image to package the binary
# https://catalog.redhat.com/software/containers/ubi9-minimal
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ docker-build:AUTHORINO_VERSION=$(shell $(YQ) '.build.version' build.yaml)
docker-build:GIT_SHA=$(shell git rev-parse HEAD)
docker-build:DIRTY=$(shell $(PROJECT_DIR)/hack/check-git-dirty.sh || echo "unknown")
docker-build: ## Builds an image based on the current branch
docker build --build-arg VERSION=$(AUTHORINO_VERSION) --build-arg GIT_SHA=$(GIT_SHA) --build-arg DIRTY=$(DIRTY) -t $(AUTHORINO_IMAGE) .
docker build --build-arg version=$(AUTHORINO_VERSION) --build-arg GIT_SHA=$(GIT_SHA) --build-arg DIRTY=$(DIRTY) -t $(AUTHORINO_IMAGE) .

test: generate manifests envtest ## Runs the tests
KUBEBUILDER_ASSETS='$(strip $(shell $(ENVTEST) use -p path 1.21.2 --os linux))' go test ./... -coverprofile cover.out
Expand Down

0 comments on commit 9bd754c

Please sign in to comment.