feat: Update CI to use tvix-store
All checks were successful
Check meta / check_meta (pull_request) Successful in 22s
Check meta / check_dns (pull_request) Successful in 39s
build configuration / build_compute01 (pull_request) Successful in 1m25s
build configuration / build_web02 (pull_request) Successful in 1m27s
build configuration / build_vault01 (pull_request) Successful in 1m38s
build configuration / build_storage01 (pull_request) Successful in 1m46s
build configuration / build_rescue01 (pull_request) Successful in 1m37s
build configuration / build_web01 (pull_request) Successful in 2m6s
build configuration / build_geo01 (pull_request) Successful in 1m7s
build configuration / build_geo02 (pull_request) Successful in 1m14s
build configuration / push_to_cache_rescue01 (pull_request) Successful in 1m35s
build configuration / push_to_cache_storage01 (pull_request) Successful in 1m50s
build configuration / push_to_cache_geo01 (pull_request) Successful in 1m10s
build configuration / push_to_cache_geo02 (pull_request) Successful in 1m13s
build configuration / push_to_cache_web01 (pull_request) Successful in 4m38s
build configuration / push_to_cache_web02 (pull_request) Successful in 1m23s
build configuration / push_to_cache_compute01 (pull_request) Successful in 1m38s
build configuration / build_compute01 (push) Successful in 1m28s
build configuration / build_vault01 (push) Successful in 1m29s
Check meta / check_meta (push) Successful in 23s
Check meta / check_dns (push) Successful in 40s
build configuration / build_storage01 (push) Successful in 1m21s
lint / check (push) Successful in 25s
build configuration / build_web01 (push) Successful in 1m42s
build configuration / build_web02 (push) Successful in 1m17s
build configuration / build_geo01 (push) Successful in 1m19s
build configuration / build_rescue01 (push) Successful in 1m24s
build configuration / build_geo02 (push) Successful in 1m20s
build configuration / push_to_cache_storage01 (push) Successful in 1m40s
build configuration / push_to_cache_compute01 (push) Successful in 1m49s
build configuration / push_to_cache_geo01 (push) Successful in 1m25s
build configuration / push_to_cache_web02 (push) Successful in 1m39s
build configuration / push_to_cache_rescue01 (push) Successful in 1m37s
build configuration / push_to_cache_web01 (push) Successful in 2m10s
build configuration / push_to_cache_geo02 (push) Successful in 1m19s

This commit is contained in:
sinavir 2024-07-24 12:32:39 +02:00 committed by thubrecht
parent c14e263b98
commit 60267b4ff6
4 changed files with 148 additions and 8 deletions

View file

@ -69,20 +69,139 @@ jobs:
# Enter the shell
nix-shell --run 'colmena build --on rescue01'
push_to_cache:
build_geo01:
runs-on: nix
steps:
- uses: actions/checkout@v3
- name: Build geo01
run: |
# Enter the shell
nix-shell --run 'colmena build --on geo01'
build_geo02:
runs-on: nix
steps:
- uses: actions/checkout@v3
- name: Build geo02
run: |
# Enter the shell
nix-shell --run 'colmena build --on geo02'
push_to_cache_compute01:
runs-on: nix
needs:
- build_compute01
steps:
- uses: actions/checkout@v3
- name: Push to cache
run: nix-shell --run push-to-nix-cache
env:
STORE_ENDPOINT: "https://tvix-store.dgnum.eu/infra-signing/"
STORE_USER: "admin"
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
NODES: '[ "compute01" ]'
- uses: actions/upload-artifact@v3
if: always()
with:
name: outputs_compute01
path: uploaded.txt
push_to_cache_storage01:
runs-on: nix
needs:
- build_storage01
- build_vault01
- build_web01
- build_web02
steps:
- uses: actions/checkout@v3
- name: Push to cache
run: nix-shell --run push-to-nix-cache
env:
STORE_ENDPOINT: "https://tvix-store.dgnum.eu/infra-signing/"
STORE_USER: "admin"
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
NODES: '[ "storage01" ]'
- uses: actions/upload-artifact@v3
if: always()
with:
name: outputs_storage01
path: uploaded.txt
push_to_cache_rescue01:
runs-on: nix
needs:
- build_rescue01
steps:
- uses: actions/checkout@v3
- name: Push to cache
run: nix-shell --run push-to-cache
run: nix-shell --run push-to-nix-cache
env:
ATTIC_ENDPOINT: "https://cachix.dgnum.eu"
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}
STORE_ENDPOINT: "https://tvix-store.dgnum.eu/infra-signing/"
STORE_USER: "admin"
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
NODES: '[ "rescue01" ]'
push_to_cache_geo01:
runs-on: nix
needs:
- build_geo01
steps:
- uses: actions/checkout@v3
- name: Push to cache
run: nix-shell --run push-to-nix-cache
env:
STORE_ENDPOINT: "https://tvix-store.dgnum.eu/infra-signing/"
STORE_USER: "admin"
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
NODES: '[ "geo01" ]'
push_to_cache_geo02:
runs-on: nix
needs:
- build_geo02
steps:
- uses: actions/checkout@v3
- name: Push to cache
run: nix-shell --run push-to-nix-cache
env:
STORE_ENDPOINT: "https://tvix-store.dgnum.eu/infra-signing/"
STORE_USER: "admin"
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
NODES: '[ "geo02" ]'
push_to_cache_web01:
runs-on: nix
needs:
- build_web01
steps:
- uses: actions/checkout@v3
- name: Push to cache
run: nix-shell --run push-to-nix-cache
env:
STORE_ENDPOINT: "https://tvix-store.dgnum.eu/infra-signing/"
STORE_USER: "admin"
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
NODES: '[ "web01" ]'
push_to_cache_web02:
runs-on: nix
needs:
- build_web02
steps:
- uses: actions/checkout@v3
- name: Push to cache
run: nix-shell --run push-to-nix-cache
env:
STORE_ENDPOINT: "https://tvix-store.dgnum.eu/infra-signing/"
STORE_USER: "admin"
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
NODES: '[ "web02" ]'

View file

@ -34,6 +34,7 @@ let
"launch-vm"
"list-nodes"
"push-to-cache"
"push-to-nix-cache"
"cache"
];
in

View file

@ -8,6 +8,6 @@ ENDPOINT=${ATTIC_ENDPOINT:-https://cachix.dgnum.eu}
@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 |\
xargs -n 10 nix-store -q -R --include-outputs |\
sed '/\.drv$/d' |\
xargs @attic@/bin/attic push dgnum:infra

20
scripts/push-to-nix-cache.sh Executable file
View file

@ -0,0 +1,20 @@
set -e
set -u
set -o pipefail
ENDPOINT=${STORE_ENDPOINT:-https://tvix-cache.dgnum.eu/infra-singing/}
cat > .netrc << EOF
default
login $STORE_USER
password $STORE_PASSWORD
EOF
@colmena@/bin/colmena eval -E "{ nodes, lib, ... }: builtins.map (v: nodes.\${v}.config.system.build.toplevel.drvPath) ${NODES:-(builtins.attrNames nodes)}" |\
@jq@/bin/jq -r '.[]' |\
xargs nix-store -q -R --include-outputs |\
sed '/\.drv$/d' |\
tee uploaded.txt |\
xargs nix copy --to "$ENDPOINT?compression=none" --extra-experimental-features nix-command --netrc-file ./.netrc
rm .netrc