-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
62 lines (58 loc) · 3.09 KB
/
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
pipeline {
agent any
stages {
stage('Log') {
steps {
sh " echo Test Runner Host ${params.sshHost}"
}
}
stage('Cypress') {
steps {
withCredentials(bindings: [usernamePassword(credentialsId: '05e46b61-cab8-41a8-8bc8-e0c60d6e7ea7', passwordVariable: 'password', usernameVariable: 'userName'),
string(credentialsId: 'slackToken', variable: 'slackToken')]) {
script {
def remote = [:]
remote.name = "testrunner"
remote.host = "${params.sshHost}"
remote.user = userName
remote.password = password
remote.allowAnyHosts = true
script {sshCommand remote: remote, command: """export SLACK_USER_TOKEN="$slackToken"
export SLACK_THREAD="${params.slackThreadId}"
export PATH=$PATH:/usr/bin/:/usr/local/bin/:/home/testrunner/node_modules/.bin/
sudo -n -E /home/testrunner/node_modules/.bin/cypress run --spec ${params.testSpecPath} --config video=false --reporter json --env host=http://${params.ipAddress}${params.websiteBase} && echo \$?"""}
}
}
}
}
stage('Locust') {
steps {
withCredentials(bindings: [usernamePassword(credentialsId: '05e46b61-cab8-41a8-8bc8-e0c60d6e7ea7', passwordVariable: 'password', usernameVariable: 'userName')]) {
script {
def remote = [:]
remote.name = "testrunner"
remote.host = "${params.sshHost}"
remote.user = userName
remote.password = password
remote.allowAnyHosts = true
script {sshCommand remote: remote, command: """ export WAVEFRONT_PROXY='${params.restWavefrontProxy}'
export WEBSITE_ADDRESS="${params.ipAddress}"
export PATH=$PATH:/usr/bin/:/usr/local/bin/
sudo -E locust --no-web -c ${params.loadTestUsers} -r ${params.loadHatchRate} -f /usr/local/bin/locust_files/${params.testSpecLocust} -t 3m --only-summary --host http://${params.ipAddress}"""}
}
}
}
}
}
parameters {
string(name: 'sshHost', defaultValue: '100.26.206.96', description: 'SSH Host running Cypress and Locust')
string(name: 'slackThreadId', defaultValue: 'slackThreadHere', description: 'slackThreadId')
string(name: 'testSpecLocust', defaultValue: 'locustWavefrontBase.py', description: 'Locust Test Spec')
string(name: 'testSpecPath', defaultValue: '/home/testrunner/titoactions.spec.js', description: 'Cypress Test Spec path')
string(name: 'ipAddress', defaultValue: 'Commuter-tito-03426-1337974357.us-east-1.elb.amazonaws.com', description: 'Website IP Address')
string(name: 'websiteBase', defaultValue: '/Tito/', description: 'Website Base URI')
string(name: 'restWavefrontProxy', defaultValue: 'Commuter-tito-02439-1370868404.us-east-1.elb.amazonaws.com', description: 'Wavefront Proxy')
string(name: 'loadTestUsers', defaultValue: '80', description: 'Locust max users per second')
string(name: 'loadHatchRate', defaultValue: '20', description: 'Locust hatch rate users per second')
}
}