bump compose-go to v2.6.3

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
(cherry picked from commit 51b8646c44)
This commit is contained in:
Guillaume Lours 2025-05-19 14:49:51 +02:00 committed by CrazyMax
parent cce8cb7227
commit 642a2dc7de
No known key found for this signature in database
GPG Key ID: ADE44D8C9D44FBE4
9 changed files with 57 additions and 11 deletions

2
go.mod
View File

@ -6,7 +6,7 @@ require (
github.com/Masterminds/semver/v3 v3.2.1
github.com/Microsoft/go-winio v0.6.2
github.com/aws/aws-sdk-go-v2/config v1.27.27
github.com/compose-spec/compose-go/v2 v2.6.2
github.com/compose-spec/compose-go/v2 v2.6.3
github.com/containerd/console v1.0.4
github.com/containerd/containerd/v2 v2.0.5
github.com/containerd/continuity v0.4.5

4
go.sum
View File

@ -64,8 +64,8 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL
github.com/cloudflare/cfssl v0.0.0-20180223231731-4e2dcbde5004/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA=
github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb h1:EDmT6Q9Zs+SbUoc7Ik9EfrFqcylYqgPZ9ANSbTAntnE=
github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb/go.mod h1:ZjrT6AXHbDs86ZSdt/osfBi5qfexBrKUdONk989Wnk4=
github.com/compose-spec/compose-go/v2 v2.6.2 h1:31uZNNLeRrKjtUCc56CzPpPykW1Tm6SxLn4gx9Jjzqw=
github.com/compose-spec/compose-go/v2 v2.6.2/go.mod h1:vPlkN0i+0LjLf9rv52lodNMUTJF5YHVfHVGLLIP67NA=
github.com/compose-spec/compose-go/v2 v2.6.3 h1:zfW1Qp605ESySyth/zR+6yLr55XE0AiOAUlZLHKMoW0=
github.com/compose-spec/compose-go/v2 v2.6.3/go.mod h1:vPlkN0i+0LjLf9rv52lodNMUTJF5YHVfHVGLLIP67NA=
github.com/containerd/cgroups/v3 v3.0.5 h1:44na7Ud+VwyE7LIoJ8JTNQOa549a8543BmzaJHo6Bzo=
github.com/containerd/cgroups/v3 v3.0.5/go.mod h1:SA5DLYnXO8pTGYiAHXz94qvLQTKfVM5GEVisn4jpins=
github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro=

View File

@ -176,7 +176,7 @@
END OF TERMS AND CONDITIONS
Copyright 2013-2017 Docker, Inc.
Copyright 2020 The Compose Specification Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@ -401,7 +401,17 @@
"type": "object",
"description": "Provider-specific options.",
"patternProperties": {
"^.+$": {"type": ["string", "number", "null"]}
"^.+$": {"oneOf": [
{ "type": ["string", "number", "boolean"] },
{ "type": "array", "items": {"type": ["string", "number", "boolean"]}}
]}
}
},
"configs": {
"type": "object",
"description": "Config files to pass to the provider.",
"patternProperties": {
"^.+$": {"type": ["string"]}
}
}
},

View File

@ -1229,8 +1229,8 @@ func deriveDeepCopy_12(dst, src []DeviceMapping) {
func deriveDeepCopy_13(dst, src *ServiceProviderConfig) {
dst.Type = src.Type
if src.Options != nil {
dst.Options = make(map[string]string, len(src.Options))
deriveDeepCopy_4(dst.Options, src.Options)
dst.Options = make(map[string][]string, len(src.Options))
deriveDeepCopy_15(dst.Options, src.Options)
} else {
dst.Options = nil
}

View File

@ -40,3 +40,27 @@ func (d *Options) DecodeMapstructure(value interface{}) error {
}
return nil
}
// MultiOptions allow option to be repeated
type MultiOptions map[string][]string
func (d *MultiOptions) DecodeMapstructure(value interface{}) error {
switch v := value.(type) {
case map[string]interface{}:
m := make(map[string][]string)
for key, e := range v {
switch e := e.(type) {
case []interface{}:
for _, v := range e {
m[key] = append(m[key], fmt.Sprint(v))
}
default:
m[key] = append(m[key], fmt.Sprint(e))
}
}
*d = m
default:
return fmt.Errorf("invalid type %T for options", value)
}
return nil
}

View File

@ -143,9 +143,9 @@ type ServiceConfig struct {
}
type ServiceProviderConfig struct {
Type string `yaml:"type,omitempty" json:"driver,omitempty"`
Options Options `yaml:"options,omitempty" json:"options,omitempty"`
Extensions Extensions `yaml:"#extensions,inline,omitempty" json:"-"`
Type string `yaml:"type,omitempty" json:"driver,omitempty"`
Options MultiOptions `yaml:"options,omitempty" json:"options,omitempty"`
Extensions Extensions `yaml:"#extensions,inline,omitempty" json:"-"`
}
// MarshalYAML makes ServiceConfig implement yaml.Marshaller

View File

@ -18,6 +18,7 @@ package validation
import (
"fmt"
"net"
"strings"
"github.com/compose-spec/compose-go/v2/tree"
@ -29,6 +30,7 @@ var checks = map[tree.Path]checkerFunc{
"volumes.*": checkVolume,
"configs.*": checkFileObject("file", "environment", "content"),
"secrets.*": checkFileObject("file", "environment"),
"services.*.ports.*": checkIPAddress,
"services.*.develop.watch.*.path": checkPath,
"services.*.deploy.resources.reservations.devices.*": checkDeviceRequest,
"services.*.gpus.*": checkDeviceRequest,
@ -105,3 +107,13 @@ func checkDeviceRequest(value any, p tree.Path) error {
}
return nil
}
func checkIPAddress(value any, p tree.Path) error {
if v, ok := value.(map[string]any); ok {
ip, ok := v["host_ip"]
if ok && net.ParseIP(ip.(string)) == nil {
return fmt.Errorf("%s: invalid ip address: %s", p, ip)
}
}
return nil
}

2
vendor/modules.txt vendored
View File

@ -122,7 +122,7 @@ github.com/aws/smithy-go/transport/http/internal/io
# github.com/cenkalti/backoff/v4 v4.3.0
## explicit; go 1.18
github.com/cenkalti/backoff/v4
# github.com/compose-spec/compose-go/v2 v2.6.2
# github.com/compose-spec/compose-go/v2 v2.6.3
## explicit; go 1.23
github.com/compose-spec/compose-go/v2/cli
github.com/compose-spec/compose-go/v2/consts