diff options
author | superherointj <5861043+superherointj@users.noreply.github.com> | 2024-06-14 18:11:38 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-14 18:11:38 -0300 |
commit | 3a57cf3037328ab7728107f2d6762fe0d5e37030 (patch) | |
tree | 75675050bac282a6e95056b744748844726c7547 /pkgs/applications/networking/cluster | |
parent | 806664a476fcb8ffd0eced46154d8e81a0a8f6d5 (diff) | |
parent | 380fa361709e82a81b049d640ea80ac397d84f68 (diff) |
Merge pull request #319405 from superherointj/fluxcd-by-name
fluxcd: refactor
Diffstat (limited to 'pkgs/applications/networking/cluster')
-rw-r--r-- | pkgs/applications/networking/cluster/fluxcd/default.nix | 79 | ||||
-rwxr-xr-x | pkgs/applications/networking/cluster/fluxcd/update.sh | 50 |
2 files changed, 0 insertions, 129 deletions
diff --git a/pkgs/applications/networking/cluster/fluxcd/default.nix b/pkgs/applications/networking/cluster/fluxcd/default.nix deleted file mode 100644 index 75689b47710fb..0000000000000 --- a/pkgs/applications/networking/cluster/fluxcd/default.nix +++ /dev/null @@ -1,79 +0,0 @@ -{ lib -, stdenv -, buildGoModule -, fetchFromGitHub -, fetchzip -, installShellFiles -}: - -let - version = "2.3.0"; - sha256 = "sha256-ZQs1rWI31qDo/BgjrmiNnEdR2OL8bUHVz+j5VceEp2k="; - manifestsSha256 = "sha256-PdhR+UDquIJWtpSymtT6V7qO5fVJOkFz6RGzAx7xeb4="; - - manifests = fetchzip { - url = - "https://github.com/fluxcd/flux2/releases/download/v${version}/manifests.tar.gz"; - sha256 = manifestsSha256; - stripRoot = false; - }; - -in buildGoModule rec { - pname = "fluxcd"; - inherit version; - - src = fetchFromGitHub { - owner = "fluxcd"; - repo = "flux2"; - rev = "v${version}"; - inherit sha256; - }; - - vendorHash = "sha256-0YH3pgFrsnh5jIsZpj/sIgfiOCTtIlPltMS5mdGz1eM="; - - postUnpack = '' - cp -r ${manifests} source/cmd/flux/manifests - - # disable tests that require network access - rm source/cmd/flux/create_secret_git_test.go - ''; - - ldflags = [ "-s" "-w" "-X main.VERSION=${version}" ]; - - subPackages = [ "cmd/flux" ]; - - # Required to workaround test error: - # panic: mkdir /homeless-shelter: permission denied - HOME = "$TMPDIR"; - - nativeBuildInputs = [ installShellFiles ]; - - doInstallCheck = true; - installCheckPhase = '' - $out/bin/flux --version | grep ${version} > /dev/null - ''; - - postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) '' - for shell in bash fish zsh; do - $out/bin/flux completion $shell > flux.$shell - installShellCompletion flux.$shell - done - ''; - - passthru.updateScript = ./update.sh; - - meta = with lib; { - description = - "Open and extensible continuous delivery solution for Kubernetes"; - longDescription = '' - Flux is a tool for keeping Kubernetes clusters in sync - with sources of configuration (like Git repositories), and automating - updates to configuration when there is new code to deploy. - ''; - homepage = "https://fluxcd.io"; - downloadPage = "https://github.com/fluxcd/flux2/releases/tag/v${version}"; - license = licenses.asl20; - maintainers = with maintainers; [ bryanasdev000 jlesquembre ]; - mainProgram = "flux"; - }; -} diff --git a/pkgs/applications/networking/cluster/fluxcd/update.sh b/pkgs/applications/networking/cluster/fluxcd/update.sh deleted file mode 100755 index 1763b37d33285..0000000000000 --- a/pkgs/applications/networking/cluster/fluxcd/update.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env nix-shell -#!nix-shell -i bash -p curl gnugrep gnused jq - -set -x -eu -o pipefail - -NIXPKGS_PATH="$(git rev-parse --show-toplevel)" -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//') - -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) - - setKV () { - sed -i "s|$1 = \".*\"|$1 = \"${2:-}\"|" "${FLUXCD_PATH}/default.nix" - } - - setKV version ${LATEST_VERSION} - setKV sha256 ${SHA256} - setKV manifestsSha256 ${SPEC_SHA256} - 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) - set -e - - if [ -n "${VENDOR_HASH:-}" ]; then - setKV vendorHash ${VENDOR_HASH} - else - echo "Update failed. VENDOR_HASH is empty." - exit 1 - fi - - # `git` flag here is to be used by local maintainers to speed up the bump process - if [ $# -eq 1 ] && [ "$1" = "git" ]; then - git switch -c "package-fluxcd-${LATEST_VERSION}" - git add "$FLUXCD_PATH"/default.nix - git commit -m "fluxcd: ${OLD_VERSION} -> ${LATEST_VERSION} - -Release: https://github.com/fluxcd/flux2/releases/tag/v${LATEST_VERSION}" - fi -else - echo "fluxcd is already up-to-date at $OLD_VERSION" -fi |