In this part of the Jenkins tutorial series, we will dive into Jenkins Pipeline Options. With options, you can configure the pipeline and change some pipeline behaviours. You may need to read the previous articles before continue reading here.

If you are interested in this tutorial series, STAR this repo:

Follow our social media:

Jenkins Pipeline Options:

Several pipeline options exist in Jenkins. Some of them are native, and some of them are added due to installing plugins. Today I’ll explain all the options available in the Jenkins stack. You can deploy this stack both on Kubernetes and Docker. The following repositories are everything you need to deploy the Jenkins complete stack.

How to configure Pipeline options:

Pipeline Options are set inside the options block of pipeline.

Here is an example:

So let’s introduce available options and their works.

buildDiscarder shown in the above example, is used to delete old builds and artefacts. You can set the rotator based on the days and numbers of the builds and artefacts.

checkoutToSubdirectory is used to change the directory of checkout scm command to a subdirectory of the pipeline workspace.


copyArtifactPermission is used to define the list of projects allowed to copy the artefacts of this job. You can learn more about copying artefacts from its plugin document.


disableConcurrentBuilds is used to turn off concurrent builds.


disableResume turns off the build resume function if the controller of Jenkins gets restarted. The controller is Jenkins master.


durabilityHint is used to override the speed/durability option of the job. You can make jobs recoverable after the controller outage (it consumes more time and more disk writes), or you can create jobs faster (it cannot be recoverable in the case of an unplanned outage). This option is advanced and should be used with care.

  • MAX_SURVIVABILITY: Maximum durability but slowest.
  • SURVIVABLE_NONATOMIC: Mix of durability and better speed.
  • PERFORMANCE_OPTIMIZED: Run like a rabbit.

CAUTION: In the case of PERFORMANCE_OPTIMIZED, the Jenkins controller should be shut down gracefully to save running pipelines.


newContainerPerStage is used in conjunction with the docker and dockerfile top-level agent. Without using this option, all pipeline stages are run in the same container. By adding this option, each stage will be run in a separate container but on the same node.

parallelsAlwaysFailFast is used to failFast all parallel stages. If any stage of parallel stages fails, the other ones are aborted, and the build status will be a failure. It’s an advanced option and should be used with care.


preserveStashes is used to preserve stashed files. While building a job, some files may be created and removed at the end of the build. In some scenarios, you must restart the build from a specific stage. In this case, you need the temporary files created during the previous build. Stash is here to achieve this need.


quietPeriod is used to quiet build for a specific period. When a job is triggered, a new build is put on the queue, but for a period set by this option, Jenkins does not start it.


retry the pipeline body for N times if any exception happens.


skipDefaultCheckout is used to stop automatic checkout while entering a new agent. You must checkout manually with checkout scm command.


skipStagesAfterUnstable skips the further stages if the build status becomes UNSTABLE. It is used to stop the whole pipeline.


timeout is used to specify the build timeout. By default, builds don’t have any timeout limit. If timeout is set, After the timeout is reached, the FlowInterruptedException is thrown, and the pipeline is aborted.

timeout(time: 300, unit: "SECONDS")

Final words:

A great many options exist in Jenkins. Several of them are native options, and many of them are added by plugins. In this article, I tried to explain some of them, but I intend to dive deeply into each one in future articles.

You can find all tutorial materials in the following GitHub repository:

If you like this series of articles, please share them and write your thoughts as comments here. Your feedback encourages me to complete this massively planned program.

Follow my LinkedIn

Follow Kubedemy LinkedIn

Follow Kubedemy Telegram

Leave a Reply

Your email address will not be published. Required fields are marked *