Santhosh
Santhosh

Reputation: 11768

gitlab: how to trigger a pipline in another project

I have a gitlab repo MAIN, where I run a pipline.

I have another gitlab repo SUB. where I run another pipeline

Now I want to trigger the pipline in MAIN repo from the SUB

i.e whenever i commit any change in SUB it should trigger the pipeline in MAIN

How do I do that in the gitlab-ci.yml file of the SUB

Upvotes: 3

Views: 1994

Answers (3)

Mouson Chen
Mouson Chen

Reputation: 1224

trigger-main:
  trigger: group/MAIN

ref: Multi-project pipelines

Upvotes: 3

Arash Hatami
Arash Hatami

Reputation: 5551

You can use Pipelines API, for example :

curl --request POST \
     --form token=TOKEN \
     --form ref=main \
     "https://gitlab.example.com/api/v4/projects/9/trigger/pipeline"

You need an Authentication token

Upvotes: 0

eckes
eckes

Reputation: 67047

You want Pipeline Triggers:

Upvotes: 1

Related Questions