Stop cleanup between two stages in gitlab-runner

2.8k views Asked by At

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 ?

1

There are 1 answers

0
Jakub Kania On

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: []