include source repo, revision and go package version as build-args

Signed-off-by: Avi Deitcher <avi@deitcher.net>
This commit is contained in:
Avi Deitcher
2023-06-08 18:16:44 +03:00
parent aad12b570f
commit de13ee521d
7 changed files with 109 additions and 4 deletions

View File

@@ -10,7 +10,7 @@ set -ex
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
# Test code goes here
echo Linuxkig is "$(which linuxkit)"
echo Linuxkit is "$(which linuxkit)"
RESULT="$(2>&1 linuxkit pkg build --force . | grep PASSED)"
echo RESULT="${RESULT}"
echo "${RESULT}" | grep "Build-arg test PASSED"

View File

@@ -0,0 +1,11 @@
FROM alpine:3.17
ARG SOURCE=FAILED
ARG REVISION=FAILED
ARG GOPKGVERSION=FAILED
RUN echo "printf \"Build-arg test source $SOURCE\\n\"" >> check.sh
RUN echo "printf \"Build-arg test revision $REVISION\\n\"" >> check.sh
RUN echo "printf \"Build-arg test gopkgversion $GOPKGVERSION\\n\"" >> check.sh
ENTRYPOINT ["/bin/sh", "/check.sh"]

View File

@@ -0,0 +1,5 @@
image: build-args-test
network: true
arches:
- amd64
- arm64

View File

@@ -0,0 +1,18 @@
#!/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
echo Linuxkit is "$(which linuxkit)"
RESULT="$(2>&1 linuxkit pkg build --force . | grep 'Build-arg test' || echo)"
echo RESULT="${RESULT}"
echo "${RESULT}" | grep -v "FAILED"
exit 0