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

Search





You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

Overview

The HelmPublish step publishes a Helm chart and associated build info from a location in a Git repo to a Helm repository in Artifactory.


This step uses the helm package  command to publish the collection of Helm files in the GitRepo to Artifactory.

The step can optionally publish build info with the Helm chart to Artifactory using the autoPublishBuildInfo flag.

Once the Helm chart is published to Artifactory, it can be deployed to a Kubernetes cluster using HelmDeploy.

Page Contents


YAML Schema

The YAML schema for HelmPublish native step is as follows:

HelmPublish
pipelines:
  - name:   <string>
    steps:
      - name: <string>
        type: HelmPublish
        configuration:
          #inherits from bash
          helmVersion:       <2 | 3>                               # optional, defaults to 2
          chartPath:         <path string>
          flags:             <option string>                       # optional
          lint:              <true | false>                        # optional, default false
          lintFlags:         <string>                              # optional
          valueFilePaths:                                          # optional
            - <path and filename>
          autoPublishBuildInfo: <true | false>                     # default false          
          inputResources:
            - name:         <GitRepo resource>                     # required
          outputResources:
            - name:         <HelmChart resource>                   # required
            - name:         <BuildInfo resource>                   # optional

        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 HelmPublish 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

inputResources 

Must specify  GitRepo resource that contains the Helm chart. 

The step will package the chart into a versioned chart archive file.

Required
outputResources  

Must specify  HelmChart   resource to update. The version property of the HelmChart is automatically set to the new chart version.

Must specify a  BuildInfo resource  when  autoPublishBuildInfo  is set to true. If  JFROG_CLI_BUILD_NAME  or  JFROG_CLI_BUILD_NUMBER  is set as an environment variable for the pipeline or the step, that name and/or number is used for the output BuildInfo. Otherwise, the default buildName and buildNumber are $pipeline_name and $run_number.

Required

May be 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
chartPathThe path to the Helm chart in the GitRepoRequired
flags

Command line options to pass to the  helm package command.

Optional
lint

When true, performs a   lint test to verify that the chart is well formed.

Defaults to false.

Optional
lintFlagsOptions string to pass to the  helm lint  command .Optional
valueFilePaths

Specifies values YAML file(s) that will be used in the lint command helm lint command.

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

Optional

autoPublishBuildInfo

When true, publishes build info with the Helm chart.

Default is false.

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 HelmPublish step.

Publish to Artifactory using Helm 3

A HelmPublish step using Helm 3 to publish to Artifactory.

HelmPublish
pipelines: 
  - name: helmPublishPipeline
    steps:
      - name: helmPublishStep
        type: HelmPublish
        configuration: 
          helmVersion: 3
          chartPath: "./myChart"
          inputResources:
            - name: gitRepoResource
          outputResources:
            - name: helmChartResource

Using lint and values.yaml

A HelmPublish step with lint, using a values.yaml file, added before publishing the Helm chart.

HelmPublish
pipelines: 
  - name: helmPublishPipeline
    steps:
      - name: helmPublishStep
        type: HelmPublish
        configuration: 
          helmVersion: 3
          chartPath: "./myChart"
          lint: true
          lintFlags: "--strict"
          valueFilePaths:
            - values.yaml
          inputResources:
            - name: gitRepoResource
          outputResources:
            - name: helmChartResource

Publish Build Info

A HelmPublish step that publishes build info. 

HelmPublish
pipelines: 
  - name: helmPublishPipeline
    steps:
      - name: helmPublishStep
        type: HelmPublish
        configuration: 
          helmVersion: 3
          chartPath: "./myChart"
          autoPublishBuildInfo: true
          inputResources:
            - name: gitRepoResource
          outputResources:
            - name: helmChartResource
            - name: buildInfoResource

Publish to Artifactory using Helm 2

A HelmPublish step using Helm 2 to publish to Artifactory.

HelmPublish
pipelines: 
  - name: helmPublishPipeline
    steps:
      - name: helmPublishStep
        type: HelmPublish
        configuration: 
          helmVersion: 2
          chartPath: "./myChart"
          inputResources:
            - name: gitRepoResource
          outputResources:
            - name: helmChartResource

How it Works

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

  • jfrog rt config (to configure the JFrog CLI with the Artifactory credentials)
  • jfrog rt use (to set the current default Artifactory configuration )
  • helm init --client-only (if the Helm version is 2)
  • replace_envs (if lint is true and there are valueFilePaths, to replace variable placeholders)
  • helm lint (if lint is true)
  • helm package
  • jfrog rt upload (upload the Helm chart)
  • write_output (to update the version in the output HelmChart resource)
  • jfrog rt build-collect-env (if autoPublishBuildInfo is true, collect environment variables)
  • jfrog rt build-publish (if autoPublishBuildInfo is true, publish the build info)
  • write_output (if autoPublishBuildInfo is true, to update the version in the output BuildInfo resource)
  • No labels
Copyright © 2021 JFrog Ltd.