Synopsis
kosli diff snapshots SNAPPISH_1 SNAPPISH_2 [flags]
Specify SNAPPISH_1 and SNAPPISH_2 by:
- environmentName
- the latest snapshot for environmentName, at the time of the request
- e.g., prod
- environmentName#N
- the Nth snapshot, counting from 1
- e.g., prod#42
- environmentName~N
- the Nth snapshot behind the latest, at the time of the request
- e.g., prod~5
- environmentName@{YYYY-MM-DDTHH:MM:SS}
- the snapshot at specific moment in time in UTC
- e.g., prod@{2023-10-02T12:00:00}
- environmentName@{N.
hours|days|weeks|months.ago}- the snapshot at a time relative to the time of the request
- e.g., prod@{2.hours.ago}
Flags
| Flag | Description |
|---|---|
-h, --help | help for snapshots |
-o, --output string | [defaulted] The format of the output. Valid formats are: [table, json]. (default “table”) |
-u, --show-unchanged | [defaulted] Show the unchanged artifacts present in both snapshots within the diff output. |
Flags inherited from parent commands
| Flag | Description |
|---|---|
-a, --api-token string | The Kosli API token. |
-c, --config-file string | [optional] The Kosli config file path. (default “kosli”) |
--debug | [optional] Print debug logs to stdout. |
-H, --host string | [defaulted] The Kosli endpoint. (default “https://app.kosli.com”) |
--http-proxy string | [optional] The HTTP proxy URL including protocol and port number. e.g. http://proxy-server-ip:proxy-port |
-r, --max-api-retries int | [defaulted] How many times should API calls be retried when the API host is not reachable. (default 3) |
--org string | The Kosli organization. |
-q, --quiet | [optional] Suppress non-critical warning messages. Errors and normal output are not affected. If both --quiet and --debug are set, --debug wins. |
Live Example
To view a live example of ‘kosli diff snapshots’ you can run the command below (for the cyber-dojo demo organization).export KOSLI_ORG=cyber-dojo
# The API token below is read-only
export KOSLI_API_TOKEN=Pj_XT2deaVA6V1qrTlthuaWsmjVt4eaHQwqnwqjRO3A
kosli diff snapshots aws-beta aws-prod --output=json
View example output
View example output
{
"snappish1": {
"snapshot_id": "aws-beta#7287",
"artifacts": [
{
"fingerprint": "1645999c4f6c31a2bd0d756b6159026398e52f3fa809d435fc3981c46d9f635a",
"name": "244531986313.dkr.ecr.eu-central-1.amazonaws.com/custom-start-points:b3e2ba9@sha256:1645999c4f6c31a2bd0d756b6159026398e52f3fa809d435fc3981c46d9f635a",
"most_recent_timestamp": 1781958201,
"flow": "custom-start-points-ci",
"commit_url": "https://github.com/cyber-dojo/custom-start-points/commit/b3e2ba9a56fb9c61a6b9254a5fc722c37e533f04",
"instance_count": 1
},
{
"fingerprint": "1778152eb6389d7f527fc23d11cdf0a8c7eb3cc507b2c6cd48781209d685cec5",
"name": "244531986313.dkr.ecr.eu-central-1.amazonaws.com/exercises-start-points:69b6408@sha256:1778152eb6389d7f527fc23d11cdf0a8c7eb3cc507b2c6cd48781209d685cec5",
"most_recent_timestamp": 1781958220,
"flow": "exercises-start-points-ci",
"commit_url": "https://github.com/cyber-dojo/exercises-start-points/commit/69b64089d9326a09d8dee2e50035906c2ff78aef",
"instance_count": 1
},
{
"fingerprint": "58b212faa812ce9cf34e01e00ae7a827448568788d59c115898b69404e4066cb",
"name": "244531986313.dkr.ecr.eu-central-1.amazonaws.com/saver:0906f8c@sha256:58b212faa812ce9cf34e01e00ae7a827448568788d59c115898b69404e4066cb",
"most_recent_timestamp": 1782042223,
"flow": "saver-ci",
"commit_url": "https://github.com/cyber-dojo/saver/commit/0906f8c20295bb8998449b05ed3855021ca5710e",
"instance_count": 1
}
]
},
"snappish2": {
"snapshot_id": "aws-prod#4814",
"artifacts": [
{
"fingerprint": "58af6b791d447d089f43c716ef61fe81521af92cd982435968fe4c47ce800c7b",
"name": "244531986313.dkr.ecr.eu-central-1.amazonaws.com/custom-start-points:843d655@sha256:58af6b791d447d089f43c716ef61fe81521af92cd982435968fe4c47ce800c7b",
"most_recent_timestamp": 1781862431,
"flow": "custom-start-points-ci",
"commit_url": "https://github.com/cyber-dojo/custom-start-points/commit/843d6556ec718da1a1f51ce906c8c5bd6366d691",
"instance_count": 1
},
{
"fingerprint": "b0ac80b4b90e684564fdda70932166d1ccf8033640242bae23aee17e1a5fed6e",
"name": "244531986313.dkr.ecr.eu-central-1.amazonaws.com/saver:fbae360@sha256:b0ac80b4b90e684564fdda70932166d1ccf8033640242bae23aee17e1a5fed6e",
"most_recent_timestamp": 1781862763,
"flow": "saver-ci",
"commit_url": "https://github.com/cyber-dojo/saver/commit/fbae360261d949b25a66a927921e757d4d064543",
"instance_count": 1
},
{
"fingerprint": "df3c3018338b58650f75291ce06fa18e054b88be2a19520e87208dcfc00e1443",
"name": "244531986313.dkr.ecr.eu-central-1.amazonaws.com/exercises-start-points:11fb356@sha256:df3c3018338b58650f75291ce06fa18e054b88be2a19520e87208dcfc00e1443",
"most_recent_timestamp": 1781862518,
"flow": "exercises-start-points-ci",
"commit_url": "https://github.com/cyber-dojo/exercises-start-points/commit/11fb35642d6c79603c1979f01d4fae7c1f7f0ce1",
"instance_count": 1
}
]
},
"changed": {
"artifacts": []
},
"not-changed": {
"artifacts": [
{
"fingerprint": "7f24a41aacf7c218e09b85fc3ce76512fe891cebe5aa6c88719e70096d0afc0f",
"name": "244531986313.dkr.ecr.eu-central-1.amazonaws.com/languages-start-points:7eeaac4@sha256:7f24a41aacf7c218e09b85fc3ce76512fe891cebe5aa6c88719e70096d0afc0f",
"most_recent_timestamp": 1782044766,
"flow": "languages-start-points-ci",
"commit_url": "https://github.com/cyber-dojo/languages-start-points/commit/7eeaac4c57e26887e4d027aa3c815bc2f214f934",
"instance_count": 1
},
{
"fingerprint": "82bd54f6d6cce8a290b0dbb106177c731ace68e6d1829c91e969de8d841d125f",
"name": "244531986313.dkr.ecr.eu-central-1.amazonaws.com/web:47ef6ca@sha256:82bd54f6d6cce8a290b0dbb106177c731ace68e6d1829c91e969de8d841d125f",
"most_recent_timestamp": 1781862427,
"flow": "web-ci",
"commit_url": "https://github.com/cyber-dojo/web/commit/47ef6ca4f22445ca7138a4818f8fe3a8b69b81f1",
"instance_count": 3
},
{
"fingerprint": "a08f777df1038d7f01a1ea13420b40be242eda069dc2e23316aa5be5096d20fc",
"name": "244531986313.dkr.ecr.eu-central-1.amazonaws.com/runner:c248c8e@sha256:a08f777df1038d7f01a1ea13420b40be242eda069dc2e23316aa5be5096d20fc",
"most_recent_timestamp": 1781862576,
"flow": "runner-ci",
"commit_url": "https://github.com/cyber-dojo/runner/commit/c248c8e2175307f6906e4a016d09b21d177923bd",
"instance_count": 3
},
{
"fingerprint": "c012ad13f83df1701223f5e5d3a88e76cae4e3fd3662255f2b48ed444eea65cd",
"name": "244531986313.dkr.ecr.eu-central-1.amazonaws.com/differ:3ab1ef8@sha256:c012ad13f83df1701223f5e5d3a88e76cae4e3fd3662255f2b48ed444eea65cd",
"most_recent_timestamp": 1781862426,
"flow": "differ-ci",
"commit_url": "https://github.com/cyber-dojo/differ/commit/3ab1ef84cb2243f184502ddb7f491e24d4ced1c1",
"instance_count": 1
},
{
"fingerprint": "c3e10b6879caa50792774c8d5eccf54ce23cbd730bee922846abf28fa534d5db",
"name": "244531986313.dkr.ecr.eu-central-1.amazonaws.com/dashboard:ff89dd9@sha256:c3e10b6879caa50792774c8d5eccf54ce23cbd730bee922846abf28fa534d5db",
"most_recent_timestamp": 1781862505,
"flow": "dashboard-ci",
"commit_url": "https://github.com/cyber-dojo/dashboard/commit/ff89dd9bd1bfc5441854450adcf25d5aad9508f4",
"instance_count": 1
},
{
"fingerprint": "d89025511c4f629e8a99d2764f9abc8666eb3353e877f3844d56481e0137cefb",
"name": "244531986313.dkr.ecr.eu-central-1.amazonaws.com/nginx:6350271@sha256:d89025511c4f629e8a99d2764f9abc8666eb3353e877f3844d56481e0137cefb",
"most_recent_timestamp": 1782044328,
"flow": "nginx-ci",
"commit_url": "https://github.com/cyber-dojo/nginx/commit/635027125d65a253a9c98bfd97d22cb3abbefa5a",
"instance_count": 1
},
{
"fingerprint": "f221996be414b7698b15bfe68d143c90896dc70431099bd42ecc594127087c43",
"name": "244531986313.dkr.ecr.eu-central-1.amazonaws.com/creator:34f14b6@sha256:f221996be414b7698b15bfe68d143c90896dc70431099bd42ecc594127087c43",
"most_recent_timestamp": 1781592148,
"flow": "creator-ci",
"commit_url": "https://github.com/cyber-dojo/creator/commit/34f14b6fc5d87ff95426046716ec8a09141c13a7",
"instance_count": 1
}
]
}
}
Examples Use Cases
These examples all assume that the flags--api-token, --org, --host, (and --flow, --trail when required), are set/provided.
compare the third latest snapshot in an environment to the latest
compare the third latest snapshot in an environment to the latest
kosli diff snapshots envName~3 envName
compare snapshots of two different environments of the same type
compare snapshots of two different environments of the same type
kosli diff snapshots envName1 envName2
show the not-changed artifacts in both snapshots
show the not-changed artifacts in both snapshots
kosli diff snapshots envName1 envName2
--show-unchanged
compare the snapshot from 2 weeks ago in an environment to the latest
compare the snapshot from 2 weeks ago in an environment to the latest
kosli diff snapshots envName@{2.weeks.ago} envName