I have a Jenkins Bitbucket Team/Project job. Inside the Jenkinsfile in my repository I use "git describe" to get the current tag. After I updated to the latest Jenkins version (2.60.3) and updated most plugins, this fails because Jenkins doesn't fetch tags anymore.
This is what I had before the update:
Branch event
Checking out git https://bitbucket.org/xxxxxxx to read Jenkinsfile
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://bitbucket.org/xxxxx.git # timeout=10
Fetching upstream changes from https://bitbucket.org/xxxx.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials Admin user to clone bitbucket repositories
> git fetch --tags --progress https://bitbucket.org/xxxxx.git +refs/heads/master
This is what I have now:
Branch event
Checking out git https://bitbucket.org/xxxx.git into /var/lib/jenkins/jobs/xxxx/jobs/xxx/branches/master/workspace@script to read Jenkinsfile
Cloning the remote Git repository
Cloning with configured refspecs honoured and without tags
Cloning repository https://bitbucket.org/xxxxx.git
> git init /var/lib/jenkins/jobs/xxx/jobs/xxxx/branches/master/workspace@script # timeout=10
Fetching upstream changes from https://bitbucket.org/xxx.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials Admin user to clone bitbucket repositories
> git fetch --no-tags --progress https://bitbucket.org/xxxx.git +refs/heads/master:refs/remotes/origin/master
This is the plugins I have installed:
The default behaviour changed. It's not fetching tags anymore (uses --no-tags). I couldn't find any settings to force jenkins to fetch tags. In Bitbucket Team/Project settings, you can setup "Advanced clone behaviours":
"Do not fetch tags" is not selected. So I'd think that it should fetch tags by default...
Anyone having similar issue? How can I force Jenkins to fetch tags in a Bitbucket Team/Project job?
I created a Jenkins issue and got some explanations (thanks to Stephen Connolly): https://issues.jenkins-ci.org/browse/JENKINS-46736
The solution is just to add the "Advanced Clone Behaviours" and to leave "Do not fetch tags" unchecked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With