Files
client-web/Jenkinsfile
T

39 lines
1.3 KiB
Groovy
Raw Normal View History

2026-07-30 21:52:18 +08:00
pipeline {
2026-09-29 18:47:46 +08:00
agent { label 'java-test' }
2026-07-30 21:52:18 +08:00
options {
timestamps()
disableConcurrentBuilds()
}
stages {
2026-09-29 18:47:46 +08:00
stage('检查测试发布参数') {
2026-07-30 21:52:18 +08:00
steps {
2026-08-14 17:45:43 +08:00
script {
2026-09-29 18:47:46 +08:00
if (env.JOB_BASE_NAME?.endsWith('-dev') || env.JOB_BASE_NAME?.endsWith('-prod')) {
error('当前仅支持 test,请使用测试环境 Job')
2026-09-17 11:49:01 +08:00
}
2026-09-29 18:47:46 +08:00
env.IMAGE_TAG = sh(script: 'git rev-parse --short=12 HEAD', returnStdout: true).trim()
2026-08-14 17:45:43 +08:00
}
2026-09-29 18:47:46 +08:00
sh '''set -eu
export API_UPSTREAM="${API_UPSTREAM:-http://gateway:9000}"
export TEST_NETWORK="${TEST_NETWORK:-firstleg-test-network}"
: "${VITE_ADMIN_WEB_ORIGIN:?VITE_ADMIN_WEB_ORIGIN 未设置}"
docker network inspect "$TEST_NETWORK" >/dev/null
docker compose -f docker-compose.test.yml config --quiet
'''
2026-07-30 21:52:18 +08:00
}
}
stage('构建并部署测试前端') {
steps {
2026-09-29 18:47:46 +08:00
sh '''set -eu
docker compose -f docker-compose.test.yml build --pull=false
docker compose -f docker-compose.test.yml up -d --wait --wait-timeout 120
2026-07-30 21:52:18 +08:00
docker compose -f docker-compose.test.yml exec -T client-web wget -qO- http://127.0.0.1/healthz
'''
}
}
}
post {
2026-09-29 18:47:46 +08:00
failure { sh 'docker compose -f docker-compose.test.yml logs --tail=100 || true' }
2026-07-30 21:52:18 +08:00
}
}