Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expire commit container images after 1 week #402

Merged
merged 1 commit into from
Aug 8, 2023
Merged
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
3 changes: 2 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ jobs:
- name: Build container images
id: build_container_images
run: |
podman version
# Build podman images locally
make build-image IMAGE_TAG=${{ steps.get_commit_id.outputs.commit_id }}
make build-image IMAGE_TAG=${{ steps.get_commit_id.outputs.commit_id }} QUAY_EXPIRE_AFTER=1w
make build-image IMAGE_TAG=main

- name: Push to quay.io
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ IMAGE_REPO?=quay.io/redhat-certification
COMMIT_ID=$(shell git rev-parse --short HEAD)
COMMIT_ID_LONG=$(shell git rev-parse HEAD)
IMAGE_TAG=$(COMMIT_ID)
QUAY_EXPIRE_AFTER="never"

default: bin

Expand Down Expand Up @@ -57,13 +58,18 @@ test:
# If IMAGE_TAG is not provided, use the COMMIT_ID
.PHONY: build-image
build-image:
$(IMAGE_BUILDER) build -t $(IMAGE_REPO)/chart-verifier:$(IMAGE_TAG) .
# TODO: Adding --no-cache option as a workaround to https://github.com/containers/buildah/issues/4632
# This can be removed as soon as we can ensure that the ubuntu-latest runner image uses podman=>4.6.0
$(IMAGE_BUILDER) build \
--no-cache \
--label quay.expires-after=$(QUAY_EXPIRE_AFTER) \
komish marked this conversation as resolved.
Show resolved Hide resolved
-t $(IMAGE_REPO)/chart-verifier:$(IMAGE_TAG) .

# Push the container image. Usage: make push-image IMAGE_TAG=my_tag
# If IMAGE_TAG is not provided, use the COMMIT_ID
.PHONY: push-image
push-image:
$(IMAGE_BUILDER) push $(IMAGE_REPO)/chart-verifier:$(IMAGE_TAG) .
$(IMAGE_BUILDER) push $(IMAGE_REPO)/chart-verifier:$(IMAGE_TAG)

.PHONY: gosec
gosec: install.gosec
Expand Down