What does this MR do?
Currently, the only way to pass environment variables to a Docker/Kubernetes service during CI is to provide them inside the job's variables. This MR adds the possibility to declare an additional set of variables for the services, making them closer to the docker-compose spec.
Please note that it's my very first time using Go so there might be some issues that I'd be glad to fix with your help.
Why was this MR needed?
This is related to gitlab!72025 (merged), which aims to close gitlab#23671 (or at least to provide an initial solution).
What's the best way to test this MR?
- Setup a new project
- Register either a Docker or a Kubernetes executor
- Create a new
.gitlab-ci.yml
file with the following contentsimage: busybox:latest variables: GIT_STRATEGY: none stages: - build Build With A Service And Some Variables: stage: build image: curlimages/curl services: - name: ealen/echo-server:latest alias: echo-server variables: PORT: 5000 ENABLE__ENVIRONMENT: 'true' ENV_VAR_FOR_SERVICE: "This is a variable passed to the service" script: - curl echo-server:5000/?echo_env_body=ENV_VAR_FOR_SERVICE Build With A Service And No Variables: stage: build image: curlimages/curl services: - name: ealen/echo-server:latest alias: echo-server script: - curl echo-server:80/ Build Without A Service: stage: build image: busybox:latest script: - echo "Build Without A Service"