k3s: vendorSha256 -> vendorHash

This commit is contained in:
Aaron Jheng 2023-09-21 23:27:34 +08:00 committed by Weijia Wang
parent 1133b4d632
commit 0188e42d0a
6 changed files with 19 additions and 19 deletions

@ -51,7 +51,7 @@ let
k3sVersion = "1.24.10+k3s1"; # k3s git tag k3sVersion = "1.24.10+k3s1"; # k3s git tag
k3sCommit = "546a94e9ae1c3be6f9c0dcde32a6e6672b035bc8"; # k3s git commit at the above version k3sCommit = "546a94e9ae1c3be6f9c0dcde32a6e6672b035bc8"; # k3s git commit at the above version
k3sRepoSha256 = "sha256-HfkGb3GtR2wQkVIze26aFh6A6W0fegr8ovpSel7oujQ="; k3sRepoSha256 = "sha256-HfkGb3GtR2wQkVIze26aFh6A6W0fegr8ovpSel7oujQ=";
k3sVendorSha256 = "sha256-YAerisDr/knlKPaO2fVMZA4FUpwshFmkpi3mJAmLqKM="; k3sVendorHash = "sha256-YAerisDr/knlKPaO2fVMZA4FUpwshFmkpi3mJAmLqKM=";
# Based on the traefik charts here: https://github.com/k3s-io/k3s/blob/v1.24.10%2Bk3s1/scripts/download#L29-L32 # Based on the traefik charts here: https://github.com/k3s-io/k3s/blob/v1.24.10%2Bk3s1/scripts/download#L29-L32
# see also https://github.com/k3s-io/k3s/blob/v1.24.10%2Bk3s1/manifests/traefik.yaml#L8-L16 # see also https://github.com/k3s-io/k3s/blob/v1.24.10%2Bk3s1/manifests/traefik.yaml#L8-L16
@ -170,7 +170,7 @@ let
version = k3sVersion; version = k3sVersion;
src = k3sRepo; src = k3sRepo;
vendorSha256 = k3sVendorSha256; vendorHash = k3sVendorHash;
nativeBuildInputs = [ pkg-config ]; nativeBuildInputs = [ pkg-config ];
buildInputs = [ libseccomp sqlite.dev ]; buildInputs = [ libseccomp sqlite.dev ];
@ -221,7 +221,7 @@ buildGoModule rec {
version = k3sVersion; version = k3sVersion;
src = k3sRepo; src = k3sRepo;
vendorSha256 = k3sVendorSha256; vendorHash = k3sVendorHash;
postPatch = '' postPatch = ''
# Nix prefers dynamically linked binaries over static binary. # Nix prefers dynamically linked binaries over static binary.
@ -279,7 +279,7 @@ buildGoModule rec {
# Specifically, it has a 'go generate' which runs part of the package. See # Specifically, it has a 'go generate' which runs part of the package. See
# this comment: # this comment:
# https://github.com/NixOS/nixpkgs/pull/158089#discussion_r799965694 # https://github.com/NixOS/nixpkgs/pull/158089#discussion_r799965694
# So, why do we use buildGoModule at all? For the `vendorSha256` / `go mod download` stuff primarily. # So, why do we use buildGoModule at all? For the `vendorHash` / `go mod download` stuff primarily.
buildPhase = '' buildPhase = ''
patchShebangs ./scripts/package-cli ./scripts/download ./scripts/build-upload patchShebangs ./scripts/package-cli ./scripts/download ./scripts/build-upload

@ -51,7 +51,7 @@ let
k3sVersion = "1.25.3+k3s1"; # k3s git tag k3sVersion = "1.25.3+k3s1"; # k3s git tag
k3sCommit = "f2585c1671b31b4b34bddbb3bf4e7d69662b0821"; # k3s git commit at the above version k3sCommit = "f2585c1671b31b4b34bddbb3bf4e7d69662b0821"; # k3s git commit at the above version
k3sRepoSha256 = "0zwf3iwjcidx14zw36s1hr0q8wmmbfc0rfqwd7fmpjq597h8zkms"; k3sRepoSha256 = "0zwf3iwjcidx14zw36s1hr0q8wmmbfc0rfqwd7fmpjq597h8zkms";
k3sVendorSha256 = "sha256-U67tJRGqPFk5AfRe7I50zKGC9HJ2oh+iI/C7qF/76BQ="; k3sVendorHash = "sha256-U67tJRGqPFk5AfRe7I50zKGC9HJ2oh+iI/C7qF/76BQ=";
# taken from ./manifests/traefik.yaml, extracted from '.spec.chart' https://github.com/k3s-io/k3s/blob/v1.23.3%2Bk3s1/scripts/download#L9 # taken from ./manifests/traefik.yaml, extracted from '.spec.chart' https://github.com/k3s-io/k3s/blob/v1.23.3%2Bk3s1/scripts/download#L9
# The 'patch' and 'minor' versions are currently hardcoded as single digits only, so ignore the trailing two digits. Weird, I know. # The 'patch' and 'minor' versions are currently hardcoded as single digits only, so ignore the trailing two digits. Weird, I know.
@ -169,7 +169,7 @@ let
version = k3sVersion; version = k3sVersion;
src = k3sRepo; src = k3sRepo;
vendorSha256 = k3sVendorSha256; vendorHash = k3sVendorHash;
nativeBuildInputs = [ pkg-config ]; nativeBuildInputs = [ pkg-config ];
buildInputs = [ libseccomp sqlite.dev ]; buildInputs = [ libseccomp sqlite.dev ];
@ -219,7 +219,7 @@ buildGoModule rec {
version = k3sVersion; version = k3sVersion;
src = k3sRepo; src = k3sRepo;
vendorSha256 = k3sVendorSha256; vendorHash = k3sVendorHash;
patches = [ patches = [
./0001-script-download-strip-downloading-just-package-CRD.patch ./0001-script-download-strip-downloading-just-package-CRD.patch
@ -281,7 +281,7 @@ buildGoModule rec {
# Specifically, it has a 'go generate' which runs part of the package. See # Specifically, it has a 'go generate' which runs part of the package. See
# this comment: # this comment:
# https://github.com/NixOS/nixpkgs/pull/158089#discussion_r799965694 # https://github.com/NixOS/nixpkgs/pull/158089#discussion_r799965694
# So, why do we use buildGoModule at all? For the `vendorSha256` / `go mod download` stuff primarily. # So, why do we use buildGoModule at all? For the `vendorHash` / `go mod download` stuff primarily.
buildPhase = '' buildPhase = ''
patchShebangs ./scripts/package-cli ./scripts/download ./scripts/build-upload patchShebangs ./scripts/package-cli ./scripts/download ./scripts/build-upload

@ -2,7 +2,7 @@
k3sVersion = "1.26.6+k3s1"; k3sVersion = "1.26.6+k3s1";
k3sCommit = "3b1919b0d55811707bd1168f0abf11cccc656c26"; k3sCommit = "3b1919b0d55811707bd1168f0abf11cccc656c26";
k3sRepoSha256 = "1g82bkq4w0jpfn1fanj1d24bj46rw908wk50p3cm47rqiqlys72y"; k3sRepoSha256 = "1g82bkq4w0jpfn1fanj1d24bj46rw908wk50p3cm47rqiqlys72y";
k3sVendorSha256 = "sha256-+a9/q5a28zA9SmAdp2IItHR1MdJvlbMW5796bHTfKBw="; k3sVendorHash = "sha256-+a9/q5a28zA9SmAdp2IItHR1MdJvlbMW5796bHTfKBw=";
chartVersions = import ./chart-versions.nix; chartVersions = import ./chart-versions.nix;
k3sRootVersion = "0.12.2"; k3sRootVersion = "0.12.2";
k3sRootSha256 = "1gjynvr350qni5mskgm7pcc7alss4gms4jmkiv453vs8mmma9c9k"; k3sRootSha256 = "1gjynvr350qni5mskgm7pcc7alss4gms4jmkiv453vs8mmma9c9k";

@ -2,7 +2,7 @@
k3sVersion = "1.27.6+k3s1"; k3sVersion = "1.27.6+k3s1";
k3sCommit = "bd04941a294793ec92e8703d5e5da14107902e88"; k3sCommit = "bd04941a294793ec92e8703d5e5da14107902e88";
k3sRepoSha256 = "04chr8gp0yprihigy1yzhvi2baby053fav384gq0sjq6bkp3fzd8"; k3sRepoSha256 = "04chr8gp0yprihigy1yzhvi2baby053fav384gq0sjq6bkp3fzd8";
k3sVendorSha256 = "sha256-LH9OsBK0Pq/NGEHprbIgYKQsslYdR3i4LYVvo5P0K+8="; k3sVendorHash = "sha256-LH9OsBK0Pq/NGEHprbIgYKQsslYdR3i4LYVvo5P0K+8=";
chartVersions = import ./chart-versions.nix; chartVersions = import ./chart-versions.nix;
k3sRootVersion = "0.12.2"; k3sRootVersion = "0.12.2";
k3sRootSha256 = "1gjynvr350qni5mskgm7pcc7alss4gms4jmkiv453vs8mmma9c9k"; k3sRootSha256 = "1gjynvr350qni5mskgm7pcc7alss4gms4jmkiv453vs8mmma9c9k";

@ -5,7 +5,7 @@ lib:
# commit hash # commit hash
k3sCommit, k3sCommit,
k3sRepoSha256 ? lib.fakeHash, k3sRepoSha256 ? lib.fakeHash,
k3sVendorSha256 ? lib.fakeHash, k3sVendorHash ? lib.fakeHash,
# taken from ./scripts/version.sh VERSION_ROOT https://github.com/k3s-io/k3s/blob/v1.23.3%2Bk3s1/scripts/version.sh#L47 # taken from ./scripts/version.sh VERSION_ROOT https://github.com/k3s-io/k3s/blob/v1.23.3%2Bk3s1/scripts/version.sh#L47
k3sRootVersion, k3sRootVersion,
k3sRootSha256 ? lib.fakeHash, k3sRootSha256 ? lib.fakeHash,
@ -182,7 +182,7 @@ let
version = k3sVersion; version = k3sVersion;
src = k3sRepo; src = k3sRepo;
vendorSha256 = k3sVendorSha256; vendorHash = k3sVendorHash;
nativeBuildInputs = [ pkg-config ]; nativeBuildInputs = [ pkg-config ];
buildInputs = [ libseccomp sqlite.dev ]; buildInputs = [ libseccomp sqlite.dev ];
@ -238,7 +238,7 @@ buildGoModule rec {
tags = [ "libsqlite3" "linux" "ctrd" ]; tags = [ "libsqlite3" "linux" "ctrd" ];
src = k3sRepo; src = k3sRepo;
vendorSha256 = k3sVendorSha256; vendorHash = k3sVendorHash;
postPatch = '' postPatch = ''
# Nix prefers dynamically linked binaries over static binary. # Nix prefers dynamically linked binaries over static binary.
@ -296,7 +296,7 @@ buildGoModule rec {
# Specifically, it has a 'go generate' which runs part of the package. See # Specifically, it has a 'go generate' which runs part of the package. See
# this comment: # this comment:
# https://github.com/NixOS/nixpkgs/pull/158089#discussion_r799965694 # https://github.com/NixOS/nixpkgs/pull/158089#discussion_r799965694
# So, why do we use buildGoModule at all? For the `vendorSha256` / `go mod download` stuff primarily. # So, why do we use buildGoModule at all? For the `vendorHash` / `go mod download` stuff primarily.
buildPhase = '' buildPhase = ''
patchShebangs ./scripts/package-cli ./scripts/download ./scripts/build-upload patchShebangs ./scripts/package-cli ./scripts/download ./scripts/build-upload

@ -101,7 +101,7 @@ cat >versions.nix <<EOF
k3sVersion = "${K3S_VERSION}"; k3sVersion = "${K3S_VERSION}";
k3sCommit = "${K3S_COMMIT}"; k3sCommit = "${K3S_COMMIT}";
k3sRepoSha256 = "${K3S_REPO_SHA256}"; k3sRepoSha256 = "${K3S_REPO_SHA256}";
k3sVendorSha256 = "${FAKE_HASH}"; k3sVendorHash = "${FAKE_HASH}";
chartVersions = import ./chart-versions.nix; chartVersions = import ./chart-versions.nix;
k3sRootVersion = "${K3S_ROOT_VERSION}"; k3sRootVersion = "${K3S_ROOT_VERSION}";
k3sRootSha256 = "${K3S_ROOT_SHA256}"; k3sRootSha256 = "${K3S_ROOT_SHA256}";
@ -114,13 +114,13 @@ cat >versions.nix <<EOF
EOF EOF
set +e set +e
K3S_VENDOR_SHA256=$(nix-prefetch -I nixpkgs=${NIXPKGS_ROOT} "{ sha256 }: (import ${NIXPKGS_ROOT}. {}).k3s_1_${MINOR_VERSION}.goModules.overrideAttrs (_: { vendorSha256 = sha256; })") K3S_VENDOR_HASH=$(nix-prefetch -I nixpkgs=${NIXPKGS_ROOT} "{ sha256 }: (import ${NIXPKGS_ROOT}. {}).k3s_1_${MINOR_VERSION}.goModules.overrideAttrs (_: { vendorHash = sha256; })")
set -e set -e
if [ -n "${K3S_VENDOR_SHA256:-}" ]; then if [ -n "${K3S_VENDOR_HASH:-}" ]; then
sed -i "s|${FAKE_HASH}|${K3S_VENDOR_SHA256}|g" ./versions.nix sed -i "s|${FAKE_HASH}|${K3S_VENDOR_HASH}|g" ./versions.nix
else else
echo "Update failed. K3S_VENDOR_SHA256 is empty." echo "Update failed. K3S_VENDOR_HASH is empty."
exit 1 exit 1
fi fi