From f42e5fd7a345d950d0521fbbdebe891179bdd5a6 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Thu, 22 Jun 2017 14:27:20 +0100 Subject: [PATCH] Use DIB_RELEASE to set fedora-atomic variable defaults When building a fedora atomic image using magnum's DIB element, setting the DIB_RELEASE environment variable does not affect the release of the fedora-atomic image built, even when FEDORA_ATOMIC_TREE_REF and FEDORA_ATOMIC_TREE_URL take their default values - fedora atomic 24 is always built. Further, fedora atomic 24 is not supported by magnum for kubernetes in newton onwards since the configuration of flannel was changed[1]. This change uses the DIB_RELEASE variable to set the default values of FEDORA_ATOMIC_TREE_URL and FEDORA_ATOMIC_TREE_REF. This ensures that fedora atomic images have an expected release, and one that by default is supported by magnum (currently DIB_RELEASE defaults to 25 in diskimage-builder). [1] https://bugs.launchpad.net/magnum/+bug/1679301 Change-Id: I9e1c846657ac9e65e2cdd8d32c96cdbf85900ba0 Closes-Bug: #1699766 Closes-Bug: #1699765 --- .../common/image/fedora-atomic/README.rst | 17 +++++++++-------- .../environment.d/50-fedora-atomic | 4 ++-- .../fedora-atomic/finalise.d/80-fedora-atomic | 2 +- .../fedora-atomic/install_imagebuild_deps.sh | 3 ++- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/magnum/drivers/common/image/fedora-atomic/README.rst b/magnum/drivers/common/image/fedora-atomic/README.rst index 4e51259445..48823b3729 100644 --- a/magnum/drivers/common/image/fedora-atomic/README.rst +++ b/magnum/drivers/common/image/fedora-atomic/README.rst @@ -18,6 +18,7 @@ present: * yum * yum-utils * python-yaml +* curl For Debian/Ubuntu systems, use:: @@ -26,15 +27,15 @@ For Debian/Ubuntu systems, use:: For CentOS and Fedora < 22, use:: - yum install python-dev build-essential python-pip kpartx python-lzma qemu-utils yum yum-utils python-yaml + yum install python-dev build-essential python-pip kpartx python-lzma qemu-utils yum yum-utils python-yaml curl For Fedora >= 22, use:: - dnf install python-devel @development-tools python-pip kpartx python-backports-lzma @virtualization yum yum-utils python-yaml + dnf install python-devel @development-tools python-pip kpartx python-backports-lzma @virtualization yum yum-utils python-yaml curl How to generate Fedora Atomic image ----------------------------------- -To generate an atomic image for Fedora 24 these commands can be +To generate an atomic image for Fedora 25 these commands can be executed:: # Install diskimage-builder in virtual environment @@ -49,7 +50,7 @@ executed:: export ELEMENTS_PATH=$(python -c 'import os, diskimage_builder, pkg_resources;print(os.path.abspath(pkg_resources.resource_filename(diskimage_builder.__name__, "elements")))') export ELEMENTS_PATH="${ELEMENTS_PATH}:${PWD}/magnum/magnum/drivers/common/image" - export DIB_RELEASE=24 # this can be switched to the desired version + export DIB_RELEASE=25 # this can be switched to the desired version export DIB_IMAGE_SIZE=2.5 # we need to give a bit more space to loopback device disk-image-create fedora-atomic -o fedora-atomic @@ -67,15 +68,15 @@ FEDORA_ATOMIC_TREE_URL :Required: Yes :Description: Url for the public fedora-atomic tree to use. It can reference to own published trees. - :Default: `https://kojipkgs.fedoraproject.org/atomic/24/ `_ + :Default: ``https://kojipkgs.fedoraproject.org/atomic/${DIB_RELEASE}/`` FEDORA_ATOMIC_TREE_REF :Required: Yes :Description: Reference of the tree to install. - :Default: d9c8b8a31238e857f010c6fdc282f5f611d3c8af3e78caa891f7edb85822771b + :Default: ``$(curl ${FEDORA_ATOMIC_TREE_URL}/refs/heads/fedora-atomic/${DIB_RELEASE}/x86_64/docker-host)`` You can use the defaults or export your url and reference, like following:: - export FEDORA_ATOMIC_TREE_URL="https://kojipkgs.fedoraproject.org/atomic/24/" - export FEDORA_ATOMIC_TREE_REF="$(curl https://kojipkgs.fedoraproject.org/atomic/24/refs/heads/fedora-atomic/f24/x86_64/docker-host)" + export FEDORA_ATOMIC_TREE_URL="https://kojipkgs.fedoraproject.org/atomic/25/" + export FEDORA_ATOMIC_TREE_REF="$(curl https://kojipkgs.fedoraproject.org/atomic/25/refs/heads/fedora-atomic/25/x86_64/docker-host)" diff --git a/magnum/drivers/common/image/fedora-atomic/environment.d/50-fedora-atomic b/magnum/drivers/common/image/fedora-atomic/environment.d/50-fedora-atomic index 3308fe909a..5ed6f5fce6 100644 --- a/magnum/drivers/common/image/fedora-atomic/environment.d/50-fedora-atomic +++ b/magnum/drivers/common/image/fedora-atomic/environment.d/50-fedora-atomic @@ -1,2 +1,2 @@ -export FEDORA_ATOMIC_TREE_URL=${FEDORA_ATOMIC_TREE_URL:-https://kojipkgs.fedoraproject.org/atomic/24/} -export FEDORA_ATOMIC_TREE_REF=${FEDORA_ATOMIC_TREE_REF:-d9c8b8a31238e857f010c6fdc282f5f611d3c8af3e78caa891f7edb85822771b} +export FEDORA_ATOMIC_TREE_URL=${FEDORA_ATOMIC_TREE_URL:-https://kojipkgs.fedoraproject.org/atomic/${DIB_RELEASE}/} +export FEDORA_ATOMIC_TREE_REF=${FEDORA_ATOMIC_TREE_REF:-$(curl ${FEDORA_ATOMIC_TREE_URL}/refs/heads/fedora-atomic/${DIB_RELEASE}/x86_64/docker-host)} diff --git a/magnum/drivers/common/image/fedora-atomic/finalise.d/80-fedora-atomic b/magnum/drivers/common/image/fedora-atomic/finalise.d/80-fedora-atomic index e8aa509fe9..6d70c42b1b 100755 --- a/magnum/drivers/common/image/fedora-atomic/finalise.d/80-fedora-atomic +++ b/magnum/drivers/common/image/fedora-atomic/finalise.d/80-fedora-atomic @@ -27,7 +27,7 @@ VMLINUZ_IMAGE=$(find ${DEPLOYED_DIRECTORY} -name vmlinuz*) # generate ostree boot cat > /etc/grub.d/15_ostree <