javaposse.jobdsl.dsl.helpers.step.StepContextHelper.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.step
import com.google.common.base.Preconditions
import javaposse.jobdsl.dsl.JobType
import javaposse.jobdsl.dsl.WithXmlAction
import javaposse.jobdsl.dsl.helpers.AbstractContextHelper
class StepContextHelper extends AbstractContextHelper {
StepContextHelper(List withXmlActions, JobType jobType) {
super(withXmlActions, jobType)
}
def steps(Closure closure) {
Preconditions.checkState(type != JobType.Maven, "steps cannot be applied for Maven jobs")
execute(closure, new StepContext(type))
}
Closure generateWithXmlClosure(StepContext context) {
return { Node project ->
def buildersNode
if (project.builders.isEmpty()) {
buildersNode = project.appendNode('builders')
} else {
buildersNode = project.builders[0]
}
context.stepNodes.each {
buildersNode << it
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy