2022-01-21 16:40:54 +00:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
|
2020-10-13 12:50:55 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "starboard";
|
2022-01-28 17:22:47 +00:00
|
|
|
version = "0.14.1";
|
2020-10-13 12:50:55 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "aquasecurity";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2022-01-28 17:22:47 +00:00
|
|
|
sha256 = "sha256-sB7C0IKadgpQ2h6HuH4D6ku/GXnFfFS+fGCW/RBSc10=";
|
2022-01-21 16:40:54 +00:00
|
|
|
# populate values that require us to use git. By doing this in postFetch we
|
|
|
|
# can delete .git afterwards and maintain better reproducibility of the src.
|
|
|
|
leaveDotGit = true;
|
|
|
|
postFetch = ''
|
|
|
|
cd "$out"
|
|
|
|
commit="$(git rev-parse HEAD)"
|
|
|
|
source_date_epoch=$(git log --date=format:'%Y-%m-%dT%H:%M:%SZ' -1 --pretty=%ad)
|
|
|
|
substituteInPlace "$out/cmd/starboard/main.go" \
|
|
|
|
--replace 'commit = "none"' "commit = \"$commit\"" \
|
|
|
|
--replace 'date = "unknown"' "date = \"$source_date_epoch\""
|
|
|
|
find "$out" -name .git -print0 | xargs -0 rm -rf
|
|
|
|
'';
|
2020-10-13 12:50:55 +00:00
|
|
|
};
|
2022-01-28 17:22:47 +00:00
|
|
|
vendorSha256 = "sha256-R7tF724y5WNIByE+9nRoNSZDZzfLtPfK/9tSBkARaN0=";
|
2020-10-13 12:50:55 +00:00
|
|
|
|
2022-01-21 16:40:54 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
2020-10-14 21:09:22 +00:00
|
|
|
|
2022-01-21 16:40:54 +00:00
|
|
|
subPackages = [ "cmd/starboard" ];
|
2020-10-13 12:50:55 +00:00
|
|
|
|
2021-08-21 08:23:47 +00:00
|
|
|
ldflags = [
|
|
|
|
"-s" "-w" "-X main.version=v${version}"
|
|
|
|
];
|
2020-10-13 12:50:55 +00:00
|
|
|
|
2021-06-04 12:39:07 +00:00
|
|
|
preCheck = ''
|
|
|
|
# Remove test that requires networking
|
|
|
|
rm pkg/plugin/aqua/client/client_integration_test.go
|
2022-01-21 16:40:54 +00:00
|
|
|
|
|
|
|
# Feed in all but the integration tests for testing
|
|
|
|
# This is because subPackages above limits what is built to just what we
|
|
|
|
# want but also limits the tests
|
|
|
|
getGoDirs() {
|
|
|
|
go list ./... | grep -v itest
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --cmd starboard \
|
|
|
|
--bash <($out/bin/starboard completion bash) \
|
|
|
|
--fish <($out/bin/starboard completion fish) \
|
|
|
|
--zsh <($out/bin/starboard completion zsh)
|
2021-06-04 12:39:07 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
$out/bin/starboard --help
|
|
|
|
$out/bin/starboard version | grep "v${version}"
|
|
|
|
runHook postInstallCheck
|
|
|
|
'';
|
2020-10-13 12:50:55 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
2021-06-04 12:39:07 +00:00
|
|
|
homepage = "https://github.com/aquasecurity/starboard";
|
|
|
|
changelog = "https://github.com/aquasecurity/starboard/releases/tag/v${version}";
|
2020-10-13 12:50:55 +00:00
|
|
|
description = "Kubernetes-native security tool kit";
|
|
|
|
longDescription = ''
|
|
|
|
Starboard integrates security tools into the Kubernetes environment, so
|
|
|
|
that users can find and view the risks that relate to different resources
|
|
|
|
in a Kubernetes-native way. Starboard provides custom security resources
|
|
|
|
definitions and a Go module to work with a range of existing security
|
|
|
|
tools, as well as a kubectl-compatible command-line tool and an Octant
|
|
|
|
plug-in that make security reports available through familiar Kubernetes
|
|
|
|
tools.
|
|
|
|
'';
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ jk ];
|
|
|
|
};
|
|
|
|
}
|