D
D
DandyDel2021-03-23 14:06:01
Continuous Integration
DandyDel, 2021-03-23 14:06:01

GITLAB CI: Is it possible to transfer artifacts between pipelines?

Good day everyone!
I wanted to ask if it is possible to transfer artifacts between pipelines in Gitlab?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Kupletsky, 2021-03-29
@zavoloklom

To save data between pipelines, you need to use cache.
For example, to create a cache for a specific stage and a specific branch, you can use the following key:

cache:
  key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"

Then the next time the pipeline is called for this branch , the cached data will be received at this stage .
Documentation with more examples: https://docs.gitlab.com/ee/ci/caching/index.html
---
If for some reason you need to get the artifact and the cache is not suitable, you can try downloading the artifact by API via curl.
For example, to get the latest artifact with the job "test" from the master branch, you can add this line:
script:
  - 'curl --location --output artifacts.zip --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://gitlab.example.com/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/master/download?job=test"'

Artifact API documentation and examples: https://docs.gitlab.com/ee/api/job_artifacts.html

D
Dmitry Shitskov, 2021-03-23
@Zarom

Perhaps the cache directive will work for you
https://docs.gitlab.com/ee/ci/yaml/#cache
Check if there is cache and don't make if it is.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question