Jenkins file edit
Some checks failed
test/timeline-frontend/pipeline/head There was a failure building this commit
Some checks failed
test/timeline-frontend/pipeline/head There was a failure building this commit
This commit is contained in:
36
Jenkinsfile
vendored
36
Jenkinsfile
vendored
@@ -159,7 +159,7 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
// 创建或更新docker-compose文件
|
// 创建或更新docker-compose文件
|
||||||
def composeContent = getComposeFileContent()
|
def composeContent = getComposeFileContent('dev')
|
||||||
writeFile file: 'docker-compose.yml', text: composeContent
|
writeFile file: 'docker-compose.yml', text: composeContent
|
||||||
|
|
||||||
// 拉取最新镜像
|
// 拉取最新镜像
|
||||||
@@ -236,23 +236,23 @@ def deployToEnvironmentWithCompose(String env) {
|
|||||||
def nginxConfContent = readFile('nginx.conf')
|
def nginxConfContent = readFile('nginx.conf')
|
||||||
|
|
||||||
// 根据部署环境替换后端服务地址
|
// 根据部署环境替换后端服务地址
|
||||||
switch(env) {
|
// switch(env) {
|
||||||
case 'dev':
|
// case 'dev':
|
||||||
// 开发环境使用特定的后端服务地址
|
// // 开发环境使用特定的后端服务地址
|
||||||
nginxConfContent = nginxConfContent.replaceAll('host.docker.internal:33333', 'dev-backend-service:33333')
|
// nginxConfContent = nginxConfContent.replaceAll('host.docker.internal:33333', 'dev-backend-service:33333')
|
||||||
break
|
// break
|
||||||
case 'staging':
|
// case 'staging':
|
||||||
// 预发布环境使用特定的后端服务地址
|
// // 预发布环境使用特定的后端服务地址
|
||||||
nginxConfContent = nginxConfContent.replaceAll('host.docker.internal:33333', 'staging-backend-service:33333')
|
// nginxConfContent = nginxConfContent.replaceAll('host.docker.internal:33333', 'staging-backend-service:33333')
|
||||||
break
|
// break
|
||||||
case 'prod':
|
// case 'prod':
|
||||||
// 生产环境使用特定的后端服务地址
|
// // 生产环境使用特定的后端服务地址
|
||||||
nginxConfContent = nginxConfContent.replaceAll('host.docker.internal:33333', 'prod-backend-service:33333')
|
// nginxConfContent = nginxConfContent.replaceAll('host.docker.internal:33333', 'prod-backend-service:33333')
|
||||||
break
|
// break
|
||||||
default:
|
// default:
|
||||||
// 默认使用生产环境后端服务
|
// // 默认使用生产环境后端服务
|
||||||
nginxConfContent = nginxConfContent.replaceAll('host.docker.internal:33333', 'prod-backend-service:33333')
|
// nginxConfContent = nginxConfContent.replaceAll('host.docker.internal:33333', 'prod-backend-service:33333')
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 写入环境特定的 nginx 配置
|
// 写入环境特定的 nginx 配置
|
||||||
writeFile file: "nginx-${env}.conf", text: nginxConfContent
|
writeFile file: "nginx-${env}.conf", text: nginxConfContent
|
||||||
|
|||||||
Reference in New Issue
Block a user