Re-use Git Plugin webhook

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

Re-use Git Plugin webhook

Carles Capdevila Tejada

Hi there,

 

I’m writing an organization plugin for Gitblit (something like Github-branch-source) and I read in the docs that to implement the automatic triggering of jobs when pushing to the SCM a webhook should be implemented. However, I’d like to re-use the webhook of the Git Plugin to do this.

Right now the Gitblit organization projects are not detected by the Git “notifyCommit” webhook given that they are WorkflowJob’s and their getSCMs() method does not see any checkout in the previous builds.

What's more, it seems that the Git hook only acts on the branches already scanned in Jenkins, so it doesn't seem posible to trigger a scan when a new repository/branch is created and pushed into in Gitblit.

 

Is trying to re-use the Git Plugin webhook for an organization plugin a good/bad idea?

Thank you for your attention.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" 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-dev/1390a8c6-cfb1-48f7-8e49-b9aef30dc9ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Re-use Git Plugin webhook

Jesse Glick-4
On Tue, Oct 24, 2017 at 11:08 AM, Carles Capdevila Tejada
<[hidden email]> wrote:
> I read in the docs that to implement the automatic
> triggering of jobs when pushing to the SCM a webhook should be implemented.
> However, I’d like to re-use the webhook of the Git Plugin to do this.

Sure. `github-branch-source` does this. Study it as a kind of
reference implementation, as well as

https://github.com/jenkinsci/scm-api-plugin/blob/master/docs/implementation.adoc

> Right now the Gitblit organization projects are not detected by the Git
> “notifyCommit” webhook given that they are WorkflowJob’s and their getSCMs()
> method does not see any checkout in the previous builds.

You mean, you have standalone Pipeline projects using this SCM. That
is very different from implementing `SCMSource` + `SCMNavigator`.

> What's more, it seems that the Git hook only acts on the branches already
> scanned in Jenkins, so it doesn't seem posible to trigger a scan when a new
> repository/branch is created and pushed into in Gitblit.

So long as Gitblit sends some kind of event when a branch is created,
you should be able to listen to that event.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" 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-dev/CANfRfr32fdjpSNB0U4neOAgsOhURw3cB-qgV-QWdxPJ-LySouw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Re-use Git Plugin webhook

Carles Capdevila Tejada
I solved this by making the 'SCMSource' (GitBlitSCMSource) extend GitSCMSource instead of AbstractGitSCMSource, so far no problems with it, the branches get updated and new branches are also detected on first push.

Thanks!

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" 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-dev/4ddad9a1-eb80-488b-be7a-b8655ccb8662%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.