Skip to content

Commit

Permalink
Emit events from the PipelineRun controller
Browse files Browse the repository at this point in the history
Emit events:
- Pipeline Start
- Pipeline Started Running
- Various Error Conditions, Cancel, Timeout

Emit all events through the events.go module.
Align and simplify the reconcile structure to have clear points
for error handling and emitting events.

Added test for the normal reconcile to completion case.
Added more event checks to existing tests.
  • Loading branch information
afrittoli committed Jun 6, 2020
1 parent 4f670ce commit 55b2db7
Show file tree
Hide file tree
Showing 6 changed files with 769 additions and 259 deletions.
12 changes: 10 additions & 2 deletions docs/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,21 @@ No events are emitted for `Conditions` today (https://github.com/tektoncd/pipeli
successfully, including post-steps injected by Tekton.
- `Failed`: this is triggered if the `TaskRun` is completed, but not successfully.
Causes of failure may be: one the steps failed, the `TaskRun` was cancelled or
the `TaskRun` timed out.
the `TaskRun` timed out. `Failed` events are also triggered in case the `TaskRun`
cannot be executed at all because of validation issues.

## PipelineRuns

`PipelineRun` events are generated for the following `Reasons`:
- `Started`: this is triggered the first time the `PipelineRun` is picked by the
reconciler from its work queue, so it only happens if web-hook validation was
successful. Note that this event does not imply that a step started executing,
as pipeline, task and bound resource validation must be successful first.
- `Running`: this is triggered when the `PipelineRun` passes validation and
actually starts running.
- `Succeeded`: this is triggered once all `Tasks` reachable via the DAG are
executed successfully.
- `Failed`: this is triggered if the `PipelineRun` is completed, but not
successfully. Causes of failure may be: one the `Tasks` failed or the
`PipelineRun` was cancelled.
`PipelineRun` was cancelled or timed out. `Failed` events are also triggered
in case the `PipelineRun` cannot be executed at all because of validation issues.
1 change: 1 addition & 0 deletions pkg/reconciler/pipelinerun/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func NewController(namespace string, images pipeline.Images) func(context.Contex
KubeClientSet: kubeclientset,
PipelineClientSet: pipelineclientset,
Logger: logger,
Recorder: controller.GetEventRecorder(ctx),
}

c := &Reconciler{
Expand Down
Loading

0 comments on commit 55b2db7

Please sign in to comment.