patch-graph / pass-the-fork

[WIP] inject forked dependencies into CI builds
MIT License
1 stars 1 forks source link

support intercepting git clone #10

Closed cben closed 5 years ago

cben commented 5 years ago

attempt to address #5 (using strategy 2 — a git executable shim)

status:

cben commented 5 years ago

Hmm, I think bundler thing is caused by INJECT_GEMS, not INJECT_GIT_URLS.

the yaml file I gave run.js:

https://github.com/ManageIQ/manageiq/pull/18418:
  gem: manageiq
  github: kbrock/manageiq
  base_github: ManageIQ/manageiq
  branch: classification_parent_yml
  test: false

manageiq-providers-openshift:
  github: cben/manageiq-providers-openshift
  base_github: ManageIQ/manageiq-providers-openshift
  depends_on:
    - https://github.com/ManageIQ/manageiq/pull/18418

https://travis-ci.org/cben/manageiq-providers-openshift/jobs/491856748

== Cloning manageiq sample app ==
pass-the-fork: modified git command: git clone https://github.com/kbrock/manageiq --branch master --depth 1 spec/manageiq
Cloning into 'spec/manageiq'...
...
pass-the-fork: gem("manageiq", git: "https://github.com/kbrock/manageiq", branch: "classification_parent_yml")
pass-the-fork: gem("manageiq", git: "https://github.com/kbrock/manageiq", branch: "classification_parent_yml")
...
Fetching https://github.com/kbrock/manageiq
pass-the-fork: unmodified git command: git clone https://github.com/kbrock/manageiq /home/travis/build/cben/manageiq-providers-openshift/vendor/bundle/cache/bundler/git/manageiq-31500445f95e8504e0c3626ecb737f060f41d163 --bare --no-hardlinks --quiet
pass-the-fork: unmodified git command: git rev-parse --verify classification_parent_yml
pass-the-fork: unmodified git command: git clone --no-checkout --quiet /home/travis/build/cben/manageiq-providers-openshift/vendor/bundle/cache/bundler/git/manageiq-31500445f95e8504e0c3626ecb737f060f41d163 /home/travis/build/cben/manageiq-providers-openshift/vendor/bundle/bundler/gems/manageiq-6c8d9bae0ae5
pass-the-fork: unmodified git command: git fetch --force --quiet --tags /home/travis/build/cben/manageiq-providers-openshift/vendor/bundle/cache/bundler/git/manageiq-31500445f95e8504e0c3626ecb737f060f41d163
pass-the-fork: unmodified git command: git reset --hard 6c8d9bae0ae5676c2f5d6743ae367764d8a7518b
pass-the-fork: unmodified git command: git --version
pass-the-fork: unmodified git command: git submodule deinit --all --force
Fetching gem metadata from https://rubygems.org/......
Fetching gem metadata from https://rubygems.org/.
Could not find gem 'manageiq' in https://github.com/kbrock/manageiq (at
classification_parent_yml@6c8d9ba).
The source does not contain any versions of 'manageiq'

The double interception is not necessarily a problem — INJECT_GEMS causes bundler to look for forked repo/branch (commit below is correct commit from the manageiq PR I'm trying to test), and git shim correctly does not modify any of those commands.

It seems it fails because manageiq dir has no *.gemspec file. Indeed, it's not intended to be used as a gem, only through plugins' bin/setup's weird source-manageiq-Gemfile-from-plugin-Gemfile arrangement. WHY was is used as a gem? Because of INJECT_GEMS — note pass-the-fork: gem("manageiq, ...) lines above!

cben commented 5 years ago

Indeed, as manageiq is consumed by git clone, not as gem, I removed gem: manageiq from the yaml, left the base_github:, and now it worked! https://travis-ci.org/cben/manageiq-providers-openshift/jobs/491882381 well, failed but looks unrelated out-of-date deps stuff (probably because wrong branch, fork's master is old)

cben commented 5 years ago

Works for me. Overrode repo and branch name here: https://travis-ci.org/cben/manageiq-providers-openshift/jobs/494563982#L499

== Cloning manageiq sample app ==
pass-the-fork: modified git command: git clone https://github.com/kbrock/manageiq --depth 1 spec/manageiq --branch=classification_parent_yml
Cloning into 'spec/manageiq'...

I have an idea how to start testing injectors but will work on that later, merging without tests. EDIT: I've since forgotten the idea :laughing: