3

I have the following (simplified) .gitlab-ci.yml file for a project.

It successfully creates an environment that is visible from the UI.

stages:
  - deploy

deploy_test:
  image: #myimage
  stage: deploy
  environment:
    name: test
    url: #myurl
    on_stop: stop_test
  rules:
    - if: '$CI_COMMIT_BRANCH == "mybranch" && $CI_PIPELINE_SOURCE != "merge_request_event"'
  script: #myscript


stop_test:
  stage: deploy
  variables:
    GIT_STRATEGY: none
  script: #myscript     
  when: manual
  environment:
    name: test
    action: stop

However, the stop action doesn't properly get recognized by Gitlab.

Stop action When I press the stop button on the environment, I get greeted with this error message.

I can only "deploy to" the stop_test job.

deploy to

Any ideas on what I did wrong here? "Deploying" to stop_test does execute my script to stop the deployment.

Thanks!

Tschösi
  • 491
  • 3
  • 13
  • 1
    I've tried your exact configuration (besides filling in some echos for the scripts), and it works. I also get the same message as you, but when stopping the environment, the `stop_test` job is triggered – Jonas V Apr 08 '22 at 12:01
  • Thank you for checking! It does work for me too, but I don't understand why this message is shown... – Tschösi Apr 08 '22 at 12:11
  • @Tschösi and others who might wonder: There is a bug report for that: https://gitlab.com/gitlab-org/gitlab/-/issues/358939 – jojoob Apr 12 '23 at 08:36

0 Answers0