Package and Deploy Helm Charts task

Azure Pipelines

Use this task in a build or release pipeline to deploy, configure, or update a Kubernetes cluster in Azure Container Service by running Helm commands. Helm is a tool that streamlines deploying and managing Kubernetes apps using a packaging format called charts. You can define, version, share, install, and upgrade even the most complex Kubernetes app by using Helm.

  • Helm helps you combine multiple Kubernetes manifests (yaml) such as service, deployments, configmaps, and more into a single unit called Helm Charts. You don't need to either invent or use a tokenization or a templating tool.
  • Helm Charts help you manage application dependencies and deploy as well as rollback as a unit. They are also easy to create, version, publish, and share with other partner teams.

Azure Pipelines has built-in support for Helm charts:

  • The Helm Tool installer task can be used to install the correct version of Helm onto the agents.
  • The Helm package and deploy task can be used to package the app and deploy it to a Kubernetes cluster. You can use the task to install or update Tiller to a Kubernetes namespace, to securely connect to Tiller over TLS for deploying charts, or to run any Helm command such as lint.
  • The Helm task supports connecting to an Azure Kubernetes Service by using an Azure service connection. You can connect to any Kubernetes cluster by using kubeconfig or a service account.
  • Helm deployments can be supplemented by using the Kubectl task; for example, create/update, imagepullsecret, and others.

Service Connection

The task works with two service connection types: Azure Resource Manager and Kubernetes Service Connection.

Azure Resource Manager

ParametersDescription
connectionType
(Service connection type)
(Required) Azure Resource Manager to use Azure Kubernetes Service. Kubernetes Service Connection for any other cluster.
Default value: Azure Resource Manager
azureSubscriptionEndpoint
(Azure subscription)
(Required) Name of the Azure service connection.
azureResourceGroup
(Resource group)
(Required) Name of the resource group within the subscription.
kubernetesCluster
(Kubernetes cluster)
(Required) Name of the AKS cluster.
namespace
(Namespace)
(Optional) The namespace on which the kubectl commands are run. If not specified, the default namespace is used.

This YAML example YAML shows how Azure Resource Manager is used to refer to the Kubernetes cluster. This is used with one of the helm commands and the appropriate values required for the command:

variables:
    azureSubscriptionEndpoint: Contoso
    azureContainerRegistry: contoso.azurecr.io
    azureResourceGroup: Contoso
    kubernetesCluster: Contoso

- task: HelmDeploy@0
  displayName: Helm deploy
  inputs:
    connectionType: Azure Resource Manager
    azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
    azureResourceGroup: $(azureResourceGroup)
    kubernetesCluster: $(kubernetesCluster)

Kubernetes Service Connection

ParametersDescription
kubernetesServiceEndpoint
(Kubernetes service connection)
(Required) Select a Kubernetes service connection.
namespace
(Namespace)
(Optional) The namespace on which the kubectl commands are run. If not specified, the default namespace is used.

This YAML example YAML shows how Kubernetes service connection is used to refer to the Kubernetes cluster. This is used with one of the helm commands and the appropriate values required for the command:

- task: HelmDeploy@0
  displayName: Helm deploy
  inputs:
    connectionType: Kubernetes Service Connection
    kubernetesServiceEndpoint: Contoso

Command values

The command input accepts one of the following helm commands: create/delete/expose/get/init/install/login/logout/ls/package/rollback/upgrade.

ParametersDescription
command
(Command)
(Required) Select a helm command.
Default value: ls
arguments
(Arguments)
Helm command options.

This YAML example demonstrates the ls command:

- task: HelmDeploy@0
  displayName: Helm list
  inputs:
    azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
    azureResourceGroup: $(azureResourceGroup)
    kubernetesCluster: $(kubernetesCluster)
    command: ls
    arguments: --all

init command

ParametersDescription
command
(Command)
(Required) Select a helm command.
Default value: ls
canaryimage
(Use canary image version)
Use the canary Tiller image, the latest pre-release version of Tiller.
Default value: false
upgradetiller
(Upgrade Tiller)
Upgrade if Tiller is already installed.
Default value: true
waitForExecution
(Wait)
Block until the command execution completes.
Default value: true
arguments
(Arguments)
Helm command options.

This YAML example demonstrates the init command:

- task: HelmDeploy@0
  displayName: Helm init
  inputs:
    azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
    azureResourceGroup: $(azureResourceGroup)
    kubernetesCluster: $(kubernetesCluster)
    command: init
    upgradetiller: true
    waitForExecution: true
    arguments: --client-only

install command

ParametersDescription
command
(Command)
(Required) Select a helm command.
Default value: ls
chartType
(Chart Type)
(Required) Select how you want to enter chart information. You can provide either the name of the chart or the folder/file path to the chart.
Default value: Name
chartName
(Chart Name)
(Required) Chart reference to install, this can be a url or a chart name. For example, if chart name is stable/mysql, the task will run helm install stable/mysql
releaseName
(Release Name)
(Optional) Release name. If not specified, it will be autogenerated. releaseName input is only valid for 'install' and 'upgrade' commands
overrideValues
(Set Values)
(Optional) Set values on the command line. You can specify multiple values, or separate values with commas. For example, key1=val1,key2=val2. The task will construct the helm command by using these set values. For example, helm install --set key1=val1 ./redis
valueFile
(Value File)
(Optional) Specify values in a YAML file or a URL. For example, specifying myvalues.yaml will result in helm install --values=myvals.yaml
updatedependency
(Update Dependency)
(Optional) Run helm dependency update before installing the chart. Update dependencies from requirements.yaml to the charts/ directory before packaging.
Default value: false
waitForExecution
(Wait)
(Optional) Block until command execution completes.
Default value: true
arguments
(Arguments)
Helm command options

This YAML example demonstrates the install command:

- task: HelmDeploy@0
  displayName: Helm install
  inputs:
    azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
    azureResourceGroup: $(azureResourceGroup)
    kubernetesCluster: $(kubernetesCluster)
    command: install
    chartType: FilePath
    chartPath: Application/charts/sampleapp

package command

ParametersDescription
command
(Command)
(Required) Select a helm command.
Default value: ls
chartPath
(Chart Path)
(Required) Path to the chart to install. This can be a path to a packaged chart or a path to an unpacked chart directory. For example, if ./redis is specified the task will run helm install ./redis. If you are consuming a chart which is published as an artifact then the path will be $(System.DefaultWorkingDirectory)/ARTIFACT-NAME/Charts/CHART-NAME
version
(Version)
(Optional) Specify the exact chart version to install. If this is not specified, the latest version is installed. Set the version on the chart to this semver version.
destination
(Destination)
(Optional) Specify values in a YAML file or a URL.
Default value: $(Build.ArtifactStagingDirectory)
updatedependency
(Update Dependency)
(Optional) Run helm dependency update before installing the chart. Update dependencies from requirements.yaml to the charts/ directory before packaging.
Default value: false
save
(Save)
(Optional) Save packaged chart to local chart repository.
Default value: true
arguments
(Arguments)
Helm command options.

This YAML example demonstrates the package command:

- task: HelmDeploy@0
  displayName: Helm package
  inputs:
    command: package
    chartPath: Application/charts/sampleapp
    destination: $(Build.ArtifactStagingDirectory)

upgrade command

ParametersDescription
command
(Command)
(Required) Select a helm command.
Default value: ls
chartType
(Chart Type)
(Required) Select how you want to enter chart information. You can provide either the name of the chart or the folder/file path to the chart.
Default value: Name
chartName
(Chart Name)
(Required) Chart reference to install, this can be a url or a chart name. For example, if chart name is stable/mysql, the task will run helm install stable/mysql
releaseName
(Release Name)
(Optional) Release name. If not specified, it will be autogenerated.
overrideValues
(Set Values)
(Optional) Set values on the command line. You can specify multiple values, or separate values with commas. For example, key1=val1,key2=val2. The task will construct the helm command by using these set values. For example, helm install --set key1=val1 ./redis
valueFile
(Value File)
(Optional) Specify values in a YAML file or a URL. For example, specifying myvalues.yaml will result in helm install --values=myvals.yaml
install
(Install if release not present)
(Optional) If a release by this name does not already exist, start an installation.
Default value: true
recreate
(Recreate Pods)
(Optional) Performs pods restart for the resource if applicable.
Default value: false
resetValues
(Reset Values)
(Optional) Reset the values to the ones built into the chart.
Default value: false
force
(Force)
(Optional) Force resource update through delete/recreate if required.
Default value: false
waitForExecution
(Wait)
(Optional) Block until command execution completes.
Default value: true​
arguments
(Arguments)
Helm command options

This YAML example demonstrates the upgrade command:

- task: HelmDeploy@0
  displayName: Helm upgrade
  inputs:
    azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
    azureResourceGroup: $(azureResourceGroup)
    kubernetesCluster: $(kubernetesCluster)
    command: upgrade
    chartType: filepath
    chartPath: $(Build.ArtifactStagingDirectory)/sampleapp-v0.2.0.tgz
    releaseName: azuredevopsdemo
    install: true
    waitForExecution: false

Open source

This task is open source on GitHub. Feedback and contributions are welcome.