如何禁用 git 实验室运行器获取 git 存储库?

How to disable fetching git repository by gitlab runner?

我的.gitlab-ci.yml

有这样的任务
deploy_all:
  stage: deploy
  script:
    - cp project/target/jnlp/* html/jnlp/
  tags:
    - client:deploy-all

一切正常,除了不必要的 git 存储库获取。以下是跑步者日志的摘录

Running with gitlab-ci-multi-runner 9.1.0 (0118d89)
...
Fetching changes...
HEAD is now at 8dfc104 Update .gitlab-ci.yml
...
Job succeeded

这里不需要存储库,因为我只需要来自其他任务的工件。是否可以禁用此行为?

我找到了解决方案:

  • 已将 gitlab 升级到版本 10.x,手册在这里 https://docs.gitlab.com/runner/install/linux-repository.html
  • 在构建脚本中禁用git签出(通过添加变量)

    deploy_all:
      variables:
        GIT_STRATEGY: none
        GIT_CHECKOUT: "false"
      stage: deploy
      script:
        - cp project/target/jnlp/* html/jnlp/
      tags:
        - client:deploy-all