vendor: update compose-go to v2.4.8

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2025-03-11 14:56:19 +01:00
parent b88423be50
commit 67d3ed34e4
13 changed files with 126 additions and 73 deletions

View File

@ -27,10 +27,6 @@ import (
"github.com/compose-spec/compose-go/v2/types"
)
// as we use another service definition by `extends`, we must exclude attributes which creates dependency to another service
// see https://github.com/compose-spec/compose-spec/blob/main/05-services.md#restrictions
var exclusions = []string{"depends_on", "volumes_from"}
func ApplyExtends(ctx context.Context, dict map[string]any, opts *Options, tracker *cycleTracker, post ...PostProcessor) error {
a, ok := dict["services"]
if !ok {
@ -123,9 +119,6 @@ func applyServiceExtends(ctx context.Context, name string, services map[string]a
},
})
}
for _, exclusion := range exclusions {
delete(source, exclusion)
}
merged, err := override.ExtendService(source, service)
if err != nil {
return nil, err

View File

@ -64,6 +64,7 @@ var interpolateTypeCastMapping = map[tree.Path]interp.Cast{
iPath("networks", tree.PathMatchAll, "external"): toBoolean,
iPath("networks", tree.PathMatchAll, "internal"): toBoolean,
iPath("networks", tree.PathMatchAll, "attachable"): toBoolean,
iPath("networks", tree.PathMatchAll, "enable_ipv4"): toBoolean,
iPath("networks", tree.PathMatchAll, "enable_ipv6"): toBoolean,
iPath("volumes", tree.PathMatchAll, "external"): toBoolean,
iPath("secrets", tree.PathMatchAll, "external"): toBoolean,

View File

@ -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 {