ginsul

Untitled

Aug 17th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 0.73 KB | None | 0 0
  1.     def target_profile
  2.     def active_branch = env.BRANCH_NAME
  3.  
  4.     switch(active_branch) {
  5.         case ~/master/:
  6.             target_profile = "test"
  7.             break
  8.         case ~/dev-.*/:
  9.             target_profile = "test"
  10.             break
  11.         case ~/test-.*/:
  12.             target_profile = "test"
  13.             break
  14.         case ~/staging-.*/:
  15.             target_profile = "staging"
  16.             break
  17.         case ~/canary-.*/:
  18.             target_profile = "canary"
  19.             break
  20.         case ~/prod-.*/:
  21.             target_profile = "prod"
  22.             break
  23.         default:
  24.             sh "echo Branch '${active_branch}' did not meet the naming criteria. Ignoring."
  25.             return
  26.             break
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment