diff --git a/app/controllers/async_info_controller.rb b/app/controllers/async_info_controller.rb index 87a1ed8e8..8ae8e3744 100644 --- a/app/controllers/async_info_controller.rb +++ b/app/controllers/async_info_controller.rb @@ -29,7 +29,7 @@ class AsyncInfoController < ApplicationController set_surrogate_key_header "shell-version-endpoint" # shell_version will change on every deploy. # *Technically* could be only on changes to assets and shell, but this is more fool-proof. - shell_version = ApplicationConfig["RELEASE_FOOTPRINT"] + SiteConfig.admin_action_taken_at.to_s + shell_version = ForemInstance.deployed_at + SiteConfig.admin_action_taken_at.to_s render json: { version: shell_version }.to_json end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4f9ba680e..e51823fc1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -176,7 +176,7 @@ module ApplicationHelper end def release_adjusted_cache_key(path) - release_footprint = ApplicationConfig["RELEASE_FOOTPRINT"] + release_footprint = ForemInstance.deployed_at return path if release_footprint.blank? "#{path}-#{params[:locale]}-#{release_footprint}-#{SiteConfig.admin_action_taken_at.rfc3339}" diff --git a/app/models/forem_instance.rb b/app/models/forem_instance.rb new file mode 100644 index 000000000..c37f5a6c0 --- /dev/null +++ b/app/models/forem_instance.rb @@ -0,0 +1,9 @@ +class ForemInstance + def self.deployed_at + @deployed_at ||= ApplicationConfig["RELEASE_FOOTPRINT"].presence || ENV["HEROKU_RELEASE_CREATED_AT"].presence + end + + def self.latest_commit_id + @latest_commit_id ||= ApplicationConfig["FOREM_BUILD_SHA"].presence || ENV["HEROKU_SLUG_COMMIT"].presence + end +end diff --git a/app/views/admin/admin_portals/index.html.erb b/app/views/admin/admin_portals/index.html.erb index f05e447c1..3aed91fa0 100644 --- a/app/views/admin/admin_portals/index.html.erb +++ b/app/views/admin/admin_portals/index.html.erb @@ -2,11 +2,11 @@
Last deployed
-
<%= ApplicationConfig["RELEASE_FOOTPRINT"].presence || ENV["HEROKU_RELEASE_CREATED_AT"].presence || "Not Available" %>
+
<%= ForemInstance.deployed_at || "Not Available" %>
Latest Commit ID
-
<%= ApplicationConfig["FOREM_BUILD_SHA"].presence || ENV["HEROKU_SLUG_COMMIT"].presence || "Not Available" %>
+
<%= ForemInstance.latest_commit_id || "Not Available" %>
diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index 63b4bf5e3..0323f3f38 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -26,7 +26,8 @@ " - data-release-footprint="<%= ApplicationConfig["RELEASE_FOOTPRINT"] %>" + data-deployed-at="<%= ForemInstance.deployed_at %>" + data-latest-commit-id="<%= ForemInstance.latest_commit_id %>" data-ga-tracking="<%= SiteConfig.ga_tracking_id %>">