Skip to content

gha: Add release branch sync workflow#7091

Open
vvoland wants to merge 1 commit into
docker:masterfrom
vvoland:gha-sync-release
Open

gha: Add release branch sync workflow#7091
vvoland wants to merge 1 commit into
docker:masterfrom
vvoland:gha-sync-release

Conversation

@vvoland

@vvoland vvoland commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Add a manually dispatched workflow for maintainers to sync a docker release branch to a selected docker release tag.

The job checks out the requested release branch, merges the tag with git merge --no-ff, checks the worktree content out from that tag, stages the result, and pushes the updated branch.

The actual push is guarded by the docker-releases GitHub environment which requires a manual approval.

@vvoland vvoland added this to the 29.7.0 milestone Jul 8, 2026
@vvoland vvoland self-assigned this Jul 8, 2026
@vvoland vvoland force-pushed the gha-sync-release branch 3 times, most recently from cc66332 to e802815 Compare July 8, 2026 10:04
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Assessment: 🔴 CRITICAL

Two high-severity bugs completely disable the master-branch safety guard in the Validate step (BRANCH vs $branch case mismatch + trailing space in the comparison string). Several medium-severity issues were also found: git checkout -- '*' won't resolve subdirectory conflicts, sed "//q" uses unescaped regex with slash-injection risk, incorrect boolean logic in conflict detection, missing xargs -r guard, and a DRY_RUN check that fires after merges have already been applied.

Comment thread .github/workflows/sync-release-branch.yml Outdated
Comment thread .github/workflows/sync-release-branch.yml Outdated
Comment thread scripts/unmerged-tags Outdated
Comment thread scripts/sync-branch
Comment thread .github/workflows/sync-release-branch.yml
Comment thread scripts/sync-branch
Comment thread .github/workflows/sync-release-branch.yml Outdated
Comment thread .github/workflows/sync-release-branch.yml

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Assessment: 🟡 NEEDS ATTENTION

3 findings in 2 files — 1 high-severity (forced inline), 2 medium-severity (security + logic).

Comment thread scripts/unmerged-tags Outdated
Comment thread .github/workflows/sync-release-branch.yml
Comment thread scripts/unmerged-tags Outdated
@vvoland vvoland force-pushed the gha-sync-release branch from 14b8e3f to 0812cfb Compare July 8, 2026 13:48
@vvoland vvoland requested a review from docker-agent July 8, 2026 14:56

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Assessment: 🔴 CRITICAL

Two confirmed high-severity bugs in new code introduced by this PR.

Findings summary

  1. scripts/unmerged-tags:32 — Plain sort sorts version tags lexicographically, causing wrong tag ordering (e.g. docker-v29.10.0 before docker-v29.9.0). The awk exit-on-target logic then cuts the list at the wrong point, syncing the wrong set of tags.
  2. .github/workflows/sync-release-branch.yml:80scripts/sync-branch (which runs git merge) is called before the DRY_RUN check, so merges always execute even in dry-run mode. The dry_run flag only prevents the push, contradicting the stated intent of "print the tag range without merging or pushing".

Comment thread scripts/unmerged-tags Outdated
Comment thread .github/workflows/sync-release-branch.yml
@vvoland vvoland force-pushed the gha-sync-release branch from 0812cfb to 21f6308 Compare July 8, 2026 15:06
@vvoland vvoland requested a review from docker-agent July 8, 2026 15:08

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Assessment: 🟡 NEEDS ATTENTION

4 medium-severity findings confirmed or likely in the newly added scripts and workflow.

Comment thread scripts/unmerged-tags
Comment thread scripts/unmerged-tags
Comment thread scripts/sync-branch Outdated
Comment thread scripts/sync-branch
Comment thread .github/workflows/sync-release-branch.yml
@vvoland vvoland force-pushed the gha-sync-release branch from 21f6308 to daa138a Compare July 8, 2026 17:19
Add a manually dispatched workflow for maintainers to sync a Docker
release branch to a selected release tag.

The sync-release-branch job checks out the release branch, computes
the list of unmerged tags up to the requested tag via
scripts/unmerged-tags, merges them in order via scripts/sync-branch
using git merge --no-ff (resolving conflicts by taking the tag's
content), then pushes the result to a temporary branch.

The push-release-branch job runs after manual approval via the
docker-releases environment. It verifies that neither the release
branch nor the temporary branch moved since the sync job ran before
force-advancing the release branch and deleting the temporary branch.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
@vvoland vvoland force-pushed the gha-sync-release branch from daa138a to 5123974 Compare July 8, 2026 17:30
@vvoland vvoland requested a review from docker-agent July 8, 2026 17:45

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Assessment: 🟡 NEEDS ATTENTION

One finding requires attention before merge.

Lower-confidence findings (not posted inline)

None.

Dismissed findings

  • scripts/sync-branch:17 — Inverted conflict-check logic (DISMISSED: logic is correct; the OR condition correctly guards the force-checkout path)
  • .github/workflows/sync-release-branch.yml:60 — User-supplied tag input not validated (DISMISSED: workflow_dispatch restricted to maintainers, env var prevents injection, git args are safe)
  • .github/workflows/sync-release-branch.yml:80 — xargs splitting may mishandle special characters (DISMISSED: git tag names cannot contain whitespace by git's own constraints)
  • .github/workflows/sync-release-branch.yml:132 — Push uses mutable FETCH_HEAD ref (DISMISSED: no concurrent fetch between verification and push; FETCH_HEAD is stable in this context)

Comment thread scripts/unmerged-tags

# Get all docker release tags merged into master but not into release branch
git tag --merged "$master" --no-merged "$release_branch" \
| grep '^v' \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[high] Tag input format in workflow description conflicts with awk stop condition in unmerged-tags

The workflow's own input description says "Tag to sync from, for example docker-v29.6.0", but the repository's actual git tags use v* format (e.g. v29.6.0). This creates two interacting issues:

  1. If a maintainer follows the description and supplies docker-v29.6.0: git rev-parse --verify refs/tags/docker-v29.6.0 fails immediately with "Tag does not exist" — the script aborts cleanly but confusingly.

  2. More critically — the awk stop condition: even when the correct v29.6.0 format is used, the awk -v tag="$tag" on line 38 compares $0 == tag to stop printing at the target tag. This relies on $tag matching the format that git tag --merged outputs. If the user ever supplies a tag in docker-v* format (matching the description), the equality check never fires and awk prints all unmerged tags rather than stopping at the intended target — syncing more tags than requested with no error.

The grep '^v' filter is correct for the real tag format; the misleading description is the root of the confusion. Recommend either:

  • Update the description to "for example v29.6.0" to match the actual repo convention, and add a validation/normalization step, or
  • If docker-v* is the intended format (e.g. ported from moby where tags differ), fix grep '^v' to grep '^docker-v' and ensure the tag existence check and awk comparison are consistent.
Confidence Score
🟡 moderate 57/100

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.

3 participants