-
Notifications
You must be signed in to change notification settings - Fork 0
/
regression-tests.jenkinsfile
134 lines (119 loc) · 3.8 KB
/
regression-tests.jenkinsfile
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
library ('base')
pipeline {
agent {
kubernetes {
defaultContainer 'jnlp'
yamlFile '.jenkins/regression-pod.yaml'
}
}
options {
timeout(time: 2, unit: 'HOURS')
timestamps()
buildDiscarder(
logRotator(
daysToKeepStr: '14',
numToKeepStr: '100',
artifactDaysToKeepStr: '30',
))
}
parameters {
booleanParam(
name: 'SMOKE_TESTS_ONLY',
defaultValue: false,
description: 'Run smoke tests only otherwise full regression'
)
choice(
name: 'STAGING_URL',
choices: [
"https://staging.clark.de",
"https://staging-test-2.clark.de",
"https://staging-test-3.clark.de",
"https://staging-test-4.clark.de",
"https://staging-test-5.clark.de",
"https://staging-test-6.clark.de",
"https://staging-test-7.clark.de",
"https://staging-test-8.clark.de",
"https://staging-test-9.clark.de",
"https://staging-test-10.clark.de",
"https://staging-test-11.clark.de",
"https://staging-test-12.clark.de",
"https://staging-test-13.clark.de",
"https://staging-test-14.clark.de",
"https://staging-test-15.clark.de",
"https://staging-test-16.clark.de",
"https://staging-test-17.clark.de",
"https://staging-test-18.clark.de",
"https://staging-test-19.clark.de",
"https://staging-test-20.clark.de"
],
description: 'select the staging environment'
)
choice(
name: 'BRAND',
choices: ['Clark'],
description: 'select the brand/whitelabel'
)
}
post {
always {
cleanWs()
}
}
environment {
RAILS_ENV = "test"
CHROME_WITHOUT_SANDBOX = "true"
CUCUMBER_AUTOMATION_CREDS = credentials('jenkins-cucumber-automation')
}
stages {
stage('cucumber regression tests') {
when {
anyOf {
triggeredBy 'TimerTrigger'
triggeredBy 'UserIdCause'
}
}
steps {
script {
withStatus(
context: "setup backend",
descriptionPending: "Running the setup to backend",
ignore: true
) {
container('application') {
ansiColor('xterm') {
withCache('application/gems', 'vendor/bundle') {
sh 'bundle install --jobs 3 --path vendor/bundle'
}
sh 'cp config/database.yml.jenkins config/database.yml'
sh 'bundle exec rake db:structure:load db:migrate'
withEnv([
"CAPYBARA_DRIVER=headless_chrome",
"CUCUMBER_TARGET_URL=${params.STAGING_URL}",
"CHROME_WITHOUT_SANDBOX=true"]) {
ansiColor('xterm') {
try {
def testType = params.SMOKE_TESTS_ONLY ? 'smoke tests' : 'regression tests'
echo "Running the cucumber ${testType} against ${env.CUCUMBER_TARGET_URL} and brand ${params.BRAND}"
def testSuitesMap = [Clark:'features/clark']
def tags = params.SMOKE_TESTS_ONLY ? '@smoke and not @ignore' : 'not @ignore'
def testSuite = testSuitesMap.get(params.BRAND)
sh "bundle exec cucumber -t '${tags}' --format AllureCucumber::Formatter --out allure-results ${testSuite}"
} finally {
allure([
includeProperties: false,
jdk: '',
properties: [],
reportBuildPolicy: 'ALWAYS',
results: [[path: 'allure-results']]
])
}
}
}
}
}
}
}
}
}
}
}