Re: gerrit-code-review-plugin integrated with multibranch pipeline

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: gerrit-code-review-plugin integrated with multibranch pipeline

Luca Milanesio
Hi Amit,
this message is more for the Jenkins mailing list. However, as I am watching actively both, I'm happy to answer :-)

On 6 Aug 2019, at 06:57, amit r <[hidden email]> wrote:

Hi All, 


i'm not sure who to send this so trying here to get some answer for my use case..

i'm trying to use the plugin gerrit-code-review-plugin  in my project using multi branch pipeline.
installed all the pre plugins in order to use it  but as mentioned in the wiki page:

not clear enough how to use it from scratch.
i assumed that need the gerrit trigger section in my jenkinsFile  so did this one:
triggers {
gerrit(
serverName: 'Gerrit Server',
gerritProjects: [[
compareType : 'ANT',
pattern : 'env.GERRIT_PROJECT',
branches : [[
compareType: 'REG_EXP',
pattern : 'env.BRANCH_NAME'
]]
]],
triggerOnEvents: [
changeMerged(),
patchsetCreated()
],
skipVote: [
onSuccessful: false,
onFailed : false,
onUnstable : false,
onNotBuilt : false
]
)
}

The above example doesn't match any of the other examples mentioned in the Gerrit Code Review plugin.

See the scripted and declarative pipelines examples at:

 but now no matter what happens - i never get any event for the merged one - only for patchsetCreated

1. is there something i'm missing here?
2. does this plugin should support this cases?

Yes, it is designed for being used in a multi-branch pipeline.

3. how can i still use the branch scanning that exist in multibranch pipeline in case i also have cases that my automation push code into gerrit so will have here endless loop...

Endless loop? Can you clarify the details?

4. what about webhooks in gerrit it self? is it something different? 

Webhooks can be used to trigger the branch reindexing also.
Just configure them in Gerrit to point to Jenkins's URL /gerrit-webhook

HTH

Luca.


any help with this will save my day! i'm trying to resolve these issues for long time with not much luck...

many thanks in advance!!
Amit Rintzler 

--
--
To unsubscribe, [hidden email]
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/12c7c061-8ffa-444f-a277-ec34b66c6dc3%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/869C42B4-9DA0-4ACB-90D3-944E665A9070%40gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: gerrit-code-review-plugin integrated with multibranch pipeline

amit r


בתאריך יום רביעי, 7 באוגוסט 2019 בשעה 10:49:42 UTC+3, מאת Luca Milanesio:
Hi Amit,
this message is more for the Jenkins mailing list. However, as I am watching actively both, I'm happy to answer :-)
thank you for this!! - pls see my answers inline 

On 6 Aug 2019, at 06:57, amit r <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="Lj_R_TurFgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">amitri...@...> wrote:

Hi All, 


i'm not sure who to send this so trying here to get some answer for my use case..

i'm trying to use the plugin gerrit-code-review-plugin  in my project using multi branch pipeline.
installed all the pre plugins in order to use it  but as mentioned in the wiki page:

<a href="https://wiki.jenkins.io/display/JENKINS/Gerrit+Code+Review+Plugin" rel="nofollow" style="color:rgb(17,85,204)" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins.io%2Fdisplay%2FJENKINS%2FGerrit%2BCode%2BReview%2BPlugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF-epGSuQilBkqB6gzCVbBORgGyvQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins.io%2Fdisplay%2FJENKINS%2FGerrit%2BCode%2BReview%2BPlugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF-epGSuQilBkqB6gzCVbBORgGyvQ&#39;;return true;">https://wiki.jenkins.io/display/JENKINS/Gerrit+Code+Review+Plugin 
not clear enough how to use it from scratch.
i assumed that need the gerrit trigger section in my jenkinsFile  so did this one:
triggers {
gerrit(
serverName: 'Gerrit Server',
gerritProjects: [[
compareType : 'ANT',
pattern : 'env.GERRIT_PROJECT',
branches : [[
compareType: 'REG_EXP',
pattern : 'env.BRANCH_NAME'
]]
]],
triggerOnEvents: [
changeMerged(),
patchsetCreated()
],
skipVote: [
onSuccessful: false,
onFailed : false,
onUnstable : false,
onNotBuilt : false
]
)
}

The above example doesn't match any of the other examples mentioned in the Gerrit Code Review plugin.

See the scripted and declarative pipelines examples at:
<a href="https://github.com/jenkinsci/gerrit-code-review-plugin" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fgerrit-code-review-plugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFaAqMK7HaJI73jtH8twD4sdm4uBA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fgerrit-code-review-plugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFaAqMK7HaJI73jtH8twD4sdm4uBA&#39;;return true;">https://github.com/jenkinsci/gerrit-code-review-plugin

 i did try as mentioned in this link but if i'm not putting any part for the trigger section as you mentioned so the pipeline will not be trigger as it doesnt recognize any event
the only time that it does recognize its when adding the section above but only for patchsetCreated..

 but now no matter what happens - i never get any event for the merged one - only for patchsetCreated

1. is there something i'm missing here?
2. does this plugin should support this cases?

Yes, it is designed for being used in a multi-branch pipeline.
 
do you have example that it works with patchset-created and also with changeMerged events?
3. how can i still use the branch scanning that exist in multibranch pipeline in case i also have cases that my automation push code into gerrit so will have here endless loop...

Endless loop? Can you clarify the details?
 
in my code i have case that for some cases i'm pushing during my CI new changes into gerrit.
now  since i want to use the scanning period in the multibranch pipeline so it will find the new commit that did during my build and trigger new ci for it..
in order to skip these specific ones so added in my jenkinsFile condition that in case msg contains specific UC so it will be aborted - otherwise ,you will get here the endless loop since everytime will get another commit in gerrit that will trigger the next one...

4. what about webhooks in gerrit it self? is it something different? 

Webhooks can be used to trigger the branch reindexing also.
Just configure them in Gerrit to point to Jenkins's URL /gerrit-webhook
 added in my project in gerrit the webhook config but doesnt look that works for all events... - do i need also the hooks or not needed? 

HTH

Luca.
many thanks for your help here

any help with this will save my day! i'm trying to resolve these issues for long time with not much luck...

many thanks in advance!!
Amit Rintzler 

-- 
-- 
To unsubscribe, <a href="javascript:" target="_blank" gdf-obfuscated-mailto="Lj_R_TurFgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">email rep...@googlegroups.com
More info at <a href="http://groups.google.com/group/repo-discuss?hl=en" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://groups.google.com/group/repo-discuss?hl\x3den&#39;;return true;" onclick="this.href=&#39;http://groups.google.com/group/repo-discuss?hl\x3den&#39;;return true;">http://groups.google.com/group/repo-discuss?hl=en

--- 
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="Lj_R_TurFgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">repo-d...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/repo-discuss/12c7c061-8ffa-444f-a277-ec34b66c6dc3%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/repo-discuss/12c7c061-8ffa-444f-a277-ec34b66c6dc3%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/repo-discuss/12c7c061-8ffa-444f-a277-ec34b66c6dc3%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/repo-discuss/12c7c061-8ffa-444f-a277-ec34b66c6dc3%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a4202492-ed4b-4ed5-a7cb-26fdfd0f389e%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: gerrit-code-review-plugin integrated with multibranch pipeline

Luca Milanesio


On 7 Aug 2019, at 09:15, amit r <[hidden email]> wrote:



בתאריך יום רביעי, 7 באוגוסט 2019 בשעה 10:49:42 UTC+3, מאת Luca Milanesio:
Hi Amit,
this message is more for the Jenkins mailing list. However, as I am watching actively both, I'm happy to answer :-)
thank you for this!! - pls see my answers inline 

On 6 Aug 2019, at 06:57, amit r <[hidden email]> wrote:

Hi All, 


i'm not sure who to send this so trying here to get some answer for my use case..

i'm trying to use the plugin gerrit-code-review-plugin  in my project using multi branch pipeline.
installed all the pre plugins in order to use it  but as mentioned in the wiki page:

not clear enough how to use it from scratch.
i assumed that need the gerrit trigger section in my jenkinsFile  so did this one:
triggers {
gerrit(
serverName: 'Gerrit Server',
gerritProjects: [[
compareType : 'ANT',
pattern : 'env.GERRIT_PROJECT',
branches : [[
compareType: 'REG_EXP',
pattern : 'env.BRANCH_NAME'
]]
]],
triggerOnEvents: [
changeMerged(),
patchsetCreated()
],
skipVote: [
onSuccessful: false,
onFailed : false,
onUnstable : false,
onNotBuilt : false
]
)
}

The above example doesn't match any of the other examples mentioned in the Gerrit Code Review plugin.

See the scripted and declarative pipelines examples at:

 i did try as mentioned in this link but if i'm not putting any part for the trigger section as you mentioned so the pipeline will not be trigger as it doesnt recognize any event

The Gerrit Code Review plugin isn't a trigger at all, you can watch the presentation video at:

The plugin is a branch source, whilst the triggering is left to the Gerrit webhook.

the only time that it does recognize its when adding the section above but only for patchsetCreated..

I believe you are using the Gerrit Trigger plugin, and NOT the Gerrit Code Review plugin then.


 but now no matter what happens - i never get any event for the merged one - only for patchsetCreated

1. is there something i'm missing here?
2. does this plugin should support this cases?

Yes, it is designed for being used in a multi-branch pipeline.
 
do you have example that it works with patchset-created and also with changeMerged events?

It doesn't listen for any event, it's a branch source.

3. how can i still use the branch scanning that exist in multibranch pipeline in case i also have cases that my automation push code into gerrit so will have here endless loop...

Endless loop? Can you clarify the details?
 
in my code i have case that for some cases i'm pushing during my CI new changes into gerrit.
now  since i want to use the scanning period in the multibranch pipeline so it will find the new commit that did during my build and trigger new ci for it..
in order to skip these specific ones so added in my jenkinsFile condition that in case msg contains specific UC so it will be aborted - otherwise ,you will get here the endless loop since everytime will get another commit in gerrit that will trigger the next one...

You can configure what are the refs you want the multibranch pipeline to fetch and filter out the ones you don't need.


4. what about webhooks in gerrit it self? is it something different? 

Webhooks can be used to trigger the branch reindexing also.
Just configure them in Gerrit to point to Jenkins's URL /gerrit-webhook
 added in my project in gerrit the webhook config but doesnt look that works for all events... - do i need also the hooks or not needed? 

It triggers for *ALL* events generated by Gerrit. What are the ones you are expecting?

HTH

Luca.


HTH

Luca.
many thanks for your help here

any help with this will save my day! i'm trying to resolve these issues for long time with not much luck...

many thanks in advance!!
Amit Rintzler 

-- 
-- 

--- 
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-d...@googlegroups.com.


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a4202492-ed4b-4ed5-a7cb-26fdfd0f389e%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8005B40A-5B44-494B-A02F-814AB20B49A6%40gmail.com.