This plugin executes a groovy script in the Jenkins JVM. Typically, the script checks some conditions and changes accordingly the build result, puts badges next to the build in the build history and/or displays information on the build summary page.
Here’s how to enable a job via the CLI:
java -jar $HOME/cli/jenkins-cli.jar -auth <username>:<password> -s <jenkins url> enable-job “<name of job>”
If you get this message when running a Jenkins job:
pending—In the quiet period. Expires in
then you’re running into the Quiet Period feature of Jenkins. i.e. essentially you can make Jenkins wait before building to allow for commit bursts.
Scripted is a general purpose DSL and executed from the top of a
Jenkinsfile downwards like most traditional scripts in Groovy.
try/catch/throw – https://jenkins.io/doc/book/pipeline/syntax/#flow-control
- Declarative pipelines have a
/*... code here ...*/
- executing a scripted pipeline in a Declarative Pipeline
script step takes a block of Scripted Pipeline and executes that in the Declarative Pipeline
Jenkins Pipeline uses Groovy to build the “Scripted Pipeline” DSL.
By default, Pipeline builds go through in order.
The milestone plugin forces all builds to go through in order.
i.e. an older build cannot pass a milestone if a newer build has passed it.
node allocates an executor on a Jenkins node (aka a slave) and runs code in the context of the workspace on that node.
Another wrinkle on
node‘s. There is also the concept of flyweight and heavyweight executors. A flyweight executor is just a thread and runs inside the Java master’s JVM. A heavyweight executor is a process (e.g.
sh ) and will halt the flow on the master so should be allocated to a node. From the docs:
It is recommended to allocate executors to agent machines, rather than on the Jenkins master – to avoid potential security vulnerabilities, Out-Of-Memory and other performance issues. To do this, configure the “# of executors” to ‘0’ on the “master” node (by default this setting is ‘2’).
stage creates a labelled block and show up as columns in the Pipeline Stage view.
See also Jenkins: milestone plugin and this post on Stage vs Lock vs Milestone.
A step is a single action. When a step succeeds it moves onto the next step. When a step fails to execute correctly the Pipeline will fail.
Note also the keyword
Jenkins has a built-in command line interface that allows you to access Jenkins from a script or from your shell. This is convenient for automation of routine tasks, bulk updates, trouble diagnosis, and so on.
This interface is accessed via the Jenkins CLI client, which is a Java JAR file distributed with Jenkins.
You can download the JAR file for the client from the URL “
/jnlpJars/jenkins-cli.jar” on your Jenkins server, e.g. https://jenkins.example.com/jnlpJars/jenkins-cli.jar
java -jar /var/lib/jenkins/cli/jenkins-cli.jar -auth <jenkins username>:<jenkins password> -s http://localhost:8080 help
Other options (instead of help):