Use of rules and variables in gitlab-ci.yml

Hello,

I would like to achieve something like this :

Deploy:
    stage: staging
    rules:
      - if: '$CI_PIPELINE_SOURCE == "web" && $CI_ENVIRONMENT_NAME == "staging"'
        when: always
      - if: '$CI_PIPELINE_SOURCE == "triggers" && $STAGE == "staging"'
        when: always
    image: python:3.7-stretch

Triggering pipeline through web with CI_ENVIRONMENT_NAME set to staging is working as expected, however I’m not able to trigger the pipeline with cURL (second test case)

I’m using :
curl -X POST -F token="" -F ref=master -F “variables[STAGE]=staging” https://gitlab.com/api/v4/projects/54546546/trigger/pipeline

What I am missing ? Thanks.

Fixed! trigger is without s

1 Like