openshift - How can I set a BuildConfig Git source ref to be a GitHub pull request? -


in openshift docs git source input, says following:

if ref field denotes pull request, system use git fetch operation , checkout fetch_head.

however, there's no example can find of needs put ref match pull request. can't figure out should be, , each variation i've tried, error such this:

error: build error: error: pathspec 'pull/128/head' did not match file(s) known git.

variations i've tried:

  • refs/pull/128/head
  • pull/128/head
  • pull/128
  • 128
  • pr-128
  • origin/pr/128/head
  • origin/pr/128/merge

any appreciated, thanks!


edit: updating new info based on graham's suggestion in comment:

i not sure if shows or not part, set build_loglevel=9 environment variable build configuration.

setting build_loglevel=9 shows following:

cloning "https://github.com/<org>/<repo>" ... i0725 13:43:32.297019 1 source.go:134] git ls-remote --heads https://github.com/<org>/<repo> ... git ls-remote --heads https://github.com/<org>/<repo> ... git checkout <branch> 

for this, of regular branches displayed, not pr heads (this reproducible repo...remove --heads option , you'll see tags , pr heads too).

source.go:236] cloning source https://github.com/<org>/<repo> ... git clone https://github.com/<org>/<repo> /tmp/docker-build989528171 ... git checkout origin/pr/128/merge ... repository.go:427] error executing command: exit status 1 ... helpers.go:116] error: build error: error: pathspec 'origin/pr/128/head' did not match file(s) known git. 

i'm not sure how give accept checkout. don't see way fetch heads refspec locally (like how jenkins e.g. git fetch --tags --progress https://github.com/<org>/<repo>.git +refs/pull/*/head:refs/remotes/origin/pr/*


edit 2: added more information on things i've tried

i've tried adding .gitconfig file secret i've got set in buildconfig (this secret has basic auth credentials able clone github on https). thing in .gitconfig refspec try fetch pr head references:

[remote "origin"]     fetch = +refs/pull/*/head:refs/remotes/origin/pr/* 

this didn't seem either, if try ref value of origin/pr/128/head, seems refspec doesn't fetched.

as mhutter suggests in comments, passing in sha1 of actual commit --commit seems want, in understand "ignore value of ref, , use instead" workaround way.

there bug around using pull refs until recently: https://bugzilla.redhat.com/show_bug.cgi?id=1447495

unless you're using origin 3.6.0-rc.0, that you're hitting.

the docs reflect state of origin master.

"refs/pull/58/head" should right format (once you're on version of openshift has fix).


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -