forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.selenium.performance.chrome
150 lines (136 loc) · 4.43 KB
/
Jenkinsfile.selenium.performance.chrome
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/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/>.
*/
library 'canvas-builds-library'
pipeline {
agent { label 'canvas-docker' }
options {
ansiColor('xterm')
timestamps()
}
environment {
BUILD_REGISTRY_FQDN = configuration.buildRegistryFQDN()
COMPOSE_FILE = 'docker-compose.new-jenkins.yml:docker-compose.new-jenkins-selenium.yml'
GERRIT_PORT = '29418'
GERRIT_URL = "$GERRIT_HOST:$GERRIT_PORT"
POSTGRES = configuration.postgres()
RUBY = configuration.ruby()
RERUNS_RETRY = 0 // no reruns
POSTGRES_PASSWORD = 'sekret'
DYNAMODB_IMAGE_TAG = imageTag.dynamodb()
POSTGRES_IMAGE_TAG = imageTag.postgres()
}
stages {
stage('Setup') {
steps {
cleanAndSetup()
}
}
// Copied wholesale out of Jenkinsfile, this needs be abstracted if possible
stage('Checkout Plugins') {
steps {
timeout(time: 10) {
script {
pullGerritRepo('gerrit_builder', 'master', '.')
gems = readFile('gerrit_builder/canvas-lms/config/plugins_list').split()
println "Plugin list: ${gems}"
/* fetch plugins */
gems.each { gem ->
pullGerritRepo(gem, 'master', 'gems/plugins')
}
pullGerritRepo('qti_migration_tool', 'master', 'vendor')
sh '''
mv -v gerrit_builder/canvas-lms/config/* config/
rm -v config/cache_store.yml
rm -vr gerrit_builder
cp -v docker-compose/config/selenium.yml config/
cp -vR docker-compose/config/new-jenkins config/new-jenkins
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) {
sh 'build/new-jenkins/docker-compose-pull.sh'
sh 'build/new-jenkins/docker-compose-build-up.sh'
sh 'build/new-jenkins/docker-compose-setup-databases.sh'
}
}
}
stage('Selenium Performance Tests') {
steps {
timeout(time: 60) {
sh 'build/new-jenkins/rspec-with-retries.sh performance'
}
}
}
}
post {
success {
slackSend(
channel: env.SLACK_CHANNEL,
color: 'good',
message: "[${env.JOB_NAME}] <${env.BUILD_URL}|${env.BUILD_DISPLAY_NAME}> was successful."
)
}
unsuccessful {
// copy spec failures to local
sh 'mkdir -vp tmp'
script {
try {
// [JIRA CCI-168]: need to handle canvas container never being spun up
sh "rm -rf tmp && mkdir -p tmp/ && docker cp test-queue-canvas-1:/usr/src/app/log/spec_failures tmp/ || true"
script {
def htmlFiles
// find all results files
dir('tmp') {
htmlFiles = findFiles glob: '**/index.html'
}
// publish html
publishHTML target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'tmp',
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."
)
}
}
}
cleanup {
script {
sh 'rm -vrf ./tmp/spec_failures/'
libraryScript.execute 'bash/docker-cleanup.sh --allow-failure'
}
}
}
}