Commit 1e92c864 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Fix default build mode

Fix value of build bode when "DEVFLOW_BUIILD_MODE" is not set.
Default value is "release" for master, and "snapshot" for all other
branches.
parent d0c4fc17
......@@ -86,16 +86,18 @@ def get_base_version(vcs_info):
def build_mode():
"""Determine the build mode from the value of $DEVFLOW_BUILD_MODE"""
try:
mode = os.environ.get("DEVFLOW_BUILD_MODE", "snapshot")
assert mode == "release" or mode == "snapshot"
except KeyError:
raise ValueError("DEVFLOW_BUILD_MODE environment variable is not set."
" Set this variable to 'release' or 'snapshot'")
except AssertionError:
raise ValueError("DEVFLOW_BUILD_MODE environment variable must be"
" 'release' or 'snapshot'")
"""Determine the build mode"""
# Get it from environment if exists
mode = os.environ.get("DEVFLOW_BUILD_MODE", None)
if mode is None:
branch = utils.get_vcs_info().branch
try:
br_type = BRANCH_TYPES[branch]
except KeyError:
allowed_branches = ", ".join(x for x in BRANCH_TYPES.keys())
raise ValueError("Malformed branch name '%s', cannot classify as"
" one of %s" % (branch, allowed_branches))
mode = "snapshot" if br_type.builds_snapshot else "release"
return mode
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment