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
7bb92cf1
Commit
7bb92cf1
authored
Jan 18, 2023
by
harshavardhan.c
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dev: Helm Chart enhancements in order to support data-processor modules.
parent
3262ddeb
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
31 deletions
+55
-31
automation_script.py
automation_script.py
+11
-6
docker_automation/docker_automate_script.py
docker_automation/docker_automate_script.py
+5
-3
docker_automation/docker_register.py
docker_automation/docker_register.py
+8
-7
helm_automation/helm_automate_script.py
helm_automation/helm_automate_script.py
+12
-8
helm_automation/helm_register.py
helm_automation/helm_register.py
+8
-7
scripts/config/__init__.py
scripts/config/__init__.py
+11
-0
No files found.
automation_script.py
View file @
7bb92cf1
...
@@ -76,25 +76,22 @@ if __name__ == '__main__':
...
@@ -76,25 +76,22 @@ if __name__ == '__main__':
"--git_repos"
,
"--git_repos"
,
"-gr"
,
"-gr"
,
required
=
False
,
required
=
False
,
default
=
None
,
default
=
''
,
help
=
"Git repos to be added in docker compose"
,
help
=
"Git repos to be added in docker compose"
,
nargs
=
"+"
)
)
ap
.
add_argument
(
ap
.
add_argument
(
"--module_names"
,
"--module_names"
,
"-mn"
,
"-mn"
,
required
=
False
,
required
=
False
,
default
=
None
,
default
=
''
,
help
=
"Module names to be added in docker compose"
,
help
=
"Module names to be added in docker compose"
,
nargs
=
"+"
)
)
ap
.
add_argument
(
ap
.
add_argument
(
"--repo_info"
,
"--repo_info"
,
"-ri"
,
"-ri"
,
required
=
False
,
required
=
False
,
default
=
None
,
default
=
''
,
help
=
"Module names to be added in docker compose"
,
help
=
"Module names to be added in docker compose"
,
nargs
=
"+"
)
)
ap
.
add_argument
(
ap
.
add_argument
(
"--execution_type"
,
"--execution_type"
,
...
@@ -103,6 +100,13 @@ if __name__ == '__main__':
...
@@ -103,6 +100,13 @@ if __name__ == '__main__':
default
=
None
,
default
=
None
,
help
=
"Type of Execution will be selected.."
help
=
"Type of Execution will be selected.."
)
)
ap
.
add_argument
(
"--extra_modules"
,
"-em"
,
required
=
False
,
default
=
'data-processor'
,
help
=
"Extra Modules to be included in script"
,
)
try
:
try
:
arguments
=
vars
(
ap
.
parse_args
())
arguments
=
vars
(
ap
.
parse_args
())
_ilens_version
=
arguments
[
"ilens_version"
]
_ilens_version
=
arguments
[
"ilens_version"
]
...
@@ -111,6 +115,7 @@ if __name__ == '__main__':
...
@@ -111,6 +115,7 @@ if __name__ == '__main__':
_reference_branch
=
arguments
[
'reference_client_name'
]
_reference_branch
=
arguments
[
'reference_client_name'
]
_git_repos
=
arguments
[
"git_repos"
]
_git_repos
=
arguments
[
"git_repos"
]
_module_names
=
arguments
[
"module_names"
]
_module_names
=
arguments
[
"module_names"
]
extra_modules
=
arguments
[
"extra_modules"
]
_branch_name
=
arguments
[
'branch_name'
]
or
"master"
_branch_name
=
arguments
[
'branch_name'
]
or
"master"
if
repo_info
:
=
arguments
[
"repo_info"
]:
if
repo_info
:
=
arguments
[
"repo_info"
]:
repo_info
=
json
.
loads
(
repo_info
)
repo_info
=
json
.
loads
(
repo_info
)
...
...
docker_automation/docker_automate_script.py
View file @
7bb92cf1
...
@@ -37,12 +37,14 @@ class DockerVersionUpgrade:
...
@@ -37,12 +37,14 @@ class DockerVersionUpgrade:
logging
.
error
(
f
'Exception occurred while preparing the docker compose {e.args}'
)
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
):
def
process_docker_automation
(
self
,
docker_temp_path
,
output_path
,
general_temp_path
):
_ilens_version
=
self
.
arguments
[
"ilens_version"
]
_release_version
=
self
.
arguments
[
"release_version"
]
_release_version
=
self
.
arguments
[
"release_version"
]
_client_name
=
self
.
arguments
[
'client_name'
]
_client_name
=
self
.
arguments
[
'client_name'
]
_git_repos
=
self
.
arguments
[
"git_repos"
]
_git_repos
=
self
.
arguments
[
"git_repos"
]
.
split
(
','
)
_module_names
=
self
.
arguments
[
"module_names"
]
_module_names
=
self
.
arguments
[
"module_names"
]
.
split
(
','
)
extra_modules
=
self
.
arguments
[
"extra_modules"
]
.
split
(
','
)
_branch_name
=
self
.
arguments
[
'branch_name'
]
or
"master"
_branch_name
=
self
.
arguments
[
'branch_name'
]
or
"master"
_
ilens_version
=
self
.
arguments
[
"ilens_version"
]
_
reference_branch
=
self
.
arguments
[
'reference_client_name'
]
if
not
_ilens_version
or
not
_release_version
or
not
_client_name
or
not
global_configmap
:
if
not
_ilens_version
or
not
_release_version
or
not
_client_name
or
not
global_configmap
:
print
(
print
(
"global_configmap, client_name, ilens_version and release_version details "
"global_configmap, client_name, ilens_version and release_version details "
...
...
docker_automation/docker_register.py
View file @
7bb92cf1
...
@@ -33,14 +33,15 @@ class DockerRegistration:
...
@@ -33,14 +33,15 @@ class DockerRegistration:
docker_temp_path
=
f
"{int(time.time())}_docker_tmp_path"
docker_temp_path
=
f
"{int(time.time())}_docker_tmp_path"
general_temp_path
=
f
"{int(time.time())}_tmp"
general_temp_path
=
f
"{int(time.time())}_tmp"
output_path
=
f
"{int(time.time())}_docker-compose"
output_path
=
f
"{int(time.time())}_docker-compose"
_ilens_version
=
self
.
arguments
[
"ilens_version"
]
_release_version
=
self
.
arguments
[
"release_version"
]
_client_name
=
self
.
arguments
[
'client_name'
]
_git_repos
=
self
.
arguments
[
"git_repos"
]
.
split
(
','
)
_module_names
=
self
.
arguments
[
"module_names"
]
.
split
(
','
)
extra_modules
=
self
.
arguments
[
"extra_modules"
]
.
split
(
','
)
_branch_name
=
self
.
arguments
[
'branch_name'
]
or
"master"
_reference_branch
=
self
.
arguments
[
'reference_client_name'
]
try
:
try
:
_ilens_version
=
self
.
arguments
[
"ilens_version"
]
_release_version
=
self
.
arguments
[
"release_version"
]
_client_name
=
self
.
arguments
[
'client_name'
]
_reference_branch
=
self
.
arguments
[
'reference_client_name'
]
_git_repos
=
self
.
arguments
[
"git_repos"
]
_module_names
=
self
.
arguments
[
"module_names"
]
_branch_name
=
self
.
arguments
[
'branch_name'
]
or
"master"
if
repo_info
:
=
self
.
arguments
[
"repo_info"
]:
if
repo_info
:
=
self
.
arguments
[
"repo_info"
]:
repo_info
=
json
.
loads
(
repo_info
)
repo_info
=
json
.
loads
(
repo_info
)
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
_git_repos
and
not
_module_names
or
not
global_configmap
:
...
...
helm_automation/helm_automate_script.py
View file @
7bb92cf1
from
scripts.config
import
EnvironmentVariables
from
scripts.config
import
EnvironmentVariables
,
ModuleConstants
from
scripts.core.helm_handler
import
HelmHandler
from
scripts.core.helm_handler
import
HelmHandler
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
@@ -35,13 +35,14 @@ class HelmVersionUpgrade:
...
@@ -35,13 +35,14 @@ class HelmVersionUpgrade:
helm_temp_path
=
f
"{int(time.time())}_helm_tmp_path"
helm_temp_path
=
f
"{int(time.time())}_helm_tmp_path"
general_temp_path
=
f
"{int(time.time())}_tmp"
general_temp_path
=
f
"{int(time.time())}_tmp"
output_path
=
f
"{int(time.time())}_helm-charts"
output_path
=
f
"{int(time.time())}_helm-charts"
_ilens_version
=
self
.
arguments
[
"ilens_version"
]
_release_version
=
self
.
arguments
[
"release_version"
]
_client_name
=
self
.
arguments
[
'client_name'
]
_git_repos
=
self
.
arguments
[
"git_repos"
]
.
split
(
','
)
_module_names
=
self
.
arguments
[
"module_names"
]
.
split
(
','
)
extra_modules
=
self
.
arguments
[
"extra_modules"
]
.
split
(
','
)
_branch_name
=
self
.
arguments
[
'branch_name'
]
or
"master"
try
:
try
:
_ilens_version
=
self
.
arguments
[
"ilens_version"
]
_release_version
=
self
.
arguments
[
"release_version"
]
_client_name
=
self
.
arguments
[
'client_name'
]
_git_repos
=
self
.
arguments
[
"git_repos"
]
_module_names
=
self
.
arguments
[
"module_names"
]
_branch_name
=
self
.
arguments
[
'branch_name'
]
or
"master"
if
not
_ilens_version
or
not
_release_version
or
not
_client_name
or
not
(
if
not
_ilens_version
or
not
_release_version
or
not
_client_name
or
not
(
_git_repos
or
_module_names
)
or
not
global_configmap
:
_git_repos
or
_module_names
)
or
not
global_configmap
:
print
(
print
(
...
@@ -63,7 +64,8 @@ class HelmVersionUpgrade:
...
@@ -63,7 +64,8 @@ class HelmVersionUpgrade:
files_info
=
os
.
listdir
(
base_helm_directory_path
)
files_info
=
os
.
listdir
(
base_helm_directory_path
)
sorted_files
=
list
(
filter
(
lambda
f
:
f
.
endswith
(
".yml"
),
files_info
))
sorted_files
=
list
(
filter
(
lambda
f
:
f
.
endswith
(
".yml"
),
files_info
))
_module_names
=
[
_each
.
replace
(
".yml"
,
""
)
for
_each
in
sorted_files
]
_module_names
=
[
_each
.
replace
(
".yml"
,
""
)
for
_each
in
sorted_files
]
_module_names
.
extend
(
extra_modules
)
_module_names
=
sorted
(
_module_names
)
global_config_data
=
self
.
common_util
.
convert_yaml_to_define_obj
(
global_config_data
=
self
.
common_util
.
convert_yaml_to_define_obj
(
os
.
path
.
join
(
base_helm_directory_path
,
global_configmap
))
os
.
path
.
join
(
base_helm_directory_path
,
global_configmap
))
# global_config_data = common_util.convert_yaml_to_json("ilens-global-configmap.yml")
# global_config_data = common_util.convert_yaml_to_json("ilens-global-configmap.yml")
...
@@ -73,6 +75,8 @@ class HelmVersionUpgrade:
...
@@ -73,6 +75,8 @@ class HelmVersionUpgrade:
if
not
os
.
path
.
exists
(
template_path
):
if
not
os
.
path
.
exists
(
template_path
):
os
.
makedirs
(
template_path
)
os
.
makedirs
(
template_path
)
for
_module
in
_module_names
:
for
_module
in
_module_names
:
if
_module
==
ModuleConstants
.
IOT_DATA_PROCESSOR
:
_module
=
ModuleConstants
.
IOT_DATA_PROCESSOR_MODULE
module_path
=
os
.
path
.
join
(
general_temp_path
)
module_path
=
os
.
path
.
join
(
general_temp_path
)
module_path
=
os
.
path
.
join
(
module_path
,
_module
)
module_path
=
os
.
path
.
join
(
module_path
,
_module
)
if
not
os
.
path
.
exists
(
module_path
):
if
not
os
.
path
.
exists
(
module_path
):
...
...
helm_automation/helm_register.py
View file @
7bb92cf1
...
@@ -40,14 +40,15 @@ class HelmRegistration:
...
@@ -40,14 +40,15 @@ class HelmRegistration:
helm_temp_path
=
f
"{int(time.time())}_helm_tmp_path"
helm_temp_path
=
f
"{int(time.time())}_helm_tmp_path"
general_temp_path
=
f
"{int(time.time())}_tmp"
general_temp_path
=
f
"{int(time.time())}_tmp"
output_path
=
f
"{int(time.time())}_helm-charts"
output_path
=
f
"{int(time.time())}_helm-charts"
_ilens_version
=
self
.
arguments
[
"ilens_version"
]
_release_version
=
self
.
arguments
[
"release_version"
]
_client_name
=
self
.
arguments
[
'client_name'
]
_git_repos
=
self
.
arguments
[
"git_repos"
]
.
split
(
','
)
_module_names
=
self
.
arguments
[
"module_names"
]
.
split
(
','
)
extra_modules
=
self
.
arguments
[
"extra_modules"
]
.
split
(
','
)
_branch_name
=
self
.
arguments
[
'branch_name'
]
or
"master"
_reference_branch
=
self
.
arguments
[
'reference_client_name'
]
try
:
try
:
_ilens_version
=
self
.
arguments
[
"ilens_version"
]
_release_version
=
self
.
arguments
[
"release_version"
]
_client_name
=
self
.
arguments
[
'client_name'
]
_reference_branch
=
self
.
arguments
[
'reference_client_name'
]
_git_repos
=
self
.
arguments
[
"git_repos"
]
_module_names
=
self
.
arguments
[
"module_names"
]
_branch_name
=
self
.
arguments
[
'branch_name'
]
or
"master"
repo_info
=
self
.
arguments
[
"repo_info"
]
repo_info
=
self
.
arguments
[
"repo_info"
]
if
repo_info
:
if
repo_info
:
repo_info
=
json
.
loads
(
repo_info
)
repo_info
=
json
.
loads
(
repo_info
)
...
...
scripts/config/__init__.py
View file @
7bb92cf1
import
os
import
os
import
sys
import
sys
from
configparser
import
BasicInterpolation
,
ConfigParser
from
configparser
import
BasicInterpolation
,
ConfigParser
from
typing
import
Optional
from
pydantic
import
BaseSettings
class
EnvInterpolation
(
BasicInterpolation
):
class
EnvInterpolation
(
BasicInterpolation
):
...
@@ -55,3 +58,11 @@ class EnvironmentVariables:
...
@@ -55,3 +58,11 @@ class EnvironmentVariables:
default
=
"https://gitlab-pm.knowledgelens.com/KnowledgeLens/Products/iLens-2.0/core/devops/docker-compose.git"
)
default
=
"https://gitlab-pm.knowledgelens.com/KnowledgeLens/Products/iLens-2.0/core/devops/docker-compose.git"
)
global_configmap
=
os
.
environ
.
get
(
"GLOBAL_VARIABLES_FILE"
,
default
=
"ilens-env-spec-variables.yml"
)
global_configmap
=
os
.
environ
.
get
(
"GLOBAL_VARIABLES_FILE"
,
default
=
"ilens-env-spec-variables.yml"
)
helm_repo
=
os
.
environ
.
get
(
"HELM_REPO"
,
default
=
""
)
helm_repo
=
os
.
environ
.
get
(
"HELM_REPO"
,
default
=
""
)
class
_ModuleConstants
(
BaseSettings
):
IOT_DATA_PROCESSOR
:
Optional
[
str
]
=
"mqtt-data-processor-worker"
IOT_DATA_PROCESSOR_MODULE
:
Optional
[
str
]
=
"data-processor-worker"
ModuleConstants
=
_ModuleConstants
(
_env_file
=
".env"
,
_env_file_encoding
=
"utf-8"
)
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