Commit 1a2cbdfe authored by 赵凯's avatar 赵凯 💬

识别 job项目部署

parent 340b63da
......@@ -9,6 +9,8 @@ from apis.tasks_api import tasks
from apis.task_patch_api import tasksPatch,taskMultiZone
from apis.task_status_api import taskstatus
def match(path, target):
return path.endswith(target)
# 获取项目id
def checkProjId():
......@@ -23,12 +25,14 @@ def checkProjId():
return proj_id
raise Exception("无法识别的项目")
def checkProjIdGetResult():
# 识别项目
def checkProjIdGetResult(job):
# 获取当前执行目录
cwd = os.getcwd()
cwdJob = cwd + job
rst_results = getProjects()
for result in rst_results:
if cwd.find(result['name']) != -1 :
if match(cwdJob, result['name']):
proj_name = result['name']
proj_id = result['id']
print(f'识别出项目: {proj_name}, 项目ID为: {proj_id}')
......@@ -67,8 +71,20 @@ if len(argv) == 2:
else:
info = argv[2]
# 是否job服务部署
job = ''
if len(argv) == 4:
isJob = argv[3]
if isJob == '-job':
job = '-job'
elif isJob == '-job2':
job = '-job2'
else:
sys.exit("job参数错误")
# 识别项目
projectResult = checkProjIdGetResult()
projectResult = checkProjIdGetResult(job)
# 项目ID
projectid = projectResult['id']
# 项目环境部署信息
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment