kyverno-chainsaw: add shell completion, version test, update script

This commit is contained in:
superherointj 2024-07-13 13:22:56 -03:00
parent 4c68bf5473
commit 636277d59d

View File

@ -1,4 +1,13 @@
{ lib, buildGoModule, fetchFromGitHub }:
{
buildGoModule,
fetchFromGitHub,
installShellFiles,
kyverno-chainsaw,
lib,
nix-update-script,
stdenv,
testers,
}:
buildGoModule rec {
pname = "kyverno-chainsaw";
@ -14,14 +23,32 @@ buildGoModule rec {
vendorHash = "sha256-UQCn5GKhhfHsHIOqYYVkKP76e2NTRtwjw2VvCwRPUB4=";
ldflags = [
"-s" "-w"
"-s"
"-w"
"-X github.com/kyverno/chainsaw/pkg/version.BuildVersion=v${version}"
"-X github.com/kyverno/chainsaw/pkg/version.BuildHash=${version}"
"-X github.com/kyverno/chainsaw/pkg/version.BuildTime=1970-01-01_00:00:00"
];
nativeBuildInputs = [ installShellFiles ];
doCheck = false; # requires running kubernetes
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
for shell in bash fish zsh; do
installShellCompletion --cmd kyverno-chainsaw \
--$shell <($out/bin/chainsaw completion $shell)
done
'';
passthru.tests.version = testers.testVersion {
package = kyverno-chainsaw;
command = "chainsaw version";
version = "v${version}";
};
passthru.updateScript = nix-update-script { };
meta = {
changelog = "https://github.com/kyverno/chainsaw/releases/tag/v${version}";
description = "Declarative approach to test Kubernetes operators and controllers";