From 2d906b1ad926f24a286975667f933f000384d3b1 Mon Sep 17 00:00:00 2001 From: ssanders1449 <59558157+ssanders1449@users.noreply.github.com> Date: Tue, 27 Sep 2022 20:09:38 +0300 Subject: [PATCH] add v1.2.2 patch for issue#2024 (#5) Signed-off-by: Shlomo Sanders Signed-off-by: Shlomo Sanders Co-authored-by: Shlomo Sanders Signed-off-by: Travis Perdue --- analysis/analysis.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/analysis/analysis.go b/analysis/analysis.go index e5c6fc907d..96c935c803 100644 --- a/analysis/analysis.go +++ b/analysis/analysis.go @@ -316,7 +316,7 @@ func (c *Controller) runMeasurements(run *v1alpha1.AnalysisRun, tasks []metricTa for _, task := range tasks { wg.Add(1) - go func(t metricTask) error { + go func(t metricTask) { defer wg.Done() //redact secret values from logs logger := logutil.WithRedactor(*logutil.WithAnalysisRun(run).WithField("metric", t.metric.Name), secrets) @@ -326,9 +326,12 @@ func (c *Controller) runMeasurements(run *v1alpha1.AnalysisRun, tasks []metricTa resultsLock.Unlock() provider, err := c.newProvider(*logger, t.metric) + //Fix for https://github.com/argoproj/argo-rollouts/issues/2024 this error is not bubbled to runMeasurements function + //it just stops the go routine to prevent nil pointer usage. Just keeping this simple due to it being a patch for a bug. + //We probably want to handle errors in this goroutine in a different way in master but for now just prevent crashing. if err != nil { log.Errorf("Error in getting provider :%v", err) - return err + return } if metricResult == nil { metricResult = &v1alpha1.MetricResult{ @@ -408,7 +411,7 @@ func (c *Controller) runMeasurements(run *v1alpha1.AnalysisRun, tasks []metricTa resultsLock.Lock() analysisutil.SetResult(run, *metricResult) resultsLock.Unlock() - return nil + }(task) } wg.Wait()