feat: automate database OSS backups
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
pipeline {
|
||||
pipeline {
|
||||
agent none
|
||||
|
||||
options {
|
||||
@@ -27,6 +27,7 @@ pipeline {
|
||||
string(name: 'SPACETIME_ROOT_DIR', defaultValue: '/stdb', description: 'spacetime CLI root-dir;需与自托管 spacetimedb.service 一致')
|
||||
string(name: 'SPACETIME_RUN_AS_USER', defaultValue: 'spacetimedb', description: '执行 spacetime publish 的本机用户,默认使用自托管服务用户')
|
||||
booleanParam(name: 'CLEAR_DATABASE', defaultValue: false, description: '是否清空数据库后发布')
|
||||
booleanParam(name: 'SKIP_DATABASE_BACKUP', defaultValue: false, description: '是否跳过 publish 前 OSS 数据库备份;默认不跳过,备份失败会阻断发布')
|
||||
}
|
||||
|
||||
stages {
|
||||
@@ -138,6 +139,7 @@ pipeline {
|
||||
steps {
|
||||
script {
|
||||
def clearArg = params.CLEAR_DATABASE ? '--clear-database' : ''
|
||||
def backupArg = params.SKIP_DATABASE_BACKUP ? '--skip-backup' : ''
|
||||
def rootArg = "--root-dir \"${params.SPACETIME_ROOT_DIR?.trim() ? params.SPACETIME_ROOT_DIR.trim() : '/stdb'}\""
|
||||
def runAsArg = params.SPACETIME_RUN_AS_USER?.trim()
|
||||
? "--run-as-user \"${params.SPACETIME_RUN_AS_USER.trim()}\""
|
||||
@@ -155,7 +157,8 @@ pipeline {
|
||||
${rootArg} \\
|
||||
${runAsArg} \\
|
||||
${serverArg} \\
|
||||
${clearArg}
|
||||
${clearArg} \\
|
||||
${backupArg}
|
||||
'
|
||||
"""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user