4

I want to download an Artifact in a job present in a Child pipeline from another job present in another Child pipeline part of the same parent-child pipeline hierarchy.

I tried with the files below that are inspired from the Gitlab documentation (see the paragraph "Example of needs:pipeline:job" in https://docs.gitlab.com/ee/ci/yaml/) but with no success (I have this error : This job depends on other jobs with expired/erased artifacts)

parent.yml

parent1:
  stage: test
  trigger:
    include: child1.yml
    strategy: depend

parent2:
  stage: test
  trigger:
    include: child2.yml
    strategy: depend
  variables:
    PARENT_PIPELINE_ID: $CI_PIPELINE_ID

Child1.yml

create-artifact:
  stage: build
  script: echo "sample artifact" > artifact.txt
  artifacts:
    paths: [artifact.txt]

Child2.yml

use-artifact:
  script: cat artifact.txt
  needs:
    - pipeline: $PARENT_PIPELINE_ID
      job: create-artifact

So according to the official Gitlab documentation : A child pipeline can download artifacts from a job in its parent pipeline or another child pipeline in the same parent-child pipeline hierarchy. so I am wondering how to make it work in my example files?

6
  • Hi, it is not possible yet. See the issue gitlab.com/gitlab-org/gitlab/-/issues/285100
    – borievka
    Jun 2, 2022 at 15:41
  • Hello. You are trying to use it on the different parent-child pipeline hierarchy. Look into the documentation that you are mention - "in the same parent-child pipeline hierarchy" Oct 2, 2022 at 19:32
  • I hear its possible by using commit-ref in your cache, then grabbing it from the cache
    – blamb
    Nov 17, 2022 at 0:37
  • @blamb do you have and example of that that you could post as an anwser?
    – St. Jan
    Jul 18, 2023 at 13:14
  • 1
    sorry I dont, id have to look it up again. I will check my browser history for it though. I think i found it on a gitlab bug report page.
    – blamb
    Jul 18, 2023 at 15:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.