fix(blog-ci): create checkout directories as the build user

Start CDN containers at the shared volume root and enter the checkout from their scripts, avoiding root-owned directories created before clone-source runs.
This commit is contained in:
dahyeon committed 2026-11-18 22:04:51 +09:00
1 parent ccf2190592
commit 4336d923aa
2 files changed
+10 -2

No files matched your search

+5
View File
@@ -65,6 +65,11 @@ CI에서 source SHA + LF + PipelineRun UID의 SHA-256 앞 16자를
계산하고 같은 CDN 설정을 SSR·WASM에 컴파일합니다. BuildKit은 단일 solve에서 image와 local 계산하고 같은 CDN 설정을 SSR·WASM에 컴파일합니다. BuildKit은 단일 solve에서 image와 local
rootfs를 함께 내보냅니다. `/app/site`를 다시 빌드하지 않고 앱 저장소 `tools/cdn`으로 포장합니다. rootfs를 함께 내보냅니다. `/app/site`를 다시 빌드하지 않고 앱 저장소 `tools/cdn`으로 포장합니다.
CDN 단계의 `workingDir`는 공유 볼륨 루트인 `/workspace/build`로 두고, 스크립트에서
`cd /workspace/build/source`를 실행합니다. 아직 clone하지 않은 경로를 `workingDir`로
지정하면 컨테이너 준비 과정이 root 소유 디렉터리를 먼저 만들어 UID 1000의 Git 쓰기를
막을 수 있습니다. checkout 디렉터리는 `clone-source`가 직접 만들도록 유지합니다.
`pkg/`는 원본·br·gzip, `assets/`는 WOFF2 원본만 S3에 게시합니다. 나머지 공개 파일은 `pkg/`는 원본·br·gzip, `assets/`는 WOFF2 원본만 S3에 게시합니다. 나머지 공개 파일은
프로젝트 HTTPS 원본이 제공합니다. 모든 객체를 조건부 PUT 후 checksum-enabled HEAD로 프로젝트 HTTPS 원본이 제공합니다. 모든 객체를 조건부 PUT 후 checksum-enabled HEAD로
검사하며, 완료 매니페스트가 성공해야 CDN Task 결과와 후속 GitOps 갱신을 허용합니다. 검사하며, 완료 매니페스트가 성공해야 CDN Task 결과와 후속 GitOps 갱신을 허용합니다.
+5 -2
View File
@@ -258,7 +258,8 @@ spec:
test "$(git -C /workspace/build/source rev-parse HEAD)" = "$REVISION" test "$(git -C /workspace/build/source rev-parse HEAD)" = "$REVISION"
- name: prepare-cdn - name: prepare-cdn
image: docker.io/library/node:26.7.0-trixie-slim@sha256:5758d367d7b4f48b73a9bb3530e687e47efb289f3b43f9c0450a25225ae0db5d image: docker.io/library/node:26.7.0-trixie-slim@sha256:5758d367d7b4f48b73a9bb3530e687e47efb289f3b43f9c0450a25225ae0db5d
workingDir: /workspace/build/source # The checkout must be created by clone-source as UID 1000, not by container startup.
workingDir: /workspace/build
computeResources: computeResources:
requests: requests:
cpu: 100m cpu: 100m
@@ -282,6 +283,7 @@ spec:
script: | script: |
#!/bin/sh #!/bin/sh
set -eu set -eu
cd /workspace/build/source
npm ci --prefix tools/cdn --ignore-scripts --no-audit --no-fund npm ci --prefix tools/cdn --ignore-scripts --no-audit --no-fund
npm test --prefix tools/cdn npm test --prefix tools/cdn
node tools/cdn/cli.mjs check-config --release-result /workspace/build/release-id node tools/cdn/cli.mjs check-config --release-result /workspace/build/release-id
@@ -387,7 +389,7 @@ spec:
printf '%s' "$DIGEST" >"$DIGEST_RESULT_PATH" printf '%s' "$DIGEST" >"$DIGEST_RESULT_PATH"
- name: publish-cdn - name: publish-cdn
image: docker.io/library/node:26.7.0-trixie-slim@sha256:5758d367d7b4f48b73a9bb3530e687e47efb289f3b43f9c0450a25225ae0db5d image: docker.io/library/node:26.7.0-trixie-slim@sha256:5758d367d7b4f48b73a9bb3530e687e47efb289f3b43f9c0450a25225ae0db5d
workingDir: /workspace/build/source workingDir: /workspace/build
computeResources: computeResources:
requests: requests:
cpu: 250m cpu: 250m
@@ -418,6 +420,7 @@ spec:
script: | script: |
#!/bin/sh #!/bin/sh
set -eu set -eu
cd /workspace/build/source
node tools/cdn/cli.mjs package \ node tools/cdn/cli.mjs package \
--site-root /workspace/build/runtime/app/site \ --site-root /workspace/build/runtime/app/site \
--output-root /workspace/build/cdn \ --output-root /workspace/build/cdn \