August 2017
Intermediate to advanced
332 pages
9h 16m
English
We already mentioned in Chapter 4, Continuous Integration Pipeline, that a pipeline can have input parameters. We can use them to provide different use cases with the same pipeline code. As an example, let's create a pipeline parametrized with the environment type:
pipeline { agent any parameters { string(name: 'Environment', defaultValue: 'dev', description: 'Which environment (dev, qa, prod)?') } stages { stage('Environment check') { steps { echo "Current environment: ${params.Environment}" } } }}
The build takes one input parameter, Environment. Then, all we do in this step is print the parameter. We can also add a condition to execute different code for different environments.
With this configuration, when we start ...
Read now
Unlock full access