Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop cleanup between two stages in gitlab-runner

Here is my .gitlab-ci.yml

stages:
  - build
  - unit_test_1
  - unit_test_2
  - perf_test

job1:
  stage: build
  script:
    - bash build.sh
  allow_failure: true

job2:
  stage: unit_test_1
  script:
    - bash ./all/deployment/testframwork/unit_test_1.sh
  allow_failure: true

Here build.sh creates a build and stores all binary in build directory. But after completion of job1 this directory is deleting.

But I am using that directory for running my 2nd job.

How can i achieve this ?

like image 292
10305059 Avatar asked Jan 06 '17 10:01

10305059


People also ask

How long does GitLab cache last?

Artifacts expire after 30 days by default. You can define a custom expiration time. The latest artifacts do not expire if keep latest artifacts is enabled.

Can GitLab runner run multiple jobs?

One way to allow more jobs to run simultaneously is to simply register more runners. Each installation of GitLab Runner can register multiple distinct runner instances. They operate independently of each other and don't all need to refer to the same coordinating server.

Is it safe to use GitLab shared runners?

Fortunately, http://gitlab.com seems to be sharing only docker runners. docker runners are generally safe* because every build runs in a new container, so there's nothing to worry.


1 Answers

Use build artifacts. You should use expire_in with the artifacts so the build dir is not stored in your gitlab forever. To control what dir gets what artifacts use dependencies

job1:
  artifacts:
    path: build
    expire_in: 1 week
job2:
  dependencies:
    -job1
job3:
  dependencies: []
like image 89
Jakub Kania Avatar answered Sep 21 '22 18:09

Jakub Kania