Jenkins pipeline - git branch Jenkins pipeline - git branch jenkins jenkins

Jenkins pipeline - git branch


You can use SCM checkout plugin with regular expression. I've used to poll the feature branches with the format feature/US1234. Modify like you need.

checkout([$class: 'GitSCM', branches: [[name: ':^(?i)origin/feature/[a-z|A-Z]{2}[0-9].*']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'WipeWorkspace'], [$class: 'LocalBranch', localBranch: '**']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'YOURID', url: 'GITURL']]]) 

Use pipeline syntax generator for more option.