Skip to content

Commit

Permalink
hydra: only build pr jobset to avoid duplicates builds
Browse files Browse the repository at this point in the history
 of dockerImages, etc.
  • Loading branch information
jbgi committed Mar 1, 2023
1 parent 3b21b2d commit 176d773
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
27 changes: 16 additions & 11 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -357,13 +357,7 @@
{
inherit ciJobs;
nonRequiredPaths = map (r: p: builtins.match r p != null) nonRequiredPaths;
} // ciJobs // {
pr = {
# We use a generic gitrev for PR CI to avoid unecessary rebuilds:
inherit ((mkFlakeAttrs (pkgs.extend (prev: final: { gitrev = "0000000000000000000000000000000000000000"; }))).ciJobs)
required nonrequired;
};
};
} // ciJobs;
};

flake = eachSystem supportedSystems (system:
Expand All @@ -378,14 +372,18 @@
inherit config system overlays;
};
inherit (mkFlakeAttrs pkgs) environments packages checks apps project ciJobs devShells workbench;
# We use a generic gitrev for PR CI to avoid unecessary rebuilds:
ciJobsPrs = (mkFlakeAttrs (pkgs.extend (prev: final: { gitrev = "0000000000000000000000000000000000000000"; }))).ciJobs;
in
{

inherit environments checks project ciJobs devShells workbench;
inherit environments checks project ciJobsPrs devShells workbench;

legacyPackages = pkgs // {
# allows access to hydraJobs without specifying <arch>:
hydraJobs = ciJobs;
hydraJobs = ciJobs // {
pr = ciJobsPrs;
};
};

packages = packages // {
Expand All @@ -403,9 +401,16 @@
);

in
removeAttrs flake [ "ciJobs" ] // {
removeAttrs flake [ "ciJobsPrs" ] // {

hydraJobs = flake.ciJobs;
hydraJobs = flake.ciJobsPrs // (let pkgs = self.legacyPackages.${defaultSystem}; in {
inherit (pkgs.callPackages iohkNix.utils.ciJobsAggregates {
ciJobs = lib.mapAttrs (_: lib.getAttr "required") flake.ciJobsPrs // {
# ensure hydra notify:
gitrev = pkgs.writeText "gitrev" pkgs.gitrev;
};
}) required;
});

# allows precise paths (avoid fallbacks) with nix build/eval:
outputs = self;
Expand Down
4 changes: 2 additions & 2 deletions nix/tullia.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ rec {

command.text = config.preset.github.status.lib.reportBulk {
bulk.text = ''
nix eval .#outputs.hydraJobs --apply __attrNames --json |
nix eval .#legacyPackages --apply __attrNames --json |
nix-systems -i |
jq 'with_entries(select(.value))' # filter out systems that we cannot build for
'';
each.text = ''nix build -L .#hydraJobs."$1".${jobsAttrs}'';
each.text = ''nix build -L .#legacyPackages."$1".hydraJobs.${jobsAttrs}'';
skippedDescription = lib.escapeShellArg "No nix builder available for this system";
};

Expand Down

0 comments on commit 176d773

Please sign in to comment.