持续集成之Jenkins结合脚本实现代码自动化部署及(4)

[root@slave01 ~]# ll /opt/webroot/
total 20672
drwxr-xr-x 5 www www 4096 Jun 26 11:36 web-demo_123_2017-06-26-11-36-44
-rw-rw-r-- 1 www www 1243347 Jun 28 22:03 web-demo_123_2017-06-26-11-36-44.tar.gz
drwxr-xr-x 5 www www 4096 Jun 26 11:39 web-demo_123_2017-06-26-11-39-02
-rw-rw-r-- 1 www www 1243347 Jun 28 22:06 web-demo_123_2017-06-26-11-39-02.tar.gz
drwxr-xr-x 5 www www 4096 Jun 26 12:04 web-demo_123_2017-06-26-12-04-19
-rw-rw-r-- 1 www www 1243351 Jun 28 22:31 web-demo_123_2017-06-26-12-04-19.tar.gz
drwxr-xr-x 5 www www 4096 Jun 26 12:16 web-demo_123_2017-06-26-12-16-49
-rw-rw-r-- 1 www www 1243347 Jun 28 22:43 web-demo_123_2017-06-26-12-16-49.tar.gz
drwxr-xr-x 5 www www 4096 Jun 26 12:18 web-demo_123_2017-06-26-12-18-09
-rw-rw-r-- 1 www www 1243347 Jun 28 22:45 web-demo_123_2017-06-26-12-18-09.tar.gz
drwxr-xr-x 5 www www 4096 Jun 26 12:18 web-demo_123_2017-06-26-12-18-57
-rw-rw-r-- 1 www www 1243369 Jun 28 22:46 web-demo_123_2017-06-26-12-18-57.tar.gz
-rw-rw-r-- 1 www www 45 Jun 29 06:21 web-demo__2017-06-30-14-28-54.tar.gz
drwxrwxr-x 2 www www 4096 Jun 30 14:30 web-demo__2017-06-30-14-30-22
-rw-rw-r-- 1 www www 130 Jun 29 06:23 web-demo__2017-06-30-14-30-22.tar.gz
drwxrwxr-x 2 www www 4096 Jun 30 14:31 web-demo__2017-06-30-14-31-53
-rw-rw-r-- 1 www www 219 Jun 29 06:24 web-demo__2017-06-30-14-31-53.tar.gz
drwxrwxr-x 4 www www 4096 Jun 30 14:59 web-demo_75463f1b_2017-06-30-14-59-58
-rw-rw-r-- 1 www www 1236456 Jun 29 06:52 web-demo_75463f1b_2017-06-30-14-59-58.tar.gz
drwxrwxr-x 4 www www 4096 Jun 30 15:05 web-demo_75463f1b_2017-06-30-15-05-57
-rw-rw-r-- 1 www www 1236450 Jun 29 06:58 web-demo_75463f1b_2017-06-30-15-05-57.tar.gz
drwxrwxr-x 4 www www 4096 Jul 10 14:01 web-demo_75463f1b_2017-07-10-14-01-34
-rw-rw-r-- 1 www www 1236446 Jul 10 14:01 web-demo_75463f1b_2017-07-10-14-01-34.tar.gz
drwxrwxr-x 4 www www 4096 Jun 30 15:18 web-demo_78869143_2017-06-30-15-18-29
-rw-rw-r-- 1 www www 1236465 Jun 29 07:11 web-demo_78869143_2017-06-30-15-18-29.tar.gz
drwxrwxr-x 4 www www 4096 Jul 10 14:00 web-demo_78869143_2017-07-10-14-00-35
-rw-rw-r-- 1 www www 1236453 Jul 10 14:00 web-demo_78869143_2017-07-10-14-00-35.tar.gz
drwxrwxr-x 3 www www 4096 Jun 30 14:14 web-demo_91d09cc2_2017-06-30-14-14-42
-rw-rw-r-- 1 www www 1236371 Jun 29 06:06 web-demo_91d09cc2_2017-06-30-14-14-42.tar.gz
drwxrwxr-x 3 www www 4096 Jun 30 14:15 web-demo_91d09cc2_2017-06-30-14-15-16
-rw-rw-r-- 1 www www 1236382 Jun 29 06:08 web-demo_91d09cc2_2017-06-30-14-15-16.tar.gz
drwxrwxr-x 4 www www 4096 Jul 10 14:08 web-demo_9a43cf55_2017-07-10-14-08-46
-rw-rw-r-- 1 www www 1233708 Jul 10 14:08 web-demo_9a43cf55_2017-07-10-14-08-46.tar.gz
drwxrwxr-x 4 www www 4096 Jun 30 15:21 web-demo_b8f3be43_2017-06-30-15-21-55
-rw-rw-r-- 1 www www 1236454 Jun 29 07:14 web-demo_b8f3be43_2017-06-30-15-21-55.tar.gz
drwxrwxr-x 4 www www 4096 Jul 10 12:34 web-demo_b8f3be43_2017-07-10-12-34-00
-rw-rw-r-- 1 www www 1236462 Jul 10 12:34 web-demo_b8f3be43_2017-07-10-12-34-00.tar.gz
drwxrwxr-x 4 www www 4096 Jun 30 14:57 web-demo_dcfb44f0_2017-06-30-14-57-10
-rw-rw-r-- 1 www www 1236447 Jun 29 06:50 web-demo_dcfb44f0_2017-06-30-14-57-10.tar.gz

1.4.2:回滚任意版本就将版本的参数传递给脚本,脚本会将web-demo的链接重新指向传递的版本(参数),比如我要回滚到web-demo_78869143_2017-06-30-15-18-29这个版本,则jenkins的配置为:

持续集成之Jenkins结合脚本实现代码自动化部署及

1.4.3:在jenkins执行回滚:
1.4.4:执行回滚的信息:

持续集成之Jenkins结合脚本实现代码自动化部署及

1.4.5:访问web界面测试任意版本回滚是否成功:

持续集成之Jenkins结合脚本实现代码自动化部署及

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/e78aaa5ef7a343e1e6f63bdaa2b471e6.html