From 8ccf1ea3103719962c7f026307de72f2ade5fa4f Mon Sep 17 00:00:00 2001 From: Lukas Eipert Date: Fri, 8 Feb 2019 13:11:15 +0100 Subject: [PATCH] Use correct integrity hash for sprockets caching Use self.integrity_uri over self.hexdigest_integrity_uri(digest), as the latter always returned nil leading to improper cache invalidation. We are alos enabling caching of `tmp/cache/assets/sprockets` again, to get those performance gains. --- .gitlab-ci.yml | 6 ++---- lib/gitlab/patch/sprockets_base_file_digest_key.rb | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4e8453726a3..1ea9ce1f497 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -388,13 +388,11 @@ flaky-examples-check: .assets-compile-cache: &assets-compile-cache cache: - key: "assets-compile:vendor_ruby:.yarn-cache:tmp_cache_assets_sprockets:v4" + key: "assets-compile:vendor_ruby:.yarn-cache:tmp_cache_assets_sprockets:v5" paths: - vendor/ruby/ - .yarn-cache/ - # We have disabled caching of sprockets for now, as it fails to pick up changes in SCSS: - # https://gitlab.com/gitlab-org/gitlab-ce/issues/57431 - # - tmp/cache/assets/sprockets + - tmp/cache/assets/sprockets compile-assets: <<: *dedicated-runner diff --git a/lib/gitlab/patch/sprockets_base_file_digest_key.rb b/lib/gitlab/patch/sprockets_base_file_digest_key.rb index 3925cdbbada..1c472638145 100644 --- a/lib/gitlab/patch/sprockets_base_file_digest_key.rb +++ b/lib/gitlab/patch/sprockets_base_file_digest_key.rb @@ -9,7 +9,7 @@ module Gitlab def file_digest(path) if stat = self.stat(path) digest = self.stat_digest(path, stat) - integrity_uri = self.hexdigest_integrity_uri(digest) + integrity_uri = self.integrity_uri(digest) key = Sprockets::UnloadedAsset.new(path, self).file_digest_key(integrity_uri) cache.fetch(key) do