diff options
author | Sascha Grunert <mail@saschagrunert.de> | 2021-01-25 12:02:22 +0100 |
---|---|---|
committer | Chris Evich <cevich@redhat.com> | 2021-02-01 10:17:29 -0500 |
commit | bf0eb84f8bc54063797f450bdb85d61ce22f2683 (patch) | |
tree | 2e5584e82dc7c792cc698f88065477ffc50b7fa3 /contrib | |
parent | 745fa4ac94c3ec99becd85f59d1b59c2c9765527 (diff) | |
download | podman-bf0eb84f8bc54063797f450bdb85d61ce22f2683.tar.gz podman-bf0eb84f8bc54063797f450bdb85d61ce22f2683.tar.bz2 podman-bf0eb84f8bc54063797f450bdb85d61ce22f2683.zip |
Fix static build cache by using cachix
It looks like we always hit the caching issue in Cirrus CI described
within #8313. A solution around that is to use cachix, which has been
pre-populated from my local machine.
To push all (runtime and build) dependencies, we can leverage a
pre-populated store by:
```
> nix-store -qR --include-outputs $(nix-instantiate nix/default.nix) | cachix push podman
```
The cache can be re-used by everybody to rapidly build static Podman
binaries: https://app.cachix.org/cache/podman
[NO TESTS NEEDED]
Signed-off-by: Sascha Grunert <mail@saschagrunert.de>
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/cirrus/required_host_ports.txt | 1 | ||||
-rwxr-xr-x | contrib/cirrus/runner.sh | 17 |
2 files changed, 9 insertions, 9 deletions
diff --git a/contrib/cirrus/required_host_ports.txt b/contrib/cirrus/required_host_ports.txt index 9248e497a..5f066e059 100644 --- a/contrib/cirrus/required_host_ports.txt +++ b/contrib/cirrus/required_host_ports.txt @@ -2,3 +2,4 @@ github.com 22 docker.io 443 quay.io 443 registry.fedoraproject.org 443 +podman.cachix.org 443 diff --git a/contrib/cirrus/runner.sh b/contrib/cirrus/runner.sh index 6e6747f28..55dd461e4 100755 --- a/contrib/cirrus/runner.sh +++ b/contrib/cirrus/runner.sh @@ -187,15 +187,14 @@ function _run_altbuild() { req_env_vars CTR_FQIN [[ "$UID" -eq 0 ]] || \ die "Static build must execute nixos container as root on host" - mkdir -p /var/cache/nix - podman run -i --rm -v /var/cache/nix:/mnt/nix:Z \ - $CTR_FQIN cp -rfT /nix /mnt/nix - podman run -i --rm -v /var/cache/nix:/nix:Z \ - -v $PWD:$PWD:Z -w $PWD $CTR_FQIN \ - nix --print-build-logs --option cores 4 --option max-jobs 4 \ - build --file ./nix/ - # result symlink is absolute from container perspective :( - cp /var/cache/$(readlink result)/bin/podman ./ # for cirrus-ci artifact + podman run -i --rm \ + -e CACHIX_AUTH_TOKEN \ + -v $PWD:$PWD:Z -w $PWD $CTR_FQIN sh -c \ + "nix-env -iA cachix -f https://cachix.org/api/v1/install && \ + cachix use podman && \ + nix-build nix && \ + nix-store -qR --include-outputs \$(nix-instantiate nix/default.nix) | grep -v podman | cachix push podman && \ + cp -R result/bin ." rm result # makes cirrus puke ;; *) |