简体   繁体   中英

Execute the git describe command from jenkins

I am new to Jenkins. The idea is to have a git tag on the master branch. Only by having a tag will we have the no_commits_since_last_tag number to set in the build number. The trick is to execute the git describe command from Jenkins in order to determine the tag number and the no commits number.

How could i execute git describe from Jenkins?

I am not shore if i can run this command. If i add a groovy script or a shell script (after build).

Following GIT plugins are installed:

Git plugin Git client plugin

a shell script 'after build' would suffice, a quick and dirty example:

last_tag=$(git describe)
echo $last_tag

you can the use the variable in any following logic.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM