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 stage contains two jobs,
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)
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?