Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
opms-command
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
赵凯
opms-command
Commits
1a2cbdfe
Commit
1a2cbdfe
authored
Mar 21, 2024
by
赵凯
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
识别 job项目部署
parent
340b63da
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
opms.py
opms.py
+20
-4
No files found.
opms.py
View file @
1a2cbdfe
...
...
@@ -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'
]
# 项目环境部署信息
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment