func()

in controllers/stage/event_handler.go [35:71]


func (h *PipelineEventHandler) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface) {
	if evt.ObjectNew == nil {
		h.log.Info("Object is nil")
		return
	}

	_, ok := evt.ObjectNew.(*cdPipeApi.CDPipeline)
	if !ok {
		h.log.Info("Object is not CDPipeline")
		return
	}

	if !evt.ObjectNew.GetDeletionTimestamp().IsZero() {
		h.log.Info("CD pipeline is being deleted")
		return
	}

	stages := &cdPipeApi.StageList{}
	if err := h.client.List(
		context.Background(),
		stages,
		client.InNamespace(evt.ObjectNew.GetNamespace()),
		client.MatchingLabels{cdPipeApi.StageCdPipelineLabelName: evt.ObjectNew.GetName()},
		client.Limit(clientLimit),
	); err != nil {
		h.log.Error(err, "unable to get stages for cd pipeline", "cd pipeline", evt.ObjectNew.GetName())
		return
	}

	//nolint
	for _, stage := range stages.Items {
		q.Add(reconcile.Request{NamespacedName: types.NamespacedName{
			Namespace: stage.GetNamespace(),
			Name:      stage.GetName(),
		}})
	}
}