diff --git a/.env_sample b/.env_sample index 5522a57b6..a5fd1c47f 100644 --- a/.env_sample +++ b/.env_sample @@ -17,7 +17,8 @@ export RACK_TIMEOUT_WAIT_TIMEOUT=100_000 export RACK_TIMEOUT_SERVICE_TIMEOUT=100_000 # 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 export REDIS_URL="redis://localhost:6379" diff --git a/app/views/admin/admin_portals/index.html.erb b/app/views/admin/admin_portals/index.html.erb index e05a39169..f05e447c1 100644 --- a/app/views/admin/admin_portals/index.html.erb +++ b/app/views/admin/admin_portals/index.html.erb @@ -1,3 +1,15 @@ +
+
+
+
Last deployed
+
<%= ApplicationConfig["RELEASE_FOOTPRINT"].presence || ENV["HEROKU_RELEASE_CREATED_AT"].presence || "Not Available" %>
+
+
+
Latest Commit ID
+
<%= ApplicationConfig["FOREM_BUILD_SHA"].presence || ENV["HEROKU_SLUG_COMMIT"].presence || "Not Available" %>
+
+
+
<% admin_menu_items.each do |menu_item| %>
@@ -9,3 +21,4 @@
<% end %>
+
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 61f8c6843..3a3dcb462 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -48,6 +48,7 @@ RSpec.describe ApplicationHelper, type: :helper do it "includes SiteConfig.admin_action_taken_at" do Timecop.freeze do 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) end end diff --git a/spec/requests/admin/admin_portals_spec.rb b/spec/requests/admin/admin_portals_spec.rb index f203c60a6..b96332ee5 100644 --- a/spec/requests/admin/admin_portals_spec.rb +++ b/spec/requests/admin/admin_portals_spec.rb @@ -22,4 +22,22 @@ RSpec.describe "/admin", type: :request do expect(response.body).not_to include("Config: Profile Setup") 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