Skip to content
This repository was archived by the owner on Dec 19, 2025. It is now read-only.

Commit fb9e18d

Browse files
Enhance scripts and documentation for template completeness checks
- Add 'set -e' to 1.sh and 2.sh for better error handling. - Update README.md to clarify the template completeness check section. - Refine jq query in check-template-complete.sh to correctly filter nested attestation statuses.
1 parent 3876135 commit fb9e18d

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

template-complete/1.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
2+
set -e
33
# Get the current git commit SHA
44
GIT_SHA=$(git rev-parse HEAD)
55
ARTIFACT=artifact.txt

template-complete/2.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
2+
set -e
33
# Get the current git commit SHA
44
GIT_SHA=$(git rev-parse HEAD)
55
ARTIFACT=artifact.txt

template-complete/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ We have 3 examples, two of which are interesting:
1414
* **Inconclussive, because of missing attestations:** Our template complete will fail, as there are one or more attestations not made. **This is scenario 1**.
1515
* **Non-compliant, and template complete:** In this scenario, all compliances are there, but just not compliant (disregarding the reason). **This is scenario 2**
1616

17-
### 2. Template Completeness Check (`check-template-complete.sh`)
17+
### Template Completeness Check (`check-template-complete.sh`)
1818

1919
The `check-template-complete.sh` script analyzes the JSON output of a given trail to determine template completeness:
2020

template-complete/check-template-complete.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ json_data=$(cat "$json_file")
3333
# We use -r to output raw strings and @tsv to format as tab-separated values
3434
# This makes it easier to parse in bash.
3535
# The query now filters for the specific status provided as an argument.
36-
jq_query='(
36+
jq_query='
37+
(
3738
.compliance_status.attestations_statuses[]?, # Attestations directly under compliance_status
38-
.compliance_status.artifacts_statuses | to_entries[]?.value.attestations_statuses[]? # Attestations nested under artifacts
39+
.compliance_status.artifacts_statuses | to_entries[]?.value | select(type == "object") | .attestations_statuses[]? # Attestations nested under artifacts
3940
)
4041
| select(.status == "'"$status_to_find"'")
4142
| [.attestation_name, .status]

0 commit comments

Comments
 (0)