Repository navigation
perf(build): inline cache persist qua các lần build - #9
Merged
Merged
Conversation
…cài đặt/vite) Khi buildkit local của runner bị dọn hoặc đổi runner, layer cài đặt native + vite phải làm lại từ đầu (chậm ~8-10p). Thêm inline cache: --cache-from thẻ cache trôi theo nhánh (BR=môi trường, staging↔prod không lẫn) + BUILDKIT_INLINE_CACHE=1 nhúng cache vào image; sau build đẩy thẻ <image>:<BR>-buildcache cho lần sau phục hồi. An toàn ngược: cache-from thiếu (lần đầu) buildkit bỏ qua không lỗi; push thẻ cache non-fatal (hỏng chỉ mất cache lần sau, không vỡ build). Không đổi driver, không thêm storage registry riêng (inline).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Vấn đề
reusable-build.yml dùng
docker buildtrơn; cache mount yarn chỉ cache DOWNLOAD. Khi buildkit local của self-hosted runner bị prune hoặc đổi runner, layer cài đặt native (better-sqlite3/swc/esbuild) + vite build phải làm lại từ đầu (~8-10p mỗi build). Đây là phần lớn thời gian build chậm (ngoài việc 1 runner → queue).Thay đổi (chỉ step Build)
--cache-from <image>:<BR>-buildcache(thẻ cache trôi theo NHÁNH = môi trường → staging/prod không lẫn).--build-arg BUILDKIT_INLINE_CACHE=1(nhúng metadata cache vào image build ra).docker tag + push <image>:<BR>-buildcachenon-fatal cho lần sau phục hồi layer.An toàn ngược (quan trọng — workflow DÙNG CHUNG mọi repo)
Test plan (trước khi merge)
Trỏ 1 repo (smart-class) gitops-deploy sang
reusable-build.yml@perf/build-inline-cache, chạy 2 build liên tiếp: build 2 phải nhanh hơn rõ (phục hồi layer). Rồi merge main + trả ref @main.Không merge mù — nhờ chủ infra review (ảnh hưởng mọi repo Techainer).