multibranch plugin with gerrit trigger plugin

336 views
Skip to first unread message

吴亭

unread,
Feb 11, 2016, 3:39:16 PM2/11/16
to Jenkins Users
Hi All,

I want to know if multi branch plugin support gerrit trigger?

I dont find any options to do this.

Or multibranch plugin is just aimed for the commit already been merged into the git repo?

Br,
Tim
Message has been deleted

Lars Berntzon

unread,
Apr 27, 2021, 4:21:51 PM4/27/21
to Jenkins Users
Hello, old thread but no answer. I have the same problem. I just can't find out how to set it up to trigger. Anyone have an answer to this. Feels like a very common use-case yet I can not find the documentation for how to set it up.
Thanks, Lars

Björn Pedersen

unread,
Apr 28, 2021, 2:47:08 AM4/28/21
to Jenkins Users
There are 2 plugins for gerrit support: 
 - gerrit-trigger  -> does not work with multibranch as  it supplies its own way of checking out the right commits, so why would you want to use multibranch ( each change in gerrit is on its own branch by gerrit design!)
- gerrit-codereview [1] -> does require multi-branch by design if you use it for checkout  (it can also work  together with gerrit-trigger for setting voters etc.)



Björn

Lars Berntzon

unread,
Apr 28, 2021, 4:51:59 AM4/28/21
to Jenkins Users
Thanks. What I want to achieve in the end is a pipeline with a stage0 check for uploaded patches, and if that passes have it do a +1 verify vote. Then a multistage job that runs of what is submitted.
And I want the pipelines created automatically for master and each release branch. I thought I could do this some how with multi-branch and some kind of gerrit trigger, either the gerrit-trigger plugin or via gerrit webhook plugin..
Regards, Lars

Björn Pedersen

unread,
Apr 28, 2021, 5:41:45 AM4/28/21
to Jenkins Users
lar...@gmail.com schrieb am Mittwoch, 28. April 2021 um 10:51:59 UTC+2:
Thanks. What I want to achieve in the end is a pipeline with a stage0 check for uploaded patches, and if that passes have it do a +1 verify vote. Then a multistage job that runs of what is submitted.
And I want the pipelines created automatically for master and each release branch. I thought I could do this some how with multi-branch and some kind of gerrit trigger, either the gerrit-trigger plugin or via gerrit webhook plugin..
Regards, Lars

Well, that is possible.  You can combine Jenkinsfile and gerrit trigger (I  would do that for the stage0 checks), just checkout scm is not possible at the moment, yuo need to  use the var from gerrit trigger in the checkout incantation. 

For the submitted checks multibranch + gerrit-review + (gerrit webhook)  will work. 

Lars Berntzon

unread,
Apr 28, 2021, 7:41:04 AM4/28/21
to Jenkins Users
Ok, even for multi-branch so it can discover new branches? I have not found a method for that to setup gerrit-triggers for new patch-sets. Do you have any hints?

Björn Pedersen

unread,
Apr 28, 2021, 10:42:22 AM4/28/21
to Jenkins Users
If you use gerrit-trigger you don't need to discover new branches. You get the GERRIT_BRANCH from the trigger data.


A typical checkout looks like:
     checkout ([poll: false, 
                scm: [$class: 'GitSCM', 
                      branches: [[name: '$GERRIT_BRANCH']],
                      doGenerateSubmoduleConfigurations: false,
                      extensions: [[$class: 'BuildChooserSetting',
                                            buildChooser: [$class: 'GerritTriggerBuildChooser']],
                                    ],
                       gitTool: 'Default',
                       submoduleCfg: [],
                       userRemoteConfigs: [[credentialsId: 'XXXX',
                                            refspec: '$GERRIT_REFSPEC',
                                            url: 'ssh://<host here>/$GERRIT_PROJECT']]
                     ]
                ])

Lars Berntzon

unread,
Apr 28, 2021, 11:05:42 AM4/28/21
to Jenkins Users
Ah, you mean one global stage0 for all branches - didn't think of that. Also thanks for the above goodies. Ill check them out.

Regards, Lars
Reply all
Reply to author
Forward
0 new messages