Skip to content

Commit

Permalink
[packaging] Normalise GCP bucket folder structure (#20903) (#20925)
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v authored Sep 2, 2020
1 parent 9642303 commit e2b1292
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions .ci/packaging.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,11 @@ def withMacOSEnv(Closure body){

def publishPackages(baseDir){
def bucketUri = "gs://${JOB_GCS_BUCKET}/snapshots"
if (env.CHANGE_ID?.trim()) {
if (isPR()) {
bucketUri = "gs://${JOB_GCS_BUCKET}/pull-requests/pr-${env.CHANGE_ID}"
}

googleStorageUpload(bucket: "${bucketUri}",
def beatsFolderName = getBeatsName(baseDir)
googleStorageUpload(bucket: "${bucketUri}/${beatsFolderName}",
credentialsId: "${JOB_GCS_CREDENTIALS}",
pathPrefix: "${baseDir}/build/distributions/",
pattern: "${baseDir}/build/distributions/**/*",
Expand All @@ -243,6 +243,18 @@ def publishPackages(baseDir){
)
}

/**
* There is a specific folder structure in https://staging.elastic.co/ and https://artifacts.elastic.co/downloads/
* therefore the storage bucket in GCP should follow the same folder structure.
* This is required by https://github.com/elastic/beats-tester
* e.g.
* baseDir=name -> return name
* baseDir=name1/name2/name3-> return name2
*/
def getBeatsName(baseDir) {
return basedir.replace('x-pack/', '')
}

def withBeatsEnv(Closure body) {
withMageEnv(){
withEnv([
Expand Down

0 comments on commit e2b1292

Please sign in to comment.