Skip to content

Instantly share code, notes, and snippets.

@gavincampbell
Last active November 16, 2017 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save gavincampbell/480843552e43efa84c60f9bb4840d6c1 to your computer and use it in GitHub Desktop.
Save gavincampbell/480843552e43efa84c60f9bb4840d6c1 to your computer and use it in GitHub Desktop.
Branching in the Jenkinsfile
node{
checkout scm
def the_one_to_run
if (env.BRANCH_NAME == "master"){
the_one_to_run = load 'master.groovy'
}
else{
the_one_to_run = load 'not-master.groovy'
}
the_one_to_run.run_build()
}
def run_build(){
echo "Hello, I'm building the master branch."
}
return this
def run_build(){
echo "Hello, I'm building a branch, but it isn't the master branch."
}
return this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment