2019-08-15 02:43:09 +08:00
|
|
|
#!/usr/bin/env groovy
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2019 - present Instructure, Inc.
|
|
|
|
*
|
|
|
|
* This file is part of Canvas.
|
|
|
|
*
|
|
|
|
* Canvas is free software: you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU Affero General Public License as published by the Free
|
|
|
|
* Software Foundation, version 3 of the License.
|
|
|
|
*
|
|
|
|
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2021-05-19 00:33:13 +08:00
|
|
|
library 'canvas-builds-library'
|
2020-05-16 03:42:23 +08:00
|
|
|
|
2019-08-15 02:43:09 +08:00
|
|
|
pipeline {
|
2019-10-04 21:07:36 +08:00
|
|
|
agent { label 'canvas-docker' }
|
2019-08-15 02:43:09 +08:00
|
|
|
options {
|
|
|
|
ansiColor('xterm')
|
2020-05-09 02:23:07 +08:00
|
|
|
timestamps()
|
2019-08-15 02:43:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
environment {
|
2020-07-28 00:14:37 +08:00
|
|
|
BUILD_REGISTRY_FQDN = configuration.buildRegistryFQDN()
|
2019-08-22 21:21:41 +08:00
|
|
|
COMPOSE_FILE = 'docker-compose.new-jenkins.yml:docker-compose.new-jenkins-selenium.yml'
|
2019-12-07 06:32:11 +08:00
|
|
|
GERRIT_PORT = '29418'
|
|
|
|
GERRIT_URL = "$GERRIT_HOST:$GERRIT_PORT"
|
2020-03-16 20:23:58 +08:00
|
|
|
NODE = configuration.node()
|
2020-06-17 02:23:25 +08:00
|
|
|
POSTGRES = configuration.postgres()
|
2020-03-16 20:23:58 +08:00
|
|
|
RUBY = configuration.ruby()
|
2021-05-18 09:33:35 +08:00
|
|
|
RERUNS_RETRY = 0 // no reruns
|
2020-05-16 03:20:33 +08:00
|
|
|
POSTGRES_PASSWORD = 'sekret'
|
2020-06-27 03:37:32 +08:00
|
|
|
|
2021-05-19 00:33:13 +08:00
|
|
|
CASSANDRA_IMAGE_TAG = imageTag.cassandra()
|
|
|
|
DYNAMODB_IMAGE_TAG = imageTag.dynamodb()
|
|
|
|
POSTGRES_IMAGE_TAG = imageTag.postgres()
|
2019-08-15 02:43:09 +08:00
|
|
|
}
|
2019-10-04 21:07:36 +08:00
|
|
|
|
2019-08-15 02:43:09 +08:00
|
|
|
stages {
|
2021-10-01 01:52:51 +08:00
|
|
|
stage('Setup') {
|
2019-12-10 02:37:05 +08:00
|
|
|
steps {
|
2020-06-17 02:23:25 +08:00
|
|
|
cleanAndSetup()
|
2019-12-10 02:37:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-07 06:32:11 +08:00
|
|
|
// Copied wholesale out of Jenkinsfile, this needs be abstracted if possible
|
|
|
|
stage('Checkout Plugins') {
|
2019-08-15 02:43:09 +08:00
|
|
|
steps {
|
2019-12-21 00:26:35 +08:00
|
|
|
timeout(time: 10) {
|
2019-12-07 06:32:11 +08:00
|
|
|
script {
|
2020-06-17 02:23:25 +08:00
|
|
|
pullGerritRepo('gerrit_builder', 'master', '.')
|
2019-12-07 06:32:11 +08:00
|
|
|
gems = readFile('gerrit_builder/canvas-lms/config/plugins_list').split()
|
|
|
|
println "Plugin list: ${gems}"
|
|
|
|
|
|
|
|
/* fetch plugins */
|
|
|
|
gems.each { gem ->
|
2020-06-17 02:23:25 +08:00
|
|
|
pullGerritRepo(gem, 'master', 'gems/plugins')
|
2019-12-07 06:32:11 +08:00
|
|
|
}
|
2021-05-19 00:33:13 +08:00
|
|
|
pullGerritRepo('qti_migration_tool', 'master', 'vendor')
|
2019-12-07 06:32:11 +08:00
|
|
|
|
|
|
|
sh '''
|
|
|
|
mv -v gerrit_builder/canvas-lms/config/* config/
|
|
|
|
rm -v config/cache_store.yml
|
2020-06-17 02:23:25 +08:00
|
|
|
rm -vr gerrit_builder
|
2019-12-07 06:32:11 +08:00
|
|
|
cp -v docker-compose/config/selenium.yml config/
|
2020-03-10 23:14:44 +08:00
|
|
|
cp -vR docker-compose/config/new-jenkins config/new-jenkins
|
2019-12-07 06:32:11 +08:00
|
|
|
cp -v config/delayed_jobs.yml.example config/delayed_jobs.yml
|
|
|
|
cp -v config/domain.yml.example config/domain.yml
|
|
|
|
cp -v config/external_migration.yml.example config/external_migration.yml
|
|
|
|
cp -v config/outgoing_mail.yml.example config/outgoing_mail.yml
|
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-01 01:52:51 +08:00
|
|
|
stage('Setup Containers') {
|
2019-12-07 06:32:11 +08:00
|
|
|
steps {
|
|
|
|
timeout(time: 20) {
|
2019-09-27 21:18:54 +08:00
|
|
|
sh 'build/new-jenkins/docker-compose-pull.sh'
|
2019-08-22 21:21:41 +08:00
|
|
|
sh 'build/new-jenkins/docker-compose-build-up.sh'
|
2020-04-26 00:56:59 +08:00
|
|
|
sh 'build/new-jenkins/docker-compose-setup-databases.sh'
|
2019-12-07 06:32:11 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-01 01:52:51 +08:00
|
|
|
stage('Selenium Performance Tests') {
|
2019-12-07 06:32:11 +08:00
|
|
|
steps {
|
|
|
|
timeout(time: 60) {
|
2021-05-18 09:33:35 +08:00
|
|
|
sh 'build/new-jenkins/rspec-with-retries.sh performance'
|
2019-08-15 02:43:09 +08:00
|
|
|
}
|
|
|
|
}
|
2019-12-10 02:37:05 +08:00
|
|
|
}
|
|
|
|
}
|
2019-08-15 02:43:09 +08:00
|
|
|
|
2019-12-10 02:37:05 +08:00
|
|
|
post {
|
2019-12-14 00:42:48 +08:00
|
|
|
success {
|
|
|
|
slackSend(
|
|
|
|
channel: env.SLACK_CHANNEL,
|
|
|
|
color: 'good',
|
|
|
|
message: "[${env.JOB_NAME}] <${env.BUILD_URL}|${env.BUILD_DISPLAY_NAME}> was successful."
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2019-12-10 02:37:05 +08:00
|
|
|
unsuccessful {
|
|
|
|
// copy spec failures to local
|
2020-03-10 23:14:44 +08:00
|
|
|
sh 'mkdir -vp tmp'
|
2019-12-10 02:37:05 +08:00
|
|
|
script {
|
2020-07-28 00:14:37 +08:00
|
|
|
try {
|
|
|
|
// [JIRA CCI-168]: need to handle canvas container never being spun up
|
2022-06-08 04:48:32 +08:00
|
|
|
sh "rm -rf tmp && mkdir -p tmp/ && docker cp test-queue_canvas_1:/usr/src/app/log/spec_failures tmp/ || true"
|
2020-07-28 00:14:37 +08:00
|
|
|
script {
|
|
|
|
def htmlFiles
|
|
|
|
// find all results files
|
2021-10-01 01:52:51 +08:00
|
|
|
dir('tmp') {
|
2020-07-28 00:14:37 +08:00
|
|
|
htmlFiles = findFiles glob: '**/index.html'
|
|
|
|
}
|
|
|
|
// publish html
|
|
|
|
publishHTML target: [
|
|
|
|
allowMissing: false,
|
|
|
|
alwaysLinkToLastBuild: false,
|
|
|
|
keepAll: true,
|
2021-05-19 00:33:13 +08:00
|
|
|
reportDir: 'tmp',
|
2020-07-28 00:14:37 +08:00
|
|
|
reportFiles: htmlFiles.join(','),
|
|
|
|
reportName: 'Test Failures'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
slackSend(
|
|
|
|
channel: env.SLACK_CHANNEL,
|
|
|
|
color: 'danger',
|
|
|
|
message: "[${env.JOB_NAME}] <${env.BUILD_URL}|${env.BUILD_DISPLAY_NAME}> was unsuccessful."
|
|
|
|
)
|
2019-08-15 02:43:09 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-12-10 02:37:05 +08:00
|
|
|
|
|
|
|
cleanup {
|
2021-01-12 07:33:50 +08:00
|
|
|
script {
|
|
|
|
sh 'rm -vrf ./tmp/spec_failures/'
|
|
|
|
libraryScript.execute 'bash/docker-cleanup.sh --allow-failure'
|
|
|
|
}
|
2019-12-10 02:37:05 +08:00
|
|
|
}
|
2019-08-15 02:43:09 +08:00
|
|
|
}
|
|
|
|
}
|