Skip to content

Commit a4e4c9d

Browse files
committed
Add labels to shell scripts in Jenkins (elastic#49657)
1 parent 99ff78c commit a4e4c9d

File tree

4 files changed

+45
-30
lines changed

4 files changed

+45
-30
lines changed

.ci/Jenkinsfile_flaky

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ stage("Kibana Pipeline") {
3232
if (!IS_XPACK) {
3333
kibanaPipeline.buildOss()
3434
if (CI_GROUP == '1') {
35-
runbld "./test/scripts/jenkins_build_kbn_tp_sample_panel_action.sh"
35+
runbld("./test/scripts/jenkins_build_kbn_tp_sample_panel_action.sh", "Build kbn tp sample panel action for ciGroup1")
3636
}
3737
} else {
3838
kibanaPipeline.buildXpack()
@@ -60,18 +60,18 @@ stage("Kibana Pipeline") {
6060
def getWorkerFromParams(isXpack, job, ciGroup) {
6161
if (!isXpack) {
6262
if (job == 'firefoxSmoke') {
63-
return kibanaPipeline.getPostBuildWorker('firefoxSmoke', { runbld './test/scripts/jenkins_firefox_smoke.sh' })
63+
return kibanaPipeline.getPostBuildWorker('firefoxSmoke', { runbld('./test/scripts/jenkins_firefox_smoke.sh', 'Execute kibana-firefoxSmoke') })
6464
} else if(job == 'visualRegression') {
65-
return kibanaPipeline.getPostBuildWorker('visualRegression', { runbld './test/scripts/jenkins_visual_regression.sh' })
65+
return kibanaPipeline.getPostBuildWorker('visualRegression', { runbld('./test/scripts/jenkins_visual_regression.sh', 'Execute kibana-visualRegression') })
6666
} else {
6767
return kibanaPipeline.getOssCiGroupWorker(ciGroup)
6868
}
6969
}
7070

7171
if (job == 'firefoxSmoke') {
72-
return kibanaPipeline.getPostBuildWorker('xpack-firefoxSmoke', { runbld './test/scripts/jenkins_xpack_firefox_smoke.sh' })
72+
return kibanaPipeline.getPostBuildWorker('xpack-firefoxSmoke', { runbld('./test/scripts/jenkins_xpack_firefox_smoke.sh', 'Execute xpack-firefoxSmoke') })
7373
} else if(job == 'visualRegression') {
74-
return kibanaPipeline.getPostBuildWorker('xpack-visualRegression', { runbld './test/scripts/jenkins_xpack_visual_regression.sh' })
74+
return kibanaPipeline.getPostBuildWorker('xpack-visualRegression', { runbld('./test/scripts/jenkins_xpack_visual_regression.sh', 'Execute xpack-visualRegression') })
7575
} else {
7676
return kibanaPipeline.getXpackCiGroupWorker(ciGroup)
7777
}

Jenkinsfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ stage("Kibana Pipeline") { // This stage is just here to help the BlueOcean UI a
2424
'oss-ciGroup10': kibanaPipeline.getOssCiGroupWorker(10),
2525
'oss-ciGroup11': kibanaPipeline.getOssCiGroupWorker(11),
2626
'oss-ciGroup12': kibanaPipeline.getOssCiGroupWorker(12),
27-
'oss-firefoxSmoke': kibanaPipeline.getPostBuildWorker('firefoxSmoke', { runbld './test/scripts/jenkins_firefox_smoke.sh' }),
28-
'oss-visualRegression': kibanaPipeline.getPostBuildWorker('visualRegression', { runbld './test/scripts/jenkins_visual_regression.sh' }),
27+
'oss-firefoxSmoke': kibanaPipeline.getPostBuildWorker('firefoxSmoke', { runbld('./test/scripts/jenkins_firefox_smoke.sh', 'Execute kibana-firefoxSmoke') }),
28+
'oss-visualRegression': kibanaPipeline.getPostBuildWorker('visualRegression', { runbld('./test/scripts/jenkins_visual_regression.sh', 'Execute kibana-visualRegression') }),
2929
]),
3030
'kibana-xpack-agent': kibanaPipeline.withWorkers('kibana-xpack-tests', { kibanaPipeline.buildXpack() }, [
3131
'xpack-ciGroup1': kibanaPipeline.getXpackCiGroupWorker(1),
@@ -38,8 +38,8 @@ stage("Kibana Pipeline") { // This stage is just here to help the BlueOcean UI a
3838
'xpack-ciGroup8': kibanaPipeline.getXpackCiGroupWorker(8),
3939
'xpack-ciGroup9': kibanaPipeline.getXpackCiGroupWorker(9),
4040
'xpack-ciGroup10': kibanaPipeline.getXpackCiGroupWorker(10),
41-
'xpack-firefoxSmoke': kibanaPipeline.getPostBuildWorker('xpack-firefoxSmoke', { runbld './test/scripts/jenkins_xpack_firefox_smoke.sh' }),
42-
'xpack-visualRegression': kibanaPipeline.getPostBuildWorker('xpack-visualRegression', { runbld './test/scripts/jenkins_xpack_visual_regression.sh' }),
41+
'xpack-firefoxSmoke': kibanaPipeline.getPostBuildWorker('xpack-firefoxSmoke', { runbld('./test/scripts/jenkins_xpack_firefox_smoke.sh', 'Execute xpack-firefoxSmoke') }),
42+
'xpack-visualRegression': kibanaPipeline.getPostBuildWorker('xpack-visualRegression', { runbld('./test/scripts/jenkins_xpack_visual_regression.sh', 'Execute xpack-visualRegression') }),
4343
]),
4444
])
4545
}

vars/kibanaPipeline.groovy

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def getOssCiGroupWorker(ciGroup) {
6868
"CI_GROUP=${ciGroup}",
6969
"JOB=kibana-ciGroup${ciGroup}",
7070
]) {
71-
runbld "./test/scripts/jenkins_ci_group.sh"
71+
runbld("./test/scripts/jenkins_ci_group.sh", "Execute kibana-ciGroup${ciGroup}")
7272
}
7373
})
7474
}
@@ -79,7 +79,7 @@ def getXpackCiGroupWorker(ciGroup) {
7979
"CI_GROUP=${ciGroup}",
8080
"JOB=xpack-kibana-ciGroup${ciGroup}",
8181
]) {
82-
runbld "./test/scripts/jenkins_xpack_ci_group.sh"
82+
runbld("./test/scripts/jenkins_xpack_ci_group.sh", "Execute xpack-kibana-ciGroup${ciGroup}")
8383
}
8484
})
8585
}
@@ -93,7 +93,7 @@ def legacyJobRunner(name) {
9393
]) {
9494
jobRunner('linux && immutable', false) {
9595
try {
96-
runbld('.ci/run.sh', true)
96+
runbld('.ci/run.sh', "Execute ${name}", true)
9797
} finally {
9898
catchError {
9999
uploadAllGcsArtifacts(name)
@@ -118,12 +118,15 @@ def jobRunner(label, useRamDisk, closure) {
118118
// Move to a temporary workspace, so that we can symlink the real workspace into /dev/shm
119119
def originalWorkspace = env.WORKSPACE
120120
ws('/tmp/workspace') {
121-
sh """
122-
mkdir -p /dev/shm/workspace
123-
mkdir -p '${originalWorkspace}' # create all of the directories leading up to the workspace, if they don't exist
124-
rm --preserve-root -rf '${originalWorkspace}' # then remove just the workspace, just in case there's stuff in it
125-
ln -s /dev/shm/workspace '${originalWorkspace}'
126-
"""
121+
sh(
122+
script: """
123+
mkdir -p /dev/shm/workspace
124+
mkdir -p '${originalWorkspace}' # create all of the directories leading up to the workspace, if they don't exist
125+
rm --preserve-root -rf '${originalWorkspace}' # then remove just the workspace, just in case there's stuff in it
126+
ln -s /dev/shm/workspace '${originalWorkspace}'
127+
""",
128+
label: "Move workspace to RAM - /dev/shm/workspace"
129+
)
127130
}
128131
}
129132

@@ -225,27 +228,33 @@ def sendKibanaMail() {
225228
}
226229
}
227230

228-
def bash(script) {
229-
sh "#!/bin/bash\n${script}"
231+
def bash(script, label) {
232+
sh(
233+
script: "#!/bin/bash\n${script}",
234+
label: label
235+
)
230236
}
231237

232238
def doSetup() {
233-
runbld "./test/scripts/jenkins_setup.sh"
239+
runbld("./test/scripts/jenkins_setup.sh", "Setup Build Environment and Dependencies")
234240
}
235241

236242
def buildOss() {
237-
runbld "./test/scripts/jenkins_build_kibana.sh"
243+
runbld("./test/scripts/jenkins_build_kibana.sh", "Build OSS/Default Kibana")
238244
}
239245

240246
def buildXpack() {
241-
runbld "./test/scripts/jenkins_xpack_build_kibana.sh"
247+
runbld("./test/scripts/jenkins_xpack_build_kibana.sh", "Build X-Pack Kibana")
242248
}
243249

244250
def runErrorReporter() {
245-
bash """
246-
source src/dev/ci_setup/setup_env.sh
247-
node scripts/report_failed_tests
248-
"""
251+
bash(
252+
"""
253+
source src/dev/ci_setup/setup_env.sh
254+
node scripts/report_failed_tests
255+
""",
256+
"Report failed tests, if necessary"
257+
)
249258
}
250259

251260
return this

vars/runbld.groovy

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
def call(script, enableJunitProcessing = false) {
1+
def call(script, label, enableJunitProcessing = false) {
22
def extraConfig = enableJunitProcessing ? "" : "--config ${env.WORKSPACE}/kibana/.ci/runbld_no_junit.yml"
33

4-
sh "/usr/local/bin/runbld -d '${pwd()}' ${extraConfig} ${script}"
4+
sh(
5+
script: "/usr/local/bin/runbld -d '${pwd()}' ${extraConfig} ${script}",
6+
label: label ?: script
7+
)
58
}
69

710
def junit() {
8-
sh "/usr/local/bin/runbld -d '${pwd()}' ${env.WORKSPACE}/kibana/test/scripts/jenkins_runbld_junit.sh"
11+
sh(
12+
script: "/usr/local/bin/runbld -d '${pwd()}' ${env.WORKSPACE}/kibana/test/scripts/jenkins_runbld_junit.sh",
13+
label: "Process JUnit reports with runbld"
14+
)
915
}
1016

1117
return this

0 commit comments

Comments
 (0)