Skip to content

Commit

Permalink
Add labels to shell scripts in Jenkins (#49657)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianseeders committed Nov 15, 2019
1 parent 99ff78c commit a4e4c9d
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 30 deletions.
10 changes: 5 additions & 5 deletions .ci/Jenkinsfile_flaky
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ stage("Kibana Pipeline") {
if (!IS_XPACK) {
kibanaPipeline.buildOss()
if (CI_GROUP == '1') {
runbld "./test/scripts/jenkins_build_kbn_tp_sample_panel_action.sh"
runbld("./test/scripts/jenkins_build_kbn_tp_sample_panel_action.sh", "Build kbn tp sample panel action for ciGroup1")
}
} else {
kibanaPipeline.buildXpack()
Expand Down Expand Up @@ -60,18 +60,18 @@ stage("Kibana Pipeline") {
def getWorkerFromParams(isXpack, job, ciGroup) {
if (!isXpack) {
if (job == 'firefoxSmoke') {
return kibanaPipeline.getPostBuildWorker('firefoxSmoke', { runbld './test/scripts/jenkins_firefox_smoke.sh' })
return kibanaPipeline.getPostBuildWorker('firefoxSmoke', { runbld('./test/scripts/jenkins_firefox_smoke.sh', 'Execute kibana-firefoxSmoke') })
} else if(job == 'visualRegression') {
return kibanaPipeline.getPostBuildWorker('visualRegression', { runbld './test/scripts/jenkins_visual_regression.sh' })
return kibanaPipeline.getPostBuildWorker('visualRegression', { runbld('./test/scripts/jenkins_visual_regression.sh', 'Execute kibana-visualRegression') })
} else {
return kibanaPipeline.getOssCiGroupWorker(ciGroup)
}
}

if (job == 'firefoxSmoke') {
return kibanaPipeline.getPostBuildWorker('xpack-firefoxSmoke', { runbld './test/scripts/jenkins_xpack_firefox_smoke.sh' })
return kibanaPipeline.getPostBuildWorker('xpack-firefoxSmoke', { runbld('./test/scripts/jenkins_xpack_firefox_smoke.sh', 'Execute xpack-firefoxSmoke') })
} else if(job == 'visualRegression') {
return kibanaPipeline.getPostBuildWorker('xpack-visualRegression', { runbld './test/scripts/jenkins_xpack_visual_regression.sh' })
return kibanaPipeline.getPostBuildWorker('xpack-visualRegression', { runbld('./test/scripts/jenkins_xpack_visual_regression.sh', 'Execute xpack-visualRegression') })
} else {
return kibanaPipeline.getXpackCiGroupWorker(ciGroup)
}
Expand Down
8 changes: 4 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ stage("Kibana Pipeline") { // This stage is just here to help the BlueOcean UI a
'oss-ciGroup10': kibanaPipeline.getOssCiGroupWorker(10),
'oss-ciGroup11': kibanaPipeline.getOssCiGroupWorker(11),
'oss-ciGroup12': kibanaPipeline.getOssCiGroupWorker(12),
'oss-firefoxSmoke': kibanaPipeline.getPostBuildWorker('firefoxSmoke', { runbld './test/scripts/jenkins_firefox_smoke.sh' }),
'oss-visualRegression': kibanaPipeline.getPostBuildWorker('visualRegression', { runbld './test/scripts/jenkins_visual_regression.sh' }),
'oss-firefoxSmoke': kibanaPipeline.getPostBuildWorker('firefoxSmoke', { runbld('./test/scripts/jenkins_firefox_smoke.sh', 'Execute kibana-firefoxSmoke') }),
'oss-visualRegression': kibanaPipeline.getPostBuildWorker('visualRegression', { runbld('./test/scripts/jenkins_visual_regression.sh', 'Execute kibana-visualRegression') }),
]),
'kibana-xpack-agent': kibanaPipeline.withWorkers('kibana-xpack-tests', { kibanaPipeline.buildXpack() }, [
'xpack-ciGroup1': kibanaPipeline.getXpackCiGroupWorker(1),
Expand All @@ -38,8 +38,8 @@ stage("Kibana Pipeline") { // This stage is just here to help the BlueOcean UI a
'xpack-ciGroup8': kibanaPipeline.getXpackCiGroupWorker(8),
'xpack-ciGroup9': kibanaPipeline.getXpackCiGroupWorker(9),
'xpack-ciGroup10': kibanaPipeline.getXpackCiGroupWorker(10),
'xpack-firefoxSmoke': kibanaPipeline.getPostBuildWorker('xpack-firefoxSmoke', { runbld './test/scripts/jenkins_xpack_firefox_smoke.sh' }),
'xpack-visualRegression': kibanaPipeline.getPostBuildWorker('xpack-visualRegression', { runbld './test/scripts/jenkins_xpack_visual_regression.sh' }),
'xpack-firefoxSmoke': kibanaPipeline.getPostBuildWorker('xpack-firefoxSmoke', { runbld('./test/scripts/jenkins_xpack_firefox_smoke.sh', 'Execute xpack-firefoxSmoke') }),
'xpack-visualRegression': kibanaPipeline.getPostBuildWorker('xpack-visualRegression', { runbld('./test/scripts/jenkins_xpack_visual_regression.sh', 'Execute xpack-visualRegression') }),
]),
])
}
Expand Down
45 changes: 27 additions & 18 deletions vars/kibanaPipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def getOssCiGroupWorker(ciGroup) {
"CI_GROUP=${ciGroup}",
"JOB=kibana-ciGroup${ciGroup}",
]) {
runbld "./test/scripts/jenkins_ci_group.sh"
runbld("./test/scripts/jenkins_ci_group.sh", "Execute kibana-ciGroup${ciGroup}")
}
})
}
Expand All @@ -79,7 +79,7 @@ def getXpackCiGroupWorker(ciGroup) {
"CI_GROUP=${ciGroup}",
"JOB=xpack-kibana-ciGroup${ciGroup}",
]) {
runbld "./test/scripts/jenkins_xpack_ci_group.sh"
runbld("./test/scripts/jenkins_xpack_ci_group.sh", "Execute xpack-kibana-ciGroup${ciGroup}")
}
})
}
Expand All @@ -93,7 +93,7 @@ def legacyJobRunner(name) {
]) {
jobRunner('linux && immutable', false) {
try {
runbld('.ci/run.sh', true)
runbld('.ci/run.sh', "Execute ${name}", true)
} finally {
catchError {
uploadAllGcsArtifacts(name)
Expand All @@ -118,12 +118,15 @@ def jobRunner(label, useRamDisk, closure) {
// Move to a temporary workspace, so that we can symlink the real workspace into /dev/shm
def originalWorkspace = env.WORKSPACE
ws('/tmp/workspace') {
sh """
mkdir -p /dev/shm/workspace
mkdir -p '${originalWorkspace}' # create all of the directories leading up to the workspace, if they don't exist
rm --preserve-root -rf '${originalWorkspace}' # then remove just the workspace, just in case there's stuff in it
ln -s /dev/shm/workspace '${originalWorkspace}'
"""
sh(
script: """
mkdir -p /dev/shm/workspace
mkdir -p '${originalWorkspace}' # create all of the directories leading up to the workspace, if they don't exist
rm --preserve-root -rf '${originalWorkspace}' # then remove just the workspace, just in case there's stuff in it
ln -s /dev/shm/workspace '${originalWorkspace}'
""",
label: "Move workspace to RAM - /dev/shm/workspace"
)
}
}

Expand Down Expand Up @@ -225,27 +228,33 @@ def sendKibanaMail() {
}
}

def bash(script) {
sh "#!/bin/bash\n${script}"
def bash(script, label) {
sh(
script: "#!/bin/bash\n${script}",
label: label
)
}

def doSetup() {
runbld "./test/scripts/jenkins_setup.sh"
runbld("./test/scripts/jenkins_setup.sh", "Setup Build Environment and Dependencies")
}

def buildOss() {
runbld "./test/scripts/jenkins_build_kibana.sh"
runbld("./test/scripts/jenkins_build_kibana.sh", "Build OSS/Default Kibana")
}

def buildXpack() {
runbld "./test/scripts/jenkins_xpack_build_kibana.sh"
runbld("./test/scripts/jenkins_xpack_build_kibana.sh", "Build X-Pack Kibana")
}

def runErrorReporter() {
bash """
source src/dev/ci_setup/setup_env.sh
node scripts/report_failed_tests
"""
bash(
"""
source src/dev/ci_setup/setup_env.sh
node scripts/report_failed_tests
""",
"Report failed tests, if necessary"
)
}

return this
12 changes: 9 additions & 3 deletions vars/runbld.groovy
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
def call(script, enableJunitProcessing = false) {
def call(script, label, enableJunitProcessing = false) {
def extraConfig = enableJunitProcessing ? "" : "--config ${env.WORKSPACE}/kibana/.ci/runbld_no_junit.yml"

sh "/usr/local/bin/runbld -d '${pwd()}' ${extraConfig} ${script}"
sh(
script: "/usr/local/bin/runbld -d '${pwd()}' ${extraConfig} ${script}",
label: label ?: script
)
}

def junit() {
sh "/usr/local/bin/runbld -d '${pwd()}' ${env.WORKSPACE}/kibana/test/scripts/jenkins_runbld_junit.sh"
sh(
script: "/usr/local/bin/runbld -d '${pwd()}' ${env.WORKSPACE}/kibana/test/scripts/jenkins_runbld_junit.sh",
label: "Process JUnit reports with runbld"
)
}

return this

0 comments on commit a4e4c9d

Please sign in to comment.