Skip to content

Commit 769ae8d

Browse files
committed
testing: Test
1 parent 937102f commit 769ae8d

File tree

1 file changed

+110
-0
lines changed

1 file changed

+110
-0
lines changed
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
- name: Run Airgap Rancher and Airgap Harvester Installation Test
3+
hosts: localhost
4+
connection: local
5+
gather_facts: false
6+
7+
vars:
8+
REPO: "{{ harvester_installer_repo_name | default('irishgordo/harvester-installer') }}"
9+
10+
tasks:
11+
- name: Make sure WORKSPACE is defined
12+
fail:
13+
msg: "Variable WORKSPACE is not defined."
14+
when: WORKSPACE is not defined
15+
16+
- name: Check for harvester-installer
17+
stat:
18+
path: "{{ WORKSPACE }}/harvester-installer"
19+
register: harvester_installer_dir_check_result
20+
21+
- name: Make sure harvester-installer directory exist
22+
fail:
23+
msg: "{{ WORKSPACE }}/harvester-installer not found"
24+
when: not harvester_installer_dir_check_result.stat.exists
25+
26+
- name: Build harvester-installer artifacts
27+
shell: >
28+
make
29+
args:
30+
chdir: "{{ WORKSPACE }}/harvester-installer"
31+
retries: 5
32+
delay: 20
33+
register: shell_result
34+
until: shell_result.rc == 0
35+
36+
- name: Check for existing environment
37+
stat:
38+
path: "{{ WORKSPACE }}/ipxe-examples"
39+
register: check_ipxe_examples_result
40+
41+
- name: Cleanup vagrants
42+
shell: >
43+
vagrant destroy -f
44+
args:
45+
chdir: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-airgap-harvester"
46+
when: check_ipxe_examples_result.stat.exists
47+
48+
- name: Cleanup ipxe-examples dir
49+
file:
50+
path: "{{ WORKSPACE }}/ipxe-examples"
51+
state: absent
52+
53+
- name: Clone ipxe-examples repo
54+
git:
55+
repo: https://github.com/harvester/ipxe-examples.git
56+
version: main
57+
dest: "{{ WORKSPACE }}/ipxe-examples"
58+
59+
- name: Check to see if "/usr/share/qemu/OVMF.fd" exist
60+
stat:
61+
path: /usr/share/qemu/OVMF.fd
62+
register: file_ovmf_fd_check_result
63+
64+
- name: Remove OVMF.fd line if needed
65+
lineinfile:
66+
path: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-airgap-harvester/Vagrantfile"
67+
regexp: '.*\/OVMF\.fd.*'
68+
state: absent
69+
when: not file_ovmf_fd_check_result.stat.exists
70+
71+
- name: Set harvester_iso_url
72+
replace:
73+
path: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-airgap-harvester/settings.yml"
74+
regexp: "^harvester_iso_url:.*"
75+
replace: "harvester_iso_url: file://{{ WORKSPACE }}/harvester-installer/dist/artifacts/harvester-master-amd64.iso"
76+
77+
- name: Set harvester_kernel_url
78+
replace:
79+
path: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-airgap-harvester/settings.yml"
80+
regexp: "^harvester_kernel_url:.*"
81+
replace: "harvester_kernel_url: file://{{ WORKSPACE }}/harvester-installer/dist/artifacts/harvester-master-vmlinuz-amd64"
82+
83+
- name: Set harvester_ramdisk_url
84+
replace:
85+
path: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-airgap-harvester/settings.yml"
86+
regexp: "^harvester_ramdisk_url:.*"
87+
replace: "harvester_ramdisk_url: file://{{ WORKSPACE }}/harvester-installer/dist/artifacts/harvester-master-initrd-amd64"
88+
89+
- name: Set harvester_rootfs_url
90+
replace:
91+
path: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-airgap-harvester/settings.yml"
92+
regexp: "^harvester_rootfs_url:.*"
93+
replace: "harvester_rootfs_url: file://{{ WORKSPACE }}/harvester-installer/dist/artifacts/harvester-master-rootfs-amd64.squashfs"
94+
95+
- name: Run setup Harvester
96+
shell: >
97+
./setup_harvester.sh -c -s /var/lib/jenkins/.ssh/known_hosts
98+
register: setup_harvester_result
99+
args:
100+
chdir: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-airgap-harvester"
101+
ignore_errors: yes
102+
103+
- name: Print Harvester installation output
104+
debug:
105+
msg: "{{ setup_harvester_result.stdout_lines }}"
106+
107+
- name: Check result
108+
fail:
109+
msg: "ERROR: {{ setup_harvester_result.stderr }}"
110+
when: setup_harvester_result.failed

0 commit comments

Comments
 (0)