38 lines
1.6 KiB
Bash
38 lines
1.6 KiB
Bash
#!/bin/sh
|
|
set -eu
|
|
|
|
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
catalog="$root/catalog/maidn-node-static-image.yaml"
|
|
tmp=$(mktemp -d)
|
|
trap 'rm -rf "$tmp"' EXIT
|
|
|
|
task() {
|
|
awk -v name="$1" '
|
|
/^---$/ { if (found) exit }
|
|
$0 == " name: " name { found=1 }
|
|
found { print }
|
|
' "$catalog"
|
|
}
|
|
|
|
[ "$(grep -c '^apiVersion: tekton.dev/v1$' "$catalog")" -eq 3 ]
|
|
[ "$(grep -c '^kind: Task$' "$catalog")" -eq 3 ]
|
|
[ "$(grep -cF 'runAsNonRoot: true' "$catalog")" -eq 3 ]
|
|
[ "$(grep -cF 'forgejo-registry-credentials' "$catalog")" -eq 1 ]
|
|
|
|
for name in maidn-git-clone maidn-node-static-build maidn-node-static-push; do
|
|
task "$name" > "$tmp/$name"
|
|
grep -qF " name: $name" "$tmp/$name"
|
|
grep -qF ' - name: source' "$tmp/$name"
|
|
done
|
|
|
|
grep -qF 'git clone "$REPOSITORY_URL" "$SOURCE_PATH"' "$tmp/maidn-git-clone"
|
|
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"
|