javaposse.jobdsl.dsl.helpers.toplevel.TopLevelHelper.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.toplevel
import com.google.common.base.Preconditions
import javaposse.jobdsl.dsl.JobType
import javaposse.jobdsl.dsl.WithXmlAction
import javaposse.jobdsl.dsl.helpers.AbstractContextHelper
import javaposse.jobdsl.dsl.helpers.AbstractHelper
class TopLevelHelper extends AbstractHelper {
TopLevelHelper(List withXmlActions, JobType jobType) {
super(withXmlActions, jobType)
}
def description(String descriptionString) {
execute {
def descNode = methodMissing('description', descriptionString)
it / descNode
}
}
/**
* "Restrict where this project can be run"
* FullTools&&RPM&&DC
* @param labelExpression Label of node to use, if null is passed in, the label is cleared out and it can roam
* @return
*/
boolean labelAlreadyAdded = false
def label(String labelExpression = null) {
Preconditions.checkState(!labelAlreadyAdded, "Label can only be appplied once")
labelAlreadyAdded = true
execute {
if (labelExpression) {
it / assignedNode(labelExpression)
it / canRoam('false') // If canRoam is true, the label will not be used
} else {
it / assignedNode('')
it / canRoam('true')
}
}
}
/**
* Add environment variables to the build.
*
*
*
*
*
* TEST=foo BAR=123
* false
*
* true
* true
* true
*
*
*/
def environmentVariables(Closure envClosure) {
environmentVariables(null, envClosure)
}
def environmentVariables(Map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy