feat(ci): Cache CI results
All checks were successful
build configuration / build_web02 (pull_request) Successful in 1m1s
build configuration / build_vault01 (pull_request) Successful in 1m0s
build configuration / build_compute01 (pull_request) Successful in 1m11s
build configuration / build_rescue01 (pull_request) Successful in 48s
build configuration / build_storage01 (pull_request) Successful in 1m25s
build configuration / build_web01 (pull_request) Successful in 1m27s
build configuration / push_to_cache (pull_request) Successful in 2m10s
build configuration / build_rescue01 (push) Successful in 1m1s
build configuration / build_vault01 (push) Successful in 1m2s
build configuration / build_storage01 (push) Successful in 1m5s
build configuration / build_compute01 (push) Successful in 1m10s
build configuration / build_web02 (push) Successful in 1m2s
lint / check (push) Successful in 22s
build configuration / build_web01 (push) Successful in 1m42s
build configuration / push_to_cache (push) Successful in 2m7s

This commit is contained in:
sinavir 2024-04-12 19:53:02 +02:00
parent 7645b6fd71
commit 9f2165abc8
6 changed files with 48 additions and 1 deletions

View file

@ -68,3 +68,21 @@ jobs:
run: |
# Enter the shell
nix-shell --run 'colmena build --on rescue01'
push_to_cache:
runs-on: nix
needs:
- build_compute01
- build_storage01
- build_vault01
- build_web01
- build_web02
- build_rescue01
steps:
- uses: actions/checkout@v3
- name: Push to cache
run: nix-shell --run push-to-cache
env:
ATTIC_ENDPOINT: "https://cachix.dgnum.eu"
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}

View file

@ -76,6 +76,7 @@ in
[
npins
nixos-generators
attic-client
]
++ (builtins.map (p: callPackage p { }) [
(sources.disko + "/package.nix")

View file

@ -58,7 +58,7 @@ in
proxyPass = "http://127.0.0.1:9090";
extraConfig = ''
client_max_body_size 700M;
client_max_body_size 10G;
'';
};
};

12
scripts/cache.sh Executable file
View file

@ -0,0 +1,12 @@
ENDPOINT=${ATTIC_ENDPOINT:-https://cachix.dgnum.eu}
if [ "$1" == "off" ]; then
echo "Please edit $XDG_CONFIG_DIRS/nix/nix.conf to remove the cache"
elif [ "$1" == "on" ]; then
@attic@/bin/attic login dgnum "$ENDPOINT"
@attic@/bin/attic use dgnum:infra
else
echo "Help:"
echo " cache {on|off}"
fi

View file

@ -10,6 +10,7 @@ let
git
jq
;
attic = pkgs.attic-client;
};
mkShellScript =
@ -32,6 +33,8 @@ let
"check-deployment"
"launch-vm"
"list-nodes"
"push-to-cache"
"cache"
];
in

13
scripts/push-to-cache.sh Executable file
View file

@ -0,0 +1,13 @@
set -e
set -u
set -o pipefail
ENDPOINT=${ATTIC_ENDPOINT:-https://cachix.dgnum.eu}
@attic@/bin/attic login dgnum "$ENDPOINT" "$ATTIC_TOKEN"
@colmena@/bin/colmena eval -E '{ nodes, lib, ... }: lib.mapAttrsToList (_: v: v.config.system.build.toplevel.drvPath) nodes' |\
@jq@/bin/jq -r '.[]' |\
xargs nix-store -q -R --include-outputs |\
sed '/\.drv$/d' |\
xargs @attic@/bin/attic push dgnum:infra