6

I am working on a multi-pipeline project, and using trigger keyword to trigger a downstream pipeline, but I'm not able to pass artifacts created in the upstream project. I am using needs to get the artifact like so:

Downstream Pipeline block to get artifacts:

needs:
    - project: workspace/build
        job: build
        ref: master
        artifacts: true

Upstream Pipeline block to trigger:

build:
    stage: build
    artifacts:
    paths:
        - ./policies
    expire_in: 2h
    only:
    - master
    script:
    - echo 'Test'
    allow_failure: false

triggerUpstream:
    stage: deploy
    only:
    - master
    trigger:
    project: workspace/deploy

But I am getting the following error:

This job depends on other jobs with expired/erased artifacts:

I'm not sure what's wrong.

Josh Correia
  • 3,807
  • 3
  • 33
  • 50
Ash Singh
  • 61
  • 1
  • 4
  • 1
    Perhaps you redacted the `strategy` part of the trigger? If so, the downstream pipeline is only able to fetch artifacts from *completed* pipelines. So if there isn't one it'll show this error – D.Ginzbourg May 19 '21 at 23:40

3 Answers3

3

Looks like there is a problem sharing artifacts between pipelines as well as between projects. It is known bug and has been reported here:

https://gitlab.com/gitlab-org/gitlab/-/issues/228586

You can find a workaround there but since it needs to add access token to project it is not the best solution.

0

Your upstream pipeline job "Build" is set to only store its artifacts for 2 hours (from the expire_in: 2h line. Your downstream pipeline must have run at least 2 hours later than the artifacts were created, so the artifact expired and was erased, generating that error.

To solve it you can either update the expire_in field to however long you need them to be active (so for example if you know the downstream pipeline will run up to 5 days later, set it to 5d for 5 days), or rerun the Build job to recreate the artifacts.

You can read more about the expire_in keyword and artifacts in general from the docs

Adam Marshall
  • 6,369
  • 1
  • 29
  • 45
  • 3
    Thanks for the reply, but have tried `expire_in: never` too, but still same issue. Also, in error its not showing which artifact it is missing, so just wondering if I am missing anything in `needs` step. – Ash Singh Feb 24 '21 at 19:01
0

It isn't a problem with expired artifacts, the error is incorrect. In my case I am able to download the artifacts as a zip directly from the UI on the executed job. My expire_in is set to 1 week yet I am still getting this message.

SBKDeveloper
  • 613
  • 1
  • 9
  • 20