fix: bound static build memory

This commit is contained in:
eding 2026-09-12 19:52:36 +02:00
parent 4ce86da69f
commit 2e7854f629
2 changed files with 18 additions and 1 deletions

View file

@ -91,6 +91,13 @@ spec:
value: $(params.target-directory) value: $(params.target-directory)
- name: BUILD_CONFIGURATION - name: BUILD_CONFIGURATION
value: $(params.build-configuration) value: $(params.build-configuration)
- name: NODE_OPTIONS
value: --max-old-space-size=384
resources:
requests:
memory: 256Mi
limits:
memory: 512Mi
script: | script: |
#!/bin/sh #!/bin/sh
set -eu set -eu
@ -111,6 +118,11 @@ spec:
mkdir -p "$layer_dir/$target_path" mkdir -p "$layer_dir/$target_path"
cp -R "$OUTPUT_DIRECTORY"/. "$layer_dir/$target_path/" cp -R "$OUTPUT_DIRECTORY"/. "$layer_dir/$target_path/"
tar -C "$layer_dir" -cf "$SOURCE_PATH/layer.tar" "$target_path" tar -C "$layer_dir" -cf "$SOURCE_PATH/layer.tar" "$target_path"
for memory_peak_path in /sys/fs/cgroup/memory.peak /sys/fs/cgroup/memory/memory.max_usage_in_bytes; do
if [ -r "$memory_peak_path" ] && memory_peak=$(cat "$memory_peak_path"); then
case "$memory_peak" in ''|*[!0-9]*) ;; *) printf 'cgroup memory peak: %s\n' "$memory_peak"; break ;; esac
fi
done
--- ---
apiVersion: tekton.dev/v1 apiVersion: tekton.dev/v1
kind: Task kind: Task

View file

@ -26,7 +26,12 @@ for name in maidn-git-clone maidn-node-static-build maidn-node-static-push; do
done done
grep -qF 'git clone "$REPOSITORY_URL" "$SOURCE_PATH"' "$tmp/maidn-git-clone" grep -qF 'git clone "$REPOSITORY_URL" "$SOURCE_PATH"' "$tmp/maidn-git-clone"
grep -qF 'tar -C "$layer_dir" -cf layer.tar "$target_path"' "$tmp/maidn-node-static-build" grep -qF 'value: --max-old-space-size=384' "$tmp/maidn-node-static-build"
grep -qF 'memory: 256Mi' "$tmp/maidn-node-static-build"
grep -qF 'memory: 512Mi' "$tmp/maidn-node-static-build"
grep -qF 'tar -C "$layer_dir" -cf "$SOURCE_PATH/layer.tar" "$target_path"' "$tmp/maidn-node-static-build"
grep -qF 'for memory_peak_path in /sys/fs/cgroup/memory.peak /sys/fs/cgroup/memory/memory.max_usage_in_bytes; do' "$tmp/maidn-node-static-build"
grep -qF "if [ -r \"\$memory_peak_path\" ] && memory_peak=\$(cat \"\$memory_peak_path\"); then" "$tmp/maidn-node-static-build"
grep -qF 'image: gcr.io/go-containerregistry/crane:v0.21.7' "$tmp/maidn-node-static-push" grep -qF 'image: gcr.io/go-containerregistry/crane:v0.21.7' "$tmp/maidn-node-static-push"
grep -qF ' - append' "$tmp/maidn-node-static-push" grep -qF ' - append' "$tmp/maidn-node-static-push"
grep -qF 'mountPath: /tekton/home/.docker' "$tmp/maidn-node-static-push" grep -qF 'mountPath: /tekton/home/.docker' "$tmp/maidn-node-static-push"