Can't trigger pipeline from another project with the API.

I’m having the following workflow rules in my main pipeline:

       workflow:
          rules:
            - if: '$CI_MERGE_REQUEST_IID == null'
              when: never
            - if: '$CI_MERGE_REQUEST_TITLE =~ /Draft:/'
              when: never
            - if: '$CI_MERGE_REQUEST_TITLE =~ /WIP:/'
              when: never
            - if: '$CI_PIPELINE_TRIGGERED =~ "true"'
              when: always
            - when: always

The issue is when I’m trying to trigger it with the following curl request it tells me that pipeline is filtered out by workflow rules and I can’t figure out what’s wrong.

This is the curl request that I’m trying to use:

curl --verbose -X POST -F token=$TRIGGER_TOKEN -F ref=BRANCH_NAME https://gitlab_url/api/v4/projects/357/trigger/pipeline"

Hi @Lotarc

I think it’s probably this clause:

       workflow:
          rules:
            - if: '$CI_MERGE_REQUEST_IID == null'
              when: never

Since the pipeline you trigger with curl doesn’t have an associated MR.

Can I workaround it somehow? I thought it should match at least 1 rule to start. Like source or something else.

According to the docs Rules are evaluated ... in order until the first match.. So, I would try putting that clause last and see where you get.

If that doesn’t work, you might want to look at using CI_PIPELINE_SOURCE.

Thanks, I will surely try this.