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
f0be8d78
Commit
f0be8d78
authored
Oct 17, 2022
by
Faizan Azim
🤓
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added merge request logic.
parent
eb6d7d8d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
helm_automate_script.py
helm_automate_script.py
+1
-1
scripts/core/git_handler.py
scripts/core/git_handler.py
+17
-0
No files found.
helm_automate_script.py
View file @
f0be8d78
...
@@ -205,7 +205,7 @@ if __name__ == '__main__':
...
@@ -205,7 +205,7 @@ if __name__ == '__main__':
module_name
=
_file
.
split
(
".yml"
)[
0
])
module_name
=
_file
.
split
(
".yml"
)[
0
])
push_helm_deployments
(
helm_repo
,
git_access_token
,
_client_name
,
final_helm_path
=
OUTPUT_PATH
,
push_helm_deployments
(
helm_repo
,
git_access_token
,
_client_name
,
final_helm_path
=
OUTPUT_PATH
,
base_path
=
helm_path
)
base_path
=
helm_path
)
git_handler_obj
.
create_merge_request
(
repo_link
=
helm_repo
,
source_branch
=
_branch
,
destination_branch
=
_client_name
)
except
Exception
as
e
:
except
Exception
as
e
:
logging
.
exception
(
f
"Exception Occurred while processing the Helm-Script Preparation {e.args}"
)
logging
.
exception
(
f
"Exception Occurred while processing the Helm-Script Preparation {e.args}"
)
finally
:
finally
:
...
...
scripts/core/git_handler.py
View file @
f0be8d78
...
@@ -89,3 +89,20 @@ class GitHandler:
...
@@ -89,3 +89,20 @@ class GitHandler:
return
False
return
False
items
=
pl
.
repository_tree
(
path
=
HELM_PATH
,
ref
=
branch
)
items
=
pl
.
repository_tree
(
path
=
HELM_PATH
,
ref
=
branch
)
print
(
items
)
print
(
items
)
def
create_merge_request
(
self
,
repo_link
:
str
,
source_branch
:
str
,
destination_branch
:
str
):
base_url
=
os
.
environ
.
get
(
"GIT_BASE_URL"
,
default
=
default_link
)
repo_link_split
=
repo_link
.
split
(
base_url
)
if
not
repo_link_split
:
return
False
gl
=
gitlab
.
Gitlab
(
url
=
base_url
,
private_token
=
self
.
access_token
)
search_str
=
repo_link_split
[
-
1
]
.
replace
(
".git"
,
""
)
if
pl
:
=
gl
.
projects
.
list
(
search
=
search_str
):
pl
=
pl
[
0
]
else
:
return
False
pl
.
mergerequests
.
create
({
'source_branch'
:
source_branch
,
'target_branch'
:
destination_branch
,
'title'
:
f
'{source_branch} merge'
})
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