Skip to content

Instantly share code, notes, and snippets.

@samplenull
Created July 8, 2014 18:54
Show Gist options
  • Save samplenull/d8a566124ae76f7695ab to your computer and use it in GitHub Desktop.
Save samplenull/d8a566124ae76f7695ab to your computer and use it in GitHub Desktop.
Jenkins Extensible Choice Branch select
def gettags = "git ls-remote git@bitbucket.org:mycomp/myrepo.git".execute()
def tags = []
def t1 = []
gettags.text.eachLine {tags.add(it)}
for(i in tags) {
def branch = i.split()[1].replaceAll('\\^\\{\\}', '').replaceAll('refs/heads/', '')
if (branch != 'HEAD'){
t1.add(branch)
}
}
t1 = t1.unique()
return t1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment