-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TEP-0056]: Initial set of API refactors pertinent to Pipelines in Pi…
…pelines
- Loading branch information
Showing
11 changed files
with
844 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<!-- | ||
--- | ||
linkTitle: "Pipelines in Pipelines" | ||
weight: 406 | ||
--- | ||
--> | ||
|
||
# Pipelines in Pipelines | ||
> 🌱 Pipelines in Pipelines is an alpha feature. The enable-api-fields feature flag must be set to "alpha" to specify PipelineRef or PipelineSpec in a PipelineTask. | ||
> | ||
> This feature is in Preview Only mode and not yet supported/implemented. | ||
* [Overview](#overview) | ||
* [Specifying `pipelineRef` in `Tasks`](#specifying-pipelineref-in-tasks) | ||
* [Specifying `pipelineSpec` in `Tasks`](#specifying-pipelinespec-in-tasks) | ||
* [Specifying `Parameters`](#specifying-parameters) | ||
|
||
## Overview | ||
A mechanism to define and execute Pipelines in Pipelines, alongside Tasks and Custom Tasks, for a more in-depth background and inspiration, refer to the proposal [TEP-0056](https://github.com/tektoncd/community/blob/main/teps/0056-pipelines-in-pipelines.md "Proposal") | ||
|
||
## Specifying `pipelineRef` in `Tasks` | ||
Defining Pipelines in Pipelines at authoring time, by either specifying `PipelineRef` or `PipelineSpec` fields to a `PipelineTask` alongside `TaskRef` and `TaskSpec`. | ||
|
||
For example, a Pipeline named security-scans which is run within a Pipeline named clone-scan-notify where the PipelineRef is used: | ||
``` | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Pipeline | ||
metadata: | ||
name: security-scans | ||
spec: | ||
tasks: | ||
- name: scorecards | ||
taskRef: | ||
name: scorecards | ||
- name: codeql | ||
taskRef: | ||
name: codeql | ||
--- | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Pipeline | ||
metadata: | ||
name: clone-scan-notify | ||
spec: | ||
tasks: | ||
- name: git-clone | ||
taskRef: | ||
name: git-clone | ||
- name: security-scans | ||
pipelineRef: | ||
name: security-scans | ||
- name: notification | ||
taskRef: | ||
name: notification | ||
``` | ||
|
||
## Specifying `pipelineSpec` in `Tasks` | ||
The `pipelineRef` [example](#specifying-pipelineref-in-tasks) can be modified to use PipelineSpec instead of PipelineRef to instead embed the Pipeline specification: | ||
``` | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Pipeline | ||
metadata: | ||
name: clone-scan-notify | ||
spec: | ||
tasks: | ||
- name: git-clone | ||
taskRef: | ||
name: git-clone | ||
- name: security-scans | ||
pipelineSpec: | ||
tasks: | ||
- name: scorecards | ||
taskRef: | ||
name: scorecards | ||
- name: codeql | ||
taskRef: | ||
name: codeql | ||
- name: notification | ||
taskRef: | ||
name: notification | ||
``` | ||
|
||
## Specifying `Parameters` | ||
Pipelines in Pipelines consume Parameters in the same way as Tasks in Pipelines | ||
``` | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Pipeline | ||
metadata: | ||
name: clone-scan-notify | ||
spec: | ||
params: | ||
- name: repo | ||
value: $(params.repo) | ||
tasks: | ||
- name: git-clone | ||
params: | ||
- name: repo | ||
value: $(params.repo) | ||
taskRef: | ||
name: git-clone | ||
- name: security-scans | ||
params: | ||
- name: repo | ||
value: $(params.repo) | ||
pipelineRef: | ||
name: security-scans | ||
- name: notification | ||
taskRef: | ||
name: notification | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
examples/v1/pipelineruns/no-ci/pipelinerun-with-pipelines-in-pipelines.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
apiVersion: tekton.dev/v1 | ||
kind: Pipeline | ||
metadata: | ||
name: security-scans | ||
spec: | ||
tasks: | ||
- name: scorecards | ||
taskSpec: | ||
steps: | ||
- image: alpine | ||
name: step-1 | ||
script: | | ||
echo "Generating scorecard report ..." | ||
- name: codeql | ||
taskSpec: | ||
steps: | ||
- image: alpine | ||
name: step-1 | ||
script: | | ||
echo "Generating codeql report ..." | ||
--- | ||
|
||
apiVersion: tekton.dev/v1 | ||
kind: Pipeline | ||
metadata: | ||
name: clone-scan-notify | ||
spec: | ||
tasks: | ||
- name: git-clone | ||
taskSpec: | ||
steps: | ||
- image: alpine | ||
name: step-1 | ||
script: | | ||
echo "Cloning a repo to run security scans ..." | ||
- name: security-scans | ||
runAfter: | ||
- git-clone | ||
pipelineRef: | ||
name: security-scans | ||
--- | ||
|
||
|
||
apiVersion: tekon.dev/v1 | ||
kind: PipelineRun | ||
metadata: | ||
generateName: pipeline-in-pipeline- | ||
spec: | ||
pipelineRef: | ||
name: clone-scan-notify |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.