javaposse.jobdsl.dsl.helpers.triggers.TriggerContextHelper.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of job-dsl-core Show documentation
Show all versions of job-dsl-core Show documentation
Javaposse jenkins job-dsl-core
package javaposse.jobdsl.dsl.helpers.triggers
import javaposse.jobdsl.dsl.JobType
import javaposse.jobdsl.dsl.WithXmlAction
import javaposse.jobdsl.dsl.helpers.AbstractContextHelper
//import groovy.xml.XmlUtil
//import hudson.util.Secret
/**
triggers {scm(String cronString)
cron(String cronString)}*/
class TriggerContextHelper extends AbstractContextHelper {
TriggerContextHelper(List withXmlActions, JobType jobType) {
super(withXmlActions, jobType)
}
/**
* Public method available on job {}* @param closure
* @return
*/
def triggers(Closure closure) {
execute(closure, new TriggerContext(withXmlActions, type, []))
}
Closure generateWithXmlClosure(TriggerContext context) {
return { Node project ->
def triggersNode
if (project.triggers.isEmpty()) {
triggersNode = project.appendNode('triggers', [class: 'vector'])
} else {
triggersNode = project.triggers[0]
}
context.triggerNodes.each {
triggersNode << it
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy