Artifact dependencies fail across projects

Hi, I am encountering an issue with depending on artifacts from another project. Firstly I ran into issues at work on our selfhosted deployment on version: 14.6.2-ee. Eventually I figured maybe this is some issue with our setup/version, although I did not have any direct reasoning for this, and moved towards created a somewhat minimal setup on Gitlab.com. The setup can be found here and here – “ci_test_2” depends on “ci_test_2” --. And luck has it I cannot get it to work here either…

When I use the “needs:project” in my pipeline to retrieve and use artifacts from another project’s pipeline, it be triggered from the other with “trigger”, or ran directly after a successful execution the dependency pipeline done manually, I get an error stating: “This job could not start because it could not retrieve the needed artifacts.” or “missing dependency failure”.

Below are both .gitlab-ci.yml’s included…
ci_test_1:

job_that_creates_some_artifact:
  script:
    - echo "Something cool" > this_makes_me_sad.cry
  artifacts:
    paths:
      - this_makes_me_sad.cry
    expire_in: 2 mos

.job_that_triggers_external_pipeline:
  needs:
    - job_that_creates_some_artifact
  trigger:
    project: n1ouse/ci_test_2
    branch: main
    strategy: depend

ci_test_2

job_that_depends_on_other_pipeline_in_other_project:
  needs:
    #- project: $CI_PROJECT_PATH
    #  job: $DEPENDENCY_JOB_NAME
    #  ref: $ARTIFACTS_DOWNLOAD_REF
    - project: n1ouse/ci_test_1
      job: job_that_creates_some_artifact
      ref: main
      artifacts: false
  script:
    - cat this_makes_me_sad.cry

I have spent quite some time googling and read all the documentation I could find. And AFAIK this should work… I did find a thread somewhere mentioning I need premium versions for this to work which I do not have. Although this is, AFAIK, never mentioned anywhere in documentation…

Documentation for using triggers across projects.
Documentation for depending across projects.

P.S.
I am also unsure what exactly the use of the “dependencies” keywor is, can someone enlighten me why this keyword is relevant and not “needs:artifacts”? Is this just legacy?

@n1ouse welcome to the forum!

needs:project is a Premium feature. If you have a trial or license changing

  ref: main
#rest of file
      artifacts: false

to

  ref: main
#rest of file
      artifacts: true

then the downstream pipeline will download artifacts from that referenced job. The trigger:strategy influences when the upstream job status changes.

I hope this helps.

-James H, GitLab Product Manager, Verify:Pipeline Execution

I ran into the same issue, and I am using Premium. I can see the artifacts were created, but the error message displayed is This job could not start because it could not retrieve the needed artifacts.

ci-experiments-child .gitlab-ci.yml:

stages: 
  - build

child-build-job: 
  stage: build
  script:
    - date > child-build-date.txt
  artifacts:
    paths:
      - child-build-date.txt

child-multi-artifacts-job:
  stage: build
  script:
    - date > child-date-1.txt
    - date > child-date-2.txt
  artifacts:
    paths:
      - child-date*.txt

ci-experiments .gitlab-ci.yml:

stages: 
  - build


code-build-job: 
  stage: build
  script:
    - ls
  needs:
    - project: path/to/project/ci-experiments-child
      job: child-build-job
      ref: main
      artifacts: true

@npoulin - Thanks for the post and welcome to the forum.

I did a little more digging in our issues and this may be related to Artifact downloads to child pipelines requires `ref` with `trigger:project` (#331596) · Issues · GitLab.org / GitLab · GitLab which includes a workaround if you’re using the trigger like the original author was.

I hope this helps!

-James H, GitLab Product Manager, Verify:Pipeline Execution

Sorry no, mine already looks like the work around using needs:project thanks for looking though.

Thanks for verifying! I think there’s an open issue with that problem. I’ll try to dig it up and link it back here.

Sorry for the trouble, though we are paying for premium, apparently some steps needed to transition the account weren’t completed so we don’t have premium features. So same problem as the OP, not on premium.

1 Like