mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-18 17:27:49 +08:00
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
|
go 1.17
|
||||||
|
|
||||||
require (
|
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/console v1.0.3
|
||||||
github.com/containerd/containerd v1.6.6
|
github.com/containerd/containerd v1.6.6
|
||||||
github.com/docker/cli v20.10.17+incompatible // v22.06.x - see "replace" for the actual version
|
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-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-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||||
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/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.4.0 h1:zaYVAZ6lIByr7Jffi20AabfeUwcTrdXfH3X1R5HEm+g=
|
||||||
github.com/compose-spec/compose-go v1.3.0/go.mod h1:l7RUULbFFLzlQHuxtJr7SVLyWdqEpbJEGTWCgcu6Eqw=
|
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/cgroups v1.0.3 h1:ADZftAkglvCiD44c77s5YmMqaP2pzVCFZvBmAlBdAP4=
|
||||||
github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw=
|
github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw=
|
||||||
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
|
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
|
||||||
|
10
vendor/github.com/compose-spec/compose-go/loader/loader.go
generated
vendored
10
vendor/github.com/compose-spec/compose-go/loader/loader.go
generated
vendored
@ -43,11 +43,6 @@ import (
|
|||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
DefaultSeparator = "-"
|
|
||||||
CompatibilitySeparator = "_"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Options supported by Load
|
// Options supported by Load
|
||||||
type Options struct {
|
type Options struct {
|
||||||
// Skip schema validation
|
// Skip schema validation
|
||||||
@ -72,8 +67,6 @@ type Options struct {
|
|||||||
projectName string
|
projectName string
|
||||||
// Indicates when the projectName was imperatively set or guessed from path
|
// Indicates when the projectName was imperatively set or guessed from path
|
||||||
projectNameImperativelySet bool
|
projectNameImperativelySet bool
|
||||||
// Set separator used for naming resources
|
|
||||||
Separator string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *Options) SetProjectName(name string, imperativelySet bool) {
|
func (o *Options) SetProjectName(name string, imperativelySet bool) {
|
||||||
@ -162,7 +155,6 @@ func Load(configDetails types.ConfigDetails, options ...func(*Options)) (*types.
|
|||||||
LookupValue: configDetails.LookupEnv,
|
LookupValue: configDetails.LookupEnv,
|
||||||
TypeCastMapping: interpolateTypeCastMapping,
|
TypeCastMapping: interpolateTypeCastMapping,
|
||||||
},
|
},
|
||||||
Separator: DefaultSeparator,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, op := range options {
|
for _, op := range options {
|
||||||
@ -231,7 +223,7 @@ func Load(configDetails types.ConfigDetails, options ...func(*Options)) (*types.
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !opts.SkipNormalization {
|
if !opts.SkipNormalization {
|
||||||
err = normalize(project, opts.ResolvePaths, opts.Separator)
|
err = normalize(project, opts.ResolvePaths)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
14
vendor/github.com/compose-spec/compose-go/loader/normalize.go
generated
vendored
14
vendor/github.com/compose-spec/compose-go/loader/normalize.go
generated
vendored
@ -28,7 +28,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// normalize compose project by moving deprecated attributes to their canonical position and injecting implicit defaults
|
// 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)
|
absWorkingDir, err := filepath.Abs(project.WorkingDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -110,7 +110,7 @@ func normalize(project *types.Project, resolvePaths bool, separator string) erro
|
|||||||
project.Services[i] = s
|
project.Services[i] = s
|
||||||
}
|
}
|
||||||
|
|
||||||
setNameFromKey(project, separator)
|
setNameFromKey(project)
|
||||||
|
|
||||||
return nil
|
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
|
// 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 {
|
for i, n := range project.Networks {
|
||||||
if n.Name == "" {
|
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
|
project.Networks[i] = n
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, v := range project.Volumes {
|
for i, v := range project.Volumes {
|
||||||
if v.Name == "" {
|
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
|
project.Volumes[i] = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, c := range project.Configs {
|
for i, c := range project.Configs {
|
||||||
if c.Name == "" {
|
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
|
project.Configs[i] = c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, s := range project.Secrets {
|
for i, s := range project.Secrets {
|
||||||
if s.Name == "" {
|
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
|
project.Secrets[i] = s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
38
vendor/github.com/compose-spec/compose-go/template/template.go
generated
vendored
38
vendor/github.com/compose-spec/compose-go/template/template.go
generated
vendored
@ -61,13 +61,14 @@ type SubstituteFunc func(string, Mapping) (string, bool, error)
|
|||||||
// SubstituteWith substitute variables in the string with their values.
|
// SubstituteWith substitute variables in the string with their values.
|
||||||
// It accepts additional substitute function.
|
// It accepts additional substitute function.
|
||||||
func SubstituteWith(template string, mapping Mapping, pattern *regexp.Regexp, subsFuncs ...SubstituteFunc) (string, error) {
|
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 {
|
result := pattern.ReplaceAllStringFunc(template, func(substring string) string {
|
||||||
|
_, subsFunc := getSubstitutionFunctionForTemplate(substring)
|
||||||
|
if len(subsFuncs) > 0 {
|
||||||
|
subsFunc = subsFuncs[0]
|
||||||
|
}
|
||||||
|
|
||||||
closingBraceIndex := getFirstBraceClosingIndex(substring)
|
closingBraceIndex := getFirstBraceClosingIndex(substring)
|
||||||
rest := ""
|
rest := ""
|
||||||
if closingBraceIndex > -1 {
|
if closingBraceIndex > -1 {
|
||||||
@ -89,24 +90,21 @@ func SubstituteWith(template string, mapping Mapping, pattern *regexp.Regexp, su
|
|||||||
}
|
}
|
||||||
|
|
||||||
if substitution == "" {
|
if substitution == "" {
|
||||||
err = &InvalidTemplateError{Template: template}
|
outerErr = &InvalidTemplateError{Template: template}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
if braced {
|
if braced {
|
||||||
for _, f := range subsFuncs {
|
var (
|
||||||
var (
|
value string
|
||||||
value string
|
applied bool
|
||||||
applied bool
|
)
|
||||||
)
|
value, applied, outerErr = subsFunc(substitution, mapping)
|
||||||
value, applied, err = f(substitution, mapping)
|
if outerErr != nil {
|
||||||
if err != nil {
|
return ""
|
||||||
return ""
|
}
|
||||||
}
|
if applied {
|
||||||
if !applied {
|
interpolatedNested, err := SubstituteWith(rest, mapping, pattern)
|
||||||
continue
|
|
||||||
}
|
|
||||||
interpolatedNested, err := SubstituteWith(rest, mapping, pattern, subsFuncs...)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@ -121,7 +119,7 @@ func SubstituteWith(template string, mapping Mapping, pattern *regexp.Regexp, su
|
|||||||
return value
|
return value
|
||||||
})
|
})
|
||||||
|
|
||||||
return result, err
|
return result, outerErr
|
||||||
}
|
}
|
||||||
|
|
||||||
func getSubstitutionFunctionForTemplate(template string) (string, SubstituteFunc) {
|
func getSubstitutionFunctionForTemplate(template string) (string, SubstituteFunc) {
|
||||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -61,7 +61,7 @@ github.com/cenkalti/backoff/v4
|
|||||||
github.com/cespare/xxhash/v2
|
github.com/cespare/xxhash/v2
|
||||||
# github.com/cloudflare/cfssl v0.0.0-20181213083726-b94e044bb51e
|
# github.com/cloudflare/cfssl v0.0.0-20181213083726-b94e044bb51e
|
||||||
## explicit
|
## explicit
|
||||||
# github.com/compose-spec/compose-go v1.3.0
|
# github.com/compose-spec/compose-go v1.4.0
|
||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
github.com/compose-spec/compose-go/consts
|
github.com/compose-spec/compose-go/consts
|
||||||
github.com/compose-spec/compose-go/dotenv
|
github.com/compose-spec/compose-go/dotenv
|
||||||
|
Loading…
x
Reference in New Issue
Block a user