Hello,
I created a gitlab-runner on DO for my project, but I have a problem when it try to execute git ls-remote on gitlab to fetch my other private projects that serves as deps for the main one, exemple:
main project has in the package.json another private project and is configured to be fetched with:
“private-dep”: “git+ssh://git@gitlab.com/my-private-dep.git”,
The error I’m getting is as follows:
$ yarn install --pure-lockfile --cache-folder .yarn
yarn install v1.22.5
[1/4] Resolving packages...
[2/4] Fetching packages...
error Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads ssh://git@gitlab.com/my-private-dep.git
Directory: /builds/monorepo
Output:
packet_write_wait: Connection to 172.65.251.78 port 22: Broken pipe
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Cleaning up file based variables
00:00
ERROR: Job failed: exit code 1
my gitlab-ci.yml is as follows:
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -e "Host *\n\tPubkeyAuthentication yes\n\tPreferredAuthentications publickey\n\tStrictHostKeyChecking no\n\tServerAliveInterval 60\n\tServerAliveCountMax 5\n\tTCPKeepAlive yes\n\tIPQoS=throughput" > ~/.ssh/config
- ssh-keyscan -H gitlab.com >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
variables:
GIT_STRATEGY: fetch
image: node:latest
stages:
- prepare
- test
- build
- deploy
cache:
paths:
- node_modules/
- .yarn
install_deps:
stage: prepare
script:
- yarn config set cache-folder .yarn
- yarn install --pure-lockfile --cache-folder .yarn
artifacts:
paths:
- node_modules/
- .yarn
only:
- development
- master
testes_unitarios:
stage: test
script:
- echo "Iniciando testes unitarios"
- REACT_APP_MOCK_SERVER=1 CI=1 yarn test
- echo "Testes concluidos com sucesso!"
only:
- development
- master
On shared runners this script runs with success =/
My runner droplet don’t have any firewall on for the moment and I can see the SSH key on the runner’s debug console when it receives a job.
Thank you
Mario