Repository navigation
Restrict SNAPSHOT tag publication to builds from main - #37
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix image tagging issue for non-main branches
Restrict May 21, 2026
SNAPSHOT tag publication to builds from main
kthoms
approved these changes
May 21, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR prevents non-main snapshot builds from overwriting the canonical global SNAPSHOT Docker tag by only publishing SNAPSHOT when the effective source branch is main, while still publishing ${VERSION}-SNAPSHOT for all snapshot builds.
Changes:
- Update
release.shsnapshot tagging to always emit${VERSION}-SNAPSHOT, and only add the plainSNAPSHOTtag whenSNAPSHOT_TAG_BRANCHresolves tomain. - Propagate
SNAPSHOT_TAG_BRANCHinto the publish job fromgithub.event.release.target_commitish(release event) orgithub.ref_name(fallback). - Add a regression test script intended to validate tag behavior for
mainvs. release branches.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
test/test-release-tags.sh |
Adds a mock-docker regression test for snapshot tag selection by branch. |
release.sh |
Gates publication of the global SNAPSHOT tag to main while keeping versioned snapshot tags. |
.github/workflows/build-test-and-publish.yml |
Passes SNAPSHOT_TAG_BRANCH to the publish step based on trigger context. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+23
to
+33
| PATH="${MOCK_DIR}:${PATH}" \ | ||
| MOCK_DOCKER_CALLS="${MOCK_DOCKER_CALLS}" \ | ||
| DISTRO="run" \ | ||
| VERSION="1.2.3" \ | ||
| SNAPSHOT="true" \ | ||
| SNAPSHOT_TAG_BRANCH="${snapshot_tag_branch}" \ | ||
| DOCKERHUB_USERNAME="user" \ | ||
| DOCKERHUB_PASSWORD="pass" \ | ||
| IMAGE_REPO_OPERATON="operaton/operaton" \ | ||
| GITHUB_STEP_SUMMARY="${MOCK_DIR}/summary.log" \ | ||
| bash "${ROOT_DIR}/release.sh" > /dev/null 2>&1 |
Comment on lines
+1
to
+5
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | ||
| MOCK_DIR="$(mktemp -d)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Snapshot builds currently publish a global
SNAPSHOTtag regardless of source branch, which allows release-branch builds to overwrite the canonical development snapshot. This change scopes globalSNAPSHOTpublication tomainwhile preserving versioned snapshot tags for all snapshot builds.Tagging logic in release publishing
release.shto always publish${VERSION}-SNAPSHOTfor snapshot builds.SNAPSHOTis only appended when the effective branch ismain.Workflow branch source propagation
build-test-and-publish.ymlto passSNAPSHOT_TAG_BRANCHfrom:github.event.release.target_commitish(release-triggered workflows), orgithub.ref_name(fallback for other triggers).Focused regression coverage
test/test-release-tags.shto assert:mainsnapshot builds include both${VERSION}-SNAPSHOTandSNAPSHOT${VERSION}-SNAPSHOTbut notSNAPSHOT