Unverified Commit 1aa8138f authored by Peder Bergebakken Sundt's avatar Peder Bergebakken Sundt Committed by GitHub
Browse files

starboard: 0.15.25 -> 0.15.26 (#419851)

parents 94618b01 8789d7a1
Loading
Loading
Loading
Loading
+20 −16
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  buildGoModule,
  fetchFromGitHub,
  installShellFiles,
  versionCheckHook,
}:

buildGoModule rec {
buildGoModule (finalAttrs: {
  pname = "starboard";
  version = "0.15.25";
  version = "0.15.26";

  __darwinAllowLocalNetworking = true; # for tests

  src = fetchFromGitHub {
    owner = "aquasecurity";
    repo = "starboard";
    rev = "v${version}";
    hash = "sha256-mCYnJ1SFa3OuYQlPWTq9vWV9s/jtaQ6dOousV/UNR18=";
    rev = "v${finalAttrs.version}";
    hash = "sha256-yQ4ABzN8EvD5qs0yjTaihM145K79LglprC2nlqAw0XU=";
    # 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;
@@ -25,7 +29,7 @@ buildGoModule rec {
      find "$out" -name .git -print0 | xargs -0 rm -rf
    '';
  };
  vendorHash = "sha256-qujObGBxUFGxtrdlJmTOTW6HUbDCjNSElPqhQfYqId4=";
  vendorHash = "sha256-6SqghCM2dwNyosZo0wfMMHlgrgY+Ts+7lIN7+qSp0GI=";

  nativeBuildInputs = [ installShellFiles ];

@@ -34,18 +38,22 @@ buildGoModule rec {
  ldflags = [
    "-s"
    "-w"
    "-X main.version=v${version}"
    "-X main.version=v${finalAttrs.version}"
  ];

  # ldflags based on metadata from git and source
  preBuild = ''
    ldflags+=" -X main.gitCommit=$(cat COMMIT)"
    ldflags+=" -X main.buildDate=$(cat SOURCE_DATE_EPOCH)"
    ldflags+=" -X main.commit=$(cat COMMIT)"
    ldflags+=" -X main.date=$(cat SOURCE_DATE_EPOCH)"
  '';

  preCheck = ''
    # Remove test that requires networking
    rm pkg/plugin/aqua/client/client_integration_test.go
    ${lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) ''
      # Remove "[It] should make a request to fetch registries" test that fails on x86_64-darwin
      rm pkg/plugin/aqua/client/client_test.go
    ''}

    # Feed in all but the integration tests for testing
    # This is because subPackages above limits what is built to just what we
@@ -62,17 +70,13 @@ buildGoModule rec {
      --zsh <($out/bin/starboard completion zsh)
  '';

  nativeInstallCheckInputs = [ versionCheckHook ];
  doInstallCheck = true;
  installCheckPhase = ''
    runHook preInstallCheck
    $out/bin/starboard --help
    $out/bin/starboard version | grep "v${version}"
    runHook postInstallCheck
  '';
  versionCheckProgramArg = "version";

  meta = {
    homepage = "https://github.com/aquasecurity/starboard";
    changelog = "https://github.com/aquasecurity/starboard/releases/tag/v${version}";
    changelog = "https://github.com/aquasecurity/starboard/releases/tag/v${finalAttrs.version}";
    description = "Kubernetes-native security tool kit";
    mainProgram = "starboard";
    longDescription = ''
@@ -87,4 +91,4 @@ buildGoModule rec {
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ jk ];
  };
}
})