fix github pulls json to be deterministic

This commit is contained in:
michael bishop 2017-06-21 09:35:26 -03:00
parent f0d24af940
commit 6e4a7a30f7
No known key found for this signature in database
GPG key ID: C294FC1A485A409A
2 changed files with 3 additions and 2 deletions

View file

@ -341,7 +341,7 @@ in
{ wantedBy = [ "multi-user.target" ]; { wantedBy = [ "multi-user.target" ];
requires = [ "hydra-init.service" ]; requires = [ "hydra-init.service" ];
after = [ "hydra-init.service" "network.target" ]; after = [ "hydra-init.service" "network.target" ];
path = [ pkgs.nettools cfg.package ]; path = with pkgs; [ nettools cfg.package jq ];
environment = env; environment = env;
serviceConfig = serviceConfig =
{ ExecStart = "@${cfg.package}/bin/hydra-evaluator hydra-evaluator"; { ExecStart = "@${cfg.package}/bin/hydra-evaluator hydra-evaluator";

View file

@ -55,7 +55,8 @@ sub fetchInput {
open(my $fh, ">", $filename) or die "Cannot open $filename for writing: $!"; open(my $fh, ">", $filename) or die "Cannot open $filename for writing: $!";
print $fh encode_json \%pulls; print $fh encode_json \%pulls;
close $fh; close $fh;
my $storePath = `nix-store --add "$filename"` system("jq -S . < $filename > $tempdir/github-pulls-sorted.json");
my $storePath = `nix-store --add "$tempdir/github-pulls-sorted.json"`
or die "cannot copy path $filename to the Nix store.\n"; or die "cannot copy path $filename to the Nix store.\n";
my $timestamp = time; my $timestamp = time;
return { storePath => $storePath, revision => strftime "%Y%m%d%H%M%S", gmtime($timestamp) }; return { storePath => $storePath, revision => strftime "%Y%m%d%H%M%S", gmtime($timestamp) };