I have a webhook in GitLab to trigger a Jenkins job when ever a new tag is created. Is there a way to use the new tag that triggered the Jenkins job in the Jenkins job? For example, lets say I pushed the tag v.1.5
to my repo.
git tag -a v1.5 -m "version 1.5"
git push --tags
Now, I want to use the tag v.1.5
in the shell execution in the Jenkins build (Execute shell).
echo <tag that triggered this job>
Is there a way to read and use the tag from the POST request?
You can read the tag from the local repo using git describe
.
tag=$(git describe --tags)
echo "tag = "$tag
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.