I have a Jenkins multibranch pipeline hooked with GIT repo to do build from master and dev branches whenever a commit or pull request happens. I did the first time pull request from dev to master and build triggered correctly. Now I did a snapshot commit in dev branch but when the auto build is triggered through Jenkins it is taking the pom artifact version from master branch and not the snapshot which I updated in dev branch.
My pipeline looks like:
checkout([
$class: 'GitSCM',
branches: [[name: '**']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'CleanCheckout']],
userRemoteConfigs: [[credentialsId: "xxx",
url: 'ssh://somerepo/scm/anycomponent.git']]])
Log file from Jenkins:
[Pipeline] checkout
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url ssh://somerepo/scm/anycomponent.git # timeout=10
Fetching upstream changes from ssh://somerepo/scm/anycomponent.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials
> git fetch --tags --progress ssh://somerepo/scm/anycomponent.git +refs/heads/*:refs/remotes/origin/*
Seen branch in repository origin/development
Seen branch in repository origin/master
Seen 2 remote branches
> git show-ref --tags -d # timeout=10
Multiple candidate revisions
Checking out Revision 01t34567h9d94f3d1f99cb3e438n6789a5d17d2i (origin/master, refs/tags/SOME_TAG)
> git config core.sparsecheckout # timeout=10
> git checkout -f 01t34567h9d94f3d1f99cb3e438n6789a5d17d2i
Commit message: "Merge pull request #1 in REPO from development to master"
First time build. Skipping changelog.
Cleaning workspace
> git rev-parse --verify HEAD # timeout=10
Resetting working tree
In the logs I can see Jenkins is taking the master pull request version and not the one I recently committed in Dev branch.
Any suggestion on what is wrong here?