Multiple deployment jobs per environment

This is a question I’m having trouble answering after looking at some related issues/docs:

https://docs.gitlab.com/ee/ci/environments/deployment_safety.html


I felt like my exact situation didn’t come up in these issues even though the core idea is the same, so I must be missing some way of accomplishing what I want. I have a case where I’m deploying variations of the same backend service to the same environment in the same stage. So in the simplest case:

one:
  environment:
    name: dev
  stage: deploy
  script:
    - echo "service A: Variation 1"

two:
  environment:
    name: dev
  stage: deploy
  script:
    - echo "service A: Variable 2"

Gitlab CI considers these two deployment jobs to the same environment so the second one is always killed. I want these to both be able to run in the same pipeline, but if the same jobs are run in another pipeline I want the newer one to cancel the older one. I figured because these jobs have two different names they would be considered separate. So job “one” and “two” can both run, but a newer job “one” will cancel an older job “one” and similarly a newer job “two” will cancel an older job “two”.

I could define a resource_group but then I have to create one for the “one” job, the “two” job, and any other variations I create when the default job cancellation feature would work fine. Is there any other way I could make this work the way I expect?

I just tried adding resource_group to my jobs (two different group names for the two jobs) and they are still considered the same deployment job and one fails because it is “older” than the other. How is this supposed to work? I thought I could have an environment and a resource_group at the same time.