Skip to content

Commit

Permalink
[Makefile] Allowing interactive session with the slave docker-contain…
Browse files Browse the repository at this point in the history
…er (#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.
  • Loading branch information
rodnymolina authored and Shuotian Cheng committed Sep 22, 2017
1 parent 1ac10df commit b5eb0c2
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
###############################################################################
## Wrapper for starting make inside sonic-slave container
#
# Supported parameters:
#
# * PLATFORM: Specific platform we wish to build images for.
# * BUILD_NUMBER: Desired version-number to pass to the building-system.
# * ENABLE_DHCP_GRAPH_SERVICE: Enables get-graph service to fetch minigraph files
# through http.
# * SHUTDOWN_BGP_ON_START: Sets admin-down state for all bgp peerings after restart.
# * SONIC_ENABLE_SYNCD_RPC: Enables rpc-based syncd builds.
# * USERNAME: Desired username -- default at rules/config
# * PASSWORD: Desired password -- default at rules/config
# * KEEP_SLAVE_ON: Keeps slave container up after building-process concludes.
#
###############################################################################

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

SONIC_BUILD_INSTRUCTION := make \
-f slave.mk \
PLATFORM=$(PLATFORM) \
BUILD_NUMBER=$(BUILD_NUMBER) \
ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \
SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \
SONIC_ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \
PASSWORD=$(PASSWORD) \
USERNAME=$(USERNAME)

.PHONY: sonic-slave-build sonic-slave-bash

.DEFAULT_GOAL := all
Expand All @@ -48,16 +71,11 @@ DOCKER_BUILD = docker build --no-cache \
@docker inspect --type image $(SLAVE_IMAGE):$(SLAVE_TAG) &> /dev/null || \
{ echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \
$(DOCKER_BUILD) ; }
@$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) make \
-f slave.mk \
PLATFORM=$(PLATFORM) \
BUILD_NUMBER=$(BUILD_NUMBER) \
ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \
SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \
SONIC_ENABLE_SYNCD_RPC=$(ENABLE_SYNCD_RPC) \
PASSWORD=$(PASSWORD) \
USERNAME=$(USERNAME) \
$@
ifeq "$(KEEP_SLAVE_ON)" "yes"
@$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash"
else
@$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) $(SONIC_BUILD_INSTRUCTION) $@
endif

sonic-slave-build :
$(DOCKER_BASE_BUILD)
Expand Down

0 comments on commit b5eb0c2

Please sign in to comment.