From c6b0e23f4d4162623081d7802ecd31337b0b0339 Mon Sep 17 00:00:00 2001 From: Steve Tooke Date: Thu, 19 Sep 2024 09:55:56 +0100 Subject: [PATCH] Add docs for `.kosli_ignore` --- cmd/kosli/attestArtifact.go | 2 +- cmd/kosli/fingerprint.go | 4 +++- cmd/kosli/root.go | 3 +++ cmd/kosli/snapshotPath.go | 2 +- cmd/kosli/snapshotPaths.go | 3 ++- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cmd/kosli/attestArtifact.go b/cmd/kosli/attestArtifact.go index 9bd835fdc..f999e8a19 100644 --- a/cmd/kosli/attestArtifact.go +++ b/cmd/kosli/attestArtifact.go @@ -41,7 +41,7 @@ type AttestArtifactPayload struct { const attestArtifactShortDesc = `Attest an artifact creation to a Kosli flow. ` const attestArtifactLongDesc = attestArtifactShortDesc + ` -` + fingerprintDesc + ` +` + fingerprintDesc + kosliIgnoreDesc + ` This command requires access to a git repo to associate the artifact to the git commit it is originating from. You can optionally redact some of the git commit data sent to Kosli using ^--redact-commit-info^` diff --git a/cmd/kosli/fingerprint.go b/cmd/kosli/fingerprint.go index 3538ee72b..20fc52e53 100644 --- a/cmd/kosli/fingerprint.go +++ b/cmd/kosli/fingerprint.go @@ -13,7 +13,9 @@ using the ^--exclude^ flag. Excluded paths are relative to the DIR-PATH and can be literal paths or glob patterns. The supported glob pattern syntax is what is documented here: https://pkg.go.dev/path/filepath#Match , -plus the ability to use recursive globs "**"` +plus the ability to use recursive globs "**" + +` + kosliIgnoreDesc const fingerprintLongDesc = fingerprintShortDesc + ` Requires ^--artifact-type^ flag to be set. diff --git a/cmd/kosli/root.go b/cmd/kosli/root.go index 469cb588c..a1d8c40ea 100644 --- a/cmd/kosli/root.go +++ b/cmd/kosli/root.go @@ -67,6 +67,9 @@ The service principal needs to have the following permissions: 2) Microsoft.ContainerRegistry/registries/pull/read ` + kosliIgnoreDesc = `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.` // flags apiTokenFlag = "The Kosli API token." diff --git a/cmd/kosli/snapshotPath.go b/cmd/kosli/snapshotPath.go index 81dae6339..39d03eb8a 100644 --- a/cmd/kosli/snapshotPath.go +++ b/cmd/kosli/snapshotPath.go @@ -18,7 +18,7 @@ You can exclude certain paths or patterns from the artifact fingerprint using ^- The supported glob pattern syntax is what is documented here: https://pkg.go.dev/path/filepath#Match , plus the ability to use recursive globs "**" -` +` + kosliIgnoreDesc const snapshotPathExample = ` # report one artifact running in a specific path in a filesystem: diff --git a/cmd/kosli/snapshotPaths.go b/cmd/kosli/snapshotPaths.go index 7b76bc0ce..cc8b30121 100644 --- a/cmd/kosli/snapshotPaths.go +++ b/cmd/kosli/snapshotPaths.go @@ -23,9 +23,10 @@ glob patterns. The supported glob pattern syntax is what is documented here: https://pkg.go.dev/path/filepath#Match , plus the ability to use recursive globs "**" +` + kosliIgnoreDesc + ` + This is an example YAML paths spec file: ` + - "```yaml\n" + `version: 1 artifacts: