From 00bf346c24db7e50942e69579eaf0bb36a0ed651 Mon Sep 17 00:00:00 2001 From: Marvin Zhang Date: Fri, 16 Aug 2019 00:43:30 +0800 Subject: [PATCH] updated Jenkinsfile --- Jenkinsfile | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1b448465..3eb0ab5b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -45,19 +45,17 @@ pipeline { stage('Deploy') { steps { echo 'Deploying....' - script { - if (env.GIT_BRANCH == 'master' || env.GIT_BRANCH == 'develop') { - sh """ - cd ./jenkins/${ENV:GIT_BRANCH} - docker-compose stop | true - docker-compose up -d - """ - } else { - sh """ - docker push tikazyq/crawlab:${ENV:TAG} - """ - } - } + sh """ + if [ ${ENV:GIT_BRANCH} -eq master ] || [ ${ENV:GIT_BRANCH} -eq develop ]; then + # 重启docker compose + cd ./jenkins/${ENV:GIT_BRANCH} + docker-compose stop | true + docker-compose up -d + else + # 发布到Dockerhub + docker push tikazyq/crawlab:${ENV:TAG} + fi + """ } } stage('Cleanup') {