Skip to content

fix(gerrit): defer change creation to createPr()#39250

Open
felipecrs wants to merge 52 commits intorenovatebot:mainfrom
felipecrs:gerrit-fix-create-pr
Open

fix(gerrit): defer change creation to createPr()#39250
felipecrs wants to merge 52 commits intorenovatebot:mainfrom
felipecrs:gerrit-fix-create-pr

Conversation

@felipecrs
Copy link
Copy Markdown
Contributor

@felipecrs felipecrs commented Nov 12, 2025

Changes

Gerrit has a very different workflow compared to other platforms. There is simply no concept of branches for the changes, just the changes themselves.

This PR changes the Gerrit platform implementation to defer the creation of the change to the createPr() method, rather than letting the change be created while preparing the branch.

This is better because it lets most of the standard Renovate platform flow continue as usual, which closes a few gaps:

This PR also refactors part of #35900 and reverts #38288, as these hacks outside of the Gerrit platform can now be dropped.

Finally, this PR also changes Gerrit SCM deleteBranch() to delete the local branch as opposed to not deleting anything (the default SCM deletes both remote and local branches).

Context

Please select one of the below:

  • This closes an existing issue: see above.
  • This doesn't close an Issue, but I accept the risk that this PR may be closed if maintainers disagree with its opening or implementation

AI assistance disclosure

Did you use AI tools to create any part of this pull request?

Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.

  • No — I did not use AI for this contribution.
  • Yes — minimal assistance (e.g., IDE autocomplete, small code completions, grammar fixes).
  • Yes — substantive assistance (AI generated non‑trivial portions of code, tests, or documentation).
  • Yes — other (please describe):

Claude Opus 4.6 was used to investigate places that needed updating, implement tests and review the code changes.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

The public repository: https://review.gerrithub.io/q/project:felipecrs/renovate-repro-gerrit-defer-change-creation

@felipecrs felipecrs force-pushed the gerrit-fix-create-pr branch 2 times, most recently from 34af483 to 38b16bd Compare November 14, 2025 02:13
Signed-off-by: Felipe Santos <felipe.santos@ericsson.com>
@felipecrs felipecrs force-pushed the gerrit-fix-create-pr branch from 0b1cce2 to d7a2601 Compare November 14, 2025 02:52
@felipecrs felipecrs marked this pull request as draft November 14, 2025 02:52
@felipecrs felipecrs force-pushed the gerrit-fix-create-pr branch 2 times, most recently from 113b707 to 5aa8581 Compare November 14, 2025 03:16
@felipecrs felipecrs force-pushed the gerrit-fix-create-pr branch from 5aa8581 to 0b491aa Compare November 14, 2025 03:42
@felipecrs felipecrs force-pushed the gerrit-fix-create-pr branch from e1fdb37 to e512e13 Compare December 15, 2025 14:34
@hanson76
Copy link
Copy Markdown

Is this being worked on, we have been forced to pin the version of Renovate to 41.167.0 which is the version prior to the change where Renovate stopped adding reviewers.

Looks like this pr has multiple parts, are all necessary to fix that bug or could it be split into several PRs that could be merged individually?

@felipecrs
Copy link
Copy Markdown
Contributor Author

I'll look into completing this PR tomorrow.

@felipecrs
Copy link
Copy Markdown
Contributor Author

Sorry, change of plans. I'll look into completing this next week or the other.

@felipecrs felipecrs marked this pull request as ready for review January 30, 2026 21:38
@felipecrs felipecrs force-pushed the gerrit-fix-create-pr branch from 928e627 to 1ddaf28 Compare January 30, 2026 21:39
@felipecrs felipecrs force-pushed the gerrit-fix-create-pr branch from c6e53b6 to 5acc7f0 Compare January 31, 2026 22:40
@avm99963
Copy link
Copy Markdown

avm99963 commented Feb 3, 2026

Hey! As requested, I just took a look at the change.

I left some comments that popped up, but both the approach and the entire diff LGTM!

I also thought about an alternative approach while reading your PRs (but I think it is worse than yours):

Renovate's generic action This PR's approach An alternative approach
Create a branch Create a branch locally without pushing Create a WIP change
Create a PR Submit a new change to Gerrit Update the change to be active

It might be helpful to keep this alternative approach in mind in the case that, in the future, Renovate changes in some way such that it requires the branch to exist in the remote after branch creation. Since I don't think this is the case currently, your approach looks much simpler and cleaner!

viceice
viceice previously approved these changes Mar 28, 2026
felipecrs added a commit to felipecrs/renovate that referenced this pull request Apr 1, 2026
Copy link
Copy Markdown
Collaborator

@RahulGautamSingh RahulGautamSingh left a comment

Choose a reason for hiding this comment

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

ready for review? @felipecrs

@felipecrs
Copy link
Copy Markdown
Contributor Author

felipecrs commented Apr 21, 2026

Yes, absolutely. 😊

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.

5 participants