blob: d1ea9b06cf058c7b38e0959e6c245d4c3aeab448 [file] [log] [blame]
#!/bin/bash
set -ex
PREFIX=kubernetes
function get_revision() {
local ebuild; ebuild="$(ls -- *-r*.ebuild)"
local ebuild="${ebuild%.ebuild}"
local revision="${ebuild#*-r}"
echo "${revision}"
}
VERSION="${1}"
REVISION=$(get_revision)
NEXT_REVISION=$((${REVISION} + 1))
if [[ -z "${VERSION}" ]]; then
echo "Must pass in version!"
exit 1
fi
if [[ -z "${REVISION}" ]]; then
echo "Failed to get current revision!"
exit 1
fi
rm -f Manifest
# Download release.
for ARCH in amd64 arm64; do
filename="kubernetes-node-linux-${ARCH}-v${VERSION}.tar.gz"
gsutil cp "gs://anthos-baremetal-staging/kubernetes/release/v${VERSION}/kubernetes-node-linux-${ARCH}.tar.gz" "${filename}"
gsutil cp "gs://anthos-baremetal-staging/kubernetes/release/v${VERSION}/kubernetes-node-linux-${ARCH}.tar.gz" "gs://chromeos-localmirror-private/distfiles/${filename}"
cat >> Manifest <<EOF
DIST ${filename} $(stat -c %s "${filename}") BLAKE2B $(b2sum "${filename}" | cut -d' ' -f1) SHA512 $(sha512sum "${filename}" | cut -d' ' -f1)
EOF
rm "${filename}"
done
sed -i "s/VERSION=.*/VERSION=${VERSION}/" ./*.ebuild
mv -- "${PREFIX}"-*.ebuild "${PREFIX}-${VERSION%-gke*}-r${NEXT_REVISION}.ebuild"