[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Building php with composer using private repos in composer.json





On Tue, Jul 18, 2017 at 6:24 PM, Piotr Baranowski <piotr baranowski osec pl> wrote:
Hey group!

I'm looking for some tips how to approach a problem I'm facing right now.

My app is build using php so composer.json is used.

It works like this:
The source code of the app itself is on a private bitbucket repo.
I'm using the ssh secret to pull the source. That part works perfectly.

Once the source is pulled, composer on the builder s2i image is trying to fetch dependencies.
I fails like this:

Cloning "git bitbucket org:xxxx/yyyyy.git" ...
Commit: blah
Author: foo
Date: Mon Jul 17 12:12:22 2017 +0200
---> Installing application source...
Found 'composer.json', installing dependencies using composer.phar...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  298k  100  298k    0     0   183k      0  0:00:01  0:00:01 --:--:--  183k
All settings correct for using Composer
Downloading...

Composer (version 1.4.2) successfully installed to: /opt/app-root/src/composer.phar
Use it: php composer.phar

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 155 installs, 0 updates, 0 removals
  - Installing doctrine/lexer (v1.0.1): Downloading (100%)
  - Installing doctrine/inflector (v1.1.0): Downloading (100%)
  - Installing privaterepo/someproject (1.0.1): Cloning aaaabbbbcccc
.....................................
.....................................

                                                                                                                                                                                                                                                                                                      
  [RuntimeException]                                                                                                                                                                                                                                                                                  
  Failed to execute git clone --no-checkout 'git bitbucket org:blah/foo.git' '/opt/app-root/src/vendor/privaterepo/someproject' && cd '/opt/app-root/src/vendor/privaterepo/someproject' && git remote add composer 'git bitbucket org:blah/foo.git' && git fetch composer  
  Host key verification failed.                                                                                                                                                                                                                                                                       
  fatal: Could not read from remote repository.                                                                                                                                                                                                                                                       
  Please make sure you have the correct access rights                                                                                                                                                                                                                                                 
  and the repository exists.                                                                                                                                                                                                                                                                        
------------------
 
The same key is actually used to auth to main repo as well as the one used by the composer.
I checked that by cloning the repos manually.


What is the "proper" way to put the required key inside the builder so that composer can use it to access the private repos?

i'm not sure how to feed the key to composer (you may need a custom assemble script to do that) but the right way to make the key available to the assemble script is described here:

https://docs.openshift.org/latest/dev_guide/builds/build_inputs.html#using-secrets-during-build

 

best regards


--
Piotr Baranowski

_______________________________________________
users mailing list
users lists openshift redhat com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users




--
Ben Parees | OpenShift


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]