Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8a56c3e

Browse files
committedOct 17, 2024··
enable sigstore verification for alpine
1 parent a068d81 commit 8a56c3e

File tree

13 files changed

+120
-85
lines changed

13 files changed

+120
-85
lines changed
 

‎3.10/alpine3.19/Dockerfile

Lines changed: 6 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎3.10/alpine3.20/Dockerfile

Lines changed: 6 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎3.11/alpine3.19/Dockerfile

Lines changed: 6 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎3.11/alpine3.20/Dockerfile

Lines changed: 6 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎3.12/alpine3.19/Dockerfile

Lines changed: 6 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎3.12/alpine3.20/Dockerfile

Lines changed: 6 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎3.13/alpine3.19/Dockerfile

Lines changed: 6 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎3.13/alpine3.20/Dockerfile

Lines changed: 6 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎3.14-rc/alpine3.19/Dockerfile

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎3.14-rc/alpine3.20/Dockerfile

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎3.9/alpine3.19/Dockerfile

Lines changed: 6 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎3.9/alpine3.20/Dockerfile

Lines changed: 6 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Dockerfile-linux.template

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,54 @@ RUN set -eux; \
5252
{{ ) end -}}
5353

5454
{{
55+
def should_sigstore:
56+
env.variant | startswith("alpine")
57+
;
5558
def should_pgp:
5659
# https://github.com/docker-library/python/issues/977
5760
# https://peps.python.org/pep-0761/
5861
# https://discuss.python.org/t/pep-761-deprecating-pgp-signatures-for-cpython-artifacts/67180
5962
rcVersion | IN("3.9", "3.10", "3.11", "3.12", "3.13")
6063
-}}
61-
{{ if should_pgp then ( -}}
64+
{{ if should_sigstore then ( -}}
65+
ENV CERTIFICATE_ISSUER {{
66+
{
67+
"3.9": "https://github.com/login/oauth",
68+
"3.10": "https://accounts.google.com",
69+
"3.11": "https://accounts.google.com",
70+
"3.12": "https://accounts.google.com",
71+
"3.13": "https://accounts.google.com",
72+
"3.14": "https://github.com/login/oauth"
73+
}[rcVersion]
74+
}}
75+
ENV CERTIFICATE_IDENTITY {{
76+
{
77+
# release manager: Łukasz Langa
78+
"3.9": "lukasz@langa.pl",
79+
# https://peps.python.org/pep-0596/#release-manager-and-crew
80+
81+
# release manager: Pablo Galindo Salgado
82+
"3.10": "pablogsal@python.org",
83+
# https://peps.python.org/pep-0619/#release-manager-and-crew
84+
85+
# release manager: Pablo Galindo Salgado
86+
"3.11": "pablogsal@python.org",
87+
# https://peps.python.org/pep-0664/#release-manager-and-crew
88+
89+
# release manager: Thomas Wouters
90+
"3.12": "thomas@python.org",
91+
# https://peps.python.org/pep-0693/#release-manager-and-crew
92+
93+
# release manager: Thomas Wouters
94+
"3.13": "thomas@python.org",
95+
# https://peps.python.org/pep-0719/#release-manager-and-crew
96+
97+
# release manager: Hugo van Kemenade
98+
"3.14": "hugo@python.org"
99+
# https://peps.python.org/pep-0745/#release-manager-and-crew
100+
}[rcVersion]
101+
}}
102+
{{ ) elif should_pgp then ( -}}
62103
ENV GPG_KEY {{
63104
{
64105
# gpg: key B26995E310250568: public key "\xc5\x81ukasz Langa (GPG langa.pl) <lukasz@langa.pl>" imported
@@ -91,8 +132,8 @@ ENV PYTHON_SHA256 {{ .checksums.source.sha256 }}
91132
RUN set -eux; \
92133
\
93134
{{ if is_alpine then ( -}}
135+
apk add --no-cache --virtual .cosign cosign --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community; \
94136
apk add --no-cache --virtual .build-deps \
95-
gnupg \
96137
tar \
97138
xz \
98139
\
@@ -154,7 +195,10 @@ RUN set -eux; \
154195
{{ if .checksums.source.sha256 then ( -}}
155196
echo "$PYTHON_SHA256 *python.tar.xz" | sha256sum -c -; \
156197
{{ ) else "" end -}}
157-
{{ if should_pgp then ( -}}
198+
{{ if should_sigstore then ( -}}
199+
wget -O python.tar.xz.sigstore "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.sigstore"; \
200+
cosign verify-blob python.tar.xz --bundle python.tar.xz.sigstore --certificate-identity ${CERTIFICATE_IDENTITY} --certificate-oidc-issuer ${CERTIFICATE_ISSUER} --new-bundle-format=true; \
201+
{{ ) elif should_pgp then ( -}}
158202
wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc"; \
159203
GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \
160204
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \
@@ -244,6 +288,7 @@ RUN set -eux; \
244288
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
245289
| xargs -rt apk add --no-network --virtual .python-rundeps \
246290
; \
291+
apk del --no-network .cosign; \
247292
apk del --no-network .build-deps; \
248293
{{ ) else ( -}}
249294
ldconfig; \

0 commit comments

Comments
 (0)
Please sign in to comment.