构建 Execute shell
 Command
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  
DEPLOYURL=${JENKINS_HOME}/jenkins.log
if [ ! -f $DEPLOYURL ]; then
touch $DEPLOYURL
fi
export DEPLOYFILE=$DEPLOYURL
DT=`date +"%Y%m%d_%H:%M:%S"`
 
case $deploy_env in
     deploy)
     zip -q -r ${JENKINS_HOME}/${JOB_NAME%%/*}-${BUILD_NUMBER}.zip $WORKSPACE/
     echo -e "$DT - verions: ${BUILD_NUMBER} | action: $deploy_env | project: ${JOB_NAME%%/*} | url: $WORKSPACE\n" >> $DEPLOYFILE
     ;;
     rollback)
     unzip -o ${JENKINS_HOME}/${JOB_NAME%%/*}-$versions.zip -d /
     zip -q -r ${JENKINS_HOME}/${JOB_NAME%%/*}-${BUILD_NUMBER}.zip $WORKSPACE/
     echo -e "$DT - verions: ${BUILD_NUMBER} | action: $deploy_env | project: ${JOB_NAME%%/*} | url: $WORKSPACE\n" >> $DEPLOYFILE
     ;;
     *)
     exit
     ;;
esac
 
  





---------------------------------------------------------------------------------------------
不忘初心 方得始终!

唯有志存高远,方能风行天下。

道之所存,虽千万人吾往矣! 情之所钟,虽千万里吾念矣~

原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。