modification v9 jenkins

This commit is contained in:
Jazze7 2024-11-06 12:42:06 +05:30
parent a50fff351b
commit c431daa5f4

19
Jenkinsfile vendored
View File

@ -31,18 +31,22 @@ pipeline {
sh '''
ssh ${REMOTE_SERVER} "mkdir -p ${REMOTE_WORKSPACE} && cd ${REMOTE_WORKSPACE} && rm -rf cicid && git clone https://git.tech4biz.wiki/jassim/cicid.git && cd cicid && git checkout main && yarn install"
'''
}
}
}
}
}
}
stage('Build Docker Image') {
stage('Build Docker Image on Remote Server') {
steps {
script {
try {
docker.build("${DOCKER_IMAGE}:${DOCKER_TAG}")
sshagent(credentials: [SSH_CREDENTIALS]) {
sh '''
ssh ${REMOTE_SERVER} "cd ${REMOTE_WORKSPACE}/cicid && docker build -t ${DOCKER_IMAGE}:${DOCKER_TAG} ."
'''
}
} catch (Exception e) {
error "Failed to build Docker image: ${e.message}"
error "Failed to build Docker image on remote server: ${e.message}"
}
}
}
@ -100,10 +104,5 @@ pipeline {
always {
cleanWs()
}
// failure {
// mail to: 'jassim.mohammed@tech4biz.io',
// subject: "Pipeline Failed: ${currentBuild.fullDisplayName}",
// body: "Pipeline failed. Check the Jenkins console for more details."
// }
}
}