controller

package
v0.0.0-...-02bafa8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const AppLabelKey string = "appstudio.openshift.io/application"
View Source
const NotificationPipelineRunAnnotation string = "konflux.ci/notified"
View Source
const NotificationPipelineRunAnnotationValue string = "true"
View Source
const NotificationPipelineRunFinalizer string = "konflux.ci/notification"
View Source
const PipelineRunTypeLabel string = "pipelinesascode.tekton.dev/event-type"
View Source
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

func IsFinalizerExistInPipelineRun(object client.Object, finalizer string) bool

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

func IsPipelineRunEnded(object client.Object) bool

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

func IsPipelineRunEndedSuccessfully(object client.Object) bool

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

func IsPushPipelineRun(object client.Object) bool

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

func PushPipelineRunCreatedPredicate() predicate.Predicate

PushPipelineRunCreatedPredicate returns a predicate which filters out all objects except Push PipelineRuns that have just created

func PushPipelineRunDeletingPredicate

func PushPipelineRunDeletingPredicate() predicate.Predicate

BuildPipelineRunDeletingPredicate returns a predicate which filters out all objects except Build PipelineRuns which have been updated to deleting

func PushPipelineRunEndedFinalizerPredicate

func PushPipelineRunEndedFinalizerPredicate() predicate.Predicate

PushPipelineRunEndedFinalizerPredicate returns a predicate which filters out all objects except Push PipelineRuns which have finished and has finalizer

func PushPipelineRunEndedNoAnnotationPredicate

func PushPipelineRunEndedNoAnnotationPredicate() predicate.Predicate

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL