mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 07:53:19 +00:00
Merge pull request #140286 from superherointj/package-linkerd-updateScript
This commit is contained in:
commit
fcadfea45c
@ -1,71 +1,8 @@
|
||||
{ lib, fetchFromGitHub, buildGoModule, installShellFiles }:
|
||||
{ callPackage }:
|
||||
|
||||
let generic = { channel, version, sha256, vendorSha256 }:
|
||||
buildGoModule rec {
|
||||
pname = "linkerd-${channel}";
|
||||
inherit version vendorSha256;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "linkerd";
|
||||
repo = "linkerd2";
|
||||
rev = "${channel}-${version}";
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
subPackages = [ "cli" ];
|
||||
runVend = true;
|
||||
|
||||
preBuild = ''
|
||||
env GOFLAGS="" go generate ./pkg/charts/static
|
||||
env GOFLAGS="" go generate ./jaeger/static
|
||||
env GOFLAGS="" go generate ./multicluster/static
|
||||
env GOFLAGS="" go generate ./viz/static
|
||||
'';
|
||||
|
||||
tags = [
|
||||
"prod"
|
||||
];
|
||||
|
||||
ldflags = [
|
||||
"-s" "-w"
|
||||
"-X github.com/linkerd/linkerd2/pkg/version.Version=${src.rev}"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
|
||||
postInstall = ''
|
||||
mv $out/bin/cli $out/bin/linkerd
|
||||
installShellCompletion --cmd linkerd \
|
||||
--bash <($out/bin/linkerd completion bash) \
|
||||
--zsh <($out/bin/linkerd completion zsh) \
|
||||
--fish <($out/bin/linkerd completion fish)
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
installCheckPhase = ''
|
||||
$out/bin/linkerd version --client | grep ${src.rev} > /dev/null
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A simple Kubernetes service mesh that improves security, observability and reliability";
|
||||
downloadPage = "https://github.com/linkerd/linkerd2/";
|
||||
homepage = "https://linkerd.io/";
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ Gonzih bryanasdev000 superherointj ];
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
stable = generic {
|
||||
channel = "stable";
|
||||
version = "2.10.2";
|
||||
sha256 = "sha256-dOD0S4FJ2lXE+1VZooi8tKvC8ndGEHAxmAvSqoWI/m0=";
|
||||
vendorSha256 = "sha256-Qb0FZOvKL9GgncfUl538PynkYbm3V8Q6lUpApUoIp5s=";
|
||||
};
|
||||
edge = generic {
|
||||
channel = "edge";
|
||||
version = "21.9.3";
|
||||
sha256 = "0swqx4myvr24visj39icg8g90kj325pvf22bq447rnm0whq3cnyz";
|
||||
vendorSha256 = "sha256-fMtAR66TwMNR/HCVQ9Jg3sJ0XBx2jUKDG7/ts0lEZM4=";
|
||||
};
|
||||
}
|
||||
(callPackage ./generic.nix { }) {
|
||||
channel = "stable";
|
||||
version = "2.10.2";
|
||||
sha256 = "sha256-dOD0S4FJ2lXE+1VZooi8tKvC8ndGEHAxmAvSqoWI/m0=";
|
||||
vendorSha256 = "sha256-Qb0FZOvKL9GgncfUl538PynkYbm3V8Q6lUpApUoIp5s=";
|
||||
}
|
||||
|
8
pkgs/applications/networking/cluster/linkerd/edge.nix
Normal file
8
pkgs/applications/networking/cluster/linkerd/edge.nix
Normal file
@ -0,0 +1,8 @@
|
||||
{ callPackage }:
|
||||
|
||||
(callPackage ./generic.nix { }) {
|
||||
channel = "edge";
|
||||
version = "21.9.3";
|
||||
sha256 = "0swqx4myvr24visj39icg8g90kj325pvf22bq447rnm0whq3cnyz";
|
||||
vendorSha256 = "sha256-fMtAR66TwMNR/HCVQ9Jg3sJ0XBx2jUKDG7/ts0lEZM4=";
|
||||
}
|
59
pkgs/applications/networking/cluster/linkerd/generic.nix
Normal file
59
pkgs/applications/networking/cluster/linkerd/generic.nix
Normal file
@ -0,0 +1,59 @@
|
||||
{ lib, fetchFromGitHub, buildGoModule, installShellFiles }:
|
||||
|
||||
{ channel, version, sha256, vendorSha256 }:
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "linkerd-${channel}";
|
||||
inherit version vendorSha256;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "linkerd";
|
||||
repo = "linkerd2";
|
||||
rev = "${channel}-${version}";
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
subPackages = [ "cli" ];
|
||||
runVend = true;
|
||||
|
||||
preBuild = ''
|
||||
env GOFLAGS="" go generate ./pkg/charts/static
|
||||
env GOFLAGS="" go generate ./jaeger/static
|
||||
env GOFLAGS="" go generate ./multicluster/static
|
||||
env GOFLAGS="" go generate ./viz/static
|
||||
'';
|
||||
|
||||
tags = [
|
||||
"prod"
|
||||
];
|
||||
|
||||
ldflags = [
|
||||
"-s" "-w"
|
||||
"-X github.com/linkerd/linkerd2/pkg/version.Version=${src.rev}"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
|
||||
postInstall = ''
|
||||
mv $out/bin/cli $out/bin/linkerd
|
||||
installShellCompletion --cmd linkerd \
|
||||
--bash <($out/bin/linkerd completion bash) \
|
||||
--zsh <($out/bin/linkerd completion zsh) \
|
||||
--fish <($out/bin/linkerd completion fish)
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
installCheckPhase = ''
|
||||
$out/bin/linkerd version --client | grep ${src.rev} > /dev/null
|
||||
'';
|
||||
|
||||
passthru.updateScript = (./. + "/update-${channel}.sh");
|
||||
|
||||
meta = with lib; {
|
||||
description = "A simple Kubernetes service mesh that improves security, observability and reliability";
|
||||
downloadPage = "https://github.com/linkerd/linkerd2/";
|
||||
homepage = "https://linkerd.io/";
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ Gonzih bryanasdev000 superherointj ];
|
||||
};
|
||||
}
|
35
pkgs/applications/networking/cluster/linkerd/update-edge.sh
Executable file
35
pkgs/applications/networking/cluster/linkerd/update-edge.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl gnugrep gnused jq
|
||||
|
||||
set -eu -o pipefail
|
||||
|
||||
cd $(dirname "$0")
|
||||
|
||||
TAG=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} \
|
||||
--silent https://api.github.com/repos/linkerd/linkerd2/releases | \
|
||||
jq 'map(.tag_name)' | grep edge | sed 's/["|,| ]//g' | sort -r | head -n1)
|
||||
|
||||
VERSION=$(echo ${TAG} | sed 's/^edge-//')
|
||||
|
||||
SHA256=$(nix-prefetch-url --quiet --unpack https://github.com/linkerd/linkerd2/archive/refs/tags/${TAG}.tar.gz)
|
||||
|
||||
setKV () {
|
||||
sed -i "s|$1 = \".*\"|$1 = \"$2\"|" ./edge.nix
|
||||
}
|
||||
|
||||
setKV version ${VERSION}
|
||||
setKV sha256 ${SHA256}
|
||||
setKV vendorSha256 "" # Necessary to force clean build.
|
||||
|
||||
cd ../../../../../
|
||||
set +e
|
||||
VENDOR_SHA256=$(nix-build --no-out-link -A linkerd_edge 2>&1 | grep "got:" | cut -d':' -f2 | sed 's| ||g')
|
||||
set -e
|
||||
|
||||
if [ -n "${VENDOR_SHA256:-}" ]; then
|
||||
cd - > /dev/null
|
||||
setKV vendorSha256 ${VENDOR_SHA256}
|
||||
else
|
||||
echo "Update failed. VENDOR_SHA256 is empty."
|
||||
exit 1
|
||||
fi
|
35
pkgs/applications/networking/cluster/linkerd/update-stable.sh
Executable file
35
pkgs/applications/networking/cluster/linkerd/update-stable.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl gnugrep gnused jq
|
||||
|
||||
set -eu -o pipefail
|
||||
|
||||
cd $(dirname "$0")
|
||||
|
||||
TAG=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} \
|
||||
--silent https://api.github.com/repos/linkerd/linkerd2/releases/latest | \
|
||||
jq -r '.tag_name')
|
||||
|
||||
VERSION=$(echo ${TAG} | sed 's/^stable-//')
|
||||
|
||||
SHA256=$(nix-prefetch-url --quiet --unpack https://github.com/linkerd/linkerd2/archive/refs/tags/${TAG}.tar.gz)
|
||||
|
||||
setKV () {
|
||||
sed -i "s|$1 = \".*\"|$1 = \"$2\"|" ./default.nix
|
||||
}
|
||||
|
||||
setKV version ${VERSION}
|
||||
setKV sha256 ${SHA256}
|
||||
setKV vendorSha256 "" # Necessary to force clean build.
|
||||
|
||||
cd ../../../../../
|
||||
set +e
|
||||
VENDOR_SHA256=$(nix-build --no-out-link -A linkerd 2>&1 | grep "got:" | cut -d':' -f2 | sed 's| ||g')
|
||||
set -e
|
||||
|
||||
if [ -n "${VENDOR_SHA256:-}" ]; then
|
||||
cd - > /dev/null
|
||||
setKV vendorSha256 ${VENDOR_SHA256}
|
||||
else
|
||||
echo "Update failed. VENDOR_SHA256 is empty."
|
||||
exit 1
|
||||
fi
|
@ -25651,9 +25651,9 @@ with pkgs;
|
||||
|
||||
fluxcd = callPackage ../applications/networking/cluster/fluxcd { };
|
||||
|
||||
linkerd_edge = (callPackage ../applications/networking/cluster/linkerd { }).edge;
|
||||
linkerd_stable = (callPackage ../applications/networking/cluster/linkerd { }).stable;
|
||||
linkerd = linkerd_stable;
|
||||
linkerd = callPackage ../applications/networking/cluster/linkerd { };
|
||||
linkerd_edge = callPackage ../applications/networking/cluster/linkerd/edge.nix { };
|
||||
linkerd_stable = linkerd;
|
||||
|
||||
kile-wl = callPackage ../applications/misc/kile-wl { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user