@@ -34,6 +34,8 @@ check_cli = type "$(1)" >/dev/null 2>&1 || { echo "Error: command '$(1)' require
3434check_image = make --silent list | grep -w '$(1 ) ' >/dev/null 2>&1 || { echo "Error: the image '$(1 ) ' does not exist in manifest for the platform 'linux/$(ARCH ) '. Please check the output of 'make list'. Exiting." ; exit 1 ; }
3535# # Base "docker buildx base" command to be reused everywhere
3636bake_base_cli := docker buildx bake -f docker-bake.hcl --load
37+ # # Default bake target
38+ bake_default_target := linux
3739
3840check-reqs :
3941# # Build requirements
@@ -71,21 +73,21 @@ shellcheck:
7173 @$(ROOT_DIR ) /tools/shellcheck -e SC1091 jenkins-support * .sh tests/test_helpers.bash tools/hadolint tools/shellcheck .ci/publish.sh
7274
7375# Build targets depending on the current architecture
74- build : check-reqs
75- @set -x; $(bake_base_cli ) --set ' *.platform=linux/$(ARCH)' $(shell make --silent list)
76+ build : check-reqs target
77+ @set -x; $(bake_base_cli ) --metadata-file=target/build-result-metadata_ $( bake_default_target ) .json -- set ' *.platform=linux/$(ARCH)' $(shell make --silent list)
7678
7779# Build targets depending on the architecture
78- buildarch-% : check-reqs showarch-%
79- @set -x; $(bake_base_cli ) --set ' *.platform=linux/$*' $(shell make --silent listarch-$* )
80+ buildarch-% : check-reqs target showarch-%
81+ @set -x; $(bake_base_cli ) --metadata-file=target/build-result-metadata_ $* .json -- set ' *.platform=linux/$*' $(shell make --silent listarch-$* )
8082
8183# Build a specific target with the current architecture
82- build-% : check-reqs show-%
84+ build-% : check-reqs target show-%
8385 @$(call check_image,$* )
84- @set -x; $(bake_base_cli ) --set ' *.platform=linux/$(ARCH)' ' $*'
86+ @set -x; $(bake_base_cli ) --metadata-file=target/build-result-metadata_ $* .json -- set ' *.platform=linux/$(ARCH)' ' $*'
8587
8688# Show all targets
8789show :
88- @set -x; make --silent show-linux
90+ @set -x; make --silent show-$( bake_default_target )
8991
9092# Show a specific target
9193show-% :
@@ -117,9 +119,12 @@ bats:
117119 cd bats ; \
118120 git checkout 3bca150ec86275d6d9d5a4fd7d48ab8b6c6f3d87; # v1.13.0
119121
120- # Ensure all bats submodules are up to date and that the tests target folder exists
121- prepare-test : bats check-reqs
122+ # Ensure all bats submodules are up to date
123+ prepare-test : bats check-reqs target
122124 git submodule update --init --recursive
125+
126+ # Ensure tests and build metadata "target" folder exist
127+ target :
123128 mkdir -p target
124129
125130# # Define bats options based on environment
@@ -159,7 +164,7 @@ test: prepare-test
159164 @make --silent list | while read image; do make --silent " test-$$ {image}" ; done
160165
161166# Set all required variables and publish all targets
162- publish :
167+ publish : target
163168 ./.ci/publish.sh
164169
165170clean :
0 commit comments