bump compose-go v2.4.6

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof
2024-12-13 16:00:43 +01:00
parent 3e3242cfdd
commit 828c1dbf98
18 changed files with 189 additions and 14 deletions

View File

@ -0,0 +1,10 @@
# passed through
FOO=foo_from_label_file
LABEL.WITH.DOT=ok
LABEL_WITH_UNDERSCORE=ok
# overridden in example2.label
BAR=bar_from_label_file
# overridden in full-example.yml
BAZ=baz_from_label_file

View File

@ -0,0 +1,4 @@
BAR=bar_from_label_file_2
# overridden in configDetails.Labels
QUX=quz_from_label_file_2

View File

@ -27,6 +27,10 @@ import (
"github.com/compose-spec/compose-go/v2/types"
)
// as we use another service definition by `extends`, we must exclude attributes which creates dependency to another service
// see https://github.com/compose-spec/compose-spec/blob/main/05-services.md#restrictions
var exclusions = []string{"extends", "depends_on", "volumes_from"}
func ApplyExtends(ctx context.Context, dict map[string]any, opts *Options, tracker *cycleTracker, post ...PostProcessor) error {
a, ok := dict["services"]
if !ok {
@ -123,7 +127,9 @@ func applyServiceExtends(ctx context.Context, name string, services map[string]a
if err != nil {
return nil, err
}
delete(merged, "extends")
for _, exclusion := range exclusions {
delete(merged, exclusion)
}
services[name] = merged
return merged, nil
}

View File

@ -210,6 +210,10 @@ services:
# - "com.example.number=42"
# - "com.example.empty-label"
label_file:
- ./example1.label
- ./example2.label
links:
- db
- db:database

View File

@ -637,6 +637,12 @@ func modelToProject(dict map[string]interface{}, opts *Options, configDetails ty
return nil, err
}
}
project, err = project.WithServicesLabelsResolved(opts.discardEnvFiles)
if err != nil {
return nil, err
}
return project, nil
}

View File

@ -155,7 +155,7 @@ func checkConsistency(project *types.Project) error {
if s.Develop != nil && s.Develop.Watch != nil {
for _, watch := range s.Develop.Watch {
if watch.Action != types.WatchActionRebuild && watch.Target == "" {
if watch.Target == "" && watch.Action != types.WatchActionRebuild && watch.Action != types.WatchActionRestart {
return fmt.Errorf("services.%s.develop.watch: target is required for non-rebuild actions: %w", s.Name, errdefs.ErrInvalid)
}
}