Gitlab + GKE + Gitlab CI unable to clone Repository

4/21/2018

I'm trying to user GitLab CI with GKE cluster to execute pipelines. I have the experience using Docker runner, but GKE is still pretty new to me, here's what I did:

  1. Create GKE cluster via Project settings in GitLab.
  2. Install Helm Tiller via GitLab Project settings.
  3. Install GitLab Runner via GitLab Project settings.
  4. Create gitlab-ci.yml with the following content before_script: - php -v

    standard:
      image: falnyr/php-ci-tools:php-cs-fixer-7.0
      script:
        - php-cs-fixer fix --diff --dry-run --stop-on-violation -v --using-cache=no
    
    lint:7.1:
      image: falnyr/php-ci:7.1-no-xdebug
      script:
        - composer build
        - php vendor/bin/parallel-lint --exclude vendor .
    
    cache:
      paths:
        - vendor/
    
  5. Push commit to the repository

  6. Pipeline output is following

    Running with gitlab-runner 10.3.0 (5cf5e19a)
      on runner-gitlab-runner-666dd5fd55-h5xzh (04180b2e)
    Using Kubernetes namespace: gitlab-managed-apps
    Using Kubernetes executor with image falnyr/php-ci:7.1-no-xdebug ...
    Waiting for pod gitlab-managed-apps/runner-04180b2e-project-5-concurrent-0nmpp7 to be running, status is Pending
    Running on runner-04180b2e-project-5-concurrent-0nmpp7 via runner-gitlab-runner-666dd5fd55-h5xzh...
    Cloning repository...
    Cloning into '/group/project'...
    remote: You are not allowed to download code from this project.
    fatal: unable to access 'https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@git.domain.tld/group/project.git/': The requested URL returned error: 403
    ERROR: Job failed: error executing remote command: command terminated with non-zero exit code: Error executing in Docker Container: 1

Now I think that I should add a gitlab-ci-token user with password somewhere, not sure if it is supposed to work like this.

Thanks!

-- Jan Richter
gitlab
gitlab-ci-runner
google-kubernetes-engine
kubernetes

1 Answer

4/29/2018

After reading more about the topic it seems that pipelines should be executed via HTTPS only (not SSH).

I enabled the HTTPS communication and when I execute the pipeline as the user in the project (admin that is not added to the project throws this error) it works without a problem.

-- Jan Richter
Source: StackOverflow