debian-forge-composer/schutzbot/Jenkinsfile
Major Hayden d4b7c1d0c7 CI: Test EC2 import and boot
Build an AWS AMI image, upload it to S3, import it into EC2, and boot
it.

Signed-off-by: Major Hayden <major@redhat.com>
2020-05-18 10:27:24 -05:00

133 lines
No EOL
4 KiB
Groovy

pipeline {
agent none
options {
timestamps()
ansiColor('xterm')
// Cancel the pipeline if it runs for more than three hours.
timeout(
time: 3,
unit: "HOURS"
)
}
stages {
stage("Functional Testing") {
parallel {
stage('Fedora 31 base') {
agent { label "fedora31" }
environment { TEST_TYPE = "base" }
steps {
run_tests()
}
post {
always {
preserve_logs('fedora31-base')
}
}
}
stage('Fedora 31 image') {
agent { label "fedora31" }
environment { TEST_TYPE = "image" }
steps {
run_tests()
}
post {
always {
preserve_logs('fedora31-image')
}
}
}
stage('Fedora 32 base') {
agent { label "fedora32" }
environment { TEST_TYPE = "base" }
steps {
run_tests()
}
post {
always {
preserve_logs('fedora32-base')
}
}
}
stage('Fedora 32 image') {
agent { label "fedora32" }
environment { TEST_TYPE = "image" }
steps {
run_tests()
}
post {
always {
preserve_logs('fedora32-image')
}
}
}
stage('Fedora 32 AWS') {
agent { label "fedora32" }
environment {
TEST_TYPE = "aws"
AWS_CREDS = credentials('aws-credentials-osbuildci')
AWS_REGION = "us-east-2"
AWS_BUCKET = "imagebuilder-jenkins-testing-use2"
}
steps {
run_tests()
}
post {
always {
preserve_logs('fedora32-image')
}
}
}
stage('RHEL 8.2 base') {
agent { label "rhel82" }
environment { TEST_TYPE = "base" }
steps {
run_tests()
}
post {
always {
preserve_logs('rhel82-base')
}
}
}
stage('RHEL 8.2 image') {
agent { label "rhel82" }
environment { TEST_TYPE = "image" }
steps {
run_tests()
}
post {
always {
preserve_logs('rhel82-image')
}
}
}
}
}
}
}
// 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() {
// Run the tests from the repository.
sh "schutzbot/run_tests.sh"
}
// Move logs to a unique location and tell Jenkins to capture them on success
// or failure.
void preserve_logs(test_slug) {
// Make a directory for the log files and move the logs there.
sh "mkdir ${test_slug} && mv *.log ${test_slug}/"
// Artifact the logs.
archiveArtifacts (
allowEmptyArchive: true,
artifacts: "${test_slug}/*.log"
)
}