bump compose-go to v2.6.3

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
This commit is contained in:
Guillaume Lours
2025-05-19 14:49:51 +02:00
parent 57a1c97c9d
commit 51b8646c44
9 changed files with 57 additions and 11 deletions
+1 -1
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.
+11 -1
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"]}
}
}
},
+2 -2
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
}
+24
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
}
+3 -3
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
+12
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
}
+1 -1
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