Home > Blockchain >  Gitlab CI: Access private repository from CI pipeline fails
Gitlab CI: Access private repository from CI pipeline fails

Time:10-21

I try to set up a Gitlab CI configuration, which executes the unit tests of a symfony project. The same configuration works for an old project, but in my new one the command composer update fails. The error message says that it isn’t possible to clone our own bundle out of our Gitlab.

$ composer update
Loading composer repositories with package information
In Git.php line 471:

 Failed to execute git clone --mirror -- ‘https://glp...XXX:private-token@gi
 tlab.company.com/bundle/test-bundle.git’ ‘/tmp/cache/vcs/https---gitla
 b.company.com-bundle-test-bundle.git/’

 Cloning into bare repository ‘/tmp/cache/vcs/https---gitlab.company.com-bundle-test-bundle.git’...
 fatal: unable to access ‘https://gitlab.company.com/bundle/test-bundle
 .git/’: Failed to connect to gitlab.company.com port 443 after 0 ms: Conn
 ection refused

At first I tried to use a personal access token in my .gitlab-ci.yaml but get the previous mentioned error.

test:
  image: composer:latest
  stage: test
  before_script:
    - composer config gitlab-token.gitlab.company.com $PERSONAL_CI_TOKEN

After that I tried the access by username/password.

echo "{\"http-basic\":{\"gitlab.company.com\":{\"username\":\"user\",\"password\":\"password\"}}}” > $HOME/.composer/auth.json

All the possibilities worked in my composer docker container and in my other project the access is still possible. I don't know how to solve this error.

CodePudding user response:

Please check if you have added your self-hosted gitlab domain in your config in the composer.json file.

It should look like this:

"config": { "gitlab-domains": ["gitlab.company.com"] }
  • Related