Skip to content

Commit

Permalink
add hotfix labelling
Browse files Browse the repository at this point in the history
  • Loading branch information
kitallis committed Nov 13, 2023
1 parent b9e6a6d commit fd06ed8
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 94 deletions.
7 changes: 7 additions & 0 deletions app/components/final_summary_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@
<dd class="text-gray-500">Commits in release</dd>
</div>

<% if hotfix? %>
<div class="flex flex-col text-center items-center justify-center">
<dt class="mb-2 text-xl font-extrabold"><%= overall.hotfixed_from %></dt>
<dd class="text-gray-500">Hotfix released from</dd>
</div>
<% end %>

<% if backmerges? %>
<div class="flex flex-col text-center items-center justify-center">
<dt class="mb-2 text-xl font-extrabold"><%= overall.backmerge_pr_count %></dt>
Expand Down
4 changes: 4 additions & 0 deletions app/components/final_summary_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ def backmerges?
release.continuous_backmerge?
end

def hotfix?
overall.is_hotfix
end

def staged_rollouts?(store_version)
store_version.staged_rollouts.present?
end
Expand Down
10 changes: 10 additions & 0 deletions app/helpers/releases_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,14 @@ def blocked_step_release_link(release)
link_text = release.ongoing? ? "current hotfix release" : "current ongoing release"
link_to link_text, release_url, class: "underline"
end

def release_title(release)
if release.hotfix?
concat content_tag :span, release.release_version.to_s, class: "pr-2"
concat inline_svg("band_aid.svg", classname: "w-6 align-middle inline-flex")
content_tag :span, "hotfix release", class: "ml-2 text-sm bg-amber-50 px-2 py-1"
else
release.release_version
end
end
end
9 changes: 8 additions & 1 deletion app/libs/queries/release_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ class Queries::ReleaseSummary::Overall
attribute :backmerge_failure_count, :integer
attribute :commits_count, :integer
attribute :duration, :integer
attribute :is_hotfix, :boolean
attribute :hotfixed_from, :string

def self.from_release(release)
attributes = {
Expand All @@ -80,9 +82,14 @@ def self.from_release(release)
backmerge_pr_count: release.backmerge_prs.size,
backmerge_failure_count: release.backmerge_failure_count,
commits_count: release.all_commits.size,
duration: release.duration&.seconds
duration: release.duration&.seconds,
is_hotfix: release.hotfix?
}

if release.hotfix?
attributes[:hotfixed_from] = release.hotfixed_from.release_version
end

new(attributes)
end

Expand Down
1 change: 1 addition & 0 deletions app/models/release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Release < ApplicationRecord
include Passportable
include Taggable
include Versionable
include Displayable
include ActionView::Helpers::DateHelper
include Rails.application.routes.url_helpers
using RefinedString
Expand Down
2 changes: 1 addition & 1 deletion app/views/releases/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<!-- Left: Title -->
<div class="mb-4 sm:mb-0">
<h2 class="text-2xl md:text-3xl text-slate-800 font-bold">
<%= @release.release_version %>
<%= release_title(@release) %>
</h2>
</div>

Expand Down
88 changes: 0 additions & 88 deletions app/views/shared/live_release/_final_summary.html.erb

This file was deleted.

9 changes: 6 additions & 3 deletions app/views/shared/live_release/_kick_off.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<section>
<div class="mb-6">
<%= render partial: "shared/live_release/section_title", locals: {heading: "Kick-off", subheading: "#{time_ago_in_words(release.created_at)} ago"} %>
<%= render partial: "shared/live_release/section_title", locals: { heading: "Kick-off", subheading: "#{time_ago_in_words(release.created_at)} ago" } %>
</div>

<%= render MetaTableComponent.new do |mt| %>
Expand All @@ -12,8 +12,11 @@
<span class="underline"><%= link_to_external "#{release.branch_name} ↗", release.branch_url %></span>
<% end %>

<% mt.with_description("Type") do %>
<%= release.release_type %>
<% if release.hotfix? %>
<% mt.with_description("Type of release") do %>
<%= release.display_attr(:release_type) %>
<%= link_to_external "(hotfixed from #{release.hotfixed_from.release_version} ↗)", release.hotfixed_from.live_release_link, class: "underline" %>
<% end %>
<% end %>

<% mt.with_description("Backmerge Config") do %>
Expand Down
4 changes: 3 additions & 1 deletion app/views/trains/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,11 @@
<% if run.ongoing? %>
<span class="ml-2 py-0.5"><%= status_badge("ongoing", :routine) %></span>
<% end %>
<% if run.hotfix? %>
<span class="ml-2 py-0.5"><%= status_badge("hotfix", :routine) %></span>
<% end %>
<% end %>


<% row.with_cell do %>
<%= run.branch_name %>
<% end %>
Expand Down
4 changes: 4 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ en:
platform:
ios: "iOS"
android: "Android"
release:
release_type:
hotfix: "Hotfix"
release: "Release"
attributes:
integration:
categories:
Expand Down

0 comments on commit fd06ed8

Please sign in to comment.