From 16e670ab4306fedefa9af0c7e56b2b9996ed8e3b Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 6 Aug 2020 08:11:26 +0100 Subject: [PATCH 1/4] [CI] runbld project name --- Jenkinsfile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c415e7ef605..a65fc49bec6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1422,6 +1422,10 @@ def junitAndStore(Map params = [:]){ def runbld() { catchError(buildResult: 'SUCCESS', message: 'runbld post build action failed.') { if (stashedTestReports) { + def jobName = 'elastic+beats-new' + if (isPR()) { + jobName = 'elastic+beats-new+pull-request' + } dir("${env.BASE_DIR}") { sh(label: 'Prepare workspace context', script: 'find . -type f -name "TEST*.xml" -path "*/build/*" -delete') @@ -1432,12 +1436,12 @@ def runbld() { } } sh(label: 'Process JUnit reports with runbld', - script: '''\ + script: """\ cat >./runbld-script < Date: Thu, 6 Aug 2020 10:29:50 +0100 Subject: [PATCH 2/4] [CI] force cwd --- Jenkinsfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a65fc49bec6..a91fcca4622 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1422,11 +1422,14 @@ def junitAndStore(Map params = [:]){ def runbld() { catchError(buildResult: 'SUCCESS', message: 'runbld post build action failed.') { if (stashedTestReports) { - def jobName = 'elastic+beats-new' + def jobName = 'elastic+beats' + // TODO: change ansible/roles/runbld/templates/runbld.conf.j2 + def where = '' if (isPR()) { - jobName = 'elastic+beats-new+pull-request' + jobName = 'elastic+beats+pull-request' + where = env.BASE_DIR } - dir("${env.BASE_DIR}") { + dir("${where}") { sh(label: 'Prepare workspace context', script: 'find . -type f -name "TEST*.xml" -path "*/build/*" -delete') // Unstash the test reports From e068990dabb59097a7a824cc2501578857c56f61 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 6 Aug 2020 13:54:36 +0100 Subject: [PATCH 3/4] fixes The most common cause is that Jenkins and runbld are configured with different working directories --- Jenkinsfile | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a91fcca4622..4b33af9087a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1423,29 +1423,30 @@ def runbld() { catchError(buildResult: 'SUCCESS', message: 'runbld post build action failed.') { if (stashedTestReports) { def jobName = 'elastic+beats' - // TODO: change ansible/roles/runbld/templates/runbld.conf.j2 - def where = '' if (isPR()) { jobName = 'elastic+beats+pull-request' - where = env.BASE_DIR } - dir("${where}") { - sh(label: 'Prepare workspace context', - script: 'find . -type f -name "TEST*.xml" -path "*/build/*" -delete') - // Unstash the test reports - stashedTestReports.each { k, v -> - dir(k) { - unstash(v) - } + deleteDir() + unstashV2(name: 'source', bucket: "${JOB_GCS_BUCKET}", credentialsId: "${JOB_GCS_CREDENTIALS}") + // Unstash the test reports + stashedTestReports.each { k, v -> + dir(k) { + unstash(v) + } + } + // Unstash the test reports + stashedTestReports.each { k, v -> + dir(k) { + unstash(v) } - sh(label: 'Process JUnit reports with runbld', - script: """\ - cat >./runbld-script <./runbld-script < Date: Thu, 6 Aug 2020 15:43:40 +0100 Subject: [PATCH 4/4] Tests need to be stored in the workspace --- Jenkinsfile | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4b33af9087a..ab27e483560 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1422,22 +1422,15 @@ def junitAndStore(Map params = [:]){ def runbld() { catchError(buildResult: 'SUCCESS', message: 'runbld post build action failed.') { if (stashedTestReports) { - def jobName = 'elastic+beats' - if (isPR()) { - jobName = 'elastic+beats+pull-request' - } + def jobName = isPR() ? 'elastic+beats+pull-request' : 'elastic+beats' deleteDir() unstashV2(name: 'source', bucket: "${JOB_GCS_BUCKET}", credentialsId: "${JOB_GCS_CREDENTIALS}") - // Unstash the test reports - stashedTestReports.each { k, v -> - dir(k) { - unstash(v) - } - } - // Unstash the test reports - stashedTestReports.each { k, v -> - dir(k) { - unstash(v) + dir("${env.BASE_DIR}") { + // Unstash the test reports + stashedTestReports.each { k, v -> + dir(k) { + unstash(v) + } } } sh(label: 'Process JUnit reports with runbld',