[PATCH v3 compass-ci 1/3] lib/matrix2.rb: discard the no $suite related job

if job has suite, but no $suite related stats metric, then discard this job when create matrix. Signed-off-by: Lu Kaiyi <2392863668@qq.com> --- lib/matrix2.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/matrix2.rb b/lib/matrix2.rb index 2769f7c..ef5d935 100644 --- a/lib/matrix2.rb +++ b/lib/matrix2.rb @@ -82,10 +82,15 @@ def create_matrix(job_list) matrix = {} suites = [] job_list.each do |job| - suites << job['suite'] if job['suite'] stats = job['stats'] next unless stats + if job['suite'] + next unless stats.keys.any? { |stat| stat.start_with?(job['suite']) } + + suites << job['suite'] + end + stats.each do |key, value| next if key.include?('timestamp') -- 2.23.0

Looks good to me Thanks, Yuanchao On Mon, Dec 21, 2020 at 04:28:59PM +0800, Lu Kaiyi wrote:
if job has suite, but no $suite related stats metric, then discard this job when create matrix.
Signed-off-by: Lu Kaiyi <2392863668@qq.com> --- lib/matrix2.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/matrix2.rb b/lib/matrix2.rb index 2769f7c..ef5d935 100644 --- a/lib/matrix2.rb +++ b/lib/matrix2.rb @@ -82,10 +82,15 @@ def create_matrix(job_list) matrix = {} suites = [] job_list.each do |job| - suites << job['suite'] if job['suite'] stats = job['stats'] next unless stats
+ if job['suite'] + next unless stats.keys.any? { |stat| stat.start_with?(job['suite']) } + + suites << job['suite'] + end + stats.each do |key, value| next if key.include?('timestamp')
-- 2.23.0
participants (2)
-
Li Yuanchao
-
Lu Kaiyi