使用 GitLab CI 如何禁用一项作业的存储库克隆? [英] With GitLab CI how to disable repository clone for one job?

查看:15
本文介绍了使用 GitLab CI 如何禁用一项作业的存储库克隆?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要加快工作部署".它不需要项目来源,只需要工件.

I need to speed up job 'deploy'. It does not need sources of project but needs ONLY ARTIFACTS.

典型的.gitlab-ci.yml(伪)看起来像:

Typical .gitlab-ci.yml (pseudo) looks like:

image: gcc

build:
  stage: build
  script:
  - ./configure
  - mkdir build && cd $_
  - cmake ..
  - make -sj8
artifacts:
  paths:
  - "build/*.elf"

deploy:
  image: artifactory
  variables:
  - DO_NOT_CLONE: 1  ## WANT THIS OPTION
  stage: deploy
  script:
  - push_artifacts build/*.elf

推荐答案

签出变量GIT_STRATEGY:

variables:
  GIT_STRATEGY: none

来自文档:

none 也重复使用项目工作区,但会跳过所有 Git 操作(包括 GitLab Runner 的预克隆脚本,如果存在).它对于专门在工件上运行的作业(例如,部署)非常有用.

none also re-uses the project workspace, but skips all Git operations (including GitLab Runner’s pre-clone script, if present). It is mostly useful for jobs that operate exclusively on artifacts (e.g., deploy).

https://docs.gitlab.com/ee/ci/yaml/#git-strategy

这篇关于使用 GitLab CI 如何禁用一项作业的存储库克隆?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆