Last active
          November 16, 2017 03:48 
        
      - 
      
- 
        Save gavincampbell/480843552e43efa84c60f9bb4840d6c1 to your computer and use it in GitHub Desktop. 
    Branching in the Jenkinsfile
  
        
  
    
      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
    
  
  
    
  | 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() | |
| } | 
  
    
      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
    
  
  
    
  | def run_build(){ | |
| echo "Hello, I'm building the master branch." | |
| } | |
| return this | 
  
    
      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
    
  
  
    
  | 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