Gitlab + GKE + Gitlab CI 无法克隆存储库

Gitlab + GKE + Gitlab CI unable to clone Repository

我正在尝试使用 GitLab CI 和 GKE 集群来执行管道。我有使用 Docker runner 的经验,但 GKE 对我来说还是很新,这是我所做的:

  1. 通过 GitLab 中的项目设置创建 GKE 集群。
  2. 通过 GitLab 项目设置安装 Helm Tiller。
  3. 通过 GitLab 项目设置安装 GitLab Runner。
  4. 创建gitlab-ci.yml,内容如下 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. 将提交推送到存储库

  6. 管道输出如下

    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
    

现在我想我应该在某处添加一个带有密码的 gitlab-ci-token 用户,不确定它是否应该像这样工作。

谢谢!

阅读更多有关该主题的内容后,似乎应该仅通过 HTTPS(而非 SSH)执行管道。

我启用了 HTTPS 通信,当我以项目中的用户身份执行管道时(未添加到项目的管理员会抛出此错误),它可以正常工作。