Fixes the exit status of slave build. (#12369)

This PR fixes the issue reported in PR#12367
https://github.com/sonic-net/sonic-buildimage/pull/12367

The issue is that exit code always being 0 for the builds that are failed.

Fix is added in the Makefile.work to return the error code
when the slave build is failed with an error.
This commit is contained in:
Kalimuthu-Velappan 2022-10-13 20:29:09 +05:30 committed by GitHub
parent 7087763af4
commit 50b77a5d44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -500,7 +500,7 @@ SONIC_BUILD_INSTRUCTION := $(MAKE) \
ifeq ($(filter clean,$(MAKECMDGOALS)),) ifeq ($(filter clean,$(MAKECMDGOALS)),)
COLLECT_BUILD_VERSION = { DBGOPT='$(DBGOPT)' scripts/collect_build_version_files.sh $$?; } COLLECT_BUILD_VERSION = { DBGOPT='$(DBGOPT)' scripts/collect_build_version_files.sh \$$?; }
endif endif
ifdef SOURCE_FOLDER ifdef SOURCE_FOLDER
@ -508,10 +508,11 @@ ifdef SOURCE_FOLDER
endif endif
ifeq "$(KEEP_SLAVE_ON)" "yes" ifeq "$(KEEP_SLAVE_ON)" "yes"
SLAVE_SHELL={ /bin/bash; } SLAVE_SHELL={ ret=\$$?; /bin/bash; exit \$$ret; }
endif endif
.DEFAULT_GOAL := all .DEFAULT_GOAL := all
.SHELLFLAGS += -e
%:: | sonic-build-hooks %:: | sonic-build-hooks
ifneq ($(filter y, $(MULTIARCH_QEMU_ENVIRON) $(CROSS_BUILD_ENVIRON)),) ifneq ($(filter y, $(MULTIARCH_QEMU_ENVIRON) $(CROSS_BUILD_ENVIRON)),)
@ -527,7 +528,7 @@ endif
$(Q)$(DOCKER_RUN) \ $(Q)$(DOCKER_RUN) \
$(SLAVE_IMAGE):$(SLAVE_TAG) \ $(SLAVE_IMAGE):$(SLAVE_TAG) \
bash -c "$(SONIC_BUILD_INSTRUCTION) $@;$(COLLECT_BUILD_VERSION); $(SLAVE_SHELL)" bash -c "$(SONIC_BUILD_INSTRUCTION) $@; $(COLLECT_BUILD_VERSION); $(SLAVE_SHELL)"
$(Q)$(docker-image-cleanup) $(Q)$(docker-image-cleanup)
docker-cleanup: docker-cleanup: