diff --git a/test/cases/000_build/010_reproducible/000_tar/test.sh b/test/cases/000_build/010_reproducible/000_tar/test.sh new file mode 100644 index 000000000..cfd8c099b --- /dev/null +++ b/test/cases/000_build/010_reproducible/000_tar/test.sh @@ -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 diff --git a/test/cases/000_build/010_reproducible/002_kernel+initrd/test.sh b/test/cases/000_build/010_reproducible/002_kernel+initrd/test.sh new file mode 100644 index 000000000..260cb7dad --- /dev/null +++ b/test/cases/000_build/010_reproducible/002_kernel+initrd/test.sh @@ -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 diff --git a/test/cases/000_build/010_reproducible/test.yml b/test/cases/000_build/010_reproducible/test.yml new file mode 100644 index 000000000..a4934cafd --- /dev/null +++ b/test/cases/000_build/010_reproducible/test.yml @@ -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