Documentation ¶
Index ¶
- func GetCloudEventDeliveryCompareOptions() []cmp.Option
- func InitializeCloudEvents(tr *v1alpha1.TaskRun, prs []*v1alpha1.PipelineResource)
- func NewFakeClient(behaviour *FakeClientBehaviour) client.Client
- func SendCloudEvent(sinkURI, eventID, eventSourceURI string, data []byte, ...) (cloudevents.Event, error)
- func SendCloudEvents(tr *v1alpha1.TaskRun, ceclient CEClient, logger *zap.SugaredLogger) error
- func SendTaskRunCloudEvent(sinkURI string, taskRun *v1alpha1.TaskRun, logger *zap.SugaredLogger, ...) (cloudevents.Event, 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 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) client.Client
NewFakeClient is a FakeClient factory, it returns a client for the target
func SendCloudEvent ¶
func SendCloudEvent(sinkURI, eventID, eventSourceURI string, data []byte, eventType TektonEventType, logger *zap.SugaredLogger, cloudEventClient CEClient) (cloudevents.Event, error)
SendCloudEvent sends a Cloud Event to the specified SinkURI
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 SendTaskRunCloudEvent ¶
func SendTaskRunCloudEvent(sinkURI string, taskRun *v1alpha1.TaskRun, logger *zap.SugaredLogger, cloudEventClient CEClient) (cloudevents.Event, error)
SendTaskRunCloudEvent sends a cloud event for a TaskRun
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 ¶
CEClient matches the `Client` interface from github.com/cloudevents/sdk-go/pkg/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) Send ¶
func (c FakeClient) Send(ctx context.Context, event cloudevents.Event) (*cloudevents.Event, error)
Send fakes the Send method from kncloudevents.NewDefaultClient
func (FakeClient) StartReceiver ¶
func (c FakeClient) StartReceiver(ctx context.Context, fn interface{}) error
StartReceiver fakes the StartReceiver method from kncloudevents.NewDefaultClient
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" )