From fb9a22e75ff31db14327d3fdbed90e88c9aac7bd Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Fri, 15 May 2020 08:28:31 +0200 Subject: [PATCH] Cherry-pick #18473 to 7.8: [CI] Optimise stash/unstash performance (#18540) --- Jenkinsfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7e34da3ddfe..5d84ccbfb03 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,6 +21,8 @@ pipeline { DOCKER_REGISTRY = 'docker.elastic.co' AWS_ACCOUNT_SECRET = 'secret/observability-team/ci/elastic-observability-aws-account-auth' RUNBLD_DISABLE_NOTIFICATIONS = 'true' + JOB_GCS_BUCKET = 'beats-ci-temp' + JOB_GCS_CREDENTIALS = 'beats-ci-gcs-plugin' } options { timeout(time: 2, unit: 'HOURS') @@ -57,7 +59,7 @@ pipeline { pipelineManager([ cancelPreviousRunningBuilds: [ when: 'PR' ] ]) deleteDir() gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: true) - stash allowEmpty: true, name: 'source', useDefaultExcludes: false + stashV2(name: 'source', bucket: "${JOB_GCS_BUCKET}", credentialsId: "${JOB_GCS_CREDENTIALS}") dir("${BASE_DIR}"){ loadConfigEnvVars() } @@ -710,7 +712,7 @@ def withBeatsEnv(boolean archive, Closure body) { "DOCKER_PULL=0", ]) { deleteDir() - unstash 'source' + unstashV2(name: 'source', bucket: "${JOB_GCS_BUCKET}", credentialsId: "${JOB_GCS_CREDENTIALS}") if(isDockerInstalled()){ dockerLogin(secret: "${DOCKERELASTIC_SECRET}", registry: "${DOCKER_REGISTRY}") } @@ -751,7 +753,7 @@ def withBeatsEnvWin(Closure body) { "RACE_DETECTOR=true", ]){ deleteDir() - unstash 'source' + unstashV2(name: 'source', bucket: "${JOB_GCS_BUCKET}", credentialsId: "${JOB_GCS_CREDENTIALS}") dir("${env.BASE_DIR}"){ installTools() try { @@ -1015,7 +1017,7 @@ def terraformCleanup(String stashName, String directory) { stage("Remove cloud scenarios in ${directory}"){ withCloudTestEnv() { withBeatsEnv(false) { - unstash "terraform-${stashName}" + unstash("terraform-${stashName}") retry(2) { sh(label: "Terraform Cleanup", script: ".ci/scripts/terraform-cleanup.sh ${directory}") } @@ -1164,7 +1166,7 @@ def runbld() { // Unstash the test reports stashedTestReports.each { k, v -> dir(k) { - unstash v + unstash(v) } } sh(label: 'Process JUnit reports with runbld',