Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
Helm-Automation-Script
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
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
harshavardhan.c
Helm-Automation-Script
Commits
ba823dcc
Commit
ba823dcc
authored
Nov 28, 2022
by
harshavardhan.c
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dev: code optimization fixes
parent
29ed9a0f
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
120 additions
and
85 deletions
+120
-85
docker_automation/docker_automate_script.py
docker_automation/docker_automate_script.py
+33
-29
docker_automation/docker_register.py
docker_automation/docker_register.py
+9
-1
scripts/core/docker_handler.py
scripts/core/docker_handler.py
+69
-46
scripts/core/helm_handler.py
scripts/core/helm_handler.py
+8
-8
scripts/utils/common_utils.py
scripts/utils/common_utils.py
+1
-1
No files found.
docker_automation/docker_automate_script.py
View file @
ba823dcc
...
...
@@ -31,6 +31,12 @@ class DockerVersionUpgrade:
general_temp_path
=
f
"{int(time.time())}_tmp"
output_path
=
f
"{int(time.time())}_docker-compose"
try
:
self
.
process_docker_automation
(
docker_temp_path
,
output_path
,
general_temp_path
)
except
Exception
as
e
:
logging
.
error
(
f
'Exception occurred while preparing the docker compose {e.args}'
)
def
process_docker_automation
(
self
,
docker_temp_path
,
output_path
,
general_temp_path
):
_release_version
=
self
.
arguments
[
"release_version"
]
_client_name
=
self
.
arguments
[
'client_name'
]
_git_repos
=
self
.
arguments
[
"git_repos"
]
...
...
@@ -60,5 +66,3 @@ class DockerVersionUpgrade:
tmp_path
=
general_temp_path
,
output_path
=
output_path
,
docker_compose_path
=
docker_compose_path
)
except
Exception
as
e
:
logging
.
error
(
f
'Exception occurred while preparing the docker compose {e.args}'
)
docker_automation/docker_register.py
View file @
ba823dcc
import
json
from
scripts.config
import
EnvironmentVariables
if
__name__
==
"__main__"
:
from
dotenv
import
load_dotenv
...
...
@@ -69,6 +71,12 @@ class DockerRegistration:
arguments
=
self
.
arguments
,
compose_info
=
repo_info
,
tmp_path
=
general_temp_path
,
output_path
=
output_path
,
modules
=
_module_names
)
# self.git_handler_obj.push_deployments_to_git(repo_link=docker_repo,
# private_token=EnvironmentVariables.git_access_token,
# branch=_branch,
# folder_path=output_path, helm_deployment=False,
# base_path=docker_compose_path)
# self.git_handler_obj.create_merge_request(repo_link=docker_repo, source_branch=_branch,
# destination_branch=_client_name)
except
Exception
as
e
:
logging
.
exception
(
f
"Exception Occurred while generating the docker compose file {e.args}"
)
scripts/core/docker_handler.py
View file @
ba823dcc
This diff is collapsed.
Click to expand it.
scripts/core/helm_handler.py
View file @
ba823dcc
...
...
@@ -33,7 +33,7 @@ class HelmHandler:
existing_data
[
'deployment'
][
'imageName'
]
=
image_tag
or
existing_data
[
'deployment'
][
'imageName'
]
self
.
common_utils
.
convert_json_to_yaml
(
json_data
=
existing_data
,
output_file_path
=
template_file
)
self
.
common_utils
.
render_
helm
_chart
(
data_dict
=
global_config_vars
,
jinja_template_file
=
f
'{module_name}.yml'
,
self
.
common_utils
.
render_
deployment
_chart
(
data_dict
=
global_config_vars
,
jinja_template_file
=
f
'{module_name}.yml'
,
outfile_path
=
helm_out_file_path
,
template_path
=
template_path
,
service_type
=
service_type
)
return
True
...
...
@@ -61,7 +61,7 @@ class HelmHandler:
value_key
=
v
.
strip
(
"<{ }>"
)
global_config_vars
.
update
({
k
:
global_config_vars
.
get
(
value_key
,
v
)})
self
.
common_utils
.
render_
helm
_chart
(
data_dict
=
{},
jinja_template_file
=
f
'{module_name}.yml'
,
self
.
common_utils
.
render_
deployment
_chart
(
data_dict
=
{},
jinja_template_file
=
f
'{module_name}.yml'
,
outfile_path
=
helm_out_file_path
,
template_path
=
"templates"
,
service_type
=
service_type
,
image_url
=
image_tag
,
variables
=
global_config_vars
,
...
...
scripts/utils/common_utils.py
View file @
ba823dcc
...
...
@@ -35,7 +35,7 @@ class CommonUtils:
return
False
@
staticmethod
def
render_
helm
_chart
(
data_dict
,
jinja_template_file
,
template_path
,
outfile_path
,
**
kwargs
):
def
render_
deployment
_chart
(
data_dict
,
jinja_template_file
,
template_path
,
outfile_path
,
**
kwargs
):
try
:
environment
=
jinja2
.
Environment
(
loader
=
jinja2
.
FileSystemLoader
(
searchpath
=
template_path
),
...
...
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