fix build-to-cachix
- Don't fail on `kill $cachixPid` when cachix has already exited. This fixes some failing CI builds. - Stop the cachix background worker before the final `cachix push`. This can avoid unneeded reuploads. Use the coreutils version of tail on cirrus which supports argument --pid.
This commit is contained in:
parent
58a88619ae
commit
9a67a32779
@ -39,4 +39,4 @@ task:
|
|||||||
build_script:
|
build_script:
|
||||||
- echo "sandbox = true" >> /etc/nix/nix.conf
|
- echo "sandbox = true" >> /etc/nix/nix.conf
|
||||||
- export NIX_PATH="nixpkgs=$(nix eval --raw -f pkgs/nixpkgs-pinned.nix $nixpkgs)"
|
- export NIX_PATH="nixpkgs=$(nix eval --raw -f pkgs/nixpkgs-pinned.nix $nixpkgs)"
|
||||||
- nix run -f '<nixpkgs>' bash cachix -c ./ci/build.sh
|
- nix run -f '<nixpkgs>' bash coreutils cachix -c ./ci/build.sh
|
||||||
|
@ -13,11 +13,17 @@ trap 'echo Error at line $LINENO' ERR
|
|||||||
|
|
||||||
atExit() {
|
atExit() {
|
||||||
rm -rf $tmpDir
|
rm -rf $tmpDir
|
||||||
if [[ -v cachixPid ]]; then kill $cachixPid; fi
|
if [[ -v cachixPid ]]; then stopCachix; fi
|
||||||
}
|
}
|
||||||
tmpDir=$(mktemp -d -p /tmp)
|
tmpDir=$(mktemp -d -p /tmp)
|
||||||
trap atExit EXIT
|
trap atExit EXIT
|
||||||
|
|
||||||
|
stopCachix() {
|
||||||
|
kill $cachixPid 2>/dev/null || true
|
||||||
|
# Wait for cachix to finish
|
||||||
|
tail --pid=$cachixPid -f /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
## Instantiate
|
## Instantiate
|
||||||
|
|
||||||
time nix-instantiate "$@" --add-root $tmpDir/drv --indirect > /dev/null
|
time nix-instantiate "$@" --add-root $tmpDir/drv --indirect > /dev/null
|
||||||
@ -44,6 +50,7 @@ fi
|
|||||||
nix-build --out-link $tmpDir/result $tmpDir/drv >/dev/null
|
nix-build --out-link $tmpDir/result $tmpDir/drv >/dev/null
|
||||||
|
|
||||||
if [[ $CACHIX_SIGNING_KEY ]]; then
|
if [[ $CACHIX_SIGNING_KEY ]]; then
|
||||||
|
stopCachix
|
||||||
cachix push $cachixCache $outPath
|
cachix push $cachixCache $outPath
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user