Gitlab CI: Set dynamic variables

Viewed 14758

For a gitlab CI I'm defining some variables like this:

variables:
  PROD: project_package
  STAGE: project_package_stage
  PACKAGE_PATH: /opt/project/build/package
  BUILD_PATH: /opt/project/build/package/bundle
  CONTAINER_IMAGE: registry.example.com/project/package:e2e

I would like to set those variables a bit more dynamically, as there are mainly only two parts: project and package. Everything else depends on those values, that means I have to change only two values to get all other variables.

So I would expect something like

variables:
  PROJECT: project
  PACKAGE: package
  PROD: $PROJECT_$PACKAGE
  STAGE: $PROD_stage
  PACKAGE_PATH: /opt/$PROJECT/build/$PACKAGE
  BUILD_PATH: /opt/$PROJECT/build/$PACKAGE/bundle
  CONTAINER_IMAGE: registry.example.com/$PROJECT/$PACKAGE:e2e

But it looks like, that the way doing this is wrong...

1 Answers
Related