Skip to content

Commit

Permalink
WIP Emit events from the PipelineRun controller
Browse files Browse the repository at this point in the history
Emit additional events:
- Pipeline Start

Emit all events through the events.go module.
Align and simplify the reconcile structure to have clear points
for error handling and emitting events.
  • Loading branch information
afrittoli committed May 16, 2020
1 parent 6ae926f commit 3da3c74
Show file tree
Hide file tree
Showing 5 changed files with 322 additions and 268 deletions.
11 changes: 11 additions & 0 deletions pkg/apis/pipeline/v1beta1/pipelinerun_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,17 @@ func (pr *PipelineRunStatus) MarkResourceNotConvertible(err *CannotConvertError)
})
}

// MarkResourceFailed sets the ConditionSucceeded condition to ConditionFalse
// based on an error that occurred and a reason
func (pr *PipelineRunStatus) MarkResourceFailed(reason string, err error) {
pipelineRunCondSet.Manage(pr).SetCondition(apis.Condition{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionFalse,
Reason: reason,
Message: err.Error(),
})
}

// PipelineRunStatusFields holds the fields of PipelineRunStatus' status.
// This is defined separately and inlined so that other types can readily
// consume these fields via duck typing.
Expand Down
1 change: 1 addition & 0 deletions pkg/reconciler/pipelinerun/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func NewController(images pipeline.Images) func(context.Context, configmap.Watch
ConfigMapWatcher: cmw,
ResyncPeriod: resyncPeriod,
Logger: logger,
Recorder: controller.GetEventRecorder(ctx),
}

c := &Reconciler{
Expand Down
Loading

0 comments on commit 3da3c74

Please sign in to comment.