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.

Publishing 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 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 myChart located in the helm-chart directory to the mydocker 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-chart/Chart.yaml helm registry login mycompany.registry.jetbrains.space -u ${'$'}JB_SPACE_CLIENT_ID -p ${'$'}JB_SPACE_CLIENT_SECRET helm chart save ./helm-chart mycompany.registry.jetbrains.space/p/pkey/mydocker/myChart helm chart push registry.jetbrains.team/p/astst/containers/myChart:0.1.${'$'}JB_SPACE_EXECUTION_NUMBER """ } } }

Publishing 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: 0.1.${'$'}JB_SPACE_EXECUTION_NUMBER/" ./helm-chart/Chart.yaml helm registry login externalrepo.example.com -u ${'$'}ID -p ${'$'}PSWRD helm chart save ./helm-chart externalrepo.example.com/mydocker/myChart helm chart push registry.jetbrains.team/p/astst/containers/myChart:0.1.${'$'}JB_SPACE_EXECUTION_NUMBER """ } } }
Last modified: 18 August 2021