Skip to content

Commit 51e74cd

Browse files
dijku
andauthored
feat: Include conformance action version in client report (#283)
* feat: Include conformance action version in client report * Add pytest-metadata as top-level dependency * Use pytest-metadata instead --------- Signed-off-by: Jussi Kukkonen <jkukkonen@google.com> Co-authored-by: Jussi Kukkonen <jkukkonen@google.com>
1 parent 8c484c2 commit 51e74cd

File tree

5 files changed

+21
-1
lines changed

5 files changed

+21
-1
lines changed

.github/scripts/generate_client_report.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class Result:
1919
skipped: int = -1
2020
rekor2_verify: bool = False
2121
rekor2_sign: bool = False
22+
conformance_action_version: str = "unknown"
2223
client_sha: str = ""
2324
client_sha_url: str = ""
2425
workflow_run: str = ""
@@ -36,6 +37,10 @@ def __init__(self, report_path: Path):
3637
return # no results found
3738
self.results_found = True
3839

40+
self.conformance_action_version = data.get("environment", {}).get(
41+
"conformance_action_version", "unknown"
42+
)
43+
3944
summary = data["summary"]
4045
self.total = summary["total"]
4146
self.passed = summary.get("passed", 0) + summary.get("subtests passed", 0)
@@ -81,6 +86,7 @@ def _generate_html(results: list[Result]):
8186
<th>Xfailed</th>
8287
<th>Rekor v2 verify</th>
8388
<th>Rekor v2 sign</th>
89+
<th>Action Version</th>
8490
</tr>
8591
</thead>
8692
<tbody>
@@ -110,6 +116,7 @@ def _generate_html(results: list[Result]):
110116
<td>{res.xfailed if res.results_found else ""}</td>
111117
<td>{"✅" if res.rekor2_verify else "❌"}</td>
112118
<td>{"✅" if res.rekor2_sign else "❌"}</td>
119+
<td>{res.conformance_action_version}</td>
113120
</tr>
114121
"""
115122
html += """

action.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#
55
# all state is passed in as environment variables
66

7+
import json
78
import os
89
import sys
910
from pathlib import Path
@@ -29,6 +30,9 @@ def _debug(msg):
2930
def _sigstore_conformance(environment: str) -> int:
3031
args = ["--json-report", "--json-report-file=conformance-report.json", "--durations=0"]
3132

33+
version = os.getenv("GHA_SIGSTORE_CONFORMANCE_ACTION_VERSION", "unknown")
34+
args.extend(["--metadata", "conformance_action_version", version])
35+
3236
if _DEBUG:
3337
args.extend(["-s", "-vv", "--showlocals"])
3438

action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ runs:
5252
echo "::endgroup::"
5353
shell: bash
5454

55+
- name: Get action version
56+
id: get_action_version
57+
run: echo "action_version=$(git describe --tags --always)" >> $GITHUB_OUTPUT
58+
shell: bash
59+
5560
- name: Run sigstore-conformance
5661
id: sigstore-conformance
5762
run: |
@@ -67,6 +72,7 @@ runs:
6772
GHA_SIGSTORE_CONFORMANCE_CLIENT_SHA_URL: "${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}"
6873
GHA_SIGSTORE_CONFORMANCE_WORKFLOW_RUN: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
6974
GHA_SIGSTORE_CONFORMANCE_SELFTEST_BIN: "${{ github.workspace }}/sigstore-conformance-selftest-env/bin/sigstore"
75+
GHA_SIGSTORE_CONFORMANCE_ACTION_VERSION: "${{ steps.get_action_version.outputs.action_version }}"
7076
shell: bash
7177

7278
- name: Upload conformance result

requirements.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
pytest==8.4.2
22
pytest-json-report==1.5.0
3+
pytest-metadata==3.1.1
34
pytest-subtests==0.15.0
45
requests==2.32.5
56
cryptography==46.0.3

requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,9 @@ pytest-json-report==1.5.0 \
603603
pytest-metadata==3.1.1 \
604604
--hash=sha256:c8e0844db684ee1c798cfa38908d20d67d0463ecb6137c72e91f418558dd5f4b \
605605
--hash=sha256:d2a29b0355fbc03f168aa96d41ff88b1a3b44a3b02acbe491801c98a048017c8
606-
# via pytest-json-report
606+
# via
607+
# -r requirements.in
608+
# pytest-json-report
607609
pytest-subtests==0.15.0 \
608610
--hash=sha256:cb495bde05551b784b8f0b8adfaa27edb4131469a27c339b80fd8d6ba33f887c \
609611
--hash=sha256:da2d0ce348e1f8d831d5a40d81e3aeac439fec50bd5251cbb7791402696a9493

0 commit comments

Comments
 (0)