NixOS / nixos-channel-scripts

33 stars 28 forks source link

hydra jobsetevals is sorted assending #18

Open twhitehead opened 6 years ago

twhitehead commented 6 years ago

@edolstra Was trying to figure out why a script I wrote based on mirror-nixos-branch wasn't working. Finally tracked it down to the fact that that the jobsetevals attribute is sorted in ascending order.

This means that this code

my $evalId = $releaseInfo->{jobsetevals}->[0] or die;

references the oldest jobseteval and not the newest.

You can see this here via the following curl request to our hydra server. The official nixos one seems to rarely have more than one evaluation on tap, so this is harder to see (and catch) on it.

curl -LH "Accept: application/json" https://hydra.sharcnet.ca/job/ccpkgs/ccpkgs-17.09/tested/latest-finished
{"jobset":"ccpkgs-17.09"
,"id":125368
,"buildmetrics":{}
,"timestamp":1529286374
,"buildstatus":0
,"system":"x86_64-linux"
,"stoptime":1529532645
,"nixname":"ccpkgs-17.09"
,"releasename":null
,"buildoutputs":
  {"out":{"path":"/nix/store/xbkrm8jvd92w96skjjfs7140ib17yrib-ccpkgs-17.09"}}
,"starttime":1529532645
,"finished":1
,"project":"ccpkgs"
,"drvpath":"/nix/store/0lb0qv0wagxb7w3a9dbnq7qmjlwll93b-ccpkgs-17.09.drv"
,"jobsetevals":[101,107]
,"job":"tested"
,"priority":100
,"buildproducts":{}
}
edolstra commented 4 years ago

Hm, tricky. I think selecting the oldest one may actually be better because it's stable (we won't create a new release if the release job didn't change). For the NixOS/Nixpkgs jobsets, we ensure that the release job changes on every commit by including the revision in the release job's name attribute.