Skip to content

Commit

Permalink
refactor: update zot and use minimal binaries (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
thesayyn authored Nov 21, 2023
1 parent 35a2baf commit e74ccde
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
5 changes: 3 additions & 2 deletions oci/private/image.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ EOF

# this will redirect stderr(2) to stderr file.
{
source "${REGISTRY_LAUNCHER}"
readonly REGISTRY=$(start_registry "${STORAGE_DIR}" "${STDERR}")
source "${REGISTRY_LAUNCHER}"
REGISTRY=
REGISTRY=$(start_registry "${STORAGE_DIR}" "${STDERR}")

OUTPUT=""
WORKDIR=""
Expand Down
2 changes: 1 addition & 1 deletion oci/private/registry/zot_launcher.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function start_registry() {
"log": { "level": "info" }
}
EOF
"${ZOT}" serve "${config_path}" >> $output 2>&1 &
HOME="${TMPDIR}" "${ZOT}" serve "${config_path}" >> $output 2>&1 &

local timeout=$((SECONDS+${deadline}))

Expand Down
16 changes: 9 additions & 7 deletions oci/private/versions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ CRANE_VERSIONS = {
}

ZOT_VERSIONS = {
"v1.4.3-rc3": {
"darwin-amd64": "sha256-AGyGP/DKR5QCrcdzB7P6TjBEAMNMPG0nmY/eUcmxH3I=",
"darwin-arm64": "sha256-C7uoK2STgfq9XXXHLSLKu3Fs8XmX94bIb0RHpwoqjzk=",
"linux-amd64": "sha256-BdeBe7bBOYCy/VfRHZsz7EC+7b4TC+kSa0g7CI1HKd0=",
"linux-arm64": "sha256-57DAO3f8h5ZV3w6zH+nXsD6KpnJI5crywbksLri4RHE=",
},
}
"v2.0.0-rc7": {
"darwin-amd64": "sha256-CgQgQBbT2MDf9H9ttWZXSCP1SJfHvI1U1JX8WcExsqc=",
"darwin-arm64": "sha256-z+7Tn1mhAfvx9JlAeMq2WxtpMx6lcLjvycUhSAANX1U=",
"freebsd-amd64": "sha256-ex4IzW3299cegSnW2Q4LCk/sBJfaIPIxzujo1ocWnRY=",
"freebsd-arm64": "sha256-byEVM7MsYNNfC94bmqxCG+VyP1CoMVPQgfQEyVQro7M=",
"linux-amd64": "sha256-pAiaOvyD+Tvi/d6MGAFytJFmYYttCukucxaxbAmnX5w=",
"linux-arm64": "sha256-+TLMTCs+eYPmxWAbbvb2PFNwGvHsMI40yxeY3wVGepM="
}
}
2 changes: 1 addition & 1 deletion oci/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ registry_toolchain(

def _zot_repo_impl(repository_ctx):
platform = repository_ctx.attr.platform.replace("_", "-")
url = "https://github.com/project-zot/zot/releases/download/{version}/zot-{platform}".format(
url = "https://github.com/project-zot/zot/releases/download/{version}/zot-{platform}-minimal".format(
version = repository_ctx.attr.zot_version,
platform = platform,
)
Expand Down
6 changes: 3 additions & 3 deletions scripts/mirror_releases_zot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ JQ_FILTER=\
'map({
"key": .tag_name,
"value": .assets
| map( select( (.name | startswith("zot-")) and (.name | endswith("-debug") | not) and (.name | endswith("-minimal") | not) ) )
| map({ key: .name | ltrimstr("zot-"), value: "sha256-" })
| map( select( (.name | startswith("zot-")) and (.name | endswith("-debug") | not) and (.name | endswith("-minimal") ) ) )
| map({ key: .name | ltrimstr("zot-") | rtrimstr("-minimal"), value: "sha256-" })
| from_entries
}) | from_entries
'
Expand All @@ -20,7 +20,7 @@ INFO="$(curl --silent -H "Accept: application/vnd.github.v3+json" https://api.gi
# TODO: remove this for loop once https://github.com/project-zot/zot/issues/715 is fixed.
for VERSION in $(jq -r 'keys | join("\n")' <<< $INFO); do
for PLATFORM in $(jq -r ".[\"$VERSION\"] | keys | join(\"\n\")" <<< $INFO); do
SHA256=$(curl -fLs "https://github.com/project-zot/zot/releases/download/$VERSION/zot-$PLATFORM" | sha256sum | xxd -r -p | base64)
SHA256=$(curl -fLs "https://github.com/project-zot/zot/releases/download/$VERSION/zot-$PLATFORM-minimal" | shasum -a 256 | xxd -r -p | base64)
INFO=$(jq ".[\"$VERSION\"][\"$PLATFORM\"] = \"sha256-$SHA256\"" <<< $INFO)
done
done
Expand Down

0 comments on commit e74ccde

Please sign in to comment.