Template Field Reference
Every field on the domain.Event struct is available in your templates. This page documents each field, its type, where it comes from, and when itβs populated. Use this as a lookup while writing templates.
Field summary
All fields are accessed with a leading dot in templates (e.g., {{ .State }}). Pointer fields (*int) must be guarded before dereferencing.
Routing fields
Field Type Description Example values .ProviderstringSCM provider name from the scm.provider annotation github, gitlab, gitea, bitbucket, azure_devops, sourcehut.ResourceResourceType of Kubernetes resource that emitted the event taskrun, pipelinerun, customrun, eventlistener.APIBaseURLstringBase URL override for self-hosted SCM instances https://github.mycompany.com/api/v3
Pipeline identity
Field Type Description Example values .RunNamestringName of the TaskRun, PipelineRun, or CustomRun build-abc12, my-pipeline-run-7k9z.RunIDstringUnique identifier (metadata.uid) a1b2c3d4-e5f6-7890-abcd-ef1234567890.NamespacestringKubernetes namespace default, production, tekton-ci
Resource-specific names
Field Type Description Example values .TaskNamestringReferenced Task spec name (from tekton.dev/task label) build, test-unit, deploy-staging.PipelineNamestringReferenced Pipeline spec name (from tekton.dev/pipeline label) my-pipeline, release-v2.PipelineTaskNamestringTask name within the Pipeline (from tekton.dev/pipelineTask label) run-tests, build-image.EventListenerNamestringEventListener that processed the trigger github-listener, ci-trigger.TriggerNamestringTekton Trigger name (from triggers.tekton.dev/trigger label) push-trigger, pr-trigger
Display names
Field Type Description Example values .TaskDisplayNamestringHuman-readable Task name from spec Run Unit Tests, Build Container Image.PipelineDisplayNamestringHuman-readable Pipeline name from spec CI Pipeline, Release Process
Status flags
Field Type Description Example values .IsFinallyTaskboolTrue if the task belongs to the finally block (from tekton.dev/memberOf label) true, false.SCMEventTypestringWebhook event type from EventListener headers (e.g., issues, pull_request, push) pull_request, push, issues.TaskCountintNumber of child tasks (from PipelineRun status.childReferences length) 0, 5, 12
State
Field Type Description Possible values .StateStateLogical execution state pending, running, success, failure, error, canceled, done.ContextstringLogical check name (default: tekton/build) tekton/build, tekton/pipeline-summary.DescriptionstringShort human-readable message Build succeeded, Task failed: test-unit.TargetURLstringClickable link to the Tekton Dashboard https://dashboard.example.com/#/namespaces/default/pipelineruns/my-run
SCM fields
Field Type Description Example values .CommitSHAstringFull commit SHA abc1234567890def1234567890abcdef12345678.Repo.OwnerstringRepository owner (GitHub, Gitea, SourceHut) my-org, alice.Repo.NamestringRepository name my-repo, backend-api.Repo.IDstringNumeric project ID (GitLab) 12345678.Repo.WorkspacestringWorkspace name (Bitbucket Cloud) my-workspace.Repo.ProjectstringProject name (Bitbucket Server, Azure DevOps) my-project, DefaultProject.Repo.OrgstringOrganization name (Azure DevOps) my-org
Linking fields (pointer types, guard before use)
Field Type Description Example values .IssueNumber*intIssue number from annotation 42, nil.PRNumber*intPull request number from annotation 123, nil.DiscussionNumber*intDiscussion number from annotation 5, nil.JiraIssueKeystringJira issue key from annotation PROJ-123, ""
Results
Field Type Description Example values .Results[]ResultTask/Pipeline results (slice of {Name, Value}) See below
Result items :
{{- range .Results }}
Name: {{ .Name }}, Value: {{ .Value }}
{{- end }}
Common result names from Tekton:
IMAGE_DIGEST β container image digest
IMAGE_URL β container image URL
COMMIT_SHA β commit SHA (if set by the pipeline)
CHANGES β changed files list
Timing
Field Type Description Example values .StartedAttime.TimeExecution start time 2024-01-15T10:30:00Z.FinishedAttime.TimeExecution end time 2024-01-15T10:35:45Z
Both are zero-valued when not yet set. Guard with .IsZero:
{{- if and (not .StartedAt.IsZero) (not .FinishedAt.IsZero) }}
Started: {{ .StartedAt.Format "2006-01-02 15:04:05 MST" }}
Duration: {{ regexReplaceAll "[.][0-9]+s" (toString (.FinishedAt.Sub .StartedAt)) "s" }}
{{- end }}
Decoder population matrix
Which decoder sets which fields. Checkmarks indicate the decoder populates the field. Blank means the field is zero/empty for that resource type.
Field TaskRun PipelineRun CustomRun EventListener .Providerβ
β
β
β
.Resourceβ
β
β
β
.APIBaseURLβ
β
β
β
.RunNameβ
β
β
β
.RunIDβ
β
β
β
.Namespaceβ
β
β
β
.TaskNameβ
β β β .PipelineNameβ
β
β β .PipelineTaskNameβ
β β β .EventListenerNameβ β β β
.TriggerNameβ β β β .TaskDisplayNameβ
β
β β .PipelineDisplayNameβ β
β β .IsFinallyTaskβ
β β β .SCMEventTypeβ β β β
.TaskCountβ β
β β .Stateβ
β
β
β
.Contextβ
β
β
β
.Descriptionβ
β
β
β
.TargetURLβ
β
β
β .CommitSHAβ
β
β
β
.Repo.*β
β
β
β
.IssueNumberβ
β
β
β .PRNumberβ
β
β
β .DiscussionNumberβ
β
β
β .JiraIssueKeyβ
β
β
β .Resultsβ
β
β
β .StartedAtβ
β
β
β .FinishedAtβ
β
β
β
State values
The .State field maps from the CloudEvent type suffix:
CloudEvent suffix .State valueDescription queuedpendingEvent queued, not yet executing startedrunningExecution started runningrunningExecution in progress succeededsuccessExecution completed successfully failedfailureExecution failed cancelledcanceledExecution was cancelled unknownrunningUnknown state (treated as running) successfulsuccessEventListener success donedoneEventListener completion
Accumulator SummaryData
The accumulator uses a different data type than the standard domain.Event. Templates receive a SummaryData struct:
Field Type Description Example values .PipelineNamestringPipeline name my-pipeline.RunNamestringPipelineRun name my-pipeline-run-abc.StatestringTerminal state success, failure, error, canceled.Tasks[]TaskSummarySorted list of task summaries See below
TaskSummary fields :
Field Type Description Example values .NamestringTask name build, test, deploy.StatestringTask state success, failure, running.EmojistringState emoji β
, β, β οΈ, π«, π, β³.DurationstringFormatted duration 45s, 1m20s, N/A
The accumulator template does NOT have access to domain.Event fields. Use SummaryData fields only.
Template examples by field
Pipeline summary with results
## Pipeline {{ .State }}
**Pipeline:** {{ .PipelineName | default .RunName }}
**Run:** `{{ .RunName }}`
**Namespace:** {{ .Namespace }}
{{- if .CommitSHA }}
**Commit:** `{{ .CommitSHA | trunc 8 }}`
{{- end }}
{{- if and (not .StartedAt.IsZero) (not .FinishedAt.IsZero) }}
**Duration:** {{ regexReplaceAll "[.][0-9]+s" (toString (.FinishedAt.Sub .StartedAt)) "s" }}
{{- end }}
{{- if .Results }}
### Results
| Name | Value |
|---|---|
{{- range .Results }}
| `{{ .Name }}` | `{{ Truncate .Value 120 }}` |
{{- end }}
{{- end }}
Conditional content by resource type
{{- if eq .Resource "pipelinerun" }}
Pipeline: {{ .PipelineName }}
Tasks: {{ .TaskCount }}
{{- else if eq .Resource "taskrun" }}
Task: {{ .TaskName }}
{{- if .IsFinallyTask }}(finally task){{ end }}
{{- end }}
Provider-specific issue reference
{{- if .PRNumber }}
Pull Request: {{ PRRef .Provider .PRNumber .Repo.Owner .Repo.Name }}
{{- else if .IssueNumber }}
Issue: {{ IssueRef .Provider .IssueNumber .Repo.Owner .Repo.Name }}
{{- end }}