Skip to main content

Review Helm

Deploys a Helm chart as a GitLab review environment and removes it when the review environment stops.

The component expects a Helm chart artifact under release/charts/ from needs-start, renders any configured values files with environment substitution, and runs helm upgrade --install against the selected namespace. After a successful deploy, it reads the first Ingress host in the namespace and writes it to review.env as CI_ENVIRONMENT_HOST, so GitLab can set the environment URL from the dotenv report.

include:
- component: $CI_SERVER_FQDN/$CI_PROJECT_PATH/helm@$CI_COMMIT_SHA
inputs:
name: my-app
path: chart
- component: $CI_SERVER_FQDN/$CI_PROJECT_PATH/review-helm@$CI_COMMIT_SHA
inputs:
release: my-app
namespace: "$CI_ENVIRONMENT_SLUG"
create-namespace: true
value-files:
- chart/values.review.yaml
set-parameters:
- image.tag=$CI_COMMIT_SHA
needs-start:
- job: build:helm:my-app
artifacts: true

Set create-namespace: true when the component should create and delete the namespace for the review release. Keep it false when the namespace lifecycle is managed outside this component.

Kubernetes service account

The GitLab CI variable KUBECONFIG must point to a service account that can read the target namespace, manage the Helm release resources, and read Ingress resources so the component can discover the review URL.

Inputs

NameDescriptionDefaultType
------------
contextKubernetes context to use for the review release.string
create-namespaceCreate and delete the namespace with the Helm test namespace helpers.falseboolean
environmentGitLab environment prefix.reviewstring
environment-identifierGitLab environment suffix./$CI_PIPELINE_IID-$CI_COMMIT_SHORT_SHAstring
nameThe name prefix for review Helm jobs.review-helmstring
namespaceKubernetes namespace for the review release.$CI_ENVIRONMENT_SLUGstring
needs-startJobs that provide the Helm chart artifact.[{"job":"build:helm:helm","artifacts":true}]array
needs-stopJobs that the stop job depends on.[]array
releaseHelm release name.$CI_PROJECT_NAMEstring
rulesRules that control when review Helm jobs run.[{"if":"$CI_PIPELINE_SOURCE == \"merge_request_event\"","when":"on_success"},{"when":"never"}]array
set-parametersHelm --set parameters as key=value entries.[]array
stagePipeline stage for review Helm jobs.teststring
tagstring
timeoutTimeout for Helm install, upgrade, and stop operations.20mstring
value-filesHelm values files to pass to the review release.[]array