Skip to content

Commit 3e32527

Browse files
committed
Merge branch 'main' of github.com:pluralsh/deployment-operator
2 parents 11c4091 + 072150e commit 3e32527

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

pkg/sync/status.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,24 @@ func (engine *Engine) UpdateErrorStatus(id string, err error) {
182182
}
183183
}
184184

185+
func FormatActionGroupEvent(age event.ActionGroupEvent) error {
186+
switch age.Action {
187+
case event.ApplyAction:
188+
log.Info("apply phase", "status", strings.ToLower(age.Status.String()))
189+
case event.PruneAction:
190+
log.Info("prune phase ", "status", strings.ToLower(age.Status.String()))
191+
case event.DeleteAction:
192+
log.Info("delete phase", "status", strings.ToLower(age.Status.String()))
193+
case event.WaitAction:
194+
log.Info("reconcile phase", "status", strings.ToLower(age.Status.String()))
195+
case event.InventoryAction:
196+
log.Info("inventory update", "status", strings.ToLower(age.Status.String()))
197+
default:
198+
return fmt.Errorf("invalid action group action: %+v", age)
199+
}
200+
return nil
201+
}
202+
185203
func (engine *Engine) UpdateApplyStatus(id, name, namespace string, ch <-chan event.Event, printStatus bool) error {
186204
var statsCollector stats.Stats
187205
var err error
@@ -193,6 +211,14 @@ func (engine *Engine) UpdateApplyStatus(id, name, namespace string, ch <-chan ev
193211
for e := range ch {
194212
statsCollector.Handle(e)
195213
switch e.Type {
214+
case event.ActionGroupType:
215+
if err := FormatActionGroupEvent(
216+
e.ActionGroupEvent,
217+
); err != nil {
218+
return err
219+
}
220+
case event.ErrorType:
221+
return e.ErrorEvent.Err
196222
case event.ApplyType:
197223
gk := e.ApplyEvent.Identifier.GroupKind
198224
name := e.ApplyEvent.Identifier.Name

0 commit comments

Comments
 (0)