Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions client_reference/kosli_assert_artifact.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ title: "kosli assert artifact"
beta: false
deprecated: false
description: "Assert the compliance status of an artifact in Kosli.
There are four (mutually exclusive) ways to use `kosli assert artifact`:
There are three ways to choose what to assert against:

1. Against an environment. When `--environment` is specified,
assert..."
asserts against all poli..."
---

## Synopsis
Expand All @@ -16,17 +16,21 @@ kosli assert artifact [IMAGE-NAME | FILE-PATH | DIR-PATH] [flags]
```

Assert the compliance status of an artifact in Kosli.
There are four (mutually exclusive) ways to use `kosli assert artifact`:
There are three ways to choose what to assert against:

1. Against an environment. When `--environment` is specified,
asserts against all policies currently attached to the given environment.
2. Against one or more policies. When `--policy` is specified,
asserts against all the given policies.
3. Against a flow. When `--flow` is specified, asserts against the
current template file of the given flow.
4. Against many flows. When none of `--environment`, `--policy`, or `--flow`
are specified, asserts against the template files of *all* flows the artifact
is found in (by fingerprint).
3. Against flow templates. When neither `--environment` nor `--policy`
is specified, asserts against the template files of the flows the artifact
is found in.

`--environment` and `--policy` are mutually exclusive.

`--flow` can be combined with any of the above to narrow the lookup
to a specific flow. Without `--flow`, all flows containing the artifact
(by fingerprint) are considered.

Exits with zero code if the artifact has compliant status,
non-zero code if non-compliant status.
Expand Down
22 changes: 22 additions & 0 deletions client_reference/kosli_evaluate_input.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ The command exits with code 0 when allowed and code 1 when denied.

When `--input-file` is omitted, JSON is read from stdin.

Use `--params` to pass configuration data to the policy as `data.params`.
This accepts inline JSON or a file reference (`@file.json`).

## Flags
| Flag | Description |
| :--- | :--- |
| -h, --help | help for input |
| -i, --input-file string | [optional] Path to a JSON input file. Reads from stdin if omitted. |
| -o, --output string | [defaulted] The format of the output. Valid formats are: [table, json]. (default "table") |
| --params string | [optional] Policy parameters as inline JSON or @file.json. Available in policies as data.params. |
| -p, --policy string | Path to a Rego policy file to evaluate against the input. |
| --show-input | [optional] Include the policy input data in the output. |

Expand Down Expand Up @@ -80,6 +84,24 @@ kosli evaluate input
```shell
cat trail-data.json | kosli evaluate input
--policy policy.rego

```
</Accordion>
<Accordion title="evaluate with policy parameters (inline JSON)">
```shell
kosli evaluate input
--input-file trail-data.json
--policy policy.rego
--params '{"threshold": 3}'

```
</Accordion>
<Accordion title="evaluate with policy parameters from a file">
```shell
kosli evaluate input
--input-file trail-data.json
--policy policy.rego
--params @params.json
```
</Accordion>
</AccordionGroup>
Expand Down
17 changes: 17 additions & 0 deletions client_reference/kosli_evaluate_trail.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ full data structure available to the policy. Use `--output json` for structured
| -f, --flow string | The Kosli flow name. |
| -h, --help | help for trail |
| -o, --output string | [defaulted] The format of the output. Valid formats are: [table, json]. (default "table") |
| --params string | [optional] Policy parameters as inline JSON or @file.json. Available in policies as data.params. |
| -p, --policy string | Path to a Rego policy file to evaluate against the trail. |
| --show-input | [optional] Include the policy input data in the output. |

Expand Down Expand Up @@ -68,6 +69,22 @@ kosli evaluate trail yourTrailName
--policy yourPolicyFile.rego
--show-input
--output json

```
</Accordion>
<Accordion title="evaluate a trail with policy parameters (inline JSON)">
```shell
kosli evaluate trail yourTrailName
--policy yourPolicyFile.rego
--params '{"min_approvers": 2}'

```
</Accordion>
<Accordion title="evaluate a trail with policy parameters from a file">
```shell
kosli evaluate trail yourTrailName
--policy yourPolicyFile.rego
--params @params.json
```
</Accordion>
</AccordionGroup>
Expand Down
9 changes: 9 additions & 0 deletions client_reference/kosli_evaluate_trails.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ full data structure available to the policy. Use `--output json` for structured
| -f, --flow string | The Kosli flow name. |
| -h, --help | help for trails |
| -o, --output string | [defaulted] The format of the output. Valid formats are: [table, json]. (default "table") |
| --params string | [optional] Policy parameters as inline JSON or @file.json. Available in policies as data.params. |
| -p, --policy string | Path to a Rego policy file to evaluate against the trails. |
| --show-input | [optional] Include the policy input data in the output. |

Expand Down Expand Up @@ -69,6 +70,14 @@ kosli evaluate trails yourTrailName1 yourTrailName2
--policy yourPolicyFile.rego
--show-input
--output json

```
</Accordion>
<Accordion title="evaluate trails with policy parameters">
```shell
kosli evaluate trails yourTrailName1 yourTrailName2
--policy yourPolicyFile.rego
--params '{"min_approvers": 2}'
```
</Accordion>
</AccordionGroup>
Expand Down
2 changes: 1 addition & 1 deletion client_reference/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: "Reference documentation for the Kosli CLI."
---

<Info>
This reference was generated from Kosli CLI **v2.15.1**.
This reference was generated from Kosli CLI **v2.15.2**.
</Info>

The Kosli CLI allows you to interact with Kosli from your terminal and CI/CD pipelines.
Expand Down