Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 installShellFiles,
6}:
7
8buildGoModule rec {
9 pname = "tektoncd-cli";
10 version = "0.41.1";
11
12 src = fetchFromGitHub {
13 owner = "tektoncd";
14 repo = "cli";
15 rev = "v${version}";
16 sha256 = "sha256-AxE7Dom40xL+f2VXz9zlAZYFfW/iCbR9EdHfuCu8z7M=";
17 };
18
19 vendorHash = null;
20
21 ldflags = [
22 "-s"
23 "-w"
24 "-X github.com/tektoncd/cli/pkg/cmd/version.clientVersion=${version}"
25 ];
26
27 nativeBuildInputs = [ installShellFiles ];
28
29 subPackages = [ "cmd/tkn" ];
30
31 preCheck = ''
32 # some tests try to write to the home dir
33 export HOME="$TMPDIR"
34
35 # run all tests
36 unset subPackages
37
38 # the tests expect the clientVersion ldflag not to be set
39 unset ldflags
40
41 # remove tests with networking
42 rm pkg/cmd/version/version_test.go
43 '';
44
45 postInstall = ''
46 installManPage docs/man/man1/*
47
48 installShellCompletion --cmd tkn \
49 --bash <($out/bin/tkn completion bash) \
50 --fish <($out/bin/tkn completion fish) \
51 --zsh <($out/bin/tkn completion zsh)
52 '';
53
54 doInstallCheck = true;
55 installCheckPhase = ''
56 runHook preInstallCheck
57 $out/bin/tkn --help
58 $out/bin/tkn version | grep "Client version: ${version}"
59 runHook postInstallCheck
60 '';
61
62 meta = {
63 homepage = "https://tekton.dev";
64 changelog = "https://github.com/tektoncd/cli/releases/tag/v${version}";
65 description = "Provides a CLI for interacting with Tekton - tkn";
66 longDescription = ''
67 The Tekton Pipelines cli project provides a CLI for interacting with
68 Tekton! For your convenience, it is recommended that you install the
69 Tekton CLI, tkn, together with the core component of Tekton, Tekton
70 Pipelines.
71 '';
72 license = lib.licenses.asl20;
73 maintainers = with lib.maintainers; [
74 jk
75 mstrangfeld
76 vdemeester
77 ];
78 mainProgram = "tkn";
79 };
80}