Jarod Ma Jarod Ma - 1 day ago 4
Groovy Question

Push a tag with Jenkins Job DSL

I want to add a tag to push to a remote repository
So I create a job like this

job('example-2') {
scm {
git('ssh://git@abc.git', 'branchName')
}
steps {
shell('sh XXXX')
}
publishers {
git {
pushOnlyIfSuccess()
tag('ssh://git@abc.git', 'v1.6') {
message('Release v1.6')
create()
update()
}
}
}
}


The function tag(?,?)'s parameter is right?
It seems not work.

Answer

It is right likes this

git {
          remote {
              name("abc")
              url("ssh://git@abc.git")
          }
          branch('branchName')
      }
tag("abc","v1.6") {
......
Comments