Skip to content

unify build workflows and add quay.expires-after label to container images#525

Merged
eguzki merged 2 commits into
Kuadrant:mainfrom
nexpectArpit:add-image-expiry-and-unified-workflow
Jul 6, 2026
Merged

unify build workflows and add quay.expires-after label to container images#525
eguzki merged 2 commits into
Kuadrant:mainfrom
nexpectArpit:add-image-expiry-and-unified-workflow

Conversation

@nexpectArpit

@nexpectArpit nexpectArpit commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Changes

.github/workflows/build-push.yaml (replaces dev-build.yaml + release-build.yaml)

  • Unified single workflow handling all three scenarios:
    • push to main → tags with git SHA + latest
    • release published → tags with semver (e.g. v0.4.0)
    • workflow_dispatch → manual trigger
  • Adds a Read quay image expiry step that sets QUAY_IMAGE_EXPIRY:
    • never for main branch and release tags (v*.*.*)
    • 3w (3 weeks) for all other refs (e.g. git SHA builds from feature branches)
  • Passes QUAY_IMAGE_EXPIRY as a build argument to the Docker build step
  • Uses IMG_REGISTRY_USERNAME / IMG_REGISTRY_TOKEN secrets (consistent with dev-build.yaml)
  • Maintains multi-arch support: linux/amd64, linux/arm64, linux/s390x, linux/ppc64le

Dockerfile

  • Added ARG QUAY_IMAGE_EXPIRY="never" — defaults to never for local/manual builds
  • Added LABEL quay.expires-after=${QUAY_IMAGE_EXPIRY} — Quay.io reads this label and automatically expires the image accordingly

Expiry Behaviour Summary

Tag type QUAY_IMAGE_EXPIRY Expires?
main never ❌ Never
latest never ❌ Never
v0.4.0 (release) never ❌ Never
Git SHA 3w ✅ After 3 weeks

closes #518

Summary by CodeRabbit

  • New Features

    • Image expiry is now set automatically during builds based on the release branch or tag.
    • Builds from main and version tags use no expiry; other builds get a shorter expiry period.
  • Changes

    • Container images now include an expiry label during build, helping downstream image management reflect the intended retention period.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8baefc71-8914-4dff-848e-ce4769eab213

📥 Commits

Reviewing files that changed from the base of the PR and between b19bc2e and 3d01f42.

📒 Files selected for processing (2)
  • .github/workflows/build-push.yaml
  • Dockerfile
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/build-push.yaml
  • Dockerfile

📝 Walkthrough

Walkthrough

The build workflow now computes a Quay image expiry value based on the git ref (never for main or semver tags, 3w otherwise) and passes it as a Docker build argument. The Dockerfile defines a corresponding QUAY_IMAGE_EXPIRY build argument (default "never") used to set the quay.expires-after label.

Changes

Quay Image Expiry Labelling

Layer / File(s) Summary
Expiry computation and build argument passing
.github/workflows/build-push.yaml
Adds a quay-expiry step that sets expiry=never for main or semver tag refs, else expiry=3w, and passes it to docker/build-push-action via build-args.
Label application via build argument
Dockerfile
Adds ARG QUAY_IMAGE_EXPIRY="never" and sets LABEL quay.expires-after=${QUAY_IMAGE_EXPIRY} in the runtime stage.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Sequence Diagram(s)

sequenceDiagram
    participant Workflow as build-push.yaml
    participant GitRef as GitHub Ref
    participant DockerBuild as docker/build-push-action
    participant Dockerfile as Dockerfile

    Workflow->>GitRef: Inspect ref_name / ref_type
    GitRef-->>Workflow: main / semver tag / other
    Workflow->>Workflow: Compute expiry (never or 3w)
    Workflow->>DockerBuild: Pass build-args QUAY_IMAGE_EXPIRY
    DockerBuild->>Dockerfile: Build with ARG QUAY_IMAGE_EXPIRY
    Dockerfile-->>DockerBuild: LABEL quay.expires-after set
Loading

Possibly related issues

Suggested reviewers: eguzki

Poem

A rabbit hopped through YAML fields so wide,
Tagging images with expiry, none to hide.
"main" stays forever, tags too shall last,
But git-SHA builds fade three weeks fast. 🐇⏳
Hop, build, label — the burrow's storage is safe at last!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarises the workflow consolidation and Quay expiry-label changes.
Linked Issues check ✅ Passed The workflow and Dockerfile changes implement the requested expiry logic, build arg, and quay.expires-after label.
Out of Scope Changes check ✅ Passed The PR stays focused on the image-expiry workflow and Dockerfile updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nexpectArpit nexpectArpit force-pushed the add-image-expiry-and-unified-workflow branch 3 times, most recently from 20d3cde to b19bc2e Compare June 4, 2026 17:26
@nexpectArpit nexpectArpit marked this pull request as ready for review June 4, 2026 17:56

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
scripts/cluster-setup.sh (1)

53-59: ⚡ Quick win

Pin Developer Portal Controller manifests to the same release as the controller image

scripts/cluster-setup.sh (used for local dev + e2e) applies the controller manifests from ref=main while the image is pinned to quay.io/kuadrant/developer-portal-controller:v0.2.0. If upstream main changes RBAC/deployment/args independently, the pinned binary can become incompatible. Pin both the kustomize ref and the image to the same immutable release (tag/commit).

Suggested change
-log "installing Developer Portal Controller from main..."
-kubectl apply -k https://github.com/Kuadrant/developer-portal-controller/config/default?ref=main
+DPC_REF="v0.2.0"
+DPC_IMAGE="quay.io/kuadrant/developer-portal-controller:${DPC_REF}"
+log "installing Developer Portal Controller from ${DPC_REF}..."
+kubectl apply -k "https://github.com/Kuadrant/developer-portal-controller/config/default?ref=${DPC_REF}"

 log "patching Developer Portal Controller image to quay.io..."
 kubectl set image deployment/developer-portal-controller-controller-manager \
-  manager=quay.io/kuadrant/developer-portal-controller:v0.2.0 \
+  manager="${DPC_IMAGE}" \
   -n developer-portal-controller-system
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/cluster-setup.sh` around lines 53 - 59, The manifest URL currently
used by kubectl apply -k references ref=main while the image is pinned to
quay.io/kuadrant/developer-portal-controller:v0.2.0; update the kustomize ref to
the same immutable release (e.g., change the URL used in the kubectl apply -k
call to use ref=v0.2.0 or the exact commit/tag that matches the image) so
manifests and the controller image stay in sync, and consider replacing the
hardcoded tag with a single variable used both for the image (in the kubectl set
image manager=...) and the kustomize ref to avoid drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/build-push.yaml:
- Around line 55-64: Replace direct GitHub Actions template expansions inside
the bash run block (the references to ${{ github.ref_name }} and ${{
github.ref_type }} used in the quay-expiry step) by first mapping them to
environment variables and then using those shell variables in the condition;
specifically, set env entries (or export at the top of the run script) like
REF_NAME and REF_TYPE from the GitHub context and update the conditional that
currently checks "${{ github.ref_name }}" and "${{ github.ref_type }}" to use
"$REF_NAME" and "$REF_TYPE" (and keep the same regex and expiry logic) so the
template expansion happens safely outside the shell code.

---

Nitpick comments:
In `@scripts/cluster-setup.sh`:
- Around line 53-59: The manifest URL currently used by kubectl apply -k
references ref=main while the image is pinned to
quay.io/kuadrant/developer-portal-controller:v0.2.0; update the kustomize ref to
the same immutable release (e.g., change the URL used in the kubectl apply -k
call to use ref=v0.2.0 or the exact commit/tag that matches the image) so
manifests and the controller image stay in sync, and consider replacing the
hardcoded tag with a single variable used both for the image (in the kubectl set
image manager=...) and the kustomize ref to avoid drift.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3f1599c5-7136-4393-955b-3a0c6eefc982

📥 Commits

Reviewing files that changed from the base of the PR and between 770ad74 and b19bc2e.

📒 Files selected for processing (4)
  • .github/workflows/build-push.yaml
  • .github/workflows/e2e.yaml
  • Dockerfile
  • scripts/cluster-setup.sh

Comment thread .github/workflows/build-push.yaml
@nexpectArpit

Copy link
Copy Markdown
Contributor Author

@eguzki please review it.

@eguzki eguzki left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the contribution 🙏 .

The changes look good to me. But remove the commit with message chore(e2e): fix developer-portal-controller deployment. It's out of scope

Needs rebase to resolve conflicts with latest changes

Comment thread Dockerfile Outdated
Comment thread .github/workflows/build-push.yaml Outdated
- Add QUAY_IMAGE_EXPIRY build arg and quay.expires-after label to Dockerfile
- Expiry set to 'never' for main branch and release tags
- Expiry set to '3w' for all other refs (e.g. manual workflow dispatch)
- Remove dev-build.yaml and release-build.yaml
- Add build-push.yaml to handle pushes, releases, and workflow dispatch

Signed-off-by: Arpit Tripathi <arpittripathiayo@gmail.com>
Signed-off-by: Arpit Tripathi <arpittripathiayo@gmail.com>
@nexpectArpit nexpectArpit force-pushed the add-image-expiry-and-unified-workflow branch from 233594c to 3d01f42 Compare July 6, 2026 13:08
@nexpectArpit nexpectArpit requested a review from eguzki July 6, 2026 13:39

@eguzki eguzki left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good one

LGTM

@eguzki eguzki added this pull request to the merge queue Jul 6, 2026
Merged via the queue into Kuadrant:main with commit ab9336d Jul 6, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add quay.expires-after LABEL to Container Images

2 participants