Reputation: 60083
Normally we use gerrit trigger plugin in jenkins to download the gerrit changeset.
But in some case, we want to download the specific changesets directly.
For example openstack Change #503032
git pull git://git.openstack.org/openstack/tripleo-quickstart-extras refs/changes/32/503032/2
And set the Refspec
to refs/changes/32/503032/2
in git repo like
And enable the Honor refspec on initial clone
in Additional behaviours like
But I got error in console log
Fetching upstream changes from git://git.openstack.org/openstack/tripleo-quickstart-extras > git fetch --tags --progress git://git.openstack.org/openstack/tripleo-quickstart-extras refs/changes/32/503032/2 --depth=1 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10 > git rev-parse origin/master^{commit} # timeout=10 ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
Any suggestion, we don't want to use the extra command in shell build step.
Upvotes: 4
Views: 4133
Reputation: 3453
Set the Refspec
to refs/changes/32/503032/2:refs/changes/32/503032/2
and Branches to build
to refs/changes/32/503032/2
Alternetively, you can push the change to another branch and point to that branch from Branches to build
.
Upvotes: 0
Reputation: 383
Set "Branch" to FETCH_HEAD
and the specified refspec will be checked out.
FETCH_HEAD
is a temporary ref pointing to the latest fetched refspec, eg. branch, commit. See this question for more information: What does FETCH_HEAD in Git mean?.
Upvotes: 9