The HelmPublishAndDeploy template creates a pipeline that publishes a Helm Chart to a Helm repository in Artifactory, creates a Build Info, promotes the Build, and then deploys the Helm Chart from the promoted Build resource using the #UUID-b96e00a5-c5d1-cc04-4556-68e67b16f1e9HelmDeploy native step. Version 1.0.0 of this template uses JFrog CLI v1 and version 1.1.0 uses JFrog CLI v2.
HelmPublishAndDeploy YAML
resources:
- name: {{ .Values.GitRepo.name | default "GitRepoRes" }}
type: GitRepo
configuration:
gitProvider: {{ .Values.GitRepo.gitProvider }}
path: {{ .Values.GitRepo.path }}
{{- if or (.Values.GitRepo.branches.include) (.Values.GitRepo.branches.exclude) }}
branches:
{{- if .Values.GitRepo.branches.include }}
include: {{ .Values.GitRepo.branches.include }}
{{- end }}
{{- if .Values.GitRepo.branches.exclude }}
exclude: {{ .Values.GitRepo.branches.exclude }}
{{- end }}
{{- end }}
{{- if or (.Values.GitRepo.files.include) (.Values.GitRepo.files.exclude) }}
files:
{{- if .Values.GitRepo.files.include }}
include: {{ .Values.GitRepo.files.include }}
{{- end }}
{{- if .Values.GitRepo.files.exclude }}
exclude: {{ .Values.GitRepo.files.exclude }}
{{- end }}
{{- end }}
- name: {{ .Values.BuildInfo.name | default "BuildInfoRes" }}
type: BuildInfo
configuration:
sourceArtifactory: {{ .Values.artifactoryIntegration }}
{{- if .Values.BuildInfoPromoted }}
- name: {{ .Values.BuildInfoPromoted.name | default "BuildInfoPromotedRes" }}
type: BuildInfo
configuration:
sourceArtifactory: {{ .Values.artifactoryIntegration }}
{{- end }}
- name: {{ .Values.HelmChart.name | default "HelmChartRes" }}
type: HelmChart
configuration:
sourceArtifactory: {{ .Values.artifactoryIntegration }}
repository: {{ .Values.HelmChart.repository }}
chart: {{ .Values.HelmChart.chartName }}
version: {{ .Values.HelmChart.chartVersion }}
pipelines:
- name: {{ .Values.Pipeline.name | default "HelmDeployPipeline" }}
configuration:
jfrogCliVersion: 2
{{- if or (.Values.BuildInfo.buildName) (.Values.BuildInfo.buildNumber) }}
environmentVariables:
readOnly:
{{- if .Values.BuildInfo.buildName }}
JFROG_CLI_BUILD_NAME: {{ .Values.BuildInfo.buildName }}
{{- end }}
{{- if .Values.BuildInfo.buildNumber }}
JFROG_CLI_BUILD_NUMBER: {{ .Values.BuildInfo.buildNumber }}
{{- end }}
{{- end }}
steps:
- name: {{ .Values.HelmPublish.name | default "HelmPublish" }}
type: HelmPublish
configuration:
helmVersion: {{ .Values.HelmChart.helmVersion | default 3 }}
autoPublishBuildInfo: true
chartPath: {{ .Values.HelmPublish.chartPath }}
{{- if .Values.HelmPublish.flags }}
flags: {{ .Values.HelmPublish.flags }}
{{- end }}
{{- if .Values.HelmPublish.valueFilePaths }}
valueFilePaths:
{{- range $.Values.HelmPublish.valueFilePaths }}
- {{ . }}
{{- end }}
{{- end }}
lint: {{ .Values.HelmPublish.lint | default false }}
{{- if .Values.HelmPublish.lintFlags }}
lintFlags: {{ .Values.HelmPublish.lintFlags }}
{{- end }}
inputResources:
- name: {{ .Values.GitRepo.name | default "GitRepoRes" }}
outputResources:
- name: {{ .Values.BuildInfo.name | default "BuildInfoRes" }}
- name: {{ .Values.HelmChart.name | default "HelmChartRes" }}
{{- if and (.Values.PromoteBuild) (.Values.BuildInfoPromoted) }}
- name: {{ .Values.PromoteBuild.name | default "PromoteBuild" }}
type: PromoteBuild
configuration:
copy: {{ .Values.PromoteBuild.copy | default false }}
targetRepository: {{ .Values.PromoteBuild.targetRepository }}
inputResources:
- name: {{ .Values.BuildInfo.name | default "BuildInfoRes" }}
trigger: {{ .Values.PromoteBuild.autoPromotion | default true }}
outputResources:
- name: {{ .Values.BuildInfoPromoted.name | default "BuildInfoPromotedRes" }}
{{- end }}
- name: {{ .Values.HelmDeploy.name | default "HelmDeploy" }}
type: HelmDeploy
configuration:
{{- if .Values.HelmChart.namespace }}
environmentVariables:
HELM_NAMESPACE: {{ .Values.HelmChart.namespace }}
{{- end }}
integrations:
- name: {{ .Values.kubernetesIntegration }}
inputResources:
{{- if and (.Values.PromoteBuild) (.Values.BuildInfoPromoted) }}
- name: {{ .Values.BuildInfoPromoted.name | default "BuildInfoPromotedRes" }}
{{- else }}
- name: {{ .Values.BuildInfo.name | default "BuildInfoRes" }}
{{- end }}
chartPath: {{ .Values.HelmDeploy.chartPath }}
chartName: {{ .Values.HelmChart.chartName }}
chartVersion: {{ .Values.HelmChart.chartVersion }}
helmVersion: {{ .Values.HelmChart.helmVersion | default 3 }}
{{- if .Values.HelmDeploy.releaseName }}
releaseName: {{ .Values.HelmDeploy.releaseName }}
{{- end }}
{{- if .Values.HelmChart.namespace }}
namespace: {{ .Values.HelmChart.namespace }}
{{- end }}
{{- if .Values.HelmDeploy.flags }}
flags: {{ .Values.HelmDeploy.flags }}
{{- end }}
{{- if .Values.HelmDeploy.valueFilePaths }}
valueFilePaths:
{{- range $.Values.HelmDeploy.valueFilePaths }}
- {{ . }}
{{- end }}
{{- end }}
lint: {{ .Values.HelmDeploy.lint | default false }}
{{- if .Values.HelmDeploy.lintFlags }}
lintFlags: {{ .Values.HelmDeploy.lintFlags }}
{{- end }}
test: {{ .Values.HelmDeploy.test | default false }}
{{- if .Values.HelmDeploy.testFlags }}
testFlags: {{ .Values.HelmDeploy.testFlags }}
{{- end }}Example
resources:
- name: fooGitRepo
type: GitRepo
configuration:
gitProvider: bb_benha
path: ~benha/simplehelm
branches:
include: master
files:
include: simplehelm.*
- name: fooBuild
type: BuildInfo
configuration:
sourceArtifactory: art_v
- name: fooBuildPromote
type: BuildInfo
configuration:
sourceArtifactory: art_v
- name: fooHelmChart
type: HelmChart
configuration:
sourceArtifactory: art_v
repository: simplecharts
chart: simplehelm
version: 0.3.0
pipelines:
- name: fooHelmDeploy
configuration:
environmentVariables:
readOnly:
JFROG_CLI_BUILD_NAME: foo
JFROG_CLI_BUILD_NUMBER: '${run_number}'
steps:
- name: HelmPublish
type: HelmPublish
configuration:
helmVersion: 3
autoPublishBuildInfo: true
chartPath: ./simplehelm
lint: false
inputResources:
- name: fooGitRepo
outputResources:
- name: fooBuild
- name: fooHelmChart
- name: fooPromoteBuild
type: PromoteBuild
configuration:
copy: false
targetRepository: helm-promote
inputResources:
- name: fooBuild
trigger: true
outputResources:
- name: fooBuildPromote
- name: fooHelmDeploy
type: HelmDeploy
configuration:
environmentVariables:
HELM_NAMESPACE: pipe-master-pool
integrations:
- name: k8s
inputResources:
- name: fooBuildPromote
chartPath: .
chartName: simplehelm
chartVersion: 0.3.0
helmVersion: 3
releaseName: 'simplehelm-${run_id}'
flags: >-
--force --wait --timeout 900s --set
image.repository=trriplejay/simplehelm --set image.tag=latest
valueFilePaths:
- values.yaml
lint: true
lintFlags: '--strict'
test: truevalues.yml: This is a samplevalues.yml, which can be edited to create your own version of the file.
artifactoryIntegration: artifactory_integration # Required. Name of the Artifactory integration.
kubernetesIntegration: kubernetes_integration # Required. Name of the Kubernetes integration.
GitRepo: # Required.
name: fooGitRepo # Name of the GitRepo resource. Defaults to GitRepoRes.
gitProvider: github # Required. Name of the SCM integration which will be used to fetch the SCM repository.
path: jfrog/jfrog-pipelines-simple-example # Required. Path to the SCM repository.
branches: # Optional.
exclude: ^master$ # Regex pattern to exclude branches.
include: ^{{gitBranch}}$ # Regex pattern to include branches.
files: # Optional.
exclude: ^fileName$ # Regex pattern to exclude files.
include: ^fileName$ # Regex pattern to include files.
BuildInfo: # Required.
name: fooBuild # Name of the BuildInfo resource. Defaults to BuildInfoRes.
buildName: foo # Optional. Name of the Artifactory Build that will be created. Defaults to $pipeline_name.
buildNumber: $run_number # Optional. Number of the Artifactory Build that will be created. Defaults to $run_number.
BuildInfoPromoted: # Optional.
name: fooBuildInfoPromoted # Name of the promoted BuildInfo resource. Defaults to BuildInfoPromotedRes.
autoPromotion: false # Optional. When set to false, indicates that Build promotion in the pipeline will be manually triggered. Defaults to true.
HelmChart: # Required.
name: fooHelmChart # Name of the HelmChart resource. Defaults to HelmChartRes.
chartName: foo # Required. Helm chart name.
chartVersion: 0.0.1 # Required. Helm chart version.
repository: foo # Required. The name of the Helm repository in Artifactory.
helmVersion: 3 # Optional. A number representing the major version of Helm to use. Defaults to 3.
namespace: foo # Optional. Set the namespace used for the Helm operations. Only supported when used with Helm 3.
Pipeline: # Optional.
name: foo # Name of the pipeline. Defaults to HelmDeployPipeline.
HelmPublish: # Required.
name: HelmPublish # Name of the HelmPublish step. Defaults to HelmPublish.
chartPath: '.' # Required. The path to the Helm chart YAML in the GitRepo resource.
flags: '--app-version=foo' # Optional. Command line options to pass to the helm package command.
lint: true # Optional. When set to true performs a lint to examine a Helm chart for possible issues. Defaults to false.
lintFlags: '--strict' # Optional. Flag string to pass to the helm lint command.
valueFilePaths: # Optional. Specifies values YAML file(s) that will be used in the lint command helm lint command.
- values.yaml # Optional. An exmaple of how to add a values YAML file.
- values2.yaml # Optional. An exmaple of how to add an additional values YAML file.
PromoteBuild: # Optional.
name: fooPromoteBuild # Name of the PromoteBuild step. Defaults to PromoteBuild.
targetRepository: fooPromote # Required. The name of the repository in Artifactory to promote the build to.
copy: false # Optional. When set to true, copies the artifacts to the targetRepository vs moving them to the targetRepository. Defaults to false.
HelmDeploy: # Required.
name: fooHelmDeploy # Name of the HelmDeploy step. Defaults to HelmDeploy.
chartPath: '.' # Required. The path to the Helm chart YAML in the input BuildInfo resource.
releaseName: foo # Required. The release name. Equivalent to the --name (-n) option of the helm install command.
flags: '--wait --timeout 900s' # Optional. Command line options to pass to the helm upgrade command.
lint: true # Optional. When set to true performs a lint to examine a Helm chart for possible issues. Defaults to false.
lintFlags: '--strict' # Optional. Flag string to pass to the helm lint command.
valueFilePaths: # Optional. Specifies values YAML file(s) for use with a --values (-f) option of the helm lint command.
- values.yaml
- values2.yaml
test: true # Optional. When set to true performs a test to run the tests for release. Defaults to false.
testFlags: # Optional. Flag string to pass to the helm test command.