Jenkins使用五:创建部署任务

创建部署任务

选择运行节点

选择使用shell

# 如果是持续进程,这里最好加一个kill进程的命令

判断如果/root/production目录存在,就删除
if [ -d /root/production ];then
    rm -rf /root/production
fi

创建/root/production目录
mkdir -p /root/production

进入到/root/production目录
cd /root/production

克隆git项目,克隆后默认存在git项目名的文件夹下
git clone root@192.168.223.128:/root/test.git

进入项目
cd test

执行python代码
python3 hello.py

执行构建

原文地址:https://www.cnblogs.com/zhongyehai/p/11349211.html