Skip to content

Commit 1903df3

Browse files
authored
Merge pull request #2592 from nkubala/unmute-logs
Make sure we mute/unmute logs at the correct times
2 parents 4b959ca + e871bb2 commit 1903df3

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

pkg/skaffold/kubernetes/log.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func sinceSeconds(d time.Duration) int64 {
142142
}
143143

144144
func (a *LogAggregator) streamContainerLogs(ctx context.Context, pod *v1.Pod, container v1.ContainerStatus) {
145-
logrus.Infof("Stream logs from pod: %s container: %s", pod.Name, container.Name)
145+
logrus.Infof("Streaming logs from pod: %s container: %s", pod.Name, container.Name)
146146

147147
// In theory, it's more precise to use --since-time='' but there can be a time
148148
// difference between the user's machine and the server.

pkg/skaffold/runner/dev.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@ import (
3434
var ErrorConfigurationChanged = errors.New("configuration changed")
3535

3636
func (r *SkaffoldRunner) doDev(ctx context.Context, out io.Writer) error {
37-
r.logger.Mute()
37+
actionPerformed := false
3838

3939
// acquire the intents
4040
buildIntent, syncIntent, deployIntent := r.intents.GetIntents()
4141

4242
if (r.changeSet.needsRedeploy && deployIntent) ||
4343
(len(r.changeSet.needsRebuild) > 0 && buildIntent) ||
4444
(len(r.changeSet.needsResync) > 0 && syncIntent) {
45+
r.logger.Mute()
4546
// if any action is going to be performed, reset the monitor's changed component tracker for debouncing
4647
defer r.monitor.Reset()
4748
defer r.listener.LogWatchToUser(out)
@@ -56,6 +57,7 @@ func (r *SkaffoldRunner) doDev(ctx context.Context, out io.Writer) error {
5657
r.changeSet.resetSync()
5758
r.intents.resetSync()
5859
}()
60+
actionPerformed = true
5961
for _, s := range r.changeSet.needsResync {
6062
color.Default.Fprintf(out, "Syncing %d files for %s\n", len(s.Copy)+len(s.Delete), s.Image)
6163

@@ -70,6 +72,9 @@ func (r *SkaffoldRunner) doDev(ctx context.Context, out io.Writer) error {
7072
r.changeSet.resetBuild()
7173
r.intents.resetBuild()
7274
}()
75+
// this linter apparently doesn't understand fallthroughs
76+
//nolint:ineffassign
77+
actionPerformed = true
7378
if _, err := r.BuildAndTest(ctx, out, r.changeSet.needsRebuild); err != nil {
7479
r.changeSet.reset()
7580
logrus.Warnln("Skipping deploy due to error:", err)
@@ -83,6 +88,7 @@ func (r *SkaffoldRunner) doDev(ctx context.Context, out io.Writer) error {
8388
r.logger.Unmute()
8489
return nil
8590
}
91+
actionPerformed = true
8692
r.forwarderManager.Stop()
8793
defer func() {
8894
r.changeSet.reset()
@@ -97,7 +103,9 @@ func (r *SkaffoldRunner) doDev(ctx context.Context, out io.Writer) error {
97103
}
98104
}
99105

100-
r.logger.Unmute()
106+
if actionPerformed {
107+
r.logger.Unmute()
108+
}
101109
return nil
102110
}
103111

0 commit comments

Comments
 (0)