Skip to content

Commit

Permalink
Release: #74 Add environment to approvals (#52)
Browse files Browse the repository at this point in the history
* Add environment flag to reportApproval command

* Approval: only send newest commit in commit list. Added sending oldest commit in seperate parameter

* parse the input oldest and newset commit to verify they exist and get their sha1 hashes

* Commands: add environment flag for request approval.

* Updated approval documentation and CLI reference

* Get oldest commit from kosli server if not given in command line

* Remove newest_commit key from approval payload

* Add test cases and fix typos in documentation

* Approval: Updated URL. Started on some more tests

* Create setup to make a snapshot in approval tests

* Approval: calculate HEAD~5 in kosli approval command

* Tests: calculate fingerprint of artifact for approval using function instead of kosli command

* Delete dead comments

* Update docs for approvals

* Docs: fix typos

* Approval: Small update docs

---------

Co-authored-by: Tore Martin Hagen <[email protected]>
Co-authored-by: Sami Alajrami <[email protected]>
Co-authored-by: Arstanaly Rysbekov <[email protected]>
  • Loading branch information
4 people committed Nov 29, 2023
1 parent 5636a24 commit 65abc43
Show file tree
Hide file tree
Showing 129 changed files with 182 additions and 3,261 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.6.14"}
{"currentversion": "v2.6.15"}
34 changes: 24 additions & 10 deletions docs.kosli.com/content/client_reference/kosli_report_approval.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ beta: false

## Synopsis

Report an approval of deploying an artifact to Kosli.
Report an approval of deploying an artifact to an environment to Kosli.
The artifact SHA256 fingerprint is calculated (based on --artifact-type flag) or alternatively it can be provided directly (with --fingerprint flag).

```shell
Expand All @@ -21,12 +21,13 @@ kosli report approval [IMAGE-NAME | FILE-PATH | DIR-PATH] [flags]
| -t, --artifact-type string | [conditional] The type of the artifact to calculate its SHA256 fingerprint. One of: [docker, file, dir]. Only required if you don't specify '--fingerprint'. |
| -d, --description string | [optional] The approval description. |
| -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 | [defaulted] The environment the artifact is approved for. (defaults to all environments) |
| -x, --exclude strings | [optional] The comma separated list of directories and files to exclude from fingerprinting. 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 |
| --newest-commit string | [defaulted] The source commit sha for the newest change in the deployment. (default "HEAD") |
| --oldest-commit string | The source commit sha for the oldest change in the deployment. |
| --newest-commit string | [defaulted] The source commit sha for the newest change in the deployment. Can be any commit-ish. (default "HEAD") |
| --oldest-commit string | [conditional] The source commit sha for the oldest change in the deployment. Can be any commit-ish. Only required if you don't specify '--environment'. |
| --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. |
Expand All @@ -49,25 +50,38 @@ kosli report approval [IMAGE-NAME | FILE-PATH | DIR-PATH] [flags]

```shell

# Report that a file type artifact has been approved for deployment.
# The approval is for the last 5 git commits
# Report that an artifact with a provided fingerprint (sha256) has been approved for
# deployment to environment <yourEnvironmentName>.
# The approval is for all git commits since the last approval to this environment.
kosli report approval \
--api-token yourAPIToken \
--description "An optional description for the approval" \
--environment yourEnvironmentName \
--approver username \
--org yourOrgName \
--flow yourFlowName \
--fingerprint yourArtifactFingerprint

# Report that a file type artifact has been approved for deployment to environment <yourEnvironmentName>.
# The approval is for all git commits since the last approval to this environment.
kosli report approval FILE.tgz \
--api-token yourAPIToken \
--artifact-type file \
--description "An optional description for the approval" \
--newest-commit $(git rev-parse HEAD) \
--oldest-commit $(git rev-parse HEAD~5) \
--environment yourEnvironmentName \
--newest-commit HEAD \
--approver username \
--org yourOrgName \
--flow yourFlowName

# Report that an artifact with a provided fingerprint (sha256) has been approved for deployment.
# The approval is for the last 5 git commits
# The approval is for all environments.
# The approval is for all commits since the git commit of origin/production branch.
kosli report approval \
--api-token yourAPIToken \
--description "An optional description for the approval" \
--newest-commit $(git rev-parse HEAD) \
--oldest-commit $(git rev-parse HEAD~5) \
--newest-commit HEAD \
--oldest-commit origin/production \
--approver username \
--org yourOrgName \
--flow yourFlowName \
Expand Down
37 changes: 25 additions & 12 deletions docs.kosli.com/content/client_reference/kosli_request_approval.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ beta: false

## Synopsis

Request an approval of a deployment of an artifact in Kosli.
Request an approval of a deployment of an artifact to an environment in Kosli.
The request should be reviewed in the Kosli UI.
The artifact SHA256 fingerprint is calculated (based on --artifact-type flag) or alternatively it can be provided directly (with --fingerprint flag).

Expand All @@ -21,12 +21,13 @@ kosli request approval [IMAGE-NAME | FILE-PATH | DIR-PATH] [flags]
| -t, --artifact-type string | [conditional] The type of the artifact to calculate its SHA256 fingerprint. One of: [docker, file, dir]. Only required if you don't specify '--fingerprint'. |
| -d, --description string | [optional] The approval description. |
| -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 | [defaulted] The environment the artifact is approved for. (defaults to all environments) |
| -x, --exclude strings | [optional] The comma separated list of directories and files to exclude from fingerprinting. 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 |
| --newest-commit string | [defaulted] The source commit sha for the newest change in the deployment. (default "HEAD") |
| --oldest-commit string | The source commit sha for the oldest change in the deployment. |
| --newest-commit string | [defaulted] The source commit sha for the newest change in the deployment. Can be any commit-ish. (default "HEAD") |
| --oldest-commit string | [conditional] The source commit sha for the oldest change in the deployment. Can be any commit-ish. Only required if you don't specify '--environment'. |
| --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. |
Expand All @@ -49,27 +50,39 @@ kosli request approval [IMAGE-NAME | FILE-PATH | DIR-PATH] [flags]

```shell

# Request that a file type artifact needs approval.
# The approval is for the last 5 git commits
# Request an approval for an artifact with a provided fingerprint (sha256)
# for deployment to environment <yourEnvironmentName>.
# The approval is for all git commits since the last approval to this environment.
kosli request approval \
--api-token yourAPIToken \
--description "An optional description for the approval" \
--environment yourEnvironmentName \
--org yourOrgName \
--flow yourFlowName \
--fingerprint yourArtifactFingerprint

# Request that a file type artifact needs approval for deployment to environment <yourEnvironmentName>.
# The approval is for all git commits since the last approval to this environment.
kosli request approval FILE.tgz \
--api-token yourAPIToken \
--artifact-type file \
--description "An optional description for the requested approval" \
--newest-commit $(git rev-parse HEAD) \
--oldest-commit $(git rev-parse HEAD~5) \
--environment yourEnvironmentName \
--newest-commit HEAD \
--org yourOrgName \
--flow yourFlowName

# Request and approval for an artifact with a provided fingerprint (sha256).
# The approval is for the last 5 git commits
# Request an approval for an artifact with a provided fingerprint (sha256).
# The approval is for all environments.
# The approval is for all commits since the git commit of origin/production branch.
kosli request approval \
--api-token yourAPIToken \
--description "An optional description for the requested approval" \
--newest-commit $(git rev-parse HEAD) \
--oldest-commit $(git rev-parse HEAD~5) \
--newest-commit HEAD \
--oldest-commit origin/production \
--org yourOrgName \
--flow yourFlowName \
--fingerprint yourArtifactFingerprint
--fingerprint yourArtifactFingerprint

```

7 changes: 0 additions & 7 deletions docs.kosli.com/content/legacy_ref/v0.1.40/_index.md

This file was deleted.

29 changes: 0 additions & 29 deletions docs.kosli.com/content/legacy_ref/v0.1.40/kosli.md

This file was deleted.

61 changes: 0 additions & 61 deletions docs.kosli.com/content/legacy_ref/v0.1.40/kosli_approval_get.md

This file was deleted.

61 changes: 0 additions & 61 deletions docs.kosli.com/content/legacy_ref/v0.1.40/kosli_approval_ls.md

This file was deleted.

57 changes: 0 additions & 57 deletions docs.kosli.com/content/legacy_ref/v0.1.40/kosli_artifact_get.md

This file was deleted.

Loading

0 comments on commit 65abc43

Please sign in to comment.