CI: add nixos-generate logging output assertions

Namely, assert that the last line of output refers to a store path that
is a file or symlink to a file.
This commit is contained in:
Matt Schreiber 2022-05-13 11:45:22 -04:00
parent 3cf3032e81
commit 70b4350553
No known key found for this signature in database
GPG Key ID: EF3B12854EEE31BF

View File

@ -22,6 +22,9 @@ stages:
- mkdir $uploadPath - mkdir $uploadPath
script: script:
- nix-shell --command './nixos-generate -f $formats -I nixpkgs=channel:nixos-$nixpkgs_ver' |& tee $uploadPath/build.log - nix-shell --command './nixos-generate -f $formats -I nixpkgs=channel:nixos-$nixpkgs_ver' |& tee $uploadPath/build.log
# Last line of output should be the path of a regular file (or symlink
# to a regular file) in the Nix store.
- storePath=$(tail -n 1 $uploadPath/build.log) && test -f "$storePath" && test "/nix/store/${storePath#/nix/store/}" = "$storePath"
- mv $(realpath result) $uploadPath - mv $(realpath result) $uploadPath
artifacts: artifacts:
name: "$uploadPath" name: "$uploadPath"