How to tell if it is the first pipeline for a newly created merge request

Hi there,

Is there a way to determine in the context of a pipeline for a merge request, if there has already been a successful pipeline for that merge request?

I have looked at several of the predefined variables in the GitLab CI but there doesn’t seem to be anything suitable…

As a bit more info on my situation, I have some jobs related to the UI of my app and some jobs related to the Backend of my app. I am using rules:changes to only run either UI or Backend jobs depending on what files have changed in a commit. This works great, however:

What I want to do is for the first time a pipeline is run for a merge request, run the FULL pipeline regardless of what files have changed.

Running using shared runners on and v14.7

Did you ever figure this out? Would be a great feature for caching, as in a sense the cache keys are salted by protected/non-protected branch (i.e. main vs other branches). But rules:changes doesn’t care about the branch difference so won’t generate a new cache.

I ended up having to write my own custom .sh script which made a call to the GitLab Merge Requests API and there is an endpoint for “List MR pipelines”. And from the result of that call, it is obvious whether this is the first pipeline of the MR or not.