-
Bug
-
Resolution: Not A Defect
-
Critical
-
None
-
Jenkins 2.164.1
git-plugin 3.9.3
Pipeline 2.6
We have a pipeline job that get the git branch name as a parameter from the user as a git parameter,
We want this job to also be triggered automatically on commits to branch develop in bitbucket. (The hook is sending the BRANCH=develop parameter as a URL parameter)
When using branch name as a parameter in pipeline checkout step the trigger from Bitbucket hook is not working , and the job is not triggered
checkout([ $class: 'GitSCM', branches: [[name: '*/$BRANCH']], extensions: [[$_class_: 'LocalBranch', localBranch: '$BRANCH']]])
We can set the branch in checkout step to **
checkout([ $class: 'GitSCM', branches: [[name: '**']], extensions: [[$_class_: 'LocalBranch', localBranch: '$BRANCH']]])
Now the hook is working and the build is triggered BUT the jenkins checkout revision is always of the BASE branch (in our case develop)
jenkins console: Checking out Revision <commit_hash> (origin/develop)
and when building manually other branched i.e release/* hotfix/* feature/* master
we always get the develop revision instead of the correct branch revision
(also in GIT_COMMIT parameter)
in addition the Jenkins build changes section will show wrong changes