Skip to content

Skip building Ruby images that already exist#4

Open
baelter wants to merge 4 commits intomainfrom
skip-existing-ruby-images
Open

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

Conversation

@baelter
Copy link
Member

@baelter baelter commented Mar 23, 2026

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
Copy link

Copilot AI left a comment

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.

baelter added 3 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).
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