Skip to content

[ML] Skip backport for minor-freeze version bump PRs#3070

Open
edsavage wants to merge 2 commits into
elastic:mainfrom
edsavage:fix/minor-freeze-no-backport
Open

[ML] Skip backport for minor-freeze version bump PRs#3070
edsavage wants to merge 2 commits into
elastic:mainfrom
edsavage:fix/minor-freeze-no-backport

Conversation

@edsavage

@edsavage edsavage commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

After the 9.5 minor freeze, merging #3068 (Leg B main bump to 9.6.0) triggered the automatic backport workflow and opened spurious #3069 onto branch 9.5. That PR would have incorrectly bumped the release branch to 9.6.0; it has been closed without merging.

This happens because:

  • elasticsearchmachine labels minor-freeze PRs with the release version (e.g. v9.5.0)
  • The same merge adds the new release branch to targetBranchChoices in .backportrc.json
  • The generic branchLabelMapping rule then backports the main-only freeze commit onto the new release branch

This will recur on every minor freeze unless we skip backport for these automation PRs.

Changes

  • Add a no-backport label to minor-freeze PRs opened by bump_main_minor_freeze.sh
  • Skip the Backport workflow when that label is present, and as a fallback when the PR head branch is a minor-freeze topic branch (ci/ml-cpp-minor-freeze-main-*)
  • Add unit tests guarding both the workflow and the bump script

The no-backport label already exists on the repo.

Test plan

  • python3 -m pytest dev-tools/unittest/test_backport_workflow.py -v
  • CI dev-tools pytest step passes
  • After merge: dummy PR backport-skip smoke test (see Manual verification below)
  • Next production minor freeze: Leg B PR has no-backport and does not spawn a spurious backport PR

Manual verification

After this PR merges to main — backport skip smoke test

No need to wait for the next minor freeze. Once #3070 is on main:

  1. Open a harmless test PR to main (e.g. a trivial dev-tools comment) with:
    • Labels: no-backport, a version label (e.g. v9.6.0), :ml, >test
  2. Merge that PR.
  3. Confirm:
    • Actions → Backport for that merge: the Backport PR job is Skipped (workflow if is false).
    • No new PR with the backport label referencing the test PR.

This reproduces the #3068#3069 failure mode (version label on a main-only change) without running the version-bump pipeline. Revert or close the test PR afterward.

On the next production minor freeze

When release-eng triggers ml-cpp-version-bump with WORKFLOW=minor again:

  • Leg B PR opened by bump_main_minor_freeze.sh should include the no-backport label and be created from a ci/ml-cpp-minor-freeze-main-* branch.
  • Merging that PR should not open a spurious backport onto the new release branch.

Note: sandbox refs (testing-*) skip Leg B in CI, so they cannot be used for a full Leg B label E2E test.

Review notes

Addressed Copilot feedback:

  • Replaced the broad (minor freeze) title-substring fallback with a head-ref check on the automation topic branch (ci/ml-cpp-minor-freeze-main-*) so unrelated PRs mentioning a minor freeze in their title are not skipped.
  • Made the guard-rail tests tolerant of whitespace/quote-style changes in backport.yml via regex.

Minor-freeze Leg B PRs are labeled vX.Y.0 by elasticsearchmachine and update
.backportrc.json in the same merge, which caused the backport workflow to open
spurious PRs onto the new release branch (e.g. elastic#3069 after elastic#3068).

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

prodsecmachine commented Jul 7, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@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 adjusts the repository’s automated backporting behavior to avoid creating incorrect backport PRs when the minor-freeze version bump on main is merged (a commit that should remain main-only but may carry release-version labels).

Changes:

  • Add a no-backport label to the PR created by dev-tools/bump_main_minor_freeze.sh.
  • Update the Backport GitHub Actions workflow to skip when no-backport is present (and also when the title contains (minor freeze)).
  • Add unit tests to guard the workflow skip conditions and the bump script’s label application.

Reviewed changes

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

File Description
dev-tools/unittest/test_backport_workflow.py Adds tests that assert the workflow and bump script contain the backport-skip mechanisms.
dev-tools/bump_main_minor_freeze.sh Ensures minor-freeze PRs get a no-backport label when created.
.github/workflows/backport.yml Skips running the backport job for PRs labeled no-backport (and those with (minor freeze) in the title).

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

Comment thread .github/workflows/backport.yml Outdated
Comment thread dev-tools/unittest/test_backport_workflow.py Outdated
Replace the broad `(minor freeze)` title-substring fallback with a head.ref
check keyed off the automation topic branch (ci/ml-cpp-minor-freeze-main-*) so
unrelated PRs that merely mention a minor freeze are not skipped. Make the
guard-rail tests tolerant of whitespace/quote-style changes via regex.

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.

4 participants