Add native qcow2 boot test
Add an end-to-end qcow2 test that follows a customer's steps with `composer-cli`. The image is booted with libvirt to allow the best virtualization options to be chosen by libvirt. It also uses libvirt's default network. Signed-off-by: Major Hayden <major@redhat.com>
This commit is contained in:
parent
1e310b61b9
commit
860bb219af
3 changed files with 338 additions and 35 deletions
110
schutzbot/Jenkinsfile
vendored
110
schutzbot/Jenkinsfile
vendored
|
|
@ -92,7 +92,7 @@ pipeline {
|
|||
environment { TEST_TYPE = "base" }
|
||||
steps {
|
||||
unstash 'fedora31'
|
||||
run_tests()
|
||||
run_tests('base')
|
||||
}
|
||||
post {
|
||||
always {
|
||||
|
|
@ -108,7 +108,7 @@ pipeline {
|
|||
}
|
||||
steps {
|
||||
unstash 'fedora31'
|
||||
run_tests()
|
||||
run_tests('image')
|
||||
}
|
||||
post {
|
||||
always {
|
||||
|
|
@ -116,12 +116,28 @@ pipeline {
|
|||
}
|
||||
}
|
||||
}
|
||||
stage('Fedora 31 integration') {
|
||||
agent { label "fedora31 && psi" }
|
||||
environment {
|
||||
TEST_TYPE = "integration"
|
||||
AWS_CREDS = credentials('aws-credentials-osbuildci')
|
||||
}
|
||||
steps {
|
||||
unstash 'fedora31'
|
||||
run_tests('integration')
|
||||
}
|
||||
post {
|
||||
always {
|
||||
preserve_logs('fedora31-integration')
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Fedora 32 base') {
|
||||
agent { label "fedora32" }
|
||||
environment { TEST_TYPE = "base" }
|
||||
steps {
|
||||
unstash 'fedora32'
|
||||
run_tests()
|
||||
run_tests('base')
|
||||
}
|
||||
post {
|
||||
always {
|
||||
|
|
@ -137,7 +153,7 @@ pipeline {
|
|||
}
|
||||
steps {
|
||||
unstash 'fedora32'
|
||||
run_tests()
|
||||
run_tests('image')
|
||||
}
|
||||
post {
|
||||
always {
|
||||
|
|
@ -145,12 +161,28 @@ pipeline {
|
|||
}
|
||||
}
|
||||
}
|
||||
stage('Fedora 32 integration') {
|
||||
agent { label "fedora32" }
|
||||
environment {
|
||||
TEST_TYPE = "integration"
|
||||
AWS_CREDS = credentials('aws-credentials-osbuildci')
|
||||
}
|
||||
steps {
|
||||
unstash 'fedora32'
|
||||
run_tests('integration')
|
||||
}
|
||||
post {
|
||||
always {
|
||||
preserve_logs('fedora32-integration')
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('RHEL 8 CDN Base') {
|
||||
agent { label "rhel8" }
|
||||
environment { TEST_TYPE = "base" }
|
||||
steps {
|
||||
unstash 'rhel8cdn'
|
||||
run_tests()
|
||||
run_tests('base')
|
||||
}
|
||||
post {
|
||||
always {
|
||||
|
|
@ -166,7 +198,7 @@ pipeline {
|
|||
}
|
||||
steps {
|
||||
unstash 'rhel8cdn'
|
||||
run_tests()
|
||||
run_tests('image')
|
||||
}
|
||||
post {
|
||||
always {
|
||||
|
|
@ -174,6 +206,22 @@ pipeline {
|
|||
}
|
||||
}
|
||||
}
|
||||
stage('RHEL 8 CDN integration') {
|
||||
agent { label "rhel8" }
|
||||
environment {
|
||||
TEST_TYPE = "integration"
|
||||
AWS_CREDS = credentials('aws-credentials-osbuildci')
|
||||
}
|
||||
steps {
|
||||
unstash 'rhel8cdn'
|
||||
run_tests('integration')
|
||||
}
|
||||
post {
|
||||
always {
|
||||
preserve_logs('rhel8-integration')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -181,13 +229,54 @@ pipeline {
|
|||
|
||||
// Set up a function to hold the steps needed to run the tests so we don't
|
||||
// need to copy/paste the same lines over and over above.
|
||||
void run_tests() {
|
||||
void run_tests(test_type) {
|
||||
|
||||
// Get CI machine details.
|
||||
sh "schutzbot/ci_details.sh"
|
||||
sh (
|
||||
label: "Get CI machine details",
|
||||
script: "schutzbot/ci_details.sh"
|
||||
)
|
||||
|
||||
// Run the tests from the repository.
|
||||
sh "schutzbot/run_tests.sh"
|
||||
sh (
|
||||
label: "Deploy",
|
||||
script: "schutzbot/run_tests.sh"
|
||||
)
|
||||
|
||||
// Run the base tests.
|
||||
if (test_type == 'base') {
|
||||
sh (
|
||||
label: "Base tests",
|
||||
script: "ansible-playbook -e workspace=${WORKSPACE} -e test_type=base -i hosts.ini schutzbot/test.yml"
|
||||
)
|
||||
}
|
||||
|
||||
if (test_type == 'image') {
|
||||
sh (
|
||||
label: "Image tests",
|
||||
script: "ansible-playbook -e workspace=${WORKSPACE} -e test_type=image -i hosts.ini schutzbot/test.yml"
|
||||
)
|
||||
}
|
||||
|
||||
if (test_type == 'integration') {
|
||||
// Run the qcow2 test.
|
||||
sh (
|
||||
label: "Integration test: QCOW2",
|
||||
script: "test/image-tests/qcow2.sh qcow2"
|
||||
)
|
||||
|
||||
// Run the openstack test.
|
||||
sh (
|
||||
label: "Integration test: OpenStack",
|
||||
script: "test/image-tests/qcow2.sh openstack"
|
||||
)
|
||||
|
||||
// Run the AWS test.
|
||||
sh (
|
||||
label: "Integration test: AWS",
|
||||
script: "test/image-tests/aws.sh"
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -195,6 +284,9 @@ void run_tests() {
|
|||
// or failure.
|
||||
void preserve_logs(test_slug) {
|
||||
|
||||
// Save the systemd journal.
|
||||
sh "journalctl --boot > systemd-journald.log"
|
||||
|
||||
// Make a directory for the log files and move the logs there.
|
||||
sh "mkdir ${test_slug} && mv *.log *.jpg ${test_slug}/ || true"
|
||||
|
||||
|
|
|
|||
|
|
@ -15,16 +15,6 @@ sudo chmod -R 777 /opt/ansible_{local,remote}
|
|||
# Restart systemd to work around some Fedora issues in cloud images.
|
||||
sudo systemctl restart systemd-journald
|
||||
|
||||
# Get the current journald cursor.
|
||||
export JOURNALD_CURSOR=$(sudo journalctl --quiet -n 1 --show-cursor | tail -n 1 | grep -oP 's\=.*$')
|
||||
|
||||
# Add a function to preserve the system journal if something goes wrong.
|
||||
preserve_journal() {
|
||||
sudo journalctl --after-cursor=${JOURNALD_CURSOR} > systemd-journald.log
|
||||
exit 1
|
||||
}
|
||||
trap "preserve_journal" ERR
|
||||
|
||||
# Write a simple hosts file for Ansible.
|
||||
echo -e "[test_instances]\nlocalhost ansible_connection=local" > hosts.ini
|
||||
|
||||
|
|
@ -34,19 +24,4 @@ git clone https://github.com/osbuild/ansible-osbuild.git ansible-osbuild
|
|||
ansible-playbook \
|
||||
-i hosts.ini \
|
||||
-e install_source=os \
|
||||
ansible-osbuild/playbook.yml
|
||||
|
||||
# Run the AWS test.
|
||||
if [[ ${TEST_TYPE:-} == image ]]; then
|
||||
test/image-tests/aws.sh
|
||||
fi
|
||||
|
||||
# Run the tests.
|
||||
ansible-playbook \
|
||||
-e workspace=${WORKSPACE} \
|
||||
-e test_type=${TEST_TYPE:-base} \
|
||||
-i hosts.ini \
|
||||
schutzbot/test.yml
|
||||
|
||||
# Collect the systemd journal anyway if we made it all the way to the end.
|
||||
sudo journalctl --after-cursor=${JOURNALD_CURSOR} > systemd-journald.log
|
||||
ansible-osbuild/playbook.yml
|
||||
Loading…
Add table
Add a link
Reference in a new issue