Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Charts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
魏国强
Charts
Commits
fca725af
Commit
fca725af
authored
Jan 29, 2021
by
Waqar Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit after udpating dependencies
parent
bde7b16e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
4 deletions
+26
-4
update_dependencies
update_dependencies
+26
-4
No files found.
update_dependencies
View file @
fca725af
#!/usr/bin/env python
#!/usr/bin/env python
3
import
argparse
import
argparse
import
errno
import
errno
import
os
import
os
...
@@ -54,7 +54,7 @@ def report_result():
...
@@ -54,7 +54,7 @@ def report_result():
)
)
def
update_train_charts
(
train_path
):
def
update_train_charts
(
train_path
,
commit
):
# We will gather all charts in the train and then for each chart all it's versions will be updated
# We will gather all charts in the train and then for each chart all it's versions will be updated
if
not
os
.
path
.
exists
(
train_path
):
if
not
os
.
path
.
exists
(
train_path
):
raise
TrainNotFoundException
()
raise
TrainNotFoundException
()
...
@@ -65,6 +65,26 @@ def update_train_charts(train_path):
...
@@ -65,6 +65,26 @@ def update_train_charts(train_path):
report_result
()
report_result
()
if
commit
:
if
any
(
ITEMS
[
item
][
'error'
]
for
item
in
ITEMS
):
print
(
f'[
\033
[91mFAILED
\x1B
[0m]
\t
Not committing changes as failures detected'
)
else
:
commit_msg
=
'Updated catalog item dependencies
\n
Following items were updated:
\n
'
for
item
in
ITEMS
:
commit_msg
+=
f'Updated
{
item
}
(
{
", "
.
join
(
ITEMS
[
item
][
"success"
])
}
versions)
\n\n
'
for
cmd
in
(
[
'git'
,
'-C'
,
train_path
,
'add'
,
train_path
],
[
'git'
,
'-C'
,
train_path
,
'commit'
,
'-m'
,
commit_msg
]
):
cp
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
DEVNULL
,
stderr
=
subprocess
.
PIPE
)
stderr
=
cp
.
communicate
()[
1
]
if
cp
.
returncode
:
print
(
f'[
\033
[91mFAILED
\x1B
[0m]
\t
Failed to execute
{
" "
.
join
(
cmd
)
}
:
{
stderr
.
decode
()
}
'
)
exit
(
1
)
print
(
'[
\033
[92mOK
\x1B
[0m]
\t
Changes committed successfully'
)
def
process_catalog_item
(
item_path
):
def
process_catalog_item
(
item_path
):
if
not
os
.
path
.
exists
(
item_path
):
if
not
os
.
path
.
exists
(
item_path
):
...
@@ -73,6 +93,7 @@ def process_catalog_item(item_path):
...
@@ -73,6 +93,7 @@ def process_catalog_item(item_path):
item_name
=
item_path
.
rsplit
(
'/'
,
1
)[
-
1
]
item_name
=
item_path
.
rsplit
(
'/'
,
1
)[
-
1
]
print
(
f'[
\033
[94mINFO
\x1B
[0m]
\t
Processing
{
item_name
!
r
}
catalog item'
)
print
(
f'[
\033
[94mINFO
\x1B
[0m]
\t
Processing
{
item_name
!
r
}
catalog item'
)
for
item_version
in
os
.
listdir
(
item_path
):
for
item_version
in
os
.
listdir
(
item_path
):
if
os
.
path
.
isdir
(
os
.
path
.
join
(
item_path
,
item_version
)):
update_item_version
(
item_name
,
item_version
,
os
.
path
.
join
(
item_path
,
item_version
))
update_item_version
(
item_name
,
item_version
,
os
.
path
.
join
(
item_path
,
item_version
))
...
@@ -93,10 +114,11 @@ def main():
...
@@ -93,10 +114,11 @@ def main():
parser_setup
=
subparsers
.
add_parser
(
'update'
,
help
=
'Update dependencies for specified train'
)
parser_setup
=
subparsers
.
add_parser
(
'update'
,
help
=
'Update dependencies for specified train'
)
parser_setup
.
add_argument
(
'--train'
,
help
=
'Specify train path to update dependencies'
,
required
=
True
)
parser_setup
.
add_argument
(
'--train'
,
help
=
'Specify train path to update dependencies'
,
required
=
True
)
parser_setup
.
add_argument
(
'--commit'
,
help
=
'Commit after updating dependencies'
,
default
=
False
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
if
args
.
action
==
'update'
:
if
args
.
action
==
'update'
:
update_train_charts
(
args
.
train
)
update_train_charts
(
args
.
train
,
args
.
commit
)
else
:
else
:
parser
.
print_help
()
parser
.
print_help
()
...
...
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