Jenkins

Jenkins的回滚

2018-09-07  本文已影响879人  Anson前行
case $Status  in
  Deploy)
    echo "Status:$Status"
    path="${WORKSPACE}/bak"
    if [ -d $path ];
    then
        echo "The files is already  exists "
    else
        mkdir -p  $path
    fi
    cd ${WORKSPACE}
    tar czf bak/${JOB_NAME}-${BUILD_NUMBER}.tar.gz * --exclude=bak
    find $path  -mtime 2 -name "*.tar.gz"  -exec rm -rf {} \;
    echo "Completin!"
    ;;
  Rollback)
      echo "Status:$Status"
      echo "Version:$Version"
      cd ${WORKSPACE}/bak
      cp -R `ls /root/.jenkins/workspace/warbak/bak  |  grep $Version`   ${JOB_NAME}-${BUILD_NUMBER}.tar.gz   ##复制为最新版本构建号
      ;;
  *)
  exit
      ;;
esac
image.png
上一篇 下一篇

猜你喜欢

热点阅读