tests: Add tests for reproducible builds

Test the 'tar' and 'kernel+initrd' formats for now.

Signed-off-by: Rolf Neugebauer <rn@rneugeba.io>
This commit is contained in:
Rolf Neugebauer 2018-12-29 12:16:15 +00:00
parent 78281af751
commit 8008811aad
3 changed files with 104 additions and 0 deletions

View File

@ -0,0 +1,25 @@
#!/bin/sh
# SUMMARY: Check that tar output format build is reproducible
# LABELS:
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=check
clean_up() {
rm -f ${NAME}*
}
trap clean_up EXIT
# -disable-content-trust to speed up the test
linuxkit build -disable-content-trust -format tar -name "${NAME}-1" ../test.yml
linuxkit build -disable-content-trust -format tar -name "${NAME}-2" ../test.yml
diff -q "${NAME}-1.tar" "${NAME}-2.tar" || exit 1
exit 0

View File

@ -0,0 +1,27 @@
#!/bin/sh
# SUMMARY: Check that kernel+initrd output format build is reproducible
# LABELS:
set -e
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
NAME=check
clean_up() {
rm -f ${NAME}*
}
trap clean_up EXIT
# -disable-content-trust to speed up the test
linuxkit build -disable-content-trust -format kernel+initrd -name "${NAME}-1" ../test.yml
linuxkit build -disable-content-trust -format kernel+initrd -name "${NAME}-2" ../test.yml
diff -q "${NAME}-1-cmdline" "${NAME}-2-cmdline" || exit 1
diff -q "${NAME}-1-kernel" "${NAME}-2-kernel" || exit 1
diff -q "${NAME}-1-initrd.img" "${NAME}-2-initrd.img" || exit 1
exit 0

View File

@ -0,0 +1,52 @@
# NOTE: Images build from this file likely do not run
kernel:
image: linuxkit/kernel:4.14.90
cmdline: "console=ttyS0"
init:
- linuxkit/init:c563953a2277eb73a89d89f70e4b6dcdcfebc2d1
- linuxkit/runc:83d0edb4552b1a5df1f0976f05f442829eac38fe
- linuxkit/containerd:326b096cd5fbab0f864e52721d036cade67599d6
onboot:
- name: dhcpcd
image: linuxkit/dhcpcd:v0.6
command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"]
# Add some random unsorted caps
capabilities:
- CAP_SETGID
- CAP_DAC_OVERRIDE
services:
- name: testservice
image: linuxkit/ip:v0.6
# Some environments
env:
- BENV=true
- ARANDOMENV=foobar
# Some mounts
mounts:
- type: cgroup
options: ["rw","nosuid","noexec","nodev","relatime"]
- type: overlay
source: overlay
destination: writeable-host-etc
options: ["rw", "lowerdir=/etc", "upperdir=/run/hostetc/upper", "workdir=/run/hostetc/work"]
# Some binds
binds:
- /var/run:/var/run
- /foobar:/foobar
- /etc/foobar:/etc/foobar
- /etc/aaa:/etc/aaa
# And some runtime settings
runtime:
mkdir: ["/var/lib/docker"]
mkdir: ["/var/lib/aaa"]
files:
- path: etc/linuxkit-config
metadata: yaml
trust:
org:
- linuxkit
- library