Skip to content

Commit

Permalink
Fixes the exit status of slave build. (sonic-net#12369)
Browse files Browse the repository at this point in the history
This PR fixes the issue reported in PR#12367
sonic-net#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.
  • Loading branch information
Kalimuthu-Velappan authored Oct 13, 2022
1 parent 7087763 commit 50b77a5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Makefile.work
Original file line number Diff line number Diff line change
Expand Up @@ -500,18 +500,19 @@ SONIC_BUILD_INSTRUCTION := $(MAKE) \


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

ifdef SOURCE_FOLDER
DOCKER_RUN += -v $(SOURCE_FOLDER):/var/$(USER)/src
endif

ifeq "$(KEEP_SLAVE_ON)" "yes"
SLAVE_SHELL={ /bin/bash; }
SLAVE_SHELL={ ret=\$$?; /bin/bash; exit \$$ret; }
endif

.DEFAULT_GOAL := all
.SHELLFLAGS += -e

%:: | sonic-build-hooks
ifneq ($(filter y, $(MULTIARCH_QEMU_ENVIRON) $(CROSS_BUILD_ENVIRON)),)
Expand All @@ -527,7 +528,7 @@ endif

$(Q)$(DOCKER_RUN) \
$(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)

docker-cleanup:
Expand Down

0 comments on commit 50b77a5

Please sign in to comment.