Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
Added a sample custome task
Browse files Browse the repository at this point in the history
  • Loading branch information
tisutisu committed Sep 28, 2023
1 parent 8b5f019 commit d870d74
Showing 1 changed file with 51 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,58 @@ Example task:
+
[source]
--
name: example-task
params:
- name: example-param
value: “Example”
runAfter:
- build-container #You can be more specific by choosing another task
taskRef:
params:
- name: name
value: example-task
- name: bundle
value: <path to container image>
- name: kind
value: task
resolver: bundles
when:
- input: $(params.skip-checks) #This references the pipeline parameters
operator: in
values:
- "false"
name: example-task
params:
- name: example-param
value: “Example”
runAfter:
- build-container #You can be more specific by choosing another task
taskRef:
params:
- name: name
value: example-task # metadata.name field of the Task
- name: bundle
value: quay.io/tekton-bundle-catalog/example-task-bundle:1.0
# For more details on tekton bundles, refer https://tekton.dev/docs/pipelines/pipelines/#tekton-bundles
- name: kind
value: task
resolver: bundles
when:
- input: $(params.skip-checks) #This references the pipeline parameters
operator: in
values:
- "false"
--

+
An example of custom task added to the pipeline which sends slack notification when the pipelinerun fails:
+
[source]
--
name: slack-webhook-notification
params:
- name: message
value: PipelineRun $(context.pipelineRun.name) failed
- name: secret-name
value: my-secret # name of the secret in the your namespace which contains slack web-hook URL
- name: key-name
value: dev-team # key name of the secret
taskRef:
params:
- name: bundle
value: quay.io/redhat-appstudio-tekton-catalog/task-slack-webhook-notification:0.1
- name: name
value: slack-webhook-notification
- name: kind
value: Task
resolver: bundles
when:
- input: $(tasks.status)
operator: in
values: ["Failed"]
--
Note that in order for this task to work you need to create a secret in your namespace with at least one key where value is webhook URL for slack.

+
NOTE: If you want to define a task directly in this file, rather than using `taskRef`, you can use `taskSpec`. Visit the documentation linked in the <<additional-resources>> section.

Expand Down

0 comments on commit d870d74

Please sign in to comment.