JetBrains Space Help

Helm Charts

Prerequisites

  • A Helm chart is stored in a separate directory in the project sources.

  • If you want to publish charts to Space Packages, make sure the project has a Docker registry.

Eligible images

The typical CI/CD task when working with a Helm chart is publishing it to a registry. With Space Automation, you can publish charts to Space Packages or to any external registry.

Publish Helm charts to Space Packages

Automation does not provide any special API for working with Helm, you should directly use the helm command-line tool.

  1. If you want to automatically generate a chart version based on the job run number, remove the version from Chart.yaml. The version line should look like:

    version:
  2. Edit the .space.kts file. The following example publishes hello-helm located in the helm-chart/hello-helm directory to the containers registry. The version of the Helm chart is adjusted with the script run number: 0.1.$JB_SPACE_EXECUTION_NUMBER.

    job("Publish Helm chart") { container("alpine/helm") { shellScript { content = """ export HELM_EXPERIMENTAL_OCI=1 sed -i.bak "s/^version:/version: 0.1.${'$'}JB_SPACE_EXECUTION_NUMBER/" ./helm_charts/hello-helm/Chart.yaml helm registry login mycompany.registry.jetbrains.space -u ${'$'}JB_SPACE_CLIENT_ID -p ${'$'}JB_SPACE_CLIENT_SECRET helm package ./helm_charts/hello-helm helm push hello-helm-0.1.${'$'}JB_SPACE_EXECUTION_NUMBER.tgz oci://mycompany.registry.jetbrains.space/p/project-key/containers """ } } }

Publish Helm charts to external registries

Publishing charts to external registries is almost the same as publishing to a Space Packages registry. The only difference is that you should store credentials to the repository in the Secrets&Parameters storage.

  1. Create a parameter and a secret for storing the username and password that the script must use to access the external repository.

    Secrets and parameters
  2. If you want to automatically generate chart version based on the job run number, remove the version from Chart.yaml. The version line should look like:

    version:
  3. Edit the .space.kts file:

    job("Publish Helm chart") { container("alpine/helm") { env["PSWRD"] = Secrets("repo-password") env["ID"] = Params("repo-user") shellScript { content = """ export HELM_EXPERIMENTAL_OCI=1 sed -i.bak "s/^version:/version: 1.1.${'$'}JB_SPACE_EXECUTION_NUMBER/" ./helm_charts/hello-helm/Chart.yaml helm registry login externalrepo.url -u ${'$'}ID -p ${'$'}PSWRD helm package ./helm_charts/hello-helm helm push hello-helm-1.1.${'$'}JB_SPACE_EXECUTION_NUMBER.tgz oci://externalrepo.url/repo-name """ } } }
Last modified: 15 December 2023