From 80ff74ca4d14990ffd2a50bc5fe11b4d548a3575 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Mon, 10 May 2021 12:13:10 +1000 Subject: [PATCH] Add fedora-containerfile element This builds Fedora from the containerfile element. Depends-On: https://review.opendev.org/c/zuul/nodepool/+/790531 Depends-On: https://review.opendev.org/c/opendev/glean/+/790368 Change-Id: I5cf9b0505f2d542b3611ebbf9494f9be11e61f34 --- .zuul.d/jobs.yaml | 13 ++++++++---- .zuul.d/project.yaml | 4 ++-- .../elements/fedora-container/README.rst | 9 +++++++++ .../fedora-container/containerfiles/34 | 3 +++ .../elements/fedora-container/element-deps | 6 ++++++ .../10-01-fedora-distro-name.bash | 2 ++ .../environment.d/11-yum-dnf.bash | 1 + .../fedora-container/package-installs.yaml | 20 +++++++++++++++++++ .../elements/fedora-container/pkg-map | 16 +++++++++++++++ .../test-elements/build-succeeds/README.rst | 1 + .../test-elements/build-succeeds/element-deps | 3 +++ 11 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 diskimage_builder/elements/fedora-container/README.rst create mode 100644 diskimage_builder/elements/fedora-container/containerfiles/34 create mode 100644 diskimage_builder/elements/fedora-container/element-deps create mode 100644 diskimage_builder/elements/fedora-container/environment.d/10-01-fedora-distro-name.bash create mode 100644 diskimage_builder/elements/fedora-container/environment.d/11-yum-dnf.bash create mode 100644 diskimage_builder/elements/fedora-container/package-installs.yaml create mode 100644 diskimage_builder/elements/fedora-container/pkg-map create mode 100644 diskimage_builder/elements/fedora-container/test-elements/build-succeeds/README.rst create mode 100644 diskimage_builder/elements/fedora-container/test-elements/build-succeeds/element-deps diff --git a/.zuul.d/jobs.yaml b/.zuul.d/jobs.yaml index 4961ad23..421999a2 100644 --- a/.zuul.d/jobs.yaml +++ b/.zuul.d/jobs.yaml @@ -30,6 +30,7 @@ - ubuntu-minimal/bionic-build-succeeds - ubuntu-minimal/focal-build-succeeds - containerfile/focal-build-succeeds + - fedora-container/build-succeeds - job: name: dib-functests-image @@ -180,14 +181,18 @@ # mirror: "http://{{ zuul_site_mirror_fqdn }}/centos" - job: - name: dib-nodepool-functional-openstack-fedora-32-src + name: dib-nodepool-functional-openstack-fedora-34-containerfile-src description: | - Test building and booting a Fedora 32 image with Nodepool and OpenStack + Test building and booting an Fedora image from a + containerfile with Nodepool and OpenStack (using released + libraries) parent: dib-nodepool-functional-src-base + pre-run: playbooks/dib-nodepool/debootstrap.yaml vars: + nodepool_debug: true nodepool_diskimage: - base_element: fedora-minimal - release: '32' + base_element: fedora-container + release: '34' - job: name: dib-nodepool-functional-openstack-ubuntu-xenial-src diff --git a/.zuul.d/project.yaml b/.zuul.d/project.yaml index 472adac5..672b670c 100644 --- a/.zuul.d/project.yaml +++ b/.zuul.d/project.yaml @@ -17,7 +17,7 @@ - dib-nodepool-functional-openstack-centos-7-src - dib-nodepool-functional-openstack-centos-8-src - dib-nodepool-functional-openstack-centos-8-stream-src - - dib-nodepool-functional-openstack-fedora-32-src + - dib-nodepool-functional-openstack-fedora-34-containerfile-src - dib-nodepool-functional-openstack-ubuntu-xenial-src - dib-nodepool-functional-openstack-ubuntu-bionic-src - dib-nodepool-functional-openstack-ubuntu-focal-src @@ -46,7 +46,7 @@ - dib-nodepool-functional-openstack-centos-7-src - dib-nodepool-functional-openstack-centos-8-src - dib-nodepool-functional-openstack-centos-8-stream-src - - dib-nodepool-functional-openstack-fedora-32-src + - dib-nodepool-functional-openstack-fedora-34-containerfile-src - dib-nodepool-functional-openstack-ubuntu-xenial-src - dib-nodepool-functional-openstack-ubuntu-bionic-src - dib-nodepool-functional-openstack-ubuntu-focal-src diff --git a/diskimage_builder/elements/fedora-container/README.rst b/diskimage_builder/elements/fedora-container/README.rst new file mode 100644 index 00000000..a932c9e6 --- /dev/null +++ b/diskimage_builder/elements/fedora-container/README.rst @@ -0,0 +1,9 @@ +================ +fedora-container +================ + +Create a minimal image based on Fedora container image + +This element sets the ``DIB_RELEASE`` var to 'fedora'. The release of +fedora to be installed can be controlled through the ``DIB_RELEASE`` +variable, which defaults the latest supported release. diff --git a/diskimage_builder/elements/fedora-container/containerfiles/34 b/diskimage_builder/elements/fedora-container/containerfiles/34 new file mode 100644 index 00000000..ec65db84 --- /dev/null +++ b/diskimage_builder/elements/fedora-container/containerfiles/34 @@ -0,0 +1,3 @@ +FROM docker.io/library/fedora:34 + +RUN dnf install -y findutils diff --git a/diskimage_builder/elements/fedora-container/element-deps b/diskimage_builder/elements/fedora-container/element-deps new file mode 100644 index 00000000..60e6d1aa --- /dev/null +++ b/diskimage_builder/elements/fedora-container/element-deps @@ -0,0 +1,6 @@ +containerfile +package-installs +redhat-common +rpm-distro +vm +yum diff --git a/diskimage_builder/elements/fedora-container/environment.d/10-01-fedora-distro-name.bash b/diskimage_builder/elements/fedora-container/environment.d/10-01-fedora-distro-name.bash new file mode 100644 index 00000000..f4fd47a5 --- /dev/null +++ b/diskimage_builder/elements/fedora-container/environment.d/10-01-fedora-distro-name.bash @@ -0,0 +1,2 @@ +export DISTRO_NAME=fedora +export DIB_RELEASE=${DIB_RELEASE:-34} diff --git a/diskimage_builder/elements/fedora-container/environment.d/11-yum-dnf.bash b/diskimage_builder/elements/fedora-container/environment.d/11-yum-dnf.bash new file mode 100644 index 00000000..91514f1e --- /dev/null +++ b/diskimage_builder/elements/fedora-container/environment.d/11-yum-dnf.bash @@ -0,0 +1 @@ +export YUM=dnf diff --git a/diskimage_builder/elements/fedora-container/package-installs.yaml b/diskimage_builder/elements/fedora-container/package-installs.yaml new file mode 100644 index 00000000..1b66417c --- /dev/null +++ b/diskimage_builder/elements/fedora-container/package-installs.yaml @@ -0,0 +1,20 @@ +audit: +dracut: +dracut-config-generic: +grubby: +kernel: +initscripts: +man-pages: +lsb_release: +redhat-rpm-config: +linux-firmware: + uninstall: true +linux-firmware-whence: + uninstall: true +# NOTE(ianw) pkg-map restricts this to !rhel/centos 7; in 7 +# the "initscripts" package handles basic networking, in +# 8+ it's the role of NetworkManager and dhcp-client. This +# mirrors the default packages installed in upstream cloud images +# to facilitate a basic network. +NetworkManager: +dhcp-client: \ No newline at end of file diff --git a/diskimage_builder/elements/fedora-container/pkg-map b/diskimage_builder/elements/fedora-container/pkg-map new file mode 100644 index 00000000..c3044360 --- /dev/null +++ b/diskimage_builder/elements/fedora-container/pkg-map @@ -0,0 +1,16 @@ +{ + "release": { + "centos": { + "7": { + "NetworkManager": "", + "dhcp-client": "" + } + } + }, +"family": { + "redhat": { + "lsb_release": "redhat-lsb-core" + } + } +} + diff --git a/diskimage_builder/elements/fedora-container/test-elements/build-succeeds/README.rst b/diskimage_builder/elements/fedora-container/test-elements/build-succeeds/README.rst new file mode 100644 index 00000000..ad83e288 --- /dev/null +++ b/diskimage_builder/elements/fedora-container/test-elements/build-succeeds/README.rst @@ -0,0 +1 @@ +Verify we can build a fedora-container image. diff --git a/diskimage_builder/elements/fedora-container/test-elements/build-succeeds/element-deps b/diskimage_builder/elements/fedora-container/test-elements/build-succeeds/element-deps new file mode 100644 index 00000000..20b98fe3 --- /dev/null +++ b/diskimage_builder/elements/fedora-container/test-elements/build-succeeds/element-deps @@ -0,0 +1,3 @@ +block-device-gpt +openstack-ci-mirrors +vm