build: remove {sha256,md5} output for push-storage-object effects

This commit is contained in:
Brendan Hay 2020-11-05 13:19:09 +01:00 committed by Joe Bryan
parent e9cf0a3518
commit 767a6f85a4
3 changed files with 11 additions and 40 deletions

32
ci.nix
View File

@ -21,34 +21,18 @@ let
localLib = callPackage ./nix/lib { }; localLib = callPackage ./nix/lib { };
# The key with google storage bucket write permission, # The key with google storage bucket write permission,
# deployed to ci via nixops `deployment.keys."service-account.json"`. # deployed to ci via nixops deployment.keys."service-account.json".
serviceAccountKey = builtins.readFile serviceAccountKey = builtins.readFile
("/var/lib/hercules-ci-agent/secrets/service-account.json"); ("/var/lib/hercules-ci-agent/secrets/service-account.json");
# Push a derivation to a remote storage bucket as a post-build effect. # Filter out systems that this machine does not support.
pushObject = { name, drv, contentType ? "application/octet-stream" }:
localLib.pushStorageObject {
inherit name contentType serviceAccountKey;
bucket = "bootstrap.urbit.org";
object = "ci/${lib.removePrefix "/nix/store/" (toString drv)}";
file = drv.out;
};
# # Build and push a split output pill derivation with the ".pill" file extension.
# pushPill = name: pill:
# pushObject {
# inherit name;
# drv = pill.build;
# extension = "pill";
# };
systems = lib.filterAttrs (_: v: builtins.elem v supportedSystems) { systems = lib.filterAttrs (_: v: builtins.elem v supportedSystems) {
linux = "x86_64-linux"; linux = "x86_64-linux";
darwin = "x86_64-darwin"; darwin = "x86_64-darwin";
}; };
# Build the ci matrix for each of the supported systems, see finalPackages
# for the total set of attributes that will be evaluated per system.
in localLib.dimension "system" systems (systemName: system: in localLib.dimension "system" systems (systemName: system:
let let
dynamicPackages = import ./default.nix { dynamicPackages = import ./default.nix {
@ -90,9 +74,13 @@ in localLib.dimension "system" systems (systemName: system:
# Push the tarball to the google storage bucket for the current platform. # Push the tarball to the google storage bucket for the current platform.
release = let inherit (staticPackages) tarball; release = let inherit (staticPackages) tarball;
in pushObject { in localLib.pushStorageObject {
inherit serviceAccountKey;
bucket = "bootstrap.urbit.org";
object = "ci/${lib.removePrefix "/nix/store/" (toString tarball)}";
name = tarball.name; name = tarball.name;
drv = tarball; file = tarball.out;
contentType = "application/x-gtar"; contentType = "application/x-gtar";
}; };
}; };

View File

@ -13,10 +13,9 @@ let
in stdenvNoCC.mkDerivation { in stdenvNoCC.mkDerivation {
name = "${name}.${extension}"; name = "${name}.${extension}";
phases = [ "buildPhase" ];
outputs = [ "out" "hash" ];
nativeBuildInputs = [ coreutils ]; nativeBuildInputs = [ coreutils ];
phases = [ "buildPhase" "hashPhase" ];
buildPhase = '' buildPhase = ''
tar -vczf $out \ tar -vczf $out \
@ -27,14 +26,5 @@ in stdenvNoCC.mkDerivation {
${sources} ${sources}
''; '';
hashPhase = ''
mkdir $hash
md5sum $out | awk '{printf $1}' > $hash/md5
sha256sum $out | awk '{printf $1}' > $hash/sha256
'';
preferLocalBuild = true; preferLocalBuild = true;
meta = { inherit extension; };
} }

View File

@ -3,20 +3,13 @@
stdenvNoCC.mkDerivation { stdenvNoCC.mkDerivation {
name = "${name}.pill"; name = "${name}.pill";
src = pier; src = pier;
outputs = [ "out" "hash" ];
buildInputs = [ urbit herb ]; buildInputs = [ urbit herb ];
dontUnpack = true; dontUnpack = true;
buildPhase = builtins.readFile builder; buildPhase = builtins.readFile builder;
installPhase = '' installPhase = ''
mv ${name}.pill $out mv ${name}.pill $out
mkdir $hash
md5sum $out | awk '{printf $1}' > $hash/md5
sha256sum $out | awk '{printf $1}' > $hash/sha256
''; '';
ARVO = arvo; ARVO = arvo;