We have a large Hudson set up with many scheduled builds running all the time. Currently I'm trying to get one build to work properly, but I have to occasionally wait when a scheduled build enters the queue. Is there a way to disable all the scheduled builds so I can concentrate on my troublesome build, without adjusting the "cron" settings of each individual build?
I don't see a direct way to do it, but you could write something that updates the config.xml for all jobs.
In each job's directory in hudson, there's a config.xml. The <project> has an element called disabled that you could update to true, thereby disabling that build.
Not ideal, but once you have the script to walk a directory and change the value of disabled, you can always use it.
Tell it to prepare to shut down.
Edit from OP (banjollity)
It's not perfect, but I think this is a reasonable "few mouse clicks solution with a default install" kind of solution, hence the accepted answer.
- Queue up a job
- Tell Hudson to prepare to shut down. This prevents other jobs being run in the meantime.
- Diagnose faults with my job, commit new code that might fix it. (I love my job).
- Cancel Hudson shut down.
- Goto step 1.
The 'configuration slicing' plugin I contributed allows you to modify the cron settings of many jobs simultaneously. This should allow you to make the bulk changes you want.
Expanding upon Mikezx6r's suggestion, I just came up with a quick method to disable all builds matching a certain string:
[user@server jobs] $ for i in *build_name*; do sed -i s/"disabled>false"/"disabled>true/" $i/config.xml; done
You could also iterate through specific build names in the "for" loop:
[user@server jobs] $ for i in build1 build2 build3; do sed -i s/"disabled>false"/"disabled>true/" $i/config.xml; done
You can test it first to see what it will do by putting an "echo" before sed:
[user@server jobs] $ for i in build1 build2 build3; do echo sed -i s/"disabled>false"/"disabled>true/" $i/config.xml; done
Conversely, you can re-enable all matching jobs by switching around the sed script:
[user@server jobs] $ for i in build1 build2 build3; do sed -i s/"disabled>true"/"disabled>false/" $i/config.xml; done
A search for something similar brought me to this question, and I realized there's another benefit of Michael Donohue's answer (and the plugin he contributed).
With "Configuration Slicing," it's easy to disable a subset of your jobs all at once. That's exactly what I needed to temporarily disable 7 of 8 related jobs so I could work on the 8th. Thanks Michael!