Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

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

Open
yakobe opened this issue Oct 6, 2015 · 5 comments
Open

Comments

@yakobe
Copy link

yakobe commented Oct 6, 2015

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
Copy link

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
Copy link
Author

yakobe commented Oct 14, 2015

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
Copy link

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
Copy link
Author

yakobe commented Oct 14, 2015

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. 😒
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
Copy link

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants