Unverified Commit 931847b7 authored by Emily's avatar Emily Committed by GitHub
Browse files

apko: 0.27.9 -> 0.29.1 (#421282)

parents b0c32af4 56eea691
Loading
Loading
Loading
Loading
+38 −29
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  buildGoModule,
  fetchFromGitHub,
  writableTmpDirAsHomeHook,
  installShellFiles,
  versionCheckHook,
  buildPackages,
}:

buildGoModule rec {
buildGoModule (finalAttrs: {
  pname = "apko";
  version = "0.27.9";
  version = "0.29.1";

  src = fetchFromGitHub {
    owner = "chainguard-dev";
    repo = pname;
    tag = "v${version}";
    hash = "sha256-ET/jzQ8sGQrxn9+3z6gOk57XTj9w9lJnwBK7c2n4s10=";
    repo = "apko";
    tag = "v${finalAttrs.version}";
    hash = "sha256-PRT29c7WqjkWR4hqzzz8ek5IytsS3ntDlPQ/tzpARCk=";
    # 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,14 +29,14 @@ buildGoModule rec {
      find "$out" -name .git -print0 | xargs -0 rm -rf
    '';
  };
  vendorHash = "sha256-zZwEdHZOPNCLpOgdV23ewOQhAkob8bcasUopwzXLtGk=";
  vendorHash = "sha256-j7f9cbcbX4PdaRxg5lare6aRz1B5lCfj2RSvs+XOfe4=";

  nativeBuildInputs = [ installShellFiles ];

  ldflags = [
    "-s"
    "-w"
    "-X sigs.k8s.io/release-utils/version.gitVersion=v${version}"
    "-X sigs.k8s.io/release-utils/version.gitVersion=v${finalAttrs.version}"
    "-X sigs.k8s.io/release-utils/version.gitTreeState=clean"
  ];

@@ -42,14 +46,17 @@ buildGoModule rec {
    ldflags+=" -X sigs.k8s.io/release-utils/version.buildDate=$(cat SOURCE_DATE_EPOCH)"
  '';

  preCheck = ''
    # some tests require a writable HOME
    export HOME=$(mktemp -d)
  nativeCheckInputs = [ writableTmpDirAsHomeHook ];

  # skip tests on darwin due to some local networking failures
  # `__darwinAllowLocalNetworking = true;` wasn't sufficient for
  # aarch64 or x86_64
  doCheck = !stdenv.isDarwin;
  preCheck = ''
    # some test data include SOURCE_DATE_EPOCH (which is different from our default)
    # and the default version info which we get by unsetting our ldflags
    export SOURCE_DATE_EPOCH=0
    ldflags=
    unset ldflags
  '';

  checkFlags = [
@@ -57,33 +64,35 @@ buildGoModule rec {
    "-skip=TestInitDB_ChainguardDiscovery"
  ];

  postInstall = ''
  postInstall =
    let
      apko =
        if stdenv.buildPlatform.canExecute stdenv.hostPlatform then
          placeholder "out"
        else
          buildPackages.apko;
    in
    ''
      installShellCompletion --cmd apko \
      --bash <($out/bin/apko completion bash) \
      --fish <($out/bin/apko completion fish) \
      --zsh <($out/bin/apko completion zsh)
        --bash <(${apko}/bin/apko completion bash) \
        --fish <(${apko}/bin/apko completion fish) \
        --zsh <(${apko}/bin/apko completion zsh)
    '';

  nativeCheckInstallInputs = [ versionCheckHook ];
  doInstallCheck = true;
  installCheckPhase = ''
    runHook preInstallCheck

    $out/bin/apko --help
    $out/bin/apko version 2>&1 | grep "v${version}"

    runHook postInstallCheck
  '';
  versionCheckProgramArg = "version";

  meta = with lib; {
  meta = {
    homepage = "https://apko.dev/";
    changelog = "https://github.com/chainguard-dev/apko/blob/main/NEWS.md";
    description = "Build OCI images using APK directly without Dockerfile";
    mainProgram = "apko";
    license = licenses.asl20;
    maintainers = with maintainers; [
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [
      jk
      developer-guy
      emilylange
    ];
  };
}
})
+0 −4
Original line number Diff line number Diff line
@@ -306,10 +306,6 @@ with pkgs;

  cve = with python3Packages; toPythonApplication cvelib;

  apko = callPackage ../development/tools/apko {
    buildGoModule = buildGo123Module;
  };

  basalt-monado = callPackage ../by-name/ba/basalt-monado/package.nix {
    tbb = tbb_2021;
    cereal = cereal_1_3_2;