From b16d36dfeba3957a687b3a2b95a3487feac1ef02 Mon Sep 17 00:00:00 2001 From: zhongyuanzhao000 Date: Sun, 22 Dec 2019 13:14:12 +0800 Subject: [PATCH] update jenkins-ci --- jenkins-ci/Jenkinsfile | 8 ++++++-- jenkins-ci/clean.sh | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/jenkins-ci/Jenkinsfile b/jenkins-ci/Jenkinsfile index 03531c9df..d6c1a7051 100644 --- a/jenkins-ci/Jenkinsfile +++ b/jenkins-ci/Jenkinsfile @@ -4,8 +4,9 @@ pipeline { jdk 'jdk8' maven 'maven-3.6.1' } - // At this stage, the jar artifacts are first built using maven, and then the docker images are built. stages { + + // At this stage, the jar artifacts are first built using maven, and then the docker images are built. stage('Build') { steps { echo "Build..." @@ -16,6 +17,7 @@ pipeline { echo "Building images Successful!" } } + // TODO: This stage will perform unit tests, etc. stage('Test') { steps { @@ -26,6 +28,7 @@ pipeline { sh 'mvn clean' } } + // This stage will push the images built to the docker hub. // After this stage is successful, you can directly pull the image from the docker hub to build the TrainTicket cluster application. // Note: The tag of the image you build at this time is latest. Please modify it when deploying the application. @@ -41,5 +44,6 @@ pipeline { sh 'sudo /bin/bash ./jenkins-ci/clean.sh' } } + } -} +} \ No newline at end of file diff --git a/jenkins-ci/clean.sh b/jenkins-ci/clean.sh index 11c351515..55d1a64b8 100644 --- a/jenkins-ci/clean.sh +++ b/jenkins-ci/clean.sh @@ -80,4 +80,7 @@ sudo docker rmi ts/ts-admin-travel-service:latest sudo docker rmi ts/ts-admin-user-service:latest sudo docker rmi ts/ts-news-service:latest sudo docker rmi ts/ts-ticket-office-service:latest -sudo docker rmi ts/ts-voucher-service:latest \ No newline at end of file +sudo docker rmi ts/ts-voucher-service:latest + +sudo docker rmi $(docker image ls -qf dangling=true) +sudo docker image prune -f \ No newline at end of file