Blocked pipeline using rules with environment / review app

We’re having an issue using rules with environments / review apps on gitlab.com where the pipeline becomes blocked if we use rules instead of when. We expect the pipeline to automatically stop using rules, as documented.

Pipeline blocked. The pipeline for this merge request requires a manual action to proceed

If we manually trigger the stop job, the pipeline is considered complete.

Should this work or must we revert to only/except?

only/except syntax:

review:
  environment:
    name: $CI_COMMIT_REF_SLUG
    on_stop: stop:review
  script:
    - echo "review"
  stage: review

stop:review:
  environment:
    action: stop
    name: $CI_COMMIT_REF_SLUG
  except:
    - master
    - tags
  script:
    - echo "stop"
  stage: review
  variables:
    GIT_STRATEGY: none
  when: manual

rules syntax:

review:
  environment:
    name: $CI_COMMIT_REF_SLUG
    on_stop: stop:review
  script:
    - echo "review"
  stage: review

stop:review:
  environment:
    action: stop
    name: $CI_COMMIT_REF_SLUG
  rules:
    # Avoid executing on merge request detached pipelines
    - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME'
      when: never
    # Execute only on branches (not master)
    - if: '$CI_COMMIT_BRANCH != "" && $CI_COMMIT_BRANCH != "master"'
      when: manual
  script:
    - echo "stop"
  stage: review
  variables:
    GIT_STRATEGY: none
1 Like