Set environment variables in GitLab Runner Helm chart
- Tier: Free, Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
Environment variables are key-value pairs that contain information that applications can use to adjust their behavior at runtime. These variables are injected into the container’s environment. You can use these variables to pass configuration data, secrets, or any other dynamic information required by the application.
You can set environment variables in GitLab Runner Helm chart by using the:
Use the runners.config
property
You can configure environment variables through the runners.config
property, similar to what you would do in the config.toml
file:
runners:
config: |
[[runners]]
shell = "bash"
[runners.kubernetes]
host = ""
environment = ["FF_USE_ADVANCED_POD_SPEC_CONFIGURATION=true"]
Variables defined this way are applied to both the job Pod and the GitLab Runner Manager container.
In the example above, the FF_USE_ADVANCED_POD_SPEC_CONFIGURATION
feature flag is set as an environment variable,
which the GitLab Runner Manager uses to modify its behavior.
Use values.yaml
properties
You can also set environment variables by using the following properties in values.yaml
.
These variables only affect the GitLab Runner Manager container.
envVars
envVars: - name: RUNNER_EXECUTOR value: kubernetes
extraEnv
extraEnv: CACHE_S3_SERVER_ADDRESS: s3.amazonaws.com CACHE_S3_BUCKET_NAME: runners-cache CACHE_S3_BUCKET_LOCATION: us-east-1 CACHE_SHARED: true
extraEnvFrom
extraEnvFrom: {} CACHE_S3_ACCESS_KEY: secretKeyRef: name: s3access key: accesskey CACHE_S3_SECRET_KEY: secretKeyRef: name: s3access key: secretkey
For more information on
extraEnvFrom
, see: