Every task has a name and a version. To invoke a task in an existing pipeline, add the following to the onStart, onExecute, onSuccess, onFailure, or onComplete section of a step in your pipeline YAML:
- task: <namespace>/<task_name>/<version>
id: <unique_id> # optional
input:
<input_variables>Tag | Description |
|---|---|
task | This is name of the task in the
Latest Version: All tasks are versioned. However, if you want to use the latest version of a task, use the
|
input | Input required for the task. Varies for each task. For information about the input required for a specific task, see the |
id | This is optional. Use it if the task produces an output that may need to be used in other commands. |
Example - setup-go
resources:
- name: jfrogClientGoRepoPseudoCommit
type: GitRepo
configuration:
gitProvider: git_integration
path: {{.jfrog-pipelines.sourceRepository}} # current pipeline source path
branches:
include: dev
buildOn:
commit: true
pipelines:
- name: jfrog_go_client_pseudo
configuration:
jfrogCliVersion: 2
runtime:
type: image
image:
custom:
name: releases-docker.jfrog.io/jfrog/pipelines-u18node
tag: "16"
autoPull: true
environmentVariables:
readOnly:
RESOLVE_REPO: npm-virtual
steps:
- name: go_sec
type: Bash
configuration:
integrations:
- name: artifactory_integration
inputResources:
- name: jfrogClientGoRepoPseudoCommit
execution:
onStart:
- task: jfrog/setup-go@v0.0.3
input:
version: "1.19.3"
cacheIntegration: artifactory_integration
- go version
- go env GOPATH
onExecute:
- echo "done with step"After a successful run of the pipeline, the log shows the setup-go task executing in the onStart section of the step: