-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This takes us to a single point of truth for data; the other is clearly secondary.
- Loading branch information
Showing
4 changed files
with
53 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
def TIMER = "H/30 * * * *" | ||
def NODE = "atomic-jslave-autobrew" | ||
|
||
def dirs_to_backup = ["rdgo", "images" ]; | ||
|
||
node(NODE) { | ||
def par_stages = [:] | ||
stage("Clean workspace") { | ||
step([$class: 'WsCleanup']) | ||
} | ||
checkout scm | ||
utils = load("pipeline-utils.groovy") | ||
utils.define_properties(TIMER) | ||
|
||
for (dir in dirs_to_backup) { | ||
// Avoid iteration+closure trap | ||
def basetarget = dir; | ||
par_stages["backup-" + basetarget] = { -> stage("Backup " + basetarget) { | ||
utils.inside_assembler_container("") { | ||
def remote = "/srv/rhcos/output/${basetarget}"; | ||
def local = "${WORKSPACE}/${basetarget}"; | ||
stage("Sync In") { | ||
withCredentials([ | ||
string(credentialsId: params.ARTIFACT_SERVER, variable: 'ARTIFACT_SERVER'), | ||
sshUserPrivateKey(credentialsId: params.ARTIFACT_SSH_CREDS_ID, keyFileVariable: 'KEY_FILE'), | ||
]) { | ||
sh "mkdir -p ${local}" | ||
utils.rsync_dir_in_dest(ARTIFACT_SERVER, KEY_FILE, remote, local) | ||
} | ||
} | ||
|
||
stage("Sync Out") { | ||
withCredentials([ | ||
[$class: 'AmazonWebServicesCredentialsBinding', credentialsId: params.AWS_CREDENTIALS], | ||
]) { | ||
sh "aws s3 sync --delete ${local}/ s3://rhcos/${basetarget}" | ||
} | ||
} | ||
} | ||
} } } | ||
|
||
// Execute | ||
parallel par_stages; par_stages = [:] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters