modification v10 jenkins
This commit is contained in:
parent
c431daa5f4
commit
358e14f930
14
Jenkinsfile
vendored
14
Jenkinsfile
vendored
@ -52,15 +52,21 @@ pipeline {
|
||||
}
|
||||
}
|
||||
|
||||
stage('Push Docker Image') {
|
||||
stage('Push Docker Image from Remote Server') {
|
||||
steps {
|
||||
script {
|
||||
try {
|
||||
docker.withRegistry('https://index.docker.io/v1/', REGISTRY_CREDENTIALS) {
|
||||
docker.image("${DOCKER_IMAGE}:${DOCKER_TAG}").push()
|
||||
sshagent(credentials: [SSH_CREDENTIALS]) {
|
||||
// Use docker.withRegistry to login with the credentials
|
||||
docker.withRegistry('https://index.docker.io/v1/', REGISTRY_CREDENTIALS) {
|
||||
sh '''
|
||||
ssh ${REMOTE_SERVER} "docker push ${DOCKER_IMAGE}:${DOCKER_TAG}"
|
||||
"
|
||||
'''
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
error "Failed to push Docker image: ${e.message}"
|
||||
error "Failed to push Docker image from remote server: ${e.message}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user