The DockerBuildAndPush template creates a pipeline that builds a docker image from an SCM repository and pushes it to a docker registry.
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 }} - name: {{ .Values.Image.name | default "ImageRes" }} type: Image configuration: registry: {{ .Values.artifactoryIntegration }} sourceRepository: {{ .Values.Image.sourceRepository }} imageName: {{ .Values.DockerBuild.dockerImageName }} imageTag: {{ .Values.DockerBuild.dockerImageTag | default "latest" }} autoPull: {{ .Values.Image.autopull | default true }} {{- if .Values.BuildInfo }} - name: {{ .Values.BuildInfo.name | default "BuildInfo" }} type: BuildInfo configuration: sourceArtifactory: {{ .Values.artifactoryIntegration }} buildName: {{ .Values.DockerPush.name }} buildNumber: {{ .Values.BuildInfo.buildNumber | default 1 }} {{- end }} pipelines: - name: {{ .Values.Pipeline.name | default "Pipeline" }} steps: - name: {{ .Values.DockerBuild.name | default "DockerBuild" }} type: DockerBuild configuration: affinityGroup: DockerBuildAndPush dockerFileLocation: {{ .Values.DockerBuild.dockerFileLocation | quote }} dockerFileName: {{ .Values.DockerBuild.dockerFileName }} dockerImageName: {{ .Values.DockerBuild.dockerImageName }} dockerImageTag: {{ .Values.DockerBuild.dockerImageTag }} inputResources: - name: {{ .Values.GitRepo.name | default "GitRepoRes" }} integrations: - name: {{ .Values.artifactoryIntegration }} - name: {{ .Values.DockerPush.name | default "DockerBuild" }} type: DockerPush configuration: {{- if .Values.BuildInfo }} autoPublishBuildInfo: {{ .Values.BuildInfo.autoPublishBuildInfo | default true }} {{- end }} affinityGroup: DockerBuildAndPush targetRepository: {{ .Values.DockerPush.targetRepository }} integrations: - name: {{ .Values.artifactoryIntegration }} inputSteps: - name: {{ .Values.DockerBuild.name | default "DockerBuild" }} outputResources: - name: {{ .Values.Image.name | default "ImageRes" }} {{- if .Values.BuildInfo }} - name: {{ .Values.BuildInfo.name | default "BuildInfo" }} {{- end }} |
values.yml: This is a sample
values.yml
. This can be edited to create your own version of the file.
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: exclude: 'master' # Regex pattern to exclude branches. include: ^{{gitBranch}}$ # Regex pattern to include branches. artifactoryIntegration: art # Required. Name of the artifactory integration using which the docker image will be pushed. Image: # Required. name: fooImage # Name of the Image resource. Defaults to ImageRes. sourceRepository: foo # Required. Name of the docker repository on artifactory autoPull: false # Defaults to true. DockerBuild: # Required. name: foobuild # Name of the DockerBuild step. Defaults to DockerBuild. dockerImageName: foo # Required. Name of the docker image getting built. dockerFileName: foo # Required. Name of the Dockerfile. dockerFileLocation: '.' # Required. Path to Dockerfile. dockerImageTag: ${run_number} # Name of the docker image tag. Defaults to latest. Pipeline: name: foo # Name of the pipeline. Defaults to Pipeline. DockerPush: # Required. name: foopush # Name of the DockerPush step. Defaults to DockerPush. targetRepository: foo # Required. Name of the artifactory repository where the image will be pushed to. BuildInfo: # Optional, if the BuildInfo needs to be published. autoPublishBuildInfo: true # Defaults to true. name: fooBuildInfo # Name of the BuildInfo resource. Defaults to BuildInfo. |
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 HelmDeploy native step.
values.yml: This is a sample
values.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. |
Perform the following steps to use a Global Template to create a pipeline source:
Go to Administration | Pipelines | Pipeline Sources, and click Add Pipeline Source, and From Template.
jfrog
namespace.DockerBuildAndPush
or HelmPublishAndDeploy
global template. Click the Select Template Version field and select the relevant version for the template.
Click Next and complete the resulting Specify values file form to add the values.yml
file.
Click the Integration field and select your source control integration from the dropdown list.
values.yml
is stored.master
).In the Values File Path field, provide the path to the values.yml
file, which contains the values for the global template. By default, this field is set to take the file from the root directory. If your values.yml
file is stored in a different directory, enter the full path.
When you do this, the values.yml
file is parsed and values are added as configured in the file.
For more information about the Specify values file form, see the section Adding a Pipeline Source. |
The combination of pipeline template name, namespace, version and values.yml
is parsed to create the pipeline definition.
After your Pipeline Source syncs successfully, you can view the newly added pipeline by navigating to My Pipelines on the left navbar and clicking Pipelines → My Pipelines.