- AppDetailView: appSecret hidden by default, email verification to reveal/reset - AppDetailView: remove per-service SecretKey, service enable requires ops approval request - ImManagementView: add register user and create group dialogs - app.ts/im.ts: update API types and add new endpoints - Add Jenkinsfile for Web apps (yarn build → Docker → ACR → deploy) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
77 行
2.4 KiB
Groovy
77 行
2.4 KiB
Groovy
pipeline {
|
|
agent any
|
|
|
|
parameters {
|
|
choice(name: 'APP', choices: ['tenant-platform', 'ops-platform'], description: '要构建的 Web 应用')
|
|
string(name: 'IMAGE_TAG', defaultValue: 'latest', description: '镜像 Tag')
|
|
booleanParam(name: 'DEPLOY', defaultValue: true, description: '构建后是否自动部署')
|
|
}
|
|
|
|
environment {
|
|
ACR_REGISTRY = 'registry.cn-hangzhou.aliyuncs.com' // 替换为你的 ACR 地址
|
|
ACR_NAMESPACE = 'xuqmgroup'
|
|
ACR_USERNAME = 'your-acr-username'
|
|
PROD_HOST = '106.54.23.149'
|
|
PROD_USER = 'ubuntu'
|
|
COMPOSE_FILE = '/opt/xuqm/deploy/compose.production.yaml'
|
|
}
|
|
|
|
stages {
|
|
stage('Checkout') {
|
|
steps { checkout scm }
|
|
}
|
|
|
|
stage('Install & Build') {
|
|
steps {
|
|
dir("${params.APP}") {
|
|
sh '''
|
|
yarn install --frozen-lockfile
|
|
yarn build
|
|
'''
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Docker Build & Push') {
|
|
steps {
|
|
withCredentials([string(credentialsId: 'ACR_PASSWORD', variable: 'ACR_PASS')]) {
|
|
script {
|
|
def imageName = "${ACR_REGISTRY}/${ACR_NAMESPACE}/web-${params.APP}:${params.IMAGE_TAG}"
|
|
sh """
|
|
docker login ${ACR_REGISTRY} -u ${ACR_USERNAME} -p \${ACR_PASS}
|
|
docker build -f ${params.APP}/Dockerfile -t ${imageName} .
|
|
docker push ${imageName}
|
|
docker rmi ${imageName}
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Deploy to Production') {
|
|
when { expression { return params.DEPLOY } }
|
|
steps {
|
|
withCredentials([sshUserPrivateKey(credentialsId: 'PROD_SSH_KEY', keyFileVariable: 'SSH_KEY')]) {
|
|
script {
|
|
def svcName = params.APP == 'tenant-platform' ? 'web' : 'ops-web'
|
|
def imageName = "${ACR_REGISTRY}/${ACR_NAMESPACE}/web-${params.APP}:${params.IMAGE_TAG}"
|
|
sh """
|
|
ssh -i \${SSH_KEY} -o StrictHostKeyChecking=no ${PROD_USER}@${PROD_HOST} "
|
|
docker pull ${imageName} &&
|
|
cd /opt/xuqm/deploy &&
|
|
docker compose -f ${COMPOSE_FILE} up -d --no-deps ${svcName} &&
|
|
docker image prune -f
|
|
"
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
success { echo "✅ ${params.APP}:${params.IMAGE_TAG} 构建部署成功" }
|
|
failure { echo "❌ 构建失败,请检查日志" }
|
|
}
|
|
}
|