From fbfdfaafda464a9b51c7a95da6bf3a972d598751 Mon Sep 17 00:00:00 2001 From: Vladislav Kuzmin Date: Mon, 12 Jul 2021 16:53:35 +0400 Subject: [PATCH] Remove unused iso-bulder It was used in the old version of isogen. This image is currently not used. Change-Id: Ia23bba08d6a2cd8fef14b384aff43ec9225d9191 --- .zuul.yaml | 9 -- iso-builder/Dockerfile | 42 ------- iso-builder/Makefile | 140 ----------------------- iso-builder/README.md | 27 ----- iso-builder/examples/isogen.yaml | 9 -- iso-builder/examples/network-config | 18 --- iso-builder/examples/user-data | 11 -- iso-builder/files/build.sh | 41 ------- iso-builder/files/functions.sh | 156 -------------------------- iso-builder/files/grub.conf | 11 -- iso-builder/files/meta_data.json | 5 - iso-builder/files/packages_install.sh | 49 -------- playbooks/airship-images-test.yaml | 46 -------- 13 files changed, 564 deletions(-) delete mode 100644 iso-builder/Dockerfile delete mode 100644 iso-builder/Makefile delete mode 100644 iso-builder/README.md delete mode 100644 iso-builder/examples/isogen.yaml delete mode 100644 iso-builder/examples/network-config delete mode 100644 iso-builder/examples/user-data delete mode 100644 iso-builder/files/build.sh delete mode 100644 iso-builder/files/functions.sh delete mode 100644 iso-builder/files/grub.conf delete mode 100644 iso-builder/files/meta_data.json delete mode 100644 iso-builder/files/packages_install.sh delete mode 100644 playbooks/airship-images-test.yaml diff --git a/.zuul.yaml b/.zuul.yaml index 47624ca..df0a224 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -27,11 +27,9 @@ image_tag: latest check: jobs: - - airship-images-functional - airship-images-build gate: jobs: - - airship-images-functional - airship-images-build post: jobs: @@ -42,13 +40,6 @@ jobs: - images-upload-git-mirror -- job: - name: airship-images-functional - nodeset: airship-images-single-node - pre-run: playbooks/airship-images-deploy-docker.yaml - run: playbooks/airship-images-test.yaml - post-run: playbooks/airship-collect-logs.yaml - - job: name: airship-images-build nodeset: airship-images-single-node diff --git a/iso-builder/Dockerfile b/iso-builder/Dockerfile deleted file mode 100644 index 1c10c70..0000000 --- a/iso-builder/Dockerfile +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2018 AT&T Intellectual Property. All other rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -ARG FROM=ubuntu:focal - -FROM ${FROM} - -LABEL org.opencontainers.image.authors='airship-discuss@lists.airshipit.org, irc://#airshipit@freenode' \ - org.opencontainers.image.url='https://airshipit.org' \ - org.opencontainers.image.documentation='https://airship-images.readthedocs.org' \ - org.opencontainers.image.source='https://opendev.org/airship/images' \ - org.opencontainers.image.vendor='The Airship Authors' \ - org.opencontainers.image.licenses='Apache-2.0' - -RUN apt-get update && apt-get install -y \ - curl\ - debootstrap \ - dosfstools \ - grub-efi-amd64-bin \ - grub-pc-bin \ - mtools \ - squashfs-tools \ - xorriso \ - && rm -rf /var/lib/apt/lists/* - -COPY files/ /builder/ - -RUN curl -L https://github.com/mikefarah/yq/releases/download/2.4.0/yq_linux_amd64 -o /bin/yq \ - && chmod +x /bin/yq - -CMD /bin/bash /builder/build.sh diff --git a/iso-builder/Makefile b/iso-builder/Makefile deleted file mode 100644 index dbb06f9..0000000 --- a/iso-builder/Makefile +++ /dev/null @@ -1,140 +0,0 @@ -# Copyright 2018 AT&T Intellectual Property. All other rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -SHELL := /bin/bash -BUILD_DIR ?= build -PUSH_IMAGE ?= false -IMAGE_ID ?= none -COMMIT ?= $(shell git rev-parse HEAD) -LABEL ?= org.airshipit.build=community -IMAGE_NAME ?= isogen -DOCKER_REGISTRY ?= quay.io -IMAGE_PREFIX ?= airshipit -IMAGE_TAG ?= latest -DISTRO ?= ubuntu_focal -IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}-${DISTRO} -SH_TO_CHECK := $(wildcard files/*.sh ) -PROXY ?= http://proxy.foo.com:8000 -NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local -USE_PROXY ?= false - -all: lint images - -check-docker: - @if [ -z $$(which docker) ]; then \ - echo "Missing \`docker\` client which is required for development"; \ - exit 2; \ - fi - -images: check-docker build_isogen - -docs: clean build_docs - -build_docs: - echo TODO - -run_images: run_isogen - -run_isogen: $(BUILD_DIR)/output-metadata.yaml - echo OK - #TODO consistance test - -$(BUILD_DIR)/output-metadata.yaml: $(BUILD_DIR)/image_id - cp examples/user-data $(BUILD_DIR) - cp examples/isogen.yaml $(BUILD_DIR) - cp examples/network-config $(BUILD_DIR) -ifeq ($(USE_PROXY), true) - docker run \ - --rm \ - -e BUILDER_CONFIG=/config/isogen.yaml \ - -e http_proxy=$(PROXY) \ - -e https_proxy=$(PROXY) \ - -e HTTP_PROXY=$(PROXY) \ - -e HTTPS_PROXY=$(PROXY) \ - -e no_proxy=$(NO_PROXY) \ - -e NO_PROXY=$(NO_PROXY) \ - -v $(shell realpath $(BUILD_DIR)):/config/ \ - $(shell cat $(BUILD_DIR)/image_id) -else - docker run \ - --rm \ - -e BUILDER_CONFIG=/config/isogen.yaml \ - -v $(shell realpath $(BUILD_DIR)):/config/ \ - $(shell cat $(BUILD_DIR)/image_id) -endif -$(BUILD_DIR)/image_id: build_isogen - -build_isogen: - mkdir -p $(BUILD_DIR) -ifeq ($(IMAGE_ID), none) -ifeq ($(USE_PROXY), true) - docker build . \ - --iidfile $(BUILD_DIR)/image_id \ - --tag $(IMAGE) \ - --label $(LABEL) \ - --label "org.opencontainers.image.revision=$(COMMIT)" \ - --label "org.opencontainers.image.created=\ - $(shell date --rfc-3339=seconds --utc)" \ - --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ - --build-arg http_proxy=$(PROXY) \ - --build-arg https_proxy=$(PROXY) \ - --build-arg HTTP_PROXY=$(PROXY) \ - --build-arg HTTPS_PROXY=$(PROXY) \ - --build-arg no_proxy=$(NO_PROXY) \ - --build-arg NO_PROXY=$(NO_PROXY) \ - --build-arg GIT_COMMIT=$(COMMIT) -else - docker build . \ - --iidfile $(BUILD_DIR)/image_id \ - --tag $(IMAGE) \ - --label $(LABEL) \ - --label "org.opencontainers.image.revision=$(COMMIT)" \ - --label "org.opencontainers.image.created=\ - $(shell date --rfc-3339=seconds --utc)" \ - --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ - --build-arg GIT_COMMIT=$(COMMIT) -endif -else - echo $(IMAGE_ID) > $(BUILD_DIR)/image_id -endif -ifeq ($(PUSH_IMAGE), true) - docker push $(IMAGE) -endif - - -clean: -ifeq ($(IMAGE_ID), none) - if [[ -s $(BUILD_DIR)/image_id ]]; \ - then \ - docker rmi $$(cat $(BUILD_DIR)/image_id); \ - fi -endif - rm -rf $(BUILD_DIR) - -# style checks -lint: test-shellcheck - -tests: lint unit_tests run_isogen - -test-shellcheck: $(SH_TO_CHECK) - -unit_tests: - echo TODO - -$(SH_TO_CHECK): - docker run --rm -v $(shell pwd):/mnt \ - nlknguyen/alpine-shellcheck -x /mnt/$(@) - -.PHONY: test clean $(SH_TO_CHECK) test-shellcheck tests lint build_isogen \ - run_isogen run_images all build_docs docs check-docker images diff --git a/iso-builder/README.md b/iso-builder/README.md deleted file mode 100644 index 0a5e3f8..0000000 --- a/iso-builder/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# airship-isogen -Iso creation tool - -Prepare - -$(BUILD_DIR)=/some_path... -mkdir $(BUILD_DIR) - -If you don't have isogen image - -make build_isogen - - -Usage - -cp examples/user-data $(BUILD_DIR) -cp examples/isogen.yaml $(BUILD_DIR) -cp examples/network-config $(BUILD_DIR) -#Modify files if necessary - -docker run \ - --rm \ - -e BUILDER_CONFIG=/config/isogen.yaml \ - -v $(shell realpath $(BUILD_DIR)):/config/ \ - $(shell cat $(BUILD_DIR)/image_id) - -Get ubuntu_focal.iso from dir $(BUILD_DIR) diff --git a/iso-builder/examples/isogen.yaml b/iso-builder/examples/isogen.yaml deleted file mode 100644 index 7096643..0000000 --- a/iso-builder/examples/isogen.yaml +++ /dev/null @@ -1,9 +0,0 @@ -container: - volume: ./examples:/config - image: dukov/image_gen:latest - containerRuntime: docker - privileged: false -builder: - userDataFileName: user-data - networkConfigFileName : network-config - outputMetadataFileName: output-metadata.yaml diff --git a/iso-builder/examples/network-config b/iso-builder/examples/network-config deleted file mode 100644 index 1ebba4e..0000000 --- a/iso-builder/examples/network-config +++ /dev/null @@ -1,18 +0,0 @@ ---- -links: -- id: ens4 - type: phy - ethernet_mac_address: 52:54:00:7d:15:63 -networks: -- id: private-ipv4 - type: ipv4 - link: ens4 - ip_address: 192.168.122.100 - netmask: 255.255.255.0 - routes: - - network: 0.0.0.0 - netmask: 0.0.0.0 - gateway: 192.168.122.1 -services: -- address: 8.8.8.8 - type: dns diff --git a/iso-builder/examples/user-data b/iso-builder/examples/user-data deleted file mode 100644 index ea2e558..0000000 --- a/iso-builder/examples/user-data +++ /dev/null @@ -1,11 +0,0 @@ -#cloud-config -ssh_pwauth: True -chpasswd: - list: | - root:deploY!K8s - deployer:deploY!K8s -users: - - default - - name: deployer - gecos: deployer - ssh_pwauth: True diff --git a/iso-builder/files/build.sh b/iso-builder/files/build.sh deleted file mode 100644 index b564054..0000000 --- a/iso-builder/files/build.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# Copyright 2018 AT&T Intellectual Property. All other rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -BASEDIR="$(dirname "$(realpath "$0")")" -# shellcheck source=files/functions.sh -source "${BASEDIR}/functions.sh" - -set -xe - -_check_input_data_set_vars - -_debootstrap - -chroot "${CHROOT}" < "${BASEDIR}/packages_install.sh" - -mkdir -p "${CLOUD_DATA_LATEST}" -cp "${BASEDIR}/meta_data.json" "${CLOUD_DATA_LATEST}" -cp "${USER_DATA}" "${CLOUD_DATA_LATEST}/user_data" -yq r -j "${NET_CONFIG}" > "${CLOUD_DATA_LATEST}/network_data.json" -echo "datasource_list: [ ConfigDrive, None ]" > \ - "${CHROOT}/etc/cloud/cloud.cfg.d/95_no_cloud_ds.cfg" - -_make_kernel -_grub_install -_make_iso - -OUTPUT="$(yq r "${BUILDER_CONFIG}" builder.outputMetadataFileName)" -HOST_PATH="${ADDR[0]}" -_make_metadata "${VOLUME}/${OUTPUT}" "${HOST_PATH}" diff --git a/iso-builder/files/functions.sh b/iso-builder/files/functions.sh deleted file mode 100644 index 35d19a5..0000000 --- a/iso-builder/files/functions.sh +++ /dev/null @@ -1,156 +0,0 @@ -#!/bin/bash -#functions -# Copyright 2018 AT&T Intellectual Property. All other rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -function _debootstrap (){ - debootstrap \ - --arch=amd64 \ - --variant=minbase \ - --foreign \ - focal \ - "${HOME}"/LIVE_BOOT/chroot \ - http://archive.ubuntu.com/ubuntu/ - chroot "${HOME}"/LIVE_BOOT/chroot /debootstrap/debootstrap --second-stage -} - -function _make_kernel(){ - mkdir -p "${HOME}"/LIVE_BOOT/{scratch,image/live} - mksquashfs \ - "${HOME}"/LIVE_BOOT/chroot \ - "${HOME}"/LIVE_BOOT/image/live/filesystem.squashfs \ - -e boot - - cp "${HOME}"/LIVE_BOOT/chroot/boot/vmlinuz-* \ - "${HOME}"/LIVE_BOOT/image/vmlinuz && - cp "${HOME}"/LIVE_BOOT/chroot/boot/initrd.img-* \ - "${HOME}"/LIVE_BOOT/image/initrd -} - -function _grub_install (){ - cp /builder/grub.conf "${HOME}"/LIVE_BOOT/scratch/grub.cfg - - touch "${HOME}/LIVE_BOOT/image/UBUNTU_FOCAL_CUSTOM" - - grub-mkstandalone \ - --format=x86_64-efi \ - --output="${HOME}/LIVE_BOOT/scratch/bootx64.efi" \ - --locales="" \ - --fonts="" \ - boot/grub/grub.cfg="${HOME}/LIVE_BOOT/scratch/grub.cfg" - - ( - cd "${HOME}/LIVE_BOOT/scratch" && \ - dd if=/dev/zero of=efiboot.img bs=1M count=10 && \ - mkfs.vfat efiboot.img && \ - LC_CTYPE=C mmd -i efiboot.img efi efi/boot && \ - LC_CTYPE=C mcopy -i efiboot.img ./bootx64.efi ::efi/boot/ - ) - - grub-mkstandalone \ - --format=i386-pc \ - --output="${HOME}/LIVE_BOOT/scratch/core.img" \ - --install-modules="linux16 linux normal iso9660 biosdisk memdisk search tar ls" \ - --modules="linux16 linux normal iso9660 biosdisk search" \ - --locales="" \ - --fonts="" \ - boot/grub/grub.cfg="${HOME}/LIVE_BOOT/scratch/grub.cfg" - - cat \ - /usr/lib/grub/i386-pc/cdboot.img "${HOME}/LIVE_BOOT/scratch/core.img" \ - > "${HOME}/LIVE_BOOT/scratch/bios.img" -} - -function _make_iso(){ - xorriso \ - -as mkisofs \ - -iso-level 3 \ - -full-iso9660-filenames \ - -volid "config-2" \ - -eltorito-boot boot/grub/bios.img \ - -no-emul-boot \ - -boot-load-size 4 \ - -boot-info-table \ - --eltorito-catalog boot/grub/boot.cat \ - --grub2-boot-info \ - --grub2-mbr /usr/lib/grub/i386-pc/boot_hybrid.img \ - -eltorito-alt-boot \ - -e EFI/efiboot.img \ - -no-emul-boot \ - -append_partition 2 0xef "${HOME}/LIVE_BOOT/scratch/efiboot.img" \ - -output "/config/ubuntu-focal.iso" \ - -graft-points \ - "${HOME}/LIVE_BOOT/image" \ - /boot/grub/bios.img="${HOME}/LIVE_BOOT/scratch/bios.img" \ - /EFI/efiboot.img="${HOME}/LIVE_BOOT/scratch/efiboot.img" -} - -function _make_metadata(){ - echo "bootImagePath: ${2:?}/ubuntu-focal.iso" > "${1:?}" -} - -function _check_input_data_set_vars(){ - CHROOT="${HOME}/LIVE_BOOT/chroot" - export CHROOT - export CLOUD_DATA_LATEST="${HOME}/LIVE_BOOT/image/openstack/latest" - echo "${BUILDER_CONFIG:?}" - if [ ! -f "${BUILDER_CONFIG}" ] - then - echo "file ${BUILDER_CONFIG} not found" - exit 1 - fi - IFS=':' read -ra ADDR <<<"$(yq r "${BUILDER_CONFIG}" container.volume)" - VOLUME="${ADDR[1]}" - echo "${VOLUME:?}" - if [[ "${VOLUME}" == 'none' ]] - then - echo "variable container.volume \ - is not present in $BUILDER_CONFIG" - exit 1 - else - if [[ ! -d "${VOLUME}" ]] - then - echo "${VOLUME} not exist" - exit 1 - fi - fi - USER_DATA="${VOLUME}/$(yq r "${BUILDER_CONFIG}" builder.userDataFileName)" - echo "${USER_DATA:?}" - if [[ "${USER_DATA}" == 'none' ]] - then - echo "variable userDataFileName \ - is not present in ${BUILDER_CONFIG}" - exit 1 - else - if [[ ! -f ${USER_DATA} ]] - then - echo "${USER_DATA} not exist" - exit 1 - fi - fi - NET_CONFIG="${VOLUME}/$(yq r "${BUILDER_CONFIG}" \ - builder.networkConfigFileName)" - echo "${NET_CONFIG:?}" - if [[ "${NET_CONFIG}" == 'none' ]] - then - echo "variable networkConfigFileName \ - is not present in ${BUILDER_CONFIG}" - exit 1 - if [[ ! -f ${NET_CONFIG} ]] - then - echo "${NET_CONFIG} not exist" - exit 1 - fi - fi -} diff --git a/iso-builder/files/grub.conf b/iso-builder/files/grub.conf deleted file mode 100644 index 23ec66e..0000000 --- a/iso-builder/files/grub.conf +++ /dev/null @@ -1,11 +0,0 @@ -search --set=root --file /UBUNTU_FOCAL_CUSTOM - -insmod all_video - -set default="0" -set timeout=1 - -menuentry "Ubuntu Focal Live" { - linux /vmlinuz boot=live nomodeset ip=frommedia gfxpayload=text overlay-size=70% cpu_init_udelay=10000 console=ttyS0,115200 verbose - initrd /initrd -} diff --git a/iso-builder/files/meta_data.json b/iso-builder/files/meta_data.json deleted file mode 100644 index f71b9bc..0000000 --- a/iso-builder/files/meta_data.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "hostname": "ephemeral", - "name": "ephemeral", - "uuid": "83679162-1378-4288-a2d4-70e13ec132aa" -} diff --git a/iso-builder/files/packages_install.sh b/iso-builder/files/packages_install.sh deleted file mode 100644 index 7acbeb8..0000000 --- a/iso-builder/files/packages_install.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -# Copyright 2018 AT&T Intellectual Property. All other rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -xe -echo "ubuntu-live" > /etc/hostname -echo "127.0.0.1 localhost" > /etc/hosts -echo "deb http://archive.ubuntu.com/ubuntu focal universe" >> /etc/apt/sources.list -apt-get update && apt-get install -y --no-install-recommends \ - linux-generic \ - live-boot \ - systemd-sysv \ - apt-transport-https \ - openssh-server \ - curl \ - gnupg \ - iptables \ - ifenslave \ - bridge-utils \ - tcpdump \ - iputils-ping \ - vlan \ - locales \ - lsb-release \ - ebtables - -# ensure we support bonding and 802.1q -echo 'bonding' >> /etc/modules -echo '8021q' >> /etc/modules - -locale-gen en_US.UTF-8 -systemctl enable systemd-networkd -echo 'br_netfilter' >> /etc/modules - -apt-get install -y --no-install-recommends \ - cloud-init - -rm -rf /var/lib/apt/lists/* diff --git a/playbooks/airship-images-test.yaml b/playbooks/airship-images-test.yaml deleted file mode 100644 index 5830809..0000000 --- a/playbooks/airship-images-test.yaml +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2018 AT&T Intellectual Property. All other rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -- hosts: primary - tasks: - - name: Run Test - block: - - name: "make tests" - make: - chdir: "{{ makefile_chdir }}" - target: tests - - name: install libvirt - include_role: - name: libvirt-install - tasks_from: "{{ item }}" - with_items: - - main - - configure - - virt_net: - state: active - name: default - - name: Launch and test VM with UEFI boot mode - include_role: - name: libvirt-domain - vars: - vm_name: ubuntu_focal_uefi - boot_mode: UEFI - src_image: /home/zuul/src/opendev.org/airship/images/iso-builder/build/ubuntu-focal.iso - - name: Launch and test VM with Legacy boot mode - include_role: - name: libvirt-domain - vars: - vm_name: ubuntu_focal_legacy - boot_mode: legacy - src_image: /home/zuul/src/opendev.org/airship/images/iso-builder/build/ubuntu-focal.iso