Skip to content

Commit 16d4af4

Browse files
authored
Skip config validation in dry-run (#840)
1 parent 887dfa7 commit 16d4af4

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/pkg/cli/composeUp.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,21 @@ func ComposeUp(ctx context.Context, provider client.Provider, upload compose.Upl
3030
upload = compose.UploadModeIgnore
3131
}
3232

33-
listConfigNamesFunc := func(ctx context.Context) ([]string, error) {
34-
configs, err := provider.ListConfig(ctx)
35-
if err != nil {
36-
return nil, err
33+
// Validate the project configuration against the provider's configuration, but only if we are going to deploy.
34+
// FIXME: should not need to validate configs if we are doing preview, but preview will fail on missing configs.
35+
if upload != compose.UploadModeIgnore {
36+
listConfigNamesFunc := func(ctx context.Context) ([]string, error) {
37+
configs, err := provider.ListConfig(ctx)
38+
if err != nil {
39+
return nil, err
40+
}
41+
42+
return configs.Names, nil
3743
}
3844

39-
return configs.Names, nil
40-
}
41-
42-
if err := compose.ValidateProjectConfig(ctx, project, listConfigNamesFunc); err != nil {
43-
return nil, project, &ComposeError{err}
45+
if err := compose.ValidateProjectConfig(ctx, project, listConfigNamesFunc); err != nil {
46+
return nil, project, &ComposeError{err}
47+
}
4448
}
4549

4650
if err := compose.ValidateProject(project); err != nil {

0 commit comments

Comments
 (0)