очистка от неиспользуемых образов
Hedgehog_server_CI/ServerMonitorBot/pipeline/head There was a failure building this commit Details
Hedgehog_server_CD/ServerMonitorBot/pipeline/head There was a failure building this commit Details

pull/31/head
L_DelOff 2023-11-21 13:43:36 +03:00
parent bf070c29a1
commit 35a8d6a8c7
2 changed files with 15 additions and 3 deletions

View File

@ -17,6 +17,11 @@ pipeline {
} }
stages { stages {
stage('Init container') {
steps {
sh 'apt-get update && apt-get install -y sshpass openssh-client'
}
}
stage('Build') { stage('Build') {
steps { steps {
sh 'mvn -B -DskipTests -X clean package spring-boot:repackage' sh 'mvn -B -DskipTests -X clean package spring-boot:repackage'
@ -25,9 +30,6 @@ pipeline {
stage('Deploy') { stage('Deploy') {
steps { steps {
script { script {
sh 'apt-get update && apt-get install -y sshpass openssh-client'
sh """ sh """
sshpass -p ${SSH_PASS} ssh -o StrictHostKeyChecking=no ${SSH_USER}@${SSH_HOST} -p ${SSH_PORT} 'mkdir -p ${PATH_TO_DEV_FOLDER}' sshpass -p ${SSH_PASS} ssh -o StrictHostKeyChecking=no ${SSH_USER}@${SSH_HOST} -p ${SSH_PORT} 'mkdir -p ${PATH_TO_DEV_FOLDER}'
sshpass -p ${SSH_PASS} scp -o StrictHostKeyChecking=no -P ${SSH_PORT} target/*.jar ${SSH_USER}@${SSH_HOST}:${PATH_TO_DEV_FOLDER}/ sshpass -p ${SSH_PASS} scp -o StrictHostKeyChecking=no -P ${SSH_PORT} target/*.jar ${SSH_USER}@${SSH_HOST}:${PATH_TO_DEV_FOLDER}/
@ -39,6 +41,11 @@ pipeline {
} }
} }
} }
stage('Prune images') {
steps {
sshpass -p ${SSH_PASS} ssh -o StrictHostKeyChecking=no ${SSH_USER}@${SSH_HOST} -p ${SSH_PORT} 'docker image prune -f'
}
}
} }
} }

View File

@ -12,4 +12,9 @@ pipeline {
} }
} }
} }
stage('Prune images') {
steps {
sshpass -p ${SSH_PASS} ssh -o StrictHostKeyChecking=no ${SSH_USER}@${SSH_HOST} -p ${SSH_PORT} 'docker image prune -f'
}
}
} }