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"' + } } } }