Skip to content

Commit

Permalink
Merge branch 'topic/okurth/ci-ova-poi-harness' into 'master'
Browse files Browse the repository at this point in the history
add ci ova poi harness

See merge request core-build/photon-os-installer!101
  • Loading branch information
Oliver Kurth committed Nov 13, 2024
2 parents d17dd2d + 28081d6 commit 476f085
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 3 deletions.
31 changes: 30 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,35 @@ pytest:
- cd tests/
- sudo chown -R $(id -u -n):$(id -g -n) .

ova-poi-harness:
variables:
VM_NAME_BASE: ova-poi-harness-${CI_COMMIT_SHORT_SHA}
stage: test
needs:
- build-container
parallel:
matrix:
- NAME:
- minimal
- minimal_lvm
script:
- VM_NAME=${VM_NAME_BASE}-${NAME}
- KS_FILE=${NAME}_ks.yaml

- docker pull ${POI_REGISTRY}/${POI_IMAGE_NAME}
- docker tag ${POI_REGISTRY}/${POI_IMAGE_NAME} ${POI_IMAGE_NAME}

- cd examples/ova
- docker run --rm --privileged -v/dev:/dev -v$(pwd):/workdir ${POI_IMAGE_NAME} create-image --repo-paths= -c ${KS_FILE} -v 5.0
- docker run --rm -v$(pwd):/workdir -w/workdir ${POI_IMAGE_NAME} create-ova --ovf --mf --vmdk --installer-config ${KS_FILE} --ova-config minimal_ova.yaml
# clone the harness code
- git clone --depth=1 https://:${POI_HARNESS_PULL_TOKEN}@${CI_SERVER_HOST}/photon/poi-harness.git
- pytest ./poi-harness/ci/pytest/ -rs --deploy --ovf *.ovf --name ${VM_NAME} --vc_config ${VC_CONFIG_FILE} --ks_config ${KS_FILE} --ova_config minimal_ova.yaml
after_script:
# change ownerships for cleanup
- cd examples/ova
- sudo chown -R $(id -u -n):$(id -g -n) .

iso-poi-harness:
variables:
ISO_OVF: photon5-iso-boot-${CI_COMMIT_SHORT_SHA}.ovf
Expand All @@ -53,7 +82,7 @@ iso-poi-harness:
# base64 encode the ks file, must have no new lines (-w0)
- docker run --rm -v$(pwd):/workdir ${POI_IMAGE_NAME} ova-compose -i iso_ova.yaml -o ${ISO_OVF} -m --param ksdata64=$(base64 -w0 < minimal_ks.yaml)
# clone the harness code
- git clone https://:${POI_HARNESS_PULL_TOKEN}@${CI_SERVER_HOST}/photon/poi-harness.git
- git clone --depth=1 https://:${POI_HARNESS_PULL_TOKEN}@${CI_SERVER_HOST}/photon/poi-harness.git
# POI harness will deploy OVF on a VC and run tests
- pytest ./poi-harness/ci/pytest/ -rs --deploy --ovf ${ISO_OVF} --name ${VM_NAME} --vc_config ${VC_CONFIG_FILE} --ks_config minimal_ks.yaml --ova_config iso_ova.yaml
after_script:
Expand Down
11 changes: 10 additions & 1 deletion examples/ova/minimal_ks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,21 @@ partitions:
- sizepercent: 5
filesystem: swap

repos:
photon:
name: "Photon 5.0"
baseurl: !param photon_repo_url=https://packages.vmware.com/photon/$releasever/photon_updates_$releasever_$basearch
enabled: 1
gpgcheck: 0

packagelist_file: packages_minimal.json

additional_packages:
- vim

public_key: <ssh-key-here>
postinstall:
# allow ssh root login
- sed -i "s/\(^PermitRootLogin\)[ ]*no$/\1 yes/g" /etc/ssh/sshd_config

linux_flavor: linux

Expand Down
11 changes: 10 additions & 1 deletion examples/ova/minimal_lvm_ks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,21 @@ partitions:
vg_name: vg_root_0
lv_name: lv_root_0

repos:
photon:
name: "Photon 5.0"
baseurl: !param photon_repo_url=https://packages.vmware.com/photon/$releasever/photon_updates_$releasever_$basearch
enabled: 1
gpgcheck: 0

packagelist_file: packages_minimal.json

additional_packages:
- vim

public_key: <ssh-key-here>
postinstall:
# allow ssh root login
- sed -i "s/\(^PermitRootLogin\)[ ]*no$/\1 yes/g" /etc/ssh/sshd_config

linux_flavor: linux

Expand Down
39 changes: 39 additions & 0 deletions examples/ova/minimal_ova.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
system:
name: minimal
type: vmx-14 vmx-20 vmx-21
os_vmw: vmwarePhoton64Guest
firmware: efi
secure_boot: false

networks:
vm_network:
name: "VM Network"
description: "The VM Network network"

hardware:
cpus: 2
memory: 2048
sata1:
type: sata_controller
scsi1:
type: scsi_controller
cdrom1:
type: cd_drive
parent: sata1
Harddisk 1:
type: hard_disk
parent: scsi1
raw_image: !param rootdisk=minimal.img
units: byte
usb2:
type: usb_controller
usb3:
type: usb3_controller
ethernet1:
type: ethernet
subtype: VmxNet3
network: vm_network
videocard1:
type: video_card
vmci1:
type: vmci

0 comments on commit 476f085

Please sign in to comment.