updated db script afte rdefault script
This commit is contained in:
@@ -1,30 +1,21 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
parameters {
|
parameters {
|
||||||
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 - either at the environmental location or fill in a custom absolute path')
|
||||||
string(name: 'directory', defaultValue: params.directory ?: ' ', description: 'The directory that should be handled')
|
string(name: 'name', defaultValue: params.name ?: ' ', description: 'The name of the job/repository that should be handled')
|
||||||
string(name: 'agentname', defaultValue: params.agentname ?: 'julien', description: 'The agent to run this backup on')
|
string(name: 'agentname', defaultValue: params.agentname ?: 'julien', description: 'The agent to run this backup on')
|
||||||
}
|
}
|
||||||
environment {
|
environment {
|
||||||
BORG_RELOCATED_REPO_ACCESS_IS_OK = 'yes'
|
BORG_RELOCATED_REPO_ACCESS_IS_OK = 'yes'
|
||||||
backdirectory = "${directory}"
|
from_dir = "${directory}"
|
||||||
|
to_dir = "${env.borglocation}" + "/" + "${name}"
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Run Preparation') {
|
|
||||||
steps {
|
|
||||||
script {
|
|
||||||
if (params.UseLocationPrefix) {
|
|
||||||
backdirectory = env.borglocation + "/" + "${directory}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Run MariaDB') {
|
stage('Run MariaDB') {
|
||||||
agent {
|
agent {
|
||||||
docker {
|
docker {
|
||||||
image 'mariadb:latest'
|
image 'mariadb:latest'
|
||||||
args "-v '${backdirectory}':/data/ --entrypoint=''"
|
args "-v '${from_dir}':/data/ --entrypoint=''"
|
||||||
reuseNode false
|
reuseNode false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,9 +30,9 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
withCredentials([string(credentialsId: 'cbce976a-0d98-4f35-8ea2-1f7818931bc3', variable: 'BORG_PASSPHRASE')]) {
|
withCredentials([string(credentialsId: 'cbce976a-0d98-4f35-8ea2-1f7818931bc3', variable: 'BORG_PASSPHRASE')]) {
|
||||||
sh "borg create --progress --stats ${env.borglocation}/nextcloud_database::${java.time.LocalDateTime.now().format(java.time.format.DateTimeFormatter.ofPattern('dd-MM-yyyy_HH:mm'))} ${backdirectory}"
|
sh "borg create --progress --stats ${to_dir}::${java.time.LocalDateTime.now().format(java.time.format.DateTimeFormatter.ofPattern('dd-MM-yyyy_HH:mm'))} ${from_dir}"
|
||||||
sh "borg prune --list --keep-daily 31 --keep-weekly 48 ${env.borglocation}/nextcloud_database"
|
sh "borg prune --list --keep-daily 31 --keep-weekly 48 ${to_dir}"
|
||||||
sh "rm -rf ${backdirectory}"
|
sh "rm -rf ${from_dir}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user