Skip to content

Commit 11f48c5

Browse files
committedSep 16, 2024
fix: image reproducibility with finalize
See tonistiigi/fsutil#207 The result of this issue is that we can't use `finalize` steps where destination is a directory, so refactor things to pull in such steps into the `install` step. Signed-off-by: Andrey Smirnov <[email protected]>
1 parent 39d2f20 commit 11f48c5

File tree

17 files changed

+68
-53
lines changed

17 files changed

+68
-53
lines changed
 

‎container-runtime/crun/pkg.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ steps:
2424
mkdir -p /rootfs/usr/local/bin
2525
cp -av crun /rootfs/usr/local/bin/crun
2626
chmod +x /rootfs/usr/local/bin/crun
27+
28+
- |
29+
mkdir -p /rootfs/etc/cri/conf.d
30+
cp /pkg/crun.part /rootfs/etc/cri/conf.d/crun.part
2731
test:
2832
- |
2933
mkdir -p /extensions-validator-rootfs
@@ -36,5 +40,3 @@ finalize:
3640
to: /rootfs
3741
- from: /pkg/manifest.yaml
3842
to: /
39-
- from: /pkg/crun.part
40-
to: /rootfs/etc/cri/conf.d/crun.part

‎container-runtime/gvisor/pkg.yaml

+5-8
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ steps:
4444
4545
cp ./bin/containerd-shim-runsc-v1 /rootfs/usr/local/bin/containerd-shim-runsc-v1
4646
chmod +x /rootfs/usr/local/bin/containerd-shim-runsc-v1
47+
48+
- |
49+
mkdir -p /rootfs/etc/cri/conf.d
50+
51+
cp /pkg/gvisor.part /pkg/runsc.toml /pkg/gvisor-kvm.part /pkg/runsc-kvm.toml /rootfs/etc/cri/conf.d/
4752
test:
4853
- |
4954
mkdir -p /extensions-validator-rootfs
@@ -55,11 +60,3 @@ finalize:
5560
to: /rootfs
5661
- from: /pkg/manifest.yaml
5762
to: /
58-
- from: /pkg/gvisor.part
59-
to: /rootfs/etc/cri/conf.d/gvisor.part
60-
- from: /pkg/runsc.toml
61-
to: /rootfs/etc/cri/conf.d/runsc.toml
62-
- from: /pkg/gvisor-kvm.part
63-
to: /rootfs/etc/cri/conf.d/gvisor-kvm.part
64-
- from: /pkg/runsc-kvm.toml
65-
to: /rootfs/etc/cri/conf.d/runsc-kvm.toml

‎container-runtime/kata-containers/pkg.yaml

+6-4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ steps:
5959
- |
6060
cd ${GOPATH}/src/github.com/kata-containers/src/runtime
6161
cp containerd-shim-kata-v2 /rootfs/usr/local/bin/containerd-shim-kata-v2
62+
- |
63+
mkdir -p /rootfs/etc/cri/conf.d
64+
cp /pkg/kata-containers.part /rootfs/etc/cri/conf.d/kata-containers.part
65+
66+
mkdir -p /rootfs/usr/local/share/kata-containers
67+
cp /pkg/configuration.toml /rootfs/usr/local/share/kata-containers/configuration.toml
6268
test:
6369
- |
6470
mkdir -p /extensions-validator-rootfs
@@ -70,7 +76,3 @@ finalize:
7076
to: /rootfs
7177
- from: /pkg/manifest.yaml
7278
to: /
73-
- from: /pkg/kata-containers.part
74-
to: /rootfs/etc/cri/conf.d/kata-containers.part
75-
- from: /pkg/configuration.toml
76-
to: /rootfs/usr/local/share/kata-containers/configuration.toml

‎container-runtime/spin/pkg.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ steps:
2424
mkdir -p /rootfs/usr/local/bin
2525
2626
tar xf containerd-shim-spin.tar.gz -C /rootfs/usr/local/bin
27+
- |
28+
mkdir -p /rootfs/etc/cri/conf.d
29+
cp /pkg/spin.part /rootfs/etc/cri/conf.d/spin.part
2730
test:
2831
- |
2932
mkdir -p /extensions-validator-rootfs
@@ -35,5 +38,3 @@ finalize:
3538
to: /rootfs
3639
- from: /pkg/manifest.yaml
3740
to: /
38-
- from: /pkg/spin.part
39-
to: /rootfs/etc/cri/conf.d/spin.part

‎container-runtime/stargz-snapshotter/pkg.yaml

+9-6
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ steps:
4141
4242
cp ./out/ctr-remote /rootfs/usr/local/lib/containers/stargz-snapshotter/ctr-remote
4343
chmod +x /rootfs/usr/local/lib/containers/stargz-snapshotter/ctr-remote
44+
- |
45+
mkdir -p /rootfs/etc/cri/conf.d
46+
cp /pkg/stargz-snapshotter.part /rootfs/etc/cri/conf.d/stargz-snapshotter.part
47+
48+
mkdir -p /rootfs/usr/local/etc/containerd-stargz-grpc
49+
cp /pkg/config.toml /rootfs/usr/local/etc/containerd-stargz-grpc/config.toml
50+
51+
mkdir -p /rootfs/usr/local/etc/containers
52+
cp /pkg/stargz-snapshotter.yaml /rootfs/usr/local/etc/containers/
4453
test:
4554
- |
4655
mkdir -p /extensions-validator-rootfs
@@ -52,9 +61,3 @@ finalize:
5261
to: /rootfs
5362
- from: /pkg/manifest.yaml
5463
to: /
55-
- from: /pkg/stargz-snapshotter.part
56-
to: /rootfs/etc/cri/conf.d/stargz-snapshotter.part
57-
- from: /pkg/config.toml
58-
to: /rootfs/usr/local/etc/containerd-stargz-grpc/config.toml
59-
- from: /pkg/stargz-snapshotter.yaml
60-
to: /rootfs/usr/local/etc/containers/

‎examples/hello-world-service/pkg.yaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@ steps:
2020
CGO_ENABLED=0 go build -o ./hello-world .
2121
install:
2222
- |
23-
mkdir -p /rootfs/usr/local/etc/containers
2423
mkdir -p /rootfs/usr/local/lib/containers/hello-world
2524
2625
cp -p /pkg/src/hello-world /rootfs/usr/local/lib/containers/hello-world/
26+
- |
27+
mkdir -p /rootfs/usr/local/etc/containers
28+
29+
cp /pkg/hello-world.yaml /rootfs/usr/local/etc/containers/
2730
test:
2831
- |
2932
mkdir -p /extensions-validator-rootfs
@@ -35,5 +38,3 @@ finalize:
3538
to: /rootfs
3639
- from: /pkg/manifest.yaml
3740
to: /
38-
- from: /pkg/hello-world.yaml
39-
to: /rootfs/usr/local/etc/containers/

‎guest-agents/qemu-guest-agent/pkg.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ steps:
6363
rmdir /rootfs/usr/local/share
6464
rmdir /rootfs/var/run
6565
rmdir /rootfs/var
66+
- |
67+
mkdir -p /rootfs/usr/local/etc/containers
68+
cp /pkg/qemu-guest-agent.yaml /rootfs/usr/local/etc/containers/
6669
test:
6770
- |
6871
mkdir -p /extensions-validator-rootfs
@@ -74,5 +77,3 @@ finalize:
7477
to: /rootfs
7578
- from: /pkg/manifest.yaml
7679
to: /
77-
- from: /pkg/qemu-guest-agent.yaml
78-
to: /rootfs/usr/local/etc/containers/

‎guest-agents/xen-guest-agent/pkg.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ steps:
3232
containerRoot=/rootfs/usr/local/lib/containers/xen-guest-agent
3333
mkdir -p "$containerRoot"
3434
mv target/{{ .ARCH }}-alpine-linux-musl/release/xen-guest-agent "$containerRoot/xen-guest-agent"
35+
- |
36+
mkdir -p /rootfs/usr/local/etc/containers
37+
38+
cp /pkg/xen-guest-agent.yaml /rootfs/usr/local/etc/containers/
3539
test:
3640
- |
3741
mkdir -p /extensions-validator-rootfs
@@ -43,5 +47,3 @@ finalize:
4347
to: /rootfs
4448
- from: /pkg/manifest.yaml
4549
to: /
46-
- from: /pkg/xen-guest-agent.yaml
47-
to: /rootfs/usr/local/etc/containers/

‎network/tailscale/pkg.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ steps:
3737
cp -pr dist/tailscale /rootfs/usr/local/lib/containers/tailscale/usr/local/bin
3838
cp -pr dist/tailscaled /rootfs/usr/local/lib/containers/tailscale/usr/local/bin
3939
cp -pr dist/containerboot /rootfs/usr/local/lib/containers/tailscale/usr/local/bin
40+
- |
41+
mkdir -p /rootfs/usr/local/etc/containers
42+
cp /pkg/tailscale.yaml /rootfs/usr/local/etc/containers/
4043
test:
4144
- |
4245
mkdir -p /extensions-validator-rootfs
@@ -48,5 +51,3 @@ finalize:
4851
to: /rootfs
4952
- from: /pkg/manifest.yaml
5053
to: /
51-
- from: /pkg/tailscale.yaml
52-
to: /rootfs/usr/local/etc/containers/

‎nvidia-gpu/nvidia-container-toolkit/lts/pkg.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ steps:
1818
sed -i 's#$VERSION#{{ .VERSION }}#' /pkg/manifest.yaml
1919
install:
2020
- |
21-
mkdir -p /rootfs
21+
mkdir -p /rootfs/usr/local/etc/containers
22+
23+
cp /pkg/nvidia-persistenced.yaml /rootfs/usr/local/etc/containers/nvidia-persistenced.yaml
2224
test:
2325
- |
2426
mkdir -p /extensions-validator-rootfs
@@ -28,7 +30,5 @@ steps:
2830
finalize:
2931
- from: /rootfs
3032
to: /rootfs
31-
- from: /pkg/nvidia-persistenced.yaml
32-
to: /rootfs/usr/local/etc/containers/nvidia-persistenced.yaml
3333
- from: /pkg/manifest.yaml
3434
to: /

‎nvidia-gpu/nvidia-container-toolkit/nvidia-container-runtime/pkg.yaml

+6-4
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,12 @@ steps:
4949
ln -sv nvidia-container-runtime-wrapper /rootfs/usr/local/bin/$(basename $clean_file)
5050
cp $clean_file /rootfs/usr/local/bin/$(basename $clean_file).real
5151
done
52+
- |
53+
mkdir -p /rootfs/etc/cri/conf.d
54+
cp /pkg/nvidia-container-runtime.part /rootfs/etc/cri/conf.d/nvidia-container-runtime.part
55+
56+
mkdir -p /rootfs/usr/local/etc/nvidia-container-runtime
57+
cp /pkg/nvidia-container-runtime.toml /rootfs/usr/local/etc/nvidia-container-runtime/config.toml
5258
finalize:
5359
- from: /rootfs
5460
to: /rootfs
55-
- from: /pkg/nvidia-container-runtime.part
56-
to: /rootfs/etc/cri/conf.d/nvidia-container-runtime.part
57-
- from: /pkg/nvidia-container-runtime.toml
58-
to: /rootfs/usr/local/etc/nvidia-container-runtime/config.toml

‎nvidia-gpu/nvidia-container-toolkit/production/pkg.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ steps:
1818
sed -i 's#$VERSION#{{ .VERSION }}#' /pkg/manifest.yaml
1919
install:
2020
- |
21-
mkdir -p /rootfs
21+
mkdir -p /rootfs/usr/local/etc/containers
22+
cp /pkg/nvidia-persistenced.yaml /rootfs/usr/local/etc/containers/nvidia-persistenced.yaml
2223
test:
2324
- |
2425
mkdir -p /extensions-validator-rootfs
@@ -28,7 +29,5 @@ steps:
2829
finalize:
2930
- from: /rootfs
3031
to: /rootfs
31-
- from: /pkg/nvidia-persistenced.yaml
32-
to: /rootfs/usr/local/etc/containers/nvidia-persistenced.yaml
3332
- from: /pkg/manifest.yaml
3433
to: /

‎nvidia-gpu/nvidia-fabricmanager/lts/pkg.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ steps:
4040
4141
cp etc/fabricmanager.cfg /rootfs/usr/local/share/nvidia/nvswitch/
4242
43+
cp /pkg/nvidia-fabricmanager.yaml /rootfs/usr/local/etc/containers/nvidia-fabricmanager.yaml
44+
4345
sed -i 's/DAEMONIZE=.*/DAEMONIZE=0/g' /rootfs/usr/local/share/nvidia/nvswitch/fabricmanager.cfg
4446
sed -i 's/STATE_FILE_NAME=.*/STATE_FILE_NAME=\/var\/run\/nvidia-fabricmanager\/fabricmanager.state/g' /rootfs/usr/local/share/nvidia/nvswitch/fabricmanager.cfg
4547
sed -i 's/TOPOLOGY_FILE_PATH=.*/TOPOLOGY_FILE_PATH=\/usr\/local\/share\/nvidia\/nvswitch/g' /rootfs/usr/local/share/nvidia/nvswitch/fabricmanager.cfg
@@ -53,7 +55,5 @@ steps:
5355
finalize:
5456
- from: /rootfs
5557
to: /rootfs
56-
- from: /pkg/nvidia-fabricmanager.yaml
57-
to: /rootfs/usr/local/etc/containers/nvidia-fabricmanager.yaml
5858
- from: /pkg/manifest.yaml
5959
to: /

‎nvidia-gpu/nvidia-fabricmanager/production/lts/pkg.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ steps:
4040
4141
cp etc/fabricmanager.cfg /rootfs/usr/local/share/nvidia/nvswitch/
4242
43+
cp /pkg/nvidia-fabricmanager.yaml /rootfs/usr/local/etc/containers/nvidia-fabricmanager.yaml
44+
4345
sed -i 's/DAEMONIZE=.*/DAEMONIZE=0/g' /rootfs/usr/local/share/nvidia/nvswitch/fabricmanager.cfg
4446
sed -i 's/STATE_FILE_NAME=.*/STATE_FILE_NAME=\/var\/run\/nvidia-fabricmanager\/fabricmanager.state/g' /rootfs/usr/local/share/nvidia/nvswitch/fabricmanager.cfg
4547
sed -i 's/TOPOLOGY_FILE_PATH=.*/TOPOLOGY_FILE_PATH=\/usr\/local\/share\/nvidia\/nvswitch/g' /rootfs/usr/local/share/nvidia/nvswitch/fabricmanager.cfg
@@ -53,7 +55,5 @@ steps:
5355
finalize:
5456
- from: /rootfs
5557
to: /rootfs
56-
- from: /pkg/nvidia-fabricmanager.yaml
57-
to: /rootfs/usr/local/etc/containers/nvidia-fabricmanager.yaml
5858
- from: /pkg/manifest.yaml
5959
to: /

‎power/nut-client/pkg.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ steps:
8080
rm -rf /rootfs/usr/local/etc
8181
rm -rf /rootfs/usr/local/lib/nut
8282
rm -rf /rootfs/usr/local/sbin
83+
- |
84+
mkdir -p /rootfs/usr/local/etc/containers
85+
cp /pkg/nut-client.yaml /rootfs/usr/local/etc/containers/
8386
test:
8487
- |
8588
mkdir -p /extensions-validator-rootfs
@@ -91,5 +94,3 @@ finalize:
9194
to: /rootfs
9295
- from: /pkg/manifest.yaml
9396
to: /
94-
- from: /pkg/nut-client.yaml
95-
to: /rootfs/usr/local/etc/containers/

‎storage/iscsi-tools/pkg.yaml

+5-4
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,18 @@ steps:
1919
# cleanup
2020
rm -rf /rootfs/usr/local/include
2121
rm -rf /rootfs/usr/share
22+
- |
23+
mkdir -p /rootfs/usr/local/etc/containers
24+
25+
cp /pkg/iscsid.yaml /rootfs/usr/local/etc/containers/iscsid.yaml
26+
cp /pkg/tgtd.yaml /rootfs/usr/local/etc/containers/tgtd.yaml
2227
test:
2328
- |
2429
mkdir -p /extensions-validator-rootfs
2530
cp -r /rootfs/ /extensions-validator-rootfs/rootfs
2631
cp /pkg/manifest.yaml /extensions-validator-rootfs/manifest.yaml
2732
/extensions-validator validate --rootfs=/extensions-validator-rootfs --pkg-name="${PKG_NAME}"
2833
finalize:
29-
- from: /pkg/iscsid.yaml
30-
to: /rootfs/usr/local/etc/containers/iscsid.yaml
31-
- from: /pkg/tgtd.yaml
32-
to: /rootfs/usr/local/etc/containers/tgtd.yaml
3334
- from: /rootfs
3435
to: /rootfs
3536
- from: /pkg/manifest.yaml

‎storage/zfs/pkg.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ steps:
1818
mkdir -p /rootfs/lib/modules /rootfs/usr/local/lib/containers/zpool-importer
1919
2020
cp -R /lib/modules/* /rootfs/lib/modules
21+
- |
22+
mkdir -p /rootfs/usr/local/lib/containers
23+
24+
cp /pkg/zpool-importer.yaml /rootfs/usr/local/lib/containers/zpool-importer.yaml
2125
test:
2226
- |
2327
mkdir -p /extensions-validator-rootfs
@@ -29,5 +33,3 @@ finalize:
2933
to: /rootfs
3034
- from: /pkg/manifest.yaml
3135
to: /
32-
- from: /pkg/zpool-importer.yaml
33-
to: /rootfs/usr/local/etc/containers/zpool-importer.yaml

0 commit comments

Comments
 (0)
Please sign in to comment.