GitLab API Download Artifacts from within Current Pipeline

,

Is there a way to utilize the GitLab API to download artifacts from a previous stage in the current pipeline? I currently have two stages in my pipleine, build and integrate. The build stage contains two jobs, build1 and build2 that builds multiple binaries that I would then like to integrate into a standalone application. The standalone application is built in the integrate stage and is a job that builds a docker container via a Dockerfile that performs curl via the GitLab API to download artifacts via job name. I would like to download artifacts from the previously executed (and successful) build1 and build2 jobs. Is there a way to do this? Or a way to structure the pipeline within the current constraints of GitLab to achieve this?

I have read the GitLab documentation (Job Artifacts API | GitLab) that states: Download the artifacts zipped archive from the latest successful pipeline for the given reference name and job, provided the job finished successfully. This is the same as getting the job’s artifacts, but by defining the job’s name instead of its ID. I interpret this to mean that I’m unable to download artifacts from within the current pipeline because the pipeline itself has not succeeded, and therefore doesn’t meet the criteria in the documentation above. I understand I could pass artifacts via the steps in the pipeline file; however, I want the Dockerfile to also be able to be used locally (outside of a pipeline) such that when it’s being built locally, it’s pulling recent artifacts via the API and not relying on artifacts to be passed to it from prior pipeline steps.

Is such a thing possible?

Hi @fowlball1010

By default, artifacts will be passed on to the next stage in the pipeline.

You are reading the artifacts docs for the API, but in the pipeline you are probably not calling the API explicitly, so the docs that you want are probably these ones.

The API is specifically what I’m trying to use because the Dockerfile that utilizes curl via the API to download the artifacts is also used outside of the pipeline as well. I want the Dockerfile to be able to download artifacts via the API whether it’s being used during the pipeline or just manually as a standalone file.