Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
Partition
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSDU
OSDU Data Platform
System
Partition
Commits
8bcc357d
Commit
8bcc357d
authored
8 months ago
by
Danylo Vanin (EPAM)
Browse files
Options
Downloads
Patches
Plain Diff
[GONRG-9896] Limit helm release cleanup to partition
parent
4b3c700a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!572
[GONRG-9896] Limit helm release cleanup to partition
Checking pipeline status
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
devops/gc/tests/clean_up/clean_up.sh
+17
-5
17 additions, 5 deletions
devops/gc/tests/clean_up/clean_up.sh
with
17 additions
and
5 deletions
devops/gc/tests/clean_up/clean_up.sh
+
17
−
5
View file @
8bcc357d
#!/usr/bin/env bash
# # This script performs cleanup operations for Kubernetes and Datastore test environments.
# It provides options to clean up Helm releases in a Kubernetes test namespace,
# clean up Datastore entries, or both. The Helm releases to be deleted are filtered
# based on a configurable variable GC_TEST_HELM_NAME, which defaults to "partition".
# Configurable variable
GC_TEST_HELM_NAME
=
${
GC_TEST_HELM_NAME
:-
partition
}
cluster_cleanup
()
{
#
c
heck
variable for namespace
#
C
heck
if the namespace contains the word "test"
if
[[
"
$GC_HELM_NAMESPACE
"
==
*
test
]]
then
#
uninstall partition helm releases
#
List all Helm releases in the namespace and uninstall those containing the value of GC_TEST_HELM_NAME
LIST
=
$(
helm
-n
$GC_HELM_NAMESPACE
list
-o
json | jq
-r
.[].name
)
for
RELEASE
in
$LIST
do
helm
-n
$GC_HELM_NAMESPACE
uninstall
$RELEASE
if
[[
"
$RELEASE
"
==
*
"
$GC_TEST_HELM_NAME
"
*
]]
;
then
helm
-n
$GC_HELM_NAMESPACE
uninstall
$RELEASE
fi
done
echo
"Cluster cleanup Finished"
else
...
...
@@ -19,16 +28,19 @@ cluster_cleanup() {
}
datastore_cleanup
()
{
# Install necessary packages and Python dependencies
apk add py3-pip python3-dev libffi-dev
pip
install
--upgrade
pip
pip
install
--upgrade
setuptools
pip
install
-q
-r
devops/gc/tests/clean_up/requirements.txt
# Run the datastore cleanup script
python3 devops/gc/tests/clean_up/datastore_clean_up.py
-p
"
$GC_PROJECT
"
-n
$PARTITION_NAMESPACE
--delete-all
echo
"Datastore cleanup finished"
}
# Enable script debugging and exit immediately if a command exits with a non-zero status
set
-ex
case
"
$1
"
in
...
...
@@ -43,6 +55,6 @@ case "$1" in
cluster_cleanup
datastore_cleanup
;;
*
)
echo
"You must setup option like --cluster
/
datastore
/
all"
echo
"You must set
up
an
option like --cluster
, --
datastore
, or --
all"
exit
1
;;
esac
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment