Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
4383c794
Commit
4383c794
authored
6 years ago
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure we abort the cleanup if release is empty
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
314bb5d1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
6 deletions
+20
-6
scripts/review_apps/review-apps.sh
scripts/review_apps/review-apps.sh
+20
-6
No files found.
scripts/review_apps/review-apps.sh
View file @
4383c794
...
...
@@ -179,20 +179,34 @@ function delete() {
track
=
"
${
1
-stable
}
"
name
=
"
$CI_ENVIRONMENT_SLUG
"
if
[
-z
"
$CI_ENVIRONMENT_SLUG
"
]
;
then
echo
"No release given, aborting the delete!"
return
fi
if
[[
"
$track
"
!=
"stable"
]]
;
then
name
=
"
$name
-
$track
"
fi
if
!
deployExists
"
${
KUBE_NAMESPACE
}
"
"
${
name
}
"
;
then
echo
"The release
$name
doesn't exist, aborting the cleanup!"
return
fi
echo
"Deleting release '
$name
'..."
helm delete
--purge
"
$name
"
||
true
}
function
cleanup
()
{
echo
"Cleaning up
$CI_ENVIRONMENT_SLUG
..."
kubectl
-n
"
$KUBE_NAMESPACE
"
get ingress,svc,pdb,hpa,deploy,statefulset,job,pod,secret,configmap,pvc,secret,clusterrole,clusterrolebinding,role,rolebinding,sa 2>&1
\
|
grep
"
$CI_ENVIRONMENT_SLUG
"
\
|
awk
'{print $1}'
\
| xargs kubectl
-n
"
$KUBE_NAMESPACE
"
delete
\
if
[
-z
"
$CI_ENVIRONMENT_SLUG
"
]
;
then
echo
"No release given, aborting the delete!"
return
fi
echo
"Cleaning up '
$CI_ENVIRONMENT_SLUG
'..."
kubectl
-n
"
$KUBE_NAMESPACE
"
delete
\
ingress,svc,pdb,hpa,deploy,statefulset,job,pod,secret,configmap,pvc,secret,clusterrole,clusterrolebinding,role,rolebinding,sa
\
-l
release
=
"
$CI_ENVIRONMENT_SLUG
"
\
||
true
}
...
...
This diff is collapsed.
Click to expand it.
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