diff --git a/workflow/executor/resource.go b/workflow/executor/resource.go index 8b4d35228e40..f39b88c6d761 100644 --- a/workflow/executor/resource.go +++ b/workflow/executor/resource.go @@ -227,6 +227,10 @@ func checkResourceState(resourceNamespace string, resourceName string, successRe }() for { + if checkIfResourceDeleted(resourceName, resourceNamespace) { + return false, errors.Errorf(errors.CodeNotFound, "Resource %s in namespace %s has been deleted somehow.", resourceName, resourceNamespace) + } + jsonBytes, err := readJSON(reader) if err != nil { @@ -254,10 +258,6 @@ func checkResourceState(resourceNamespace string, resourceName string, successRe return true, resultErr } - if checkIfResourceDeleted(resourceName, resourceNamespace) { - return false, errors.Errorf(errors.CodeNotFound, "Resource %s in namespace %s has been deleted somehow.", resourceName, resourceNamespace) - } - log.Info(string(jsonBytes)) ls := gjsonLabels{json: jsonBytes} for _, req := range failReqs {