代码之家  ›  专栏  ›  技术社区  ›  Jan Richter

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

  •  0
  • Jan Richter  · 技术社区  · 6 年前

    我试图使用GKE集群使用GitLab CI来执行管道。我有使用Docker runner的经验,但GKE对我来说还是相当陌生的,以下是我所做的:

    1. 通过GitLab中的项目设置创建GKE集群。
    2. 通过GitLab项目设置安装Helm Tiller。
    3. 通过GitLab项目设置安装GitLab Runner。
    4. 创建gitlab ci。yml具有以下内容 \u脚本之前: -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令牌用户,但不确定它是否应该像这样工作。

    谢谢

    1 回复  |  直到 6 年前
        1
  •  0
  •   Jan Richter    6 年前

    在阅读了有关该主题的更多信息后,似乎应该仅通过HTTPS(而不是SSH)执行管道。

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