Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab ci issue with passing artifacts to Downstream pipeline with trigger and needs keywords

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.

like image 336
Ash Singh Avatar asked Feb 24 '21 17:02

Ash Singh


People also ask

What job keyword defines a downstream pipeline?

Specify a downstream pipeline branch The project keyword to specify the full path to a downstream project. In GitLab 15.3 and later, variable expansion is supported. The branch keyword to specify the name of a branch in the project specified by project .

How do you trigger a pipeline from another pipeline in GitLab?

Go to Settings → CI/CD → Pipeline triggers → Add Trigger . It will create a trigger with a TOKEN string, which then can be copied into the curl command of gitlab-ci. yml of project A. Note: The triggers under only is necessary to define the rules.

What is upstream and downstream in GitLab?

The term upstream and downstream refers to the repository. Generally, upstream is from where you clone the repository, and downstream is any project that integrates your work with other works. However, these terms are not restricted to Git repositories.


1 Answers

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.

like image 68
user2477643 Avatar answered Sep 20 '22 10:09

user2477643