Skip to content

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

Open
edsavage wants to merge 3 commits into
elastic:mainfrom
edsavage:fix/version-bump-snapshot-helpers
Open

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

Conversation

@edsavage

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
  • Re-run or manually complete patch bumps for 9.3.9 / 9.4.5 / 8.19.20 (topic branches already pushed; separate unblock PRs)

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

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
@@ -0,0 +1,5 @@
area: Build
issues: []
pr: 3083

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Rather than reconcile the filename/pr field, I've removed the changelog entry entirely (4a0aae2): this is a CI/dev-tools tooling change (>build), which doesn't warrant a user-facing changelog. With no changelog files left in the PR, validate-changelogs.sh soft-passes.

Comment on lines +107 to +116
dest="$(mktemp -d "${TMPDIR:-/tmp}/ml-cpp-version-bump-helpers.XXXXXX")"
for name in "$@"; do
if [[ ! -f "${src_dir}/${name}" ]]; then
echo "ERROR: missing helper to snapshot: ${src_dir}/${name}" >&2
rm -rf "${dest}"
return 1
fi
cp "${src_dir}/${name}" "${dest}/${name}"
chmod +x "${dest}/${name}"
done

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed — under set -e a failed cp/chmod would abort before the caller installs its cleanup trap, leaking the temp dir. Fixed in 4a0aae2 by handling cp/chmod failure explicitly: on error it now removes ${dest} and return 1 instead of relying on set -e.

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

3 participants