modification v16 jenkins

This commit is contained in:
Jazze7 2024-11-06 14:46:22 +05:30
parent 0f59d10af1
commit 169046cf2e

20
Jenkinsfile vendored
View File

@ -69,39 +69,35 @@ pipeline {
} }
} }
stage('Deploy') { stage('Deploy') {
steps { steps {
script { script {
sshagent(credentials: [SSH_CREDENTIALS]) { sshagent(credentials: [SSH_CREDENTIALS]) {
sh ''' sh '''
ssh ${REMOTE_SERVER} << EOF ssh ${REMOTE_SERVER} "cd ${REMOTE_WORKSPACE}/cicid && \
cd ${REMOTE_WORKSPACE}/cicid docker pull ${DOCKER_IMAGE}:${DOCKER_TAG} && \
docker pull ${DOCKER_IMAGE}:${DOCKER_TAG} docker stop documentation-container || true && \
docker stop documentation-container || true docker rm documentation-container || true && \
docker rm documentation-container || true docker run -d -p 3000:3000 --name documentation-container ${DOCKER_IMAGE}:${DOCKER_TAG}"
docker run -d -p 3000:3000 --name documentation-container ${DOCKER_IMAGE}:${DOCKER_TAG}
EOF
''' '''
} }
} }
} }
} }
stage('Update Nginx Configuration') { stage('Update Nginx Configuration') {
steps { steps {
script { script {
sshagent(credentials: [SSH_CREDENTIALS]) { sshagent(credentials: [SSH_CREDENTIALS]) {
sh ''' sh '''
ssh ${REMOTE_SERVER} << EOF ssh ${REMOTE_SERVER} "sudo nginx -t && sudo systemctl reload nginx"
sudo nginx -t
sudo systemctl reload nginx
EOF
''' '''
} }
} }
} }
} }
} }
post { post {