blob: 7a84d52232bdc3396c7ee2514946c904dc2e9406 (
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
{
stdenv,
lib,
buildGoModule,
fetchFromGitHub,
pcsclite,
pkg-config,
installShellFiles,
pivKeySupport ? true,
pkcs11Support ? true,
testers,
}:
buildGoModule (finalAttrs: {
pname = "cosign";
version = "3.1.3";
src = fetchFromGitHub {
owner = "sigstore";
repo = "cosign";
rev = "v${finalAttrs.version}";
hash = "sha256-6YgCEeDwjNNMMh1tE/DUbScR7ZYf+FNMhFs+q7b0MuM=";
};
buildInputs = lib.optional (stdenv.hostPlatform.isLinux && pivKeySupport) (lib.getDev pcsclite);
nativeBuildInputs = [
pkg-config
installShellFiles
];
vendorHash = "sha256-1ouPW3HBjyTB2qRg7DNNLs5eO8UF1UKJLYPPNfJX4NU=";
subPackages = [
"cmd/cosign"
];
tags =
[ ] ++ lib.optionals pivKeySupport [ "pivkey" ] ++ lib.optionals pkcs11Support [ "pkcs11key" ];
ldflags = [
"-s"
"-w"
"-X sigs.k8s.io/release-utils/version.gitVersion=v${finalAttrs.version}"
"-X sigs.k8s.io/release-utils/version.gitTreeState=clean"
];
__darwinAllowLocalNetworking = true;
preCheck = ''
# test all paths
unset subPackages
'';
checkFlags =
let
# Skip tests that require network access
skippedTests = [
"TestLoadCertsKeylessVerification/default_fulcio"
"TestGetCTLogPubKeys"
"TestGetRekorPubKeys"
"TestVerifyEmbeddedSCT"
"TestValidateAndUnpackCertWithSCT"
"TestVerifySkWithoutIdentities"
"TestVerifyAttestationSkWithoutIdentities"
];
in
[ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd cosign \
--bash <($out/bin/cosign completion bash) \
--fish <($out/bin/cosign completion fish) \
--zsh <($out/bin/cosign completion zsh)
'';
passthru.tests.version = testers.testVersion {
package = finalAttrs.finalPackage;
command = "cosign version";
version = "v${finalAttrs.version}";
};
meta = {
homepage = "https://github.com/sigstore/cosign";
changelog = "https://github.com/sigstore/cosign/releases/tag/v${finalAttrs.version}";
description = "Container Signing CLI with support for ephemeral keys and Sigstore signing";
mainProgram = "cosign";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [
lesuisse
jk
developer-guy
];
};
})
|