From c8a3fd0e7a239535220a285effa769adee65bfd0 Mon Sep 17 00:00:00 2001 From: Justin Cormack Date: Wed, 7 Jun 2017 16:53:02 +0100 Subject: [PATCH] Update Moby tool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - rename img→raw and gcp-img→gcp - support creating `docker` outputs, see https://github.com/moby/tool/tree/master/examples - less memory usage via streaming outputs - allow specification of multiple yaml files in a single command line, improves modularity - notary fixes and local cache, so does not pull as much - you now have to specify the full filename of the yaml file, you cannot omit the suffix Signed-off-by: Justin Cormack --- .gitignore | 1 + Makefile | 2 +- docs/platform-gcp.md | 4 ++-- test/Makefile | 4 ++-- test/cases/000_build/000_outputs/test.sh | 7 +++---- test/cases/010_platforms/000_qemu/040_run_raw/test.sh | 6 +++--- test/cases/020_kernel/000_config_4.4.x/test.sh | 2 +- test/cases/020_kernel/001_config_4.9.x/test.sh | 2 +- test/cases/020_kernel/003_config_4.11.x/test.sh | 2 +- test/cases/020_kernel/010_kmod_4.9.x/test.sh | 2 +- test/cases/040_packages/002_binfmt/test.sh | 2 +- test/cases/040_packages/003_ca-certificates/test.sh | 2 +- test/cases/040_packages/004_dhcpcd/test.sh | 2 +- test/cases/040_packages/019_sysctl/test.sh | 2 +- 14 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 6673d67d4..d51e3e51d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ Dockerfile.media *.img *.tag *.iso +*.raw *.vhd *.vmdk *.vmdk.lck diff --git a/Makefile b/Makefile index e6b1525e0..7efb640c7 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ endif PREFIX?=/usr/local/ -MOBY_COMMIT=3a16c02f100d1e01ea405a33d21a02de2a85904f +MOBY_COMMIT=e0aac90f4476c7dadfec9ab4116cf1363e51ce77 bin/moby: Makefile | bin docker run --rm --log-driver=none $(CROSS) $(GO_COMPILE) --clone-path github.com/moby/tool --clone https://github.com/moby/tool.git --commit $(MOBY_COMMIT) --package github.com/moby/tool/cmd/moby --ldflags "-X main.GitCommit=$(GIT_COMMIT) -X main.Version=$(VERSION)" -o $@ > tmp_moby_bin.tar tar xf tmp_moby_bin.tar > $@ diff --git a/docs/platform-gcp.md b/docs/platform-gcp.md index 4fec58637..f8eb7c5e9 100644 --- a/docs/platform-gcp.md +++ b/docs/platform-gcp.md @@ -50,11 +50,11 @@ Make sure to download the credentials in JSON format and store them somewhere sa ## Build an image -When using `moby build ...` to build an image, specify `-output gcp-img` to +When using `moby build ...` to build an image, specify `-output gcp` to build an image in a format that GCP will understand. For example: ``` -moby build -output gcp-img myprefix.yml +moby build -output gcp myprefix.yml ``` This will create a local `myprefix.img.tar.gz` compressed image file. diff --git a/test/Makefile b/test/Makefile index f68c8db32..249b1cf8f 100644 --- a/test/Makefile +++ b/test/Makefile @@ -31,7 +31,7 @@ gcp-hack: ../artifacts/test.img.tar.gz ../artifacts/test.img.tar.gz: rm -rf ../artifacts mkdir -p ../artifacts - $(MOBY) build -output gcp-img -pull -name ../artifacts/test hack/test.yml + $(MOBY) build -output gcp -pull -name ../artifacts/test hack/test.yml define check_test_log @cat $1 |grep -q 'test suite PASSED' @@ -40,7 +40,7 @@ endef .PHONY: ltp ltp: export CLOUDSDK_IMAGE_NAME?=test-ltp ltp: $(LINUXKIT) test-ltp.img.tar.gz - $(MOBY) build -output gcp-img -pull hack/test-ltp.yml + $(MOBY) build -output gcp -pull hack/test-ltp.yml $(LINUXKIT) push gcp test-ltp.img.tar.gz $(LINUXKIT) run gcp -skip-cleanup -machine n1-highcpu-4 $(CLOUDSDK_IMAGE_NAME) | tee test-ltp.log $(call check_test_log, test-ltp.log) diff --git a/test/cases/000_build/000_outputs/test.sh b/test/cases/000_build/000_outputs/test.sh index f846ed093..5d12555b7 100644 --- a/test/cases/000_build/000_outputs/test.sh +++ b/test/cases/000_build/000_outputs/test.sh @@ -17,15 +17,14 @@ clean_up() { trap clean_up EXIT -moby build -disable-content-trust -output tar,kernel+initrd,iso-bios,iso-efi,img,img-gz,qcow2,vmdk -name "${NAME}" test.yml -[ -f "${NAME}.tar" ] || exit 1 +moby build -disable-content-trust -output kernel+initrd,iso-bios,iso-efi,gcp,raw,qcow2,vmdk -name "${NAME}" test.yml [ -f "${NAME}-kernel" ] || exit 1 [ -f "${NAME}-initrd.img" ] || exit 1 [ -f "${NAME}-cmdline" ] || exit 1 [ -f "${NAME}.iso" ] || exit 1 [ -f "${NAME}-efi.iso" ] || exit 1 -[ -f "${NAME}.img" ] || exit 1 -[ -f "${NAME}.img.gz" ] || exit 1 +[ -f "${NAME}.img.tar.gz" ] || exit 1 +[ -f "${NAME}.raw" ] || exit 1 [ -f "${NAME}.qcow2" ] || exit 1 # VHD currently requires a lot of memory, disable for now # [ -f "${NAME}.vhd" ] || exit 1 diff --git a/test/cases/010_platforms/000_qemu/040_run_raw/test.sh b/test/cases/010_platforms/000_qemu/040_run_raw/test.sh index e213f2057..27b9d5aab 100644 --- a/test/cases/010_platforms/000_qemu/040_run_raw/test.sh +++ b/test/cases/010_platforms/000_qemu/040_run_raw/test.sh @@ -17,7 +17,7 @@ clean_up() { trap clean_up EXIT -moby build -output img -name "${NAME}" test.yml -[ -f "${NAME}.img" ] || exit 1 -linuxkit run qemu "${NAME}.img" | grep -q "Welcome to LinuxKit" +moby build -output raw -name "${NAME}" test.yml +[ -f "${NAME}.raw" ] || exit 1 +linuxkit run qemu "${NAME}.raw" | grep -q "Welcome to LinuxKit" exit 0 diff --git a/test/cases/020_kernel/000_config_4.4.x/test.sh b/test/cases/020_kernel/000_config_4.4.x/test.sh index 12908d5d3..f05fc86d5 100644 --- a/test/cases/020_kernel/000_config_4.4.x/test.sh +++ b/test/cases/020_kernel/000_config_4.4.x/test.sh @@ -15,7 +15,7 @@ clean_up() { trap clean_up EXIT # Test code goes here -moby build -output kernel+initrd test-kernel-config +moby build -output kernel+initrd test-kernel-config.yml RESULT="$(linuxkit run qemu -kernel test-kernel-config)" echo "${RESULT}" | grep -q "suite PASSED" diff --git a/test/cases/020_kernel/001_config_4.9.x/test.sh b/test/cases/020_kernel/001_config_4.9.x/test.sh index b0b4e5c02..1c047cae1 100644 --- a/test/cases/020_kernel/001_config_4.9.x/test.sh +++ b/test/cases/020_kernel/001_config_4.9.x/test.sh @@ -15,7 +15,7 @@ clean_up() { trap clean_up EXIT # Test code goes here -moby build -output kernel+initrd test-kernel-config +moby build -output kernel+initrd test-kernel-config.yml RESULT="$(linuxkit run qemu test-kernel-config)" echo "${RESULT}" | grep -q "suite PASSED" diff --git a/test/cases/020_kernel/003_config_4.11.x/test.sh b/test/cases/020_kernel/003_config_4.11.x/test.sh index b0b4e5c02..1c047cae1 100644 --- a/test/cases/020_kernel/003_config_4.11.x/test.sh +++ b/test/cases/020_kernel/003_config_4.11.x/test.sh @@ -15,7 +15,7 @@ clean_up() { trap clean_up EXIT # Test code goes here -moby build -output kernel+initrd test-kernel-config +moby build -output kernel+initrd test-kernel-config.yml RESULT="$(linuxkit run qemu test-kernel-config)" echo "${RESULT}" | grep -q "suite PASSED" diff --git a/test/cases/020_kernel/010_kmod_4.9.x/test.sh b/test/cases/020_kernel/010_kmod_4.9.x/test.sh index efff37070..50f6079ca 100644 --- a/test/cases/020_kernel/010_kmod_4.9.x/test.sh +++ b/test/cases/020_kernel/010_kmod_4.9.x/test.sh @@ -22,6 +22,6 @@ docker pull linuxkit/kernel:4.9.x # Build a package docker build -t ${IMAGE_NAME} . # Build a LinuxKit image with kernel module (and test script) -moby build -output kernel+initrd kmod +moby build -output kernel+initrd kmod.yml # Run it linuxkit run qemu kmod | grep -q "Hello LinuxKit" diff --git a/test/cases/040_packages/002_binfmt/test.sh b/test/cases/040_packages/002_binfmt/test.sh index 3d75a4ef7..78641aa60 100644 --- a/test/cases/040_packages/002_binfmt/test.sh +++ b/test/cases/040_packages/002_binfmt/test.sh @@ -16,7 +16,7 @@ clean_up() { trap clean_up EXIT # Test code goes here -moby build -output kernel+initrd test-binfmt +moby build -output kernel+initrd test-binfmt.yml RESULT="$(linuxkit run qemu -kernel test-binfmt)" echo "${RESULT}" echo "${RESULT}" | grep -q "suite PASSED" diff --git a/test/cases/040_packages/003_ca-certificates/test.sh b/test/cases/040_packages/003_ca-certificates/test.sh index 6ca44b026..5e634a646 100644 --- a/test/cases/040_packages/003_ca-certificates/test.sh +++ b/test/cases/040_packages/003_ca-certificates/test.sh @@ -16,7 +16,7 @@ clean_up() { trap clean_up EXIT # Test code goes here -moby build -output kernel+initrd test-ca-certificates +moby build -output kernel+initrd test-ca-certificates.yml RESULT="$(linuxkit run qemu -kernel test-ca-certificates)" echo "${RESULT}" echo "${RESULT}" | grep -q "suite PASSED" diff --git a/test/cases/040_packages/004_dhcpcd/test.sh b/test/cases/040_packages/004_dhcpcd/test.sh index 06c884208..e4bd6104a 100644 --- a/test/cases/040_packages/004_dhcpcd/test.sh +++ b/test/cases/040_packages/004_dhcpcd/test.sh @@ -16,7 +16,7 @@ clean_up() { trap clean_up EXIT # Test code goes here -moby build -output kernel+initrd test-dhcpcd +moby build -output kernel+initrd test-dhcpcd.yml RESULT="$(linuxkit run qemu -kernel test-dhcpcd)" echo "${RESULT}" echo "${RESULT}" | grep -q "suite PASSED" diff --git a/test/cases/040_packages/019_sysctl/test.sh b/test/cases/040_packages/019_sysctl/test.sh index eb048c8f2..732c7be5c 100644 --- a/test/cases/040_packages/019_sysctl/test.sh +++ b/test/cases/040_packages/019_sysctl/test.sh @@ -16,7 +16,7 @@ clean_up() { trap clean_up EXIT # Test code goes here -moby build -output kernel+initrd test-sysctl +moby build -output kernel+initrd test-sysctl.yml RESULT="$(linuxkit run qemu -kernel test-sysctl)" echo "${RESULT}" echo "${RESULT}" | grep -q "suite PASSED"