mirror of https://github.com/fluxcd/cli-utils.git
add ids in the apply task into taskContext
This commit is contained in:
parent
b9ff655ee7
commit
c6a79a0764
|
|
@ -137,6 +137,7 @@ func (a *ApplyTask) Start(taskContext *taskrunner.TaskContext) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
infos = append(infos, info)
|
||||||
canApply, err := inventory.CanApply(a.InvInfo, clusterObj, a.InventoryPolicy)
|
canApply, err := inventory.CanApply(a.InvInfo, clusterObj, a.InventoryPolicy)
|
||||||
if !canApply {
|
if !canApply {
|
||||||
taskContext.EventChannel() <- createApplyEvent(
|
taskContext.EventChannel() <- createApplyEvent(
|
||||||
|
|
@ -147,7 +148,6 @@ func (a *ApplyTask) Start(taskContext *taskrunner.TaskContext) {
|
||||||
}
|
}
|
||||||
// add the inventory annotation to the resource being applied.
|
// add the inventory annotation to the resource being applied.
|
||||||
inventory.AddInventoryIDAnnotation(obj, a.InvInfo)
|
inventory.AddInventoryIDAnnotation(obj, a.InvInfo)
|
||||||
infos = append(infos, info)
|
|
||||||
ao.SetObjects([]*resource.Info{info})
|
ao.SetObjects([]*resource.Info{info})
|
||||||
err = ao.Run()
|
err = ao.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -611,6 +611,8 @@ func TestApplyTaskWithDifferentInventoryAnnotation(t *testing.T) {
|
||||||
assert.Equal(t, tc.expectedEvents[i].Type, e.Type)
|
assert.Equal(t, tc.expectedEvents[i].Type, e.Type)
|
||||||
assert.Equal(t, tc.expectedEvents[i].ApplyEvent.Error.Error(), e.ApplyEvent.Error.Error())
|
assert.Equal(t, tc.expectedEvents[i].ApplyEvent.Error.Error(), e.ApplyEvent.Error.Error())
|
||||||
}
|
}
|
||||||
|
actualUids := taskContext.AllResourceUIDs()
|
||||||
|
assert.Equal(t, len(actualUids), 1)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue