GoPublishModule - Examples

JFrog Pipelines Documentation

ft:sourceType
Paligo

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

Full Pipeline Example

# 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:
  # 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_publish_binary_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: cicd_go_publish_binary
        type: GoPublishBinary
        configuration:
          # forceXrayScan: true
          # failOnScan: false
          autoPublishBuildInfo: true
          inputSteps:
            - name: build_go
          targetRepository: go-local
          integrations:
            - name: myArtifactory
          outputResources:
            - name: go_buildinfo

Using Default Locations

A GoPublishModule step using default locations and publishing version v0.0.0 to an Artifactory repository named go-repo.

GoPublishModule

pipelines: 
  - name: goPublishModulePipeline
    steps:
      - name: goPublishModuleStep
        type: GoPublishModule
        configuration: 
          version: "v0.0.0"
          targetRepository: go-repo
          inputResources:
            - name: gitRepoResource
          integrations:
            - name: artifactory_integration

Different Source Location in the GitRepo

A GoPublishModule step specifying a different source location in the GitRepo and publishing the project and dependencies to the Artifactory repository named go-repo as well.

GoPublishModule

pipelines: 
  - name: goPublishModulePipeline
    steps:
      - name: goPublishModuleStep
        type: GoPublishModule
        configuration: 
          version: "v0.0.${run_number}"
          targetRepository: go-repo
                  resolverRepo: go-virtual
          self: true
          deps: ALL
          inputResources:
            - name: gitRepoResource
          integrations:
            - name: artifactory_integration

Publish Build Info and Trigger Xray Scan

A GoPublishModule step that publishes the build info and triggers an Xray scan.

GoPublishModule

pipelines: 
  - name: goPublishModulePipeline
    steps:
      - name: goPublishModuleStep
        type: GoPublishModule
        configuration: 
          version: "v0.0.${run_number}"
          targetRepository: go-repo
          autoPublishBuildInfo: true
          forceXrayScan: true
          inputResources:
            - name: gitRepoResource
          outputResources:
            - name: outputBuildInfo
          integrations:
            - name: artifactory_integration