diff --git a/.gitlab/ci/rules.gitlab-ci.yml b/.gitlab/ci/rules.gitlab-ci.yml
index cdb455c8c312d23cd4f3eabe661b1a19758f2742..d8162d108bad76394594b053adba49b4f02387ca 100644
--- a/.gitlab/ci/rules.gitlab-ci.yml
+++ b/.gitlab/ci/rules.gitlab-ci.yml
@@ -283,6 +283,7 @@
 # This list should match the list in Tasks::Gitlab::Assets.assets_impacting_compilation
 .assets-compilation-patterns: &assets-compilation-patterns
   - "{package.json,yarn.lock}"
+  - "{Gemfile,Gemfile.lock}"
   - ".browserslistrc"
   - "babel.config.js"
   - "config/webpack.config.js"
diff --git a/lib/tasks/gitlab/assets.rake b/lib/tasks/gitlab/assets.rake
index 0936430a0f24b2777e5df0fae193d64281975b11..5d6d395037c23173a986f369001b6c084870b01f 100644
--- a/lib/tasks/gitlab/assets.rake
+++ b/lib/tasks/gitlab/assets.rake
@@ -55,6 +55,9 @@ module Tasks
         Digest::SHA256.hexdigest(assets_sha256).tap { |sha256| puts "=> SHA256 generated in #{Time.now - start_time}: #{sha256}" if verbose }
       end
 
+      # Files listed here should match the list in:
+      # .assets-compilation-patterns in .gitlab/ci/rules.gitlab-ci.yml
+      # So we make sure that any impacting changes we do rebuild cache
       def self.assets_impacting_compilation
         assets_folders = FOSS_ASSET_FOLDERS
         assets_folders += EE_ASSET_FOLDERS if ::Gitlab.ee?