fixed
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
pipeline {
|
||||
parameters {
|
||||
string(name: 'directoryPrefix', defaultValue: params.directoryPrefix ?: ${env.borglocation}, description: 'The directory prefix that should be handled')
|
||||
booleanParam(name: 'UseLocationPrefix', defaultValue: params.backuplocally ?: true, description: 'Use the environmental backup location')
|
||||
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')
|
||||
@@ -8,20 +8,28 @@ pipeline {
|
||||
agent { label params['agentname'] }
|
||||
environment {
|
||||
BORG_RELOCATED_REPO_ACCESS_IS_OK = 'yes'
|
||||
backdirectory = "${directory}"
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Run Information') {
|
||||
stage('Run Preparation') {
|
||||
steps {
|
||||
echo "Backing up directory ${directoryPrefix}/${directory}"
|
||||
sh "echo '${params.excludelist}' >> excludelist"
|
||||
script {
|
||||
if (params.UseLocationPrefix) {
|
||||
backdirectory = env.borglocation + "/" + "${directory}"
|
||||
}
|
||||
echo "Backing up directory ${backdirectory}"
|
||||
sh "echo '${params.excludelist}' >> excludelist"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 ${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}"
|
||||
sh "borg create --progress --stats --exclude-from excludelist ${backdirectory}::${java.time.LocalDateTime.now().format(java.time.format.DateTimeFormatter.ofPattern('dd-MM-yyyy_HH:mm'))} ${backdirectory}"
|
||||
sh "borg prune --list --keep-daily 31 --keep-weekly 48 ${backdirectory}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user