Last active
November 14, 2018 13:04
-
-
Save zagy/5345d730c70005e3c75fad4090998fee to your computer and use it in GitHub Desktop.
This file contains 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
// copied from http://www.aimtheory.com/jenkins/pipeline/continuous-delivery/2017/12/02/jenkins-pipeline-global-shared-library-best-practices.html | |
// /src/org/acme/pythonPipeline.groovy | |
#!/usr/bin/groovy | |
package org.acme; | |
pythonPipeline(pipelineDefinition) { | |
// Create a globally accessible variable that makes | |
// the YAML pipeline definition available to all scripts | |
pd = pipelineDefinition | |
} | |
def executePipeline() { | |
node { | |
if (runTests) { | |
stage('Run Tests') { | |
sh pd.testCommand | |
} | |
} | |
if (deployUponTestSuccess) { | |
stage('Deploy') { | |
sh "path/to/a/deploy/bash/script.sh ${pd.deploymentEnvironment}" | |
} | |
} | |
} | |
} | |
return this |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment