mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-01 00:23:56 +08:00 
			
		
		
		
	vendor: update compose-go to v1.19.0
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
		
							
								
								
									
										8
									
								
								vendor/github.com/compose-spec/compose-go/cli/options.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/github.com/compose-spec/compose-go/cli/options.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -328,6 +328,14 @@ func WithResourceLoader(r loader.ResourceLoader) ProjectOptionsFn { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // WithoutEnvironmentResolution disable environment resolution | ||||
| func WithoutEnvironmentResolution(o *ProjectOptions) error { | ||||
| 	o.loadOptions = append(o.loadOptions, func(options *loader.Options) { | ||||
| 		options.SkipResolveEnvironment = true | ||||
| 	}) | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // DefaultFileNames defines the Compose file names for auto-discovery (in order of preference) | ||||
| var DefaultFileNames = []string{"compose.yaml", "compose.yml", "docker-compose.yml", "docker-compose.yaml"} | ||||
|  | ||||
|   | ||||
							
								
								
									
										33
									
								
								vendor/github.com/compose-spec/compose-go/loader/loader.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										33
									
								
								vendor/github.com/compose-spec/compose-go/loader/loader.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -61,6 +61,8 @@ type Options struct { | ||||
| 	SkipExtends bool | ||||
| 	// SkipInclude will ignore `include` and only load model from file(s) set by ConfigDetails | ||||
| 	SkipInclude bool | ||||
| 	// SkipResolveEnvironment will ignore computing `environment` for services | ||||
| 	SkipResolveEnvironment bool | ||||
| 	// Interpolation options | ||||
| 	Interpolate *interp.Options | ||||
| 	// Discard 'env_file' entries after resolving to 'environment' section | ||||
| @@ -255,7 +257,6 @@ func load(ctx context.Context, configDetails types.ConfigDetails, opts *Options, | ||||
| 	loaded = append(loaded, mainFile) | ||||
|  | ||||
| 	includeRefs := make(map[string][]types.IncludeConfig) | ||||
| 	first := true | ||||
| 	for _, file := range configDetails.ConfigFiles { | ||||
| 		var postProcessor PostProcessor | ||||
| 		configDict := file.Config | ||||
| @@ -285,22 +286,21 @@ func load(ctx context.Context, configDetails types.ConfigDetails, opts *Options, | ||||
| 				} | ||||
| 			} | ||||
|  | ||||
| 			if first { | ||||
| 				first = false | ||||
| 			if model == nil { | ||||
| 				model = cfg | ||||
| 				return nil | ||||
| 			} | ||||
| 			merged, err := merge([]*types.Config{model, cfg}) | ||||
| 			if err != nil { | ||||
| 				return err | ||||
| 			} else { | ||||
| 				merged, err := merge([]*types.Config{model, cfg}) | ||||
| 				if err != nil { | ||||
| 					return err | ||||
| 				} | ||||
| 				model = merged | ||||
| 			} | ||||
| 			if postProcessor != nil { | ||||
| 				err = postProcessor.Apply(merged) | ||||
| 				err = postProcessor.Apply(model) | ||||
| 				if err != nil { | ||||
| 					return err | ||||
| 				} | ||||
| 			} | ||||
| 			model = merged | ||||
| 			return nil | ||||
| 		} | ||||
|  | ||||
| @@ -337,6 +337,10 @@ func load(ctx context.Context, configDetails types.ConfigDetails, opts *Options, | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if model == nil { | ||||
| 		return nil, errors.New("empty compose file") | ||||
| 	} | ||||
|  | ||||
| 	project := &types.Project{ | ||||
| 		Name:        opts.projectName, | ||||
| 		WorkingDir:  configDetails.WorkingDir, | ||||
| @@ -385,9 +389,14 @@ func load(ctx context.Context, configDetails types.ConfigDetails, opts *Options, | ||||
|  | ||||
| 	project.ApplyProfiles(opts.Profiles) | ||||
|  | ||||
| 	err := project.ResolveServicesEnvironment(opts.discardEnvFiles) | ||||
| 	if !opts.SkipResolveEnvironment { | ||||
| 		err := project.ResolveServicesEnvironment(opts.discardEnvFiles) | ||||
| 		if err != nil { | ||||
| 			return nil, err | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	return project, err | ||||
| 	return project, nil | ||||
| } | ||||
|  | ||||
| func InvalidProjectNameErr(v string) error { | ||||
|   | ||||
							
								
								
									
										7
									
								
								vendor/github.com/compose-spec/compose-go/loader/paths.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								vendor/github.com/compose-spec/compose-go/loader/paths.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -115,6 +115,13 @@ func ResolveServiceRelativePaths(workingDir string, s *types.ServiceConfig) { | ||||
| 		} | ||||
| 		s.Volumes[i].Source = resolveMaybeUnixPath(workingDir, vol.Source) | ||||
| 	} | ||||
|  | ||||
| 	if s.Develop != nil { | ||||
| 		for i, w := range s.Develop.Watch { | ||||
| 			w.Path = absPath(workingDir, w.Path) | ||||
| 			s.Develop.Watch[i] = w | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func absPath(workingDir string, filePath string) string { | ||||
|   | ||||
							
								
								
									
										21
									
								
								vendor/github.com/compose-spec/compose-go/schema/compose-spec.json
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										21
									
								
								vendor/github.com/compose-spec/compose-go/schema/compose-spec.json
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -91,6 +91,7 @@ | ||||
|       "type": "object", | ||||
|  | ||||
|       "properties": { | ||||
|         "develop": {"$ref": "#/definitions/development"}, | ||||
|         "deploy": {"$ref": "#/definitions/deployment"}, | ||||
|         "annotations": {"$ref": "#/definitions/list_or_dict"}, | ||||
|         "attach": {"type": "boolean"}, | ||||
| @@ -463,6 +464,26 @@ | ||||
|       "additionalProperties": false, | ||||
|       "patternProperties": {"^x-": {}} | ||||
|     }, | ||||
|     "development": { | ||||
|       "id": "#/definitions/development", | ||||
|       "type": ["object", "null"], | ||||
|       "properties": { | ||||
|         "watch": { | ||||
|           "type": "array", | ||||
|           "items": { | ||||
|             "type": "object", | ||||
|             "properties": { | ||||
|               "ignore": {"type": "array", "items": {"type": "string"}}, | ||||
|               "path": {"type": "string"}, | ||||
|               "action": {"type": "string", "enum": ["rebuild", "sync"]}, | ||||
|               "target": {"type": "string"} | ||||
|             } | ||||
|           }, | ||||
|           "additionalProperties": false, | ||||
|           "patternProperties": {"^x-": {}} | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "deployment": { | ||||
|       "id": "#/definitions/deployment", | ||||
|       "type": ["object", "null"], | ||||
|   | ||||
							
								
								
									
										26
									
								
								vendor/github.com/compose-spec/compose-go/template/template.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										26
									
								
								vendor/github.com/compose-spec/compose-go/template/template.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -28,12 +28,20 @@ import ( | ||||
|  | ||||
| var delimiter = "\\$" | ||||
| var substitutionNamed = "[_a-z][_a-z0-9]*" | ||||
|  | ||||
| var substitutionBraced = "[_a-z][_a-z0-9]*(?::?[-+?](.*))?" | ||||
|  | ||||
| var groupEscaped = "escaped" | ||||
| var groupNamed = "named" | ||||
| var groupBraced = "braced" | ||||
| var groupInvalid = "invalid" | ||||
|  | ||||
| var patternString = fmt.Sprintf( | ||||
| 	"%s(?i:(?P<escaped>%s)|(?P<named>%s)|{(?:(?P<braced>%s)}|(?P<invalid>)))", | ||||
| 	delimiter, delimiter, substitutionNamed, substitutionBraced, | ||||
| 	"%s(?i:(?P<%s>%s)|(?P<%s>%s)|{(?:(?P<%s>%s)}|(?P<%s>)))", | ||||
| 	delimiter, | ||||
| 	groupEscaped, delimiter, | ||||
| 	groupNamed, substitutionNamed, | ||||
| 	groupBraced, substitutionBraced, | ||||
| 	groupInvalid, | ||||
| ) | ||||
|  | ||||
| var defaultPattern = regexp.MustCompile(patternString) | ||||
| @@ -164,14 +172,14 @@ func DefaultReplacementAppliedFunc(substring string, mapping Mapping, cfg *Confi | ||||
|  | ||||
| 	matches := pattern.FindStringSubmatch(substring) | ||||
| 	groups := matchGroups(matches, pattern) | ||||
| 	if escaped := groups["escaped"]; escaped != "" { | ||||
| 	if escaped := groups[groupEscaped]; escaped != "" { | ||||
| 		return escaped, true, nil | ||||
| 	} | ||||
|  | ||||
| 	braced := false | ||||
| 	substitution := groups["named"] | ||||
| 	substitution := groups[groupNamed] | ||||
| 	if substitution == "" { | ||||
| 		substitution = groups["braced"] | ||||
| 		substitution = groups[groupBraced] | ||||
| 		braced = true | ||||
| 	} | ||||
|  | ||||
| @@ -322,12 +330,12 @@ func extractVariable(value interface{}, pattern *regexp.Regexp) ([]Variable, boo | ||||
| 	values := []Variable{} | ||||
| 	for _, match := range matches { | ||||
| 		groups := matchGroups(match, pattern) | ||||
| 		if escaped := groups["escaped"]; escaped != "" { | ||||
| 		if escaped := groups[groupEscaped]; escaped != "" { | ||||
| 			continue | ||||
| 		} | ||||
| 		val := groups["named"] | ||||
| 		val := groups[groupNamed] | ||||
| 		if val == "" { | ||||
| 			val = groups["braced"] | ||||
| 			val = groups[groupBraced] | ||||
| 		} | ||||
| 		name := val | ||||
| 		var defaultValue string | ||||
|   | ||||
							
								
								
									
										35
									
								
								vendor/github.com/compose-spec/compose-go/types/develop.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								vendor/github.com/compose-spec/compose-go/types/develop.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | ||||
| /* | ||||
|    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. | ||||
|    You may obtain a copy of the License at | ||||
|  | ||||
|        http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|    Unless required by applicable law or agreed to in writing, software | ||||
|    distributed under the License is distributed on an "AS IS" BASIS, | ||||
|    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|    See the License for the specific language governing permissions and | ||||
|    limitations under the License. | ||||
| */ | ||||
|  | ||||
| package types | ||||
|  | ||||
| type DevelopConfig struct { | ||||
| 	Watch []Trigger `json:"watch,omitempty"` | ||||
| } | ||||
|  | ||||
| type WatchAction string | ||||
|  | ||||
| const ( | ||||
| 	WatchActionSync    WatchAction = "sync" | ||||
| 	WatchActionRebuild WatchAction = "rebuild" | ||||
| ) | ||||
|  | ||||
| type Trigger struct { | ||||
| 	Path   string      `json:"path,omitempty"` | ||||
| 	Action WatchAction `json:"action,omitempty"` | ||||
| 	Target string      `json:"target,omitempty"` | ||||
| 	Ignore []string    `json:"ignore,omitempty"` | ||||
| } | ||||
							
								
								
									
										35
									
								
								vendor/github.com/compose-spec/compose-go/types/types.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										35
									
								
								vendor/github.com/compose-spec/compose-go/types/types.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -88,23 +88,24 @@ type ServiceConfig struct { | ||||
| 	Name     string   `yaml:"-" json:"-"` | ||||
| 	Profiles []string `yaml:"profiles,omitempty" json:"profiles,omitempty"` | ||||
|  | ||||
| 	Annotations  Mapping      `yaml:"annotations,omitempty" json:"annotations,omitempty"` | ||||
| 	Attach       *bool        `yaml:"attach,omitempty" json:"attach,omitempty"` | ||||
| 	Build        *BuildConfig `yaml:"build,omitempty" json:"build,omitempty"` | ||||
| 	BlkioConfig  *BlkioConfig `yaml:"blkio_config,omitempty" json:"blkio_config,omitempty"` | ||||
| 	CapAdd       []string     `yaml:"cap_add,omitempty" json:"cap_add,omitempty"` | ||||
| 	CapDrop      []string     `yaml:"cap_drop,omitempty" json:"cap_drop,omitempty"` | ||||
| 	CgroupParent string       `yaml:"cgroup_parent,omitempty" json:"cgroup_parent,omitempty"` | ||||
| 	Cgroup       string       `yaml:"cgroup,omitempty" json:"cgroup,omitempty"` | ||||
| 	CPUCount     int64        `yaml:"cpu_count,omitempty" json:"cpu_count,omitempty"` | ||||
| 	CPUPercent   float32      `yaml:"cpu_percent,omitempty" json:"cpu_percent,omitempty"` | ||||
| 	CPUPeriod    int64        `yaml:"cpu_period,omitempty" json:"cpu_period,omitempty"` | ||||
| 	CPUQuota     int64        `yaml:"cpu_quota,omitempty" json:"cpu_quota,omitempty"` | ||||
| 	CPURTPeriod  int64        `yaml:"cpu_rt_period,omitempty" json:"cpu_rt_period,omitempty"` | ||||
| 	CPURTRuntime int64        `yaml:"cpu_rt_runtime,omitempty" json:"cpu_rt_runtime,omitempty"` | ||||
| 	CPUS         float32      `yaml:"cpus,omitempty" json:"cpus,omitempty"` | ||||
| 	CPUSet       string       `yaml:"cpuset,omitempty" json:"cpuset,omitempty"` | ||||
| 	CPUShares    int64        `yaml:"cpu_shares,omitempty" json:"cpu_shares,omitempty"` | ||||
| 	Annotations  Mapping        `yaml:"annotations,omitempty" json:"annotations,omitempty"` | ||||
| 	Attach       *bool          `yaml:"attach,omitempty" json:"attach,omitempty"` | ||||
| 	Build        *BuildConfig   `yaml:"build,omitempty" json:"build,omitempty"` | ||||
| 	Develop      *DevelopConfig `yaml:"develop,omitempty" json:"develop,omitempty"` | ||||
| 	BlkioConfig  *BlkioConfig   `yaml:"blkio_config,omitempty" json:"blkio_config,omitempty"` | ||||
| 	CapAdd       []string       `yaml:"cap_add,omitempty" json:"cap_add,omitempty"` | ||||
| 	CapDrop      []string       `yaml:"cap_drop,omitempty" json:"cap_drop,omitempty"` | ||||
| 	CgroupParent string         `yaml:"cgroup_parent,omitempty" json:"cgroup_parent,omitempty"` | ||||
| 	Cgroup       string         `yaml:"cgroup,omitempty" json:"cgroup,omitempty"` | ||||
| 	CPUCount     int64          `yaml:"cpu_count,omitempty" json:"cpu_count,omitempty"` | ||||
| 	CPUPercent   float32        `yaml:"cpu_percent,omitempty" json:"cpu_percent,omitempty"` | ||||
| 	CPUPeriod    int64          `yaml:"cpu_period,omitempty" json:"cpu_period,omitempty"` | ||||
| 	CPUQuota     int64          `yaml:"cpu_quota,omitempty" json:"cpu_quota,omitempty"` | ||||
| 	CPURTPeriod  int64          `yaml:"cpu_rt_period,omitempty" json:"cpu_rt_period,omitempty"` | ||||
| 	CPURTRuntime int64          `yaml:"cpu_rt_runtime,omitempty" json:"cpu_rt_runtime,omitempty"` | ||||
| 	CPUS         float32        `yaml:"cpus,omitempty" json:"cpus,omitempty"` | ||||
| 	CPUSet       string         `yaml:"cpuset,omitempty" json:"cpuset,omitempty"` | ||||
| 	CPUShares    int64          `yaml:"cpu_shares,omitempty" json:"cpu_shares,omitempty"` | ||||
|  | ||||
| 	// Command for the service containers. | ||||
| 	// If set, overrides COMMAND from the image. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 David Karlsson
					David Karlsson