Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build]: allow to customize USERNAME and PASSWORD in command line #492

Merged
merged 3 commits into from
Apr 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ DOCKER_BUILD = docker build --no-cache \
PLATFORM=$(PLATFORM) \
BUILD_NUMBER=$(BUILD_NUMBER) \
ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \
PASSWORD=$(PASSWORD) \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to check if they are not empty

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See below. It appears that Make is already checking for missing/empty values.

Copy link
Contributor

@taoyl-ms taoyl-ms Apr 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you misunderstood Marian's comment. What is happening here is that adding this statement will override slave.mk's $PASSWORD with Makefile's $PASSWORD, even if it is empty. So we DO need to check empty before passing it or the value in rule.cofig will be overridden.

What is different here from ENABLE_DHCP_GRAPH_SERVICE is that in the case of ENABLE_DHCP_GRAPH_SERVICE actually empty is a valid value (and also the default value), while for $PASSWORD it is not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, gotcha. Pretty sure Guohan's intention was to have them initially set to the defaults in rules/config and only overwritten if explicitly specified on the command line.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

USERNAME=$(USERNAME) \
$@

sonic-slave-build :
Expand Down
8 changes: 4 additions & 4 deletions rules/config
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ SONIC_CONFIG_LOG_TO_FILES = y
# Comment next line to disable:
# SONIC_CONFIG_ENABLE_COLORS = y

# USERNAME - username for installer build
USERNAME = admin
# DEFAULT_USERNAME - default username for installer build
DEFAULT_USERNAME = admin

# PASSWORD - password for installer build
PASSWORD = YourPaSsWoRd
# DEFAULT_PASSWORD - default password for installer build
DEFAULT_PASSWORD = YourPaSsWoRd

# ENABLE_DHCP_GRAPH_SERVICE - specify the source of minigraph to generate configuration file.
# If set to y SONiC will get the minigraph from graph service. Graph service URL need to be
Expand Down
8 changes: 8 additions & 0 deletions slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ ifneq ($(CONFIGURED_PLATFORM), undefined)
include $(PLATFORM_PATH)/rules.mk
endif

ifeq ($(USERNAME),)
override USERNAME := $(DEFAULT_USERNAME)
endif

ifeq ($(PASSWORD),)
override PASSWORD := $(DEFAULT_PASSWORD)
endif

MAKEFLAGS += -j $(SONIC_CONFIG_BUILD_JOBS)

###############################################################################
Expand Down