Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate backports to LTS branches #9641

Open
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

npolshakova
Copy link
Contributor

Description

Backports are annoying. This automates opening a backport PR if a developers includes label (ex. Backport: 1.17.x) on their PRs. After the PR merges, the backport.yaml Github Action will run, and the PR with the title (ex. '[v1.17.x] {old pr title}') should be created.

This is based on the backport automation that Gloo Mesh Enterprise uses:

API changes

None

Code changes

None

CI changes

  • Backport workflow introduced

Docs changes

None

Context

None

Interesting decisions

None

Testing steps

None

Notes for reviewers

None

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

@github-actions github-actions bot added the keep pr updated signals bulldozer to keep pr up to date with base branch label Jun 18, 2024
Copy link

github-actions bot commented Jun 18, 2024

Visit the preview URL for this PR (updated for commit 23b16c9):

https://gloo-edge--pr9641-npolshak-add-backpor-lxcnr6q8.web.app

(expires Fri, 05 Jul 2024 20:53:48 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 77c2b86e287749579b7ff9cadb81e099042ef677

Copy link
Contributor

@sam-heilbron sam-heilbron left a comment

Choose a reason for hiding this comment

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

I like the idea, thanks for pushing out the proposal! A few thoughts around making this safe/easy to manage across LTS branches

runs-on: ubuntu-latest
name: Backport into our v1.15.x LTS branch
if: |
contains(github.event.pull_request.labels.*.name, 'Backport: 1.15.x') &&
Copy link
Contributor

Choose a reason for hiding this comment

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

We already have the concept of release/1.N which tends to indicate on issues, which versions a given change should go to. Instead of adding new labels per LTS branch, what if we added a auto-backport label, and we use that plus release/1.N to identify which branches to backport this to?

on:
pull_request:
branches:
- main
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to make this also to be run with a manual trigger? I like the idea of reducing the burden on developers, and I imagine that we'd first start with a tool developers to initiate, and then work to automate. I'm also thinking of the case where a decision to backport a piece of work is identified after it has merged

${{ github.event.pull_request.user.login }}
reviewers: |
${{ github.event.pull_request.user.login }}
cherry_pick_v1_16_x_backport_pr:
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way to use the release labels to determine which versions to target? I think it would be cool if we could have a single job that runs, and mainly works by taking a source commit, and a target branch (or a list of them) and opens PRs to each branch. That way each time we add an LTS branch, we don't need to update this job

Copy link
Contributor

Choose a reason for hiding this comment

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

Another idea: In https://github.com/solo-io/solo-projects/issues/6395 I propose having LTS branches own the automation they need. Would it be useful/possible to follow that model, where the LTS branch owns the workflow to open a PR against it, and this job on main is just the orchestrator?

token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
fetch-depth: 0
- name: Cherry pick into v1.17.x LTS branch
uses: ashleywang1/[email protected]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible with this action to open a PR in a draft state, or apply custom labels to the PR itself? I imagine that our changelog-bot would fail anyway on the new PR, but I wonder if it's valuable to either open a draft PR or add the work in progress label, to ensure that user intervention is required before the PR is eligible to merge

description: |
"Developers should add a label like `Backport: 1.17.x` on their PRs. After your PR merges, the backport.yaml
Github Action will run, and the PR with the title like '[v1.17.x] {old pr title}' should be created."
skipCI: true
Copy link
Contributor

Choose a reason for hiding this comment

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

^This is not a valid directive in this repo. https://github.com/solo-io/gloo/tree/main/ci#special-directives-to-skip-ci is the list that we support. Do you think it's worth it to add support for this one?

I kind of llike the granular approach so you can opt-out of certain pieces of CI, though I could see value in a global definition as well. wdyt?

pull_request:
branches:
- main
types: ["closed"]
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like there is no "merged" event that we can use. Should we add some logic in the job to skip events where a PR was closed (not merged)?

Alternatively, could/show we use the on push to main trigger, like https://github.com/solo-io/gloo/blob/main/.github/workflows/cache-setup.yaml#L7?

soloio-bulldozer bot and others added 24 commits June 20, 2024 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keep pr updated signals bulldozer to keep pr up to date with base branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants