1{ lib
2, buildGoModule
3, fetchFromGitHub
4, installShellFiles
5, testers
6, datree
7}:
8
9buildGoModule rec {
10 pname = "datree";
11 version = "1.9.3";
12
13 src = fetchFromGitHub {
14 owner = "datreeio";
15 repo = "datree";
16 rev = "refs/tags/${version}";
17 hash = "sha256-tf/1BJ23EpFjdHYNQJMben6CEAsZ9cvLoyI6BVn6roo=";
18 };
19
20 vendorHash = "sha256-ECVKofvmLuFAFvncq63hYUaYW8/2+F4gZr8wIGQyrdU=";
21
22 nativeBuildInputs = [ installShellFiles ];
23
24 ldflags = [
25 "-s"
26 "-w"
27 "-X github.com/datreeio/datree/cmd.CliVersion=${version}"
28 ];
29
30 tags = [ "main" ];
31
32 postInstall = ''
33 installShellCompletion \
34 --cmd datree \
35 --bash <($out/bin/datree completion bash) \
36 --fish <($out/bin/datree completion fish) \
37 --zsh <($out/bin/datree completion zsh)
38 '';
39
40 passthru.tests.version = testers.testVersion {
41 package = datree;
42 command = "datree version";
43 };
44
45 meta = with lib; {
46 description = "CLI tool to ensure K8s manifests and Helm charts follow best practices";
47 longDescription = ''
48 Datree provides an E2E policy enforcement solution to run automatic checks
49 for rule violations. Datree can be used on the command line, admission
50 webhook, or even as a kubectl plugin to run policies against Kubernetes
51 objects.
52 '';
53 homepage = "https://datree.io/";
54 changelog = "https://github.com/datreeio/datree/releases/tag/${version}";
55 license = licenses.asl20;
56 maintainers = with maintainers; [ azahi jceb ];
57 };
58}