nixpkgs/pkgs/applications/networking/cluster/linkerd/update-edge.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
1011 B
Bash
Raw Normal View History

2021-10-01 00:40:47 +00:00
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl gnugrep gnused jq
2021-10-14 18:06:00 +00:00
set -x -eu -o pipefail
2021-10-01 00:40:47 +00:00
cd $(dirname "$0")
2021-10-20 20:01:22 +00:00
VERSION=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} \
2021-10-01 00:40:47 +00:00
--silent https://api.github.com/repos/linkerd/linkerd2/releases | \
2021-10-20 20:01:22 +00:00
jq 'map(.tag_name)' | grep edge | sed 's/["|,| ]//g' | sed 's/edge-//' | sort -V -r | head -n1)
2021-10-01 00:40:47 +00:00
2021-10-20 20:01:22 +00:00
SHA256=$(nix-prefetch-url --quiet --unpack https://github.com/linkerd/linkerd2/archive/refs/tags/edge-${VERSION}.tar.gz)
2021-10-01 00:40:47 +00:00
setKV () {
2021-10-14 18:06:00 +00:00
sed -i "s|$1 = \".*\"|$1 = \"${2:-}\"|" ./edge.nix
2021-10-01 00:40:47 +00:00
}
setKV version ${VERSION}
setKV sha256 ${SHA256}
2021-10-20 20:01:22 +00:00
setKV vendorSha256 "0000000000000000000000000000000000000000000000000000" # Necessary to force clean build.
2021-10-01 00:40:47 +00:00
cd ../../../../../
set +e
2021-10-20 20:01:22 +00:00
VENDOR_SHA256=$(nix-build --no-out-link -A linkerd_edge 2>&1 >/dev/null | grep "got:" | cut -d':' -f2 | sed 's| ||g')
2021-10-01 00:40:47 +00:00
set -e
2021-10-14 18:06:00 +00:00
cd - > /dev/null
2021-10-01 00:40:47 +00:00
if [ -n "${VENDOR_SHA256:-}" ]; then
setKV vendorSha256 ${VENDOR_SHA256}
else
echo "Update failed. VENDOR_SHA256 is empty."
exit 1
fi