Skip to content

Commit

Permalink
Throw exception when 'root' plugin setting is used by people (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
ca-johnson authored Aug 8, 2019
1 parent d35a56b commit e61bc53
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 0 additions & 2 deletions plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ configuration:
type: string
p4trust:
type: string
root:
type: string
view:
type: string
stream:
Expand Down
6 changes: 5 additions & 1 deletion python/buildkite.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ def get_env():
def get_config():
"""Get configuration which will be passed directly to perforce.P4Repo as kwargs"""
conf = {}
conf['root'] = os.environ.get('BUILDKITE_PLUGIN_PERFORCE_ROOT') or os.environ.get('BUILDKITE_BUILD_CHECKOUT_PATH')
conf['view'] = os.environ.get('BUILDKITE_PLUGIN_PERFORCE_VIEW') or '//... ...'
conf['stream'] = os.environ.get('BUILDKITE_PLUGIN_PERFORCE_STREAM')
conf['sync'] = os.environ.get('BUILDKITE_PLUGIN_PERFORCE_SYNC')
conf['parallel'] = os.environ.get('BUILDKITE_PLUGIN_PERFORCE_PARALLEL') or 0
conf['client_opts'] = os.environ.get('BUILDKITE_PLUGIN_PERFORCE_CLIENT_OPTIONS')

if 'BUILDKITE_PLUGIN_PERFORCE_ROOT' in os.environ and not __LOCAL_RUN__:
raise Exception("Custom P4 root is for use in unit tests only")
conf['root'] = os.environ.get('BUILDKITE_PLUGIN_PERFORCE_ROOT') or os.environ.get('BUILDKITE_BUILD_CHECKOUT_PATH')


# Coerce view into pairs of [depot client] paths
view_parts = conf['view'].split(' ')
assert (len(view_parts) % 2) == 0, "Invalid view format"
Expand Down

0 comments on commit e61bc53

Please sign in to comment.