blob: 44ec92be8b902cfd20c89f44ca5d4c7685343e32 [file] [log] [blame]
Kirill Mashchenkoda535892018-09-05 11:05:52 +03001def common = new com.mirantis.mk.Common()
azvyagintsevac363ef2018-11-23 20:13:08 +02002s4cmdOpts = ' --sync-check '
Kirill Mashchenkoda535892018-09-05 11:05:52 +03003
4node("docker") {
5 stage('Prepare') {
6 img = docker.image(IMAGE)
7 img.pull()
8 }
9 stage('Upload') {
10 FILENAMES.split().each { filename ->
11 url = "${SOURCE}/${filename}"
azvyagintsevac363ef2018-11-23 20:13:08 +020012 opts = s4cmdOpts
13 if(filename.contains('stable')){
14 common.warningMsg("Going to ovveride ${filename}")
15 opts = opts + '--force'
16 }
Kirill Mashchenkoda535892018-09-05 11:05:52 +030017 img.withRun("--entrypoint='/bin/bash'") { c ->
18 withCredentials([[$class : 'UsernamePasswordMultiBinding', credentialsId: 'aws-s3',
19 usernameVariable: 'S3_ACCESS_KEY', passwordVariable: 'S3_SECRET_KEY']]) {
20 img.inside("-e S3_ACCESS_KEY=${S3_ACCESS_KEY} -e S3_SECRET_KEY=${S3_SECRET_KEY}") {
21 common.retry(3, 5) {
22 sh(script: "wget --progress=dot:giga -O ${filename} ${url}", returnStdout: true)
azvyagintsevac363ef2018-11-23 20:13:08 +020023 sh(script: "/usr/local/bin/s4cmd put ${opts} ${filename} ${DEST}/${filename}", returnStdout: true)
Kirill Mashchenkoda535892018-09-05 11:05:52 +030024 }
25 }
26 }
27
28
29 }
30 sh("rm ${filename}")
31 }
32 }
33 deleteDir()
34}