Skip to content

Commit

Permalink
Merge branch 'topic/psinghchauha/deployment-tests' into 'master'
Browse files Browse the repository at this point in the history
Add ostree-iso-deployment test

See merge request core-build/photon-os-installer!103
  • Loading branch information
Oliver Kurth committed Dec 5, 2024
2 parents 0fc8449 + 6fbb0fe commit 775779c
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 14 deletions.
13 changes: 10 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,31 @@ ova-poi-harness:
iso-poi-harness:
variables:
ISO_OVF: photon5-iso-boot-${CI_COMMIT_SHORT_SHA}.ovf
VM_NAME: poi-iso-boot-${CI_COMMIT_SHORT_SHA}
VM_NAME_BASE: poi-iso-boot-${CI_COMMIT_SHORT_SHA}
stage: test
needs:
- build-container
parallel:
matrix:
- NAME:
- minimal
- ostree
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/iso
# create ISO
- docker run --rm --privileged -v/dev:/dev -v$(pwd):/workdir ${POI_IMAGE_NAME} photon-iso-builder --config iso.yaml
# create OVF that includes that ISO, and a blank hard disk
# base64 encode the ks file, must have no new lines (-w0)
- KSDATA64=$(base64 -w0 < minimal_ks.yaml)
- KSDATA64=$(base64 -w0 < ${KS_FILE})
- docker run --rm -v$(pwd):/workdir ${POI_IMAGE_NAME} ova-compose -i iso_ova.yaml -o ${ISO_OVF} -m --param ksdata64=${KSDATA64}
# clone the harness code
- 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 --param ksdata64=${KSDATA64}
- pytest ./poi-harness/ci/pytest/ -rs --deploy --ovf ${ISO_OVF} --name ${VM_NAME} --vc_config ${VC_CONFIG_FILE} --ks_config ${KS_FILE} --ova_config iso_ova.yaml --param ksdata64=${KSDATA64}
after_script:
# change ownerships for cleanup
- cd examples/iso
Expand Down
6 changes: 3 additions & 3 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,16 @@ repo_paths:
iso_files:
minimal_ks.yaml: isolinux/
"https://raw.githubusercontent.com/vmware/photon/5.0/support/image-builder/iso/sample_ks.cfg": isolinux/
"https://raw.githubusercontent.com/vmware/photon/5.0/support/poi/configs/iso/sample_ks.cfg": isolinux/
"https://raw.githubusercontent.com/vmware/photon/5.0/EULA.txt": ""
"https://raw.githubusercontent.com/vmware/photon/5.0/NOTICE-Apachev2": ""
"https://raw.githubusercontent.com/vmware/photon/5.0/NOTICE-GPL2.0": ""
"https://github.com/vmware/photon/raw/5.0/support/image-builder/iso/open_source_license.tar.gz": ""
"https://github.com/vmware/photon/raw/5.0/support/poi/configs/iso/open_source_license.tar.gz": ""
initrd_files:
minimal_ks.yaml: installer/
packages_minimal.json: installer/
"https://raw.githubusercontent.com/vmware/photon/5.0/support/image-builder/iso/sample_ui.cfg": installer/
"https://raw.githubusercontent.com/vmware/photon/5.0/support/poi/configs/iso/sample_ui.cfg": installer/
"https://raw.githubusercontent.com/vmware/photon/5.0/EULA.txt": installer/
```
Use the config file as (`iso.yaml`) with:
Expand Down
10 changes: 3 additions & 7 deletions examples/iso/iso.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ packageslist_file: packages_minimal.json

initrd_pkgs_list_file: packages_installer_initrd.json

kickstart_path: minimal_ks.yaml

# uncomment for non-interactive install
#boot_cmdline_param: ks=minimal_ks.yaml

Expand All @@ -16,15 +14,13 @@ repo_paths:
- /poi

iso_files:
minimal_ks.yaml: isolinux/
"https://raw.githubusercontent.com/vmware/photon/5.0/support/image-builder/iso/sample_ks.cfg": isolinux/
"https://raw.githubusercontent.com/vmware/photon/5.0/support/poi/configs/iso/sample_ks.cfg": isolinux/
"https://raw.githubusercontent.com/vmware/photon/5.0/EULA.txt": ""
"https://raw.githubusercontent.com/vmware/photon/5.0/NOTICE-Apachev2": ""
"https://raw.githubusercontent.com/vmware/photon/5.0/NOTICE-GPL2.0": ""
"https://github.com/vmware/photon/raw/5.0/support/image-builder/iso/open_source_license.tar.gz": ""
"https://github.com/vmware/photon/raw/5.0/support/poi/configs/iso/open_source_license.tar.gz": ""

initrd_files:
minimal_ks.yaml: installer/
packages_minimal.json: installer/
"https://raw.githubusercontent.com/vmware/photon/5.0/support/image-builder/iso/sample_ui.cfg": installer/
"https://raw.githubusercontent.com/vmware/photon/5.0/support/poi/configs/iso/sample_ui.cfg": installer/
"https://raw.githubusercontent.com/vmware/photon/5.0/EULA.txt": installer/
2 changes: 1 addition & 1 deletion examples/iso/minimal_ks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ additional_packages:

# for testing, take a random file (this one)
additional_files:
- minimal_ks.yaml: /root/minimal_ks.yaml
- sample_ks.cfg: /root/sample_ks.cfg

# fake a key for testing
public_key: <ssh-key-here>
Expand Down
34 changes: 34 additions & 0 deletions examples/iso/ostree_ks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
password:
crypted: false
text: changeme
age: -1

hostname: ostree

disks:
default:
device: /dev/sda

ostree:
default_repo: false
repo_url: https://packages-prod.broadcom.com/photon/rpm-ostree/base/5.0/x86_64/repo/
repo_ref: photon/5.0/x86_64/minimal

partitions:
- mountpoint: /
size: 0
filesystem: ext4
- mountpoint: /boot
size: 128
filesystem: ext4
- mountpoint: /root
sizepercent: 5
filesystem: ext4
- sizepercent: 5
filesystem: swap

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

linux_flavor: linux

0 comments on commit 775779c

Please sign in to comment.