From 2e6a19a018197f1f9dda54763e65b06e5ad16d1a Mon Sep 17 00:00:00 2001 From: Stanislav Makar Date: Tue, 15 May 2018 10:42:31 +0000 Subject: [PATCH] Add Ubuntu 18.04 support Use squashfs for more recent Ubuntu releases Change-Id: I80df28be6e2a5e03ae1450e84fc05715f21a7750 Closes-bug: 1766850 --- .../ubuntu-core/root.d/10-cache-ubuntu-image | 1 + .../elements/ubuntu/root.d/10-cache-ubuntu-tarball | 12 ++++++++++-- .../test-elements/bionic-build-succeeds/README.rst | 4 ++++ .../test-elements/bionic-build-succeeds/element-deps | 4 ++++ .../environment.d/10-set-distro.bash | 1 + .../bionic-build-succeeds/test-output-formats | 1 + .../run.yaml | 4 ++-- .../legacy/dib-dsvm-functests-python3-image/run.yaml | 4 ++-- tests/run_functests.sh | 1 + 9 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 diskimage_builder/elements/ubuntu/test-elements/bionic-build-succeeds/README.rst create mode 100644 diskimage_builder/elements/ubuntu/test-elements/bionic-build-succeeds/element-deps create mode 100644 diskimage_builder/elements/ubuntu/test-elements/bionic-build-succeeds/environment.d/10-set-distro.bash create mode 100644 diskimage_builder/elements/ubuntu/test-elements/bionic-build-succeeds/test-output-formats diff --git a/diskimage_builder/elements/ubuntu-core/root.d/10-cache-ubuntu-image b/diskimage_builder/elements/ubuntu-core/root.d/10-cache-ubuntu-image index 9f16abfd6..f3a36aba5 100755 --- a/diskimage_builder/elements/ubuntu-core/root.d/10-cache-ubuntu-image +++ b/diskimage_builder/elements/ubuntu-core/root.d/10-cache-ubuntu-image @@ -23,6 +23,7 @@ release_numbers[wily]=15.10 release_numbers[xenial]=16.04 release_numbers[yakkety]=16.10 release_numbers[zesty]=17.04 +release_numbers[bionic]=18.04 numeric_release=${release_numbers[$DIB_RELEASE]} DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cdimage.ubuntu.com/ubuntu-core/releases/$numeric_release/release} diff --git a/diskimage_builder/elements/ubuntu/root.d/10-cache-ubuntu-tarball b/diskimage_builder/elements/ubuntu/root.d/10-cache-ubuntu-tarball index 41241a5b5..d9e5d7bc0 100755 --- a/diskimage_builder/elements/ubuntu/root.d/10-cache-ubuntu-tarball +++ b/diskimage_builder/elements/ubuntu/root.d/10-cache-ubuntu-tarball @@ -14,7 +14,11 @@ shopt -s extglob DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud-images.ubuntu.com} DIB_RELEASE=${DIB_RELEASE:-trusty} -BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$DIB_RELEASE-server-cloudimg-$ARCH-root.tar.gz} +if [ $DIB_RELEASE != "trusty" ] && [ $DIB_RELEASE != "xenial" ]; then + BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$DIB_RELEASE-server-cloudimg-$ARCH.squashfs} +else + BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-$DIB_RELEASE-server-cloudimg-$ARCH-root.tar.gz} +fi SHA256SUMS=${SHA256SUMS:-https://${DIB_CLOUD_IMAGES##http?(s)://}/$DIB_RELEASE/current/SHA256SUMS} CACHED_FILE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE CACHED_FILE_LOCK=$DIB_LOCKFILES/$BASE_IMAGE_FILE.lock @@ -47,7 +51,11 @@ function get_ubuntu_tarball() { fi # Extract the base image (use --numeric-owner to avoid UID/GID mismatch between # image tarball and host OS e.g. when building Ubuntu image on an openSUSE host) - sudo tar -C $TARGET_ROOT --numeric-owner -xzf $DIB_IMAGE_CACHE/$BASE_IMAGE_FILE + if [ $DIB_RELEASE != "trusty" ] && [ $DIB_RELEASE != "xenial" ]; then + sudo unsquashfs -f -d $TARGET_ROOT $DIB_IMAGE_CACHE/$BASE_IMAGE_FILE + else + sudo tar -C $TARGET_ROOT --numeric-owner -xzf $DIB_IMAGE_CACHE/$BASE_IMAGE_FILE + fi } ( diff --git a/diskimage_builder/elements/ubuntu/test-elements/bionic-build-succeeds/README.rst b/diskimage_builder/elements/ubuntu/test-elements/bionic-build-succeeds/README.rst new file mode 100644 index 000000000..35bdfee4e --- /dev/null +++ b/diskimage_builder/elements/ubuntu/test-elements/bionic-build-succeeds/README.rst @@ -0,0 +1,4 @@ +Verify we can build a ubuntu image. + +Note this test includes the vm element to test the bootloader install, +and specifies to output a .qcow2 diff --git a/diskimage_builder/elements/ubuntu/test-elements/bionic-build-succeeds/element-deps b/diskimage_builder/elements/ubuntu/test-elements/bionic-build-succeeds/element-deps new file mode 100644 index 000000000..ccdc41079 --- /dev/null +++ b/diskimage_builder/elements/ubuntu/test-elements/bionic-build-succeeds/element-deps @@ -0,0 +1,4 @@ +block-device-mbr +openstack-ci-mirrors +vm + diff --git a/diskimage_builder/elements/ubuntu/test-elements/bionic-build-succeeds/environment.d/10-set-distro.bash b/diskimage_builder/elements/ubuntu/test-elements/bionic-build-succeeds/environment.d/10-set-distro.bash new file mode 100644 index 000000000..ba2fb47d2 --- /dev/null +++ b/diskimage_builder/elements/ubuntu/test-elements/bionic-build-succeeds/environment.d/10-set-distro.bash @@ -0,0 +1 @@ +export DIB_RELEASE=bionic diff --git a/diskimage_builder/elements/ubuntu/test-elements/bionic-build-succeeds/test-output-formats b/diskimage_builder/elements/ubuntu/test-elements/bionic-build-succeeds/test-output-formats new file mode 100644 index 000000000..c780936b8 --- /dev/null +++ b/diskimage_builder/elements/ubuntu/test-elements/bionic-build-succeeds/test-output-formats @@ -0,0 +1 @@ +tar,qcow2 \ No newline at end of file diff --git a/playbooks/legacy/dib-dsvm-functests-python2-centos-7-image/run.yaml b/playbooks/legacy/dib-dsvm-functests-python2-centos-7-image/run.yaml index 308201116..63dbc4517 100644 --- a/playbooks/legacy/dib-dsvm-functests-python2-centos-7-image/run.yaml +++ b/playbooks/legacy/dib-dsvm-functests-python2-centos-7-image/run.yaml @@ -67,8 +67,8 @@ opensuse/build-succeeds \ opensuse/opensuse423-build-succeeds \ fedora/build-succeeds \ - ubuntu/trusty-build-succeeds \ - ubuntu/xenial-build-succeeds + ubuntu/xenial-build-succeeds \ + ubuntu/bionic-build-succeeds set +u deactivate diff --git a/playbooks/legacy/dib-dsvm-functests-python3-image/run.yaml b/playbooks/legacy/dib-dsvm-functests-python3-image/run.yaml index 224b81ec1..8ef5ee2cf 100644 --- a/playbooks/legacy/dib-dsvm-functests-python3-image/run.yaml +++ b/playbooks/legacy/dib-dsvm-functests-python3-image/run.yaml @@ -67,8 +67,8 @@ opensuse/build-succeeds \ opensuse/opensuse423-build-succeeds \ fedora/build-succeeds \ - ubuntu/trusty-build-succeeds \ - ubuntu/xenial-build-succeeds + ubuntu/xenial-build-succeeds \ + ubuntu/bionic-build-succeeds set +u deactivate diff --git a/tests/run_functests.sh b/tests/run_functests.sh index 3344cf18a..189845f14 100755 --- a/tests/run_functests.sh +++ b/tests/run_functests.sh @@ -44,6 +44,7 @@ DEFAULT_SKIP_TESTS=( fedora/build-succeeds ubuntu/trusty-build-succeeds ubuntu/xenial-build-succeeds + ubuntu/bionic-build-succeeds # No longer reasonable to test upstream (lacks a mirror in infra) # Note this is centos6 and should probably be removed