I\'m currently trying to tag a repo from a Jenkins Workflow script. I\'ve tried using a sh step but this runs into problems because of credentials not being set
I've managed to get this working by using the withCredentials step provided by the credentials binding plugin.
Its not great because it involved specifying it all in the URL but these values are masked in the console output.
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'MyID', usernameVariable: 'GIT_USERNAME', passwordVariable: 'GIT_PASSWORD']]) {
sh("git tag -a some_tag -m 'Jenkins'")
sh("git push https://${env.GIT_USERNAME}:${env.GIT_PASSWORD}@ --tags")
}