validate yaml for extraneous fields in pkg build

Signed-off-by: Avi Deitcher <avi@deitcher.net>
This commit is contained in:
Avi Deitcher
2025-09-05 11:30:07 +03:00
committed by Avi Deitcher
parent 9da6903609
commit 358803fcc7
5 changed files with 34 additions and 3 deletions

View File

@@ -0,0 +1,2 @@
FROM alpine:3.22

View File

@@ -0,0 +1,7 @@
image: build-args-test
network: true
arches:
- amd64
- arm64
# should error out on this unknown field
unknownField: "abc"

View File

@@ -0,0 +1,19 @@
#!/bin/sh
# SUMMARY: Check that the build-args are correctly passed to Dockerfiles
# LABELS:
# REPEAT:
set -ex
# Source libraries. Uncomment if needed/defined
#. "${RT_LIB}"
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
# Test code goes here
RESULT=$(linuxkit pkg build --force . 2>&1 || echo FAILED)
if [ "${RESULT}" != "FAILED" ]; then
echo "Build should have failed with invalid yaml, instead was ${RESULT}"
fi
echo "Summary: correctly detected invalid yaml"
exit 0