about summary refs log tree commit diff
path: root/pkgs/by-name/ro/rosa/package.nix
blob: b9156afa9df81bc0344cd7ed4eb8ad3d941dd5eb (plain) (blame)
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
{ lib, buildGoModule, fetchFromGitHub, installShellFiles, testers, rosa, nix-update-script }:

buildGoModule rec {
  pname = "rosa";
  version = "1.2.38";

  src = fetchFromGitHub {
    owner = "openshift";
    repo = "rosa";
    rev = "v${version}";
    hash = "sha256-eS9mK5iK/fXWMpgA/RF7wYybcJtPDW/pIWo9Iw0I+K8=";
  };
  vendorHash = null;

  ldflags = [ "-s" "-w" ];

  __darwinAllowLocalNetworking = true;

  postPatch = ''
    # e2e tests require network access
    rm -r tests/e2e
  '';

  preCheck = ''
    # Workaround for cmd/list/rhRegion/cmd_test.go:39
    #   Failed to get OCM regions: Can't retrieve shards: Get "https://api.stage.openshift.com/static/ocm-shards.json": dial tcp: lookup api.stage.openshift.com on [::1]:53: read udp [::1]:55793->[::1]:53: read: connection refused
    substituteInPlace "cmd/list/rhRegion/cmd_test.go" \
      --replace-fail "TestRhRegionCommand" "SkipRhRegionCommand"
  '';

  nativeBuildInputs = [ installShellFiles ];
  postInstall = ''
    installShellCompletion --cmd rosa \
      --bash <($out/bin/rosa completion bash) \
      --fish <($out/bin/rosa completion fish) \
      --zsh <($out/bin/rosa completion zsh)
  '';

  passthru = {
    tests.version = testers.testVersion {
      package = rosa;
      command = "rosa version --client";
    };
    updateScript = nix-update-script { };
  };

  meta = with lib; {
    description = "CLI for the Red Hat OpenShift Service on AWS";
    license = licenses.asl20;
    homepage = "https://github.com/openshift/rosa";
    maintainers = with maintainers; [ jfchevrette ];
  };
}