Skip to content

Add configuration for sorenlouv/backport tool #4474

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

Merged
merged 1 commit into from
Jun 6, 2025
Merged

Add configuration for sorenlouv/backport tool #4474

merged 1 commit into from
Jun 6, 2025

Conversation

pquentin
Copy link
Member

@pquentin pquentin commented Jun 6, 2025

Elastic engineers commonly use https://github.com/sorenlouv/backport to perform backports. I've been using it in the elasticsearch-specification repository for months now.

Since pull request forks are not accepted in this repository, committing the configuration is helpful to avoid backports being pushed to forks. It will mean that active branches will have to be maintained here, but that's okay. I've had this locally for a while now, and I update it whenever I notice any missing branches.

(I'm backporting this change because it's easy to do, but it's not needed as backports are done from main.)

Copy link
Member

@flobernd flobernd left a comment

Choose a reason for hiding this comment

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

Thanks! Let's switch to the corresponding GHA as well. Tested this in the .NET generator repo and it's way better than the current action.

Can do that change in a follow up. If you prefer to do it yourself or to include it in this PR, just a quick note: the backport prefix setting can't contain whitespaces which means we have to rename our labels to "backport-x.x" instead of "backport x.x".

@pquentin
Copy link
Member Author

pquentin commented Jun 6, 2025

Oh, wow, I had no idea there was a GitHub action. That's great to hear! Happy to do this as a follow-up, as it's a larger change.

Regarding the whitespace issue, I think we can change branchLabelMapping from the default ^backport-to-(.+)$ to ^backport (.+)$.

@pquentin pquentin merged commit 0c9e661 into main Jun 6, 2025
16 checks passed
@pquentin pquentin deleted the backport-rc branch June 6, 2025 09:13
github-actions bot pushed a commit that referenced this pull request Jun 6, 2025
github-actions bot pushed a commit that referenced this pull request Jun 6, 2025
github-actions bot pushed a commit that referenced this pull request Jun 6, 2025
github-actions bot pushed a commit that referenced this pull request Jun 6, 2025
@flobernd
Copy link
Member

flobernd commented Jun 6, 2025

@pquentin Sure. I think the action automatically reads the config that you added in this PR.

In the .NET generator repository I don't have a config yet, but I used the provided option on the action:
https://github.com/sorenlouv/backport-github-action/blob/929f69d04adbc196d982e60f02837b6cc00b3129/action.yml#L7-L9

The default value does not seem to contain a regex:

auto_backport_label_prefix: backport-to-

I tried with:

auto_backport_label_prefix: 'backport '

but this was not correctly recognized when I did an initial test:

"results": [
    {
      "targetBranch": " 9.0",
      "status": "handled-error",
      "error": {
        "name": "BackportError",
        "errorContext": {
          "code": "invalid-branch-exception",
          "branchName": " 9.0"
        }
      }
    }
  ]

It parsed the prefix incorrectly and assumed the whitespace to be part of the branch name. That's probably something that we could fix upstream or ask to get fixed upstream, but I didn't had time to check that any further so I just used backport- which works perfectly fine.

If we are lucky, we don't have to use this option in the GHA at all and the tool will read it from the config file.

pquentin added a commit that referenced this pull request Jun 6, 2025
(cherry picked from commit 0c9e661)

Co-authored-by: Quentin Pradet <[email protected]>
pquentin added a commit that referenced this pull request Jun 6, 2025
(cherry picked from commit 0c9e661)

Co-authored-by: Quentin Pradet <[email protected]>
pquentin added a commit that referenced this pull request Jun 6, 2025
(cherry picked from commit 0c9e661)

Co-authored-by: Quentin Pradet <[email protected]>
pquentin added a commit that referenced this pull request Jun 6, 2025
(cherry picked from commit 0c9e661)

Co-authored-by: Quentin Pradet <[email protected]>
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.

2 participants