Skip to content

CI_ENVIRONMENT_SLUG variable not present in trigger job context

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Related to #426379 as it has the same root cause, but not the same issue, as that one has a workaround while this one does not.

The CI_ENVIRONMENT_SLUG variable is never generated for trigger jobs. While it's possible to work around this for the downstream pipeline context (pass CI_ENVIRONMENT_NAME and generate CI_ENVIRONMENT_SLUG in the downstream job that needs it), there is a usecase where this workaround doesn't help:

deploy:downstream:
  stage: deploy
  environment:
    name: review/$CI_COMMIT_REF_NAME
    url: https://myproject.internal/$CI_ENVIRONMENT_SLUG
  trigger:
    project: mygroup/myproject_deployment
    strategy: depend

The environment url will always be https://myproject.internal/ because the CI_ENVIRONMENT_SLUG is empty.

Edited by 🤖 GitLab Bot 🤖