add ids in the apply task into taskContext

This commit is contained in:
Jingfang Liu 2020-12-21 15:55:06 -08:00
parent b9ff655ee7
commit c6a79a0764
2 changed files with 3 additions and 1 deletions

View File

@ -137,6 +137,7 @@ func (a *ApplyTask) Start(taskContext *taskrunner.TaskContext) {
continue
}
}
infos = append(infos, info)
canApply, err := inventory.CanApply(a.InvInfo, clusterObj, a.InventoryPolicy)
if !canApply {
taskContext.EventChannel() <- createApplyEvent(
@ -147,7 +148,6 @@ func (a *ApplyTask) Start(taskContext *taskrunner.TaskContext) {
}
// add the inventory annotation to the resource being applied.
inventory.AddInventoryIDAnnotation(obj, a.InvInfo)
infos = append(infos, info)
ao.SetObjects([]*resource.Info{info})
err = ao.Run()
if err != nil {

View File

@ -611,6 +611,8 @@ func TestApplyTaskWithDifferentInventoryAnnotation(t *testing.T) {
assert.Equal(t, tc.expectedEvents[i].Type, e.Type)
assert.Equal(t, tc.expectedEvents[i].ApplyEvent.Error.Error(), e.ApplyEvent.Error.Error())
}
actualUids := taskContext.AllResourceUIDs()
assert.Equal(t, len(actualUids), 1)
})
}
}