ci: propagate database to api deploy
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-05-06 17:03:12 +08:00
parent ca394766d1
commit cf27686e17
4 changed files with 81 additions and 2 deletions

View File

@@ -24,6 +24,9 @@ pipeline {
string(name: 'CURRENT_LINK', defaultValue: '/opt/genarrative/current', description: '当前版本软链接')
string(name: 'SERVICE_NAME', defaultValue: 'genarrative-api.service', description: 'systemd 服务名')
string(name: 'HEALTH_URL', defaultValue: 'http://127.0.0.1:8082/healthz', description: '本机健康检查地址')
string(name: 'API_ENV_FILE', defaultValue: '/etc/genarrative/api-server.env', description: 'api-server 环境文件')
string(name: 'DATABASE', defaultValue: 'genarrative-prod', description: 'api-server 连接的 SpacetimeDB database')
string(name: 'SPACETIME_SERVER_URL', defaultValue: 'http://127.0.0.1:3101', description: 'api-server 连接的 SpacetimeDB server URL')
}
stages {
@@ -45,6 +48,15 @@ pipeline {
if (!params.BUILD_NUMBER_TO_DEPLOY?.trim()) {
error('BUILD_NUMBER_TO_DEPLOY 不能为空。')
}
if (!params.DATABASE?.trim()) {
error('DATABASE 不能为空。')
}
if (!(params.DATABASE.trim() ==~ /^[a-z0-9]+(-[a-z0-9]+)*$/)) {
error("DATABASE 必须匹配 ^[a-z0-9]+(-[a-z0-9]+)*$: ${params.DATABASE}")
}
if (!params.API_ENV_FILE?.trim()) {
error('API_ENV_FILE 不能为空。')
}
}
}
}
@@ -105,7 +117,10 @@ pipeline {
--release-root "${RELEASE_ROOT}" \
--current-link "${CURRENT_LINK}" \
--service "${SERVICE_NAME}" \
--health-url "${HEALTH_URL}"
--health-url "${HEALTH_URL}" \
--api-env-file "${API_ENV_FILE}" \
--database "${DATABASE}" \
--spacetime-server-url "${SPACETIME_SERVER_URL}"
'
'''
}