Skip to content

Commit 50e2c48

Browse files
authored
Merge pull request #27493 from Preeticp/trigger_mods
Trigger doc updates
2 parents f9d702e + 662cf8e commit 50e2c48

11 files changed

+127
-69
lines changed

modules/op-about-pipelines.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
[id="about-pipelines_{context}"]
66
= Pipelines
77

8-
A _Pipeline_ is a collection of Tasks arranged in a specific order of execution. You can define a CI/CD workflow for your application using Pipelines containing one or more Tasks.
8+
A _Pipeline_ is a collection of `Task` resources arranged in a specific order of execution. You can define a CI/CD workflow for your application using pipelines containing one or more tasks.
99

10-
A Pipeline definition consists of a number of fields or attributes, which together enable the Pipeline to accomplish a specific goal. Each Pipeline definition must contain at least one Task, which ingests specific inputs and produces specific outputs. The Pipeline definition can also optionally include Conditions, Workspaces, Parameters, or Resources depending on the application requirements.
10+
A `Pipeline` resource definition consists of a number of fields or attributes, which together enable the pipeline to accomplish a specific goal. Each `Pipeline` resource definition must contain at least one `Task` resource, which ingests specific inputs and produces specific outputs. The pipeline definition can also optionally include _Conditions_, _Workspaces_, _Parameters_, or _Resources_ depending on the application requirements.
1111

12-
The following example shows the `build-and-deploy` Pipeline, which builds an application image from a Git repository using the `buildah` ClusterTask:
12+
The following example shows the `build-and-deploy` pipeline, which builds an application image from a Git repository using the `buildah` `ClusterTask` resource:
1313

1414
[source,yaml]
1515
----
@@ -30,7 +30,7 @@ spec: <4>
3030
- name: git-revision
3131
type: string
3232
description: revision to be used from repo of the code for deployment
33-
default: "release-tech-preview-2"
33+
default: "release-tech-preview-3"
3434
- name: IMAGE
3535
type: string
3636
description: image to be build from the code

modules/op-about-triggers.adoc

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,22 @@
55
[id="about-triggers_{context}"]
66
= Triggers
77

8-
Use Triggers in conjunction with Pipelines to create a full-fledged CI/CD system where the Kubernetes resources define the entire CI/CD execution. Pipeline Triggers capture the external events and process them to extract key pieces of information. Mapping this event data to a set of predefined parameters triggers a series of tasks that can then create and deploy Kubernetes resources.
8+
Use _Triggers_ in conjunction with pipelines to create a full-fledged CI/CD system where Kubernetes resources define the entire CI/CD execution. Triggers capture the external events and process them to extract key pieces of information. Mapping this event data to a set of predefined parameters triggers a series of tasks that can then create and deploy Kubernetes resources and instantiate the pipeline.
99

10-
For example, you define a CI/CD workflow using {pipelines-title} for your application. The PipelineRun must start for any new changes to take effect in the application repository. Triggers automate this process by capturing and processing any change events and by triggering a PipelineRun that deploys the new image with the latest changes.
10+
For example, you define a CI/CD workflow using {pipelines-title} for your application. The pipeline must start for any new changes to take effect in the application repository. Triggers automate this process by capturing and processing any change event and by triggering a pipeline run that deploys the new image with the latest changes.
1111

12-
Triggers consist of the following main components that work together to form a reusable, decoupled, and self-sustaining CI/CD system:
12+
Triggers consist of the following main resources that work together to form a reusable, decoupled, and self-sustaining CI/CD system:
1313

14-
* _EventListeners_ provide endpoints, or an event sink, that listen for incoming HTTP-based events with a JSON payload. The EventListener performs lightweight event processing on the payload using Event Interceptors, which identify the type of payload and optionally modify it. Currently, Pipeline Triggers support four types of Interceptors: Webhook Interceptors, GitHub Interceptors, GitLab Interceptors, and Common Expression Language (CEL) Interceptors.
15-
* _TriggerBindings_ extract the fields from an event payload and store them as parameters.
16-
* _TriggerTemplates_ specify how to use the parameterized data from the TriggerBindings. A TriggerTemplate defines a resource template that receives input from the TriggerBindings, and then performs a series of actions that result in creation of new PipelineResources and initiation of a new PipelineRun.
14+
* The `TriggerBinding` resource validates events, extracts the fields from an event payload, and stores them as parameters.
15+
* The `TriggerTemplate` resource acts as a standard for the way resources must be created. It specifies the way parameterized data from the `TriggerBinding` resource should be used.
16+
A trigger template receives input from the trigger binding, and then performs a series of actions that results in creation of new pipeline resources, and initiation of a new pipeline run.
1717

18-
EventListeners tie the concepts of TriggerBindings and TriggerTemplates together. The EventListener listens for the incoming event, handles basic filtering using Interceptors, extracts data using TriggerBindings, and then processes this data to create Kubernetes resources using TriggerTemplates.
18+
* The `EventListener` resource provides an endpoint, or an event sink, that listens for incoming HTTP-based events with a JSON payload. It extracts event parameters from each `TriggerBinding` resource, and then processes this data to create Kubernetes resources as specified by the corresponding `TriggerTemplate` resource. The `EventListener` resource also performs lightweight event processing or basic filtering on the payload using event `interceptors`, which identify the type of payload and optionally modify it. Currently, pipeline triggers support four types of interceptors: _Webhook Interceptors_, _GitHub Interceptors_, _GitLab Interceptors_, and _Common Expression Language (CEL) Interceptors_.
1919

20+
* The `Trigger` resource connects the `TriggerBinding` and `TriggerTemplate` resources, and this `Trigger` resource is referenced in the `EventListener` specification.
2021
//image::op-triggers.png[]
2122

22-
The following example shows a code snippet of the `vote-app-binding` TriggerBinding, which extracts the Git repository information from the received event payload:
23+
The following example shows a code snippet of the `TriggerBinding` resource, which extracts the Git repository information from the received event payload:
2324

2425
[source,yaml]
2526
----
@@ -37,13 +38,13 @@ spec:
3738
value: $(body.head_commit.id)
3839
----
3940

40-
<1> TriggerBinding API version `v1alpha1`.
41+
<1> The API version of the `TriggerBinding` resource. In this example, `v1alpha1`.
4142
<2> Specifies the type of Kubernetes object. In this example, `TriggerBinding`.
42-
<3> Unique name to identify this TriggerBinding.
43-
<4> List of parameters which will be extracted from the received event payload and passed to the TriggerTemplate. In this example, the Git repository URL, name, and revision are extracted from the body of the event payload.
43+
<3> Unique name to identify the `TriggerBinding` resource.
44+
<4> List of parameters which will be extracted from the received event payload and passed to the `TriggerTemplate` resource. In this example, the Git repository URL, name, and revision are extracted from the body of the event payload.
4445

4546

46-
The following example shows a code snippet of a `vote-app-template` TriggerTemplate, which creates Pipeline Resources from the Git repository information received from the TriggerBinding:
47+
The following example shows a code snippet of a `TriggerTemplate` resource, which creates a pipeline run using the Git repository information received from the `TriggerBinding` resource you just created:
4748
[source,yaml]
4849
----
4950
apiVersion: triggers.tekton.dev/v1alpha1 <1>
@@ -89,14 +90,37 @@ spec:
8990
storage: 500Mi
9091
----
9192

92-
<1> TriggerTemplate API version `v1alpha1`.
93+
<1> The API version of the `TriggerTemplate` resource. In this example, `v1alpha1`.
9394
<2> Specifies the type of Kubernetes object. In this example, `TriggerTemplate`.
94-
<3> Unique name to identify this TriggerTemplate.
95-
<4> Parameters supplied by the TriggerBinding or EventListerner.
96-
<5> List of Resource templates created for the Pipeline from the parameters received in the TriggerBinding or EventListener.
95+
<3> Unique name to identify the `TriggerTemplate` resource.
96+
<4> Parameters supplied by the `TriggerBinding` or `EventListerner` resources.
97+
<5> List of templates that specify the way resources must be created using the parameters received through the `TriggerBinding` or `EventListener` resources.
9798

9899

99-
The following example shows an EventListener which uses `vote-app-binding` TriggerBinding and `vote-app-template` TriggerTemplate to process incoming events.
100+
The following example shows a code snippet of a `Trigger` resource, named `vote-trigger` that connects the `TriggerBinding` and `TriggerTemplate` resources.
101+
102+
[source,yaml]
103+
----
104+
apiVersion: triggers.tekton.dev/v1alpha1 <1>
105+
kind: Trigger <2>
106+
metadata:
107+
name: vote-trigger <3>
108+
spec:
109+
serviceAccountName: pipeline <4>
110+
bindings:
111+
- ref: vote-app <5>
112+
template: <6>
113+
name: vote-app
114+
----
115+
<1> The API version of the `Trigger` resource. In this example, `v1alpha1`.
116+
<2> Specifies the type of Kubernetes object. In this example, `Trigger`.
117+
<3> Unique name to identify the `Trigger` resource.
118+
<4> Service account name to be used.
119+
<5> Name of the `TriggerBinding` resource to be connected to the `TriggerTemplate` resource.
120+
<6> Name of the `TriggerTemplate` resource to be connected to the `TriggerBinding` resource.
121+
122+
123+
The following example shows an `EventListener` resource, which references the `Trigger` resource named `vote-trigger`.
100124

101125
[source,yaml]
102126
----
@@ -107,14 +131,10 @@ metadata:
107131
spec:
108132
serviceAccountName: pipeline <4>
109133
triggers:
110-
- bindings: <5>
111-
- ref: vote-app
112-
template: <6>
113-
name: vote-app
134+
- triggerRef: vote-trigger <5>
114135
----
115-
<1> EventListener API version `v1alpha1`.
136+
<1> The API version of the `EventListener` resource. In this example, `v1alpha1`.
116137
<2> Specifies the type of Kubernetes object. In this example, `EventListener`.
117-
<3> Unique name to identify this EventListener.
138+
<3> Unique name to identify the `EventListener` resource.
118139
<4> Service account name to be used.
119-
<5> Name of the TriggerBinding to be used for this EventListener.
120-
<6> Name of the Triggertemplate to be used for this Eventlistener.
140+
<5> Name of the `Trigger` resource referenced by the `EventListener` resource.

modules/op-adding-triggers.adoc

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[id="adding-triggers_{context}"]
66
= Adding Triggers to a Pipeline
77

8-
Triggers enable Pipelines to respond to external GitHub events, such as push events and pull requests. After you have assembled and started the Pipeline for the application, add TriggerBindings, TriggerTemplates, and an EventListener to capture the GitHub events.
8+
Triggers enable pipelines to respond to external GitHub events, such as push events and pull requests. After you assemble and start a Pipeline for the application, add the `TriggerBinding`, `TriggerTemplate`, `Trigger`, and `EventListener` resources to capture the GitHub events.
99

1010
[discrete]
1111
.Procedure
@@ -27,21 +27,23 @@ spec:
2727
value: $(body.head_commit.id)
2828
----
2929

30-
. Create the `TriggerBinding`:
30+
. Create the `TriggerBinding` resource:
3131
+
32+
[source,terminal]
3233
----
3334
$ oc create -f <triggerbinding-yaml-file-name.yaml>
3435
----
3536
+
36-
Alternatively, you can create the `TriggerBinding` directly from the `pipelines-tutorial` Git repository:
37+
Alternatively, you can create the `TriggerBinding` resource directly from the `pipelines-tutorial` Git repository:
3738
+
39+
[source,terminal,subs="attributes+"]
3840
----
39-
$ oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/release-tech-preview-2/03_triggers/01_binding.yaml
41+
$ oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/{pipelines-ver}/03_triggers/01_binding.yaml
4042
----
4143

4244
. Copy the content of the following sample `TriggerTemplate` YAML file and save it:
4345
+
44-
[source,yaml]
46+
[source,yaml,subs="attributes+"]
4547
----
4648
apiVersion: triggers.tekton.dev/v1alpha1
4749
kind: TriggerTemplate
@@ -53,7 +55,7 @@ spec:
5355
description: The git repository url
5456
- name: git-revision
5557
description: The git revision
56-
default: release-tech-preview-2
58+
default: {pipelines-ver}
5759
- name: git-repo-name
5860
description: The name of the deployment to be created / patched
5961
@@ -88,16 +90,48 @@ spec:
8890
+
8991
The template specifies a volume claim template to create a persistent volume claim for defining the storage volume for the workspace. Therefore, you do not need to create a persistent volume claim to provide data storage.
9092

91-
. Create the `TriggerTemplate`:
93+
. Create the `TriggerTemplate` resource:
9294
+
95+
[source,terminal]
9396
----
9497
$ oc create -f <triggertemplate-yaml-file-name.yaml>
9598
----
9699
+
97-
Alternatively, you can create the `TriggerTemplate` directly from the `pipelines-tutorial` Git repository:
100+
Alternatively, you can create the `TriggerTemplate` resource directly from the `pipelines-tutorial` Git repository:
101+
+
102+
[source,terminal,subs="attributes+"]
103+
----
104+
$ oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/{pipelines-ver}/03_triggers/02_template.yaml
105+
----
106+
107+
. Copy the contents of the following sample `Trigger` YAML file and save it:
108+
+
109+
[source,yaml]
110+
----
111+
apiVersion: triggers.tekton.dev/v1alpha1
112+
kind: Trigger
113+
metadata:
114+
name: vote-trigger
115+
spec:
116+
serviceAccountName: pipeline
117+
bindings:
118+
- ref: vote-app
119+
template:
120+
name: vote-app
121+
----
122+
123+
. Create the `Trigger` resource:
124+
+
125+
[source,terminal]
126+
----
127+
$ oc create -f <trigger-yaml-file-name.yaml>
128+
----
129+
+
130+
Alternatively, you can create the `Trigger` resource directly from the `pipelines-tutorial` Git repository:
98131
+
132+
[source,terminal,subs="attributes+"]
99133
----
100-
$ oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/release-tech-preview-2/03_triggers/02_template.yaml
134+
$ oc create -f https://github.com/openshift/pipelines-tutorial/blob/{pipelines-ver}/03_triggers/03_trigger.yaml
101135
----
102136

103137
. Copy the contents of the following sample `EventListener` YAML file and save it:
@@ -111,26 +145,26 @@ metadata:
111145
spec:
112146
serviceAccountName: pipeline
113147
triggers:
114-
- bindings:
115-
- name: vote-app
116-
template:
117-
name: vote-app
148+
- triggerRef: vote-trigger
118149
----
119150

120-
. Create the `EventListener`:
151+
. Create the `EventListener` resource:
121152
+
153+
[source,terminal]
122154
----
123155
$ oc create -f <eventlistener-yaml-file-name.yaml>
124156
----
125157
+
126-
Alternatively, you can create the `EvenListener` directly from the `pipelines-tutorial` Git repository:
158+
Alternatively, you can create the `EvenListener` resource directly from the `pipelines-tutorial` Git repository:
127159
+
160+
[source,terminal,subs="attributes+"]
128161
----
129-
$ oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/release-tech-preview-2/03_triggers/03_event_listener.yaml
162+
$ oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/{pipelines-ver}/03_triggers/04_event_listener.yaml
130163
----
131164

132-
. Expose the EventListener service as an {product-title} route to make it publicly accessible:
165+
. Expose the `EventListener` service as an {product-title} route to make it publicly accessible:
133166
+
167+
[source,terminal]
134168
----
135169
$ oc expose svc el-vote-app
136170
----

modules/op-assembling-a-pipeline.adoc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The Pipeline performs the following tasks for the back-end application `vote-api
2828

2929
. Copy the contents of the following sample Pipeline YAML file and save it:
3030
+
31-
[source,yaml]
31+
[source,yaml,subs="attributes+"]
3232
----
3333
apiVersion: tekton.dev/v1beta1
3434
kind: Pipeline
@@ -47,7 +47,7 @@ spec:
4747
- name: git-revision
4848
type: string
4949
description: revision to be used from repo of the code for deployment
50-
default: "release-tech-preview-2"
50+
default: "{pipelines-ver}"
5151
- name: IMAGE
5252
type: string
5353
description: image to be build from the code
@@ -115,8 +115,9 @@ $ oc create -f <pipeline-yaml-file-name.yaml>
115115
+
116116
Alternatively, you can also execute the YAML file directly from the Git repository:
117117
+
118+
[source,terminal,subs="attributes+"]
118119
----
119-
$ oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/release-tech-preview-2/01_pipeline/04_pipeline.yaml
120+
$ oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/{pipelines-ver}/01_pipeline/04_pipeline.yaml
120121
----
121122

122123
. Use the `tkn pipeline list` command to verify that the Pipeline is added to the application:

modules/op-creating-pipeline-tasks.adoc

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,40 @@
88
[discrete]
99
.Procedure
1010

11-
. Install the `apply-manifests` and `update-deployment` Tasks from the `pipelines-tutorial` repository, which contains a list of reusable Tasks for Pipelines:
11+
. Install the `apply-manifests` and `update-deployment` `Task` resources from the `pipelines-tutorial` repository, which contains a list of reusable tasks for pipelines:
1212
+
13+
[source,terminal,subs="attributes+"]
1314
----
14-
$ oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/release-tech-preview-2/01_pipeline/01_apply_manifest_task.yaml
15-
$ oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/release-tech-preview-2/01_pipeline/02_update_deployment_task.yaml
15+
$ oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/{pipelines-ver}/01_pipeline/01_apply_manifest_task.yaml
16+
$ oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/{pipelines-ver}/01_pipeline/02_update_deployment_task.yaml
1617
----
1718

18-
. Use the `tkn task list` command to list the Tasks you created:
19+
. Use the `tkn task list` command to list the tasks you created:
1920
+
2021
----
2122
$ tkn task list
2223
----
2324
+
24-
The output verifies that the `apply-manifests` and `update-deployment` Tasks were created:
25+
The output verifies that the `apply-manifests` and `update-deployment` `Task` resources were created:
2526
+
2627
----
2728
NAME DESCRIPTION AGE
2829
apply-manifests 1 minute ago
2930
update-deployment 48 seconds ago
3031
----
3132

32-
. Use the `tkn clustertasks list` command to list the Operator-installed additional ClusterTasks, for example --`buildah` and `s2i-python-3`:
33+
. Use the `tkn clustertasks list` command to list the Operator-installed additional `ClusterTask` resources, for example --`buildah` and `s2i-python-3`:
3334
+
3435
[NOTE]
3536
====
36-
You must use a privileged Pod container to run the `buildah` ClusterTask because it requires a privileged security context. To learn more about security context constraints (SCC) for pods, see the Additional resources section.
37+
You must use a privileged pod container to run the `buildah` `ClusterTask` resource because it requires a privileged security context. To learn more about security context constraints (SCC) for pods, see the Additional resources section.
3738
====
3839
+
3940
----
4041
$ tkn clustertasks list
4142
----
4243
+
43-
The output lists the Operator-installed ClusterTasks:
44+
The output lists the Operator-installed `ClusterTask` resources:
4445
+
4546
----
4647
NAME DESCRIPTION AGE

modules/op-installing-tkn-on-linux-using-rpm.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ For {op-system-base-full} version 8, you can install the {pipelines-title} CLI (
4747
+
4848
[source,terminal]
4949
----
50-
# subscription-manager repos --enable="pipelines-1.1-for-rhel-8-x86_64-rpms"
50+
# subscription-manager repos --enable="pipelines-1.2-for-rhel-8-x86_64-rpms"
5151
----
5252

5353
. Install the `openshift-pipelines-client` package:

modules/op-installing-tkn-on-linux.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ For Linux distributions, you can download the CLI directly as a `tar.gz` archive
1010

1111
.Procedure
1212

13-
. Download the link:https://mirror.openshift.com/pub/openshift-v4/clients/pipeline/0.11.0/tkn-linux-amd64-0.11.0.tar.gz[CLI].
13+
. Download the link:https://mirror.openshift.com/pub/openshift-v4/clients/pipeline/0.13.1/tkn-linux-amd64-0.13.1.tar.gz[CLI].
1414

1515
. Unpack the archive:
1616
+

modules/op-installing-tkn-on-macos.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ For macOS, the `tkn` CLI is provided as a `tar.gz` archive.
1010

1111
.Procedure
1212

13-
. Download the link:https://mirror.openshift.com/pub/openshift-v4/clients/pipeline/0.11.0/tkn-macos-amd64-0.11.0.tar.gz[CLI].
13+
. Download the link:https://mirror.openshift.com/pub/openshift-v4/clients/pipeline/0.13.1/tkn-macos-amd64-0.13.1.tar.gz[CLI].
1414

1515
. Unpack and unzip the archive.
1616

0 commit comments

Comments
 (0)