Add an explicit cache restore

This commit is contained in:
Greg Hellings
2024-06-21 16:23:24 -05:00
parent 9bb997c9e7
commit 04b625f9e4
4 changed files with 16 additions and 7 deletions
+1 -7
View File
@@ -40,13 +40,7 @@ stages:
${EXCEPT}
sources
before_script:
- packer init sources
- echo $COMMAND
- mc alias set storage "http://localhost:9000" root "$MINIO_SECRET"
- mc ls storage/isos/cache
- file=$(echo var.iso.url | packer console -var-file="${distro}" -config-type=hcl2 sources/)
- mkdir cache
- mc get "storage/isos/$file" "$file"
- nix run ".#cache-restore"
script:
- ls -l cache/
- echo $COMMAND > build.sh
+1
View File
@@ -72,6 +72,7 @@ downloads:
paths:
- ./packer_config/
script:
- nix run ".#cache-restore"
- nix run ".#cache"
trigger:
+5
View File
@@ -0,0 +1,5 @@
mc alias set storage "$STORAGE_URL" root "$MINIO_SECRET"
for f in $(mc ls --json storage/isos/cache | jq '.key' | tr -d '"'); do
mc get -q "storage/isos/cache/$f" "./cache/$f"
done
+9
View File
@@ -53,6 +53,15 @@
];
text = builtins.readFile ./cache.sh;
};
cache-restore = pkgs.writeShellApplication {
name = "cache-restore";
runtimeInputs = with pkgs; [
jq
minio-client
packer
];
text = builtins.readFile ./cache-restore.sh;
};
};
# https://numtide.github.io/treefmt/