use of org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty in project workflow-job-plugin by jenkinsci.
the class WorkflowJob method addTrigger.
public void addTrigger(Trigger trigger) throws IOException {
BulkChange bc = new BulkChange(this);
try {
PipelineTriggersJobProperty originalProp = getTriggersJobProperty();
Trigger old = originalProp.getTriggerForDescriptor(trigger.getDescriptor());
if (old != null) {
originalProp.removeTrigger(old);
old.stop();
}
originalProp.addTrigger(trigger);
removeProperty(PipelineTriggersJobProperty.class);
addProperty(originalProp);
bc.commit();
} finally {
bc.abort();
}
}
use of org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty in project workflow-job-plugin by jenkinsci.
the class WorkflowJob method setTriggers.
public void setTriggers(List<Trigger<?>> inputTriggers) throws IOException {
triggers = null;
BulkChange bc = new BulkChange(this);
try {
PipelineTriggersJobProperty originalProp = getTriggersJobProperty();
removeProperty(PipelineTriggersJobProperty.class);
PipelineTriggersJobProperty triggerProp = new PipelineTriggersJobProperty(null);
triggerProp.setTriggers(inputTriggers);
addProperty(triggerProp);
bc.commit();
originalProp.stopTriggers();
// No longer need to start triggers here - that's done by when we add the property.
} finally {
bc.abort();
}
}
Aggregations