The YAML schema for GoBuild native step is as follows:
An alphanumeric string (underscores are permitted) that identifies the step.
GoBuild for this step type.
Description of usage
| ||Specifies an Artifactory Integration where modules will be published. If a FileSpec resource is specified in ||May be required|
Must specify a GitRepo resource that has Go source files in
Also may specify an optional FileSpec resource that specifies what files to copy to
In addition, these tags can be defined to support the step's native operation:
Tags derived from Bash
All native steps derive from the Bash step. This means that all steps share the same base set of tags from Bash, while native steps have their own additional tags as well that support the step's particular function. So it's important to be familiar with the Bash step definition, since it's the core of the definition of all other steps.
Description of usage
|Location where the Go source files are available, relative to the root of the GitRepo repository. If not specified, the default is the root of the GitRepo repository.||Optional|
|Location where the built Go modules should be published.||Optional|
|File that has the output of the Go command. The default filename is the name of the step.||Optional|
|Name of the Artifactory repository to be used to resolve dependencies.||Optional|
|Alternative to ||Optional|
Specifies a command line string of options to use with the Go client.
Declares collections of shell command sequences to perform for pre- and post-execution phases:
|Tag||Description of usage||Required/Optional|
|Commands to execute in advance of the native operation||Optional|
|Commands to execute on successful completion||Optional|
|Commands to execute on failed completion||Optional|
|Commands to execute on any completion||Optional|
The actions performed for the
onExecute phase are inherent to this step type and may not be overridden.
The following examples show how to configure a GoBuild step.
Full Pipeline Example
- This example requires an Artifactory Integration and a GitHub Integration.
- The Pipelines DSL for this example is available in this repository in the JFrog GitHub account.
- For a full tutorial, see Pipeline Example: Go Build.
A GoBuild step using default locations.
A GoBuild step with a FileSpec input providing files for the build that are not in the GitRepo and resolverRepo specifying an Artifactory repository to use when resolving dependencies.
Alternative Source Location in Git Repo
A GoBuild step with an alternative source location in the GitRepo and an alternative Go command for the build.
How it Works
When you use the GoBuild native step in a pipeline, it performs the following functions in the background:
- jfrog rt config (to configure the JFrog CLI with the Artifactory credentials in the input FileSpec if there is no input integration)
- jfrog rt use (to set the current default Artifactory configuration )
- cp (if there is an input FileSpec, copy the files to the root of the cloned GitRepo)
- jfrog rt go-config (configure the repository to resolve dependencies)
- jfrog rt go (build)
- add_run_variables (save information about this step for future steps)
- add_run_files (save the output and the build information in the run state for later publish steps)
- jfrog rt build-collect-env (collect environment variables)