Skip to content

Commit

Permalink
test: use containerd client instead of transfer service
Browse files Browse the repository at this point in the history
Signed-off-by: Kohei Tokunaga <[email protected]>
  • Loading branch information
ktock committed Dec 23, 2024
1 parent 4ce034f commit 9241431
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions script/integration/containerd/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ function optimize {
local DST="${2}"
local PLAINHTTP="${3}"
local OPTS=${@:4}
ctr-remote image pull -u "${DUMMYUSER}:${DUMMYPASS}" "${SRC}"
ctr-remote image pull --local -u "${DUMMYUSER}:${DUMMYPASS}" "${SRC}"
ctr-remote image optimize ${OPTS} --oci "${SRC}" "${DST}"
PUSHOPTS=
if [ "${PLAINHTTP}" == "true" ] ; then
PUSHOPTS=--plain-http
fi
ctr-remote image push ${PUSHOPTS} -u "${DUMMYUSER}:${DUMMYPASS}" "${DST}"
ctr-remote image push --local ${PUSHOPTS} -u "${DUMMYUSER}:${DUMMYPASS}" "${DST}"
}

function convert {
Expand All @@ -163,17 +163,17 @@ function convert {
if [ "${PLAINHTTP}" == "true" ] ; then
PUSHOPTS=--plain-http
fi
ctr-remote image pull -u "${DUMMYUSER}:${DUMMYPASS}" "${SRC}"
ctr-remote image pull --local -u "${DUMMYUSER}:${DUMMYPASS}" "${SRC}"
ctr-remote image convert ${OPTS} --oci "${SRC}" "${DST}"
ctr-remote image push ${PUSHOPTS} -u "${DUMMYUSER}:${DUMMYPASS}" "${DST}"
ctr-remote image push --local ${PUSHOPTS} -u "${DUMMYUSER}:${DUMMYPASS}" "${DST}"
}

function copy {
local SRC="${1}"
local DST="${2}"
ctr-remote i pull --all-platforms "${SRC}"
ctr-remote i tag "${SRC}" "${DST}"
ctr-remote i push -u "${DUMMYUSER}:${DUMMYPASS}" "${DST}"
ctr-remote image pull --local --all-platforms "${SRC}"
ctr-remote image tag --local "${SRC}" "${DST}"
ctr-remote image push --local -u "${DUMMYUSER}:${DUMMYPASS}" "${DST}"
}

function copy_out_dir {
Expand Down Expand Up @@ -202,7 +202,7 @@ function dump_dir {
if [ "${REMOTE}" == "true" ] ; then
run_and_check_remote_snapshots ctr-remote images rpull --user "${DUMMYUSER}:${DUMMYPASS}" "${IMAGE}"
else
ctr-remote images pull --snapshotter="${SNAPSHOTTER}" --user "${DUMMYUSER}:${DUMMYPASS}" "${IMAGE}"
ctr-remote image pull --local --snapshotter="${SNAPSHOTTER}" --user "${DUMMYUSER}:${DUMMYPASS}" "${IMAGE}"
fi
copy_out_dir "${IMAGE}" "${TARGETDIR}" "${DEST}" "${SNAPSHOTTER}"
}
Expand Down Expand Up @@ -276,9 +276,9 @@ optimize "${REGISTRY_HOST}/alpine:3.15.3" "${REGISTRY_ALT_HOST}:5000/alpine:esgz
# TODO: support external TOC suffix other than "-esgztoc"
optimize "${REGISTRY_HOST}/ubuntu:22.04" "${REGISTRY_HOST}/ubuntu:esgz-50000" "false" --estargz-min-chunk-size=50000
optimize "${REGISTRY_HOST}/ubuntu:22.04" "${REGISTRY_HOST}/ubuntu:esgz-ex" "false" --estargz-external-toc
ctr-remote i push -u "${DUMMYUSER}:${DUMMYPASS}" "${REGISTRY_HOST}/ubuntu:esgz-ex-esgztoc"
ctr-remote image push --local -u "${DUMMYUSER}:${DUMMYPASS}" "${REGISTRY_HOST}/ubuntu:esgz-ex-esgztoc"
convert "${REGISTRY_HOST}/ubuntu:22.04" "${REGISTRY_HOST}/ubuntu:esgz-ex-keep-diff-id" "false" --estargz --estargz-external-toc --estargz-keep-diff-id
ctr-remote i push -u "${DUMMYUSER}:${DUMMYPASS}" "${REGISTRY_HOST}/ubuntu:esgz-ex-keep-diff-id-esgztoc"
ctr-remote image push --local -u "${DUMMYUSER}:${DUMMYPASS}" "${REGISTRY_HOST}/ubuntu:esgz-ex-keep-diff-id-esgztoc"

if [ "${BUILTIN_SNAPSHOTTER}" != "true" ] ; then

Expand All @@ -294,21 +294,21 @@ if [ "${BUILTIN_SNAPSHOTTER}" != "true" ] ; then
retry curl -X POST localhost:5001/api/v0/version >/dev/null 2>&1 # wait for up

# stargz snapshotter (default labels)
ctr-remote i pull --user "${DUMMYUSER}:${DUMMYPASS}" "${REGISTRY_HOST}/ubuntu:22.04"
ctr-remote image pull --local --user "${DUMMYUSER}:${DUMMYPASS}" "${REGISTRY_HOST}/ubuntu:22.04"
CID=$(ctr-remote i ipfs-push "${REGISTRY_HOST}/ubuntu:22.04")
reboot_containerd
run_and_check_remote_snapshots ctr-remote i rpull --ipfs "${CID}"
copy_out_dir "${CID}" "/usr" "${USR_STARGZSN_IPFS}" "stargz"

# stargz snapshotter (containerd labels)
ctr-remote i pull --user "${DUMMYUSER}:${DUMMYPASS}" "${REGISTRY_HOST}/ubuntu:22.04"
ctr-remote image pull --local --user "${DUMMYUSER}:${DUMMYPASS}" "${REGISTRY_HOST}/ubuntu:22.04"
CID=$(ctr-remote i ipfs-push "${REGISTRY_HOST}/ubuntu:22.04")
reboot_containerd
run_and_check_remote_snapshots ctr-remote i rpull --use-containerd-labels --ipfs "${CID}"
copy_out_dir "${CID}" "/usr" "${USR_STARGZSN_CTD_IPFS}" "stargz"

# overlayfs snapshotter
ctr-remote i pull --user "${DUMMYUSER}:${DUMMYPASS}" "${REGISTRY_HOST}/ubuntu:22.04"
ctr-remote image pull --local --user "${DUMMYUSER}:${DUMMYPASS}" "${REGISTRY_HOST}/ubuntu:22.04"
CID=$(ctr-remote i ipfs-push --estargz=false "${REGISTRY_HOST}/ubuntu:22.04")
reboot_containerd
ctr-remote i rpull --snapshotter=overlayfs --ipfs "${CID}"
Expand All @@ -329,7 +329,7 @@ echo "Testing refreshing and mirror..."

reboot_containerd
echo "Getting image with normal snapshotter..."
ctr-remote images pull --user "${DUMMYUSER}:${DUMMYPASS}" "${REGISTRY_HOST}/alpine:esgz"
ctr-remote image pull --local --user "${DUMMYUSER}:${DUMMYPASS}" "${REGISTRY_HOST}/alpine:esgz"
copy_out_dir "${REGISTRY_HOST}/alpine:esgz" "/usr" "${USR_ORG}" "overlayfs"

echo "Getting image with stargz snapshotter..."
Expand Down

0 comments on commit 9241431

Please sign in to comment.