Tuned the conditions

This commit is contained in:
2026-01-09 16:25:13 +01:00
parent d5477b148c
commit 33b505b01a

View File

@@ -1,8 +1,8 @@
pipeline {
agent any
environment {
BackupToDavid = false
BackupToRPI = false
parameters {
booleanParam(name: 'backuptodavid', defaultValue: false, description: 'Checked = true. Unchecked = false')
booleanParam(name: 'backuptopi', defaultValue: false, description: 'Checked = true. Unchecked = false')
}
stages {
stage('Getting RClone Configuration') {
@@ -37,7 +37,7 @@ pipeline {
stage('Run Rsync to David') {
steps {
script {
if (env.BackupToDavid == true) {
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"
@@ -48,7 +48,7 @@ pipeline {
stage('Run Rsync to External PI') {
steps {
script {
if (env.BackupToRPI == true) {
if (params.backuptopi) {
withCredentials([sshUserPrivateKey(credentialsId: '095cc365-ac40-4ddb-a078-2fa403092de0', keyFileVariable: 'keyfile', passphraseVariable: 'passphrase', usernameVariable: 'user')]) {
sh "cp ${keyfile} ${WORKSPACE}/keyfile"
sh "rsync -v -a -e -n 'ssh -i /home/borgbackup/.ssh/id_rsa -p 9898' --delete --info=progress2 ${env.borglocation}/${directory} borgbackup@localhost:/borgbackup"