entagen / jenkins-build-per-branch

http://entagen.github.io/jenkins-build-per-branch/
Apache License 2.0
190 stars 183 forks source link

Newly cloned jobs are not buildable and therefore polling does not work #92

Open yakobe opened 9 years ago

yakobe commented 9 years ago

Apparently there has been a change in how jobs are saved which means that cloned jobs need to be saved before jenkins marks them as 'buildable'. You can still manually start the build but polling does not work. The issue is here: https://issues.jenkins-ci.org/browse/JENKINS-30745

Perhaps it is possible to save the newly created jobs immediately so this is not a problem in the short term?

arendjantetteroo commented 9 years ago

I was bitten by this as well. You can work around it by saving the config after enabling the project.

See lines 68 till 73 https://github.com/arendjantetteroo/jenkins-build-per-branch/blob/master/src/main/groovy/com/entagen/jenkins/JenkinsApi.groovy

I've updated my version to work with gradle 2.x, so I can't easily do a PR with this change.

It seems a bit of a hack, but it works for me

yakobe commented 9 years ago

Hey, thanks for the answer! I am trying to implement that too. I have tried before and after enabling but the polling still does not work. After enabling cause the project to be disabled again (because the template job is diabled). Are you sure that polling works again with the latest jenkins? Any help would be greatly appreciated

arendjantetteroo commented 9 years ago

I'm on 1.632 and it works.

Isee that you do another disable /enable after saving the config. That might be the issue? Maybe when it's disabled the polling is stopped again?

yakobe commented 9 years ago

My template job is disabled so i need to force enable. I have tried various configurations (disable before and enable after, both before, both after, both before and after). Nothing worked. :unamused: It appears that when you run post('job/' + missingJob.jobName + "/config.xml", missingJobConfig, [:], ContentType.XML) it overwrites the config again so the enable/disable bit is gone. And the polling still doesnt work. So annoying that they change the core jenkins functionality without thinking about the consequences. Do you know of any other api way to save the job again?

arendjantetteroo commented 9 years ago

Ah, i have an already enabled job that i copy. I just post the complete config back because all settings are ok for me.

Maybe you can change the enabled/disabled bit in the config.xml before resaving it?