git 无变化跳过构建

最后更新于:2022-04-02 02:58:46

[TOC] ## 使用 在shell 脚本执行处写 ``` #!/bin/bash if [ ! $GIT_PREVIOUS_SUCCESSFUL_COMMIT ];then echo "GIT_PREVIOUS_SUCCESSFUL_COMMIT is not exists." exit 0 else echo "GIT_COMMIT=[$GIT_COMMIT],GIT_PREVIOUS_SUCCESSFUL_COMMIT=[$GIT_PREVIOUS_SUCCESSFUL_COMMIT]" if [ $GIT_PREVIOUS_SUCCESSFUL_COMMIT == $GIT_COMMIT ];then echo "GIT_COMMIT is equals to GIT_PREVIOUS_SUCCESSFUL_COMMIT,skip build." # 编译好后的操作 code ... exit -1 else echo "GIT_COMMIT is not equals to GIT_PREVIOUS_SUCCESSFUL_COMMIT" # 进行编译操作 code ... exit 0 fi fi ```
';