ScriptBuildStep
A build step running a script with the specified content
Example. Runs a script in the checkout directory.
buildType {
// Other Build Type settings ...
steps {
// Other Build Steps ...
script {
scriptContent = "echo 'hello'"
}
Content copied to clipboard }
}
Example. Runs a multiline script in the specified build working directory with an argument referencing to the configuration parameter. Any of stderr output will be treated as errors.
buildType {
// Other Build Type settings ...
steps {
// Other Build Steps ...
script {
name = "Run tests"
workingDir = "tests"
scriptContent = """
echo "Running tests for version %product.version%"
./run_tests.sh "%product.version%"
""".trimIndent()
formatStderrAsError = true
}
Content copied to clipboard }
}
Example. Runs a multiline script in the specified build working directory in the specified Docker container with an argument referencing to the configuration parameter.
buildType {
// Other Build Type settings ...
steps {
// Other Build Steps ...
script {
name = "Run tests in Docker"
workingDir = "tests"
scriptContent = """
echo "Running tests for version %product.version%"
./run_tests.sh "%product.version%"
""".trimIndent()
dockerImage = "nodejs:lts"
dockerImagePlatform = ScriptBuildStep.ImagePlatform.Linux
dockerRunParameters = "--rm --interactive=false"
}
Content copied to clipboard }
}
See also
Constructors
Types
Functions
Deletes all configured build step conditions
Configures build step conditions
Copies parameters of this object to the specified target
Creates an instance of this build step via reflection using a no argument constructor, used during copying. Throws an error if this class doesn't have a default constructor. Subclasses can override it to create an instance without using a default constructor.
Validates this object and reports found errors to the provided consumer
Properties
If enabled, "pull image" command will be run before docker run.
Build working directory for script, specify it if it is different from the checkout directory.