I have a project (A) which depends on another project (B).
When building project A I want to use the latest artifacts of project B to build.
I identified two solutions:
- Use
needs:project
`.gitlab-ci.yml` keyword reference | GitLab - Use the API to download the artifacts
1. needs:project
solution
I configured the needs correctly:
needs:
- project: xy
job: build_job
ref: main
artifacts: true
But in the running pipeline I saw that the job it was dependent on was the same job that was just triggered. Even though project xy is no the same project as this pipeline run at.
So I figured it must be a bug in Gitlab and tried solution 2.
2. Use API
I used /api/v4/projects/3/jobs/artifacts/main/download?job=build_job
to download the artifacts.
It works when I use my personal access token with the PRIVATE_TOKEN header. But when I try it with JOB_TOKEN an CI_JOB_TOKEN it doesnt work.
I configured Token Access accordingly.
Any ideas here?
I’d prefer solution one, but two would work as well.
Versions:
GitLab self hosted: v16.0.7-ee
Runner: 16.0.2 shell powershell