blob: 93083f9d2b19c98a0087a8e75fd9929bcf22281c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
installShellFiles,
testers,
ocm,
}:
buildGoModule (finalAttrs: {
pname = "ocm";
version = "1.0.15";
src = fetchFromGitHub {
owner = "openshift-online";
repo = "ocm-cli";
rev = "v${finalAttrs.version}";
sha256 = "sha256-/WSWifl5UH34d2/I/874ZTHzJwI0QyoXq5QGuz4dzZE=";
};
vendorHash = "sha256-1+H2DoSsPqg6JXWLVFyQ4eBTU3EqySTA2fe9BBWbjMg=";
# Strip the final binary.
ldflags = [
"-s"
"-w"
];
nativeBuildInputs = [ installShellFiles ];
# Tests expect the binary to be located in the root directory.
preCheck = ''
ln -s $GOPATH/bin/ocm ocm
'';
checkFlags = [
# Disable integration tests which require networking and gnupg which has issues in the sandbox
"-skip=^TestCLI$"
];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd ocm \
--bash <($out/bin/ocm completion bash) \
--fish <($out/bin/ocm completion fish) \
--zsh <($out/bin/ocm completion zsh)
'';
passthru.tests.version = testers.testVersion {
package = ocm;
command = "ocm version";
};
meta = {
description = "CLI for the Red Hat OpenShift Cluster Manager";
mainProgram = "ocm";
license = lib.licenses.asl20;
homepage = "https://github.com/openshift-online/ocm-cli";
maintainers = with lib.maintainers; [
stehessel
jfchevrette
];
};
})
|