mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-18 09:18:04 +08:00
vendor: update compose-go to v2.4.8
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
14
vendor/github.com/compose-spec/compose-go/v2/loader/validate.go
generated
vendored
14
vendor/github.com/compose-spec/compose-go/v2/loader/validate.go
generated
vendored
@@ -28,7 +28,7 @@ import (
|
||||
|
||||
// checkConsistency validate a compose model is consistent
|
||||
func checkConsistency(project *types.Project) error {
|
||||
for _, s := range project.Services {
|
||||
for name, 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)
|
||||
}
|
||||
@@ -38,6 +38,18 @@ func checkConsistency(project *types.Project) error {
|
||||
return fmt.Errorf("service %q declares mutualy exclusive dockerfile and dockerfile_inline: %w", s.Name, errdefs.ErrInvalid)
|
||||
}
|
||||
|
||||
for add, c := range s.Build.AdditionalContexts {
|
||||
if target, ok := strings.CutPrefix(c, types.ServicePrefix); ok {
|
||||
t, err := project.GetService(target)
|
||||
if err != nil {
|
||||
return fmt.Errorf("service %q declares unknown service %q as additional contexts %s", name, target, add)
|
||||
}
|
||||
if t.Build == nil {
|
||||
return fmt.Errorf("service %q declares non-buildable service %q as additional contexts %s", name, target, add)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(s.Build.Platforms) > 0 && s.Platform != "" {
|
||||
var found bool
|
||||
for _, platform := range s.Build.Platforms {
|
||||
|
Reference in New Issue
Block a user