Skip to content

Commit

Permalink
Release: add attest custom command (#394)
Browse files Browse the repository at this point in the history
* WIP - creating tests

* add attest custom command

* enable tests for attest custom

---------

Co-authored-by: Steve Tooke <tooky@kosli.com>
  • Loading branch information
sami-alajrami and tooky committed Dec 20, 2024
1 parent ee10b05 commit 55a0b1b
Show file tree
Hide file tree
Showing 88 changed files with 273 additions and 143 deletions.
2 changes: 1 addition & 1 deletion docs.kosli.com/assets/metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"currentversion": "v2.11.4"}
{"currentversion": "v2.11.5"}
7 changes: 0 additions & 7 deletions docs.kosli.com/content/legacy_ref/v2.10.18/_index.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs.kosli.com/content/legacy_ref/v2.11.0/_index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: v2.11.0
bookCollapseSection: true
weight: 603
weight: 604
---

# v2.11.0
2 changes: 1 addition & 1 deletion docs.kosli.com/content/legacy_ref/v2.11.1/_index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: v2.11.1
bookCollapseSection: true
weight: 602
weight: 603
---

# v2.11.1
2 changes: 1 addition & 1 deletion docs.kosli.com/content/legacy_ref/v2.11.2/_index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: v2.11.2
bookCollapseSection: true
weight: 601
weight: 602
---

# v2.11.2
2 changes: 1 addition & 1 deletion docs.kosli.com/content/legacy_ref/v2.11.3/_index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: v2.11.3
bookCollapseSection: true
weight: 600
weight: 601
---

# v2.11.3
7 changes: 7 additions & 0 deletions docs.kosli.com/content/legacy_ref/v2.11.4/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: v2.11.4
bookCollapseSection: true
weight: 600
---

# v2.11.4
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ deprecated: false
## Synopsis

Add an artifact to an environment's allowlist.
The artifact SHA256 fingerprint is calculated (based on the `--artifact-type` flag and the artifact name/path argument) or can be provided directly (with the `--fingerprint` flag).

The artifact fingerprint can be provided directly with the `--fingerprint` flag, or
calculated based on `--artifact-type` flag.

Artifact type can be one of: "file" for files, "dir" for directories, "oci" for container
images in registries or "docker" for local docker images.



```shell
kosli allow artifact [IMAGE-NAME | FILE-PATH | DIR-PATH] [flags]
Expand All @@ -18,16 +25,15 @@ kosli allow artifact [IMAGE-NAME | FILE-PATH | DIR-PATH] [flags]
## Flags
| Flag | Description |
| :--- | :--- |
| -t, --artifact-type string | The type of the artifact to calculate its SHA256 fingerprint. One of: [docker, file, dir]. Only required if you want Kosli to calculate the fingerprint for you (i.e. when you don't specify '--fingerprint' on commands that allow it). |
| -t, --artifact-type string | The type of the artifact to calculate its SHA256 fingerprint. One of: [oci, docker, file, dir]. Only required if you want Kosli to calculate the fingerprint for you (i.e. when you don't specify '--fingerprint' on commands that allow it). |
| -D, --dry-run | [optional] Run in dry-run mode. When enabled, no data is sent to Kosli and the CLI exits with 0 exit code regardless of any errors. |
| -e, --environment string | The environment name for which the artifact is allowlisted. |
| -x, --exclude strings | [optional] The comma separated list of directories and files to exclude from fingerprinting. Can take glob patterns. Only applicable for --artifact-type dir. |
| -F, --fingerprint string | [conditional] The SHA256 fingerprint of the artifact. Only required if you don't specify '--artifact-type'. |
| -h, --help | help for artifact |
| --reason string | The reason why this artifact is allowlisted. |
| --registry-password string | [conditional] The docker registry password or access token. Only required if you want to read docker image SHA256 digest from a remote docker registry. |
| --registry-provider string | [conditional] The docker registry provider or url. Only required if you want to read docker image SHA256 digest from a remote docker registry. |
| --registry-username string | [conditional] The docker registry username. Only required if you want to read docker image SHA256 digest from a remote docker registry. |
| --registry-password string | [conditional] The container registry password or access token. Only required if you want to read container image SHA256 digest from a remote container registry. |
| --registry-username string | [conditional] The container registry username. Only required if you want to read container image SHA256 digest from a remote container registry. |


## Flags inherited from parent commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ deprecated: false

Assert an artifact in Kosli has been approved for deployment.
Exits with non-zero code if the artifact has not been approved.
The artifact SHA256 fingerprint is calculated (based on the `--artifact-type` flag and the artifact name/path argument) or can be provided directly (with the `--fingerprint` flag).

The artifact fingerprint can be provided directly with the `--fingerprint` flag, or
calculated based on `--artifact-type` flag.

Artifact type can be one of: "file" for files, "dir" for directories, "oci" for container
images in registries or "docker" for local docker images.



```shell
kosli assert approval [IMAGE-NAME | FILE-PATH | DIR-PATH] [flags]
Expand All @@ -19,15 +26,14 @@ kosli assert approval [IMAGE-NAME | FILE-PATH | DIR-PATH] [flags]
## Flags
| Flag | Description |
| :--- | :--- |
| -t, --artifact-type string | The type of the artifact to calculate its SHA256 fingerprint. One of: [docker, file, dir]. Only required if you want Kosli to calculate the fingerprint for you (i.e. when you don't specify '--fingerprint' on commands that allow it). |
| -t, --artifact-type string | The type of the artifact to calculate its SHA256 fingerprint. One of: [oci, docker, file, dir]. Only required if you want Kosli to calculate the fingerprint for you (i.e. when you don't specify '--fingerprint' on commands that allow it). |
| -D, --dry-run | [optional] Run in dry-run mode. When enabled, no data is sent to Kosli and the CLI exits with 0 exit code regardless of any errors. |
| -x, --exclude strings | [optional] The comma separated list of directories and files to exclude from fingerprinting. Can take glob patterns. Only applicable for --artifact-type dir. |
| -F, --fingerprint string | [conditional] The SHA256 fingerprint of the artifact. Only required if you don't specify '--artifact-type'. |
| -f, --flow string | The Kosli flow name. |
| -h, --help | help for approval |
| --registry-password string | [conditional] The docker registry password or access token. Only required if you want to read docker image SHA256 digest from a remote docker registry. |
| --registry-provider string | [conditional] The docker registry provider or url. Only required if you want to read docker image SHA256 digest from a remote docker registry. |
| --registry-username string | [conditional] The docker registry username. Only required if you want to read docker image SHA256 digest from a remote docker registry. |
| --registry-password string | [conditional] The container registry password or access token. Only required if you want to read container image SHA256 digest from a remote container registry. |
| --registry-username string | [conditional] The container registry username. Only required if you want to read container image SHA256 digest from a remote container registry. |


## Flags inherited from parent commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ kosli assert artifact [IMAGE-NAME | FILE-PATH | DIR-PATH] [flags]
## Flags
| Flag | Description |
| :--- | :--- |
| -t, --artifact-type string | The type of the artifact to calculate its SHA256 fingerprint. One of: [docker, file, dir]. Only required if you want Kosli to calculate the fingerprint for you (i.e. when you don't specify '--fingerprint' on commands that allow it). |
| -t, --artifact-type string | The type of the artifact to calculate its SHA256 fingerprint. One of: [oci, docker, file, dir]. Only required if you want Kosli to calculate the fingerprint for you (i.e. when you don't specify '--fingerprint' on commands that allow it). |
| -D, --dry-run | [optional] Run in dry-run mode. When enabled, no data is sent to Kosli and the CLI exits with 0 exit code regardless of any errors. |
| -x, --exclude strings | [optional] The comma separated list of directories and files to exclude from fingerprinting. Can take glob patterns. Only applicable for --artifact-type dir. |
| -F, --fingerprint string | [conditional] The SHA256 fingerprint of the artifact. Only required if you don't specify '--artifact-type'. |
| -f, --flow string | The Kosli flow name. |
| -h, --help | help for artifact |
| --registry-password string | [conditional] The docker registry password or access token. Only required if you want to read docker image SHA256 digest from a remote docker registry. |
| --registry-provider string | [conditional] The docker registry provider or url. Only required if you want to read docker image SHA256 digest from a remote docker registry. |
| --registry-username string | [conditional] The docker registry username. Only required if you want to read docker image SHA256 digest from a remote docker registry. |
| --registry-password string | [conditional] The container registry password or access token. Only required if you want to read container image SHA256 digest from a remote container registry. |
| --registry-username string | [conditional] The container registry username. Only required if you want to read container image SHA256 digest from a remote container registry. |


## Flags inherited from parent commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ deprecated: false
## Synopsis

Attest an artifact creation to a Kosli flow.
The artifact SHA256 fingerprint is calculated (based on the `--artifact-type` flag and the artifact name/path argument) or can be provided directly (with the `--fingerprint` flag).To specify paths in a directory artifact that should always be excluded from the SHA256 calculation, you can add a `.kosli_ignore` file to the root of the artifact.

The artifact fingerprint can be provided directly with the `--fingerprint` flag, or
calculated based on `--artifact-type` flag.

Artifact type can be one of: "file" for files, "dir" for directories, "oci" for container
images in registries or "docker" for local docker images.

To specify paths in a directory artifact that should always be excluded from the SHA256 calculation, you can add a `.kosli_ignore` file to the root of the artifact.
Each line should specify a relative path or path glob to be ignored. You can include comments in this file, using `#`.
The `.kosli_ignore` will be treated as part of the artifact like any other file,unless it is explicitly ignored itself.
This command requires access to a git repo to associate the artifact to the git commit it is originating from.
Expand All @@ -23,7 +30,7 @@ kosli attest artifact {IMAGE-NAME | FILE-PATH | DIR-PATH} [flags]
| Flag | Description |
| :--- | :--- |
| --annotate stringToString | [optional] Annotate the attestation with data using key=value. |
| -t, --artifact-type string | The type of the artifact to calculate its SHA256 fingerprint. One of: [docker, file, dir]. Only required if you want Kosli to calculate the fingerprint for you (i.e. when you don't specify '--fingerprint' on commands that allow it). |
| -t, --artifact-type string | The type of the artifact to calculate its SHA256 fingerprint. One of: [oci, docker, file, dir]. Only required if you want Kosli to calculate the fingerprint for you (i.e. when you don't specify '--fingerprint' on commands that allow it). |
| -b, --build-url string | The url of CI pipeline that built the artifact. (defaulted in some CIs: https://docs.kosli.com/ci-defaults ). |
| -g, --commit string | [defaulted] The git commit from which the artifact was created. (defaulted in some CIs: https://docs.kosli.com/ci-defaults, otherwise defaults to HEAD ). (default "HEAD") |
| -u, --commit-url string | The url for the git commit that created the artifact. (defaulted in some CIs: https://docs.kosli.com/ci-defaults ). |
Expand All @@ -37,9 +44,8 @@ kosli attest artifact {IMAGE-NAME | FILE-PATH | DIR-PATH} [flags]
| -h, --help | help for artifact |
| -n, --name string | The name of the artifact in the yml template file. |
| --redact-commit-info strings | [optional] The list of commit info to be redacted before sending to Kosli. Allowed values are one or more of [author, message, branch]. |
| --registry-password string | [conditional] The docker registry password or access token. Only required if you want to read docker image SHA256 digest from a remote docker registry. |
| --registry-provider string | [conditional] The docker registry provider or url. Only required if you want to read docker image SHA256 digest from a remote docker registry. |
| --registry-username string | [conditional] The docker registry username. Only required if you want to read docker image SHA256 digest from a remote docker registry. |
| --registry-password string | [conditional] The container registry password or access token. Only required if you want to read container image SHA256 digest from a remote container registry. |
| --registry-username string | [conditional] The container registry username. Only required if you want to read container image SHA256 digest from a remote container registry. |
| --repo-root string | [defaulted] The directory where the source git repository is available. (default ".") |
| -T, --trail string | The Kosli trail name. |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ kosli attest generic [IMAGE-NAME | FILE-PATH | DIR-PATH] [flags]
| Flag | Description |
| :--- | :--- |
| --annotate stringToString | [optional] Annotate the attestation with data using key=value. |
| -t, --artifact-type string | The type of the artifact to calculate its SHA256 fingerprint. One of: [docker, file, dir]. Only required if you want Kosli to calculate the fingerprint for you (i.e. when you don't specify '--fingerprint' on commands that allow it). |
| -t, --artifact-type string | The type of the artifact to calculate its SHA256 fingerprint. One of: [oci, docker, file, dir]. Only required if you want Kosli to calculate the fingerprint for you (i.e. when you don't specify '--fingerprint' on commands that allow it). |
| --attachments strings | [optional] The comma-separated list of paths of attachments for the reported attestation. Attachments can be files or directories. All attachments are compressed and uploaded to Kosli's evidence vault. |
| -g, --commit string | [conditional] The git commit for which the attestation is associated to. Becomes required when reporting an attestation for an artifact before reporting it to Kosli. (defaulted in some CIs: https://docs.kosli.com/ci-defaults ). |
| -C, --compliant | [defaulted] Whether the attestation is compliant or not. A boolean flag https://docs.kosli.com/faq/#boolean-flags (default true) |
Expand All @@ -44,9 +44,8 @@ kosli attest generic [IMAGE-NAME | FILE-PATH | DIR-PATH] [flags]
| -n, --name string | The name of the attestation as declared in the flow or trail yaml template. |
| -o, --origin-url string | [optional] The url pointing to where the attestation came from or is related. (defaulted to the CI url in some CIs: https://docs.kosli.com/ci-defaults ). |
| --redact-commit-info strings | [optional] The list of commit info to be redacted before sending to Kosli. Allowed values are one or more of [author, message, branch]. |
| --registry-password string | [conditional] The docker registry password or access token. Only required if you want to read docker image SHA256 digest from a remote docker registry. |
| --registry-provider string | [conditional] The docker registry provider or url. Only required if you want to read docker image SHA256 digest from a remote docker registry. |
| --registry-username string | [conditional] The docker registry username. Only required if you want to read docker image SHA256 digest from a remote docker registry. |
| --registry-password string | [conditional] The container registry password or access token. Only required if you want to read container image SHA256 digest from a remote container registry. |
| --registry-username string | [conditional] The container registry username. Only required if you want to read container image SHA256 digest from a remote container registry. |
| --repo-root string | [defaulted] The directory where the source git repository is available. Only used if --commit is used. (default ".") |
| -T, --trail string | The Kosli trail name. |
| -u, --user-data string | [optional] The path to a JSON file containing additional data you would like to attach to the attestation. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ kosli attest jira [IMAGE-NAME | FILE-PATH | DIR-PATH] [flags]
| Flag | Description |
| :--- | :--- |
| --annotate stringToString | [optional] Annotate the attestation with data using key=value. |
| -t, --artifact-type string | The type of the artifact to calculate its SHA256 fingerprint. One of: [docker, file, dir]. Only required if you want Kosli to calculate the fingerprint for you (i.e. when you don't specify '--fingerprint' on commands that allow it). |
| -t, --artifact-type string | The type of the artifact to calculate its SHA256 fingerprint. One of: [oci, docker, file, dir]. Only required if you want Kosli to calculate the fingerprint for you (i.e. when you don't specify '--fingerprint' on commands that allow it). |
| --assert | [optional] Exit with non-zero code if the attestation is non-compliant |
| --attachments strings | [optional] The comma-separated list of paths of attachments for the reported attestation. Attachments can be files or directories. All attachments are compressed and uploaded to Kosli's evidence vault. |
| -g, --commit string | [conditional] The git commit for which the attestation is associated to. Becomes required when reporting an attestation for an artifact before reporting it to Kosli. (defaulted in some CIs: https://docs.kosli.com/ci-defaults ). |
Expand All @@ -59,9 +59,8 @@ kosli attest jira [IMAGE-NAME | FILE-PATH | DIR-PATH] [flags]
| -n, --name string | The name of the attestation as declared in the flow or trail yaml template. |
| -o, --origin-url string | [optional] The url pointing to where the attestation came from or is related. (defaulted to the CI url in some CIs: https://docs.kosli.com/ci-defaults ). |
| --redact-commit-info strings | [optional] The list of commit info to be redacted before sending to Kosli. Allowed values are one or more of [author, message, branch]. |
| --registry-password string | [conditional] The docker registry password or access token. Only required if you want to read docker image SHA256 digest from a remote docker registry. |
| --registry-provider string | [conditional] The docker registry provider or url. Only required if you want to read docker image SHA256 digest from a remote docker registry. |
| --registry-username string | [conditional] The docker registry username. Only required if you want to read docker image SHA256 digest from a remote docker registry. |
| --registry-password string | [conditional] The container registry password or access token. Only required if you want to read container image SHA256 digest from a remote container registry. |
| --registry-username string | [conditional] The container registry username. Only required if you want to read container image SHA256 digest from a remote container registry. |
| --repo-root string | [defaulted] The directory where the source git repository is available. Only used if --commit is used. (default ".") |
| -T, --trail string | The Kosli trail name. |
| -u, --user-data string | [optional] The path to a JSON file containing additional data you would like to attach to the attestation. |
Expand Down
Loading

0 comments on commit 55a0b1b

Please sign in to comment.