This repository has been archived by the owner on Aug 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Jenkinsfile
98 lines (97 loc) · 2.89 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
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
#!/usr/bin/env groovy
pipeline {
agent {
label 'webpagetest'
}
libraries {
lib('[email protected]')
}
environment {
WEB_PAGE_TEST = credentials('WEB_PAGE_TEST')
WEBPAGETEST_SERVER = "https://${WEB_PAGE_TEST}@wpt-api.stage.mozaws.net/"
PUB_WPT_API_KEY = credentials('PUB_WPT_API_KEY')
}
options {
ansiColor('xterm')
timestamps()
timeout(time: 25, unit: 'MINUTES')
}
stages {
stage('Clone webpagetest-api repo') {
agent any
steps {
checkout([
$class: 'GitSCM',
branches: [[name: 'remove-entrypoint']],
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'webpagetest-api']],
userRemoteConfigs: [[url: 'https://github.com/davehunt/webpagetest-api']]])
}
}
stage('Run WebPageTest (command-line API)') {
agent {
dockerfile { dir 'webpagetest-api' }
}
steps {
writeFile([
file: 'commands.txt',
encoding: 'UTF-8',
text: """test ${TARGET_URL} --location us-east-1-linux:Firefox --keepua --noopt --noimages -r 3 --first --priority 1 --poll 5 --reporter json --label ${TARGET_NAME}.fx.release
test ${TARGET_URL} --location us-east-1-linux:Firefox%20Nightly --keepua --noopt --noimages -r 3 --first --priority 1 --poll 5 --reporter json --label ${TARGET_NAME}.fx.nightly
test ${TARGET_URL} --location us-east-1-linux:Chrome --keepua --noopt --noimages -r 3 --first --priority 1 --poll 5 --reporter json --label ${TARGET_NAME}.chrome.release
test ${TARGET_URL} --location us-east-1-linux:Chrome%20Canary --keepua --noopt --noimages -r 3 --first --priority 1 --poll 5 --reporter json --label ${TARGET_NAME}.chrome.canary"""])
sh '/usr/src/app/bin/webpagetest batch commands.txt > "wpt.json"'
}
post {
always {
archiveArtifacts 'commands.txt,wpt.json'
}
success {
stash includes: 'wpt.json', name: 'wpt.json'
}
}
}
stage('Submit stats to Telemetry') {
agent {
dockerfile true
}
steps {
unstash 'wpt.json'
sh 'python ./send_to_telemetry.py wpt.json'
}
post {
always {
archiveArtifacts 'wpt-telemetry-*.json'
}
}
}
stage('Submit stats to Datadog') {
agent {
dockerfile {
args '--net host'
}
}
environment {
DATADOG_API_KEY = credentials("DATADOG_API_KEY")
DATADOG_APP_KEY = credentials("DATADOG_APP_KEY")
}
steps {
unstash 'wpt.json'
sh 'python ./send_to_datadog.py wpt.json'
}
}
}
post {
failure {
ircNotification('#perftest-alerts')
emailext(
attachLog: true,
body: '$BUILD_URL\n\n$FAILED_TESTS',
replyTo: '$DEFAULT_REPLYTO',
subject: '$DEFAULT_SUBJECT',
to: '$DEFAULT_RECIPIENTS')
}
cleanup {
deleteDir()
}
}
}