mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: update compose-go to v2.0.0-rc.8
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
17
vendor/github.com/compose-spec/compose-go/v2/loader/validate.go
generated
vendored
17
vendor/github.com/compose-spec/compose-go/v2/loader/validate.go
generated
vendored
@ -29,6 +29,7 @@ import (
|
||||
|
||||
// checkConsistency validate a compose model is consistent
|
||||
func checkConsistency(project *types.Project) error {
|
||||
containerNames := map[string]string{}
|
||||
for _, s := range project.Services {
|
||||
if s.Build == nil && s.Image == "" {
|
||||
return fmt.Errorf("service %q has neither an image nor a build context specified: %w", s.Name, errdefs.ErrInvalid)
|
||||
@ -123,6 +124,13 @@ func checkConsistency(project *types.Project) error {
|
||||
s.Deploy.Replicas = s.Scale
|
||||
}
|
||||
|
||||
if s.ContainerName != "" {
|
||||
if existing, ok := containerNames[s.ContainerName]; ok {
|
||||
return fmt.Errorf(`"services.%s": container name "%s" is already in use by "services.%s": %w`, s.Name, s.ContainerName, existing, errdefs.ErrInvalid)
|
||||
}
|
||||
containerNames[s.ContainerName] = s.Name
|
||||
}
|
||||
|
||||
if s.GetScale() > 1 && s.ContainerName != "" {
|
||||
attr := "scale"
|
||||
if s.Scale == nil {
|
||||
@ -131,6 +139,15 @@ func checkConsistency(project *types.Project) error {
|
||||
return fmt.Errorf("services.%s: can't set container_name and %s as container name must be unique: %w", attr,
|
||||
s.Name, errdefs.ErrInvalid)
|
||||
}
|
||||
|
||||
if s.Develop != nil && s.Develop.Watch != nil {
|
||||
for _, watch := range s.Develop.Watch {
|
||||
if watch.Action != types.WatchActionRebuild && watch.Target == "" {
|
||||
return fmt.Errorf("services.%s.develop.watch: target is required for non-rebuild actions: %w", s.Name, errdefs.ErrInvalid)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
for name, secret := range project.Secrets {
|
||||
|
Reference in New Issue
Block a user