Gitlab doesn't recognize stop action for environment

Gitlab doesn’t recognize stop action for environment

I have CICD Config, which creates an environment. However, the on_stop action doesn’t properly get recognized by gittlab (selfhosted 14.9.2).

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

When I try to stop the environment via the GUI, it tells me that there is “no “stop environment action” being defined in the .gitlab-ci.yml file.”.

However, I can select stop_test as a possible “deployment target”:
Screenshot from 2022-04-07 20-00-50

Any ideas on what I’m doing wrong here?

Thanks!

1 Like

I am having the same exact issue.

Did anyone find an answer for this? I am also having this issue. Thanks!

I’m seeing the exact same issue. Would be so nice to be able to remove environments from the deployments, without this error (it does work though).

Same issue in 14.10.5-ee

I have the same issue: my stop action is not recognized as such, but as a ‘start’ action. Pressing the stop gives the “no stop action defined” popup, and selecting the “start” action (that is called stop) does work.

Possible issue: Stop environment shows a note about not having an effect on any existing deployment (#358939) · Issues · GitLab.org / GitLab · GitLab