diff options
Diffstat (limited to 'app/services/ci/generate_coverage_reports_service.rb')
-rw-r--r-- | app/services/ci/generate_coverage_reports_service.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/services/ci/generate_coverage_reports_service.rb b/app/services/ci/generate_coverage_reports_service.rb index 12b1f19f4b5..81f26e84ef8 100644 --- a/app/services/ci/generate_coverage_reports_service.rb +++ b/app/services/ci/generate_coverage_reports_service.rb @@ -32,5 +32,18 @@ module Ci def latest?(base_pipeline, head_pipeline, data) data&.fetch(:key, nil) == key(base_pipeline, head_pipeline) end + + private + + def key(base_pipeline, head_pipeline) + [ + base_pipeline&.id, last_update_timestamp(base_pipeline), + head_pipeline&.id, last_update_timestamp(head_pipeline) + ] + end + + def last_update_timestamp(pipeline_hierarchy) + pipeline_hierarchy&.self_and_descendants&.maximum(:updated_at) + end end end |