Skip to content

Commit

Permalink
Fetch the sha256 directly
Browse files Browse the repository at this point in the history
Signed-off-by: Ma Xinjian <[email protected]>
  • Loading branch information
MaXinjian authored and BenTheElder committed May 19, 2021
1 parent 2f66967 commit 48795b9
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions images/base/update-shasums.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ CONTAINERD_VERSION="$(sed -n 's/ARG CONTAINERD_VERSION="\(.*\)"/\1/p' ./images/b
CNI_PLUGINS_VERSION="$(sed -n 's/ARG CNI_PLUGINS_VERSION="\(.*\)"/\1/p' ./images/base/Dockerfile)"
CRICTL_VERSION="$(sed -n 's/ARG CRICTL_VERSION="\(.*\)"/\1/p' ./images/base/Dockerfile)"

# setup cleanup trap, create portable tempdir
cleanup(){
rm -rf "${TMP:?}"
}
trap 'cleanup' EXIT
TMP="$(mktemp -d)"

# darwin is great
SED="sed"
if which gsed &>/dev/null; then
Expand Down Expand Up @@ -67,15 +60,12 @@ for ARCH in "${ARCHITECTURES[@]}"; do
done

echo
# TODO (micahhausler): Once we upgrade to a release with the fix for https://github.com/kubernetes-sigs/cri-tools/issues/716 (1.21.0?), just fetch the sha256
for ARCH in "${ARCHITECTURES[@]}"; do
CRICTL_URL="https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRICTL_VERSION}/crictl-${CRICTL_VERSION}-linux-${ARCH}.tar.gz"
curl -sSL --retry 5 --output "${TMP}/crictl.${ARCH}.tgz" "${CRICTL_URL}"
SHASUM=$(shasum -a 256 "${TMP}/crictl.${ARCH}.tgz" | awk '{print $1}')
SHASUM=$(curl -sSL --retry 5 "${CRICTL_URL}.sha256" | awk '{print $1}')
ARCH_UPPER=$(echo "$ARCH" | tr '[:lower:]' '[:upper:]')
echo "ARG CRICTL_${ARCH_UPPER}_SHA256SUM=${SHASUM}"
$SED -i 's/ARG CRICTL_'"${ARCH_UPPER}"'_SHA256SUM=.*/ARG CRICTL_'"${ARCH_UPPER}"'_SHA256SUM="'"${SHASUM}"'"/' ./images/base/Dockerfile
rm "${TMP}/crictl.${ARCH}.tgz"
done

echo
Expand Down

0 comments on commit 48795b9

Please sign in to comment.