diff --git a/helm-chart-collator/Makefile b/helm-chart-collator/Makefile index 8723af0..b6626d8 100644 --- a/helm-chart-collator/Makefile +++ b/helm-chart-collator/Makefile @@ -75,6 +75,7 @@ build_collator: 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)" \ @@ -90,6 +91,7 @@ ifeq ($(USE_PROXY), true) --build-arg GIT_COMMIT=$(COMMIT) else docker build . \ + --iidfile $(BUILD_DIR)/image_id \ --tag $(IMAGE) \ --label $(LABEL) \ --label "org.opencontainers.image.revision=$(COMMIT)" \ @@ -98,7 +100,6 @@ else --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ --build-arg GIT_COMMIT=$(COMMIT) endif - echo $(shell docker images -q $(IMAGE)) > $(BUILD_DIR)/image_id else echo $(IMAGE_ID) > $(BUILD_DIR)/image_id endif diff --git a/iso-builder/Makefile b/iso-builder/Makefile index 9774b3a..dbb06f9 100644 --- a/iso-builder/Makefile +++ b/iso-builder/Makefile @@ -80,6 +80,7 @@ build_isogen: 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)" \ @@ -95,6 +96,7 @@ ifeq ($(USE_PROXY), true) --build-arg GIT_COMMIT=$(COMMIT) else docker build . \ + --iidfile $(BUILD_DIR)/image_id \ --tag $(IMAGE) \ --label $(LABEL) \ --label "org.opencontainers.image.revision=$(COMMIT)" \ @@ -103,7 +105,6 @@ else --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ --build-arg GIT_COMMIT=$(COMMIT) endif - echo $(shell docker images -q $(IMAGE)) > $(BUILD_DIR)/image_id else echo $(IMAGE_ID) > $(BUILD_DIR)/image_id endif @@ -124,7 +125,7 @@ endif # style checks lint: test-shellcheck -tests: lint unit_tests +tests: lint unit_tests run_isogen test-shellcheck: $(SH_TO_CHECK) diff --git a/iso-builder/examples/network-config b/iso-builder/examples/network-config index 461b90b..1ebba4e 100644 --- a/iso-builder/examples/network-config +++ b/iso-builder/examples/network-config @@ -1,47 +1,18 @@ --- links: -- name: pxe0 - id: pxe0 +- id: ens4 type: phy ethernet_mac_address: 52:54:00:7d:15:63 -- name: oam0 - type: phy - id: oam0 - ethernet_mac_address: 52:54:00:bf:b2:d8 -- name: stor0 - id: stor0 - type: phy - ethernet_mac_address: 52:54:00:9b:2c:71 -- name: underlay0 - type: phy - id: underlay0 - ethernet_mac_address: 52:54:00:9b:2c:71 networks: -- id: pxe0-ipv4 +- id: private-ipv4 type: ipv4 - link: pxe0 - ip_address: 192.168.10.100 - netmask: 255.255.255.0 -- id: oam0-ipv4 - type: ipv4 - link: oam0 - ip_address: 192.168.100.100 + 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.100.1 -- id: stor0-ipv4 - type: ipv4 - link: stor0 - ip_address: 192.168.20.100 - netmask: 255.255.255.0 -- id: underlay0-ipv4 - type: ipv4 - link: underlay0 - ip_address: 192.168.30.100 - netmask: 255.255.255.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 index 594b5a0..ea2e558 100644 --- a/iso-builder/examples/user-data +++ b/iso-builder/examples/user-data @@ -1,5 +1,11 @@ #cloud-config - -runcmd: - - kubeadm init --pod-network-cidr=192.168.0.0/24 --ignore-preflight-errors 'SystemVerification' - - kubectl --kubeconfig /etc/kubernetes/admin.conf taint nodes --all node-role.kubernetes.io/master- +ssh_pwauth: True +chpasswd: + list: | + root:deploY!K8s + deployer:deploY!K8s +users: + - default + - name: deployer + gecos: deployer + ssh_pwauth: True diff --git a/playbooks/airship-images-test.yaml b/playbooks/airship-images-test.yaml index 7ff191a..19fdca6 100644 --- a/playbooks/airship-images-test.yaml +++ b/playbooks/airship-images-test.yaml @@ -20,3 +20,27 @@ make: chdir: "{{ zuul.project.src_dir }}" 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 diff --git a/roles/libvirt-domain/tasks/domain.yaml b/roles/libvirt-domain/tasks/domain.yaml new file mode 100644 index 0000000..f1d42b4 --- /dev/null +++ b/roles/libvirt-domain/tasks/domain.yaml @@ -0,0 +1,31 @@ +# 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. + +--- +- name: Define VM {{ vm_name }} + virt: + name: "{{ vm_name }}" + command: define + xml: "{{ lookup('template', 'templates/domain.xml.j2') }}" + +- name: Start VM {{ vm_name }} + virt: + name: "{{ vm_name }}" + state: running + +- name: Wait for ssh to come up on {{ vm_name }} + wait_for: host=192.168.122.100 port=22 delay=5 timeout=300 + +- name: Destroy VM {{ vm_name }} + virt: + name: "{{ vm_name }}" + command: destroy diff --git a/roles/libvirt-domain/tasks/main.yaml b/roles/libvirt-domain/tasks/main.yaml new file mode 100644 index 0000000..1830f45 --- /dev/null +++ b/roles/libvirt-domain/tasks/main.yaml @@ -0,0 +1,13 @@ +# 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. + +- include_tasks: domain.yaml diff --git a/roles/libvirt-domain/templates/domain.xml.j2 b/roles/libvirt-domain/templates/domain.xml.j2 new file mode 100644 index 0000000..a3358fb --- /dev/null +++ b/roles/libvirt-domain/templates/domain.xml.j2 @@ -0,0 +1,82 @@ + + {{ vm_name }} + 4194304 + 4194304 + 1 + + /machine + + + hvm + {% if boot_mode is defined and boot_mode == 'UEFI' %} + /usr/share/OVMF/OVMF_CODE.fd + {% endif %} + + + + + + + + + + + + + destroy + restart + destroy + + + + + + /usr/bin/qemu-system-x86_64 + + + + + + +
+ + +
+ + + +
+ + + + + +
+ + + + + + + + + + + + + + +