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/>.
|
|
|
|
*/
|
|
|
|
|
2020-06-17 02:23:25 +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 {
|
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-06-17 02:23:25 +08:00
|
|
|
POSTGRES = configuration.postgres()
|
|
|
|
RUBY_PASSENGER = configuration.rubyPassenger()
|
2019-10-04 21:07:36 +08:00
|
|
|
MAX_FAIL = 5
|
2019-12-07 06:32:11 +08:00
|
|
|
RERUNS_RETRY = 0 // no reruns
|
2020-05-16 03:20:33 +08:00
|
|
|
POSTGRES_PASSWORD = 'sekret'
|
2020-07-15 08:13:38 +08:00
|
|
|
SELENIUM_VERSION = "3.141.59-20200525"
|
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 {
|
2020-06-17 02:23:25 +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
|
|
|
}
|
2020-06-17 02:23:25 +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
|
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage ('Setup Containers') {
|
|
|
|
steps {
|
|
|
|
timeout(time: 20) {
|
2019-09-27 21:18:54 +08:00
|
|
|
sh 'build/new-jenkins/docker-compose-pull.sh'
|
|
|
|
sh 'build/new-jenkins/docker-compose-pull-selenium.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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage ('Selenium Performance Tests') {
|
|
|
|
steps {
|
|
|
|
timeout(time: 60) {
|
2019-10-04 21:07:36 +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'
|
2020-05-02 05:04:18 +08:00
|
|
|
// [JIRA CCI-168]: need to handle canvas container never being spun up
|
2020-05-16 03:20:33 +08:00
|
|
|
sh 'docker cp $(docker ps -q --filter "name=canvas_"):/usr/src/app/log/spec_failures/ ./tmp' || true
|
2019-12-10 02:37:05 +08:00
|
|
|
script {
|
|
|
|
def htmlFiles
|
|
|
|
// find all results files
|
|
|
|
dir ('tmp') {
|
|
|
|
htmlFiles = findFiles glob: '**/index.html'
|
2019-08-15 02:43:09 +08:00
|
|
|
}
|
2019-12-10 02:37:05 +08:00
|
|
|
// publish html
|
|
|
|
publishHTML target: [
|
|
|
|
allowMissing: false,
|
|
|
|
alwaysLinkToLastBuild: false,
|
|
|
|
keepAll: true,
|
|
|
|
reportDir: "tmp",
|
|
|
|
reportFiles: htmlFiles.join(','),
|
|
|
|
reportName: 'Test Failures'
|
2020-03-10 23:14:44 +08:00
|
|
|
]
|
2019-08-15 02:43:09 +08:00
|
|
|
}
|
2019-12-14 00:42:48 +08:00
|
|
|
|
|
|
|
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 {
|
2020-03-10 23:14:44 +08:00
|
|
|
sh 'rm -vrf ./tmp/spec_failures/'
|
2020-06-17 02:23:25 +08:00
|
|
|
execute 'bash/docker-cleanup.sh --allow-failure'
|
2019-12-10 02:37:05 +08:00
|
|
|
}
|
2019-08-15 02:43:09 +08:00
|
|
|
}
|
|
|
|
}
|