You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* xref:../create/remote-pipelines-tasks-resolvers.adoc#remote-pipelines-tasks-resolvers[Specifying remote pipelines, tasks, and step actions using resolvers]
Copy file name to clipboardExpand all lines: create/remote-pipelines-tasks-resolvers.adoc
+39-29Lines changed: 39 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
:_mod-docs-content-type: ASSEMBLY
2
2
include::_attributes/common-attributes.adoc[]
3
3
[id="remote-pipelines-tasks-resolvers"]
4
-
= Specifying remote pipelinesand tasks using resolvers
4
+
= Specifying remote pipelines, tasks, and step actions using resolvers
5
5
:context: remote-pipelines-tasks-resolvers
6
6
7
7
toc::[]
@@ -10,22 +10,30 @@ Pipelines and tasks are reusable blocks for your CI/CD processes. You can reuse
10
10
11
11
In a pipeline run resource, you can specify a pipeline from an existing source. In a pipeline resource or a task run resource, you can specify a task from an existing source.
12
12
13
-
In these cases, the _resolvers_ in {pipelines-title} retrieve the pipeline or task definition from the specified source at run time.
13
+
Step actions, defined in `StepAction` custom resources (CRs), are reusable actions that a single step within a task completes. When specifying a step, you can reference a `StepAction` definition from an existing source.
14
+
15
+
In these cases, the _resolvers_ in {pipelines-title} retrieve the pipeline, task, or `StepAction` definition from the specified source at run time.
14
16
15
17
The following resolvers are available in a default installaton of {pipelines-title}:
16
18
17
-
Hub resolver:: Retrieves a task or pipeline from the Pipelines Catalog available on {artifact-hub} or {tekton-hub}.
18
-
Bundles resolver:: Retrieves a task or pipeline from a Tekton bundle, which is an OCI image available from any OCI repository, such as an OpenShift container repository.
19
+
Hub resolver:: Retrieves a task, pipeline, or `StepAction` definition from the Pipelines Catalog available on {artifact-hub} or {tekton-hub}.
20
+
Bundles resolver:: Retrieves a task, pipeline, or `StepAction` definition from a Tekton bundle, which is an OCI image available from any OCI repository, such as an OpenShift container repository.
21
+
Git resolver:: Retrieves a task, pipeline, or `StepAction` definition from a Git repository. You must specify the repository, the branch, and the path.
22
+
HTTP resolver:: Retrieves a task, pipeline, or `StepAction` definition from a remote HTTP or HTTPS URL. You must specify the URL for authentication.
19
23
Cluster resolver:: Retrieves a task or pipeline that is already created on the same {OCP} cluster in a specific namespace.
20
-
Git resolver:: Retrieves a task or pipeline binding from a Git repository. You must specify the repository, the branch, and the path.
21
-
HTTP resolver:: Retrieves a task or pipeline from a remote HTTP or HTTPS URL. You must specify the URL for authentication.
24
+
+
25
+
[NOTE]
26
+
====
27
+
In {pipelines-shortname} version {pipelines-version-number}, the cluster resolver does not support retrieving `StepAction` definitions.
28
+
====
22
29
23
30
An {pipelines-shortname} installation includes a set of standard tasks that you can use in your pipelines. These tasks are located in the {pipelines-shortname} installation namespace, which is normally the `openshift-pipelines` namespace. You can use the cluster resolver to access the tasks.
24
31
25
-
[id="resolver-hub_{context}"]
26
-
== Specifying a remote pipeline or task from a Tekton catalog
32
+
{pipelines-shortname} also provides a standard `StepAction` definition. You can use the HTTP resolver to access this definition.
27
33
28
-
You can use the hub resolver to specify a remote pipeline or task that is defined either in a public Tekton catalog of link:https://artifacthub.io/[{artifact-hub}] or in an instance of {tekton-hub}.
34
+
[id="resolver-hub_{context}"]
35
+
== Specifying a remote pipeline, task, or step action from a Tekton catalog
36
+
You can use the hub resolver to specify a remote pipeline, task, or `StepAction` definition that is defined either in a public Tekton catalog of link:https://artifacthub.io/[{artifact-hub}] or in an instance of {tekton-hub}.
== Specifying a remote pipelineor task from a Tekton bundle
47
+
== Specifying a remote pipeline, task, or step action from a Tekton bundle
40
48
41
-
You can use the bundles resolver to specify a remote pipelineor task from a Tekton bundle. A Tekton bundle is an OCI image available from any OCI repository, such as an OpenShift container repository.
49
+
You can use the bundles resolver to specify a remote pipeline, task, or `StepAction` definition from a Tekton bundle. A Tekton bundle is an OCI image available from any OCI repository, such as an OpenShift container repository.
== Specifying a pipeline or task from the same cluster
48
-
49
-
You can use the cluster resolver to specify a pipeline or task that is defined in a namespace on the {OCP} cluster where {pipelines-title} is running.
50
-
51
-
In particular, you can use the cluster resolver to access tasks that {pipelines-shortname} provides in its installation namespace, which is normally the `openshift-pipelines` namespace.
== Specifying a remote pipelineor task with anonymous Git cloning
55
+
== Specifying a remote pipeline, task, or step action with anonymous Git cloning
60
56
61
-
You can use the Git resolver to access a remote pipelineor task from a Git repository. The repository must include a YAML file that defines the pipeline or task. For anonymous access, you can clone repositories with the resolver without needing authentication credentials.
57
+
You can use the Git resolver to access a remote pipeline, task, or `StepAction` definition from a Git repository. The repository must include a YAML file that defines the pipeline or task. For anonymous access, you can clone repositories with the resolver without needing authentication credentials.
== Specifying a remote pipelineor task with an authenticated API
63
+
== Specifying a remote pipeline, task, or step action with an authenticated Git API
68
64
69
-
You can specify a remote pipelineor task from a Git repository by using the Git resolver. The repository must contain a YAML file that defines the pipeline or task. You can securely access repositories by using an authenticated API, which supports user authentication.
65
+
You can specify a remote pipeline, task, or `StepAction` definition from a Git repository by using the Git resolver. The repository must contain a YAML file that defines the pipeline or task. You can securely access repositories by using an authenticated API, which supports user authentication.
== Specifying a remote pipelineor task by using the HTTP resolver
72
+
== Specifying a remote pipeline, task, or step action by using the HTTP resolver
77
73
78
-
You can specify a remote pipelineor task from an HTTP or HTTPS URL by using the HTTP resolver. The URL must point to a YAML file that defines the pipelineor task.
74
+
You can specify a remote pipeline, task, or `StepAction` definition from an HTTP or HTTPS URL by using the HTTP resolver. The URL must point to a YAML file that defines the pipeline, task, or step action.
== Specifying a pipeline or task from the same cluster
81
+
82
+
You can use the cluster resolver to specify a pipeline or task that is defined in a namespace on the {OCP} cluster where {pipelines-title} is running.
83
+
84
+
In particular, you can use the cluster resolver to access tasks that {pipelines-shortname} provides in its installation namespace, which is normally the `openshift-pipelines` namespace.
// This module is included in the following assemblies:
2
+
// * about/understanding-openshift-pipelines.adoc
3
+
4
+
:_mod-docs-content-type: CONCEPT
5
+
[id="about-stepactions_{context}"]
6
+
= Step actions
7
+
8
+
A step is a part of a task. If you define a step in a task, you cannot reference this step from another task.
9
+
10
+
However, you can optionally define a _step action_ in a `StepAction` custom resource (CR). This CR contains the action that a step performs. You can reference a `StepAction` object from a step to create a step that performs the action. You can also use resolvers to reference a `StepAction` definition that is available from an external source.
11
+
12
+
The following examples shows a `StepAction` CR named `apply-manifests-action`. This step action applies manifests from a source tree to your {OCP} environment:
13
+
14
+
[source,yaml]
15
+
----
16
+
apiVersion: tekton.dev/v1
17
+
kind: StepAction
18
+
metadata:
19
+
name: apply-manifests-action
20
+
spec:
21
+
params:
22
+
- name: working_dir
23
+
description: The working directory where the source is located
24
+
type: string # <1>
25
+
default: "/workspace/source"
26
+
- name: manifest_dir
27
+
description: The directory in source that contains yaml manifests
oc apply -f "$MANIFEST_DIR" | tee $(results.output)
40
+
----
41
+
<1> The `type` specification for a parameter is optional.
42
+
43
+
The `StepAction` CR does not include definitions of workspaces. Instead, the step action expects that the task that includes the action also provides the mounted source tree, typically using a workspace.
44
+
45
+
A `StepAction` object can define parameters and results. When you reference this object, you must specify the values for the parameters of the `StepAction` object in the definition of the step. The results of the `StepAction` object automatically become the results of the step.
46
+
47
+
[IMPORTANT]
48
+
====
49
+
To avoid malicious attacks that use the shell, the `StepAction` CR does not support using parameter values in a `script` value. Instead, you must use the `env:` section to define environment variables that contain the parameter values.
50
+
====
51
+
52
+
The following example task includes a step that references the `apply-manifests-action` step action, provides the necessary parameters, and uses the result:
53
+
54
+
[source,yaml]
55
+
----
56
+
apiVersion: tekton.dev/v1
57
+
kind: Task
58
+
metadata:
59
+
name: apply-manifests-with-action
60
+
spec:
61
+
workspaces:
62
+
- name: source
63
+
params:
64
+
- name: manifest_dir
65
+
description: The directory in source that contains yaml manifests
= Specifying a remote pipelineor task using the bundles resolver
7
+
= Specifying a remote pipeline, task, or step action using the bundles resolver
8
8
9
-
When creating a pipeline run, you can specify a remote pipeline from a Tekton bundle. When creating a pipeline or a task run, you can specify a remote task from a Tekton bundle.
9
+
When creating a pipeline run, you can specify a remote pipeline from a Tekton bundle. When creating a pipeline or a task run, you can specify a remote task from a Tekton bundle. When creating a step within a task, you can reference a remote `StepAction` definition from a Tekton bundle.
10
10
11
11
.Procedure
12
12
13
-
* To specify a remote pipelineor task from a Tekton bundle, use the following reference format in the `pipelineRef`or `taskRef` spec:
13
+
* To specify a remote pipeline, task, or `StepAction` definition from a Tekton bundle, use the following reference format in the `pipelineRef`, `taskRef`, or `step.ref` spec:
14
14
+
15
15
[source,yaml]
16
16
----
@@ -49,6 +49,8 @@ When creating a pipeline run, you can specify a remote pipeline from a Tekton bu
49
49
+
50
50
If the pipeline or task requires additional parameters, specify values for these parameters in the `params` section of the specification of the pipeline, pipeline run, or task run. The `params` section of the `pipelineRef` or `taskRef` specification must contain only the parameters that the resolver supports.
51
51
52
+
.Examples
53
+
52
54
The following example pipeline run references a remote pipeline from a Tekton bundle:
53
55
54
56
[source,yaml]
@@ -121,3 +123,28 @@ spec:
121
123
- name: sample-task-parameter
122
124
value: test
123
125
----
126
+
127
+
The following example task includes a step that references a `StepAction` definition from a Tekton bundle:
Copy file name to clipboardExpand all lines: modules/op-resolver-git-anon.adoc
+31-5Lines changed: 31 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,13 @@
4
4
5
5
:_mod-docs-content-type: PROCEDURE
6
6
[id="resolver-git-anon-specify_{context}"]
7
-
= Specifying a remote pipelineor task by using the Git resolver for anonymous cloning
7
+
= Specifying a remote pipeline, task, or step action by using the Git resolver for anonymous cloning
8
8
9
-
When creating a pipeline run, you can specify a remote pipeline from a Git repository by using anonymous cloning. When creating a pipeline or a task run, you can specify a remote task from a Git repository.
9
+
When creating a pipeline run, you can specify a remote pipeline from a Git repository by using anonymous cloning. When creating a pipeline or a task run, you can specify a remote task from a Git repository. When creating a step within a task, you can reference a remote `StepAction` definition from a Git repository.
10
10
11
11
.Procedure
12
12
13
-
. To specify a remote pipelineor task from a Git repository, use the following reference format in the `pipelineRef`or `taskRef` spec:
13
+
* To specify a remote pipeline, task, or `StepAction` definition from a Git repository, use the following reference format in the `pipelineRef`, `taskRef`, or `step.ref` spec:
14
14
+
15
15
[source,yaml]
16
16
----
@@ -52,6 +52,8 @@ To clone and fetch the repository anonymously, use the `url` parameter. Do not s
52
52
+
53
53
If the pipeline or task requires additional parameters, provide these parameters in `params`.
54
54
55
+
.Examples
56
+
55
57
The following example pipeline run references a remote pipeline from a Git repository:
56
58
57
59
[source,yaml]
@@ -97,7 +99,7 @@ spec:
97
99
value: main
98
100
- name: pathInRepo
99
101
value: task/git-clone/0.6/git-clone.yaml
100
-
params:
102
+
params:
101
103
- name: sample-task-parameter
102
104
value: test
103
105
----
@@ -123,4 +125,28 @@ spec:
123
125
params:
124
126
- name: sample-task-parameter
125
127
value: test
126
-
----
128
+
----
129
+
130
+
The following example task includes a step that references a `StepAction` definition from a Git repository:
0 commit comments