perf(blog): cache CI builds and raise memory limits to 10Gi

This commit is contained in:
dahyeon committed 2026-11-17 21:52:03 +09:00
1 parent bb34391305
commit 83efb25978
3 files changed
+93 -31

No files matched your search

+60 -24
View File
@@ -70,43 +70,67 @@ kind: Task
metadata:
name: blog-quality
spec:
description: Check formatting, architecture, Rust tests, SSR, and WASM without runtime credentials.
description: Run the Dockerfile quality target with a branch-scoped registry cache and no runtime credentials.
params:
- name: environment
type: string
default: staging
workspaces:
- name: source
stepTemplate:
workingDir: $(workspaces.source.path)
env:
- name: CI
value: "true"
readOnly: true
- name: dockerconfig
readOnly: true
volumes:
- name: buildkit-state
emptyDir: {}
steps:
- name: verify-rust
image: docker.io/library/rust:1.100.0-trixie@sha256:e19840879045c951c905d0eaa9887f3439c62000e429963371b376bac8d38c31
image: docker.io/moby/buildkit:v0.31.1-rootless@sha256:946cf909534b789c9b84af75e6d4f8cb23c3b9cb387daec5ba0f4878a3e4647c
computeResources:
requests:
cpu: 500m
memory: 6Gi
limits:
cpu: "4"
memory: 8Gi
memory: 10Gi
securityContext:
privileged: false
allowPrivilegeEscalation: true
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
seccompProfile:
type: Unconfined
appArmorProfile:
type: Unconfined
volumeMounts:
- name: buildkit-state
mountPath: /home/user/.local/share/buildkit
env:
- name: PATH
value: /usr/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- name: CARGO_HOME
value: /usr/local/cargo
- name: CARGO_BUILD_JOBS
value: "1"
- name: CARGO_INCREMENTAL
value: "0"
- name: CARGO_PROFILE_DEV_DEBUG
value: "0"
- name: CARGO_PROFILE_TEST_DEBUG
value: "0"
- name: BUILDKITD_FLAGS
value: --oci-worker-no-process-sandbox
- name: DOCKER_CONFIG
value: $(workspaces.dockerconfig.path)
- name: SOURCE_DIR
value: $(workspaces.source.path)
- name: DEPLOY_ENV
value: $(params.environment)
- name: CACHE_REPOSITORY
value: registry.dahyeon.us/dahyeon/blog
script: |
#!/bin/sh
set -eu
rustup component add rustfmt
rustup target add wasm32-unknown-unknown
sh tools/ci/check.sh
case "$DEPLOY_ENV" in staging|prod) ;; *) echo 'Invalid deployment environment' >&2; exit 1;; esac
buildctl-daemonless.sh build \
--frontend dockerfile.v0 \
--local context="$SOURCE_DIR" \
--local dockerfile="$SOURCE_DIR" \
--opt filename=Dockerfile \
--opt target=quality \
--opt platform=linux/arm64 \
--import-cache "type=registry,ref=$CACHE_REPOSITORY:cache-quality-arm64-$DEPLOY_ENV" \
--import-cache "type=registry,ref=$CACHE_REPOSITORY:cache-release-arm64-$DEPLOY_ENV" \
--export-cache "type=registry,ref=$CACHE_REPOSITORY:cache-quality-arm64-$DEPLOY_ENV,mode=max,image-manifest=true,oci-mediatypes=true"
---
apiVersion: tekton.dev/v1
kind: Task
@@ -119,6 +143,9 @@ spec:
type: string
- name: image
type: string
- name: environment
type: string
default: staging
results:
- name: image-url
description: Published repository and unique tag.
@@ -193,7 +220,7 @@ spec:
memory: 2Gi
limits:
cpu: "4"
memory: 8Gi
memory: 10Gi
securityContext:
privileged: false
allowPrivilegeEscalation: true
@@ -218,18 +245,27 @@ spec:
value: $(workspaces.dockerconfig.path)
- name: IMAGE
value: $(params.image)
- name: DEPLOY_ENV
value: $(params.environment)
- name: CACHE_REPOSITORY
value: registry.dahyeon.us/dahyeon/blog
- name: METADATA_FILE
value: /workspace/build/build-metadata.json
script: |
#!/bin/sh
set -eu
printf '%s\n' "$IMAGE" | grep -Eq '^registry\.dahyeon\.us/dahyeon/blog:sha-[0-9a-f]{40}-[a-zA-Z0-9-]+$'
case "$DEPLOY_ENV" in staging|prod) ;; *) echo 'Invalid deployment environment' >&2; exit 1;; esac
buildctl-daemonless.sh build \
--frontend dockerfile.v0 \
--local context=/workspace/build/source \
--local dockerfile=/workspace/build/source \
--opt filename=Dockerfile \
--opt target=runtime \
--opt platform=linux/arm64 \
--import-cache "type=registry,ref=$CACHE_REPOSITORY:cache-release-arm64-$DEPLOY_ENV" \
--import-cache "type=registry,ref=$CACHE_REPOSITORY:cache-quality-arm64-$DEPLOY_ENV" \
--export-cache "type=registry,ref=$CACHE_REPOSITORY:cache-release-arm64-$DEPLOY_ENV,mode=max,image-manifest=true,oci-mediatypes=true" \
--output "type=image,name=$IMAGE,push=true" \
--metadata-file "$METADATA_FILE"
- name: record-digest