Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
e52460d2
Commit
e52460d2
authored
Feb 11, 2020
by
Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
error code = 1 if bin script failed
parent
a13a149b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
13 deletions
+16
-13
build.py
bin/build.py
+10
-1
deploy.py
bin/deploy.py
+6
-12
No files found.
bin/build.py
View file @
e52460d2
...
...
@@ -21,6 +21,7 @@ command_args = [{'path': path,
for
path
in
paths
]
error
:
int
=
0
res_str
=
[]
for
command_arg
in
command_args
:
path
=
command_arg
[
'path'
]
...
...
@@ -34,11 +35,19 @@ for command_arg in command_args:
os
.
remove
(
os
.
path
.
join
(
ROOT
,
DOCKER_COMPOSE_NAME
))
res_str
.
append
(
f
"{image_name} built with exit code {exit_val}"
)
if
exit_val
!=
0
:
error
=
exit_val
os
.
system
(
f
"docker push {image_name}"
)
# push created Docker image
exit_val
=
os
.
system
(
f
"docker push {image_name}"
)
res_str
.
append
(
f
"{image_name} pushed with exit code {exit_val}"
)
if
exit_val
!=
0
:
error
=
exit_val
print
(
f
"Found {len(command_args)} images"
)
for
s
in
res_str
:
print
(
s
)
sys
.
exit
(
1
if
error
>
0
else
0
)
\ No newline at end of file
bin/deploy.py
View file @
e52460d2
import
os
import
sys
EXTERNAL_IP
=
"143.205.173.225"
# apply or delete config
kube_command
=
'apply'
if
len
(
sys
.
argv
)
==
2
:
...
...
@@ -14,14 +12,10 @@ for p, _, f in os.walk('./'):
if
'deployment.yml'
==
file
:
paths
.
append
(
os
.
path
.
normpath
(
p
))
error
:
int
=
0
for
path
in
paths
:
os
.
system
(
f
"kubectl {kube_command} -f {path}"
)
# if kube_command == 'apply':
# # apply external ip
# service_name = path.split(os.path.normpath('/'))[-2] # -1 is deployment folder
# if service_name.split('-')[-1] == 'microservice':
# # remove microservice suffix
# service_name = service_name[:len(service_name)-len('-microservice')]
# os.system(f"kubectl patch service {service_name} -p '{{\"spec\":{{\"externalIPs\":[\"{EXTERNAL_IP}\"]}}}}'")
\ No newline at end of file
exit_val
=
os
.
system
(
f
"kubectl {kube_command} -f {path}"
)
if
exit_val
!=
0
:
error
=
exit_val
sys
.
exit
(
1
if
error
>
0
else
0
)
\ No newline at end of file
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