Ensure that the channel doesn't go back in time

This can happen when builds are restarted, causing the "latest
finished evaluation" to point to an older evaluation.
This commit is contained in:
Eelco Dolstra 2015-09-02 11:16:51 +02:00
parent 87ccf9de70
commit a441c018e2

View file

@ -32,6 +32,16 @@ releaseDir=$releasesDir/$release
echo "release is $release (build $releaseId), eval is $url, dir is $releaseDir" >&2 echo "release is $release (build $releaseId), eval is $url, dir is $releaseDir" >&2
curRelease=$(basename $(readlink $channelsDir/$channelName 2> /dev/null) 2> /dev/null || true)
if [ -n "$curRelease" ]; then
d="$(nix-instantiate --eval -E "builtins.compareVersions (builtins.parseDrvName \"$curRelease\").version (builtins.parseDrvName \"$release\").version")"
if [ "$d" = 1 ]; then
echo "channel would go back in time from $curRelease to $release, bailing out" >&2
exit 1
fi
fi
# Figure out the Git revision from which this release was # Figure out the Git revision from which this release was
# built. FIXME: get this from Hydra directly. # built. FIXME: get this from Hydra directly.
shortRev=$(echo "$release" | sed 's/.*\.//') shortRev=$(echo "$release" | sed 's/.*\.//')