Skip to content

Commit d12ee98

Browse files
xnoxocto-sts[bot]
andauthored
Enable off-line builds with auto-discovered keys (#241)
- **automated: Update to new apko release** - **Update for new key cashing structure** See: - chainguard-dev/apko#1968 - chainguard-dev/apko#1985 --------- Signed-off-by: octo-sts[bot] <157150467+octo-sts[bot]@users.noreply.github.com> Co-authored-by: octo-sts[bot] <157150467+octo-sts[bot]@users.noreply.github.com>
1 parent d0fb76e commit d12ee98

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ bazel_dep(name = "buildifier_prebuilt", version = "8.2.0.2", dev_dependency = Tr
1717
bazel_dep(name = "stardoc", version = "0.8.0", dev_dependency = True, repo_name = "io_bazel_stardoc")
1818

1919
toolchain = use_extension("//apko:extensions.bzl", "apko")
20-
toolchain.toolchain(apko_version = "v0.30.22")
20+
toolchain.toolchain(apko_version = "v0.30.32")
2121
use_repo(toolchain, "apko_toolchains")
2222

2323
register_toolchains("@apko_toolchains//:all")

apko/private/apk.bzl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,10 @@ def _cachePathFromURL(url):
189189
Mimicks https://github.com/chainguard-dev/go-apk/blob/7b08e8f3b0fcaa0f0a44757aedf23f6778cd8e4f/pkg/apk/cache.go#L326C6-L326C22
190190
Is interprets URL as following path: {repo}/{arch}/{file} [but also used for keyring files that don't obey {arch} part].
191191
192+
For RSA public key files (*.rsa.pub), the file is stored in a directory named after the full filename.
193+
192194
Examples:
193-
https://packages.wolfi.dev/os/wolfi-signing.rsa.pub -> https%3A%2F%2Fpackages.wolfi.dev%2F/os/wolfi-signing.rsa.pub
195+
https://packages.wolfi.dev/os/wolfi-signing.rsa.pub -> https%3A%2F%2Fpackages.wolfi.dev%2F/os/wolfi-signing.rsa.pub/wolfi-signing.rsa.pub
194196
https://packages.wolfi.dev/os/aarch64/sqlite-libs-3.44.0-r0.apk -> https%3A%2F%2Fpackages.wolfi.dev%2Fos/arch64/sqlite-libs-3.44.0-r0.apk
195197
"""
196198
url_split = url.rsplit("/", 2)
@@ -199,7 +201,13 @@ def _cachePathFromURL(url):
199201
# Seems the Apko adds additional "/" if the URL is short.
200202
repo += "/"
201203
repo_escaped = util.url_escape(repo)
202-
return "{}/{}/{}".format(repo_escaped, url_split[1], url_split[2])
204+
filename = url_split[2]
205+
206+
# For RSA public key files, store them in a directory named after the full filename
207+
if filename.endswith(".rsa.pub"):
208+
return "{}/{}/{}/{}".format(repo_escaped, url_split[1], filename, filename)
209+
210+
return "{}/{}/{}".format(repo_escaped, url_split[1], filename)
203211

204212
def _apk_keyring_impl(rctx):
205213
public_key = _cachePathFromURL(rctx.attr.url)

apko/private/versions.bzl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
# Add new versions by running
44
# ./scripts/mirror_apko.sh
55
APKO_VERSIONS = {
6-
"v0.30.22": {
7-
"darwin_amd64": "sha256-g7rbw7G/eRKq7N76dUl9Tr+449JQ92b2MCG4W9J6YJA=",
8-
"darwin_arm64": "sha256-L2Bgc0rUZzvNmqj0zjsO0EBwJWzuKWYt2LD2w+bj4fw=",
9-
"linux_386": "sha256-Nh+P8TXmb0OE5dDhvJBJ7jGgKqas4OSxnFjiE5A+aQE=",
10-
"linux_amd64": "sha256-2H2ToTuuOHQSD/hGux3FZ5C6R9swk65aX4+QS8vQK1Q=",
11-
"linux_arm64": "sha256-81H7VSHQuqn5WtJWICTHzgDvm/ynxE2gRbu0OHTRqK0=",
6+
"v0.30.32": {
7+
"darwin_amd64": "sha256-jt1VJHkF9JiExvzjgzLg0xmOVF92SsKLlmuKcUVOV3c=",
8+
"darwin_arm64": "sha256-h5cMiTzvwaW+ynwDivmOSQdHq+meSgkJ60AfD9fcg1A=",
9+
"linux_386": "sha256-cW1EQNcKCFYrWTd91NSXA6v5VbYzb4VblqROHhBerq8=",
10+
"linux_amd64": "sha256-zygC0MGD5zA1iwTLtA9Eh8NS1N38Mnrnn81mSbYGTy4=",
11+
"linux_arm64": "sha256-7Z+g+m7vXpnrRP4Uepar2M5iuKykbByE5S3olM0ZxSI=",
1212
},
1313
}

apko/tests/versions_test.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ load("//apko/private:versions.bzl", "APKO_VERSIONS")
77

88
def _smoke_test_impl(ctx):
99
env = unittest.begin(ctx)
10-
asserts.equals(env, "v0.30.22", APKO_VERSIONS.keys()[0])
10+
asserts.equals(env, "v0.30.32", APKO_VERSIONS.keys()[0])
1111
return unittest.end(env)
1212

1313
# The unittest library requires that we export the test cases as named test rules,

0 commit comments

Comments
 (0)