Environment stop job shows up in environment's "manual job" dropdown

Hello.

I’m trying to implement “Review Apps”-style CI/CD process in a project I’m working on. To that end, I have added two jobs to my .gitlab-ci.yml as per help/ci/environments:

stages:
  - build
  - test
  - deploy

<...>

k8s/cd/review:
  stage: deploy
  environment:
    name: review/$CI_COMMIT_REF_NAME
    url: https://$CI_COMMIT_REF_SLUG.ci.example.tld
    on_stop: k8s/cd/review/stop
  when: manual
  script:
    - <...>


k8s/cd/review/stop:
  stage: deploy
  environment:
    name: review/$CI_COMMIT_REF_NAME
    action: stop
  when: manual
  script:
    - <...>

This works, but the “Manual job” dropdown (the “Play” button) in Pipelines shows both start and stop jobs. When deployment completes, the environment in “Environments” gets both a “Stop” button and a “Play” button with just the stop job in its dropdown.

This is kinda confusing, and I suspect I have misconfigured something. Is this intended/expected behavior?

This is exactly what we see. The stop job may be called automatically by gitlab when you merge or close MRs or by your users to manually destroy an environment. We have found this useful, for example, when we push broken migrations. We have to destroy the env and try again.

We even leverage this behavior to setup other tasks in the environment, like a job that dumps the current logs.

image