Bogdan
Bogdan

Reputation: 652

Gitlab-CI cannot clone

I have a very basic integration configured for Gitlab-CI but it fails almost at the beginning when it has to clone the code.

My integration is this:

image: node:latest

stages:
  - build
  - test

cache:
  paths:
    - node_modules/
    - dist/

build-prod:
  stage: build
  script:
    - npm install
    - npm run build-prod
  artifacts:
    paths:
      - node_modules/
      - dist/

test_with_karma:
  stage: test
  script: ng test

And the error that I get is this:

Running with gitlab-runner 11.7.0 (8bb608ff)
  on fakehost 2eaf11ea
Using Docker executor with image node:latest ...
Pulling docker image node:latest ...
Using docker image sha256:8c67bfd7b95bdc535edc4a4144f5392b0f73efd6385fbcb47747d028d7059359 for node:latest ...
Running on runner-2eaf11ea-project-56-concurrent-0 via fakehost...
Cloning repository...
Cloning into '/builds/redacted/frontend'...
remote: You are not allowed to download code from this project.
fatal: unable to access 'https://gitlab-ci-token:[email protected]/redacted/frontend.git/': The requested URL returned error: 403
/bin/bash: line 65: cd: /builds/redacted/frontend: No such file or directory
ERROR: Job failed: exit code 1

What is the problem here?

Upvotes: 4

Views: 12202

Answers (1)

VonC
VonC

Reputation: 1323115

Check if this is covered by gitlab-org/gitlab-ce issue 39469

YAY - it works for me. This problem seems to have multiple solutions.

The one that worked for me is #44855

To summarize. Being an Administrator on Gitlab does not mean you have the "access" to do whatever you want to do in Gitlab.

"Unable to access" permissions applies to the person who is logged into Gitlab and running the job.
To fix the problem - the person / account running the job must be a member (master) of the project.

This will apply to private projects.
It is not necessary to make a private project Public even though that appears to fix the problem. GITLAB suggests you must have https for the project to work you can use http.

SOLUTION - add your account to the project even if you are the Administrator

And:

Conrad has described it correctly.

You need to have rights to the project to run pipeline, however, as administrator, you can start any pipeline.

I've got the case when the user being Admin in Gitlab could push his commit from command line, although theoretically having no rights to project - and the pipeline has failed.

This inconsistency need to be fixed, either Admin user should not be able to push/start pipeline, having no rights for it, or he should authomatically be granted all rights to all projects. I'd prefer the first one, because it separates gitlab administration from project rights. Sometimes I prefer not having full rights, just like working as non-root under Linux.

Upvotes: 9

Related Questions