Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ jobs:
run: |
version=`make read-release-version`
echo version=$version >> $GITHUB_OUTPUT
- name: Determine quay image expiry
id: quay-expiry
run: |
if [[ "${{ github.ref_type }}" == "tag" && "${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ ]]; then
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also just change the Makefile value

QUAY_IMAGE_EXPIRY ?= never
of QUAY_IMAGE_EXPIRY to never when triggering the release workflow, and let 3w as the default... what do you reckon?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same way it's changing the VERSION here

- name: Update VERSION in Makefile
run: |
VERSION="${{ github.event.inputs.version }}"
sed -i "s/^VERSION ?= .*/VERSION ?= $VERSION/" Makefile
echo "Updated Makefile VERSION to $VERSION"
grep "^VERSION" Makefile

echo "expiry=never" >> $GITHUB_OUTPUT
echo "Setting expiry to 'never' for release tag ${{ github.ref_name }}"
else
echo "expiry=3w" >> $GITHUB_OUTPUT
echo "Setting expiry to '3w' for non-release ref ${{ github.ref_name }}"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could change this and make it open and read the value from input

fi
- name: Build and Push Image
if: github.repository_owner == 'kuadrant'
id: build-image
Expand All @@ -61,6 +71,7 @@ jobs:
GIT_SHA=${{ github.sha }}
DIRTY=false
VERSION=${{ steps.release.outputs.version }}
QUAY_IMAGE_EXPIRY=${{ steps.quay-expiry.outputs.expiry }}
- name: Print Image URL
run: |
echo "Image(s) pushed:"
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,9 @@ WORKDIR /
COPY --from=builder /workspace/manager .
USER 65532:65532

# Quay image expiry
ARG QUAY_IMAGE_EXPIRY
ENV QUAY_IMAGE_EXPIRY=${QUAY_IMAGE_EXPIRY:-never}
LABEL quay.expires-after=$QUAY_IMAGE_EXPIRY

ENTRYPOINT ["/manager"]
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= 0.0.0

# QUAY_IMAGE_EXPIRY defines when to expire the built quay images.
# The time values could be something like 1h, 2d, 3w for hours, days, and weeks, respectively,
# from the time the image is built.
QUAY_IMAGE_EXPIRY ?= never


# IMAGE_TAG_BASE defines the docker.io namespace and part of the image name for remote images.
# This variable is used to construct full image tags for bundle and catalog images.
#
Expand Down Expand Up @@ -147,6 +153,7 @@ docker-build: ## Build docker image with the manager.
--build-arg GIT_SHA=$(GIT_SHA) \
--build-arg DIRTY=$(DIRTY) \
--build-arg VERSION=v$(VERSION) \
--build-arg QUAY_IMAGE_EXPIRY=$(QUAY_IMAGE_EXPIRY) \
-t ${IMG} .

.PHONY: docker-push
Expand Down