From 47066db305a905fd74508c08834689e26440251c Mon Sep 17 00:00:00 2001 From: txb Date: Wed, 11 May 2022 16:37:57 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20ip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改ip 修改111ip --- Jenkinsfile | 62 ++++++++++++++++++++++----------------------- k8s_kitchenweb.yaml | 4 +-- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0f67acf..b1f57e7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,7 @@ def getHost(){ } pipeline{ - agent any + agent any parameters { choice( description: 'EIP环境', @@ -21,19 +21,19 @@ pipeline{ choice( description: '执行操作(发布|回滚)', - name: 'operation', + name: 'operation', choices: ['develop', 'rollback'] ) choice( description: '是否下载包', - name: 'isDownloadPackage', + name: 'isDownloadPackage', choices: ['是','否'] ) string( - name: 'tag', - defaultValue: '', + name: 'tag', + defaultValue: '', description: '版本tag' ) @@ -43,7 +43,7 @@ pipeline{ { stage('Prepare') { - steps { + steps { script{ echo "1.Prepare Stage" echo "当前环境${params.environment}" @@ -64,67 +64,67 @@ pipeline{ } } stage('Test') { - steps { + steps { script{ echo "2.Test Stage" } } - + } stage('Build') { - steps { + steps { script{ echo "3.Build Docker Image Stage" if(params.operation=='develop') { nodejs("nodejs") { - + } if(params.isDownloadPackage=='是') { - sh "npm install --unsafe-perm=true --allow-root" + sh "npm install --unsafe-perm=true --allow-root" } sh "rm -rf ./dist/*" - sh "npm run build" - sh "docker build -t 111.9.47.105:10249/bpa/kitchenweb:${build_tag} ." - } + sh "npm run build" + sh "docker build -t 10.2.1.24:10242/bpa/kitchenweb:${build_tag} ." + } } } } - - - - + + + + stage('Push') { - steps { + steps { script{ echo "4.Push Docker Image Stage" withCredentials([usernamePassword(credentialsId: 'harbor', passwordVariable: 'harborPassword', usernameVariable: 'harborUser')]) { - sh "docker login -u ${harborUser} -p ${harborPassword} 111.9.47.105:10249" + sh "docker login -u ${harborUser} -p ${harborPassword} 10.2.1.24:10242" if(params.operation=='develop') - { - sh "docker push 111.9.47.105:10249/bpa/kitchenweb:${build_tag}" + { + sh "docker push 10.2.1.24:10242/bpa/kitchenweb:${build_tag}" } } } } - - - + + + } - + stage('Deploy') { - steps { + steps { script{ echo "5. Deploy Stage" // server = getHost() - // sshCommand remote: server, command: """ + // sshCommand remote: server, command: """ // /root/eip/web/shell/linux-eipweb.install.sh eipweb ${build_tag} 80 // """ @@ -135,9 +135,9 @@ pipeline{ } - + } } } - -} \ No newline at end of file + +} diff --git a/k8s_kitchenweb.yaml b/k8s_kitchenweb.yaml index ce69613..0991553 100644 --- a/k8s_kitchenweb.yaml +++ b/k8s_kitchenweb.yaml @@ -4,7 +4,7 @@ metadata: name: kitchenweb namespace: kube- spec: - + selector: matchLabels: app: kitchenweb @@ -15,7 +15,7 @@ spec: app: kitchenweb spec: containers: - - image: 111.9.47.105:10249/bpa/kitchenweb: + - image: 10.2.1.24:10242/bpa/kitchenweb: imagePullPolicy: IfNotPresent name: kitchenweb env: