fix: ensure validation takes place
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Part of coop-cloud/organising#243 (comment).
This commit is contained in:
parent
ef6a9abba9
commit
fdf4fc6737
|
@ -13,6 +13,11 @@ import (
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// DontSkipValidation ensures validation is done for compose file loading
|
||||||
|
func DontSkipValidation(opts *loader.Options) {
|
||||||
|
opts.SkipValidation = false
|
||||||
|
}
|
||||||
|
|
||||||
// LoadComposefile parse the composefile specified in the cli and returns its Config and version.
|
// LoadComposefile parse the composefile specified in the cli and returns its Config and version.
|
||||||
func LoadComposefile(opts Deploy, appEnv map[string]string) (*composetypes.Config, error) {
|
func LoadComposefile(opts Deploy, appEnv map[string]string) (*composetypes.Config, error) {
|
||||||
configDetails, err := getConfigDetails(opts.Composefiles, appEnv)
|
configDetails, err := getConfigDetails(opts.Composefiles, appEnv)
|
||||||
|
@ -21,13 +26,12 @@ func LoadComposefile(opts Deploy, appEnv map[string]string) (*composetypes.Confi
|
||||||
}
|
}
|
||||||
|
|
||||||
dicts := getDictsFrom(configDetails.ConfigFiles)
|
dicts := getDictsFrom(configDetails.ConfigFiles)
|
||||||
config, err := loader.Load(configDetails)
|
config, err := loader.Load(configDetails, DontSkipValidation)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if fpe, ok := err.(*loader.ForbiddenPropertiesError); ok {
|
if fpe, ok := err.(*loader.ForbiddenPropertiesError); ok {
|
||||||
return nil, fmt.Errorf("compose file contains unsupported options:\n\n%s",
|
return nil, fmt.Errorf("compose file contains unsupported options:\n\n%s",
|
||||||
propertyWarnings(fpe.Properties))
|
propertyWarnings(fpe.Properties))
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue