Skip to content

Commit

Permalink
Rename internal filename of sha512 so checksum pass (#1581)
Browse files Browse the repository at this point in the history
* Adding checksum for latest snapshots artifacts

Signed-off-by: Peter Zhu <[email protected]>

* Change to snapshots dir name in path

Signed-off-by: Peter Zhu <[email protected]>

* Update test stack with new location

Signed-off-by: Peter Zhu <[email protected]>

* Simplify the naming in artifacts variables

Signed-off-by: Peter Zhu <[email protected]>

* Rename internal filename of sha512 so checksum pass

Signed-off-by: Peter Zhu <[email protected]>

* Update tests

Signed-off-by: Peter Zhu <[email protected]>

* Remove id number

Signed-off-by: Peter Zhu <[email protected]>

* Move sh block outside of withAWS block

Signed-off-by: Peter Zhu <[email protected]>
  • Loading branch information
peterzhuamazon authored Feb 2, 2022
1 parent 305cc3f commit 4a3660e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
11 changes: 7 additions & 4 deletions tests/jenkins/jobs/uploadMinSnapshotsToS3_Jenkinsfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ ccc
bbb
ccc
})
uploadMinSnapshotsToS3.sh(
cp tests/data/builds/opensearch/dist/opensearch-min-1.2.2-SNAPSHOT-linux-x64.tar.gz tests/data/builds/opensearch/dist/opensearch-min-1.2.2-SNAPSHOT-linux-x64-latest.tar.gz
cp tests/data/builds/opensearch/dist/opensearch-min-1.2.2-SNAPSHOT-linux-x64.tar.gz.sha512 tests/data/builds/opensearch/dist/opensearch-min-1.2.2-SNAPSHOT-linux-x64-latest.tar.gz.sha512
sed -i "s/.tar.gz/-latest.tar.gz/g" tests/data/builds/opensearch/dist/opensearch-min-1.2.2-SNAPSHOT-linux-x64-latest.tar.gz.sha512
)
uploadMinSnapshotsToS3.withAWS({role=dummy_role, roleAccount=1234, duration=900, roleSessionName=jenkins-session}, groovy.lang.Closure)
uploadMinSnapshotsToS3.s3Upload({file=tests/data/builds/opensearch/dist/opensearch-min-1.2.2-SNAPSHOT-linux-x64.tar.gz, bucket=dummy_bucket, path=snapshots/core/opensearch/1.2.2-SNAPSHOT/opensearch-min-1.2.2-SNAPSHOT-linux-x64-29.tar.gz})
uploadMinSnapshotsToS3.s3Upload({file=tests/data/builds/opensearch/dist/opensearch-min-1.2.2-SNAPSHOT-linux-x64.tar.gz, bucket=dummy_bucket, path=snapshots/core/opensearch/1.2.2-SNAPSHOT/opensearch-min-1.2.2-SNAPSHOT-linux-x64-latest.tar.gz})
uploadMinSnapshotsToS3.s3Upload({file=tests/data/builds/opensearch/dist/opensearch-min-1.2.2-SNAPSHOT-linux-x64.tar.gz.sha512, bucket=dummy_bucket, path=snapshots/core/opensearch/1.2.2-SNAPSHOT/opensearch-min-1.2.2-SNAPSHOT-linux-x64-29.tar.gz.sha512})
uploadMinSnapshotsToS3.s3Upload({file=tests/data/builds/opensearch/dist/opensearch-min-1.2.2-SNAPSHOT-linux-x64.tar.gz.sha512, bucket=dummy_bucket, path=snapshots/core/opensearch/1.2.2-SNAPSHOT/opensearch-min-1.2.2-SNAPSHOT-linux-x64-latest.tar.gz.sha512})
uploadMinSnapshotsToS3.s3Upload({file=tests/data/builds/opensearch/dist/opensearch-min-1.2.2-SNAPSHOT-linux-x64-latest.tar.gz, bucket=dummy_bucket, path=snapshots/core/opensearch/1.2.2-SNAPSHOT/opensearch-min-1.2.2-SNAPSHOT-linux-x64-latest.tar.gz})
uploadMinSnapshotsToS3.s3Upload({file=tests/data/builds/opensearch/dist/opensearch-min-1.2.2-SNAPSHOT-linux-x64-latest.tar.gz.sha512, bucket=dummy_bucket, path=snapshots/core/opensearch/1.2.2-SNAPSHOT/opensearch-min-1.2.2-SNAPSHOT-linux-x64-latest.tar.gz.sha512})
11 changes: 7 additions & 4 deletions vars/uploadMinSnapshotsToS3.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ void call(Map args = [:]) {
action(argsMap)
}

sh """
cp ${srcDir}/${baseName}.tar.gz ${srcDir}/${baseName}-latest.tar.gz
cp ${srcDir}/${baseName}.tar.gz.sha512 ${srcDir}/${baseName}-latest.tar.gz.sha512
sed -i "s/.tar.gz/-latest.tar.gz/g" ${srcDir}/${baseName}-latest.tar.gz.sha512
"""
withAWS(role: "${ARTIFACT_PROMOTION_ROLE_NAME}", roleAccount: "${AWS_ACCOUNT_ARTIFACT}", duration: 900, roleSessionName: 'jenkins-session') {
s3Upload(file: "${srcDir}/${baseName}.tar.gz", bucket: "${ARTIFACT_PRODUCTION_BUCKET_NAME}", path: "${dstDir}/${baseName}-${id}.tar.gz")
s3Upload(file: "${srcDir}/${baseName}.tar.gz", bucket: "${ARTIFACT_PRODUCTION_BUCKET_NAME}", path: "${dstDir}/${baseName}-latest.tar.gz")
s3Upload(file: "${srcDir}/${baseName}.tar.gz.sha512", bucket: "${ARTIFACT_PRODUCTION_BUCKET_NAME}", path: "${dstDir}/${baseName}-${id}.tar.gz.sha512")
s3Upload(file: "${srcDir}/${baseName}.tar.gz.sha512", bucket: "${ARTIFACT_PRODUCTION_BUCKET_NAME}", path: "${dstDir}/${baseName}-latest.tar.gz.sha512")
s3Upload(file: "${srcDir}/${baseName}-latest.tar.gz", bucket: "${ARTIFACT_PRODUCTION_BUCKET_NAME}", path: "${dstDir}/${baseName}-latest.tar.gz")
s3Upload(file: "${srcDir}/${baseName}-latest.tar.gz.sha512", bucket: "${ARTIFACT_PRODUCTION_BUCKET_NAME}", path: "${dstDir}/${baseName}-latest.tar.gz.sha512")
}
}

0 comments on commit 4a3660e

Please sign in to comment.