diff --git a/.albatros b/.albatros index e10424b..b30c445 100755 --- a/.albatros +++ b/.albatros @@ -2,9 +2,9 @@ set -euxo pipefail nix build -if [[ $BRANCH == "main" && -f $SECRET_PATH ]]; then - mkdir -p /kaniko/.docker - cp $SECRET_PATH /kaniko/.docker/config.json - export HOME=/kaniko - nix develop --command sh -c "executor --force --destination dxflrs/albatros:${COMMIT} --context dir://`pwd` --verbosity=debug" 1>&2 -fi +#if [[ $BRANCH == "main" && -f $SECRET_PATH ]]; then +# mkdir -p /kaniko/.docker +# cp $SECRET_PATH /kaniko/.docker/config.json +# export HOME=/kaniko +# nix develop --command sh -c "executor --force --destination dxflrs/albatros:${COMMIT} --context dir://`pwd` --verbosity=debug" 1>&2 +#fi diff --git a/README.md b/README.md index 62d0164..0ebe834 100644 --- a/README.md +++ b/README.md @@ -59,8 +59,20 @@ And... that's basically all you need. ### A NixOS builder with local cache -Currently, we propose a single, nix-based builder. -I am currently working on using proper caching on it. +The nix builder will create a local cache on your node agent at `/var/cache/albatros`. +It will create two folders: `/var/cache/albatros/nix` that contains a nix store, +and `/var/cache/albatros/cacheroot` that contains nix roots, ie. the builds we must keep. + +Caching is handled thanks to these roots: roots that are older than 7 days will be removed, +then a garbage collection will be triggered, and their associate content will be deleted. + +To keep your cache between builds, you must put your outlink in `/mnt/cacheroot` with a unique name. +The git commit is a good candidate: + +```bash +# create an output link at a persisted path +nix build --out-link $GCROOT +``` ## Register a build diff --git a/hcl/builder.hcl b/hcl/builder.hcl index 6094eee..1e9dd74 100644 --- a/hcl/builder.hcl +++ b/hcl/builder.hcl @@ -37,19 +37,7 @@ job "builder" { } template { - data = <