Documentation
¶
Index ¶
- Constants
- func AddAnnotationToPipelineRun(ctx context.Context, pipelineRun *tektonv1.PipelineRun, ...) error
- func AddFinalizerToPipelineRun(ctx context.Context, pipelineRun *tektonv1.PipelineRun, ...) error
- func GetApplicationNameFromPipelineRun(pipelineRun *tektonv1.PipelineRun) string
- func GetResultsFromPipelineRun(pipelineRun *tektonv1.PipelineRun) ([]byte, error)
- func IsAnnotationExistInPipelineRun(object client.Object, annotation string, annotationValue string) bool
- func IsFinalizerExistInPipelineRun(object client.Object, finalizer string) bool
- func IsPipelineRunEnded(object client.Object) bool
- func IsPipelineRunEndedSuccessfully(object client.Object) bool
- func IsPushPipelineRun(object client.Object) bool
- func PushPipelineRunCreatedPredicate() predicate.Predicate
- func PushPipelineRunDeletingPredicate() predicate.Predicate
- func PushPipelineRunEndedFinalizerPredicate() predicate.Predicate
- func PushPipelineRunEndedNoAnnotationPredicate() predicate.Predicate
- func RemoveFinalizerFromPipelineRun(ctx context.Context, pipelineRun *tektonv1.PipelineRun, ...) error
- type NotificationServiceReconciler
Constants ¶
const AppLabelKey string = "appstudio.openshift.io/application"
const NotificationPipelineRunAnnotation string = "konflux.ci/notified"
const NotificationPipelineRunAnnotationValue string = "true"
const NotificationPipelineRunFinalizer string = "konflux.ci/notification"
const PipelineRunTypeLabel string = "pipelinesascode.tekton.dev/event-type"
const PushPipelineRunTypeValue string = "push"
Variables ¶
This section is empty.
Functions ¶
func AddAnnotationToPipelineRun ¶
func AddAnnotationToPipelineRun(ctx context.Context, pipelineRun *tektonv1.PipelineRun, r *NotificationServiceReconciler, annotation string, annotationValue string) error
AddNotificationAnnotationToPipelineRun adds an annotation to the PipelineRun. If annotation was not added successfully, a non-nil error is returned.
func AddFinalizerToPipelineRun ¶
func AddFinalizerToPipelineRun(ctx context.Context, pipelineRun *tektonv1.PipelineRun, r *NotificationServiceReconciler, finalizer string) error
AddFinalizerToPipelineRun adds the finalizer to the PipelineRun. If finalizer was not added successfully, a non-nil error is returned.
func GetApplicationNameFromPipelineRun ¶
func GetApplicationNameFromPipelineRun(pipelineRun *tektonv1.PipelineRun) string
GetApplicationNameFromPipelineRun gets the application name from the application label Returns the application name or empty string in case the applicatio name could not retrieved
func GetResultsFromPipelineRun ¶
func GetResultsFromPipelineRun(pipelineRun *tektonv1.PipelineRun) ([]byte, error)
GetResultsFromPipelineRun extracts results from pipelinerun And adds the pipelinerunName Return error if failed to extract results or if results does not exist
func IsAnnotationExistInPipelineRun ¶
func IsAnnotationExistInPipelineRun(object client.Object, annotation string, annotationValue string) bool
IsNotificationAnnotationExist checks if an annotation exists in pipelineRun Return true if yes, otherwise return false If the object passed to this function is not a PipelineRun, the function will return false.
func IsFinalizerExistInPipelineRun ¶
IsFinalizerExistInPipelineRun checks if an finalizer exists in pipelineRun Return true if yes, otherwise return false If the object passed to this function is not a PipelineRun, the function will return false.
func IsPipelineRunEnded ¶
IsPipelineRunEnded returns a boolean indicating whether the PipelineRun finished or not. If the object passed to this function is not a PipelineRun, the function will return false.
func IsPipelineRunEndedSuccessfully ¶
IsPipelineRunEndedSuccessfully returns a boolean indicating whether the PipelineRun succeeded or not. If the object passed to this function is not a PipelineRun, the function will return false.
func IsPushPipelineRun ¶
IsPushPipelineRun checks if an object is a push pipelinerun Return true if yes, otherwise return false If the object passed to this function is not a PipelineRun, the function will return false.
func PushPipelineRunCreatedPredicate ¶
PushPipelineRunCreatedPredicate returns a predicate which filters out all objects except Push PipelineRuns that have just created
func PushPipelineRunDeletingPredicate ¶
BuildPipelineRunDeletingPredicate returns a predicate which filters out all objects except Build PipelineRuns which have been updated to deleting
func PushPipelineRunEndedFinalizerPredicate ¶
PushPipelineRunEndedFinalizerPredicate returns a predicate which filters out all objects except Push PipelineRuns which have finished and has finalizer
func PushPipelineRunEndedNoAnnotationPredicate ¶
PushPipelineRunEndedNoAnnotationPredicate returns a predicate which filters out all objects except Push PipelineRuns which have finished and has no notification annotation
func RemoveFinalizerFromPipelineRun ¶
func RemoveFinalizerFromPipelineRun(ctx context.Context, pipelineRun *tektonv1.PipelineRun, r *NotificationServiceReconciler, finalizer string) error
RemoveFinalizerFromPipelineRun removes the finalizer from the PipelineRun. If finalizer was not removed successfully, a non-nil error is returned.
Types ¶
type NotificationServiceReconciler ¶
type NotificationServiceReconciler struct { client.Client Log logr.Logger Scheme *runtime.Scheme Notifier notifier.Notifier }
NotificationServiceReconciler reconciles a NotificationService object
func (*NotificationServiceReconciler) Reconcile ¶
func (r *NotificationServiceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile will monitor the pipelinerun, extract its result and send it as a webhook When a pipelinerun is created, it will add a finalizer to it so we will be able to extract the results After a pipelinerun ends successfully, the results will be extracted from it and will be sent as a webhook, An annotation will be added to mark this pipelinerun as handled and the finalizer will be rmoved to allow the deletion of this pipelinerun
func (*NotificationServiceReconciler) SetupWithManager ¶
func (r *NotificationServiceReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.