mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-11-22 08:04:20 +01:00
Update hydraJobs to include more useful info
Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
parent
f6b45a6506
commit
a412f91488
60
flake.nix
60
flake.nix
|
@ -33,17 +33,59 @@
|
|||
let
|
||||
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||
makeJob = container:
|
||||
pkgs.runCommandNoCCLocal "${container.stream.imageName}-hydra-job"
|
||||
{}
|
||||
pkgs.stdenv.mkDerivation
|
||||
|
||||
{ name = "${container.stream.imageName}-hydra-job";
|
||||
buildPhase =
|
||||
''
|
||||
mkdir -p $out/nix-support $out/image
|
||||
${container.stream} | tar -xf - -C $out/image
|
||||
for img in $out/image/*/*.tar ; do
|
||||
gzip $img
|
||||
_workdir=$(mktemp -d)
|
||||
mkdir -p $out/nix-support $out/layers
|
||||
|
||||
${container.stream} | tar -xf - -C $_workdir
|
||||
for img in $_workdir/*/*.tar ; do
|
||||
_hash=$(basename $(dirname $img))
|
||||
|
||||
gzip $img -c > $out/layers/$_hash.tar.gz
|
||||
done
|
||||
|
||||
echo "directory docker-image $out/image" >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
_config=$(basename $(find $_workdir -name '*.json' ! -name 'manifest.json' -type f))
|
||||
|
||||
ls $out/layers/ | jq -Rsc '{ layers: split("\n")[:-1] }' > $out/index.json
|
||||
|
||||
cat >> $out/index.html <<EOF
|
||||
<html>
|
||||
<body>
|
||||
<a href="manifest.json">manifest.json</a><br>
|
||||
<a href="$_config">config.json</a><br>
|
||||
EOF
|
||||
jq -r '.layers | join("\n")' < $out/index.json | xargs -I {} awk 'BEGIN { print "<a href=\"layers/{}\">{}</a><br>" }' >> $out/index.html
|
||||
cat >> $out/index.html <<EOF
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
||||
|
||||
cp $_workdir/manifest.json $out/manifest.json
|
||||
cp $_workdir/$_config $out/$_config
|
||||
|
||||
ln -s ${container.stream} $out/stream
|
||||
|
||||
cat > $out/nix-support/hydra-build-products <<EOF
|
||||
directory image-layers $out/layers
|
||||
|
||||
file manifest $out/manifest.json
|
||||
file config $out/$_config
|
||||
|
||||
file html $out/layers/index.html
|
||||
file json $out/layers/index.json
|
||||
|
||||
file executable $out/stream
|
||||
EOF
|
||||
'' ;
|
||||
|
||||
phases = [ "buildPhase" ];
|
||||
|
||||
nativeBuildInputs = with pkgs; [ jq ];
|
||||
};
|
||||
in
|
||||
{
|
||||
website = makeJob self.ociImages.website;
|
||||
|
@ -59,7 +101,7 @@
|
|||
in
|
||||
pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs;
|
||||
[ nomad_1_1 consul vault
|
||||
[ nomad_1_1 consul vault jq
|
||||
];
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue