GoPublishBinary - Examples

JFrog Pipelines Documentation

ft:sourceType
Paligo

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

Upload to Artifactory

Uploads the binary built by a GoBuild step to an Artifactory repository named go-local.

# This config file is templatized so that it can be easily customized. Values can be provided with a values.yml file. For more information, see the 'Pipeline Example: Go Build' quickstart.
template: true   # required for local templates
valuesFilePath: ./values.yml

resources:
  # Sample Go app in a GitRepo
  - name: go_repo
    type: GitRepo
    configuration:
      path: {{ .Values.repoPath }}
      branches:
        include: main
      gitProvider: {{ .Values.gitProvider }}

  # Build info for the published Go app
  - name: go_buildinfo
    type: BuildInfo
    configuration:
      sourceArtifactory: {{ .Values.artifactory }}


pipelines:
  - name: go_build_pipeline_example
    steps:
      # Build the Go sample app from the GitRepo
      - name: build_go
        type: GoBuild
        configuration:
          sourceLocation: .
          resolverRepo: go-virtual
          noRegistry: true
          inputResources:
            - name: go_repo
          integrations:
            - name: {{ .Values.artifactory }}

      # Publish the Go sample app binary to Artifactory
      - name: publish_go_binary
        type: GoPublishBinary
        configuration:
          inputSteps:
            - name: build_go
          targetRepository: go-local
          integrations:
            - name: {{ .Values.artifactory }}

Upload Build Info

Uploads the binary built by a GoBuild step to an Artifactory repository named go-repo and uploads build info. This extends example 1 in the GoBuild documentation.

GoPublishBinary

pipelines: 
  - name: goBuildPipeline
    steps:
      - name: goBuildStep
        type: GoBuild
        configuration:
          inputResources:
            - name: gitRepoResource
          integrations:
            - name: artifactory_integration
      - name: goPublishBinaryStep
        type: GoPublishBinary
        configuration:
          targetRepository: go-repo
          autoPublishBuildInfo: true
          inputSteps:
            - name: goBuildStep
          outputResources:
            - name: outputBuildInfo

Publish Build Info and Trigger Xray Scan

In this example, build info is published and an Xray scan triggered.

GoPublishBinary

pipelines: 
  - name: goBuildPipeline
    steps:
      - name: goBuildStep
        type: GoBuild
        configuration:
          inputResources:
            - name: gitRepoResource
          integrations:
            - name: artifactory_integration
      - name: goPublishBinaryStep
        type: GoPublishBinary
        configuration:
          targetRepository: go-repo
          autoPublishBuildInfo: true
          forceXrayScan: true
          inputSteps:
            - name: goBuildStep
          outputResources:
            - name: outputBuildInfo