mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-09-02 23:47:11 +00:00
Declare build-args in build.yml
This allows multiple build flavors for a single codebase, without sacrificing reproducible builds. The build-args are set in build.yml, which is typically under the source control (if it is not, then no reproducible builds are possible anyways). Meaning that mutating build-args would result in setting "dirty" flag. Intended use of this commit is to switch between build flavors by specifying a different yaml file (presumably also under the version control) by `-build-yml` option. Because it is impossible to build a final image from packages in cache, the test for this feature relies on the `RUN echo $build-arg` output during the `pkg build` process. Signed-off-by: Yuri Volchkov <yuri@zededa.com>
This commit is contained in:
7
test/cases/000_build/030_build_args/Dockerfile
Normal file
7
test/cases/000_build/030_build_args/Dockerfile
Normal file
@@ -0,0 +1,7 @@
|
||||
FROM alpine:3.13
|
||||
|
||||
ARG TEST_RESULT=FAILED
|
||||
|
||||
RUN echo "printf \"Build-arg test $TEST_RESULT\\n\"" >> check.sh
|
||||
|
||||
ENTRYPOINT ["/bin/sh", "/check.sh"]
|
7
test/cases/000_build/030_build_args/build.yml
Normal file
7
test/cases/000_build/030_build_args/build.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
image: build-args-test
|
||||
network: true
|
||||
arches:
|
||||
- amd64
|
||||
- arm64
|
||||
buildArgs:
|
||||
- TEST_RESULT=PASSED
|
18
test/cases/000_build/030_build_args/test.sh
Executable file
18
test/cases/000_build/030_build_args/test.sh
Executable 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 Linuxkig is "$(which linuxkit)"
|
||||
RESULT="$(2>&1 linuxkit pkg build --force . | grep PASSED)"
|
||||
echo RESULT="${RESULT}"
|
||||
echo "${RESULT}" | grep "Build-arg test PASSED"
|
||||
|
||||
exit 0
|
Reference in New Issue
Block a user