运维技术-自动化-jenkins实践01-自动化部署
配置1: 参数化构建过程:
名称:project ,默认值:projectname
配置2: 源码管理:
从svn或git获取项目包
配置3:构建-执行shell:
一般升级会有升级文档、发布的生产包,可以通过脚本直接读取升级说明

1 #!/usr/bin/env python3 2 #coding=utf-8 3 import sys 4 from docx import Document 5 6 path = sys.argv[1] #文件路径 7 8 doc = Document(path) #打开目标文档 9 tables = doc.tables #获取文档中的表格 10 11 for table in tables: 12 row_count = len(table.rows) #获取表中的列数 13 col_count = len(table.columns) #获取表中的行数 14 List = [] # 存储不重复的数据列表 15 prior_tc = None #原有的内存地址 16 17 for i in range(row_count): 18 for j in range(col_count): 19 prior_tc=table.cell(i,j)._tc 20 if table.cell(i-1,j)._tc is prior_tc or table.cell(i,j-1)._tc is prior_tc: 21 continue 22 print( table.cell(i,j).text)
python3 readDocx.py 升级文档/*.docx
配置3:构建-传送升级包到生产服务器,并部署:
Send files or execute commands overssh
Name: 在jenkins系统配置好的服务器
Source file: 升级包/$project.war #引用参数变量$projcect ,即实际项目:projectname
Remove prefix:升级包/ #相当于忽略“升级包/”这层目录,直接传送$project.war到生产服务器。