Skip to content

Commit

Permalink
chore: upload files to Google Storage when they exist (#28836) (#28847)
Browse files Browse the repository at this point in the history
* fix: send to Google Storage when there are files

* fix: prevent failures if mage exits with 1

* fix: define variable properly

(cherry picked from commit 20d637e)

Co-authored-by: Manuel de la Peña <[email protected]>
  • Loading branch information
mergify[bot] and mdelapenya authored Nov 5, 2021
1 parent a68567b commit e4ff918
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -831,20 +831,23 @@ def archiveTestOutput(Map args = [:]) {
catchError(buildResult: 'SUCCESS', message: 'Failed to archive the build test results', stageResult: 'SUCCESS') {
withMageEnv(version: "${env.GO_VERSION}"){
dir(directory){
cmd(label: "Archive system tests files", script: 'mage packageSystemTests')
cmd(label: "Archive system tests files", script: 'mage packageSystemTests', returnStatus: true)
}
}

def fileName = 'build/system-tests-*.tar.gz' // see dev-tools/mage/target/common/package.go#PackageSystemTests method
def files = findFiles(glob: "${fileName}")
files.each { file ->
echo "${file.name}"

if (files?.length() > 0) {
googleStorageUploadExt(
bucket: "gs://${JOB_GCS_BUCKET}/${env.JOB_NAME}-${env.BUILD_ID}",
credentialsId: "${JOB_GCS_EXT_CREDENTIALS}",
pattern: "${fileName}",
sharedPublicly: true
)
} else {
log(level: 'WARN', text: "There are no system-tests files to upload Google Storage}")
}
googleStorageUploadExt(
bucket: "gs://${JOB_GCS_BUCKET}/${env.JOB_NAME}-${env.BUILD_ID}",
credentialsId: "${JOB_GCS_EXT_CREDENTIALS}",
pattern: "${fileName}",
sharedPublicly: true
)
}
}
}
Expand Down

0 comments on commit e4ff918

Please sign in to comment.