forked from mirrors/nixpkgs
Merge pull request #156074 from 06kellyjac/starboard
This commit is contained in:
commit
25ace3e196
|
@ -1,20 +1,32 @@
|
|||
{ lib, buildGoModule, fetchFromGitHub }:
|
||||
{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "starboard";
|
||||
version = "0.12.0";
|
||||
version = "0.14.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "aquasecurity";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-6QIQsxqTKERo5x2Knv4IBeNt5KjvfoW0ryFJLlALqrA=";
|
||||
sha256 = "sha256-/k9lQS3oPOYxhaaXuaDwPnai7byDkge4yBu7/9g4RUE=";
|
||||
# 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
|
||||
'';
|
||||
};
|
||||
vendorSha256 = "sha256-7SVEyyJRE7oYIhuENraZy0aieIAoFFWtq4mrSXxURlQ=";
|
||||
|
||||
vendorSha256 = "sha256-r6wMSeW5Et6hYwoEKufmcOmucuHlYuBDOMuXXMT4W2Y=";
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
|
||||
# Don't build and check the integration tests
|
||||
excludedPackages = "itest";
|
||||
subPackages = [ "cmd/starboard" ];
|
||||
|
||||
ldflags = [
|
||||
"-s" "-w" "-X main.version=v${version}"
|
||||
|
@ -23,6 +35,20 @@ buildGoModule rec {
|
|||
preCheck = ''
|
||||
# Remove test that requires networking
|
||||
rm pkg/plugin/aqua/client/client_integration_test.go
|
||||
|
||||
# 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)
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
|
|
Loading…
Reference in a new issue