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.
fatal: could not read Username for 'https://<repo>': Device not configured
Is there an existing step that can be used either to tag a repo or to get round the credentials problem?
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}@<REPO> --tags")
}