The following examples show how to configure a PromoteBuild step. For more information on PromoteBuild Pipeline steps, see PromoteBuild.
Promote Build to Artifactory
Promotes a build specified by an input BuildInfo to an Artifactory repository named docker-prod-local
. In this example, trigger
is set as false
on the input resource so that the step will not be automatically triggered.
This example requires an Artifactory Integration or JFrog Platform Access Token Integration and a GitHub Integration.
The Pipelines DSL for this example is available in this repository in the JFrog GitHub account.
PromoteBuild
# This config file is templatized so that it can be easily customized. Values can be provided with a values.yml file. template: true # required for local templates valuesFilePath: ./values.yml resources: - name: app_repo type: GitRepo configuration: gitProvider: {{ .Values.gitIntegration }} path: {{ .Values.gitRepositoryPath }} branches: include: master - name: app_buildinfo type: BuildInfo configuration: sourceArtifactory: {{ .Values.artifactoryIntegration }} - name: app_promoted_buildinfo type: BuildInfo configuration: sourceArtifactory: {{ .Values.artifactoryIntegration }} pipelines: - name: app_dev_pipeline_su204 steps: - name: app_build type: DockerBuild configuration: affinityGroup: docker_group dockerFileLocation: . dockerFileName: Dockerfile dockerImageName: {{ .Values.artifactoryUrl }}/{{ .Values.sourceRepository }}/{{ .Values.imageName }} dockerImageTag: ${run_number} inputResources: - name: app_repo integrations: - name: {{ .Values.artifactoryIntegration }} - name: app_push type: DockerPush configuration: affinityGroup: docker_group targetRepository: {{ .Values.sourceRepository }} integrations: - name: {{ .Values.artifactoryIntegration }} inputSteps: - name: app_build - name: publish_app_build type: PublishBuildInfo configuration: affinityGroup: docker_group inputSteps: - name: app_push outputResources: - name: app_buildinfo - name: xrayScanStep type: XrayScan configuration: inputResources: - name: app_buildinfo - name: app_prod_pipeline_su204 steps: - name: app_promote_build type: PromoteBuild configuration: targetRepository: {{ .Values.prodRepository }} inputResources: - name: app_buildinfo trigger: false outputResources: - name: app_promoted_buildinfo - name: app_deploy type: Bash configuration: integrations: - name: {{ .Values.artifactoryIntegration }} inputResources: - name: app_promoted_buildinfo execution: onStart: - jfrog rt docker-pull {{ .Values.artifactoryUrl }}/{{ .Values.prodRepository }}/{{ .Values.imageName }}:$res_app_promoted_buildinfo_buildNumber {{ .Values.prodRepository }} #- jfrog rt dl prod-go-local/app #- ls -latr onExecute: - docker run {{ .Values.artifactoryUrl }}/{{ .Values.prodRepository }}/{{ .Values.imageName }}:$res_app_promoted_buildinfo_buildNumber
Promote Build with Status and Comment
Promotes the build with a status and comment.
PromoteBuild
pipelines: - name: promoteBuildPipeline steps: - name: promoteBuildStep type: PromoteBuild configuration: targetRepository: my-promoted-builds status: TEST comment: "Promoted by run number ${run_number}." integrations: - name: artifactory_integration inputResources: - name: inputBuildInfo trigger: false outputResources: - name: outputBuildInfo
Promote Build and Copy
In this example, when the build is promoted, it is copied so that a copy remains in the previous repository and the dependencies are copied as well as the build.
PromoteBuild
pipelines: - name: promoteBuildPipeline steps: - name: promoteBuildStep type: PromoteBuild configuration: targetRepository: my-promoted-builds includeDependencies: true copy: true integrations: - name: artifactory_integration inputResources: - name: inputBuildInfo trigger: false outputResources: - name: outputBuildInfo