修改配置文件

This commit is contained in:
王文艳
2026-05-19 18:43:08 +08:00
parent 68c445b002
commit 81503d0c62
Vendored
+21 -21
View File
@@ -11,7 +11,7 @@ pipeline {
stages { stages {
stage("Git Checkout") { stage("Git Checkout") {
steps { steps {
git changelog: false, credentialsId: 'gitlabsecret', poll: false, url: 'http://gitlab.fangjia.com/dev0/main.git' git changelog: false, credentialsId: 'Gitea_Admin_Token', poll: false, url: 'https://gitea.fangjia.com/dev0/main.git'
} }
} }
stage('Maven Build') { stage('Maven Build') {
@@ -50,26 +50,26 @@ pipeline {
} }
} }
} }
stage('K8S Deploy') { // stage('K8S Deploy') {
steps { // steps {
script { // script {
def projects = ['fangjiabkoff', 'chafangtong', 'fangjia', 'fangjiapds', 'fangjiastatic', 'geluke', 'fangjiaopen'] // def projects = ['fangjiabkoff', 'chafangtong', 'fangjia', 'fangjiapds', 'fangjiastatic', 'geluke', 'fangjiaopen']
def k8s_config_map = ['fangjiabkoff': 'fangjia-bkoff', 'chafangtong': 'chafangtong', 'fangjia': 'fangjia-coresite', 'fangjiapds': 'fangjia-pds', 'fangjiastatic': 'fangjia-static', 'geluke':"geluke", 'fangjiaopen': 'fangjia-open'] // def k8s_config_map = ['fangjiabkoff': 'fangjia-bkoff', 'chafangtong': 'chafangtong', 'fangjia': 'fangjia-coresite', 'fangjiapds': 'fangjia-pds', 'fangjiastatic': 'fangjia-static', 'geluke':"geluke", 'fangjiaopen': 'fangjia-open']
for (def project : projects) { // for (def project : projects) {
if (params.PROJECT_NAME == project) { // if (params.PROJECT_NAME == project) {
dir("deliverables/k8s") { // dir("deliverables/k8s") {
withKubeConfig([credentialsId: 'K8SSecret', serverUrl: 'https://k8s.fangjia.com:6443']) { // withKubeConfig([credentialsId: 'K8SSecret', serverUrl: 'https://k8s.fangjia.com:6443']) {
def orgVersion = "${k8s_config_map[project]}:latest" // def orgVersion = "${k8s_config_map[project]}:latest"
def nowVersion = "${k8s_config_map[project]}:${env.BUILD_TAG.toLowerCase()}" // def nowVersion = "${k8s_config_map[project]}:${env.BUILD_TAG.toLowerCase()}"
sh "sed -i 's/${orgVersion}/${nowVersion}/g' ${k8s_config_map[project]}.yaml" // sh "sed -i 's/${orgVersion}/${nowVersion}/g' ${k8s_config_map[project]}.yaml"
sh "kubectl apply -f ${k8s_config_map[project]}.yaml" // sh "kubectl apply -f ${k8s_config_map[project]}.yaml"
} // }
} // }
} // }
} // }
} // }
} // }
} // }
} }
} }