Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

With GitLab CI how to disable repository clone for one job?

Tags:

yaml

gitlab-ci

I need to speed up job 'deploy'. It does not need sources of project but needs ONLY 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
like image 498
kyb Avatar asked May 27 '19 10:05

kyb


People also ask

How do I stop a running pipeline in GitLab?

To enable or disable GitLab CI/CD Pipelines in your project: Navigate to Settings > General > Visibility, project features, permissions. Expand the Repository section. Enable or disable the Pipelines toggle as required.

Does GitLab runner clone repository?

GitLab and GitLab Runner perform a shallow clone by default.

What is Git_strategy none?

GIT_STRATEGY=none requires GitLab Runner v1. 7+. You can set the GIT_STRATEGY used for getting recent application code, either in the global variables section or the variables section for individual jobs. If left unspecified, the default from project settings will be used.


1 Answers

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

like image 162
Philipp Ludwig Avatar answered Oct 24 '22 09:10

Philipp Ludwig