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 {
|
for _, srv := range project.Services {
|
||||||
service := srv
|
service := srv
|
||||||
|
if service.Image == "" {
|
||||||
|
w.Event(progress.Event{
|
||||||
|
ID: service.Name,
|
||||||
|
Status: progress.Done,
|
||||||
|
Text: "Skipped",
|
||||||
|
})
|
||||||
|
continue
|
||||||
|
}
|
||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
w.Event(progress.Event{
|
w.Event(progress.Event{
|
||||||
ID: service.Name,
|
ID: service.Name,
|
||||||
|
|
|
@ -23,6 +23,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
|
"github.com/docker/buildx/driver"
|
||||||
|
|
||||||
"github.com/docker/compose-cli/config"
|
"github.com/docker/compose-cli/config"
|
||||||
"github.com/docker/compose-cli/progress"
|
"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
|
info.IndexServerAddress = registry.IndexServer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
w := progress.ContextWriter(ctx)
|
||||||
for _, service := range project.Services {
|
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
|
continue
|
||||||
}
|
}
|
||||||
service := service
|
service := service
|
||||||
eg.Go(func() error {
|
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)
|
ref, err := reference.ParseNormalizedNamed(service.Image)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -104,9 +117,6 @@ func (s *composeService) Push(ctx context.Context, project *types.Project) error
|
||||||
toPushProgressEvent("Pushing "+service.Name, jm, w)
|
toPushProgressEvent("Pushing "+service.Name, jm, w)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
|
||||||
}
|
|
||||||
return eg.Wait()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func toPushProgressEvent(prefix string, jm jsonmessage.JSONMessage, w progress.Writer) {
|
func toPushProgressEvent(prefix string, jm jsonmessage.JSONMessage, w progress.Writer) {
|
||||||
|
|
Loading…
Reference in New Issue