Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 634
vladm Avatar asked Mar 15 '26 07:03

vladm


1 Answers

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.

like image 126
blotto Avatar answered Mar 17 '26 23:03

blotto