Merge pull request 'fix: bound static build memory' (#3) from fix/static-build-resource-contract into main

Reviewed-on: #3
This commit is contained in:
eding 2026-09-12 23:36:23 +02:00
commit 16cf6f66f3
2 changed files with 18 additions and 1 deletions

View file

@ -91,6 +91,13 @@ spec:
value: $(params.target-directory)
- name: BUILD_CONFIGURATION
value: $(params.build-configuration)
- name: NODE_OPTIONS
value: --max-old-space-size=384
resources:
requests:
memory: 256Mi
limits:
memory: 512Mi
script: |
#!/bin/sh
set -eu
@ -111,6 +118,11 @@ spec:
mkdir -p "$layer_dir/$target_path"
cp -R "$OUTPUT_DIRECTORY"/. "$layer_dir/$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
kind: Task

View file

@ -26,7 +26,12 @@ for name in maidn-git-clone maidn-node-static-build maidn-node-static-push; do
done
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 ' - append' "$tmp/maidn-node-static-push"
grep -qF 'mountPath: /tekton/home/.docker' "$tmp/maidn-node-static-push"