Pipelines Tasks enable developers to simplify and standardize CI/CD pipelines and help them reduce maintenance costs by promoting principles such as reusability, immutability, and versioning.
An ever-growing library of tasks are available out of the box and can be used in your pipeline definition. The same task can be invoked multiple times and can be executed across different steps in a pipeline. The code for each invoked task is stored in an Artifactory repository and downloaded/executed at the runtime of the step. In addition, since tasks are stored in Artifactory, they can be shared by different teams using local, remote, and virtual repositories. In fact, a task can be written in a way that leverages the Platform.
When Pipelines is installed, the following repositories are created by default for Pipelines tasks:
pipelines-tasks-local
pipelines-tasks-remote
pipelines-tasks-virtual
Viewing Tasks
To view the list of available tasks, do one of the following:
Go to Reusables and click the Tasks tab.
Or
Go to Application | Artifacts and click the
pipelines-tasks-local
repository. Each task is stored in a dedicated directory, which contains the files required for the execution of the task and documentation in the form of areadme.md
file.
Task | Description |
---|---|
build-publish | This task publishes BuildInfo to Artifactory. BuildInfo provides a manifest for the build and includes metadata about the modules, dependencies and other environment variables. |
curate-artifact | This task takes a single artifact path from a remote repository, copies it to a local repository and associates it with a build. |
docker-build | Performs a build to produce a Docker image from a Dockerfile in a GitRepo source repository resource. |
docker-push | Pushes a Docker Image to a Docker registry. |
email-notify | Sends email notifications from your pipeline step. |
frogbot | Frogbot is a Git bot that scans your pull requests and repositories for security vulnerabilities. This task allows you to embed Frogbot in your Pipelines Steps. |
go-build | This Pipelines Task performs a build from Go (GoLang) source. |
go-security-check | Runs gosec code security analysis. |
go-static-check | Runs Go static code analysis. |
jira-comment | Adds a comment to a Jira issue. |
jira-transition | Updates the status of a Jira. |
mvn-build | This task performs a Maven project build on files in a Git repository. |
npm-build | Builds an npm source. |
publish-task | Validates Pipelines Task descriptor, create package and upload to Artifactory. |
run-cypress | Runs cypress tests. |
setup-go | Install and set up Go programming language. |
setup-java | Install and set up OpenJDK. |
setup-jfrog-cli | Installs and sets up JFrog CLI. |
setup-node | Installs and sets up NodeJS programming language. |
setup-yarn | Installs yarn package manager. |
slack-notify | Sends Slack notifications from your pipeline step. |
upload-file-s3 | Uploads a file to an AWS S3 bucket. |
Using Tasks
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: