modification v9 jenkins
This commit is contained in:
parent
a50fff351b
commit
c431daa5f4
19
Jenkinsfile
vendored
19
Jenkinsfile
vendored
@ -31,18 +31,22 @@ pipeline {
|
|||||||
sh '''
|
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"
|
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 {
|
steps {
|
||||||
script {
|
script {
|
||||||
try {
|
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) {
|
} 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 {
|
always {
|
||||||
cleanWs()
|
cleanWs()
|
||||||
}
|
}
|
||||||
// failure {
|
|
||||||
// mail to: 'jassim.mohammed@tech4biz.io',
|
|
||||||
// subject: "Pipeline Failed: ${currentBuild.fullDisplayName}",
|
|
||||||
// body: "Pipeline failed. Check the Jenkins console for more details."
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user