Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for building ova images #435

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .azure-pipelines/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
targets:
- name: RHEL 9.2
test: rhel/9.2/
# - name: RHEL 8.8

Check warning on line 180 in .azure-pipelines/azure-pipelines.yml

View workflow job for this annotation

GitHub Actions / Lint Blue

180:13 [comments-indentation] comment not indented like content

Check warning on line 180 in .azure-pipelines/azure-pipelines.yml

View workflow job for this annotation

GitHub Actions / Lint Green

180:13 [comments-indentation] comment not indented like content
# test: rhel/8.8/
groups:
- 1
Expand Down Expand Up @@ -206,7 +206,7 @@
targets:
- name: RHEL 9.2 edge-commit
test: rhel/9.2/
# - name: RHEL 8.8 edge-commit

Check warning on line 209 in .azure-pipelines/azure-pipelines.yml

View workflow job for this annotation

GitHub Actions / Lint Blue

209:13 [comments-indentation] comment not indented like content

Check warning on line 209 in .azure-pipelines/azure-pipelines.yml

View workflow job for this annotation

GitHub Actions / Lint Green

209:13 [comments-indentation] comment not indented like content
# test: rhel/8.8/
groups:
- 4
Expand All @@ -216,7 +216,7 @@
targets:
- name: RHEL 9.2 edge-container
test: rhel/9.2/
# - name: RHEL 8.8 edge-container

Check warning on line 219 in .azure-pipelines/azure-pipelines.yml

View workflow job for this annotation

GitHub Actions / Lint Blue

219:13 [comments-indentation] comment not indented like content

Check warning on line 219 in .azure-pipelines/azure-pipelines.yml

View workflow job for this annotation

GitHub Actions / Lint Green

219:13 [comments-indentation] comment not indented like content
# test: rhel/8.8/
groups:
- 5
Expand Down Expand Up @@ -311,7 +311,7 @@
targets:
- name: RHEL 9.2 oci
test: rhel/9.2/
# - name: RHEL 8.8 oci

Check warning on line 314 in .azure-pipelines/azure-pipelines.yml

View workflow job for this annotation

GitHub Actions / Lint Blue

314:13 [comments-indentation] comment not indented like content

Check warning on line 314 in .azure-pipelines/azure-pipelines.yml

View workflow job for this annotation

GitHub Actions / Lint Green

314:13 [comments-indentation] comment not indented like content
# test: rhel/8.8/
groups:
- 14
Expand All @@ -321,7 +321,7 @@
targets:
- name: RHEL 9.2 openstack
test: rhel/9.2/
# - name: RHEL 8.8 openstack

Check warning on line 324 in .azure-pipelines/azure-pipelines.yml

View workflow job for this annotation

GitHub Actions / Lint Blue

324:13 [comments-indentation] comment not indented like content

Check warning on line 324 in .azure-pipelines/azure-pipelines.yml

View workflow job for this annotation

GitHub Actions / Lint Green

324:13 [comments-indentation] comment not indented like content
# test: rhel/8.8/
groups:
- 15
Expand All @@ -331,7 +331,7 @@
targets:
- name: RHEL 9.2 qcow2
test: rhel/9.2/
# - name: RHEL 8.8 qcow2

Check warning on line 334 in .azure-pipelines/azure-pipelines.yml

View workflow job for this annotation

GitHub Actions / Lint Blue

334:13 [comments-indentation] comment not indented like content

Check warning on line 334 in .azure-pipelines/azure-pipelines.yml

View workflow job for this annotation

GitHub Actions / Lint Green

334:13 [comments-indentation] comment not indented like content
# test: rhel/8.8/
groups:
- 16
Expand All @@ -341,7 +341,7 @@
targets:
- name: RHEL 9.2 tar
test: rhel/9.2/
# - name: RHEL 8.8 tar

Check warning on line 344 in .azure-pipelines/azure-pipelines.yml

View workflow job for this annotation

GitHub Actions / Lint Blue

344:13 [comments-indentation] comment not indented like content

Check warning on line 344 in .azure-pipelines/azure-pipelines.yml

View workflow job for this annotation

GitHub Actions / Lint Green

344:13 [comments-indentation] comment not indented like content
# test: rhel/8.8/
groups:
- 17
Expand All @@ -351,7 +351,7 @@
targets:
- name: RHEL 9.2 vhd
test: rhel/9.2/
# - name: RHEL 8.8 vhd

Check warning on line 354 in .azure-pipelines/azure-pipelines.yml

View workflow job for this annotation

GitHub Actions / Lint Blue

354:13 [comments-indentation] comment not indented like content

Check warning on line 354 in .azure-pipelines/azure-pipelines.yml

View workflow job for this annotation

GitHub Actions / Lint Green

354:13 [comments-indentation] comment not indented like content
# test: rhel/8.8/
groups:
- 18
Expand All @@ -361,10 +361,18 @@
targets:
- name: RHEL 9.2 vmdk
test: rhel/9.2/
# - name: RHEL 8.8 vmdk

Check warning on line 364 in .azure-pipelines/azure-pipelines.yml

View workflow job for this annotation

GitHub Actions / Lint Blue

364:13 [comments-indentation] comment not indented like content

Check warning on line 364 in .azure-pipelines/azure-pipelines.yml

View workflow job for this annotation

GitHub Actions / Lint Green

364:13 [comments-indentation] comment not indented like content
# test: rhel/8.8/
groups:
- 19
- template: templates/matrix.yml
parameters:
testFormat: devel/{0}
targets:
- name: RHEL 9.2 ova
test: rhel/9.2/
groups:
- 20

# https://github.com/ansible/ansible/blob/stable-2.15/test/lib/ansible_test/_data/completion/remote.txt
- stage: Remote_2_16
Expand Down Expand Up @@ -565,6 +573,16 @@
test: rhel/8.8/
groups:
- 19
- template: templates/matrix.yml
parameters:
testFormat: 2.16/{0}
targets:
- name: RHEL 9.2 ova
test: rhel/9.2/
- name: RHEL 8.8 ova
test: rhel/8.8/
groups:
- 20

# https://github.com/ansible/ansible/blob/stable-2.14/test/lib/ansible_test/_data/completion/remote.txt
- stage: Remote_2_15
Expand Down
3 changes: 3 additions & 0 deletions changelogs/fragments/311-add_ova_image_support.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- add support for building ova images
3 changes: 3 additions & 0 deletions plugins/modules/start_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
- image-installer
- oci
- openstack
- ova
- qcow2
- tar
- vhd
Expand Down Expand Up @@ -142,6 +143,7 @@
"image-installer",
"oci",
"openstack",
"ova",
"qcow2",
"tar",
"vhd",
Expand Down Expand Up @@ -299,6 +301,7 @@ def start_compose(module, weldr):
compose_output_types: dict[str, list[str]] = {
"tar": ["tar", "edge-commit", "iot-commit", "edge-container", "iot-container", "container"],
"iso": ["edge-installer", "edge-simplified-installer", "iot-installer", "image-installer"],
"ova": ["ova"],
"qcow2": ["qcow2", "openstack", "oci"],
"vmdk": ["vmdk"],
"vhd": ["vhd"],
Expand Down
8 changes: 8 additions & 0 deletions tests/integration/targets/compose_type-ova/aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

azp/posix/19
needs/root
destructive
setup/always/role_setup_server
24 changes: 24 additions & 0 deletions tests/integration/targets/compose_type-ova/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
####################################################################
# WARNING: These are designed specifically for Ansible tests #
# and should not be used as examples of how to write Ansible roles #
####################################################################

# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
#
- name: Include variables
ansible.builtin.include_vars:
file: ../vars/main.yml

- name: Run the infra.osbuild.builder role
ansible.builtin.import_role:
name: infra.osbuild.builder
vars:
builder_pub_key: "{{ pubkey }}"
builder_blueprint_src_path: "{{ blueprint_src_path }}"
builder_compose_type: "{{ compose_type }}"

- name: Validate the role
ansible.builtin.include_tasks: tests.yml
17 changes: 17 additions & 0 deletions tests/integration/targets/compose_type-ova/tasks/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

# NOTE: the compose_start_out variable comes into scope via the
# execution of the infra.osbuild.builder role and is not defined
# within these test cases (yet?).
- name: Check if image was built and served
ansible.builtin.stat:
path: "/var/www/html/{{ builder_blueprint_name }}/images/0.0.1/{{ builder_blueprint_name }}_ova.ova" # noqa yaml[line-length]
register: ova_stat_result

- name: Assert that the image was successful and that it is available on the server.
ansible.builtin.assert:
that:
- ova_stat_result.stat.exists
12 changes: 12 additions & 0 deletions tests/integration/targets/compose_type-ova/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

blueprint_src_path: "/tmp/blueprint.toml"
pubkey: "ssh-rsa FAKEPUBKEY"

builder_blueprint_distro: "{{ 'fedora' if ansible_distribution == 'Fedora' else 'centos' }}-{{ ansible_distribution_major_version }}"
builder_blueprint_ref: "{{ 'fedora' if ansible_distribution == 'Fedora' else 'centos' }}/{{ ansible_distribution_major_version }}/x86_64/{{ 'iot' if ansible_distribution == 'Fedora' else 'edge' }}" # yamllint disable-line rule:line-length

compose_type: "ova"
Loading