Commit d0b20742 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'alberts-336646' into 'master'

Fix broken review-cleanup job

See merge request gitlab-org/gitlab!66599
parents 2eba76ca 76798d8f
......@@ -2,7 +2,7 @@ review-cleanup:
extends:
- .default-retry
- .review:rules:review-cleanup
image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-helm3.5-kubectl1.17
image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-helm3-kubectl1.14
stage: prepare
environment:
name: review/auto-cleanup
......
......@@ -142,10 +142,13 @@ module Tooling
def resources_created_before_date(response, date)
items = JSON.parse(response)['items'] # rubocop:disable Gitlab/Json
items.filter_map do |item|
items.each_with_object([]) do |item, result|
item_created_at = Time.parse(item.dig('metadata', 'creationTimestamp'))
item.dig('metadata', 'name') if item_created_at < date
if item_created_at < date
resource_name = item.dig('metadata', 'name')
result << resource_name
end
end
rescue ::JSON::ParserError => ex
puts "Ignoring this JSON parsing error: #{ex}\n\nResponse was:\n#{response}" # rubocop:disable Rails/Output
......
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