mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-12 14:37:08 +08:00
bumpo compose-go to v2.1.0
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
This commit is contained in:
23
vendor/github.com/compose-spec/compose-go/v2/loader/include.go
generated
vendored
23
vendor/github.com/compose-spec/compose-go/v2/loader/include.go
generated
vendored
@ -29,12 +29,15 @@ import (
|
||||
"github.com/compose-spec/compose-go/v2/types"
|
||||
)
|
||||
|
||||
// loadIncludeConfig parse the require config from raw yaml
|
||||
// loadIncludeConfig parse the required config from raw yaml
|
||||
func loadIncludeConfig(source any) ([]types.IncludeConfig, error) {
|
||||
if source == nil {
|
||||
return nil, nil
|
||||
}
|
||||
configs := source.([]any)
|
||||
configs, ok := source.([]any)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("`include` must be a list, got %s", source)
|
||||
}
|
||||
for i, config := range configs {
|
||||
if v, ok := config.(string); ok {
|
||||
configs[i] = map[string]any{
|
||||
@ -73,11 +76,19 @@ func ApplyInclude(ctx context.Context, configDetails types.ConfigDetails, model
|
||||
p = path
|
||||
|
||||
if i == 0 { // This is the "main" file, used to define project-directory. Others are overrides
|
||||
relworkingdir = loader.Dir(path)
|
||||
if r.ProjectDirectory == "" {
|
||||
r.ProjectDirectory = filepath.Dir(path)
|
||||
}
|
||||
|
||||
switch {
|
||||
case r.ProjectDirectory == "":
|
||||
relworkingdir = loader.Dir(path)
|
||||
r.ProjectDirectory = filepath.Dir(path)
|
||||
case !filepath.IsAbs(r.ProjectDirectory):
|
||||
relworkingdir = loader.Dir(r.ProjectDirectory)
|
||||
r.ProjectDirectory = filepath.Join(configDetails.WorkingDir, r.ProjectDirectory)
|
||||
|
||||
default:
|
||||
relworkingdir = r.ProjectDirectory
|
||||
|
||||
}
|
||||
for _, f := range included {
|
||||
if f == path {
|
||||
included = append(included, path)
|
||||
|
Reference in New Issue
Block a user