From 920717529c234ee36e775904882c352e7304f4d4 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Sun, 14 Oct 2018 12:23:36 -0700 Subject: [PATCH] hack: offer .tar.gz releases, use for posix (#105) - create krew.tar.gz{,.sha256sum} - use it in krew.yaml for linux/darwin - use it in README.md for linux/darwin instalation (fixes #101) Signed-off-by: Ahmet Alp Balkan --- README.md | 4 ++-- hack/krew.yaml | 12 ++++++------ hack/make-release-artifacts.sh | 29 +++++++++++++++++++++-------- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 890b4e5785..d6b5dacd38 100644 --- a/README.md +++ b/README.md @@ -41,8 +41,8 @@ For macOS and Linux: ```sh ( set -x; cd "$(mktemp -d)" && - curl -fsSLO "https://github.com/GoogleContainerTools/krew/releases/download/v0.2.0/krew.{zip,yaml}" && - unzip krew.zip && + curl -fsSLO "https://github.com/GoogleContainerTools/krew/releases/download/v0.2.0/krew.{tar.gz,yaml}" && + tar zxvf krew.tar.gz && ./out/bin/krew-"$(uname | tr '[:upper:]' '[:lower:]')_amd64" install \ --manifest=krew.yaml --archive=krew.zip ) diff --git a/hack/krew.yaml b/hack/krew.yaml index e3a0adb58e..fd9c282067 100644 --- a/hack/krew.yaml +++ b/hack/krew.yaml @@ -20,8 +20,8 @@ spec: version: "KREW_TAG" shortDescription: Package manager for kubectl plugins. platforms: - - uri: https://github.com/GoogleContainerTools/krew/releases/download/KREW_TAG/krew.zip - sha256: KREW_ZIP_CHECKSUM + - uri: https://github.com/GoogleContainerTools/krew/releases/download/KREW_TAG/krew.tar.gz + sha256: KREW_TAR_CHECKSUM bin: krew files: - from: out/bin/krew-darwin_amd64 @@ -30,8 +30,8 @@ spec: matchLabels: os: darwin arch: amd64 - - uri: https://github.com/GoogleContainerTools/krew/releases/download/KREW_TAG/krew.zip - sha256: KREW_ZIP_CHECKSUM + - uri: https://github.com/GoogleContainerTools/krew/releases/download/KREW_TAG/krew.tar.gz + sha256: KREW_TAR_CHECKSUM bin: krew files: - from: out/bin/krew-linux_amd64 @@ -40,8 +40,8 @@ spec: matchLabels: os: linux arch: amd64 - - uri: https://github.com/GoogleContainerTools/krew/releases/download/KREW_TAG/krew.zip - sha256: KREW_ZIP_CHECKSUM + - uri: https://github.com/GoogleContainerTools/krew/releases/download/KREW_TAG/krew.tar.gz + sha256: KREW_TAR_CHECKSUM bin: krew files: - from: out/bin/krew-linux_arm diff --git a/hack/make-release-artifacts.sh b/hack/make-release-artifacts.sh index c9322118c5..d1cc58558f 100755 --- a/hack/make-release-artifacts.sh +++ b/hack/make-release-artifacts.sh @@ -25,23 +25,36 @@ if [[ ! -d "${bin_dir}" ]]; then exit 1 fi -krew_archive="krew.zip" -echo >&2 "Creating ${krew_archive} archive." -zip -X -q -r --verbose out/krew.zip "${bin_dir}" +krew_tar_archive="krew.tar.gz" +krew_zip_archive="krew.zip" + +echo >&2 "Creating ${krew_tar_archive} archive." +tar czvf "out/${krew_tar_archive}" "${bin_dir}" +echo >&2 "Creating ${krew_zip_archive} archive." +zip -X -q -r --verbose "out/${krew_zip_archive}" "${bin_dir}" checksum_cmd="shasum -a 256" if hash sha256sum 2>/dev/null; then checksum_cmd="sha256sum" fi -zip_checksum="$(eval "${checksum_cmd[@]}" "out/${krew_archive}" | awk '{print $1;}')" -sumfile="out/${krew_archive}.sha256" -echo >&2 "${krew_archive} checksum: ${zip_checksum}" -echo >&2 "${zip_checksum}" > "${sumfile}" -echo >&2 "Written ${sumfile}." + +tar_sumfile="out/${krew_tar_archive}.sha256" +tar_checksum="$(eval "${checksum_cmd[@]}" "out/${krew_tar_archive}" | awk '{print $1;}')" +echo >&2 "${krew_tar_archive} checksum: ${tar_checksum}" +echo "${tar_checksum}" > "${tar_sumfile}" +echo >&2 "Written ${tar_sumfile}." + +zip_sumfile="out/${krew_zip_archive}.sha256" +zip_checksum="$(eval "${checksum_cmd[@]}" "out/${krew_zip_archive}" | awk '{print $1;}')" +echo >&2 "${krew_zip_archive} checksum: ${zip_checksum}" +echo "${zip_checksum}" > "${zip_sumfile}" +echo >&2 "Written ${zip_sumfile}." + # Copy and process krew manifest cp ./hack/krew.yaml ./out/krew.yaml tag="$(git describe --tags --always HEAD)" sed -i "s/KREW_ZIP_CHECKSUM/${zip_checksum}/g" ./out/krew.yaml +sed -i "s/KREW_TAR_CHECKSUM/${tar_checksum}/g" ./out/krew.yaml sed -i "s/KREW_TAG/${tag}/g" ./out/krew.yaml echo >&2 "Written krew.yaml."