Kirill Mashchenko | da53589 | 2018-09-05 11:05:52 +0300 | [diff] [blame^] | 1 | def common = new com.mirantis.mk.Common() |
| 2 | |
| 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}" |
| 12 | img.withRun("--entrypoint='/bin/bash'") { c -> |
| 13 | withCredentials([[$class : 'UsernamePasswordMultiBinding', credentialsId: 'aws-s3', |
| 14 | usernameVariable: 'S3_ACCESS_KEY', passwordVariable: 'S3_SECRET_KEY']]) { |
| 15 | img.inside("-e S3_ACCESS_KEY=${S3_ACCESS_KEY} -e S3_SECRET_KEY=${S3_SECRET_KEY}") { |
| 16 | common.retry(3, 5) { |
| 17 | sh(script: "wget --progress=dot:giga -O ${filename} ${url}", returnStdout: true) |
| 18 | sh(script: "/usr/local/bin/s4cmd put ${filename} ${DEST}/${filename}", returnStdout: true) |
| 19 | } |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | |
| 24 | } |
| 25 | sh("rm ${filename}") |
| 26 | } |
| 27 | } |
| 28 | deleteDir() |
| 29 | } |