Repository navigation
ci(image): build images on an in-cluster BuildKit in the staging cluster - #237
Merged
Merged
Conversation
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.
背景
GitHub 托管 runner 直推火山 CR 实测 19 KB/s(2 MiB 分片上传 110s):
冷构建 push 耗时 2h30m、增量构建 25.5 分钟,每次 main-v2 合并都会跑一次,不可用。
仓库里现成可用的凭据里,只有 staging 集群 kubeconfig(
STAGING_KUBECONFIG_B64,staging environment,无审批)能在GitHub runner 上访问,且集群与 CR 同区域。因此把镜像构建/推送搬到集群内,不新增任何运维配置。
改动
keystone-image.yml:environment: staging,用已有的STAGING_KUBECONFIG_B64配置 kubeconfig;keystone-image-buildnamespace 里创建:cr-pullimagePullSecret(用现有 CR 账号密码);buildkit-cache(ebs-ssd,40Gi),作为 BuildKit 构建缓存;upstream/buildkit:buildx-stable-1);kubectl port-forward连到该 BuildKit(--driver remote),构建上下文(约 5-9MB)经 port-forward 上传;if: always();concurrency: keystone-image串行化(PVC 是 RWO);allowNonMainV2Branchworkflow_dispatch 开关,便于从开发分支手动验证。实测(本分支 dispatch 两次,都成功)
对比改造前:push 2h30m(冷)/ 25.5 分钟(增量)。
注意
keystone-image-buildnamespace 与 40Gi PVC 会保留下来做缓存;