-
Notifications
You must be signed in to change notification settings - Fork 8.2k
/
Jenkinsfile_coverage
126 lines (107 loc) · 5 KB
/
Jenkinsfile_coverage
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
#!/bin/groovy
library 'kibana-pipeline-library'
kibanaLibrary.load() // load from the Jenkins instance
kibanaPipeline(timeoutMinutes: 180) {
catchErrors {
withEnv([
'CODE_COVERAGE=1', // Needed for multiple ci scripts, such as remote.ts, test/scripts/*.sh, schema.js, etc.
]) {
parallel([
'kibana-intake-agent': workers.intake('kibana-intake', './test/scripts/jenkins_unit.sh'),
'x-pack-intake-agent': {
withEnv([
'NODE_ENV=test' // Needed for jest tests only
]) {
workers.intake('x-pack-intake', './test/scripts/jenkins_xpack.sh')()
}
},
'kibana-oss-agent' : workers.functional(
'kibana-oss-tests',
{ kibanaPipeline.buildOss() },
ossProks()
),
'kibana-xpack-agent' : workers.functional(
'kibana-xpack-tests',
{ kibanaPipeline.buildXpack() },
xpackProks()
),
])
workers.base(name: 'coverage-worker', label: 'tests-l', ramDisk: false, bootstrapped: false) {
kibanaPipeline.downloadCoverageArtifacts()
// def timestamp = new Date(currentBuild.startTimeInMillis).format("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("UTC"))
def timestamp = new Date().format("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("UTC")).previous().previous()
withEnv([
"TIME_STAMP=${timestamp}",
"QA_TEAM_ROCKS=true"
]) {
def vaultSecret = 'secret/kibana-issues/prod/coverage/elasticsearch'
withVaultSecret(secret: vaultSecret, secret_field: 'host', variable_name: 'HOST_FROM_VAULT') {
withVaultSecret(secret: vaultSecret, secret_field: 'username', variable_name: 'USER_FROM_VAULT') {
withVaultSecret(secret: vaultSecret, secret_field: 'password', variable_name: 'PASS_FROM_VAULT') {
kibanaPipeline.bash(
"""
source src/dev/ci_setup/setup_env.sh
# bootstrap from x-pack folder
cd x-pack
yarn kbn bootstrap --prefer-offline
# Return to project root
cd ..
. src/dev/code_coverage/shell_scripts/extract_archives.sh
. src/dev/code_coverage/shell_scripts/fix_html_reports_parallel.sh
. src/dev/code_coverage/shell_scripts/merge_jest_and_functional.sh
. src/dev/code_coverage/shell_scripts/copy_mocha_reports.sh
. src/dev/code_coverage/shell_scripts/ingest_coverage.sh ${BUILD_NUMBER} ${env.BUILD_URL}
""", "### Bootstrap shell and kibana env, merge and ingest code coverage"
)
}
}
}
kibanaPipeline.bash(
"""
echo "### Canonical TIME_STAMP for the build and ingestion: ${TIME_STAMP}"
""",
"### About to Upload Code Coverage Static Site"
)
kibanaCoverage.uploadCoverageStaticSite(TIME_STAMP)
}
sh 'tar -czf kibana-jest-coverage.tar.gz target/kibana-coverage/jest-combined/*'
kibanaPipeline.uploadCoverageArtifacts("coverage/jest-combined", 'kibana-jest-coverage.tar.gz')
sh 'tar -czf kibana-functional-coverage.tar.gz target/kibana-coverage/functional-combined/*'
kibanaPipeline.uploadCoverageArtifacts("coverage/functional-combined", 'kibana-functional-coverage.tar.gz')
sh 'tar -czf kibana-mocha-coverage.tar.gz target/kibana-coverage/mocha-combined/*'
kibanaPipeline.uploadCoverageArtifacts("coverage/mocha-combined", 'kibana-mocha-coverage.tar.gz')
}
}
}
kibanaPipeline.sendMail()
}
def ossProks() {
return [
'oss-ciGroup1': kibanaPipeline.ossCiGroupProcess(1),
'oss-ciGroup2': kibanaPipeline.ossCiGroupProcess(2),
'oss-ciGroup3': kibanaPipeline.ossCiGroupProcess(3),
'oss-ciGroup4': kibanaPipeline.ossCiGroupProcess(4),
'oss-ciGroup5': kibanaPipeline.ossCiGroupProcess(5),
'oss-ciGroup6': kibanaPipeline.ossCiGroupProcess(6),
'oss-ciGroup7': kibanaPipeline.ossCiGroupProcess(7),
'oss-ciGroup8': kibanaPipeline.ossCiGroupProcess(8),
'oss-ciGroup9': kibanaPipeline.ossCiGroupProcess(9),
'oss-ciGroup10': kibanaPipeline.ossCiGroupProcess(10),
'oss-ciGroup11': kibanaPipeline.ossCiGroupProcess(11),
'oss-ciGroup12': kibanaPipeline.ossCiGroupProcess(12),
]
}
def xpackProks() {
return [
'xpack-ciGroup1' : kibanaPipeline.xpackCiGroupProcess(1),
'xpack-ciGroup2' : kibanaPipeline.xpackCiGroupProcess(2),
'xpack-ciGroup3' : kibanaPipeline.xpackCiGroupProcess(3),
'xpack-ciGroup4' : kibanaPipeline.xpackCiGroupProcess(4),
'xpack-ciGroup5' : kibanaPipeline.xpackCiGroupProcess(5),
'xpack-ciGroup6' : kibanaPipeline.xpackCiGroupProcess(6),
'xpack-ciGroup7' : kibanaPipeline.xpackCiGroupProcess(7),
'xpack-ciGroup8' : kibanaPipeline.xpackCiGroupProcess(8),
'xpack-ciGroup9' : kibanaPipeline.xpackCiGroupProcess(9),
'xpack-ciGroup10': kibanaPipeline.xpackCiGroupProcess(10),
]
}