Triggering a pipeline on another branch for the same project

Hello all. I’m trying to trigger a pipeline on a different branch from within the same project.

The pipeline I’m trying to trigger is on the pages branch - I’d like for my GitLab Pages website to be updated on a successful build of my project on the master branch.

When my master branch pipeline finishes, it fails on the last job which is to trigger the pages branch pipeline:

update_website:
  stage: website
  rules:
    - if: '$CI_COMMIT_REF_NAME == "master"'
      when: on_success
  trigger:
    project: leavesunderfoot/nimblenote
    branch: pages

When the pipeline job is run, it fails with:

downstream pipeline trigger definition is invalid

Both the master and pages branches, each with their own .gitlab-ci.yml files are within the leavesunderfoot/nimblenote project.

From what I can see, both the project and branch values in the yml are correct.

Hi David,
I have the same issue. Did you manage to solve this bug?

Hi David (or actually anyone who has any idea why this does not work),
I have the same issue. Did you manage to solve this bug?

Ok, the solution is simple: Do not use the trigger feature and trigger it manually by calling the web API

trigger-pages:
  stage: trigger-pages
  script:
  - curl -X POST -F token=$TRIGGER_PAGES_TOKEN -F ref=pages https://gitlab.com/api/v4/projects/12345/trigger/pipeline
  only:
  - master

You need to replace 1234 with your projects id, create a trigger token and store it to the CI variable TRIGGER_PAGES_TOKEN