Skip to content

Commit 06eab8d

Browse files
authored
Merge pull request #2539 from keboola/mvasko/PSGO-198-push-validation-warnings
fix(push): downgrade JSON schema validation errors to warnings
2 parents 2202d0e + 1308d3a commit 06eab8d

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

pkg/lib/operation/project/sync/pull/operation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func Run(ctx context.Context, projectState *project.State, o Options, d dependen
143143
logger.Warn(ctx, "")
144144
logger.Warn(ctx, `The project has been pulled, but it is not in a valid state.`)
145145
logger.Warn(ctx, `Please correct the problems listed above.`)
146-
logger.Warn(ctx, `Push operation is only possible when project is valid.`)
146+
logger.Warn(ctx, `Push will proceed with warnings for configs already accepted by the server.`)
147147
}
148148

149149
// Log untracked paths

pkg/lib/operation/project/sync/push/operation.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/keboola/keboola-as-code/internal/pkg/project"
1313
"github.com/keboola/keboola-as-code/internal/pkg/project/ignore"
1414
"github.com/keboola/keboola-as-code/internal/pkg/telemetry"
15+
"github.com/keboola/keboola-as-code/internal/pkg/utils/errors"
1516
"github.com/keboola/keboola-as-code/pkg/lib/operation/project/local/encrypt"
1617
"github.com/keboola/keboola-as-code/pkg/lib/operation/project/local/validate"
1718
createDiff "github.com/keboola/keboola-as-code/pkg/lib/operation/project/sync/diff/create"
@@ -60,7 +61,10 @@ func Run(ctx context.Context, projectState *project.State, o Options, d dependen
6061
ValidateJSONSchema: true,
6162
}
6263
if err := validate.Run(ctx, projectState, validateOptions, d); err != nil {
63-
return err
64+
logger.Warn(ctx, errors.Format(errors.PrefixError(err, "warning"), errors.FormatAsSentences()))
65+
logger.Warn(ctx, "")
66+
logger.Warn(ctx, "Validation warnings found, proceeding with push.")
67+
logger.Warn(ctx, "The configs already exist on the server; the server is the source of truth.")
6468
}
6569
}
6670

test/cli/pull/invalid-remote-state/expected-stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ Warning:
55

66
The project has been pulled, but it is not in a valid state.
77
Please correct the problems listed above.
8-
Push operation is only possible when project is valid.
8+
Push will proceed with warnings for configs already accepted by the server.

0 commit comments

Comments
 (0)