2019-07-29 23:55:07 +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/>.
|
|
|
|
*/
|
|
|
|
|
2019-11-16 02:12:18 +08:00
|
|
|
def getImageTagVersion() {
|
|
|
|
def flags = load 'build/new-jenkins/groovy/commit-flags.groovy'
|
|
|
|
return flags.getImageTagVersion()
|
|
|
|
}
|
|
|
|
|
2019-07-29 23:55:07 +08:00
|
|
|
pipeline {
|
2019-09-07 02:03:00 +08:00
|
|
|
agent { label 'canvas-docker' }
|
2019-07-29 23:55:07 +08:00
|
|
|
options {
|
|
|
|
ansiColor('xterm')
|
|
|
|
}
|
|
|
|
|
|
|
|
environment {
|
2019-08-22 21:21:41 +08:00
|
|
|
COMPOSE_FILE = 'docker-compose.new-jenkins.yml'
|
2019-07-29 23:55:07 +08:00
|
|
|
// 'refs/changes/63/181863/8' -> '63.181863.8'
|
2019-11-16 02:12:18 +08:00
|
|
|
NAME = getImageTagVersion()
|
2019-08-27 01:48:19 +08:00
|
|
|
PATCHSET_TAG = "$DOCKER_REGISTRY_FQDN/jenkins/canvas-lms:$NAME"
|
2019-07-29 23:55:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
2019-12-10 02:37:05 +08:00
|
|
|
stage ('Pre-Cleanup') {
|
|
|
|
steps {
|
|
|
|
timeout(time: 2) {
|
|
|
|
sh 'build/new-jenkins/docker-cleanup.sh'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-29 23:55:07 +08:00
|
|
|
stage ('Run Vendored Gems specs') {
|
|
|
|
steps {
|
|
|
|
timeout(time: 60) {
|
|
|
|
sh 'printenv | sort'
|
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'
|
|
|
|
sh 'build/new-jenkins/docker-compose-create-database.sh'
|
2019-07-29 23:55:07 +08:00
|
|
|
sh 'build/new-jenkins/test-gems.sh'
|
|
|
|
}
|
|
|
|
}
|
2019-12-10 02:37:05 +08:00
|
|
|
}
|
|
|
|
}
|
2019-07-29 23:55:07 +08:00
|
|
|
|
2019-12-10 02:37:05 +08:00
|
|
|
post {
|
|
|
|
always {
|
|
|
|
// copy the test results from the container
|
|
|
|
sh 'docker cp $(docker ps -f "ancestor"="$PATCHSET_TAG" -q):/usr/src/app/tmp/spec_results/. ./spec_results/'
|
|
|
|
script {
|
|
|
|
def htmlFiles
|
|
|
|
// find all results files
|
|
|
|
dir ('spec_results') {
|
|
|
|
sh 'mv report.html canvas_i18nliner_results.html'
|
|
|
|
htmlFiles = findFiles glob: '*results.html'
|
|
|
|
}
|
2019-08-29 00:07:46 +08:00
|
|
|
|
2019-12-10 02:37:05 +08:00
|
|
|
// publish html
|
|
|
|
publishHTML target: [
|
|
|
|
allowMissing: false,
|
|
|
|
alwaysLinkToLastBuild: false,
|
|
|
|
keepAll: true,
|
|
|
|
reportDir: "spec_results",
|
|
|
|
reportFiles: htmlFiles.join(','),
|
|
|
|
reportName: 'Test Results'
|
|
|
|
]
|
2019-07-29 23:55:07 +08:00
|
|
|
}
|
|
|
|
}
|
2019-12-10 02:37:05 +08:00
|
|
|
|
|
|
|
cleanup {
|
|
|
|
sh 'rm -rf ./spec_results/'
|
2019-12-11 03:58:45 +08:00
|
|
|
sh 'build/new-jenkins/docker-cleanup.sh --allow-failure'
|
2019-12-10 02:37:05 +08:00
|
|
|
}
|
2019-07-29 23:55:07 +08:00
|
|
|
}
|
|
|
|
}
|