PublishBuildInfo - Examples

JFrog Pipelines Documentation

Products
JFrog Pipelines
Content Type
User Guide
ft:sourceType
Paligo

The following examples show how to configure a PublishBuildInfo step. For more information on PublishBuildInfo Pipeline steps, see PublishBuildInfo.

Full Pipeline Example

Pushes the image created by the DockerBuild input step and published BuildInfo to Artifactory.

DockerPush

# 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_repo1
    type: GitRepo
    configuration:
      gitProvider: {{ .Values.gitIntegration }}                      
      path: {{ .Values.gitRepositoryPath }}    
      branches:
        include: master

  - name: app_buildinfo1
    type: BuildInfo
    configuration:
      sourceArtifactory: {{ .Values.artifactoryIntegration }}

  - name: app_promoted_buildinfo1
    type: BuildInfo
    configuration:
      sourceArtifactory: {{ .Values.artifactoryIntegration }}

pipelines:
  - name: app_dev_pipeline
    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

MvnBuild Example

This extends the first MvnBuild example to publish the build info using a PublishBuildInfo step.

PublishBuildInfo

pipelines:
  - name: MyMavenPipeline
    steps:
      - name: MavenWithArtifactory
        type: MvnBuild
        configuration:
          integrations:
            - name: art
          inputResources:
            - name: mvn_repo
      - name: publishBuildInfoStep
        type: PublishBuildInfo
        configuration:
          inputSteps:
            - name: MavenWithArtifactory
          outputResources:
            - name: buildInfoResource

NpmBuild and NpmPublish Example

An NpmBuild and NpmPublish example publishing the build info using a PublishBuildInfo step and triggering an Xray scan in the PublishBuildInfo step.

PublishBuildInfo

pipelines:
  - name: npmBuildPipeline
    steps:
      - name: npmBuildStep
        type: NpmBuild
        configuration:
          inputResources:
            - name: gitRepoResource
          integrations:
            - name: artifactory_integration
      - name: npmPublishStep
        type: NpmPublish
        configuration:
          deployerRepo: npm-repo
          inputSteps:
            - name: npmBuildStep
          outputResources:
            - name: outputBuildInfo
      - name: publishBuildInfoStep
        type: PublishBuildInfo
        configuration:
          forceXrayScan: true
          inputSteps:
            - name: npmPublishStep
          outputResources:
            - name: buildInfoResource

Bash and GoPublishModule Step

A Bash step input to the PublishBuildInfo step following an earlier GoPublishModule step.

PublishBuildInfo

pipelines:
  - name: goPublishModulePipeline
    steps:
      - name: goPublishModuleStep
        type: GoPublishModule
        configuration:
          version: "v0.0.${run_number}"
          targetRepository: go-repo
          self: true
          deps: ALL
          inputResources:
            - name: gitRepoResource
          integrations:
            - name: artifactory_integration
      - name: moduleTestStep
        type: Bash
        configuration:
          inputSteps:
            - name: goPublishModuleStep
        execution:
          onExecute:
            - "echo 'Running some tests.'"
      - name: publishBuildInfoStep
        type: PublishBuildInfo
        configuration:
          environmentVariables:
            buildStepName: goPublishModuleStep
          inputSteps:
            - name: moduleTestStep
          outputResources:
            - name: buildInfoResource