We have a monorepo with more than 20 subprojects sharing the same code base. Our pipeline requirements are:
- We want to be able to deploy each subproject separately.
- We want to be able to stop each subproject separately.
- We want to use GitLab Environments for development environments.
I have created a pipeline that basically looks like this:
stages:
- deploy
deploy_dev:
stage: deploy
script:
- env
parallel:
matrix:
- PROJECT_NAME: a
- PROJECT_NAME: b
- PROJECT_NAME: c
OTHER_VARIABLE: foo
- PROJECT_NAME: d
environment:
name: $PROJECT_NAME
# on_stop: stop_dev
rules:
- when: manual
The deploy job works as expected but I was not able to figure out how to stop the environments. I have noticed that when using the parallel matrix jobs, the CI_JOB_NAME
is set to ${job_name}: [ ${matrix variables} ]
, but it is unfortunately not possible to use environment variables in the environment:on_stop
key. Is it possible to somehow pass the PROJECT_NAME
variable from the deploy_dev
job to the stop_dev
job or otherwise stop the environments separately?