Use what is known as a parameterized pipeline. You can set default environment variables for code runs.
when you want to change the behavior of the pipeline stage you can modify the parameter. If you set the toggle parameter to false in the UI, or by calling the build via URL, it will now skip the first stage because it's not true
Calling via URL: http://server/job/project/buildWithParameters?toggle=false
pipeline {
agent any
parameters {
booleanParam(name: 'toggle', defaultValue: true)}
stages {
stage('optional stage'){
when (toggle: true){
sh `make clean`}}}}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Use what is known as a parameterized pipeline. You can set default environment variables for code runs.
when
you want to change the behavior of the pipeline stage you can modify the parameter. If you set the toggle parameter to false in the UI, or by calling the build via URL, it will now skip the first stage because it's not trueCalling via URL:
http://server/job/project/buildWithParameters?toggle=false