Skip to content

Commit b5eb0c2

Browse files
rodnymolinaShuotian Cheng
authored and
Shuotian Cheng
committed
[Makefile] Allowing interactive session with the slave docker-container (#903)
* Fixing a couple of issues to enable FRR to run with latest SONiC code. * Adjusting FRR's jinja template to meet latest sonic-cfgen requirements. Basically, i'm just extending #448 changes into FRR. * Eliminate FRR's integrated-config file to prevent daemons from bypassing their own config files. FRR daemons now default to an integrated-config file for config-parsing purposes. But we are still interested in having each daemon looking in their specific config file (bgpd.conf, zebra.conf, etc). So here i'm just deleting this integrating-config file to prevent FRR from running from a bogus config-file. * Allows interactive session with the slave docker-container after conclusion of the building process. Proposed changes provide a more direct access to the building pipeline, by allowing users to launch consecutive compilation tasks from the same slave container.
1 parent 1ac10df commit b5eb0c2

File tree

1 file changed

+28
-10
lines changed

1 file changed

+28
-10
lines changed

Makefile

+28-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
###############################################################################
22
## Wrapper for starting make inside sonic-slave container
3+
#
4+
# Supported parameters:
5+
#
6+
# * PLATFORM: Specific platform we wish to build images for.
7+
# * BUILD_NUMBER: Desired version-number to pass to the building-system.
8+
# * ENABLE_DHCP_GRAPH_SERVICE: Enables get-graph service to fetch minigraph files
9+
# through http.
10+
# * SHUTDOWN_BGP_ON_START: Sets admin-down state for all bgp peerings after restart.
11+
# * SONIC_ENABLE_SYNCD_RPC: Enables rpc-based syncd builds.
12+
# * USERNAME: Desired username -- default at rules/config
13+
# * PASSWORD: Desired password -- default at rules/config
14+
# * KEEP_SLAVE_ON: Keeps slave container up after building-process concludes.
15+
#
316
###############################################################################
417

518
SHELL = /bin/bash
@@ -37,6 +50,16 @@ DOCKER_BUILD = docker build --no-cache \
3750
sonic-slave && \
3851
docker tag $(SLAVE_IMAGE):latest $(SLAVE_IMAGE):$(SLAVE_TAG)
3952

53+
SONIC_BUILD_INSTRUCTION := make \
54+
-f slave.mk \
55+
PLATFORM=$(PLATFORM) \
56+
BUILD_NUMBER=$(BUILD_NUMBER) \
57+
ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \
58+
SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \
59+
SONIC_ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \
60+
PASSWORD=$(PASSWORD) \
61+
USERNAME=$(USERNAME)
62+
4063
.PHONY: sonic-slave-build sonic-slave-bash
4164

4265
.DEFAULT_GOAL := all
@@ -48,16 +71,11 @@ DOCKER_BUILD = docker build --no-cache \
4871
@docker inspect --type image $(SLAVE_IMAGE):$(SLAVE_TAG) &> /dev/null || \
4972
{ echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \
5073
$(DOCKER_BUILD) ; }
51-
@$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) make \
52-
-f slave.mk \
53-
PLATFORM=$(PLATFORM) \
54-
BUILD_NUMBER=$(BUILD_NUMBER) \
55-
ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \
56-
SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \
57-
SONIC_ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \
58-
PASSWORD=$(PASSWORD) \
59-
USERNAME=$(USERNAME) \
60-
$@
74+
ifeq "$(KEEP_SLAVE_ON)" "yes"
75+
@$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash"
76+
else
77+
@$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) $(SONIC_BUILD_INSTRUCTION) $@
78+
endif
6179

6280
sonic-slave-build :
6381
$(DOCKER_BASE_BUILD)

0 commit comments

Comments
 (0)