Kirill Mashchenko | da53589 | 2018-09-05 11:05:52 +0300 | [diff] [blame] | 1 | def common = new com.mirantis.mk.Common() |
azvyagintsev | ac363ef | 2018-11-23 20:13:08 +0200 | [diff] [blame] | 2 | s4cmdOpts = ' --sync-check ' |
Kirill Mashchenko | da53589 | 2018-09-05 11:05:52 +0300 | [diff] [blame] | 3 | |
| 4 | node("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}" |
azvyagintsev | ac363ef | 2018-11-23 20:13:08 +0200 | [diff] [blame] | 12 | opts = s4cmdOpts |
| 13 | if(filename.contains('stable')){ |
| 14 | common.warningMsg("Going to ovveride ${filename}") |
| 15 | opts = opts + '--force' |
| 16 | } |
Kirill Mashchenko | da53589 | 2018-09-05 11:05:52 +0300 | [diff] [blame] | 17 | 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) { |
Ivan Udovichenko | 038b81f | 2020-10-05 23:57:27 +0300 | [diff] [blame] | 22 | sh(script: "wget --progress=dot:giga --tries=50 -O ${filename} ${url}", returnStdout: true) |
azvyagintsev | ac363ef | 2018-11-23 20:13:08 +0200 | [diff] [blame] | 23 | sh(script: "/usr/local/bin/s4cmd put ${opts} ${filename} ${DEST}/${filename}", returnStdout: true) |
Kirill Mashchenko | da53589 | 2018-09-05 11:05:52 +0300 | [diff] [blame] | 24 | } |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | |
| 29 | } |
| 30 | sh("rm ${filename}") |
| 31 | } |
| 32 | } |
| 33 | deleteDir() |
| 34 | } |