From a52a8fd6442ab19be52a5cf55ec37aa65cdce1fb Mon Sep 17 00:00:00 2001 From: D Chua Date: Wed, 27 Sep 2023 14:10:02 +0100 Subject: [PATCH] Fix release version in footer This has been broken since we moved to EKS and the SHA is no longer provided. We can use the [SENTRY_RELEASE](https://github.com/alphagov/govuk-helm-charts/blob/077117e7f40c096a958f9e0b853a2bd76cf43f26/charts/generic-govuk-app/templates/deployment.yaml#L92C1-L92C1) environment variable which is defined for every app and takes its value from the container image's tag. If for whatever reason the image tag is not defined it will display `null`, which should make it clearer (instead of displaying `development`) that this data is not being pulled in successfully. --- app/views/layouts/application.html.erb | 2 +- config/initializers/current_release_sha.rb | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) delete mode 100644 config/initializers/current_release_sha.rb diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index f3865dad2..40ec79483 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -50,7 +50,7 @@ <% end %> -<% content_for :footer_version, CURRENT_RELEASE_SHA %> +<% content_for :footer_version, ENV.fetch("SENTRY_RELEASE", "null")[0..18] %> <% content_for :body_end do %> <%= javascript_include_tag "application" %> diff --git a/config/initializers/current_release_sha.rb b/config/initializers/current_release_sha.rb deleted file mode 100644 index e68ebecc3..000000000 --- a/config/initializers/current_release_sha.rb +++ /dev/null @@ -1,6 +0,0 @@ -if File.exist?(Rails.root.join("REVISION")) - revision = `cat #{Rails.root}/REVISION`.chomp - CURRENT_RELEASE_SHA = revision[0..10] # Just get the short SHA -else - CURRENT_RELEASE_SHA = "development".freeze -end