-
Notifications
You must be signed in to change notification settings - Fork 153
/
release.py
75 lines (63 loc) · 2.47 KB
/
release.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#coding:utf-8
# 脚本是为了加快我发布的速度而生
# 之前发布太费劲了
import os
from shutil import copyfile
import sys
class ReleaseJobs:
def __init__(self, argv):
self.baseHome = os.getcwd()
self.version = argv[1]
self.jarPath = [
{'path':'../../test/source/w3a-soc-center/w3a-dashboard-service/target/', 'name':'w3a-dashboard-service', 'dist':'./backend/dashboard/', 'report':'registry.cn-beijing.aliyuncs.com/aidolphins_com/w3a-dashboard:'},
{'path':'../../test/source/w3a-soc-center/w3a-openapi-service/target/', 'name':'w3a-openapi-service', 'dist':'./backend/openapi/', 'report':'registry.cn-beijing.aliyuncs.com/aidolphins_com/w3a-openapi:'},
{'path':'../../test/source/w3a-soc-center/w3a-workerapi-service/target/', 'name':'w3a-workerapi-service', 'dist':'./backend/workapi/', 'report':'registry.cn-beijing.aliyuncs.com/aidolphins_com/w3a-workapi:'},
]
self.dockerHub = []
def copyJar(self):
'''
构建后盾
'''
for jarPathItems in self.jarPath:
copyfile(jarPathItems['path']+jarPathItems['name']+"-0.0.1-SNAPSHOT.jar", jarPathItems['dist']+'release.jar')
# 切换目录进行构建
os.chdir(jarPathItems['dist'])
os.system("./run.sh "+self.version)
os.system("rm -rf release.jar")
self.dockerHub.append(jarPathItems['report']+self.version)
# 回到原来目录
os.chdir(self.baseHome)
def copyGolang(self):
'''
构建工具端
'''
os.chdir("../../test/source/w3a-soc-agent")
os.system("./run.sh "+self.version)
os.chdir(self.baseHome)
self.dockerHub.append("registry.cn-beijing.aliyuncs.com/aidolphins_com/w3a-agent:"+self.version)
def copyFrontend(self):
'''
构建前端
'''
os.chdir("../../test/source/w3a-soc-frontend/")
os.system("npm run build:prod")
os.system("tar zcvf w3a-soc-frontend.tar.gz dist/")
os.system("rm -rf dist/")
os.chdir(self.baseHome)
copyfile("../../test/source/w3a-soc-frontend/w3a-soc-frontend.tar.gz", "./frontend/release.tar.gz")
os.system("rm -rf ../../test/source/w3a-soc-frontend/w3a-soc-frontend.tar.gz")
os.chdir("./frontend/")
os.system("tar xvf release.tar.gz")
os.system("./run.sh "+self.version)
os.system("rm -rf dist/")
os.system("rm -rf release.tar.gz")
os.chdir(self.baseHome)
self.dockerHub.append("registry.cn-beijing.aliyuncs.com/aidolphins_com/w3a-frontend:"+self.version)
if __name__ == '__main__':
t = ReleaseJobs(sys.argv)
t.copyJar()
t.copyGolang()
t.copyFrontend()
print("[*]构建完成:")
for item in t.dockerHub:
print item