Skip to content

Commit 5b09272

Browse files
authored
Merge pull request sameersbn#2884 from kkimurak/issue/2866-fix-assets_webpack_manifest.json-not-found
Add build patch to prevent rake task assets:compile to remove assets dir
2 parents de1350b + 3885a45 commit 5b09272

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
diff --git a/lib/tasks/gitlab/assets.rake b/lib/tasks/gitlab/assets.rake
2+
index b8a6e7018767..5096d81ea63f 100644
3+
--- a/lib/tasks/gitlab/assets.rake
4+
+++ b/lib/tasks/gitlab/assets.rake
5+
@@ -96,7 +96,14 @@ namespace :gitlab do
6+
puts "Assets SHA256 for `HEAD`: #{Tasks::Gitlab::Assets.head_assets_sha256.inspect}"
7+
8+
if Tasks::Gitlab::Assets.head_assets_sha256 != Tasks::Gitlab::Assets.master_assets_sha256
9+
- FileUtils.rm_rf([Tasks::Gitlab::Assets::PUBLIC_ASSETS_DIR] + Dir.glob('app/assets/javascripts/locale/**/app.js'))
10+
+ # sameersbn/gitlab takes a cache of public_assets_dir by symlinking to volume to speedup relaunch (if relative url is used)
11+
+ # so do not remove the directory directly, empty instead
12+
+ # Dir.glob("*") ignores dotfiles (even it is fine to remove here), so list up children manually
13+
+ removal_targets = Dir.glob('app/assets/javascripts/locale/**/app.js')
14+
+ if Dir.exists?(Tasks::Gitlab::Assets::PUBLIC_ASSETS_DIR)
15+
+ removal_targets += Dir.children(Tasks::Gitlab::Assets::PUBLIC_ASSETS_DIR).map {|child| File.join(Tasks::Gitlab::Assets::PUBLIC_ASSETS_DIR, child)}
16+
+ end
17+
+ FileUtils.rm_rf(removal_targets, secure: true)
18+
19+
# gettext:compile needs to run before rake:assets:precompile because
20+
# app/assets/javascripts/locale/**/app.js are pre-compiled by Sprockets

0 commit comments

Comments
 (0)