Stop gitlab runner not to delete directory

I have a directory that is created during build and should not be removed in future builds. I tried to store the directory in the cache in .gitlab-ci.yml:

cache:
  key: "$CI_BUILD_REF_NAME"
  untracked: true
  paths:
    - target_directory/
build-runner1:
  stage: build
  script:
    - ./build-platform.sh target_directory

      

The first build creates a cache.zip, but for the next builds the target_directory file is removed and the cache.zip is extracted, which takes a very long time. Here is the log of the second build:

Running with gitlab-ci-multi-runner 1.11.
  on Runner1
Using Shell executor...
Running on Runner1...
Fetching changes...
Removing target_directory/
HEAD is now at xxxxx Update .gitlab-ci.yml
From xxxx
Checking out xxx as master...
Skipping Git submodules setup
Checking cache for master...
Successfully extracted cache

      

Is there a way that gitlab runner doesn't delete the directory in the first place?

+3


source to share


1 answer


You need to use work artifacts :

Artifacts are a list of files and directories that are attached to after successful completion.

.gitlab-ci.yml

file:

your job:
    before_script:
        - do something
    script:
         - do another thing
         - do something to generate your zip file (example: myFiles.zip)
  artifacts:
    paths:
         - myFiles.zip

      



After completing the quest, if you go to the quest page, you can see that there is a button to download the artifact archive.

Note

+3


source







All Articles