mirror of https://github.com/docker/compose.git
ignore services without image attribute
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
b560f0cbe9
commit
5a455e47c3
|
@ -55,6 +55,14 @@ func (s *composeService) Pull(ctx context.Context, project *types.Project) error
|
|||
|
||||
for _, srv := range project.Services {
|
||||
service := srv
|
||||
if service.Image == "" {
|
||||
w.Event(progress.Event{
|
||||
ID: service.Name,
|
||||
Status: progress.Done,
|
||||
Text: "Skipped",
|
||||
})
|
||||
continue
|
||||
}
|
||||
eg.Go(func() error {
|
||||
w.Event(progress.Event{
|
||||
ID: service.Name,
|
||||
|
|
|
@ -23,6 +23,8 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/docker/buildx/driver"
|
||||
|
||||
"github.com/docker/compose-cli/config"
|
||||
"github.com/docker/compose-cli/progress"
|
||||
|
||||
|
@ -51,14 +53,25 @@ func (s *composeService) Push(ctx context.Context, project *types.Project) error
|
|||
info.IndexServerAddress = registry.IndexServer
|
||||
}
|
||||
|
||||
w := progress.ContextWriter(ctx)
|
||||
for _, service := range project.Services {
|
||||
if service.Build == nil {
|
||||
if service.Build == nil || service.Image == "" {
|
||||
w.Event(progress.Event{
|
||||
ID: service.Name,
|
||||
Status: progress.Done,
|
||||
Text: "Skipped",
|
||||
})
|
||||
continue
|
||||
}
|
||||
service := service
|
||||
eg.Go(func() error {
|
||||
w := progress.ContextWriter(ctx)
|
||||
return s.pullServiceImage(ctx, service, info, configFile, w)
|
||||
})
|
||||
}
|
||||
return eg.Wait()
|
||||
}
|
||||
|
||||
func (s *composeService) pullServiceImage(ctx context.Context, service types.ServiceConfig, info moby.Info, configFile driver.Auth, w progress.Writer) error {
|
||||
ref, err := reference.ParseNormalizedNamed(service.Image)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -104,9 +117,6 @@ func (s *composeService) Push(ctx context.Context, project *types.Project) error
|
|||
toPushProgressEvent("Pushing "+service.Name, jm, w)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
return eg.Wait()
|
||||
}
|
||||
|
||||
func toPushProgressEvent(prefix string, jm jsonmessage.JSONMessage, w progress.Writer) {
|
||||
|
|
Loading…
Reference in New Issue