This commit is contained in:
matthias
2026-05-04 15:02:29 +02:00
parent 80c98513a7
commit 5163fdbb55
+20 -17
View File
@@ -2,7 +2,7 @@ pipeline {
agent any
parameters {
booleanParam(name: 'backuplocally', defaultValue: params.backuplocally ?: false, description: 'If true local BORG backup will be created')
booleanParam(name: 'backuptostackstorage', defaultValue: false, description: 'If true backup data to TransIP Stack')
// booleanParam(name: 'backuptostackstorage', defaultValue: false, description: 'If true backup data to TransIP Stack')
booleanParam(name: 'backuptodavid', defaultValue: params.backuptodavid ?: false, description: 'If true rsync the BORG repository to David')
booleanParam(name: 'backuptowinschoten', defaultValue: params.backuptowinschoten ?: false, description: 'If true rsync the BORG repository to our Winschoten backup system')
string(name: 'directory', defaultValue: params.directory ?: ' ', description: 'The directory that should be handled')
@@ -17,7 +17,7 @@ pipeline {
script { env.backuptostackstorage = false }
echo "Backing up directory ${env.storagelocation}/${directory}"
echo "Local BORG backup creation is ${params.backuplocally}"
echo "Backup to TransIP Stack is ${params.backuptostackstorage}"
// echo "Backup to TransIP Stack is ${params.backuptostackstorage}"
echo "Backup to David is ${params.backuptodavid}"
echo "Backup to Winschoten PI is ${params.backuptowinschoten}"
sh "echo '${params.excludelist}' >> excludelist"
@@ -67,22 +67,25 @@ pipeline {
// }
stage('Rsync TEST') {
steps {
script {
if (params.backuptodavid) {
sh "rsync -v -a -e 'ssh -p 664' --delete --bwlimit=3000 --info=progress2 ${env.borglocation}/${directory} matthias@home.daf2000.nl:/media/disk/borgbackup/"
} else {
echo "Backup to David is skipped"
}
}
script {
if (params.backuptowinschoten) {
withCredentials([sshUserPrivateKey(credentialsId: 'backupwinschoten', keyFileVariable: 'keyfile', passphraseVariable: 'passphrase', usernameVariable: 'user')]) {
sh "cp ${keyfile} ${WORKSPACE}/keyfile"
sh "rsync -v -a -e 'ssh -i /home/backupwinschoten/.ssh/id_rsa -p 9897' --delete --info=progress2 ${env.borglocation}/${directory} backupwinschoten@localhost:/storage/borgbackups/"
failFast false
parallel {
steps {
script {
if (params.backuptodavid) {
sh "rsync -v -a -e 'ssh -p 664' --delete --bwlimit=3000 --info=progress2 ${env.borglocation}/${directory} matthias@home.daf2000.nl:/media/disk/borgbackup/"
} else {
echo "Backup to David is skipped"
}
}
script {
if (params.backuptowinschoten) {
withCredentials([sshUserPrivateKey(credentialsId: 'backupwinschoten', keyFileVariable: 'keyfile', passphraseVariable: 'passphrase', usernameVariable: 'user')]) {
sh "cp ${keyfile} ${WORKSPACE}/keyfile"
sh "rsync -v -a -e 'ssh -i /home/backupwinschoten/.ssh/id_rsa -p 9897' --delete --info=progress2 ${env.borglocation}/${directory} backupwinschoten@localhost:/storage/borgbackups/"
}
} else {
echo "Backup to Winschoten is skipped"
}
} else {
echo "Backup to External PI is skipped"
}
}
}