@@ -12,17 +12,29 @@ import (
1212 "github.com/spf13/cobra"
1313)
1414
15- const assertArtifactShortDesc = `Assert the compliance status of an artifact in Kosli ` +
16- `(in its flow, against an environment or against one or more policies). `
15+ const assertArtifactShortDesc = `Assert the compliance status of an artifact in Kosli. ` +
16+ `
17+ There are four (mutually exclusive) ways to use ^kosli assert artifact^:
18+
19+ 1. Against an environment. When ^--environment^ is specified,
20+ asserts against all policies currently attached to the given environment.
21+ 2. Against one or more policies. When ^--policy^ is specified,
22+ asserts against all the given policies.
23+ 3. Against a flow. When ^--flow^ is specified, asserts against the
24+ current template file of the given flow.
25+ 4. Against many flows. When none of ^--environment^, ^--policy^, or ^--flow^
26+ are specified, asserts against the template files of *all* flows the artifact
27+ is found in (by fingerprint).
28+ `
1729
1830const assertArtifactLongDesc = assertArtifactShortDesc + `
19- Exits with non-zero code if the artifact has a non-compliant status.`
31+ Exits with zero code if the artifact has compliant status,
32+ non-zero code if non-compliant status.`
2033
2134const assertArtifactExample = `
2235# assert that an artifact meets all compliance requirements for an environment
2336kosli assert artifact \
2437 --fingerprint 184c799cd551dd1d8d5c5f9a5d593b2e931f5e36122ee5c793c1d08a19839cc0 \
25- --flow yourFlowName \
2638 --environment prod \
2739 --api-token yourAPIToken \
2840 --org yourOrgName
@@ -34,17 +46,18 @@ kosli assert artifact \
3446 --api-token yourAPIToken \
3547 --org yourOrgName
3648
37- # fail if an artifact has a non-compliant status (using the artifact fingerprint)
49+ # fail if an artifact has a non-compliant status in a single flow (using the artifact fingerprint)
50+ export KOSLI_FLOW=yourFlowName
3851kosli assert artifact \
3952 --fingerprint 184c799cd551dd1d8d5c5f9a5d593b2e931f5e36122ee5c793c1d08a19839cc0 \
4053 --flow yourFlowName \
4154 --api-token yourAPIToken \
4255 --org yourOrgName
4356
44- # fail if an artifact has a non-compliant status (using the artifact name and type)
57+ # fail if an artifact has a non-compliant status in any flow (using the artifact name and type)
58+ unset KOSLI_FLOW
4559kosli assert artifact library/nginx:1.21 \
4660 --artifact-type docker \
47- --flow yourFlowName \
4861 --api-token yourAPIToken \
4962 --org yourOrgName
5063`
0 commit comments