Not able to trigger Github Organization folder job automatically

1,484 views
Skip to first unread message

Harsha Adiga

unread,
Aug 15, 2016, 3:47:24 PM8/15/16
to Jenkins Users

I am doing a POC using GitHub Organization Folder plugin. I have created a job selecting Git Hub Organization as the type. I have configured it to scan my org using the personal access token that I have generated in my Github account. I am using my Enterprise Git hub. I have also created a webhook at the org level as below:

http://<Jenkins URL>/github-webhook/  (I have selected content type as  "application/x-www-form-urlencoded" and selected "Send me everything" option)

I am able to scan the organization and create folders and jobs for all my repos. 

But I am not able to trigger my Jenkins job automatically when a new repo is created in my GitHub organization. I see that the webhook is getting fired on new repo creation. I also see the event logged in Jenkins logs. But the job is not getting triggered. I need to manually run "Re-scan organization" to get jobs created for the new repo.  But once the jobs are created any future commits to the repo or even branch creation is able to trigger the jenkins build job automatically. Only the new repo creation is not working. I am using Jenkins v 2.7.2 and Git Hub Org folder plugin v 1.4. Can someone please help me?


Patrick Wolf

unread,
Aug 15, 2016, 3:54:07 PM8/15/16
to jenkins...@googlegroups.com
How are you creating the Jenkinsfile?  When a new repository is created the repository trigger will be sent but the Github Organization Folder plugin won't do anything at that point because it assumes the repository is empty. If the repository is created from a fork and a Jenkinsfile is already there then Jenkins should create a job for that repository right away.

You can see that code here:


The first push to the new repository that contains a Jenkinsfile should trigger Jenkins to create the job at that point based on the Push webhook sent from Github.  Is that not working correctly?

--
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 jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/2edb9a66-be61-4bea-85fb-77e3ab3eeb7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Patrick Wolf
Product Director - Jenkins 
CloudBees

Harsha Adiga

unread,
Aug 15, 2016, 4:03:55 PM8/15/16
to Jenkins Users
Hi Patrick,

Thanks for the quick reply. Yes I am creating an empty repository without Jenkinsfile at first and then adding the Jenkins file as a new file commit. I was expecting my job to get triggered at this point when I add the Jenkinsfile. But it is not doing that. Am I missing something here? Does the plugin expect the repo to have a Jenkinsfile at the time of creation itself?

Regards,
Harsha


On Monday, 15 August 2016 15:54:07 UTC-4, Patrick Wolf wrote:
How are you creating the Jenkinsfile?  When a new repository is created the repository trigger will be sent but the Github Organization Folder plugin won't do anything at that point because it assumes the repository is empty. If the repository is created from a fork and a Jenkinsfile is already there then Jenkins should create a job for that repository right away.

You can see that code here:


The first push to the new repository that contains a Jenkinsfile should trigger Jenkins to create the job at that point based on the Push webhook sent from Github.  Is that not working correctly?
On Mon, Aug 15, 2016 at 12:47 PM, Harsha Adiga <harsha...@gmail.com> wrote:

I am doing a POC using GitHub Organization Folder plugin. I have created a job selecting Git Hub Organization as the type. I have configured it to scan my org using the personal access token that I have generated in my Github account. I am using my Enterprise Git hub. I have also created a webhook at the org level as below:

http://<Jenkins URL>/github-webhook/  (I have selected content type as  "application/x-www-form-urlencoded" and selected "Send me everything" option)

I am able to scan the organization and create folders and jobs for all my repos. 

But I am not able to trigger my Jenkins job automatically when a new repo is created in my GitHub organization. I see that the webhook is getting fired on new repo creation. I also see the event logged in Jenkins logs. But the job is not getting triggered. I need to manually run "Re-scan organization" to get jobs created for the new repo.  But once the jobs are created any future commits to the repo or even branch creation is able to trigger the jenkins build job automatically. Only the new repo creation is not working. I am using Jenkins v 2.7.2 and Git Hub Org folder plugin v 1.4. Can someone please help me?


--
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 jenkinsci-use...@googlegroups.com.

Patrick Wolf

unread,
Aug 15, 2016, 4:13:02 PM8/15/16
to jenkins...@googlegroups.com
Do you know if the Push Event webhook is received by Jenkins when you create the Jenkinsfile?

"Does the plugin expect the repo to have a Jenkinsfile at the time of creation itself?"

Just the opposite. The plugin expects the repo to be empty at the time of creation unless the repo is created by a fork. That is why the first Push Event is so important.



To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/264a62fc-f425-4769-ac5e-09a6448b0b25%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Harsha Adiga

unread,
Aug 15, 2016, 5:03:54 PM8/15/16
to Jenkins Users
I think yes Jenkins is receiving the event. I can see the below line in System Logs:

Aug 15, 2016 4:17:13 PM INFO org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber onEvent
Received POST for https://<jenkins URL>/<Org>/TestRepo_MultiBranchPipeline3

Do you know where can I see more detailed logs? I see the attached message in the GitHub payload.

Also when I fork my repos (ones that already have a Jenkinsfile) my job is getting triggered automatically.

Regards,
Harsha
Screen Shot 2016-08-15 at 4.55.46 PM.png

Harsha Adiga

unread,
Aug 17, 2016, 2:21:06 PM8/17/16
to Jenkins Users
Hi Patrick,

Any updates on this query? Do you need any more information from me?

Regards,
Harsha

Patrick Wolf

unread,
Aug 17, 2016, 6:13:18 PM8/17/16
to jenkins...@googlegroups.com
Can you confirm if this is the same behavior you are seeing?


If so, add your comments here so we can track all of it.

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/2c569b1d-35bb-43b3-b59f-0f946d98b9cf%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Harsha Adiga

unread,
Aug 18, 2016, 10:36:20 AM8/18/16
to Jenkins Users
Hi Patrick,

Yes that is exactly the same behaviour that I am seeing. I will add my comments there. Do you have an ETA when we can expect this to get resolved? Its a major blocking issue for us proceed with our automation efforts.

My company also has a dedicated cloudbees support channel. Will it be better to also raise this through that channel? 

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