diff --git a/daemon/loop.go b/daemon/loop.go index 6be742b66..b752d5ef4 100644 --- a/daemon/loop.go +++ b/daemon/loop.go @@ -241,6 +241,7 @@ func (d *Daemon) doSync(logger log.Logger) (retErr error) { changedFiles, err := working.ChangedFiles(ctx, oldTagRev) if err == nil && len(changedFiles) > 0 { // We had some changed files, we're syncing a diff + // FIXME(michael): this won't be accurate when a file can have more than one resource changedResources, err = d.Manifests.LoadManifests(working.Dir(), changedFiles[0], changedFiles[1:]...) } cancel() @@ -310,7 +311,7 @@ func (d *Daemon) doSync(logger log.Logger) (retErr error) { case update.Images: spec := n.Spec.Spec.(update.ReleaseSpec) noteEvents = append(noteEvents, event.Event{ - ServiceIDs: serviceIDs.ToSlice(), + ServiceIDs: n.Result.AffectedResources(), Type: event.EventRelease, StartedAt: started, EndedAt: time.Now().UTC(), @@ -329,7 +330,7 @@ func (d *Daemon) doSync(logger log.Logger) (retErr error) { case update.Auto: spec := n.Spec.Spec.(update.Automated) noteEvents = append(noteEvents, event.Event{ - ServiceIDs: serviceIDs.ToSlice(), + ServiceIDs: n.Result.AffectedResources(), Type: event.EventAutoRelease, StartedAt: started, EndedAt: time.Now().UTC(), diff --git a/update/result.go b/update/result.go index e0efd8645..ecf80167b 100644 --- a/update/result.go +++ b/update/result.go @@ -30,6 +30,16 @@ func (r Result) ServiceIDs() []string { return result } +func (r Result) AffectedResources() flux.ResourceIDs { + ids := flux.ResourceIDs{} + for id, result := range r { + if result.Status == ReleaseStatusSuccess { + ids = append(ids, id) + } + } + return ids +} + func (r Result) ChangedImages() []string { images := map[image.Ref]struct{}{} for _, serviceResult := range r { @@ -74,10 +84,6 @@ type ControllerResult struct { PerContainer []ContainerUpdate // what happened with each container } -func (fr ControllerResult) Msg(id flux.ResourceID) string { - return fmt.Sprintf("%s service %s as it is %s", fr.Status, id.String(), fr.Error) -} - type ContainerUpdate struct { Container string Current image.Ref