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
29ed9a0f
Commit
29ed9a0f
authored
Nov 27, 2022
by
harshavardhan.c
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dev: integration fixes while generating helm-scripts dynamically.
parent
f413d47e
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
288 additions
and
354 deletions
+288
-354
automation_script.py
automation_script.py
+9
-3
docker_automation/docker_automate_script.py
docker_automation/docker_automate_script.py
+2
-2
helm_automation/helm_automate_script.py
helm_automation/helm_automate_script.py
+120
-153
helm_automation/helm_register.py
helm_automation/helm_register.py
+130
-185
scripts/core/docker_handler.py
scripts/core/docker_handler.py
+17
-8
templates/docker_deployment.yml
templates/docker_deployment.yml
+10
-3
No files found.
automation_script.py
View file @
29ed9a0f
...
...
@@ -4,9 +4,11 @@ import sys
from
dotenv
import
load_dotenv
from
docker_automation.docker_automate_script
import
DockerVersionUpgrade
load_dotenv
()
from
helm_automation.helm_register
import
HelmRegistration
from
docker_automation.docker_automate_script
import
DockerVersionUpgrade
from
helm_automation.helm_automate_script
import
HelmVersionUpgrade
from
docker_automation.docker_register
import
DockerRegistration
from
scripts.config
import
EnvironmentVariables
from
scripts.logging
import
logger
...
...
@@ -25,7 +27,11 @@ def func_mapper(operation_type, parameters):
"docker_registration"
:
DockerRegistration
(
arguments
=
parameters
,
git_user_name
=
git_user_name
,
git_access_token
=
git_access_token
)
.
module_registration
,
"docker_version_upgrade"
:
DockerVersionUpgrade
(
arguments
=
parameters
,
git_user_name
=
git_user_name
,
git_access_token
=
git_access_token
)
.
module_registration
git_access_token
=
git_access_token
)
.
module_registration
,
"helm_version_upgrade"
:
HelmVersionUpgrade
(
arguments
=
parameters
,
git_user_name
=
git_user_name
,
git_access_token
=
git_access_token
)
.
module_registration
,
"helm_registration"
:
HelmRegistration
(
arguments
=
parameters
,
git_user_name
=
git_user_name
,
git_access_token
=
git_access_token
)
.
module_registration
}
return
func_mapper_dict
.
get
(
operation_type
)
...
...
docker_automation/docker_automate_script.py
View file @
29ed9a0f
...
...
@@ -37,9 +37,9 @@ class DockerVersionUpgrade:
_module_names
=
self
.
arguments
[
"module_names"
]
_branch_name
=
self
.
arguments
[
'branch_name'
]
or
"master"
_ilens_version
=
self
.
arguments
[
"ilens_version"
]
if
not
_ilens_version
or
not
_release_version
or
not
_client_name
or
not
_git_repos
and
not
_module_names
or
not
global_configmap
:
if
not
_ilens_version
or
not
_release_version
or
not
_client_name
or
not
global_configmap
:
print
(
"global_configmap,
git_repos, module_names,
client_name, ilens_version and release_version details "
"global_configmap, client_name, ilens_version and release_version details "
"not found!!!!!"
)
sys
.
exit
()
variables_file
=
"variables.yml"
...
...
helm_automation/helm_automate_script.py
View file @
29ed9a0f
This diff is collapsed.
Click to expand it.
helm_automation/helm_register.py
View file @
29ed9a0f
This diff is collapsed.
Click to expand it.
scripts/core/docker_handler.py
View file @
29ed9a0f
...
...
@@ -3,8 +3,9 @@ import os
from
scripts.config
import
EnvironmentVariables
from
scripts.core
import
ILensVersionHandler
from
scripts.core.git_handler
import
GitHandler
from
scripts.db.psql.databases
import
get_db_for_func
from
scripts.logging
import
logging
from
scripts.schemas
import
DockerComposeSchema
from
scripts.schemas
import
DockerComposeSchema
,
GetRequest
from
scripts.utils.common_utils
import
CommonUtils
...
...
@@ -39,13 +40,12 @@ class DockerHandler:
logging
.
debug
(
"Failed to clone module!! Skipping Docker File Preparation"
)
continue
_module_data
=
self
.
common_util
.
convert_yaml_to_define_obj
(
variables_file_path
)
#
session_obj = get_db_for_func()
#
module_info = self.db_handler.get_module_versions(
#
input_data=GetRequest(module_name=_module, client='iLens', ilens_version=ilens_version,
#
release_version=release_version), db=session_obj)
#
session_obj.close()
session_obj
=
get_db_for_func
()
module_info
=
self
.
db_handler
.
get_module_versions
(
input_data
=
GetRequest
(
module_name
=
_module
,
client
=
'iLens'
,
ilens_version
=
ilens_version
,
release_version
=
release_version
),
db
=
session_obj
)
session_obj
.
close
()
_module_data
=
self
.
common_util
.
convert_yaml_to_define_obj
(
variables_file_path
)
module_info
=
{}
module_env_variables
=
_module_data
.
get
(
'deployment'
,
{})
.
get
(
'environmentVar'
,
[])
module_env_variables
=
{
_v
[
'name'
]:
_v
.
get
(
'value'
)
for
_v
in
module_env_variables
}
image_url
=
module_info
.
get
(
"image_url"
,
''
)
if
module_info
else
''
...
...
@@ -105,11 +105,20 @@ class DockerHandler:
def
process_compose_data_by_template
(
self
,
modules
,
compose_info
:
dict
,
variables_file
,
arguments
,
tmp_path
,
output_path
):
ilens_version
=
arguments
.
get
(
"ilens_version"
)
branch_name
=
arguments
.
get
(
"branch_name"
)
release_version
=
arguments
.
get
(
"release_version"
)
compose_dict
=
{
"services"
:
{}}
try
:
for
module
in
modules
:
session_obj
=
get_db_for_func
()
module_info
=
self
.
db_handler
.
get_module_versions
(
input_data
=
GetRequest
(
module_name
=
module
,
client
=
'iLens'
,
ilens_version
=
ilens_version
,
release_version
=
release_version
),
db
=
session_obj
)
session_obj
.
close
()
image_url
=
module_info
.
get
(
"image_url"
,
''
)
if
module_info
else
''
compose_dict
[
'services'
]
.
update
({
module
:
DockerComposeSchema
()
.
dict
()
module
:
DockerComposeSchema
(
image
=
image_url
)
.
dict
()
})
compose_out_file_path
=
os
.
path
.
join
(
output_path
,
"docker-compose.yml"
)
jinja_template_file
=
'docker_deployment.yml'
...
...
templates/docker_deployment.yml
View file @
29ed9a0f
version
:
"
2"
{
%
for k
,
v in modules.items() %
}
x-{{ k }}-image
:
&
{{
k
}}
-image {{v['image']}}
{
%
endfor %
}
services
:
{
%
for k
,
v in modules.items() %
}
{{
k
}}:
image
:
{{
v
[
'
image'
]}}
image
:
*
{{
k
}}
-image
ports
:
-
{{
v
[
'
ports'
]}}
environment
:
...
...
@@ -15,4 +17,9 @@ services:
{
%
for volume in v
[
'
volumes'
]
%
}
-
{{
volume
}}
{
%
endfor %
}
{
%
endfor %
}
\ No newline at end of file
{
%
endfor %
}
networks
:
default
:
external
:
name
:
"
ilens"
\ 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