jenkins跳过构建
回滚时,不需要进行构建。直接使用备份文件进行覆盖即可!
因此,需要在回滚时,跳过构建,直接使用备份文件
安装插件
安装插件:Conditional BuildStep
插件说明:A buildstep wrapping any number of other buildsteps, controlling their execution based on a defined condition (e.g. BuildParameter).
新建job
参数化构建
增加构建步骤
Conditional Step (single)
择执行shell脚本
脚本内容如下
#!/bin/bash
if [ -z $BUILD_ID ];then
echo "No BUILD_ID, no build required"
exit 0
else
echo "Need to build"
exit -1
fi
#!/bin/bash
if [ -z $BUILD_ID ];then
echo "No BUILD_ID, no build required"
exit 0
else
echo "Need to build"
exit -1
fi
脚本解释:当BUILD_ID变量不存在时,不执行构建,退出码为0。否则执行构建,退出码为-1
再增加构步骤,选择执行shell脚本