Cloud customer?
Start for Free >
Upgrade in MyJFrog >
What's New in Cloud >

Search





Overview

The  HelmDeploy  step deploys a Docker image to a Kubernetes cluster using a Helm chart.


The Helm chart used to deploy the image through this native step can be either:

  • HelmChart resource that identifies a Helm chart stored in an Artifactory repository by HelmPublish.
  • A Helm chart in a source code repository identified by a GitRepo resource.

When properly configured, the HelmDeploy step will also perform a replace_envs operation on all files specified under the valueFilePaths tag to replace all environment variables in those files with their values. This enables the step to derive information from a resource (such as the image name and tag from an Image) and use it to perform the deployment.

The HelmDeploy step uses the helm upgrade command to perform the deployment.

Page Contents


YAML Schema

The YAML schema for HelmDeploy native step is as follows:

HelmDeploy
pipelines:
  - name:   <string>
    steps:
      - name: <string>
        type: HelmDeploy
        configuration:
          #inherits from bash
          helmVersion:         <2 | 3>          # optional, defaults to 2
          flags:               <string>         # optional
          valueFilePaths:                       # optional
            - <path and filename>
          releaseName:         <string> 
          chartPath:           <path string>    # optional, may be required for certain input resources
		  chartName:           <path string>    # optional, may be required for certain input resources
		  chartVersion:        <path string>    # optional, may be required for certain input resources
          dryRun:              <true | false>   # optional, only deploys if the dryrun is success
          lint:                <true | false>   # lints chart before upgrade, default false
          lintFlags: “--strict”
          test:                <true | false>   # runs helm test after upgrade, default false
          testFlags: “--parallel”

          integrations:
            - name:         <kubernetes integration>      		   # required
          inputResources:
            - name:         <HelmChart, GitRepo, FileSpec or BuildInfo resource>        # required, only one input resource is allowed

        execution:
          onStart:
            - echo "Preparing for work..."
          onSuccess:
            - echo "Job well done!"
          onFailure:
            - echo "uh oh, something went wrong"
          onComplete: #always
            - echo "Cleaning up some stuff"

Tags

name 

An  alphanumeric string (underscores are permitted) that identifies the step.

type 

Must be HelmDeploy  for this step type.

configuration

Specifies all configuration selections for the step's execution environment. This step inherits the  Bash/PowerShell  step configuration tags, including these pertinent   tags:

Tag

Description of usage

Required/Optional

integrations Must specify a Kubernetes Integration.Required
inputResources 

Must specify either HelmChart resource or a  GitRepo resource that contains a Helm chart.

Required


In addition, these tags can be defined to support the step's native operation:

Tag

Description of usage

Required/Optional
helmVersionA number representing the major version of Helm to use. Can be 2 or 3. Defaults to 2.Optional
flagsA flag string to be included in the helm command. For example: "--set key=’value’ -f myTestValues.yaml"Optional
valueFilePaths

Specifies values YAML file(s) for use with a--values (-f) option of the  helm install command.

All environment variable references in the specified file(s) will be automatically replaced with values of matching runtime environment variables. 

Optional
releaseName

The release name. Equivalent to the --name (-n) option of the  helm install command.

Required
chartPath

The path to the Helm chart in the GitRepo/FileSpec/BuildInfo resource specified in inputResources.

Do not use when a HelmChart resource is specified.

May be required
chartName

The name of the Helm chart in the FileSpec/BuildInfo resource specified in inputResources.

Do not use when a HelmChart/GitRepo resource is specified or when your input resource is not an Artifactory Helm repository.

May be required
chartVersion

The name of the Helm chart in the FileSpec/BuildInfo resource specified in inputResources.

Do not use when a HelmChart/GitRepo resource is specified or when your input resource is not an Artifactory Helm repository.

May be required
dryRun

When true, only deploys if the --dry-run install simulation is successful.

Defaults to false.

Optional
lint

When set to true performs a  lint to examine a chart for possible issues.

Defaults to false.

Optional
lintFlagsFlag string to pass to the helm lint command.Optional
test

When set to true performs a  test to run the tests for release.

Defaults to false.

Optional
testFlagsFlag string to pass to the helm test command.Optional

execution

Declares collections of shell command sequences to perform for pre- and post-execution phases:

Tag

Description of usage

Required/Optional
onStartCommands to execute in advance of the native operationOptional
onSuccessCommands to execute on successful completionOptional
onFailureCommands to execute on failed completionOptional
onCompleteCommands to execute on any completionOptional

The actions performed for the onExecute  phase are inherent to this step type and may not be overridden.


Examples

The following examples show how to configure a HelmDeploy step.

Helm 3 and HelmChart Resource Input

A HelmDeploy step using Helm 3 and a HelmChart resource input.

HelmDeploy
pipelines: 
  - name: helmDeployPipeline
    steps:
      - name: helmDeployStep
        type: HelmDeploy
        configuration: 
          helmVersion: 3
          releaseName: myHelmRelease
          integrations:
            - name: kubernetes_integration
          inputResources:
            - name: helmChartResource

Dry Run

A HelmDeploy step using Helm 3 and a HelmChart resource input with values files and a dry run before the deployment.

HelmDeploy
pipelines: 
  - name: helmDeployPipeline
    steps:
      - name: helmDeployStep
        type: HelmDeploy
        configuration: 
          helmVersion: 3
          releaseName: myHelmRelease
          dryRun: true
          valueFilePaths:
            - values/values1.yaml
            - values/values2.yaml
          integrations:
            - name: kubernetes_integration
          inputResources:
            - name: helmChartResource

GitRepo Input

A HelmDeploy step with a GitRepo input instead of a HelmChart and lint and test commands. 

HelmDeploy
pipelines: 
  - name: helmDeployPipeline
    steps:
      - name: helmDeployStep
        type: HelmDeploy
        configuration: 
          helmVersion: 3
          chartPath: "./myChart"
          releaseName: myHelmRelease
          lint: true
          lintFlags: "--strict"
          test: true
          testFlags: "--parallel"
          valueFilePaths:
            - values/values1.yaml
            - values/values2.yaml
          integrations:
            - name: kubernetes_integration
          inputResources:
            - name: gitRepoResource

FileSpec Input

A HelmDeploy step with a FileSpec input resource. When using the FileSpec input resource, use the chartPath property to specify where the Helm chart file is in the FileSpec resource. If the FileSpec represents a Generic repository in Artifactory that contains the Helm chart, use the following configuration as a reference:

HelmDeploy
pipelines: 
  - name: helmDeployPipeline
    steps:
      - name: helmDeployStep
        type: HelmDeploy
        configuration: 
          helmVersion: 3
          chartPath: "./myChart"
          releaseName: myHelmRelease
          lint: true
          lintFlags: "--strict"
          test: true
          testFlags: "--parallel"
          valueFilePaths:
            - values/values1.yaml
            - values/values2.yaml
          integrations:
            - name: kubernetes_integration
          inputResources:
            - name: fileSpecResource

If the FileSpec input resource represents a Helm repository in Artifactory, you will also need to provide the chartName and chartVersion configuration properties:

HelmDeploy
pipelines: 
  - name: helmDeployPipeline
    steps:
      - name: helmDeployStep
        type: HelmDeploy
        configuration: 
          helmVersion: 3
          chartPath: "./myChart"
		  chartName: "myChartName"
		  chartVersion: 0.0.1
          releaseName: myHelmRelease
          lint: true
          lintFlags: "--strict"
          test: true
          testFlags: "--parallel"
          valueFilePaths:
            - values/values1.yaml
            - values/values2.yaml
          integrations:
            - name: kubernetes_integration
          inputResources:
            - name: fileSpecResource

BuildInfo Input

A HelmDeploy step with a BuildInfo input resource. When using the BuildInfo input resource, use the chartPath property to specify where the Helm chart file is in the BuildInfo resource. If the BuildInfo represents a Generic repository in Artifactory that contains the Helm chart, use the following configuration as a reference:

HelmDeploy
pipelines: 
  - name: helmDeployPipeline
    steps:
      - name: helmDeployStep
        type: HelmDeploy
        configuration: 
          helmVersion: 3
          chartPath: "./myChart"
          releaseName: myHelmRelease
          lint: true
          lintFlags: "--strict"
          test: true
          testFlags: "--parallel"
          valueFilePaths:
            - values/values1.yaml
            - values/values2.yaml
          integrations:
            - name: kubernetes_integration
          inputResources:
            - name: buildInfoResource

If the BuildInfo input resource represents a Helm repository in Artifactory, you will also need to provide the chartName and chartVersion configuration properties:

HelmDeploy
pipelines: 
  - name: helmDeployPipeline
    steps:
      - name: helmDeployStep
        type: HelmDeploy
        configuration: 
          helmVersion: 3
          chartPath: "./myChart"
		  chartName: "myChartName"
		  chartVersion: 0.0.1
          releaseName: myHelmRelease
          lint: true
          lintFlags: "--strict"
          test: true
          testFlags: "--parallel"
          valueFilePaths:
            - values/values1.yaml
            - values/values2.yaml
          integrations:
            - name: kubernetes_integration
          inputResources:
            - name: buildInfoResource

Helm 2

A HelmDeploy step using Helm 2. 

HelmDeploy
pipelines: 
  - name: helmDeployPipeline
    steps:
      - name: helmDeployStep
        type: HelmDeploy
        configuration: 
          helmVersion: 2
          releaseName: myHelmRelease
          integrations:
            - name: kubernetes_integration
          inputResources:
            - name: helmChartResource

How it Works

When you use the HelmDeploy native step in a pipeline, it performs the following functions in the background:

  • helm init --client-only (if the Helm version is 2)
  • jfrog rt config (if there is a HelmChart resource input, to configure the JFrog CLI with the Artifactory credentials)
  • jfrog rt use (if there is a HelmChart resource input, to set the current default Artifactory configuration )
  • helm fetch (if there is a HelmChart resource input and the Helm version is 2, to fetch the chart)
  • helm pull (if there is a HelmChart resource input and the Helm version is 3, to fetch the chart)
  • replace_envs (if there are valueFilePaths, to replace variable placeholders)
  • helm lint (if lint is true)
  • helm --dry-run (if dryRun is true)
  • helm (deploy)
  • helm test (if test is true)
  • No labels
Copyright © 2021 JFrog Ltd.