-
New Feature
-
Resolution: Unresolved
-
Minor
-
None
-
Windows
I have npm scripts which do all the magic required for incrementing package versions and generating the tag from that version. When it comes to getting the git plugin to push, however, if I configure the tag name to push as '*',
git tag -l
works the tag is recognised from the command line, and I see that command being issued by the git plugin, however, the tags are not pushed and the plugin errors:
ERROR: Step ‘Git Publisher’ failed: Tag * does not exist and Create Tag is not specified, so failing.
I would expect the git plugin to push any tags matched by the name parameter. Even better if I could just say "push all tags" – tagging doesn't have to be the responsibility of this plugin.
If you're using a Jenkins Pipeline job, you can perform the push directly from the build script using either a withCredentials step (for https) or the sshagent step (for ssh).
The withCredentials step defines variables for the username and password which the statements inside the block can use to reference the username and password in the git command line. Refer to the credentials binding plugin documentation on jenkins.io
A similar technique can be used with git repositories using the ssh protocol by using an sshagent step. Refer to the sshagent pipeline step documentation on jenkins.io