Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7a3fbd64b3 | |||
| e6d25bff2d | |||
| b17a219a4d |
@@ -1,13 +1,13 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
|
||||||
parameters {
|
parameters {
|
||||||
booleanParam(name: 'backuplocally', defaultValue: params.backuplocally ?: false, description: 'If true local BORG backup will be created')
|
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: 'backuptodavid', defaultValue: params.backuptodavid ?: false, description: 'If true rsync the BORG repository to David')
|
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')
|
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')
|
string(name: 'directory', defaultValue: params.directory ?: ' ', description: 'The directory that should be handled')
|
||||||
|
string(name: 'agentname', defaultValue: params.directory ?: 'any', description: 'The agent to run this backup on')
|
||||||
text(name: 'excludelist', defaultValue: params.excludelist ?: '**/cache/** ', description: 'Multiline string to exclude patterns from backup')
|
text(name: 'excludelist', defaultValue: params.excludelist ?: '**/cache/** ', description: 'Multiline string to exclude patterns from backup')
|
||||||
}
|
}
|
||||||
|
agent params.agentname
|
||||||
environment {
|
environment {
|
||||||
BORG_RELOCATED_REPO_ACCESS_IS_OK = 'yes'
|
BORG_RELOCATED_REPO_ACCESS_IS_OK = 'yes'
|
||||||
}
|
}
|
||||||
@@ -17,20 +17,11 @@ pipeline {
|
|||||||
script { env.backuptostackstorage = false }
|
script { env.backuptostackstorage = false }
|
||||||
echo "Backing up directory ${env.storagelocation}/${directory}"
|
echo "Backing up directory ${env.storagelocation}/${directory}"
|
||||||
echo "Local BORG backup creation is ${params.backuplocally}"
|
echo "Local BORG backup creation is ${params.backuplocally}"
|
||||||
// echo "Backup to TransIP Stack is ${params.backuptostackstorage}"
|
|
||||||
echo "Backup to David is ${params.backuptodavid}"
|
echo "Backup to David is ${params.backuptodavid}"
|
||||||
echo "Backup to Winschoten PI is ${params.backuptowinschoten}"
|
echo "Backup to Winschoten PI is ${params.backuptowinschoten}"
|
||||||
sh "echo '${params.excludelist}' >> excludelist"
|
sh "echo '${params.excludelist}' >> excludelist"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Getting RClone Configuration') {
|
|
||||||
steps {
|
|
||||||
configFileProvider([configFile(fileId: 'e0237193-1245-452e-b035-9d3d501f4c1b', variable: 'rclone_config')]) {
|
|
||||||
sh "mkdir -p ${WORKSPACE}/config"
|
|
||||||
sh "cp ${rclone_config} ${WORKSPACE}/config/rclone.conf"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Create local BorgBackup'){
|
stage('Create local BorgBackup'){
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
@@ -45,28 +36,8 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// stage('Run rclone') {
|
|
||||||
// agent {
|
|
||||||
// docker {
|
|
||||||
// image 'rclone/rclone'
|
|
||||||
// args "--volumes-from=jenkins -v ${env.storagelocation}/${directory}/:/data/ --entrypoint=''"
|
|
||||||
// reuseNode true
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// steps {
|
|
||||||
// script {
|
|
||||||
// if (params.backuptostackstorage) {
|
|
||||||
// sh "mkdir -p /config/rclone"
|
|
||||||
// sh "cp ${WORKSPACE}/config/rclone.conf /config/rclone/"
|
|
||||||
// sh "rclone copy -v /data/ stackstorage:/julien/storage/${directory} --exclude-from excludelist"
|
|
||||||
// } else {
|
|
||||||
// echo "Backup to TransIP Stack is skipped"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
stage('Rsync TEST') {
|
stage('Rsync Backup in Parallel') {
|
||||||
failFast false
|
failFast false
|
||||||
parallel {
|
parallel {
|
||||||
stage ('Run Backup to David') {
|
stage ('Run Backup to David') {
|
||||||
@@ -96,32 +67,5 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// stage('Run Rsync to David') {
|
|
||||||
// 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"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// stage('Run Rsync Backup to Winschoten') {
|
|
||||||
// steps {
|
|
||||||
// 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 External PI is skipped"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user