I want to tag the current git changeset and push the tag from inside the Jenkinsfile. If the tag already exists it must be replaced.
I want to use this logic in orde
To get this working for blue ocean (which uses https connection) use the following:
sshagent(credentials: ["406ef572-9598-45ee-8d39-9c9a227a9227"]) {
def repository = "git@" + env.GIT_URL.replaceFirst(".+://", "").replaceFirst("/", ":")
sh("git remote set-url origin $repository")
sh("git tag --force build-${env.BRANCH_NAME}")
sh("git push --force origin build-${env.BRANCH_NAME}")
}