Commit 0ab28957 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'stop-environment-before-deleting-review-app-docs' into 'master'

Stop environment before deleting

See merge request gitlab-org/gitlab!69271
parents f696be66 be9a53ac
......@@ -115,14 +115,16 @@ class AutomatedCleanup
last_deploy = deployment.created_at
deployed_at = Time.parse(last_deploy)
if deployed_at < stop_threshold
environment_state = fetch_environment(environment)&.state
stop_environment(environment, deployment) if environment_state && environment_state != 'stopped'
end
if deployed_at < delete_threshold
delete_environment(environment, deployment)
delete_count += 1
break if delete_count > max_delete_count
elsif deployed_at < stop_threshold
environment_state = fetch_environment(environment)&.state
stop_environment(environment, deployment) if environment_state && environment_state != 'stopped'
end
checked_environments << environment.slug
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment