Add application deployment information to the admin page (#12149)
* WIP: release footprint in the admin UI * feat: show the commit ID and the date * chore: change env optional to empty string * fix: change the FOREM_BUILD_DATE to RELEASE_FOOTPRINT * feat: add Not Available as a last option * test: last deployed time and latest commit id * feat: update the way we change the env variable! * fix: we need to set the RELEASE FOOTPRINT so that this clause is not hit - `return path if release_footprint.blank?`
This commit is contained in:
parent
ccc5aa6d11
commit
ebfe0ead2d
4 changed files with 34 additions and 1 deletions
|
|
@ -17,7 +17,8 @@ export RACK_TIMEOUT_WAIT_TIMEOUT=100_000
|
||||||
export RACK_TIMEOUT_SERVICE_TIMEOUT=100_000
|
export RACK_TIMEOUT_SERVICE_TIMEOUT=100_000
|
||||||
|
|
||||||
# Heroku release slug used to bust caches on deploys
|
# Heroku release slug used to bust caches on deploys
|
||||||
export HEROKU_SLUG_COMMIT="Optional"
|
export HEROKU_RELEASE_CREATED_AT=""
|
||||||
|
export HEROKU_SLUG_COMMIT=""
|
||||||
|
|
||||||
# Redis caching storage
|
# Redis caching storage
|
||||||
export REDIS_URL="redis://localhost:6379"
|
export REDIS_URL="redis://localhost:6379"
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,15 @@
|
||||||
|
<div>
|
||||||
|
<div class="tag-card crayons-card p-4 m:p-6 m:pt-4 mb-4 flex flex-row relative">
|
||||||
|
<div class="mr-8">
|
||||||
|
<div class="crayons-field__description">Last deployed</div>
|
||||||
|
<div><%= ApplicationConfig["RELEASE_FOOTPRINT"].presence || ENV["HEROKU_RELEASE_CREATED_AT"].presence || "Not Available" %></div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="crayons-field__description">Latest Commit ID</div>
|
||||||
|
<div><%= ApplicationConfig["FOREM_BUILD_SHA"].presence || ENV["HEROKU_SLUG_COMMIT"].presence || "Not Available" %></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="grid gap-2 m:gap-4 l:gap-6 m:grid-cols-2 l:grid-cols-3 px-2 m:px-0">
|
<div class="grid gap-2 m:gap-4 l:gap-6 m:grid-cols-2 l:grid-cols-3 px-2 m:px-0">
|
||||||
<% admin_menu_items.each do |menu_item| %>
|
<% admin_menu_items.each do |menu_item| %>
|
||||||
<div class="tag-card crayons-card branded-4 p-4 m:p-6 m:pt-4 flex flex-col relative">
|
<div class="tag-card crayons-card branded-4 p-4 m:p-6 m:pt-4 flex flex-col relative">
|
||||||
|
|
@ -9,3 +21,4 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ RSpec.describe ApplicationHelper, type: :helper do
|
||||||
it "includes SiteConfig.admin_action_taken_at" do
|
it "includes SiteConfig.admin_action_taken_at" do
|
||||||
Timecop.freeze do
|
Timecop.freeze do
|
||||||
allow(SiteConfig).to receive(:admin_action_taken_at).and_return(5.minutes.ago)
|
allow(SiteConfig).to receive(:admin_action_taken_at).and_return(5.minutes.ago)
|
||||||
|
allow(ApplicationConfig).to receive(:[]).with("RELEASE_FOOTPRINT").and_return("abc123")
|
||||||
expect(helper.release_adjusted_cache_key("cache-me")).to include(SiteConfig.admin_action_taken_at.rfc3339)
|
expect(helper.release_adjusted_cache_key("cache-me")).to include(SiteConfig.admin_action_taken_at.rfc3339)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,22 @@ RSpec.describe "/admin", type: :request do
|
||||||
expect(response.body).not_to include("Config: Profile Setup")
|
expect(response.body).not_to include("Config: Profile Setup")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "Last deployed and Lastest Commit ID card" do
|
||||||
|
it "shows 'Not Available' if the Last deployed time is missing" do
|
||||||
|
stub_const("ENV", ENV.to_h.merge("HEROKU_RELEASE_CREATED_AT" => ""))
|
||||||
|
|
||||||
|
get admin_path
|
||||||
|
|
||||||
|
expect(response.body).to include("Not Available")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "shows the correct value if the Last deployed time is available" do
|
||||||
|
stub_const("ENV", ENV.to_h.merge("HEROKU_RELEASE_CREATED_AT" => "Some date"))
|
||||||
|
|
||||||
|
get admin_path
|
||||||
|
|
||||||
|
expect(response.body).to include(ENV["HEROKU_RELEASE_CREATED_AT"])
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue