Skip to content

Snapshot version-bump helpers before release-branch checkout - #3083

Merged
edsavage merged 3 commits into
elastic:mainfrom
edsavage:fix/version-bump-snapshot-helpers
Jul 23, 2026
Merged

Snapshot version-bump helpers before release-branch checkout#3083
edsavage merged 3 commits into
elastic:mainfrom
edsavage:fix/version-bump-snapshot-helpers

Conversation

@edsavage

@edsavage edsavage commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Patch version bumps (Buildkite ml-cpp-version-bump) start from main, then git checkout the target release branch tip before opening the PR.
  • After #3064, main's bump_version.sh passes --label ci:skip-es-tests, but older create_github_pull_request.sh on 8.19 / 9.3 / 9.4 rejects unknown --labelERROR: unknown argument: --label (builds 60–62).
  • Snapshot validation / PR helpers to a temp dir before the release-branch checkout so CI always uses the pipeline revision's scripts. Same pattern for minor-freeze (bump_main_minor_freeze.sh).

Test plan

  • pytest dev-tools/unittest/test_version_bump_lib.py
  • Verify the fix non-destructively: reproduce the pre-fix --label rejection using the 9.3/9.4/8.19 copy of create_github_pull_request.sh, and confirm the snapshotted (pipeline-revision) helper accepts --label after the release-branch checkout. The 9.3.9 / 9.4.5 / 8.19.20 patch bumps were blocked by exactly this unknown argument: --label error (builds 60–62); topic branches are pushed and can be completed via the normal pipeline once merged.

Made with Cursor

edsavage and others added 2 commits July 22, 2026 10:11
Patch bumps start from main then git checkout the target branch tip, which
replaced create_github_pull_request.sh with an older copy that rejects
--label. Keep pipeline-revision helpers in a temp snapshot instead.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@elasticsearchmachine

Copy link
Copy Markdown

Pinging @elastic/ml-core (Team:ML)

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

Pull request overview

This PR hardens the Buildkite version-bump automation by ensuring the pipeline always runs the current helper scripts from main, even after the workflow checks out an older release branch tip (which may contain outdated helper implementations).

Changes:

  • Add version_bump_snapshot_helpers to copy selected helper scripts into a temp directory for stable execution after branch checkouts.
  • Update patch and minor-freeze bump scripts to snapshot validation/PR-creation helpers before switching branches, and clean up via trap.
  • Add unit tests covering helper snapshot behavior and a regression check for --label parsing support.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
docs/changelog/3082.yaml Adds a changelog entry for this pipeline/scripts fix.
dev-tools/version_bump_lib.sh Introduces a helper-snapshot function used by version bump workflows.
dev-tools/unittest/test_version_bump_lib.py Adds tests validating the snapshot helper behavior and regression coverage.
dev-tools/bump_version.sh Snapshots helper scripts before release-branch checkout for patch bumps.
dev-tools/bump_main_minor_freeze.sh Snapshots helper scripts before any checkout for minor-freeze leg B.

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

Comment thread docs/changelog/3082.yaml Outdated
Comment thread dev-tools/version_bump_lib.sh
- Remove docs/changelog/3082.yaml: this is a CI/tooling change that does not
  need a changelog entry, and the filename/pr field mismatched anyway.
- Harden version_bump_snapshot_helpers: handle cp/chmod failure explicitly so
  a copy error removes the temp dir and returns non-zero instead of aborting
  under set -e before the caller installs its cleanup trap.

Co-authored-by: Cursor <cursoragent@cursor.com>
@edsavage
edsavage requested a review from valeriy42 July 22, 2026 03:15
@edsavage

Copy link
Copy Markdown
Contributor Author

Test plan item 2 — verified non-destructively

The literal "complete the patch bumps" is destructive (rewrites version metadata, opens PRs), so instead I verified — with the real helper scripts — that this PR resolves the exact blocker, using a gh shim so no PR is created and no network/version state is touched.

The simulation mirrors the pipeline: version_bump_snapshot_helpers copies the pipeline-revision (main) helpers to a temp dir before the git checkout of the release branch, and bump_version.sh points CREATE_PR_SH at that snapshot. I extracted the current 9.3 dev-tools to stand in for the post-checkout worktree.

1) Pre-fix failure reproduced — the release branch's own create_github_pull_request.sh (invoked after git checkout 9.3) with the --label that main's bump_version.sh passes since #3064:

ERROR: unknown argument: --label   (exit 1)

This is the builds 60–62 failure.

2) Fix proven — snapshot taken before the checkout; worktree copy --label support = 0, snapshot copy = 1; invoking the snapshot (what CREATE_PR_SH resolves to) with identical args:

[SHIM gh pr create --repo elastic/ml-cpp --base 9.3 --head ci/ml-cpp-version-bump-9.3-9.3.9 \
   --title "[ML] Bump version to 9.3.9" --body "..." --label ci:skip-es-tests]   (exit 0)

--label ci:skip-es-tests is accepted and forwarded intact.

Coverage: the 9.4 and 8.19 copies of create_github_pull_request.sh are identical in the relevant respect (no --label case — grep count 0 on all three), so the fix covers 9.4.5 and 8.19.20 uniformly; the minor-freeze path (bump_main_minor_freeze.sh) uses the same snapshot mechanism.

The three topic branches are already pushed and can be completed through the normal ml-cpp-version-bump pipeline once this merges.

@edsavage
edsavage merged commit 96befcd into elastic:main Jul 23, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants