-
Notifications
You must be signed in to change notification settings - Fork 0
Examples
Real-world configurations, ready to adapt. The full annotated config shows every field.
One self-updating summary comment + granular required checks + lifecycle labels:
scm:
github:
- name: github
enabled: true
auth: { secret_name: github-token }
actions:
- name: task-checks
type: commit_status
enabled: true
context_per_task: true # tekton/ci/build, tekton/ci/test, ...
when: 'isTaskRun() && !isFinallyTask()'
- name: pipeline-check
type: commit_status
enabled: true
when: 'isPipelineRun()'
- name: pr-summary
type: pr_comment
enabled: true
mode: upsert # one comment, updated in place
when: 'isPR() && isPipelineRun() && stateIn("running", "success", "failure")'
template: |
### {{ ternary "🔄" (ternary "✅" "❌" (eq .State "success")) (eq .State "running") }} Pipeline `{{.PipelineName}}` — {{.State}}
**Commit:** `{{ .CommitSHA | trunc 8 }}` · {{ if .TargetURL }}[logs]({{.TargetURL}}){{ end }}
- name: ci-labels
type: label
enabled: true
when: 'isPR() && isPipelineRun() && stateIn("running", "success", "failure", "error")'
labels:
add: ["ci::{{.State}}"]
remove: ["ci::running", "ci::success", "ci::failure", "ci::error"]notifiers:
slack:
- name: prod-alerts
enabled: true
secret_name: slack-webhook
channel: "#prod-alerts"
when: 'event.Namespace == "production" && isPipelineRun() && stateIn("failure", "error")'
template: |
:rotating_light: *{{.PipelineName}}* failed in *{{.Namespace}}*
Run `{{.RunName}}` · Commit `{{ .CommitSHA | trunc 8 }}`
{{if .TargetURL}}<{{.TargetURL}}|View logs>{{end}}scm:
github:
- name: github
enabled: true
auth: { secret_name: github-token }
actions:
- name: deployments
type: deployment_status
enabled: true
when: 'isPipelineRun() && event.PipelineName.startsWith("deploy-")'
notifiers:
grafana:
- name: deploy-markers
enabled: true
url: https://grafana.company.example.com
secret_name: grafana-token
when: 'isPipelineRun() && event.PipelineName.startsWith("deploy-") && stateIn("success", "failure")'
sentry:
- name: sentry
enabled: true
org: acme
projects: ["api"]
secret_name: sentry-token
when: 'isPipelineRun() && event.PipelineName.startsWith("deploy-")'Set the environment per run with the tekton.dev/tekton-events-relay.scm.context annotation (staging, production, …).
Engineering metrics (DORA & friends) belong in DevLake — feed it with the webhook notifier and a gojq transform matching DevLake's deployments webhook schema:
notifiers:
webhook:
- name: devlake-deployments
enabled: true
url_secret_name: devlake-webhook # https://devlake/.../plugins/webhook/<id>/deployments
when: 'isPipelineRun() && event.PipelineName.startsWith("deploy-") && stateIn("success", "failure")'
transform: |
{
deploymentCommits: [{
repoUrl: ("https://github.com/" + .repo.owner + "/" + .repo.name),
refName: .commit_sha,
startedDate: .started_at,
finishedDate: .finished_at
}],
id: .run_id,
result: (if .state == "success" then "SUCCESS" else "FAILURE" end),
startedDate: .started_at,
finishedDate: .finished_at
}Instances are independent — one event can update GitHub and a self-managed GitLab and page on-call:
scm:
github:
- name: github
enabled: true
auth: { secret_name: github-token }
actions: [{ name: status, type: commit_status, enabled: true }]
gitlab:
- name: gitlab-internal
variant: self-managed
enabled: true
base_url: https://gitlab.corp.example.com/api/v4
auth: { secret_name: gitlab-token }
actions: [{ name: status, type: commit_status, enabled: true }]
notifiers:
pagerduty:
- name: oncall
enabled: true
secret_name: pd-key
severity: critical
when: 'event.Namespace == "production" && stateIn("failure", "error")'Each run picks its target via the scm.provider annotation (github or gitlab-internal).
Batch all TaskRun results into a single PR comment posted when the PipelineRun finishes:
accumulator:
enabled: true
ttl: 5m
max_size: 200
provider:
name: github # a registered pr_comment-capable instance
scm:
github:
- name: github
enabled: true
auth: { secret_name: github-token }
actions:
- name: pr-comment
type: pr_comment
enabled: true
mode: upsert # summaries converge to one commentGetting started
Reference
SCM providers
Notifiers
Running in production
More