lib/command/cleanup_stale_apps.rb in cpl-1.0.0 vs lib/command/cleanup_stale_apps.rb in cpl-1.0.1
- old
+ new
@@ -49,9 +49,10 @@
gvcs.each do |gvc|
app_name = gvc["name"]
images = cp.image_query(app_name)["items"].filter { |item| item["name"].start_with?("#{app_name}:") }
image = latest_image_from(images, app_name: app_name, name_only: false)
+ next unless image
created_date = DateTime.parse(image["created"])
diff_in_days = (now - created_date).to_i
next unless diff_in_days >= stale_app_image_deployed_days