Documentation ¶
Index ¶
- func EventForTaskRun(taskRun *v1alpha1.TaskRun) (*cloudevents.Event, error)
- func GetCloudEventDeliveryCompareOptions() []cmp.Option
- func InitializeCloudEvents(tr *v1alpha1.TaskRun, prs []*v1alpha1.PipelineResource)
- func NewFakeClient(behaviour *FakeClientBehaviour) cloudevents.Client
- func SendCloudEvents(tr *v1alpha1.TaskRun, ceclient CEClient, logger *zap.SugaredLogger) error
- func WithClient(ctx context.Context, behaviour *FakeClientBehaviour) context.Context
- type CECKey
- type CEClient
- type FakeClient
- type FakeClientBehaviour
- type TektonCloudEventData
- type TektonEventType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EventForTaskRun ¶ added in v0.12.0
func EventForTaskRun(taskRun *v1alpha1.TaskRun) (*cloudevents.Event, error)
EventForTaskRun will create a new event based on a TaskRun, or return an error if not possible.
func GetCloudEventDeliveryCompareOptions ¶
GetCloudEventDeliveryCompareOptions returns compare options to sort and compare a list of CloudEventDelivery
func InitializeCloudEvents ¶
func InitializeCloudEvents(tr *v1alpha1.TaskRun, prs []*v1alpha1.PipelineResource)
InitializeCloudEvents initializes the CloudEvents part of the TaskRunStatus from a slice of PipelineResources
func NewFakeClient ¶
func NewFakeClient(behaviour *FakeClientBehaviour) cloudevents.Client
NewFakeClient is a FakeClient factory, it returns a client for the target
func SendCloudEvents ¶
SendCloudEvents is used by the TaskRun controller to send cloud events once the TaskRun is complete. `tr` is used to obtain the list of targets but also to construct the body of the
func WithClient ¶
func WithClient(ctx context.Context, behaviour *FakeClientBehaviour) context.Context
WithClient adds to the context a fake client with the desired behaviour
Types ¶
type CECKey ¶
type CECKey struct{}
CECKey is used to associate the CloudEventClient inside the context.Context
type CEClient ¶
type CEClient cloudevents.Client
CEClient matches the `Client` interface from github.com/cloudevents/sdk-go/v2/cloudevents
type FakeClient ¶
type FakeClient struct {
// contains filtered or unexported fields
}
FakeClient is a fake CloudEvent client for unit testing Holding a pointer to the behaviour allows to change the behaviour of a client
func (FakeClient) Request ¶ added in v0.12.0
func (c FakeClient) Request(ctx context.Context, event cloudevents.Event) (*cloudevents.Event, protocol.Result)
Request fakes the Request method from cloudevents.Client
func (FakeClient) Send ¶
func (c FakeClient) Send(ctx context.Context, event cloudevents.Event) protocol.Result
Send fakes the Send method from cloudevents.Client
func (FakeClient) StartReceiver ¶
func (c FakeClient) StartReceiver(ctx context.Context, fn interface{}) error
StartReceiver fakes StartReceiver method from cloudevents.Client
type FakeClientBehaviour ¶
type FakeClientBehaviour struct {
SendSuccessfully bool
}
FakeClientBehaviour defines how the client will behave
type TektonCloudEventData ¶
TektonCloudEventData type is used to marshal and unmarshal the payload of a Tekton cloud event. It only includes a TaskRun for now. Using a type opens the possibility for the future to add more data to the payload
func NewTektonCloudEventData ¶
func NewTektonCloudEventData(taskRun *v1alpha1.TaskRun) TektonCloudEventData
NewTektonCloudEventData returns a new instance of NewTektonCloudEventData
type TektonEventType ¶
type TektonEventType string
TektonEventType holds the types of cloud events sent by Tekton
const ( // TektonTaskRunUnknownV1 is sent for TaskRuns with "ConditionSucceeded" "Unknown" TektonTaskRunUnknownV1 TektonEventType = "dev.tekton.event.task.unknown.v1" // TektonTaskRunSuccessfulV1 is sent for TaskRuns with "ConditionSucceeded" "True" TektonTaskRunSuccessfulV1 TektonEventType = "dev.tekton.event.task.successful.v1" // TektonTaskRunFailedV1 is sent for TaskRuns with "ConditionSucceeded" "False" TektonTaskRunFailedV1 TektonEventType = "dev.tekton.event.task.failed.v1" )
func (TektonEventType) String ¶ added in v0.12.0
func (t TektonEventType) String() string