mirror of
https://github.com/docker/compose.git
synced 2025-07-22 21:24:38 +02:00
don't use progress to render restart, which hides logs
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
813900180e
commit
0aad9595a5
@ -527,7 +527,7 @@ func (s *composeService) handleWatchBatch(ctx context.Context, project *types.Pr
|
|||||||
pathMappings[i] = batch[i].PathMapping
|
pathMappings[i] = batch[i].PathMapping
|
||||||
}
|
}
|
||||||
|
|
||||||
writeWatchSyncMessage(options.LogTo, serviceName, pathMappings)
|
writeWatchSyncMessage(options.LogTo, serviceName, pathMappings, restartService)
|
||||||
|
|
||||||
service, err := project.GetService(serviceName)
|
service, err := project.GetService(serviceName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -537,17 +537,28 @@ func (s *composeService) handleWatchBatch(ctx context.Context, project *types.Pr
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if restartService {
|
if restartService {
|
||||||
return s.Restart(ctx, project.Name, api.RestartOptions{
|
err = s.restart(ctx, project.Name, api.RestartOptions{
|
||||||
Services: []string{serviceName},
|
Services: []string{serviceName},
|
||||||
Project: project,
|
Project: project,
|
||||||
NoDeps: false,
|
NoDeps: false,
|
||||||
})
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
options.LogTo.Log(
|
||||||
|
api.WatchLogger,
|
||||||
|
fmt.Sprintf("service %q restarted", serviceName))
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// writeWatchSyncMessage prints out a message about the sync for the changed paths.
|
// writeWatchSyncMessage prints out a message about the sync for the changed paths.
|
||||||
func writeWatchSyncMessage(log api.LogConsumer, serviceName string, pathMappings []sync.PathMapping) {
|
func writeWatchSyncMessage(log api.LogConsumer, serviceName string, pathMappings []sync.PathMapping, restart bool) {
|
||||||
|
action := "Syncing"
|
||||||
|
if restart {
|
||||||
|
action = "Syncing and restarting"
|
||||||
|
}
|
||||||
if logrus.IsLevelEnabled(logrus.DebugLevel) {
|
if logrus.IsLevelEnabled(logrus.DebugLevel) {
|
||||||
hostPathsToSync := make([]string, len(pathMappings))
|
hostPathsToSync := make([]string, len(pathMappings))
|
||||||
for i := range pathMappings {
|
for i := range pathMappings {
|
||||||
@ -556,7 +567,8 @@ func writeWatchSyncMessage(log api.LogConsumer, serviceName string, pathMappings
|
|||||||
log.Log(
|
log.Log(
|
||||||
api.WatchLogger,
|
api.WatchLogger,
|
||||||
fmt.Sprintf(
|
fmt.Sprintf(
|
||||||
"Syncing %q after changes were detected: %s",
|
"%s service %q after changes were detected: %s",
|
||||||
|
action,
|
||||||
serviceName,
|
serviceName,
|
||||||
strings.Join(hostPathsToSync, ", "),
|
strings.Join(hostPathsToSync, ", "),
|
||||||
),
|
),
|
||||||
@ -564,7 +576,7 @@ func writeWatchSyncMessage(log api.LogConsumer, serviceName string, pathMappings
|
|||||||
} else {
|
} else {
|
||||||
log.Log(
|
log.Log(
|
||||||
api.WatchLogger,
|
api.WatchLogger,
|
||||||
fmt.Sprintf("Syncing service %q after %d changes were detected", serviceName, len(pathMappings)),
|
fmt.Sprintf("%s service %q after %d changes were detected", action, serviceName, len(pathMappings)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -290,8 +290,7 @@ func doTest(t *testing.T, svcName string) {
|
|||||||
return poll.Continue("%v", r.Combined())
|
return poll.Continue("%v", r.Combined())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
poll.WaitOn(t, checkRestart(fmt.Sprintf("%s-1 Restarting", svcName)))
|
poll.WaitOn(t, checkRestart(fmt.Sprintf("service %q restarted", svcName)))
|
||||||
poll.WaitOn(t, checkRestart(fmt.Sprintf("%s-1 Started", svcName)))
|
|
||||||
poll.WaitOn(t, checkFileContents("/app/config/file.config", "This is an updated config file"))
|
poll.WaitOn(t, checkFileContents("/app/config/file.config", "This is an updated config file"))
|
||||||
|
|
||||||
testComplete.Store(true)
|
testComplete.Store(true)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user