2026-07-30 20:36:34 +08:00
|
|
|
pipeline {
|
|
|
|
|
agent any
|
|
|
|
|
|
2026-07-30 21:18:39 +08:00
|
|
|
options {
|
|
|
|
|
timestamps()
|
|
|
|
|
disableConcurrentBuilds()
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-30 20:36:34 +08:00
|
|
|
stages {
|
2026-07-30 21:18:39 +08:00
|
|
|
stage('确认提交版本') {
|
2026-07-30 20:36:34 +08:00
|
|
|
steps {
|
|
|
|
|
sh 'echo "Jenkins 已拉取 release/test 分支代码"'
|
|
|
|
|
sh 'git log -1 --oneline'
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-07-30 21:18:39 +08:00
|
|
|
|
|
|
|
|
stage('构建并部署测试前端') {
|
|
|
|
|
steps {
|
|
|
|
|
sh '''
|
|
|
|
|
set -eu
|
|
|
|
|
docker compose -f docker-compose.test.yml build --pull=false
|
|
|
|
|
docker compose -f docker-compose.test.yml up -d --remove-orphans
|
|
|
|
|
'''
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stage('部署检查') {
|
|
|
|
|
steps {
|
|
|
|
|
sh '''
|
|
|
|
|
set -eu
|
|
|
|
|
docker compose -f docker-compose.test.yml ps
|
|
|
|
|
docker compose -f docker-compose.test.yml exec -T admin-web wget -qO- http://127.0.0.1/healthz
|
|
|
|
|
'''
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-07-30 20:36:34 +08:00
|
|
|
}
|
2026-07-30 21:18:39 +08:00
|
|
|
|
|
|
|
|
post {
|
|
|
|
|
failure {
|
|
|
|
|
sh 'docker compose -f docker-compose.test.yml logs --tail=100 || true'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|