What does this MR do and why?
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 Ruby so there might be some issues that I'd be glad to fix with your help.
How to set up and validate locally
Setup a new project
Create a new
.gitlab-ci.ymlfile with the following contents
image: 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"
The CI file is correctly validated by the linter
It can also be tested by building and using a runner with the code from gitlab-runner!3158 (closed)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
I have evaluated the MR acceptance checklist for this MR.
Related to #23671