In a jenkins pipeline, I am attempting to pull from a dev branch, tag as 't_int_dev'. later I want to pull tag 't_int_dev' and retag as 't_int_qa' and push that.
The first part works fine:
checkout scmGit( branches: [[name: 'b_dev']], userRemoteConfigs: [[credentialsId: creds, url: repo ]])
sh("""git pull origin b_dev &&
git tag -f t_int_dev &&
git push -f origin t_int_dev""")
But later, when I want to pull the dev tag and retag as qa, I get an error on this line:
checkout scmGit( branches: [[name: 't_int_dev']], userRemoteConfigs: [[credentialsId: creds, url: repo ]])
Jenkins error:
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
why is this happening?
Try with the complete ref name for your target tag:
branches: [[name: 'refs/tags/t_int_dev']]
If you have a message stating that it is an unknown revision, try also setting a refspec which would instruct git to download this tag:
branches: [[name: 'refs/tags/t_int_dev']],
userRemoteConfigs: [
[credentialsId: creds, url: repo],
[refspec: '+refs/tags/t_int_dev:refs/tags/t_int_dev']
]
the above refspec instructs to only download the specific t_int_dev
tag, you may use a more generic refspec:
# download all tags:
refspec: '+refs/tags/*:refs/tags/*'
# download all branches and tags:
refspec: '+refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/*'