tekton-pipelines/catalog/test-node-static-image.sh
2026-09-08 15:39:31 +02:00

33 lines
1.1 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 'tar -C "$layer_dir" -cf layer.tar "$target_path"' "$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"