2.9.3 • Published 5 months ago

semantic-release-helm-git-chart v2.9.3

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

semantic-release-helm3

semantic-release plugin to publish Helm charts.

Latest version License Downloads Total Downloads

StepDescription
verifyConditionsVerify required configuration and login to Helm registry.
prepareUpdate version and/or appVersion in Chart.yaml.
publishPublish Helm chart to registry.

NOTE: This is a fork of semantic-release-helm with added support for ChartMuseum repositories such as Harbor by utilizing the helm cm-push plugin. It also supports helm versions >=3.7.0 and pre-release branches.

This is a plugin for semantic-release. It updates version and appVersion of a Helm chart's Chart.yaml.

The version and appVersion are updated according to nextRelease.version. Updating the appVersion is optional and can be disabled by setting onlyUpdateVersion to true.

Install

npm install semantic-release-helm3 -D

BREAKING CHANGE in v2

path has been renamed to chartPath to prevent config conflicts.

Examples:
version 0.1.0  
appVersion 1.16.0
  1. patch (1.16.0 -> 1.16.1)
    New chart version is 0.1.1

  2. minor (1.16.0 -> 1.17.0)
    New chart version is 0.2.0

  3. major (1.16.0 -> 2.0.0)
    New chart version is 1.0.0

Configuration

Plugin Config

ParameterTypeDefaultRequiredDescription
chartPathstring""trueChart directory, where the Chart.yaml is located.
registrystring""falseURI of a container registry.
onlyUpdateVersionbooleanfalsefalseDon't change appVersion if this is true. Useful if your chart is in a different git repo than the application.
crPublishbooleanfalsefalseEnable chart-releaser publishing.
crConfigPathstring""falsePath to .ct.yaml chart-releaser configuration file.
isChartMuseumbooleanfalsefalseEnable ChartMuseum publishing.
populateChangelogbooleanfalsefalsePopulate artifacthub.io/changes annotations with notes produced by @semantic-release/release-notes-generator compatible plugins.
skipRegistryLoginbooleanfalsefalseSkip the helm registry login command in the verifyConditions step.
packageArgsstring""falseAdditional parameters for the helm package command, e.g. --key mykey --keyring ~/.gnupg/secring.gpg
cmPushArgsstring""falseAdditional parameters for the helm cm-push command (only relevant if isChartMuseum is set to true) e.g. --context-path /repo/path

Environment Variables

Set chart path

export CHART_PATH=<dir>

Pass credentials through environment variables accordingly:

export REGISTRY_HOST=<HOST>
export REGISTRY_USERNAME=<USERNAME>
export REGISTRY_PASSWORD=<PASSWORD>

For S3 pass the AWS credentials as environment variables:

export AWS_REGION=<REGION>
export AWS_ACCESS_KEY_ID=<ACCESS_KEY_ID>
export AWS_SECRET_ACCESS_KEY=<SECRET_ACCESS_KEY>

Example

This will update version and appVersion in ./chart/Chart.yaml and push the chart to localhost:5000/repo/chart. The image will be tagged with the value of version from Chart.yaml.

{
  "plugins": [
    [
      "semantic-release-helm3",
      {
        chartPath: './chart',
        registry: 'localhost:5000/repo/chart'
      }
    ]
  ]
}

ChartMuseum Example

The helm cm-push plugin adds support for ChartMuseum repositories such as Harbor.

This will push the chart to the specified repository, e.g. https://mydomain.com/chartrepo/myproject and tag the chart with the value of version from Chart.yaml.

It is important to set isChartMuseum to true and to specify the repository url as registry.

Note: It is required to have at least helm version 3.7.0 installed.

{
  "plugins": [
    [
      "semantic-release-helm3",
      {
        chartPath: './chart',
        registry: 'https://mydomain.com/chartrepo/myproject',
        isChartMuseum: true
      }
    ]
  ]
}

S3 Example

The helm-s3 plugin adds support for S3. Check the documentation for additional options

This will update version in ./chart/Chart.yaml and push the chart to s3://my-s3-bucket/s3-prefix. The image will be tagged with the value of version from Chart.yaml.

{
  "plugins": [
    [
      "semantic-release-helm3",
      {
        chartPath: './chart',
        registry: 's3://my-s3-bucket-repo/s3-prefix',
        onlyUpdateVersion: true,
      }
    ]
  ]
}