Skip to content

`on_stop` is not automatically triggered anymore, stopping environment becomes impossible

Summary

Since the 11.10 version, on_stop (in .gitlab-ci.yml) is not automatically triggered anymore. For example, when you merge the MR (deleting the source branch) the review application environment isn't stopped.

Steps to reproduce

  • Create a project (even empty)
  • add .gitlab-ci.yml with this content:
stages:
  - calculations
  - preview

addition:
  only: 
    - master 
  stage: calculations
  script:
    - expr 40 + 2
  environment:
    name: production
    url: http://www.google.com

run_preview:
  stage: preview
  only:
    - merge_requests
  script: |
    echo "creating an environment"
  environment:
    name: preview
    url: http://www.google.com
    on_stop: stop_preview

stop_preview:
  stage: preview
  when: manual
  only:
    - merge_requests
  script: |
    echo "deleting an environment"
  environment:
    name: preview
    action: stop
  • when you commit on master it will create a production environment
  • when you create a MR it will create a preview environment
  • when you merge the MR (deleting the source branch) the preview environment will not be stopped

with the 11.09 version, the preview environment was stopped automatically

Example Project

example: https://gitlab.com/kebab-corp/demo

What is the current bug behavior?

When doing a Review Application, the review environment isn't stopped when merging (and deleting the source branch)

What is the expected correct behavior?

When doing a Review Application, the review environment is stopped when merging (and deleting the source branch)

Output of checks

This bug happens on GitLab.com and on GitLab self-hosted

Edited by Philippe Charrière