forked from ehunter-usgs/earthquake-design-ws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile-qc.groovy
58 lines (47 loc) · 1.44 KB
/
Jenkinsfile-qc.groovy
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
#!/usr/bin/env groovy
node {
def TARGET_WEB_NODES = DEVELOPMENT_WEB_NODES
// Determine set of hosts to run against
if (ENVIRONMENT.toUpperCase() == 'PRODUCTION') {
TARGET_WEB_NODES = PRODUCTION_WEB_NODES
}
TARGET_WEB_NODES = readJSON text: TARGET_WEB_NODES
try {
stage('Setup') {
cleanWs()
sh """
mkdir -p ${WORKSPACE}/qc-results;
chmod -R 777 ${WORKSPACE}/qc-results;
"""
}
stage('Quality Control Checks') {
def TASKS = [:]
TARGET_WEB_NODES.each { host ->
TASKS[host] = {
sh """
docker run --rm \
-v ${WORKSPACE}/qc-results:/hazdev-project/qc-results:rw \
${GITLAB_INNERSOURCE_REGISTRY}/${params.WS_IMAGE} \
/bin/bash --login -c 'node qc/smoketest.js https://${host} >> qc-results/${host}.txt'
"""
publishHTML (target: [
allowMissing: true,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: "${WORKSPACE}/qc-results",
reportFiles: "${host}.txt",
reportName: "${host} QC Results"
])
}
}
parallel TASKS
}
} catch (e) {
mail to: '[email protected]',
from: 'noreply@jenkins',
subject: "Jenkins Failed: ${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
body: "Project build (${BUILD_TAG}) failed '${e}'"
currentBuild.result = 'FAILURE'
throw e
}
}