Compare commits

...

2 Commits

Author SHA1 Message Date
matthias b677ede690 Merge branch 'newtry'
# Conflicts:
#	jenkins/default_backup.yml
2026-05-08 14:44:30 +02:00
matthias ac1687c402 fixed remote location 2026-05-08 14:00:32 +02:00
3 changed files with 7 additions and 24 deletions
-1
View File
@@ -1,5 +1,4 @@
pipeline {
parameters {
agent any
stages {
stage ('Run Backup to David') {
+7 -7
View File
@@ -1,6 +1,7 @@
pipeline {
parameters {
string(name: 'directory', defaultValue: params.directory ?: '${env.borglocation}/', description: 'The directory that should be handled')
string(name: 'directoryPrefix', defaultValue: params.directoryPrefix ?: '${env.borglocation}/', description: 'The directory prefix that should be handled')
string(name: 'directory', defaultValue: params.directory ?: ' ', description: 'The directory that should be handled')
string(name: 'agentname', defaultValue: params.agentname ?: 'julien', description: 'The agent to run this backup on')
text(name: 'excludelist', defaultValue: params.excludelist ?: '**/cache/** ', description: 'Multiline string to exclude patterns from backup')
}
@@ -9,19 +10,18 @@ pipeline {
BORG_RELOCATED_REPO_ACCESS_IS_OK = 'yes'
}
stages {
stage('Run Information') {
stage('Run Information') {
steps {
echo "Backing up directory ${directory}"
echo "Backing up directory ${directoryPrefix}/${directory}"
sh "echo '${params.excludelist}' >> excludelist"
}
}
stage('Create local BorgBackup'){
stage('Create local BorgBackup') {
steps {
script {
withCredentials([string(credentialsId: 'cbce976a-0d98-4f35-8ea2-1f7818931bc3', variable: 'BORG_PASSPHRASE')]) {
sh "borg create --progress --stats --exclude-from excludelist ${directory}::${java.time.LocalDateTime.now().format(java.time.format.DateTimeFormatter.ofPattern('dd-MM-yyyy_HH:mm'))} ${env.storagelocation}/${directory}"
sh "borg prune --list --keep-daily 31 --keep-weekly 48 ${directory}"
}
sh "borg create --progress --stats --exclude-from excludelist ${directoryPrefix}/${directory}::${java.time.LocalDateTime.now().format(java.time.format.DateTimeFormatter.ofPattern('dd-MM-yyyy_HH:mm'))} ${directoryPrefix}/${directory}"
sh "borg prune --list --keep-daily 31 --keep-weekly 48 ${directoryPrefix}/${directory}"
}
}
}
-16
View File
@@ -75,21 +75,5 @@ pipeline {
}
}
}
stage('Run Rsync to External PI') {
steps {
script {
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 'ssh -i /home/borgbackup/.ssh/id_rsa -p 9898' --delete --info=progress2 --exclude='.*' /srv/dev-disk-by-uuid-27fc012e-a1fa-4c7c-9dad-82770888cd03/nextcloud_backup/database_dump/ borgbackup@localhost:/nextcloudbackup/database_dump/"
}
} else {
echo "Backup to External PI is skipped"
}
}
}
}
}
}