add force opts for stable files, in s4 sync
Change-Id: Ief5e2fa5c86b5555e547b4e5fc94f90beaa23b29
diff --git a/sync-http-to-s3.groovy b/sync-http-to-s3.groovy
index 108a394..44ec92b 100644
--- a/sync-http-to-s3.groovy
+++ b/sync-http-to-s3.groovy
@@ -1,5 +1,5 @@
def common = new com.mirantis.mk.Common()
-
+s4cmdOpts = ' --sync-check '
node("docker") {
stage('Prepare') {
@@ -9,13 +9,18 @@
stage('Upload') {
FILENAMES.split().each { filename ->
url = "${SOURCE}/${filename}"
+ opts = s4cmdOpts
+ if(filename.contains('stable')){
+ common.warningMsg("Going to ovveride ${filename}")
+ opts = opts + '--force'
+ }
img.withRun("--entrypoint='/bin/bash'") { c ->
withCredentials([[$class : 'UsernamePasswordMultiBinding', credentialsId: 'aws-s3',
usernameVariable: 'S3_ACCESS_KEY', passwordVariable: 'S3_SECRET_KEY']]) {
img.inside("-e S3_ACCESS_KEY=${S3_ACCESS_KEY} -e S3_SECRET_KEY=${S3_SECRET_KEY}") {
common.retry(3, 5) {
sh(script: "wget --progress=dot:giga -O ${filename} ${url}", returnStdout: true)
- sh(script: "/usr/local/bin/s4cmd put ${filename} ${DEST}/${filename}", returnStdout: true)
+ sh(script: "/usr/local/bin/s4cmd put ${opts} ${filename} ${DEST}/${filename}", returnStdout: true)
}
}
}