Using git describe in Jenkins differs from regular clones

8 views
Skip to first unread message

Randall Becker

unread,
Aug 3, 2020, 5:13:00 PM8/3/20
to Jenkins Users
I know I should know the answer to this one, but it's eluding me. When I run git describe from within a Jenkins pipeline, I am getting different results from when git describe is run from a normal clone/checkout. This happens even if I move to a detached head state.

Obviously I'm missing an option in the Git clone in Jenkins but I can't figure out what I'm missing. The current checkout is:

                checkout([$class: 'GitSCM',
                changelog: true,
                poll: true,
                branches: [[name: 'master']],
                extensions: [
                    [$class: 'CleanBeforeCheckout'],
                    [$class: 'SubmoduleOption', disableSubmodules: false, parentCredentials: true,
                        recursiveSubmodules: true, reference: '', trackingSubmodules: false]],
                doGenerateSubmoduleConfigurations: false, extensions: [
                    [$class: 'CleanCheckout'],
                    [$class: 'CloneOption', timeout: 60, shallow: true],
                    [$class: 'CheckoutOption', timeout: 60],
                    ],
                userRemoteConfigs: [[url: 'git://git.samba.org/rsync.git']]])

shallow makes no difference - I don't think it's supported anymore, correct?

Inside Jenkins, git describe reports 47351c2b.
In a standard clone, detached head (or on a branch) at this commit, I get v3.2.3pre1-9-g47351c2b, which is what I'm expecting.

Thanks,
Randall

Randall Becker

unread,
Aug 3, 2020, 5:20:48 PM8/3/20
to Jenkins Users
OK: Blame the operator. shallow: true made the difference. It was shallow: false before. So that makes the difference. I'm now getting the desired results inside Jenkins.

Randall
Reply all
Reply to author
Forward
0 new messages