-
Bug
-
Resolution: Fixed
-
Major
-
None
-
Platform: All, OS: All
When the build-publisher transfers a job to the public Hudson instance, the
entire job configuration is copied verbatim, including the build triggers. This
is problematic as the published builds still attempt to query the SCM and place
themselves in the build queue on the public Hudson instance. Provided the job
is runnable on the public instance, the job will now be run twice! If it is not
runnable (e.g. tied to a label or node that the public instance doesn't know
about), then the job will sit in the public instance's build queue indefinitely.
I think there are two ways to correct this, but neither one is perfect:
1) add the following to the ExternalProjectProperty.doAcceptBuild() [r18636,
line 130]:
for(TriggerDescriptor trigger: project.getTriggers().keySet())
project.save();
2) use an xml filter to replace the <triggers> element in the job's original
config.xml with an empty element, before transmitting it to the public
instance (i.e. in PublisherThread.submitConfig()). [I can provide a patch that
implements this.]
The first option has the benefit of being concise and working through the
standard Hudson core API. However, the job arrives with its build triggers
intact and is loaded for a brief moment before the private instance transmits
the build (running doAcceptBuild() and removing the triggers). The second
option is logically cleaner: it never sends the triggers in the first place, but
it relies on direct hacking of the config.xml instead of working through the
Hudson API.
Thanks for comments. A few points: not sure, why this issue is complete stopper for you - removing trigger via Groovy script works fine (see David's comment above). I'm not aware of any Hudson feature to mark jobs as read only - remove the right to configure/build the project should be sufficient. However, both can be done only if you are publishing Hudson builds on Hudson instance dedicated for publishing builds, but I would expect such dedicated instance.
Agree that disabling the projects is not a good solution (moreover has the same disadvantage as removing the triggers).
I'm afraid that any patch which utilizes QueueDecisionHandler is not a perfect solution as the published job will run e.g. SCM polling, which is not acceptable (at least for us) on public Hudson.
Currently I'm investigating if same approach as in
JENKINS-2494can be used, but it seems to me, that it won't be possible without other changes in Hudson core. As I wrote in my previous comment, if I don't find a good solution in some near future, I'll use the imperfect one discussed above - i.e. this should be (somehow) solved within one month or so.