Skip to content

Commit 051eca7

Browse files
committed
fix: pass error to applyFailed events
There was a bug where an error from an apply filter wasn't propagated to the applyFailed event, which leaded to printed events without error message set on them: > {"group":"rbac.authorization.k8s.io","kind":"RoleBinding","name":"redacted","namespace":"redacted","status":"Failed","timestamp":"2022-12-21T12:43:46Z","type":"apply"}
1 parent 135cc3f commit 051eca7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/apply/task/apply_task.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"k8s.io/klog/v2"
2121
"k8s.io/kubectl/pkg/cmd/apply"
2222
cmddelete "k8s.io/kubectl/pkg/cmd/delete"
23+
2324
applyerror "sigs.k8s.io/cli-utils/pkg/apply/error"
2425
"sigs.k8s.io/cli-utils/pkg/apply/event"
2526
"sigs.k8s.io/cli-utils/pkg/apply/filter"
@@ -121,7 +122,7 @@ func (a *ApplyTask) Start(taskContext *taskrunner.TaskContext) {
121122
// only log event emitted errors if the verbosity > 4
122123
klog.Errorf("apply filter errored (filter: %s, object: %s): %v", applyFilter.Name(), id, fatalErr.Err)
123124
}
124-
taskContext.SendEvent(a.createApplyFailedEvent(id, err))
125+
taskContext.SendEvent(a.createApplyFailedEvent(id, fatalErr))
125126
taskContext.InventoryManager().AddFailedApply(id)
126127
break
127128
}

0 commit comments

Comments
 (0)