Skip to content

Skip building Ruby images that already exist#4

Closed
baelter wants to merge 5 commits into
mainfrom
skip-existing-ruby-images
Closed

Skip building Ruby images that already exist#4
baelter wants to merge 5 commits into
mainfrom
skip-existing-ruby-images

Conversation

@baelter

@baelter baelter commented Mar 23, 2026

Copy link
Copy Markdown
Member

Summary

Recently changes so updates to the ruby version matrix would trigger builds. I then noticed all versions got rebuilt. I think this makes sense:

  • Skip building Ruby images that already exist in GHCR
  • Rebuild all versions when ruby/Dockerfile changes (validated without pushing on PRs)
  • Add force input to workflow_dispatch for manual full rebuilds

Behavior

Trigger Dockerfile changed New version Existing version Action
push (main) yes - - Build + push all
push (main) no yes - Build + push new only
PR yes - - Build all (no push)
PR no yes - Build new only (no push)
PR no no yes Skip
workflow_dispatch (force) - - - Build + push all

Checks if the image tag exists before building. New versions
added to the matrix get built, existing ones are skipped.

Manual workflow dispatch with force=true rebuilds everything.
@baelter baelter requested review from Copilot and dentarg March 23, 2026 14:28
@baelter baelter marked this pull request as ready for review March 23, 2026 14:28

Copilot AI 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.

Pull request overview

This PR updates the Ruby container image GitHub Actions workflow to avoid rebuilding/pushing GHCR images when a given Ruby-version tag already exists, with an override to rebuild everything on manual dispatch.

Changes:

  • Add a workflow_dispatch boolean input force to rebuild all images on demand.
  • Add a pre-build step that checks GHCR for an existing tag via docker buildx imagetools inspect.
  • Gate docker/login-action and docker/build-push-action behind the “tag missing OR force” condition.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ruby.yml Outdated
Comment thread .github/workflows/ruby.yml Outdated
baelter and others added 4 commits March 23, 2026 15:33
On PRs and pushes, only build versions that don't exist in GHCR
yet. If the Dockerfile itself changed, rebuild all versions to
validate (without pushing on PRs).

Copilot AI 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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment on lines +48 to +52
if [ "${{ github.event_name }}" = "pull_request" ]; then
BASE="${{ github.event.pull_request.base.sha }}"
else
BASE="${{ github.event.before }}"
fi
@baelter

baelter commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

Closing, we want to rebuild with latest upstream often to get security patches.

@baelter baelter closed this Jun 15, 2026
@dentarg dentarg deleted the skip-existing-ruby-images branch June 15, 2026 11:16
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.

2 participants