mirror of https://github.com/docker/buildx.git
update github.com/compose-spec/compose-go to v1.4.0
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
f360088ae7
commit
e3c0e34b33
2
go.mod
2
go.mod
|
@ -3,7 +3,7 @@ module github.com/docker/buildx
|
|||
go 1.17
|
||||
|
||||
require (
|
||||
github.com/compose-spec/compose-go v1.3.0
|
||||
github.com/compose-spec/compose-go v1.4.0
|
||||
github.com/containerd/console v1.0.3
|
||||
github.com/containerd/containerd v1.6.6
|
||||
github.com/docker/cli v20.10.17+incompatible // v22.06.x - see "replace" for the actual version
|
||||
|
|
4
go.sum
4
go.sum
|
@ -121,8 +121,8 @@ github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWH
|
|||
github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||
github.com/compose-spec/compose-go v1.3.0 h1:n5fSOUXQsfnCpn/lZBgNM3qEu1PDhvcbWrWXVBlUNmA=
|
||||
github.com/compose-spec/compose-go v1.3.0/go.mod h1:l7RUULbFFLzlQHuxtJr7SVLyWdqEpbJEGTWCgcu6Eqw=
|
||||
github.com/compose-spec/compose-go v1.4.0 h1:zaYVAZ6lIByr7Jffi20AabfeUwcTrdXfH3X1R5HEm+g=
|
||||
github.com/compose-spec/compose-go v1.4.0/go.mod h1:l7RUULbFFLzlQHuxtJr7SVLyWdqEpbJEGTWCgcu6Eqw=
|
||||
github.com/containerd/cgroups v1.0.3 h1:ADZftAkglvCiD44c77s5YmMqaP2pzVCFZvBmAlBdAP4=
|
||||
github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw=
|
||||
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
|
||||
|
|
|
@ -43,11 +43,6 @@ import (
|
|||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
const (
|
||||
DefaultSeparator = "-"
|
||||
CompatibilitySeparator = "_"
|
||||
)
|
||||
|
||||
// Options supported by Load
|
||||
type Options struct {
|
||||
// Skip schema validation
|
||||
|
@ -72,8 +67,6 @@ type Options struct {
|
|||
projectName string
|
||||
// Indicates when the projectName was imperatively set or guessed from path
|
||||
projectNameImperativelySet bool
|
||||
// Set separator used for naming resources
|
||||
Separator string
|
||||
}
|
||||
|
||||
func (o *Options) SetProjectName(name string, imperativelySet bool) {
|
||||
|
@ -162,7 +155,6 @@ func Load(configDetails types.ConfigDetails, options ...func(*Options)) (*types.
|
|||
LookupValue: configDetails.LookupEnv,
|
||||
TypeCastMapping: interpolateTypeCastMapping,
|
||||
},
|
||||
Separator: DefaultSeparator,
|
||||
}
|
||||
|
||||
for _, op := range options {
|
||||
|
@ -231,7 +223,7 @@ func Load(configDetails types.ConfigDetails, options ...func(*Options)) (*types.
|
|||
}
|
||||
|
||||
if !opts.SkipNormalization {
|
||||
err = normalize(project, opts.ResolvePaths, opts.Separator)
|
||||
err = normalize(project, opts.ResolvePaths)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import (
|
|||
)
|
||||
|
||||
// normalize compose project by moving deprecated attributes to their canonical position and injecting implicit defaults
|
||||
func normalize(project *types.Project, resolvePaths bool, separator string) error {
|
||||
func normalize(project *types.Project, resolvePaths bool) error {
|
||||
absWorkingDir, err := filepath.Abs(project.WorkingDir)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -110,7 +110,7 @@ func normalize(project *types.Project, resolvePaths bool, separator string) erro
|
|||
project.Services[i] = s
|
||||
}
|
||||
|
||||
setNameFromKey(project, separator)
|
||||
setNameFromKey(project)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -143,31 +143,31 @@ func absComposeFiles(composeFiles []string) ([]string, error) {
|
|||
}
|
||||
|
||||
// Resources with no explicit name are actually named by their key in map
|
||||
func setNameFromKey(project *types.Project, separator string) {
|
||||
func setNameFromKey(project *types.Project) {
|
||||
for i, n := range project.Networks {
|
||||
if n.Name == "" {
|
||||
n.Name = fmt.Sprintf("%s%s%s", project.Name, separator, i)
|
||||
n.Name = fmt.Sprintf("%s_%s", project.Name, i)
|
||||
project.Networks[i] = n
|
||||
}
|
||||
}
|
||||
|
||||
for i, v := range project.Volumes {
|
||||
if v.Name == "" {
|
||||
v.Name = fmt.Sprintf("%s%s%s", project.Name, separator, i)
|
||||
v.Name = fmt.Sprintf("%s_%s", project.Name, i)
|
||||
project.Volumes[i] = v
|
||||
}
|
||||
}
|
||||
|
||||
for i, c := range project.Configs {
|
||||
if c.Name == "" {
|
||||
c.Name = fmt.Sprintf("%s%s%s", project.Name, separator, i)
|
||||
c.Name = fmt.Sprintf("%s_%s", project.Name, i)
|
||||
project.Configs[i] = c
|
||||
}
|
||||
}
|
||||
|
||||
for i, s := range project.Secrets {
|
||||
if s.Name == "" {
|
||||
s.Name = fmt.Sprintf("%s%s%s", project.Name, separator, i)
|
||||
s.Name = fmt.Sprintf("%s_%s", project.Name, i)
|
||||
project.Secrets[i] = s
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,13 +61,14 @@ type SubstituteFunc func(string, Mapping) (string, bool, error)
|
|||
// SubstituteWith substitute variables in the string with their values.
|
||||
// It accepts additional substitute function.
|
||||
func SubstituteWith(template string, mapping Mapping, pattern *regexp.Regexp, subsFuncs ...SubstituteFunc) (string, error) {
|
||||
var err error
|
||||
var outerErr error
|
||||
|
||||
if len(subsFuncs) == 0 {
|
||||
_, subsFunc := getSubstitutionFunctionForTemplate(template)
|
||||
subsFuncs = []SubstituteFunc{subsFunc}
|
||||
}
|
||||
result := pattern.ReplaceAllStringFunc(template, func(substring string) string {
|
||||
_, subsFunc := getSubstitutionFunctionForTemplate(substring)
|
||||
if len(subsFuncs) > 0 {
|
||||
subsFunc = subsFuncs[0]
|
||||
}
|
||||
|
||||
closingBraceIndex := getFirstBraceClosingIndex(substring)
|
||||
rest := ""
|
||||
if closingBraceIndex > -1 {
|
||||
|
@ -89,24 +90,21 @@ func SubstituteWith(template string, mapping Mapping, pattern *regexp.Regexp, su
|
|||
}
|
||||
|
||||
if substitution == "" {
|
||||
err = &InvalidTemplateError{Template: template}
|
||||
outerErr = &InvalidTemplateError{Template: template}
|
||||
return ""
|
||||
}
|
||||
|
||||
if braced {
|
||||
for _, f := range subsFuncs {
|
||||
var (
|
||||
value string
|
||||
applied bool
|
||||
)
|
||||
value, applied, err = f(substitution, mapping)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
if !applied {
|
||||
continue
|
||||
}
|
||||
interpolatedNested, err := SubstituteWith(rest, mapping, pattern, subsFuncs...)
|
||||
var (
|
||||
value string
|
||||
applied bool
|
||||
)
|
||||
value, applied, outerErr = subsFunc(substitution, mapping)
|
||||
if outerErr != nil {
|
||||
return ""
|
||||
}
|
||||
if applied {
|
||||
interpolatedNested, err := SubstituteWith(rest, mapping, pattern)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
@ -121,7 +119,7 @@ func SubstituteWith(template string, mapping Mapping, pattern *regexp.Regexp, su
|
|||
return value
|
||||
})
|
||||
|
||||
return result, err
|
||||
return result, outerErr
|
||||
}
|
||||
|
||||
func getSubstitutionFunctionForTemplate(template string) (string, SubstituteFunc) {
|
||||
|
|
|
@ -61,7 +61,7 @@ github.com/cenkalti/backoff/v4
|
|||
github.com/cespare/xxhash/v2
|
||||
# github.com/cloudflare/cfssl v0.0.0-20181213083726-b94e044bb51e
|
||||
## explicit
|
||||
# github.com/compose-spec/compose-go v1.3.0
|
||||
# github.com/compose-spec/compose-go v1.4.0
|
||||
## explicit; go 1.17
|
||||
github.com/compose-spec/compose-go/consts
|
||||
github.com/compose-spec/compose-go/dotenv
|
||||
|
|
Loading…
Reference in New Issue