From b815f4880306ccaf9dab8fabf835400359df5bb7 Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Wed, 18 Dec 2019 11:29:57 +0300 Subject: [PATCH] Add script for generating binary hashes (#5470) Change-Id: I4498d1c0585ee98c23856208d660caadf67cab34 --- scripts/download_hash.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 scripts/download_hash.sh diff --git a/scripts/download_hash.sh b/scripts/download_hash.sh new file mode 100644 index 000000000..5edfff80f --- /dev/null +++ b/scripts/download_hash.sh @@ -0,0 +1,28 @@ +#!/bin/sh +set -eo pipefail + +VERSIONS="$@" +ARCHITECTURES="arm arm64 amd64" +DOWNLOADS="kubelet kubectl kubeadm" +DOWNLOAD_DIR="tmp/kubeadm_hasher" + +if [ -z "$VERSIONS" ]; then + echo "USAGE: $0 " + exit 1 +fi + +mkdir -p ${DOWNLOAD_DIR} +for download in ${DOWNLOADS}; do + echo -e "\n\n${download}_checksums:" + for arch in ${ARCHITECTURES}; do + echo -e " ${arch}:" + for version in ${VERSIONS}; do + TARGET="${DOWNLOAD_DIR}/${download}-$version-$arch" + if [ ! -f ${TARGET} ]; then + curl -s -o ${TARGET} "https://storage.googleapis.com/kubernetes-release/release/${version}/bin/linux/${arch}/${download}" + fi + echo -e " ${version}: $(sha256sum ${TARGET} | awk '{print $1}')" + done + done +done +echo -e "\n\nAdd these values to roles/download/defaults/main.yml"