Skip to content

Commit

Permalink
fluxcd: update script fix #3
Browse files Browse the repository at this point in the history
  • Loading branch information
superherointj committed Oct 14, 2021
1 parent a91ebff commit f8d8987
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions pkgs/applications/networking/cluster/fluxcd/update.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl gnugrep gnused jq

set -eu -o pipefail
set -x -eu -o pipefail

cd $(dirname "${BASH_SOURCE[0]}")

Expand All @@ -14,7 +14,7 @@ SHA256=$(nix-prefetch-url --quiet --unpack https://github.com/fluxcd/flux2/archi
SPEC_SHA256=$(nix-prefetch-url --quiet --unpack https://github.com/fluxcd/flux2/releases/download/${TAG}/manifests.tar.gz)

setKV () {
sed -i "s|$1 = \".*\"|$1 = \"$2\"|" ./default.nix
sed -i "s|$1 = \".*\"|$1 = \"${2:-}\"|" ./default.nix
}

setKV version ${VERSION}
Expand All @@ -24,8 +24,15 @@ setKV vendorSha256 ""

cd ../../../../../
set +e
VENDOR_SHA256=$(nix-build --no-out-link -A fluxcd 2>&1 | grep "got:" | cut -d':' -f2 | sed 's/ //g')
VENDOR_SHA256=$(nix-build --no-out-link -A fluxcd 2>&1 | grep "got:" | cut -d':' -f2 | sed 's| ||g')
set -e

cd - > /dev/null
setKV vendorSha256 ${VENDOR_SHA256}

if [ -n "${VENDOR_SHA256:-}" ]; then
setKV vendorSha256 ${VENDOR_SHA256}
else
echo "Update failed. VENDOR_SHA256 is empty."
exit 1
fi

0 comments on commit f8d8987

Please sign in to comment.