Downstream pipeline trigger definition is invalid

Problem description
Hey Guys, I am trying to create a downstream pipeline using trigger keyword from a particular job. The parent pipeline is executed on feature branch and after at a point it should then kick off a downstream pipeline on master branch of the same project. However I am using below code yml snippet to trigger the pipeline:

trigger:
project: kinsale/kinsale/ki-api
branch: master
strategy: depend

This gives error as shown in the screenshot.

downstream pipeline trigger definition is invalid.

Screen Shot 2021-04-29 at 4.57.02 PM

I was expecting to see create downstream pipeline in the same graph. Am I doing something wrong.

Here’s my full job yml snippet.

no-stay:
stage: deploy:status
rules:
- if: ‘$CI_PIPELINE_SOURCE == “merge_request_event”’
when: manual
trigger:
project: group/subgroup/ki-api
branch: master
strategy: depend
variables:
ENVIRONMENT: prod_support_team

I am using gitlab version 3.12.0-pre and I am using multi-project pipeline doc. referred from. here:
https://docs.gitlab.com/ee/ci/multi_project_pipelines.html

*Thanks for taking the time to read this. Hope this helps. ! Looking forward for your inputs.

Hi @sumit-ki
let me ask you why do you need to run pipeline on the same project in different branch?
AFAIK you cannot use the trigger keyword to trigger pipeline on the same project.

Thanks for your reply @balonik ! Appreciate you asking that. We have requirement that if the prod deployment fails from feature branch a pipeline should be kicked off from master to rollback changes in production environment. To your point I want to see that master pipeline in the same graph where the feature pipeline is running which I am not able to see when I trigger it via API. Instead it creates a new pipeline.

The whole intention to use ‘trigger’ keyword to see the downstream pipeline which is not working when provided project and branch (same project). I would love to know if there is a way if I can show the downstream pipeline in the same graph while I trigger it via API. Does that make sense? Please let me know if you need any additional information.

Thank you.

I suppose you could create a dummy project which you will trigger and that will trigger main project master branch pipeline. You should see it in one pipeline graph this way.
I can’t think of other options that don’t involve doing deployment only from master branch.

My understanding from the docs for child pipelines and trigger was that you can have a downstream child pipeline in the same project.

Maybe I’ve misunderstood, but can you not have the before_script of the child pipeline run git checkout BRANCH as the first thing it does?

1 Like

Hey you were correct. It was so simple I was just overthinking. I am using befor_script and did git checkout master. Kudos. Thanks for great inputs.

1 Like