Skip to content

Commit

Permalink
Fix script to pass CI
Browse files Browse the repository at this point in the history
Signed-off-by: Kohei Tokunaga <[email protected]>
  • Loading branch information
ktock committed Nov 13, 2024
1 parent 2187068 commit 40a550e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 3 additions & 1 deletion script/integration/containerd/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,9 @@ fi
echo "Preparing images..."
copy ghcr.io/stargz-containers/ubuntu:22.04-org "${REGISTRY_HOST}/ubuntu:22.04"
copy ghcr.io/stargz-containers/alpine:3.15.3-org "${REGISTRY_HOST}/alpine:3.15.3"
stargzify "${REGISTRY_HOST}/ubuntu:22.04" "${REGISTRY_HOST}/ubuntu:sgz"
# nerctl v2 stores creds info with explicit port information. We need to add port in the image name
# so that ggcr can authenticate.
stargzify "${REGISTRY_HOST}:443/ubuntu:22.04" "${REGISTRY_HOST}:443/ubuntu:sgz"
optimize "${REGISTRY_HOST}/ubuntu:22.04" "${REGISTRY_HOST}/ubuntu:esgz" "false"
optimize "${REGISTRY_HOST}/ubuntu:22.04" "${REGISTRY_HOST}/ubuntu:zstdchunked" "false" --zstdchunked
optimize "${REGISTRY_HOST}/alpine:3.15.3" "${REGISTRY_HOST}/alpine:esgz" "false"
Expand Down
17 changes: 11 additions & 6 deletions script/optimize/optimize/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ REGISTRY_HOST=registry-optimize.test
DUMMYUSER=dummyuser
DUMMYPASS=dummypass
ORG_IMAGE_TAG="${REGISTRY_HOST}/test/test:org$(date '+%M%S')"
OPT_IMAGE_TAG="${REGISTRY_HOST}/test/test:opt$(date '+%M%S')"
NOOPT_IMAGE_TAG="${REGISTRY_HOST}/test/test:noopt$(date '+%M%S')"
OPT_IMAGE_NAME="test:opt$(date '+%M%S')"
NOOPT_IMAGE_NAME="test:noopt$(date '+%M%S')"
OPT_IMAGE_TAG="${REGISTRY_HOST}/test/${OPT_IMAGE_NAME}"
NOOPT_IMAGE_TAG="${REGISTRY_HOST}/test/${NOOPT_IMAGE_NAME}"
TOC_JSON_DIGEST_ANNOTATION="containerd.io/snapshot/stargz/toc.digest"
UNCOMPRESSED_SIZE_ANNOTATION="io.containers.estargz.uncompressed-size"
REMOTE_SNAPSHOTTER_SOCKET=/run/containerd-stargz-grpc/containerd-stargz-grpc.sock
Expand Down Expand Up @@ -126,7 +128,8 @@ function check_uncompressed_size {
}

function check_optimization {
local TARGET=${1}
local TARGET="${REGISTRY_HOST}/test/${1}"
local TARGET_WITH_PORT="${REGISTRY_HOST}:443/test/${1}"

LOCAL_WORKING_DIR="$(mktemp -d --tmpdir=${WORKING_DIR}/)"
nerdctl pull "${TARGET}" && nerdctl save "${TARGET}" | tar xv -C "${LOCAL_WORKING_DIR}"
Expand All @@ -151,7 +154,9 @@ function check_optimization {
echo "Validating tarball contents of layer ${I}..."
diff "${LOCAL_WORKING_DIR}/${I}" "${LOCAL_WORKING_DIR}/${I}-want"
done
crane manifest "${TARGET}" | tee "${LOCAL_WORKING_DIR}/dist-manifest.json" && echo ""
# nerctl v2 stores creds info with explicit port information. We need to add port in the image name
# so that crane can authenticate.
crane manifest "${TARGET_WITH_PORT}" | tee "${LOCAL_WORKING_DIR}/dist-manifest.json" && echo ""
INDEX=0
for L in ${LAYERS}; do
echo "Validating TOC JSON digest of layer ${INDEX}..."
Expand Down Expand Up @@ -230,7 +235,7 @@ e.txt
EOF
append_toc "${WORKING_DIR}/2-want"

check_optimization "${OPT_IMAGE_TAG}" \
check_optimization "${OPT_IMAGE_NAME}" \
"${WORKING_DIR}/0-want" \
"${WORKING_DIR}/1-want" \
"${WORKING_DIR}/2-want"
Expand Down Expand Up @@ -259,7 +264,7 @@ e.txt
EOF
append_toc "${WORKING_DIR}/2-want"

check_optimization "${NOOPT_IMAGE_TAG}" \
check_optimization "${NOOPT_IMAGE_NAME}" \
"${WORKING_DIR}/0-want" \
"${WORKING_DIR}/1-want" \
"${WORKING_DIR}/2-want"
Expand Down

0 comments on commit 40a550e

Please sign in to comment.