Skip to content

Add backport action#599

Merged
gbanasiak merged 6 commits intoelastic:masterfrom
gareth-ellis:add-backport
Sep 24, 2024
Merged

Add backport action#599
gbanasiak merged 6 commits intoelastic:masterfrom
gareth-ellis:add-backport

Conversation

@gareth-ellis
Copy link
Member

@gareth-ellis gareth-ellis commented May 6, 2024

Original idea:

This adds a backport action that should do the following two things:

  • Backport any PR to current latest branch (currently 8.15) that we tag with backport. We potentially could remove the requirement to add a label too - so absolutely everything is backported to 8.15
  • Backport to other branches (e.g 8.13) by adding a label of v8.13.

The backport will work by creating a new PR(or PRs) against the relevant branch(es).


New simplified setup: #599 (comment)

@gareth-ellis gareth-ellis requested a review from a team May 6, 2024 07:56
Copy link
Contributor

@gbanasiak gbanasiak left a comment

Choose a reason for hiding this comment

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

I left some comments.

I would add targetPRLabels option with a label that will allow us to find or filter out backport PRs quickly. We currently have backport label as a trigger. We could add backported label to indicate the PR was created by backport tool. For instance https://github.com/elastic/kibana is using auto-backport / backport label pair for this purpose.

.backportrc.json Outdated
@@ -0,0 +1,9 @@
{
"upstream": "elastic/rally-tracks",
"targetBranches": ["8.15"],
Copy link
Contributor

@gbanasiak gbanasiak May 6, 2024

Choose a reason for hiding this comment

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

I did some testing, and it looks like PR labels are converted to branch list based on branchLabelMapping which is filtered through targetBranchChoices which in turn gets overridden by targetBranches. So current configuration will always backport to 8.15 regardless of the labels.

I think we need to choose between the following:

  • configure targetBranches to the current latest branch which is closest to what we had earlier,
  • configure branchLabelMapping and label each time (more work but more flexible).

WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

hmm, I wonder if we can find a way to configure both - ideally I would like:

  • (either tagged with backport or untagged, we can decide) -> backported to latest (currently 8.13)
  • If we have a vX.XX tag, then we ALSO backport to those branches. Let me see if I can find a config that will allow that

@gareth-ellis
Copy link
Member Author

@elasticmachine update branch

@gareth-ellis gareth-ellis self-assigned this Jul 2, 2024
@gbanasiak
Copy link
Contributor

@elasticmachine update branch

@gbanasiak
Copy link
Contributor

We had quite a few backports recently so I think it's time to revisit this one. I've simplified setup in cf7d836 based on https://github.com/sorenlouv/backport-github-action documentation. The intended behavior is as follows:

  • backport is triggered by backport-to-... label, e.g. backport-to-8.15,
  • there is no automatic backport to the most recent non-master branch, see earlier testing in Add backport action #599 (comment),
  • the backport PR is labeled with backport label.

@gbanasiak gbanasiak requested a review from a team September 24, 2024 15:50
Copy link
Contributor

@favilo favilo left a comment

Choose a reason for hiding this comment

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

This is really neat. Refactoring might be harder to ballet sometimes, but this i feel would make it actually approachable

@gbanasiak gbanasiak merged commit 3ae3304 into elastic:master Sep 24, 2024
github-actions bot pushed a commit that referenced this pull request Sep 24, 2024
(cherry picked from commit 3ae3304)
@github-actions
Copy link

💚 All backports created successfully

Status Branch Result
8.15

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

gbanasiak pushed a commit that referenced this pull request Sep 25, 2024
(cherry picked from commit 3ae3304)

Co-authored-by: Gareth Ellis <gareth.ellis@elastic.co>
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.

4 participants

Comments