Jenkins - JenkinsFile

Card Puncher Data Processing

About

Syntax

Scripted Pipeline is written in a limited form of Groovy syntax.

[1, 2, 3] is a list in Groovy whereas [a: 1, b: 2, c: 3] is a map.

The built-in documentation can be found globally at: http://localhost:8080/pipeline-syntax/

node {
    sh 'echo hello world'
}

where:

  • node and sh are build steps

Step parameters

Step parameters are given as key-value pairs:

# Step parameters are given as key-value pairs
readFile file: 'build.properties'
# Shortcut when only one parameter is mandatory
# if parameter is a map, it must be enclosed in parentheses to avoid a syntactic ambiguity.
readFile 'build.properties'
# multiple parameters:
readFile file: 'build.properties', encoding: 'ISO-8859-1'
# nested steps
splitTests parallelism: count(size: 3)

Built-in variable

  • env environment variable: env.PATH or env.BUILD_ID See: Global env variable
  • params parameters defined for the Pipeline. params.MY_PARAM_NAME
  • currentBuild variable from the currentBuild. Example: currentBuild.result, currentBuild.displayName

See http://localhost:8080/pipeline-syntax/globals





Discover More
Card Puncher Data Processing
Jenkins - Pipeline

The pipeline step allows you to define your Pipelines in a more structured way. Pipelines are a series of steps that allow you to orchestrate the work required to build, test and deploy applications....



Share this page:
Follow us:
Task Runner