39

I need to speed up the job 'deploy'. It does not need the sources of the project, only the artifacts.

How to disable project cloning for the only job?

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
Philipp Ludwig
  • 3,758
  • 3
  • 30
  • 48
kyb
  • 7,233
  • 5
  • 52
  • 105

1 Answers1

63

Checkout the variable GIT_STRATEGY:

variables:
  GIT_STRATEGY: none

From the documentation:

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/runners/configure_runners.html#git-strategy

Sajjad Haghani
  • 45
  • 1
  • 1
  • 8
Philipp Ludwig
  • 3,758
  • 3
  • 30
  • 48