Skip to content

Commit 76296af

Browse files
authored
Mark require-provenance flag as depricated server/#3431 (#572)
* Mark require-provenance flag as depricated server/#3431 * Added check of return value of MarkDepricated
1 parent 91feae8 commit 76296af

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

cmd/kosli/createEnvironment.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ The following types are supported:
2424
- server - Generic type
2525
- logical - Logical grouping of real environments
2626
27-
By default, the environment does not require artifacts provenance (i.e. environment snapshots will not
28-
become non-compliant because of artifacts that do not have provenance). You can require provenance for all artifacts
29-
by setting --require-provenance=true
30-
31-
Also, by default, kosli will not make new snapshots for scaling events (change in number of instances running).
27+
By default, kosli will not make new snapshots for scaling events (change in number of instances running).
3228
For large clusters the scaling events will often outnumber the actual change of SW.
3329
3430
It is possible to enable new snapshots for scaling events with the --include-scaling flag, or turn
@@ -106,9 +102,14 @@ func newCreateEnvironmentCmd(out io.Writer) *cobra.Command {
106102
cmd.Flags().BoolVar(&o.payload.RequireProvenance, "require-provenance", false, requireProvenanceFlag)
107103
cmd.Flags().StringSliceVar(&o.payload.IncludedEnvironments, "included-environments", []string{}, includedEnvironments)
108104

105+
err := cmd.Flags().MarkDeprecated("require-provenance", "this flag is deprecated and will be removed in a future version. Use policies instead.")
106+
if err != nil {
107+
logger.Error("failed to mark require-provenance as deprecated: %v", err)
108+
}
109+
109110
addDryRunFlag(cmd)
110111

111-
err := RequireFlags(cmd, []string{"type"})
112+
err = RequireFlags(cmd, []string{"type"})
112113
if err != nil {
113114
logger.Error("failed to configure required flags: %v", err)
114115
}

cmd/kosli/createEnvironment_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ func (suite *CreateEnvironmentCommandTestSuite) TestCreateEnvironmentCmd() {
5151
golden: "environment newEnv1 was created\n",
5252
},
5353
{
54-
name: "can create K8S env with --require-provenance",
55-
cmd: "create env strictEnv --type K8S --require-provenance" + suite.defaultKosliArguments,
56-
golden: "environment strictEnv was created\n",
54+
name: "can create K8S env with --require-provenance",
55+
cmd: "create env strictEnv --type K8S --require-provenance" + suite.defaultKosliArguments,
56+
goldenRegex: "Flag --require-provenance has been deprecated.*\nenvironment strictEnv was created",
5757
},
5858
{
59-
name: "can create K8S env with --require-provenance=false",
60-
cmd: "create env relaxedEnv --type K8S --require-provenance=false" + suite.defaultKosliArguments,
61-
golden: "environment relaxedEnv was created\n",
59+
name: "can create K8S env with --require-provenance=false",
60+
cmd: "create env relaxedEnv --type K8S --require-provenance=false" + suite.defaultKosliArguments,
61+
goldenRegex: "Flag --require-provenance has been deprecated.*\nenvironment relaxedEnv was created",
6262
},
6363
{
6464
wantError: true,

0 commit comments

Comments
 (0)