diff --git a/lib/gitlab.rb b/lib/gitlab.rb index 7d260f9..e557d2c 100644 --- a/lib/gitlab.rb +++ b/lib/gitlab.rb @@ -14,14 +14,16 @@ module Gitlab # The FailedTest class encapsulates all the information related to a failed # test within a pipeline job. class FailedTest - attr_accessor :ref, :comment, :has_screenshot, :int_suite_version, :sequencescape_version, :limber_version, - :is_flaky + attr_accessor :ref, :comment, :has_screenshot, :environment, + :int_suite_version, :sequencescape_version, + :limber_version, :is_flaky def initialize(location, description, job_url, has_screenshot) @ref = location @comment = description @job_url = job_url @has_screenshot = has_screenshot + @environment = nil @int_suite_version = nil @sequencescape_version = nil @limber_version = nil @@ -154,10 +156,12 @@ def self.pipeline_status(pipeline) def self.extract_application_versions(html_summary) versions = {} if html_summary.include?('Application versions') - regex = %r{Application versions deployed in \w+ environment:(.*)

} + regex = %r{Application versions deployed in (?\w+) environment:(?.*)

} match = html_summary.match(regex) if match - match[1].strip.split('
').each do |line| + environment = match[:environment] + versions['environment'] = environment + match[:versions].strip.split('
').each do |line| next unless line.start_with?(' ') parts = line.strip.split diff --git a/lib/integration_suite.rb b/lib/integration_suite.rb index 1edabaa..0429fcd 100644 --- a/lib/integration_suite.rb +++ b/lib/integration_suite.rb @@ -4,23 +4,24 @@ require 'set' require_relative 'gitlab' -UNKNOWN_VERSION = CGI.escapeHTML('') +UNKNOWN = CGI.escapeHTML('') # The IntegrationSuite module encapsulates all the logic related to the # Integration Suite, its pipelines, and interations between applications. module IntegrationSuite def self.group_pipelines(pipelines) - # Group pipelines by int_suite, sequencescape, and limber versions. + # Group pipelines by environment, int_suite, sequencescape, and limber versions. grouped_pipelines = Hash.new { |hash, key| hash[key] = [] } pipelines.each do |pipeline| key = [ + pipeline['versions']['environment'], pipeline['versions']['int_suite'], pipeline['versions']['sequencescape'], pipeline['versions']['limber'] ] - next if key.include?(UNKNOWN_VERSION) # Skip pipelines with unknown versions + next if key.include?(UNKNOWN) # Skip pipelines with unknown versions next unless pipeline['tested?'] # Skip pipelines where tests were not executed grouped_pipelines[key] << pipeline @@ -61,15 +62,17 @@ def self.compile_pipelines(filters = {}) # Get the application versions gitlab_versions = Gitlab.application_versions(pipeline) || {} default_versions = { + 'environment' => '', 'int_suite' => pipeline['int_suite_version'], - 'sequencescape' => UNKNOWN_VERSION, - 'limber' => UNKNOWN_VERSION + 'sequencescape' => UNKNOWN, + 'limber' => UNKNOWN } versions = default_versions.merge(gitlab_versions) pipeline['versions'] = versions # Apply the versions to the failed tests for analysis pipeline['failed_tests'].each do |failed_test| + failed_test.environment = versions['environment'] failed_test.int_suite_version = versions['int_suite'] failed_test.sequencescape_version = versions['sequencescape'] failed_test.limber_version = versions['limber'] diff --git a/views/index.html.erb b/views/index.html.erb index 5787054..473b505 100644 --- a/views/index.html.erb +++ b/views/index.html.erb @@ -35,16 +35,17 @@ } .application-label { display: inline-block; - width: 1.4em; + padding-right: 0.2em; font-size: 0.9em; font-weight: bold; } .circle { display: inline-block; - width: 0.7em; - height: 0.7em; + width: 0.8em; + height: 0.8em; + vertical-align: middle; border-radius: 50%; - border: 1px solid #333; + border: 0.5px solid #aaa; } .status-success { color: var(--bs-success); @@ -61,6 +62,15 @@ .status-running { color: var(--bs-info); } + .env-uat { + background-color: var(--bs-danger); + } + .env-training { + background-color: var(--bs-success); + } + .env-production { + background-color: var(--bs-primary); + } @@ -127,7 +137,7 @@ <% pipelines.each do |pipeline| %>