-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Support for Gerrit #4109
Comments
Renovate uses branches extensively. Will this map to Gerrit's concepts? |
Yes - i'll map to a "change" in Gerrit. The only difference is that Gerrit only allows one commit in such a "change" so all changes after the first commit have to be amended and then pushed. Maybe I'll find some time in the next weeks to provide a proof of concept implementation |
Renovate only every makes one commit off master and force pushes over the top if it needs to make a change. So far sounds compatible? |
Yes! Started with the implementation in my fork: https://github.com/derkoe/renovate/tree/feat/4109-gerrit |
@derkoe how's your implementation so far? I wonder how does Google uses both Gerrit and Renovate together. |
Not very far (╯︵╰) - we are mostly using GitLab now, so I'm not sure if I'll ever finish that. Does Google use Renovate with Gerrit? Where did you find that. |
I think Google's use of Renovate is limited to its open source repositories, where they use GitHub Issues |
To create Gerrit PR it is only necessary to do simple push command And you basically don't need to amend the last commit if you want just update the previous PR, you need just use the same |
I myself use Gerrit and would like to join in the efforts to make renovate available for gerrit, so I'll fork @derkoe's branch and try to figure out how to continue implementing it (I'm new to renovate!). If someone else is also interested in continuing @derkoe's work, please say so and we can coordinate! |
hi, the current state works (inclusive automerge/submit) with some drawbacks (see below). Warning: I'm new to renovate and still study the documentation and code to understand all of the details. Perhaps i'm misunderstood some details/features. Then correct me plz. Renovate-with-Gerrit WorkflowHere are my (current) translation of the renovate-branch/pull-request-model to the gerrit-change-model:
(current) Drawbacks
Unfinished stuff
Needed Renovate Config.jsI'm use the Gerrit-HTTP REST API with http-basic-auth (Prefix /a/). Therefore you need to generate a custom password for the gerrit-enovate-account. These are the important part:
|
New revision (amend-commit) uploaded. The (major) drawback, The (fake) branch-handling was improved, for each open gerrit-change a local branch was created (from initRepo) and registered with the commitSha. All open gerrit-changes are automatically "updated" if origin/$basebranch was updated. |
New revision (amend-commit) uploaded.
In my opinion the proof of concept is done. Any comments? |
Hi @NiasSt90, thanks for keeping us updated with your progress. I have never used Gerrit so have to admit some of it is a little 🤯 for me. Should we try to address the drawbacks first, e.g. things which might make this unworkable? Can you describe them in a bit more detail (not just what you tried, but what the high level requirements are) so that we can try to work out a solution? Also feel free to email me for an invite into our contributor-only Slack group |
@NiasSt90 I'm actually having some capacity as well and were wondering if you like support with implementing Gerrit support? Anything we can try/test/implement to help you? |
I don't know, whether nias (a friend of mine) will be able to answer himself, but let me just inform you, that he finished his vacation with some accident, he still struggles with. |
My company might be willing to fund this feature. Reach out to me if interested. |
info about:
for any help needed, please ask. Hope nias gets better. |
First and foremost, you should advertise this effort in the Gerrit community, I'm sure you will get a lot of valid input from there.
|
One problem with the use of topics is that a change can have just a single topic, and users may want to use topics for other purposes (e.g. atomic cross-repo commits with the Submit Whole Topic feature). |
hello,
okay, i would do this soon.
okay, i've modified my prototype to allow both, topics or hashtags (with %topic= or %t=).
yes, only a single branch is currently possible. I'm still searching for an idea how to change this. Renovate use a local git repo for all platforms in the same way (hard coded git-commands), a specific platform can't break out of this workflow (currently).
that is not an option (or useful). |
New revision (amend-commit) uploaded. It's now possible to ignore pull-requests by vote them with -2 (reject). |
Nice, I have tested the WIP and created a bunch of Gerrit reviews with updates and it works like a charm! I had to do some smaller things like wrap the project query parameter in a "encodeURIComponent" to get it working here (my project contains "/" chars). My fork can be found here. I also added some tests that you can copy. |
sadly no, at the time of the commitAndPush the target-branch (i.e. baseBranch) is not known I will do some more investigations into this, perhaps there is a (clean) way to provide these information to the platform.commitAndPush. |
New Prototyp V3You can find these Gerrit-V3 Branch here. It's based on V1 and don't need special permission (except to allow +2 Code-Review label) for some refs. This way it's possible to build a gerrit-push url like:
The original branchName was stored into an Gerrit hashtag (with prefix) to allow find existing PRs. As in V1 from initRepo() all existing (renovate-) PRs were checked out as local branches (additional with This way most util/git/* commands are work as expected or in detail:
|
Awesome! |
Will config.branchName always contain "renovate"? p.s. IIRC there are extension-points for hashtag creation validation so that once a set hash-tag pattern is established it wouldn't be to difficult to write a plugin that validates hashtag creation so that only the renovate-user (and f.i. admins) have the right to create hashtags with a certain pattern (f.i. "sourceBranch-renovate/.*"). |
That depends on the branchName configuration.
okay, to avoid/prevent potential abuse? I hope the maximum length for a Gerrit hashtag is not that short, i couldn't found this in the documentation so far. |
V3 Patchset Updatewhats new/changed:
|
Yes, not related to this effort in any other way than that it shouldn't be difficult to write such a Gerrit plugin, for any Renovate users that doesn't want to consider the complexity of anyone removing or adding "Renovate-hashtags" and I'd be happy to do it.
There should be a technical limit, but in any case it's above 400 chars (empirically tested) so I think it will suffice. |
V3 Patchset Updatedthe branch/diff can be found here
I think we're on the home straight. I've updated the |
V3 Patchset updated again and now it has reached the test-coverage requirements. |
Gerrit 3.7 brings better (but not complete) markdown support. |
V3 Patchset updated again.I've changed the "preset" loading feature a little bit.
to extend the configuration with the file content renovate.json from the All-Projects HEAD branch. Important: grant read access for the renovate account to the project/refspec (above "refs/meta/config"). I'm still unsure how to "fix" or implement the The translation of the different file lookups to a |
V3 Patchset rebased and updated again
I've now done some first tests (two cloned but real repos) in our company infrastructure with success. |
Hello @NiasSt90, First of all thanks for creating this integration with Gerrit. I have a question, all my topic branch names are created like this "sourceBranch-renovate/all-minor-patch", there is any config to have a this String "sourceBranch", configured by repo? I ask this because in our gerrit behaviour all reviews opened with same topic name will be submited together even in different repos hosted in same Gerrit instance. Thanks |
Looks like you are trying to use an really old prototype. Exactly for this reason I no longer use the Gerrit "topic" property to store the (virtual) branch name of the pull request. The branch with the latest prototype can be found here. |
The problem we see in our gerrit service is that hashtag functionality is disabled. I get greeted from gerrit push for review with this lovelly message: Explanation from service owners is that they are currently using "reviewdb" that doesn't support hashtags. Still using topic with static name for all reviews is not good, as all reviews with same topic name are grouped and can only be submitted together :( Is there any way to disable usage of topic name altogether ? |
Support for reviewdb was dropped in Gerrit 3.0, released in May 2019 and long EOL. |
Ouch, this means that you are running a Gerrit version that is 4 1/2 years old and was EOL 2 years ago (2.16). All your Gerrit admin needs to do is to upgrade to the latest v2.16 version and migrate to NoteDB: What they really should do is upgrade to an actively supported version such as 3.7, but that's a separate issue. |
Yes unfortunately we are stuck until IT service upgrades service to 3.x (which they aren't updating claiming performance impacts) |
you should change your it service 😏 |
We could discuss this all day long... It's also my case with Gerrit 2.14. And there's nothing I can do to change it. :) It's actually comforting to hear that I'm not the only one facing the same situation. Nevertheless, I don't think the implementors of Gerrit in Renovate should lift a finger to support EOL versions of Gerrit either. |
They don't have to upgrade to 3.x to get hashtags support, notedb is supported in 2.16 (see my post above). If anything you get better performance with NoteDB, especially once they upgrade to a newer Gerrit version. |
Thanks for the info, I'll try to reason with them and get NoteDB added, as we currently are using 2.16 based version. |
🎉 This issue has been resolved in version 37.112.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
What would you like Renovate to be able to do?
It would be great to have support for Gerrit based Git repositories including the Gerrit change workflow.
Describe the solution you'd like
Create a Gerrit change for each dependency update and also update this changes on every run. Hashtags may be used to label changes (like GitHub labels).
Describe alternatives you've considered
Gerrit provides a REST API which could be used to query/modify changes.
Additional context
Gerrit is still used in a lot of projects especially by Google (https://gerrit.googlesource.com/, https://fuchsia.googlesource.com/).
The text was updated successfully, but these errors were encountered: