ci: move edge test to testing-farm
This commit is contained in:
parent
09c5f5e374
commit
85e176f438
7 changed files with 175 additions and 164 deletions
1
.fmf/version
Normal file
1
.fmf/version
Normal file
|
|
@ -0,0 +1 @@
|
|||
1
|
||||
|
|
@ -5,6 +5,12 @@ set -euo pipefail
|
|||
source /etc/os-release
|
||||
ARCH=$(uname -m)
|
||||
|
||||
# In case port 8081 is already in use
|
||||
sudo dnf install -y lsof
|
||||
if lsof -nP -iTCP -sTCP:LISTEN|grep 8081; then
|
||||
sudo fuser -k 8081/tcp
|
||||
fi
|
||||
|
||||
# Provision the software under test.
|
||||
/usr/libexec/osbuild-composer-test/provision.sh none
|
||||
|
||||
|
|
@ -108,7 +114,7 @@ INSTALLER_TYPE=edge-simplified-installer
|
|||
INSTALLER_FILENAME=simplified-installer.iso
|
||||
MEMORY=2048
|
||||
BOOT_ARGS="uefi"
|
||||
REF_PREFIX="rhel-edge"
|
||||
# REF_PREFIX="rhel-edge"
|
||||
|
||||
# Set up temporary files.
|
||||
TEMPDIR=$(mktemp -d)
|
||||
|
|
@ -139,12 +145,12 @@ EDGE_USER_PASSWORD_SHA512=$(openssl passwd -6 -stdin <<< "${EDGE_USER_PASSWORD:-
|
|||
case "${ID}-${VERSION_ID}" in
|
||||
"rhel-8"* )
|
||||
OSTREE_REF="rhel/8/${ARCH}/edge"
|
||||
PARENT_REF="rhel/8/${ARCH}/edge"
|
||||
# PARENT_REF="rhel/8/${ARCH}/edge"
|
||||
OS_VARIANT="rhel8-unknown"
|
||||
;;
|
||||
"rhel-9"* )
|
||||
OSTREE_REF="rhel/9/${ARCH}/edge"
|
||||
PARENT_REF="rhel/9/${ARCH}/edge"
|
||||
# PARENT_REF="rhel/9/${ARCH}/edge"
|
||||
OS_VARIANT="rhel9-unknown"
|
||||
SYSROOT_RO="true"
|
||||
ANSIBLE_USER=fdouser
|
||||
|
|
@ -155,13 +161,13 @@ case "${ID}-${VERSION_ID}" in
|
|||
;;
|
||||
"centos-8")
|
||||
OSTREE_REF="centos/8/${ARCH}/edge"
|
||||
PARENT_REF="centos/8/${ARCH}/edge"
|
||||
# PARENT_REF="centos/8/${ARCH}/edge"
|
||||
OS_VARIANT="centos8"
|
||||
KERNEL_RT_PKG="kernel-rt-core"
|
||||
;;
|
||||
"centos-9")
|
||||
OSTREE_REF="centos/9/${ARCH}/edge"
|
||||
PARENT_REF="centos/9/${ARCH}/edge"
|
||||
# PARENT_REF="centos/9/${ARCH}/edge"
|
||||
OS_VARIANT="centos-stream9"
|
||||
BOOT_ARGS="uefi,firmware.feature0.name=secure-boot,firmware.feature0.enabled=no"
|
||||
SYSROOT_RO="true"
|
||||
|
|
@ -478,7 +484,7 @@ build_image simplified_iso_without_fdo "${INSTALLER_TYPE}" "${PROD_REPO_URL}/"
|
|||
greenprint "📥 Downloading the simplified_iso_without_fdo image"
|
||||
sudo composer-cli compose image "${COMPOSE_ID}" > /dev/null
|
||||
ISO_FILENAME="${COMPOSE_ID}-${INSTALLER_FILENAME}"
|
||||
sudo cp "${ISO_FILENAME}" /var/lib/libvirt/images
|
||||
sudo mv "${ISO_FILENAME}" /var/lib/libvirt/images
|
||||
|
||||
# Clean compose and blueprints.
|
||||
greenprint "🧹 Clean up simplified_iso_without_fdo blueprint and compose"
|
||||
|
|
@ -578,6 +584,7 @@ if [[ $(sudo virsh domstate "${IMAGE_KEY}-simplified_iso_without_fdo") == "runni
|
|||
fi
|
||||
sudo virsh undefine "${IMAGE_KEY}-simplified_iso_without_fdo" --nvram
|
||||
sudo virsh vol-delete --pool images "$LIBVIRT_IMAGE_PATH"
|
||||
sudo rm -fr "/var/lib/libvirt/images/${ISO_FILENAME}"
|
||||
|
||||
########################################################################
|
||||
##
|
||||
|
|
@ -829,7 +836,7 @@ build_image fdosshkey "${INSTALLER_TYPE}" "${PROD_REPO_URL}"
|
|||
greenprint "📥 Downloading the fdosshkey image"
|
||||
sudo composer-cli compose image "${COMPOSE_ID}" > /dev/null
|
||||
ISO_FILENAME="${COMPOSE_ID}-${INSTALLER_FILENAME}"
|
||||
sudo cp "${ISO_FILENAME}" /var/lib/libvirt/images
|
||||
sudo mv "${ISO_FILENAME}" /var/lib/libvirt/images
|
||||
|
||||
# Clean compose and blueprints.
|
||||
greenprint "🧹 Clean up fdosshkey blueprint and compose"
|
||||
|
|
@ -946,146 +953,6 @@ sudo ansible-playbook -v -i "${TEMPDIR}"/inventory \
|
|||
/usr/share/tests/osbuild-composer/ansible/check_ostree.yaml || RESULTS=0
|
||||
check_result
|
||||
|
||||
##################################################################
|
||||
##
|
||||
## Build rebased ostree repo
|
||||
##
|
||||
##################################################################
|
||||
tee "$BLUEPRINT_FILE" > /dev/null << EOF
|
||||
name = "rebase"
|
||||
description = "An rebase rhel-edge container image"
|
||||
version = "0.0.2"
|
||||
modules = []
|
||||
groups = []
|
||||
|
||||
[[packages]]
|
||||
name = "python3"
|
||||
version = "*"
|
||||
|
||||
[[packages]]
|
||||
name = "sssd"
|
||||
version = "*"
|
||||
|
||||
[[packages]]
|
||||
name = "wget"
|
||||
version = "*"
|
||||
|
||||
[customizations.kernel]
|
||||
name = "${KERNEL_RT_PKG}"
|
||||
|
||||
[[customizations.user]]
|
||||
name = "admin"
|
||||
description = "Administrator account"
|
||||
password = "${EDGE_USER_PASSWORD_SHA512}"
|
||||
home = "/home/admin/"
|
||||
groups = ["wheel"]
|
||||
EOF
|
||||
|
||||
greenprint "📄 rebase blueprint"
|
||||
cat "$BLUEPRINT_FILE"
|
||||
|
||||
# Prepare the blueprint for the compose.
|
||||
greenprint "📋 Preparing rebase blueprint"
|
||||
sudo composer-cli blueprints push "$BLUEPRINT_FILE"
|
||||
sudo composer-cli blueprints depsolve rebase
|
||||
|
||||
# Build upgrade image.
|
||||
OSTREE_REF="test/redhat/x/${ARCH}/edge"
|
||||
build_image rebase "$CONTAINER_TYPE" "$PROD_REPO_URL" "$PARENT_REF"
|
||||
|
||||
# Download the image
|
||||
greenprint "📥 Downloading the rebase image"
|
||||
sudo composer-cli compose image "${COMPOSE_ID}" > /dev/null
|
||||
|
||||
# Delete installation rhel-edge container and its image
|
||||
greenprint "🧹 Delete installation rhel-edge container and its image"
|
||||
# Remove rhel-edge container if exists
|
||||
sudo podman ps -q --filter name=rhel-edge --format "{{.ID}}" | sudo xargs --no-run-if-empty podman rm -f
|
||||
# Remove container image if exists
|
||||
sudo podman images --filter "dangling=true" --format "{{.ID}}" | sudo xargs --no-run-if-empty podman rmi -f
|
||||
|
||||
# Deal with stage repo container
|
||||
greenprint "🗜 Extracting image"
|
||||
IMAGE_FILENAME="${COMPOSE_ID}-${CONTAINER_FILENAME}"
|
||||
sudo podman pull "oci-archive:${IMAGE_FILENAME}"
|
||||
sudo podman images
|
||||
# Clear image file
|
||||
sudo rm -f "$IMAGE_FILENAME"
|
||||
|
||||
# Run edge stage repo
|
||||
greenprint "🛰 Running edge stage repo"
|
||||
# Get image id to run image
|
||||
EDGE_IMAGE_ID=$(sudo podman images --filter "dangling=true" --format "{{.ID}}")
|
||||
sudo podman run -d --name rhel-edge --network edge --ip "$STAGE_REPO_ADDRESS" "$EDGE_IMAGE_ID"
|
||||
# Wait for container to be running
|
||||
until [ "$(sudo podman inspect -f '{{.State.Running}}' rhel-edge)" == "true" ]; do
|
||||
sleep 1;
|
||||
done;
|
||||
|
||||
# Pull rebase commit to prod mirror
|
||||
greenprint "⛓ Pull rebase commit to prod mirror"
|
||||
sudo ostree --repo="$PROD_REPO" pull --mirror edge-stage "$OSTREE_REF"
|
||||
|
||||
# Get ostree commit value.
|
||||
greenprint "🕹 Get ostree rebase commit value"
|
||||
REBASE_HASH=$(curl "${PROD_REPO_URL}/refs/heads/${OSTREE_REF}")
|
||||
|
||||
# Clean compose and blueprints.
|
||||
greenprint "🧽 Clean up rebase blueprint and compose"
|
||||
sudo composer-cli compose delete "${COMPOSE_ID}" > /dev/null
|
||||
sudo composer-cli blueprints delete rebase > /dev/null
|
||||
|
||||
greenprint "🗳 Rebase ostree image/commit"
|
||||
sudo ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" admin@${EDGE_GUEST_ADDRESS} "echo '${EDGE_USER_PASSWORD}' |sudo -S rpm-ostree rebase ${REF_PREFIX}:${OSTREE_REF}"
|
||||
sudo ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" admin@${EDGE_GUEST_ADDRESS} "echo '${EDGE_USER_PASSWORD}' |nohup sudo -S systemctl reboot &>/dev/null & exit"
|
||||
|
||||
# Sleep 10 seconds here to make sure vm restarted already
|
||||
sleep 10
|
||||
|
||||
# Check for ssh ready to go.
|
||||
greenprint "🛃 Checking for SSH is ready to go"
|
||||
# shellcheck disable=SC2034 # Unused variables left for readability
|
||||
for _ in $(seq 0 30); do
|
||||
RESULTS="$(wait_for_ssh_up $EDGE_GUEST_ADDRESS)"
|
||||
if [[ $RESULTS == 1 ]]; then
|
||||
echo "SSH is ready now! 🥳"
|
||||
break
|
||||
fi
|
||||
sleep 10
|
||||
done
|
||||
|
||||
# Check ostree rebase result
|
||||
check_result
|
||||
|
||||
# Add instance IP address into /etc/ansible/hosts
|
||||
sudo tee "${TEMPDIR}"/inventory > /dev/null << EOF
|
||||
[ostree_guest]
|
||||
${EDGE_GUEST_ADDRESS}
|
||||
|
||||
[ostree_guest:vars]
|
||||
ansible_python_interpreter=/usr/bin/python3
|
||||
ansible_user=${ANSIBLE_USER}
|
||||
ansible_private_key_file=${SSH_KEY}
|
||||
ansible_ssh_common_args="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
||||
ansible_become=yes
|
||||
ansible_become_method=sudo
|
||||
ansible_become_pass=${EDGE_USER_PASSWORD}
|
||||
EOF
|
||||
|
||||
# Test IoT/Edge OS
|
||||
sudo ansible-playbook -v -i "${TEMPDIR}"/inventory \
|
||||
-e image_type=rhel-edge \
|
||||
-e ostree_commit="${REBASE_HASH}" \
|
||||
-e skip_rollback_test="true" \
|
||||
-e edge_type=edge-simplified-installer \
|
||||
-e fdo_credential="true" \
|
||||
-e sysroot_ro="$SYSROOT_RO" \
|
||||
-e mfg_guest_int_name="${MFG_GUEST_INT_NAME}" \
|
||||
-e fips="${FIPS}" \
|
||||
/usr/share/tests/osbuild-composer/ansible/check_ostree.yaml || RESULTS=0
|
||||
|
||||
check_result
|
||||
|
||||
# Clean up VM
|
||||
greenprint "🧹 Clean up VM"
|
||||
if [[ $(sudo virsh domstate "${IMAGE_KEY}-fdosshkey") == "running" ]]; then
|
||||
|
|
@ -1093,15 +960,7 @@ if [[ $(sudo virsh domstate "${IMAGE_KEY}-fdosshkey") == "running" ]]; then
|
|||
fi
|
||||
sudo virsh undefine "${IMAGE_KEY}-fdosshkey" --nvram
|
||||
sudo virsh vol-delete --pool images "$LIBVIRT_IMAGE_PATH"
|
||||
|
||||
# Re configure OSTREE_REF because it's change to "test/redhat/x/${ARCH}/edge" by above rebase test
|
||||
if [[ "$ID" == fedora ]]; then
|
||||
OSTREE_REF="${ID}/${VERSION_ID}/${ARCH}/iot"
|
||||
elif [[ "$VERSION_ID" == 8* ]]; then
|
||||
OSTREE_REF="${ID}/8/${ARCH}/edge"
|
||||
else
|
||||
OSTREE_REF="${ID}/9/${ARCH}/edge"
|
||||
fi
|
||||
sudo rm -fr "/var/lib/libvirt/images/${ISO_FILENAME}"
|
||||
|
||||
##################################################################
|
||||
##
|
||||
|
|
@ -1162,7 +1021,7 @@ build_image fdorootcert "${INSTALLER_TYPE}" "${PROD_REPO_URL}/"
|
|||
greenprint "📥 Downloading the fdorootcert image"
|
||||
sudo composer-cli compose image "${COMPOSE_ID}" > /dev/null
|
||||
ISO_FILENAME="${COMPOSE_ID}-${INSTALLER_FILENAME}"
|
||||
sudo cp "${ISO_FILENAME}" /var/lib/libvirt/images
|
||||
sudo mv "${ISO_FILENAME}" /var/lib/libvirt/images
|
||||
|
||||
# Clean compose and blueprints.
|
||||
greenprint "🧹 Clean up fdorootcert blueprint and compose"
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ EDGE_USER_PASSWORD_SHA512=$(openssl passwd -6 -stdin <<< "${EDGE_USER_PASSWORD}"
|
|||
|
||||
DATACENTER_70="Datacenter7.0"
|
||||
DATASTORE_70="datastore-80"
|
||||
DATACENTER_70_POOL="/Datacenter7.0/host/Automation/Resources"
|
||||
DATACENTER_70_POOL="/Datacenter7.0/host/Edge/Resources"
|
||||
# Workdaround for creating rhel9 and centos9 on dc67, change guest_id to 8
|
||||
case "${ID}-${VERSION_ID}" in
|
||||
"rhel-9"* )
|
||||
|
|
|
|||
|
|
@ -58,25 +58,25 @@
|
|||
set_fact:
|
||||
failed_counter: "{{ failed_counter | int + 1 }}"
|
||||
|
||||
- name: add RHEL 9.4 BaseOS repository
|
||||
- name: add RHEL 9.5 BaseOS repository
|
||||
yum_repository:
|
||||
name: baseos
|
||||
description: RHEL repository
|
||||
baseurl: "http://{{ download_node }}/rhel-9/nightly/RHEL-9/latest-RHEL-9.4.0/compose/BaseOS/{{ ansible_facts['architecture'] }}/os/"
|
||||
baseurl: "http://{{ download_node }}/rhel-9/nightly/RHEL-9/latest-RHEL-9.5.0/compose/BaseOS/{{ ansible_facts['architecture'] }}/os/"
|
||||
gpgcheck: no
|
||||
file: rhel_repo
|
||||
become: yes
|
||||
when: ansible_facts['distribution'] == 'RedHat' and ansible_facts ['distribution_version'] is version('9.4', '==')
|
||||
when: ansible_facts['distribution'] == 'RedHat' and ansible_facts ['distribution_version'] is version('9.5', '==')
|
||||
|
||||
- name: add RHEL 9.4 AppStream repository
|
||||
- name: add RHEL 9.5 AppStream repository
|
||||
yum_repository:
|
||||
name: appstream
|
||||
description: RHEL repository
|
||||
baseurl: "http://{{ download_node }}/rhel-9/nightly/RHEL-9/latest-RHEL-9.4.0/compose/AppStream/{{ ansible_facts['architecture'] }}/os/"
|
||||
baseurl: "http://{{ download_node }}/rhel-9/nightly/RHEL-9/latest-RHEL-9.5.0/compose/AppStream/{{ ansible_facts['architecture'] }}/os/"
|
||||
gpgcheck: no
|
||||
file: rhel_repo
|
||||
become: yes
|
||||
when: ansible_facts['distribution'] == 'RedHat' and ansible_facts ['distribution_version'] is version('9.4', '==')
|
||||
when: ansible_facts['distribution'] == 'RedHat' and ansible_facts ['distribution_version'] is version('9.5', '==')
|
||||
|
||||
- name: add RHEL 8.10 BaseOS repository
|
||||
yum_repository:
|
||||
|
|
|
|||
109
tmt/plans/edge-test.fmf
Normal file
109
tmt/plans/edge-test.fmf
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
summary: Edge test plan
|
||||
discover:
|
||||
how: fmf
|
||||
test: edge-test
|
||||
execute:
|
||||
how: tmt
|
||||
provision:
|
||||
hardware:
|
||||
virtualization:
|
||||
is-supported: true
|
||||
cpu:
|
||||
processors: ">= 2"
|
||||
memory: ">= 6 GB"
|
||||
|
||||
/edge-x86-commit:
|
||||
summary: Test edge commit
|
||||
environment+:
|
||||
TEST_CASE: edge-commit
|
||||
|
||||
/edge-x86-installer:
|
||||
summary: Test edge installer image
|
||||
environment+:
|
||||
TEST_CASE: edge-installer
|
||||
|
||||
/edge-x86-installer-fips:
|
||||
summary: Test edge installer image with fips enabled
|
||||
environment+:
|
||||
TEST_CASE: edge-installer-fips
|
||||
adjust+:
|
||||
- when: distro == cs-9
|
||||
enabled: false
|
||||
- when: distro == fedora
|
||||
enabled: false
|
||||
|
||||
/edge-x86-raw-image:
|
||||
summary: Test edge raw image
|
||||
environment+:
|
||||
TEST_CASE: edge-raw-image
|
||||
|
||||
/edge-x86-simplified-installer:
|
||||
summary: Test edge simplified installer image
|
||||
environment+:
|
||||
TEST_CASE: edge-simplified-installer
|
||||
adjust+:
|
||||
- when: distro == fedora
|
||||
enabled: false
|
||||
|
||||
/edge-x86-ignition:
|
||||
summary: Test edge ignition feature
|
||||
environment+:
|
||||
TEST_CASE: edge-ignition
|
||||
adjust+:
|
||||
- when: distro == fedora
|
||||
enabled: false
|
||||
|
||||
/edge-x86-pulp:
|
||||
summary: Test edge pulp feature
|
||||
environment+:
|
||||
TEST_CASE: edge-pulp
|
||||
adjust+:
|
||||
- when: distro == cs-9
|
||||
enabled: false
|
||||
- when: distro == fedora
|
||||
enabled: false
|
||||
|
||||
/edge-x86-ami-image:
|
||||
summary: Test edge ami image
|
||||
environment+:
|
||||
TEST_CASE: edge-ami-image
|
||||
adjust+:
|
||||
- when: distro == fedora
|
||||
enabled: false
|
||||
|
||||
/edge-x86-ami-image-fips:
|
||||
summary: Test edge ami image with fips enabled
|
||||
environment+:
|
||||
TEST_CASE: edge-ami-image-fips
|
||||
adjust+:
|
||||
- when: distro == cs-9
|
||||
enabled: false
|
||||
- when: distro == fedora
|
||||
enabled: false
|
||||
- when: distro == rhel-9-5
|
||||
enabled: false
|
||||
|
||||
/edge-x86-minimal:
|
||||
summary: Test edge minimal raw image
|
||||
environment+:
|
||||
TEST_CASE: edge-minimal
|
||||
|
||||
/edge-x86-vsphere:
|
||||
summary: Test edge vsphere image
|
||||
environment+:
|
||||
TEST_CASE: edge-vsphere
|
||||
adjust+:
|
||||
- when: distro == cs-9
|
||||
enabled: false
|
||||
- when: distro == fedora
|
||||
enabled: false
|
||||
|
||||
/edge-x86-qcow2:
|
||||
summary: Test edge qcow2 image
|
||||
environment+:
|
||||
TEST_CASE: edge-qcow2
|
||||
adjust+:
|
||||
- when: distro == cs-9
|
||||
enabled: false
|
||||
- when: distro == rhel-9-5
|
||||
enabled: false
|
||||
2
tmt/tests/edge-test.fmf
Normal file
2
tmt/tests/edge-test.fmf
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
test: ./test.sh
|
||||
duration: 180m
|
||||
40
tmt/tests/test.sh
Executable file
40
tmt/tests/test.sh
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
#!/bin/bash
|
||||
set -euox pipefail
|
||||
|
||||
cd ../../ || exit 1
|
||||
|
||||
schutzbot/deploy.sh
|
||||
|
||||
function run_tests() {
|
||||
if [ "$TEST_CASE" = "edge-commit" ]; then
|
||||
/usr/libexec/tests/osbuild-composer/ostree.sh
|
||||
elif [ "$TEST_CASE" = "edge-installer" ]; then
|
||||
/usr/libexec/tests/osbuild-composer/ostree-ng.sh
|
||||
elif [ "$TEST_CASE" = "edge-installer-fips" ]; then
|
||||
FIPS=true /usr/libexec/tests/osbuild-composer/ostree-ng.sh
|
||||
elif [ "$TEST_CASE" = "edge-raw-image" ]; then
|
||||
/usr/libexec/tests/osbuild-composer/ostree-raw-image.sh
|
||||
elif [ "$TEST_CASE" = "edge-simplified-installer" ]; then
|
||||
/usr/libexec/tests/osbuild-composer/ostree-simplified-installer.sh
|
||||
elif [ "$TEST_CASE" = "edge-ignition" ]; then
|
||||
/usr/libexec/tests/osbuild-composer/ostree-ignition.sh
|
||||
elif [ "$TEST_CASE" = "edge-pulp" ]; then
|
||||
/usr/libexec/tests/osbuild-composer/ostree-pulp.sh
|
||||
elif [ "$TEST_CASE" = "edge-minimal" ]; then
|
||||
/usr/libexec/tests/osbuild-composer/minimal-raw.sh
|
||||
elif [ "$TEST_CASE" = "edge-ami-image" ]; then
|
||||
/usr/libexec/tests/osbuild-composer/ostree-ami-image.sh
|
||||
elif [ "$TEST_CASE" = "edge-ami-image-fips" ]; then
|
||||
FIPS=true /usr/libexec/tests/osbuild-composer/ostree-ami-image.sh
|
||||
elif [ "$TEST_CASE" = "edge-vsphere" ]; then
|
||||
/usr/libexec/tests/osbuild-composer/ostree-vsphere.sh
|
||||
elif [ "$TEST_CASE" = "edge-qcow2" ]; then
|
||||
/usr/libexec/tests/osbuild-composer/ostree-iot-qcow2.sh
|
||||
else
|
||||
echo "Error: Test case $TEST_CASE not found!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
run_tests
|
||||
exit 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue