Strange behaviour with extends and environments

Hi everybody,

I’m currently running into a strange behaviour regarding variable substitution, extends and environments.

The pipeline editor is telling me this YAML is invalid:
This GitLab CI configuration is invalid: test_ext job: on_stop job stop_${TEST} is not defined, but according to the docs, this should be valid.

.test:
  stage: stop
  script:
    - echo null
  environment:
    name: $TEST
    on_stop: stop_${TEST}

.stop:
  stage: stop
  script:
    - echo stop
  environment:
    name: $TEST
    action: stop


test_ext:
  extends: .test
  variables: 
    TEST: bla

stop_bla:
  extends: .stop
  variables:
    TEST: bla

I’m not entirely sure why this is not working as I expect, but I’m kinda sure something is wrong with my code and not with gitlab :stuck_out_tongue:

I’m not sure the docs do say that. I believe you can use a variable for environment:name, but not for environment:on_stop.

1 Like

Oh thats sad, I would have really needed that…

But thank you anyway :slight_smile:

In that case, do raise an issue to ask for it to be added in!

1 Like