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
505e44a0
Commit
505e44a0
authored
Sep 29, 2022
by
Faizan Azim
🤓
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added git clone and copy logic
parent
2c37df7c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
13 deletions
+9
-13
.gitignore
.gitignore
+2
-0
helm_automate_script.py
helm_automate_script.py
+7
-13
No files found.
.gitignore
View file @
505e44a0
__pycache__
__pycache__
.idea
.idea
.vscode
.vscode
data
logs
\ No newline at end of file
helm_automate_script.py
View file @
505e44a0
...
@@ -27,6 +27,7 @@ global_configmap = os.environ.get("GLOBAL_VARIABLES_FILE", default="")
...
@@ -27,6 +27,7 @@ global_configmap = os.environ.get("GLOBAL_VARIABLES_FILE", default="")
HELM_PATH
=
"/ilens-core/ilens-modules"
HELM_PATH
=
"/ilens-core/ilens-modules"
HELM_STORE_PATH
=
"./helm-charts"
HELM_STORE_PATH
=
"./helm-charts"
REPO_CLONE_PATH
=
"./data"
def
render_helm_chart
(
helm_name
,
data_dict
,
variables_list
,
helm_template_file
):
def
render_helm_chart
(
helm_name
,
data_dict
,
variables_list
,
helm_template_file
):
...
@@ -121,19 +122,12 @@ def push_helm_deployments(repo_link:str, private_token:str, branch: str):
...
@@ -121,19 +122,12 @@ def push_helm_deployments(repo_link:str, private_token:str, branch: str):
logging
.
exception
(
f
'Exception while pushing helm deployments: {e.args}'
)
logging
.
exception
(
f
'Exception while pushing helm deployments: {e.args}'
)
def
pull_global_config
(
repo_link
:
str
,
private_token
:
str
,
branch
:
str
,
file_name
:
str
):
def
pull_global_config
(
repo_link
:
str
,
private_token
:
str
,
branch
:
str
,
file_name
:
str
):
base_url
=
os
.
environ
.
get
(
"GIT_BASE_URL"
,
default
=
default_link
)
if
repo_link
.
split
(
"https://"
)[
-
1
]
.
startswith
(
"gitlab-pm"
):
repo_link_split
=
repo_link
.
split
(
base_url
)
repo_link
=
repo_link
.
replace
(
"https://"
,
f
"https://{git_user_name}:{git_access_token}@"
)
if
not
repo_link_split
:
repo
=
git
.
Repo
.
clone_from
(
url
=
repo_link
,
to_path
=
REPO_CLONE_PATH
)
return
False
repo
.
git
.
checkout
(
branch
)
gl
=
gitlab
.
Gitlab
(
url
=
base_url
,
private_token
=
private_token
)
shutil
.
copy
(
f
'{REPO_CLONE_PATH}{HELM_PATH}/{file_name}'
,
"."
)
search_str
=
repo_link_split
[
-
1
]
.
replace
(
".git"
,
""
)
print
(
"I can break here"
)
if
pl
:
=
gl
.
projects
.
list
(
search
=
search_str
):
pl
=
pl
[
0
]
else
:
return
False
with
open
(
file_name
,
'wb'
)
as
f
:
pl
.
files
.
raw
(
file_path
=
f
'{HELM_PATH[1:]}/{file_name}'
,
ref
=
branch
,
streamed
=
True
,
action
=
f
.
write
)
return
True
def
remove_all_files_from_repo
(
repo_link
:
str
,
private_token
:
str
,
branch
:
str
,
exclude_file
:
list
):
def
remove_all_files_from_repo
(
repo_link
:
str
,
private_token
:
str
,
branch
:
str
,
exclude_file
:
list
):
base_url
=
os
.
environ
.
get
(
"GIT_BASE_URL"
,
default
=
default_link
)
base_url
=
os
.
environ
.
get
(
"GIT_BASE_URL"
,
default
=
default_link
)
...
...
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