Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eval exit code of wrong $(shell) cmds #25

Merged
merged 1 commit into from
Dec 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Makefile.docker
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,13 @@ docker-load:
# Helper Targets
# -------------------------------------------------------------------------------------------------
.PHONY: docker-pull-base-image
_DOCKER_PULL_BASE_IMAGES_FOUND = $(shell grep FROM $(DIR)/$(FILE) | sed 's/^FROM\s*//g' | sed 's/\s.*$$//g' | sort -u )
_DOCKER_PULL_BASE_IMAGES_FOUND = $(shell \
if [ ! -f "$(DIR)/$(FILE)" ]; then \
echo "Error, Dockerfile not found in: $(DIR)/$(FILE)" >&2; \
exit 1; \
fi; \
grep FROM $(DIR)/$(FILE) | sed 's/^FROM\s*//g' | sed 's/\s.*$$//g' | sort -u \
)
DOCKER_PULL_VARIABLES = "VERSION=$(VERSION)"
docker-pull-base-image:
@echo "################################################################################"
Expand All @@ -209,6 +215,9 @@ docker-pull-base-image:
@if [ -n $(DOCKER_PULL_VARIABLES) ];then for e in $(DOCKER_PULL_VARIABLES);do export "$${e}";done;fi; echo "Images Found: $(_DOCKER_PULL_BASE_IMAGES_FOUND)"
@if [ -n $(DOCKER_PULL_VARIABLES) ];then for e in $(DOCKER_PULL_VARIABLES);do export "$${e}";done;fi; echo "Images Ignore: $(DOCKER_PULL_BASE_IMAGES_IGNORE)"
@echo
@if [ "$(.SHELLSTATUS)" != "0" ]; then \
exit 1; \
fi
# These variables will be exported to the shell
@if [ -n $(DOCKER_PULL_VARIABLES) ];then for e in $(DOCKER_PULL_VARIABLES);do export "$${e}";done;fi; \
echo $(_DOCKER_PULL_BASE_IMAGES_FOUND) | sed 's/\s/\n/g' | while read -r line; do \
Expand Down