Can I get Jenkins to build a git tag from a passed in parameter?

后端 未结 3 893
北荒
北荒 2020-12-05 13:30

Jenkins supports parametrized builds.

I have a deployment build that requires the tag to deploy to be specified via a parameter. (to deploy a particular tag to produ

3条回答
  •  悲&欢浪女
    2020-12-05 14:18

    Will up oooold topic, since this one is in google's top. Spent some time on this question... Short answer: Extensible choice plugin + groovy script. This allows to make dropdown menu already filled with existing tags.

    def gettags = "git ls-remote -t git@github.com:mycompany/com.someproject.git".execute()
    def tags = []
    def t1 = []
    gettags.text.eachLine {tags.add(it)}
    for(i in tags)
        t1.add(i.split()[1].replaceAll('\\^\\{\\}', '').replaceAll('refs/tags/', ''))
    t1 = t1.unique()
    return t1
    

    Long answer here

提交回复
热议问题