summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-24 09:06:18 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-24 09:06:18 +0000
commitdc0622dbe3cd552abca4107557c6c09edb23625c (patch)
tree224dc625a2fe70a37ea7af11b1ad539b9bee2212 /scripts
parent12287a65b735d784cda3555d1b261e50b461b29e (diff)
downloadgitlab-ce-dc0622dbe3cd552abca4107557c6c09edb23625c.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/review_apps/automated_cleanup.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/review_apps/automated_cleanup.rb b/scripts/review_apps/automated_cleanup.rb
index da6652d603b..2b4f1b9fe0b 100755
--- a/scripts/review_apps/automated_cleanup.rb
+++ b/scripts/review_apps/automated_cleanup.rb
@@ -58,8 +58,11 @@ class AutomatedCleanup
checked_environments = []
delete_threshold = threshold_time(days: days_for_delete)
stop_threshold = threshold_time(days: days_for_stop)
+ deployments_look_back_threshold = threshold_time(days: days_for_delete * 5)
+
+ gitlab.deployments(project_path, per_page: DEPLOYMENTS_PER_PAGE, sort: 'desc').auto_paginate do |deployment|
+ break if Time.parse(deployment.created_at) < deployments_look_back_threshold
- gitlab.deployments(project_path, per_page: DEPLOYMENTS_PER_PAGE).auto_paginate do |deployment|
environment = deployment.environment
next unless environment
@@ -89,6 +92,9 @@ class AutomatedCleanup
threshold_day = threshold_time(days: days)
helm_releases.each do |release|
+ # Prevents deleting `dns-gitlab-review-app` releases or other unrelated releases
+ next unless release.name.start_with?('review-')
+
if release.status == 'FAILED' || release.last_update < threshold_day
delete_helm_release(release)
else