Allow build image with local changes for debug purpose (#247)
* Allow build with local change for debug purpose Uncomment DEBUG_BUILD = y in rule.mk/config to enable local build
This commit is contained in:
parent
7e9f6b4e12
commit
f5b2dccee9
1
Makefile
1
Makefile
@ -31,6 +31,7 @@ DOCKER_BUILD = docker build --no-cache \
|
|||||||
-f slave.mk \
|
-f slave.mk \
|
||||||
PLATFORM=$(PLATFORM) \
|
PLATFORM=$(PLATFORM) \
|
||||||
SKU=$(SKU) \
|
SKU=$(SKU) \
|
||||||
|
DEBUG_BUILD=$(DEBUG_BUILD) \
|
||||||
$@
|
$@
|
||||||
|
|
||||||
sonic-slave-build :
|
sonic-slave-build :
|
||||||
|
@ -13,11 +13,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
## Retrieval short version of Git revision hash for partition metadata
|
## Retrieval short version of Git revision hash for partition metadata
|
||||||
[ -z "$(git status --untracked-files=no -s --ignore-submodules)" ] || {
|
if [ -z "$(git status --untracked-files=no -s --ignore-submodules)" ]; then
|
||||||
echo "Error: There is local changes not committed to git repo. Cannot get a revision hash for partition metadata."
|
GIT_REVISION=$(git rev-parse --short HEAD)
|
||||||
|
elif [ ! "$DEBUG_BUILD" = "y" ]; then
|
||||||
|
echo "Error: There are local changes not committed to git repo. Cannot get a revision hash for partition metadata."
|
||||||
exit 1
|
exit 1
|
||||||
}
|
else
|
||||||
GIT_REVISION=$(git rev-parse --short HEAD)
|
echo "Warning: There are local changes not committed to git repo, revision hash won't be tracked. Never deploy this image for other than debugging purpose."
|
||||||
|
GIT_REVISION=$(git rev-parse --short HEAD)"_local_debug"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$IMAGE_TYPE" = "onie" ]; then
|
if [ "$IMAGE_TYPE" = "onie" ]; then
|
||||||
echo "Build ONIE installer"
|
echo "Build ONIE installer"
|
||||||
|
@ -11,6 +11,10 @@
|
|||||||
# Uncomment next line to enable:
|
# Uncomment next line to enable:
|
||||||
# SONIC_CONFIG_PRINT_DEPENDENCIES = y
|
# SONIC_CONFIG_PRINT_DEPENDENCIES = y
|
||||||
|
|
||||||
|
# DEBUG_BUILD - enable building image with uncommitted local changes.
|
||||||
|
# Uncomment next line to enable:
|
||||||
|
# DEBUG_BUILD = y
|
||||||
|
|
||||||
# SONIC_CONFIG_BUILD_JOBS - set number of jobs for parallel build.
|
# SONIC_CONFIG_BUILD_JOBS - set number of jobs for parallel build.
|
||||||
# Corresponding -j argument will be passed to make command inside docker
|
# Corresponding -j argument will be passed to make command inside docker
|
||||||
# container.
|
# container.
|
||||||
|
2
slave.mk
2
slave.mk
@ -321,7 +321,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform
|
|||||||
)
|
)
|
||||||
|
|
||||||
./build_debian.sh "$(USERNAME)" "$(shell perl -e 'print crypt("$(PASSWORD)", "salt"),"\n"')" $(LOG)
|
./build_debian.sh "$(USERNAME)" "$(shell perl -e 'print crypt("$(PASSWORD)", "salt"),"\n"')" $(LOG)
|
||||||
TARGET_MACHINE=$($*_MACHINE) IMAGE_TYPE=$($*_IMAGE_TYPE) ./build_image.sh $(LOG)
|
TARGET_MACHINE=$($*_MACHINE) IMAGE_TYPE=$($*_IMAGE_TYPE) DEBUG_BUILD=$(DEBUG_BUILD) ./build_image.sh $(LOG)
|
||||||
|
|
||||||
$(foreach docker, $($*_DOCKERS), \
|
$(foreach docker, $($*_DOCKERS), \
|
||||||
rm $($(docker)_CONTAINER_NAME).sh
|
rm $($(docker)_CONTAINER_NAME).sh
|
||||||
|
Loading…
Reference in New Issue
Block a user