Created
November 28, 2016 10:43
-
-
Save macg33zr/a687304194fbc6eab81434bf1a21fafe to your computer and use it in GitHub Desktop.
Jenkins pipeline model definition - how to disable with an environment variable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Check for early exit of a pipeline. The env check has to be inside a node. | |
boolean earlyExit = false | |
node { | |
echo "env.PIPE_DISABLED = ${env.PIPE_DISABLED}" | |
if(env?.PIPE_DISABLED == 'true') { | |
earlyExit = true | |
} | |
} | |
if(earlyExit) { | |
echo "Early exit pipeline as disabled" | |
return | |
} | |
pipeline { | |
// Run on any node | |
agent label: "" | |
stages { | |
stage('foo) { | |
steps { | |
echo "Foo stage executed" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment