Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save eeichinger/9761870 to your computer and use it in GitHub Desktop.
Save eeichinger/9761870 to your computer and use it in GitHub Desktop.
Groovy script to list git tags and branches using jenkins' Dynamic Choices Parameter plugin
def gettags = ("git ls-remote -t -h ssh://jenkins@<mygitpath>/repo/some.git feature/*").execute()
return gettags.text.readLines()
.collect { it.split()[1].replaceAll('refs/heads/', '') }
.unique()
.findAll { it.startsWith('<some more pattern>') }
@ddutka-creatision
Copy link

the result of this script is the list of branches. How do i get the list of remote tags though?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment