使用Jenkins时,如果GIT_COMMIT无变化,跳过构建
生活随笔
收集整理的這篇文章主要介紹了
使用Jenkins时,如果GIT_COMMIT无变化,跳过构建
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
為什么80%的碼農(nóng)都做不了架構(gòu)師?>>> ??
使用Jenkins時,如果GIT_COMMIT無變化,跳過構(gòu)建使用插件: conditional-buildstep A buildstep wrapping any number of other buildsteps, controlling their execution based on a defined condition (e.g. BuildParameter). wiki: https://wiki.jenkins-ci.org/display/JENKINS/Conditional+BuildStep+Plugin
如下圖所示,如果環(huán)境變量GIT_PREVIOUS_SUCCESSFUL_COMMIT不存在,或者GIT_COMMIT和GIT_PREVIOUS_SUCCESSFUL_COMMIT不同,才會執(zhí)行構(gòu)建
上圖中腳本如下: #!/bin/bash if [ ! $GIT_PREVIOUS_SUCCESSFUL_COMMIT ];thenecho "GIT_PREVIOUS_SUCCESSFUL_COMMIT is not exists."exit 0 elseecho "GIT_COMMIT=[$GIT_COMMIT],GIT_PREVIOUS_SUCCESSFUL_COMMIT=[$GIT_PREVIOUS_SUCCESSFUL_COMMIT]"if [ $GIT_PREVIOUS_SUCCESSFUL_COMMIT == $GIT_COMMIT ];thenecho "GIT_COMMIT is equals to GIT_PREVIOUS_SUCCESSFUL_COMMIT,skip build."exit -1elseecho "GIT_COMMIT is not equals to GIT_PREVIOUS_SUCCESSFUL_COMMIT"exit 0fi fi
轉(zhuǎn)載于:https://my.oschina.net/donhui/blog/613711
總結(jié)
以上是生活随笔為你收集整理的使用Jenkins时,如果GIT_COMMIT无变化,跳过构建的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 蚂蚁金服ATEC城市峰会上海举行,三大发
- 下一篇: 消息中间件RocketMQ源码解析--