Skip to content

Commit 67d48c5

Browse files
Merge pull request #9180 from cevich/v3.0_static_remote
[v3.0] Use cachix for static build & include podman-remote build
2 parents 0ba47f7 + 6c595dd commit 67d48c5

File tree

5 files changed

+23
-22
lines changed

5 files changed

+23
-22
lines changed

.cirrus.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ static_alt_build_task:
322322
- build
323323
# Community-maintained task, may fail on occasion. If so, uncomment
324324
# the next line and file an issue with details about the failure.
325-
allow_failures: $CI == $CI
325+
# allow_failures: $CI == $CI
326326
gce_instance: *bigvm
327327
env:
328328
<<: *stdenvars
@@ -331,14 +331,13 @@ static_alt_build_task:
331331
ALT_NAME: 'Static build'
332332
# Do not use 'latest', fixed-version tag for runtime stability.
333333
CTR_FQIN: "docker.io/nixos/nix:2.3.6"
334-
# This is critical, it helps to avoid a very lengthy process of
335-
# statically building every dependency needed to build podman.
336-
# Assuming the dependency and build description hasn't changed,
337-
# this cache ensures only the static podman binary is built.
338-
nix_cache:
339-
folder: '/var/cache/nix'
340-
# Cirrus will calculate/use sha of this output as the cache key
341-
fingerprint_script: echo "${IMAGE_SUFFIX}" && cat nix/*
334+
# Authentication token for pushing the build cache to cachix.
335+
# This is critical, it helps to avoid a very lengthy process of
336+
# statically building every dependency needed to build podman.
337+
# Assuming the pinned nix dependencies in nix/nixpkgs.json have not
338+
# changed, this cache will ensure that only the static podman binary is
339+
# built.
340+
CACHIX_AUTH_TOKEN: ENCRYPTED[df0d4d0a67474e8ea49cc503221dcb912b7e2ba45c8ec4bf2e5fd9c49a18ac21c24bacee59b5393355ed9e4358d2baef]
342341
setup_script: *setup
343342
main_script: *main
344343
always: *binary_artifacts

contrib/cirrus/required_host_ports.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ github.com 22
22
docker.io 443
33
quay.io 443
44
registry.fedoraproject.org 443
5+
podman.cachix.org 443

contrib/cirrus/runner.sh

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,14 @@ function _run_altbuild() {
178178
req_env_vars CTR_FQIN
179179
[[ "$UID" -eq 0 ]] || \
180180
die "Static build must execute nixos container as root on host"
181-
mkdir -p /var/cache/nix
182-
podman run -i --rm -v /var/cache/nix:/mnt/nix:Z \
183-
$CTR_FQIN cp -rfT /nix /mnt/nix
184-
podman run -i --rm -v /var/cache/nix:/nix:Z \
185-
-v $PWD:$PWD:Z -w $PWD $CTR_FQIN \
186-
nix --print-build-logs --option cores 4 --option max-jobs 4 \
187-
build --file ./nix/
188-
# result symlink is absolute from container perspective :(
189-
cp /var/cache/$(readlink result)/bin/podman ./ # for cirrus-ci artifact
181+
podman run -i --rm \
182+
-e CACHIX_AUTH_TOKEN \
183+
-v $PWD:$PWD:Z -w $PWD $CTR_FQIN sh -c \
184+
"nix-env -iA cachix -f https://cachix.org/api/v1/install && \
185+
cachix use podman && \
186+
nix-build nix && \
187+
nix-store -qR --include-outputs \$(nix-instantiate nix/default.nix) | grep -v podman | cachix push podman && \
188+
cp -R result/bin ."
190189
rm result # makes cirrus puke
191190
;;
192191
*)

nix/default.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ let
4949
buildPhase = ''
5050
patchShebangs .
5151
make bin/podman
52+
make bin/podman-remote
5253
'';
5354
installPhase = ''
5455
install -Dm755 bin/podman $out/bin/podman
56+
install -Dm755 bin/podman-remote $out/bin/podman-remote
5557
'';
5658
};
5759
in self

nix/nixpkgs.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"url": "https://github.com/nixos/nixpkgs",
3-
"rev": "4a75203f0270f96cbc87f5dfa5d5185690237d87",
4-
"date": "2020-12-29T03:18:48+01:00",
5-
"path": "/nix/store/scswsm6r4jnhp9ki0f6s81kpj5x6jkn7-nixpkgs",
6-
"sha256": "0h70fm9aa7s06wkalbadw70z5rscbs3p6nblb47z523nhlzgjxk9",
3+
"rev": "ce7b327a52d1b82f82ae061754545b1c54b06c66",
4+
"date": "2021-01-25T11:28:05+01:00",
5+
"path": "/nix/store/dpsa6a1sy8hwhwjkklc52brs9z1k5fx9-nixpkgs",
6+
"sha256": "1rc4if8nmy9lrig0ddihdwpzg2s8y36vf20hfywb8hph5hpsg4vj",
77
"fetchSubmodules": false,
88
"deepClone": false,
99
"leaveDotGit": false

0 commit comments

Comments
 (0)