How to pull build artifacts from merge request pipeline to master?

Let’s say you have several branch pipelines running. When a merge request occurs, it builds the docker image and all artifacts to test in the pipeline for the merge. Then when the merge is approved, it has to do the same build in the master pipeline to generate new images and artifacts so that we can push them to production.

My question is how can I get the master branch to see the previously built artifacts from a previous pipeline and use them, so that instead of rebuilding, we just do some kind of release step. I know about the Jobs api, but how can I dynamically specify to gitlab which is the correct pipeline to pull the artifacts from?

We are using Jfrog to publish the artifacts to. The main question I run into is how do you know which branch you would want to pull the artifacts from. Since multiple branches may publish artifacts around the same time, and you may not want the most recent one.

Also, we are using Merge Train. I don’t know if that matters.

  • What are you seeing, and how does it differ from what you expect to see?
    Currently we build/publish all images in the merge request pipeline, and do the same in the master pipeline.

  • What version are you on (Hint: /help) ? and are you using self-managed or gitlab.com?
    Latest version

1 Like

i dont know if i can answer to your problem, but for my self, i run build project of my framework, and at end, i run a trigger new pipeline automatically on other project with parent pipeline id and other parameters for running test automation with builded artifact of pipeline parent, but i need to get the artifact of previous pipeline and i run shell scripts/python with curl with the api gitlab for searching the pipeline parent, when you find right one , you can acces jobs and artifacts of the pipeline/jobs parent, if not, i take last pipeline parent framework builded. take care with token trigger. Two way you can set criteria automaticaly with trigger between projects pipelines, or you set manualy the criteria by scheduler, pipeline id, branch, artifact name. we have also a master pipeline for launching lot of child pipelines with triggers for delivery on nexus repositories with criteria build profile variable for each customer target of my framework .

Hi.

Did you solve this problem. I have been thinking about how to solve it but I have not been able to find something optimal

Thks!!