Skip to content

Commit c4a1251

Browse files
committed
[CI] Optimise stash/unstash performance (elastic#18473)
1 parent 7a5e0f0 commit c4a1251

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Jenkinsfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ pipeline {
2121
DOCKER_REGISTRY = 'docker.elastic.co'
2222
AWS_ACCOUNT_SECRET = 'secret/observability-team/ci/elastic-observability-aws-account-auth'
2323
RUNBLD_DISABLE_NOTIFICATIONS = 'true'
24+
JOB_GCS_BUCKET = 'beats-ci-temp'
25+
JOB_GCS_CREDENTIALS = 'beats-ci-gcs-plugin'
2426
}
2527
options {
2628
timeout(time: 2, unit: 'HOURS')
@@ -57,7 +59,7 @@ pipeline {
5759
pipelineManager([ cancelPreviousRunningBuilds: [ when: 'PR' ] ])
5860
deleteDir()
5961
gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: true)
60-
stash allowEmpty: true, name: 'source', useDefaultExcludes: false
62+
stashV2(name: 'source', bucket: "${JOB_GCS_BUCKET}", credentialsId: "${JOB_GCS_CREDENTIALS}")
6163
dir("${BASE_DIR}"){
6264
loadConfigEnvVars()
6365
}
@@ -710,7 +712,7 @@ def withBeatsEnv(boolean archive, Closure body) {
710712
"DOCKER_PULL=0",
711713
]) {
712714
deleteDir()
713-
unstash 'source'
715+
unstashV2(name: 'source', bucket: "${JOB_GCS_BUCKET}", credentialsId: "${JOB_GCS_CREDENTIALS}")
714716
if(isDockerInstalled()){
715717
dockerLogin(secret: "${DOCKERELASTIC_SECRET}", registry: "${DOCKER_REGISTRY}")
716718
}
@@ -751,7 +753,7 @@ def withBeatsEnvWin(Closure body) {
751753
"RACE_DETECTOR=true",
752754
]){
753755
deleteDir()
754-
unstash 'source'
756+
unstashV2(name: 'source', bucket: "${JOB_GCS_BUCKET}", credentialsId: "${JOB_GCS_CREDENTIALS}")
755757
dir("${env.BASE_DIR}"){
756758
installTools()
757759
try {
@@ -1015,7 +1017,7 @@ def terraformCleanup(String stashName, String directory) {
10151017
stage("Remove cloud scenarios in ${directory}"){
10161018
withCloudTestEnv() {
10171019
withBeatsEnv(false) {
1018-
unstash "terraform-${stashName}"
1020+
unstash("terraform-${stashName}")
10191021
retry(2) {
10201022
sh(label: "Terraform Cleanup", script: ".ci/scripts/terraform-cleanup.sh ${directory}")
10211023
}
@@ -1164,7 +1166,7 @@ def runbld() {
11641166
// Unstash the test reports
11651167
stashedTestReports.each { k, v ->
11661168
dir(k) {
1167-
unstash v
1169+
unstash(v)
11681170
}
11691171
}
11701172
sh(label: 'Process JUnit reports with runbld',

0 commit comments

Comments
 (0)