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.
envVarsenvVars: - name: RUNNER_EXECUTOR value: kubernetesextraEnvextraEnv: CACHE_S3_SERVER_ADDRESS: s3.amazonaws.com CACHE_S3_BUCKET_NAME: runners-cache CACHE_S3_BUCKET_LOCATION: us-east-1 CACHE_SHARED: trueextraEnvFromextraEnvFrom: {} CACHE_S3_ACCESS_KEY: secretKeyRef: name: s3access key: accesskey CACHE_S3_SECRET_KEY: secretKeyRef: name: s3access key: secretkeyFor more information on
extraEnvFrom, see: