public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [tests/python] main: Add a test to verify tarballs with sigstore
Date: Tue, 27 Oct 2026 10:43:09 GMT [thread overview]
Message-ID: <179309778966.1.13367130140474825424.tests-python-b638ee25c205@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : tests/python
Branch : main
Commit : b638ee25c2055d19bb431ac3c8fcacab962e847c
Author : Miro Hrončok <miro@hroncok.cz>
Date : 2026-10-27T11:33:56+01:00
Stats : +58/-0 in 2 file(s)
URL : https://src.fedoraproject.org/tests/python/c/b638ee25c2055d19bb431ac3c8fcacab962e847c?branch=main
Log:
Add a test to verify tarballs with sigstore
Assisted-By: Claude Sonnet 5
---
diff --git a/sigstore/sigstore.fmf b/sigstore/sigstore.fmf
new file mode 100644
index 0000000..618361c
--- /dev/null
+++ b/sigstore/sigstore.fmf
@@ -0,0 +1,24 @@
+summary: Verify the CPython release tarball used for the build with Sigstore
+description: |
+ Verifies that the upstream CPython source release tarball actually
+ used to build the package was signed by the expected release manager
+ identity, as documented at
+ https://www.python.org/downloads/metadata/sigstore/ (see PEP 761).
+
+ The tarball is found in $TMT_SOURCE_DIR, which tmt populates when
+ this test runs as part of a discover phase with
+ dist-git-source: true (and no url, so it resolves to the dist-git
+ checkout of the package itself rather than this shared tests repo).
+ This fails if that directory does not contain exactly one release
+ tarball.
+
+ IDENTITY and ISSUER must be set to the release manager identity.
+
+path: /sigstore
+test: ./sigstore.sh
+require: [python3, bash, wget]
+
+tier: 1
+tag: [sigstore]
+
+duration: 5m
diff --git a/sigstore/sigstore.sh b/sigstore/sigstore.sh
new file mode 100755
index 0000000..6f5d27d
--- /dev/null
+++ b/sigstore/sigstore.sh
@@ -0,0 +1,34 @@
+#!/bin/bash -eux
+TMT_SOURCE_DIR=${TMT_SOURCE_DIR:?TMT_SOURCE_DIR must be set; run this test from a discover phase with dist-git-source: true}
+IDENTITY=${IDENTITY:?IDENTITY must be set (see https://www.python.org/downloads/metadata/sigstore/)}
+ISSUER=${ISSUER:?ISSUER must be set (see https://www.python.org/downloads/metadata/sigstore/)}
+
+# Find the one release tarball among the downloaded dist-git sources
+tarballs=$(find "$TMT_SOURCE_DIR" -maxdepth 1 -type f \
+ \( -name '*.tar.gz' -o -name '*.tar.xz' -o -name '*.tar.bz2' -o -name '*.tgz' \))
+tarball_count=$(printf '%s\n' "$tarballs" | grep -c . || true)
+
+if [ "$tarball_count" -ne 1 ]; then
+ echo "FAIL: expected exactly one release tarball in \$TMT_SOURCE_DIR ($TMT_SOURCE_DIR), found $tarball_count" >&2
+ printf '%s\n' "$tarballs" >&2
+ exit 1
+fi
+
+FILE="$tarballs"
+FILENAME="$(basename "$FILE")"
+
+# The upstream ftp directory drops any prerelease suffix from the file's
+# version, e.g. Python-3.14.0rc3.tar.xz is published under .../3.14.0/
+VERSION="$(echo "$FILENAME" | sed -E 's/^Python-([0-9]+\.[0-9]+\.[0-9]+).*/\1/')"
+BUNDLEURL="https://www.python.org/ftp/python/${VERSION}/${FILENAME}.sigstore"
+wget -O "${FILENAME}.sigstore" "$BUNDLEURL"
+
+python3 -m venv sigstore_venv
+sigstore_venv/bin/pip install sigstore
+
+sigstore_venv/bin/python -m sigstore verify identity \
+ --bundle "${FILENAME}.sigstore" \
+ --cert-identity "$IDENTITY" \
+ --cert-oidc-issuer "$ISSUER" \
+ "$FILE"
+
reply other threads:[~2026-10-27 10:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179309778966.1.13367130140474825424.tests-python-b638ee25c205@fedoraproject.org \
--to=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox