mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-21 04:13:12 +00:00
fluxcd: 2.3.0 -> 2.4.0 (#345690)
This commit is contained in:
commit
b755388e12
@ -8,30 +8,29 @@
|
||||
}:
|
||||
|
||||
let
|
||||
version = "2.3.0";
|
||||
hash = "sha256-ZQs1rWI31qDo/BgjrmiNnEdR2OL8bUHVz+j5VceEp2k=";
|
||||
manifestsSha256 = "sha256-PdhR+UDquIJWtpSymtT6V7qO5fVJOkFz6RGzAx7xeb4=";
|
||||
version = "2.4.0";
|
||||
srcHash = "sha256-b4mu/iijfALBm+7OIdKgZs55fR6xWfPgL6OMOgIOi3w=";
|
||||
vendorHash = "sha256-rVyirt6+D1qedbTvPZjLog16sMAq+zyFUmbjnJIieRg=";
|
||||
manifestsHash = "sha256-85Ykc6B+DP9PVqwGbvqsQCUHpx/IzIP9TgOt3id7P5g=";
|
||||
|
||||
manifests = fetchzip {
|
||||
url = "https://github.com/fluxcd/flux2/releases/download/v${version}/manifests.tar.gz";
|
||||
hash = manifestsSha256;
|
||||
hash = manifestsHash;
|
||||
stripRoot = false;
|
||||
};
|
||||
in
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "fluxcd";
|
||||
inherit version;
|
||||
inherit vendorHash version;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "fluxcd";
|
||||
repo = "flux2";
|
||||
rev = "v${version}";
|
||||
inherit hash;
|
||||
hash = srcHash;
|
||||
};
|
||||
|
||||
vendorHash = "sha256-0YH3pgFrsnh5jIsZpj/sIgfiOCTtIlPltMS5mdGz1eM=";
|
||||
|
||||
postUnpack = ''
|
||||
cp -r ${manifests} source/cmd/flux/manifests
|
||||
|
||||
|
@ -8,30 +8,30 @@ FLUXCD_PATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
|
||||
OLD_VERSION="$(nix-instantiate --eval -E "with import $NIXPKGS_PATH {}; fluxcd.version or (builtins.parseDrvName fluxcd.name).version" | tr -d '"')"
|
||||
LATEST_TAG=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} --silent https://api.github.com/repos/fluxcd/flux2/releases/latest | jq -r '.tag_name')
|
||||
LATEST_VERSION=$(echo ${LATEST_TAG} | sed 's/^v//')
|
||||
LATEST_VERSION=$(echo "${LATEST_TAG}" | sed 's/^v//')
|
||||
|
||||
if [ ! "$OLD_VERSION" = "$LATEST_VERSION" ]; then
|
||||
SHA256=$(nix-prefetch-url --quiet --unpack https://github.com/fluxcd/flux2/archive/refs/tags/${LATEST_TAG}.tar.gz)
|
||||
SHA256=$(nix hash to-sri --type sha256 $SHA256)
|
||||
SPEC_SHA256=$(nix-prefetch-url --quiet --unpack https://github.com/fluxcd/flux2/releases/download/${LATEST_TAG}/manifests.tar.gz)
|
||||
SPEC_SHA256=$(nix hash to-sri --type sha256 $SPEC_SHA256)
|
||||
SRC_SHA256=$(nix-prefetch-url --quiet --unpack "https://github.com/fluxcd/flux2/archive/refs/tags/${LATEST_TAG}.tar.gz")
|
||||
SRC_HASH=$(nix hash convert --hash-algo sha256 --to sri "$SRC_SHA256")
|
||||
MANIFESTS_SHA256=$(nix-prefetch-url --quiet --unpack "https://github.com/fluxcd/flux2/releases/download/${LATEST_TAG}/manifests.tar.gz")
|
||||
MANIFESTS_HASH=$(nix hash convert --hash-algo sha256 --to sri "$MANIFESTS_SHA256")
|
||||
|
||||
setKV () {
|
||||
sed -i "s|$1 = \".*\"|$1 = \"${2:-}\"|" "${FLUXCD_PATH}/package.nix"
|
||||
}
|
||||
|
||||
setKV version ${LATEST_VERSION}
|
||||
setKV sha256 ${SHA256}
|
||||
setKV manifestsSha256 ${SPEC_SHA256}
|
||||
setKV version "${LATEST_VERSION}"
|
||||
setKV srcHash "${SRC_HASH}"
|
||||
setKV manifestsHash "${MANIFESTS_HASH}"
|
||||
setKV vendorHash "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" # The same as lib.fakeHash
|
||||
|
||||
set +e
|
||||
VENDOR_HASH=$(nix-build --no-out-link -A fluxcd $NIXPKGS_PATH 2>&1 >/dev/null | grep "got:" | cut -d':' -f2 | sed 's| ||g')
|
||||
VENDOR_HASH=$(nix hash to-sri --type sha256 $VENDOR_HASH)
|
||||
VENDOR_SHA256=$(nix-build --no-out-link -A fluxcd "$NIXPKGS_PATH" 2>&1 >/dev/null | grep "got:" | cut -d':' -f2 | sed 's| ||g')
|
||||
VENDOR_HASH=$(nix hash convert --hash-algo sha256 --to sri "$VENDOR_SHA256")
|
||||
set -e
|
||||
|
||||
if [ -n "${VENDOR_HASH:-}" ]; then
|
||||
setKV vendorHash ${VENDOR_HASH}
|
||||
setKV vendorHash "${VENDOR_HASH}"
|
||||
else
|
||||
echo "Update failed. VENDOR_HASH is empty."
|
||||
exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user