In my pipeline I have this:
steps {
script
{
def TAG_NAME = env.GIT_BRANCH.split("/")[1]
}
sshagent(credentials: ["<snip>"]) {
sh """
git tag -a "v.${TAG_NAME}.${env.BUILD_NUMBER}" -m "Add tag"
git push --tags
"""
}
}
But when this runs, I see that TAG_NAME is 'null.'
How do I make it so that I can see it in the sshagent.
A declarative pipeline example to set and get variables across the stages in a different ways .
on your example, it could be