Using artifacts from a job in a different pipeline on the same project

The CI pipeline triggered by a merge request event runs a build job. The job has artifacts.
The post merge pipeline (same project) wants to avoid invoking another build. Using the build job artifacts should be sufficient.

Added the following to the post merge pipeline job, which I am facing some challenges to validate.
Does that looks good?

    - project: $CI_PROJECT_PATH
      job: build
      ref: $CI_COMMIT_REF_NAME
      artifacts: true

The latest online docs for this does have these caveata:

  • To download artifacts from a different pipeline in the current project, set project to be the same as the current project, but use a different ref than the current pipeline. Concurrent pipelines running on the same ref could override the artifacts.
  • Support for CI/CD variables in project , job , and ref was introduced in GitLab 13.3

and the use of the needs:project key is a Premium feature (according to the docs) - just thought I should mention that.

If the merge request pipeline completes the job prior to the post-merge job does the fetch of the artifacts, should work, AFAIK. Does this not work for you?

I’ve not tried this myself as I’m using a local PyPI repository that I push, pull from as needed across pipelines. My intra-pipeline jobs use the artifacts as the first choice, testing what was just built. Only push to devpi service if tests pass.