Run a job at the creation of a MR

Hello :wave:

I am trying to execute one job at the creation of a MR. Do you know if it’s possible ?

One MR doesn’t contain any change, so pipeline is not running. I would like to initiate some elements when one people create a MR at the beginning of this work. I tried to use different things. I only see the creation of a webhook to execute a script that execute a pipeline with glab :exploding_head: :sweat_smile:there is no need to specify that I wish to avoid this :joy:

Wow, I think I was tired and I was lost in my own pipeline. Fix resolved, at the creation of a branch a pipeline run.

You can use the rules.

  • if: $CI_PIPELINE_SOURCE == “merge_request_event”
    when: manual

You can make sure the stages doesn’t trigger for all MR if you have multiple branches. The rules could be finely controlled based on your branching strategy.

You can add merge request source branch and target branch names to control it accordingly.

If you think you need to run it after approval you can use CI_MERGE_REQUEST_APPROVED=true

Use && or || for adding more conditions

Thanks for your response @sunilhariuk !

My tests was at the begining of the MR (and not at the end). I success to close my test. I had too much rules and everythin as wrong :exploding_head: :sweat_smile:

Hello @JeanPhi.Baconnais
Can you share your rules please ? I try to do the same functionality : run a pipeline at the creation of the merge request with no commit.

But unfortunately all my try failed.

Hello @Kamaradeivanov , if you want to run one pipeline when you created your MR, you have just to create a MR, and have a .gitlab-ci.yml file containing a job.

In my case, I have several rules who blocked my MR.

Do you have a link to your project ?