From 11a07da143d8a86c49ef3d3745c9a6753ca3d1b5 Mon Sep 17 00:00:00 2001 From: ModerRAS Date: Sun, 2 Apr 2023 12:20:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=8A=A8=E9=83=A8?= =?UTF-8?q?=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8db990b..cd73c74 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -22,15 +22,20 @@ pipeline { sh 'docker push registry.miaostay.com/kotadoc' } } - stage('Delete Local Images') { - when { + stage('Deploy to Production Server') { + when { anyOf { branch 'master' } - } - steps { - sh 'docker images|grep none|awk \'{print $3 }\'|xargs docker rmi' - } + } + environment { + SERVER_CREDENTIALS = credentials('868e1509-ec55-4a4e-9296-042ca7e8b0eb') + SERVER_IP = credentials('3e762d69-418d-4283-95ac-913f19d7fe4e') + SERVER_PORT = credentials('736149c1-675d-470d-abce-3fb9e8e146c0') + } + steps { + sh 'sshpass -p $SERVER_CREDENTIALS_PSW ssh -p $SERVER_PORT $SERVER_CREDENTIALS_USR@$SERVER_IP "cd /data/kotadoc && kubectl delete pods kotadoc && kubectl apply -f kotadoc.yaml"' + } } } }