remove self from context to avoid races

This commit is contained in:
Lance R. Vick 2024-02-11 07:36:22 -08:00
parent 0291039caf
commit 088bb4f08f
No known key found for this signature in database
GPG key ID: 8E47A1EC35A1551D
2 changed files with 4 additions and 3 deletions

View file

@ -1,9 +1,10 @@
#!/bin/bash
self=${1}
for each in $(find src/*/*/Containerfile); do
package=$(basename $(dirname ${each}))
digest_file=out/${package}/index.json
digest_line=""
[ "$package" == "$self" ] && continue
if [ -e ${digest_file} ]; then
printf -- ' --build-context %s=oci-layout://./out/%s' "${package}" "${package}"
fi

View file

@ -44,7 +44,7 @@ define build
$(if $(filter latest,$(VERSION)),,--build-arg VERSION=$(VERSION)) \
--output type=oci,rewrite-timestamp=true,force-compression=true,name=$(NAME),annotation.org.opencontainers.image.revision=$(REVISION),annotation.org.opencontainers.image.version=$(VERSION),tar=false,dest=out/$(NAME) \
--target $(TARGET) \
$(shell ./src/context.sh) \
$(shell ./src/context.sh $(NAME)) \
$(EXTRA_ARGS) \
$(NOCACHE_FLAG) \
-f src/$(CATEGORY)/$(NAME)/Containerfile \
@ -53,7 +53,7 @@ define build
$(eval TIMESTAMP := $(shell TZ=GMT date +"%Y-%m-%dT%H:%M:%SZ"))
mkdir -p out/ \
&& echo $(TIMESTAMP) $(BUILD_CMD) start >> out/build.log \
&& rm -rf out/$(NAME)/* \
&& rm -rf out/$(NAME) \
&& $(BUILD_CMD) \
&& echo $(TIMESTAMP) $(BUILD_CMD) end >> out/build.log;
endef