Pass base branch to module validator on delegate.
This commit is contained in:
parent
c160ede789
commit
bc8186543a
3 changed files with 25 additions and 3 deletions
|
@ -15,6 +15,7 @@ from lib.executor import (
|
||||||
SubprocessError,
|
SubprocessError,
|
||||||
ShellConfig,
|
ShellConfig,
|
||||||
TestConfig,
|
TestConfig,
|
||||||
|
SanityConfig,
|
||||||
create_shell_command,
|
create_shell_command,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -354,6 +355,9 @@ def generate_command(args, path, options, exclude, require):
|
||||||
|
|
||||||
if isinstance(args, ShellConfig):
|
if isinstance(args, ShellConfig):
|
||||||
cmd = create_shell_command(cmd)
|
cmd = create_shell_command(cmd)
|
||||||
|
elif isinstance(args, SanityConfig):
|
||||||
|
if args.base_branch:
|
||||||
|
cmd += ['--base-branch', args.base_branch]
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
|
|
||||||
|
@ -382,6 +386,10 @@ def filter_options(args, argv, options, exclude, require):
|
||||||
'--changed-from': 1,
|
'--changed-from': 1,
|
||||||
'--changed-path': 1,
|
'--changed-path': 1,
|
||||||
})
|
})
|
||||||
|
elif isinstance(args, SanityConfig):
|
||||||
|
options.update({
|
||||||
|
'--base-branch': 1,
|
||||||
|
})
|
||||||
|
|
||||||
remaining = 0
|
remaining = 0
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ from lib.util import (
|
||||||
ApplicationWarning,
|
ApplicationWarning,
|
||||||
ApplicationError,
|
ApplicationError,
|
||||||
SubprocessError,
|
SubprocessError,
|
||||||
|
MissingEnvironmentVariable,
|
||||||
display,
|
display,
|
||||||
run_command,
|
run_command,
|
||||||
deepest_path,
|
deepest_path,
|
||||||
|
@ -796,12 +797,12 @@ def command_sanity_validate_modules(args, targets):
|
||||||
if skip_paths:
|
if skip_paths:
|
||||||
cmd += ['--exclude', '^(%s)' % '|'.join(skip_paths)]
|
cmd += ['--exclude', '^(%s)' % '|'.join(skip_paths)]
|
||||||
|
|
||||||
if is_shippable():
|
if args.base_branch:
|
||||||
cmd.extend([
|
cmd.extend([
|
||||||
'--base-branch', os.environ['BASE_BRANCH']
|
'--base-branch', args.base_branch,
|
||||||
])
|
])
|
||||||
else:
|
else:
|
||||||
display.warning("Cannot perform module comparison against the base branch when running locally")
|
display.warning('Cannot perform module comparison against the base branch. Base branch not detected when running locally.')
|
||||||
|
|
||||||
run_command(args, cmd, env=env)
|
run_command(args, cmd, env=env)
|
||||||
|
|
||||||
|
@ -1378,6 +1379,16 @@ class SanityConfig(TestConfig):
|
||||||
self.skip_test = args.skip_test # type: list [str]
|
self.skip_test = args.skip_test # type: list [str]
|
||||||
self.list_tests = args.list_tests # type: bool
|
self.list_tests = args.list_tests # type: bool
|
||||||
|
|
||||||
|
if args.base_branch:
|
||||||
|
self.base_branch = args.base_branch # str
|
||||||
|
elif is_shippable():
|
||||||
|
try:
|
||||||
|
self.base_branch = os.environ['BASE_BRANCH'] # str
|
||||||
|
except KeyError as ex:
|
||||||
|
raise MissingEnvironmentVariable(name=ex.args[0])
|
||||||
|
else:
|
||||||
|
self.base_branch = ''
|
||||||
|
|
||||||
|
|
||||||
class IntegrationConfig(TestConfig):
|
class IntegrationConfig(TestConfig):
|
||||||
"""Configuration for the integration command."""
|
"""Configuration for the integration command."""
|
||||||
|
|
|
@ -285,6 +285,9 @@ def parse_args():
|
||||||
choices=SUPPORTED_PYTHON_VERSIONS,
|
choices=SUPPORTED_PYTHON_VERSIONS,
|
||||||
help='python version: %s' % ', '.join(SUPPORTED_PYTHON_VERSIONS))
|
help='python version: %s' % ', '.join(SUPPORTED_PYTHON_VERSIONS))
|
||||||
|
|
||||||
|
sanity.add_argument('--base-branch',
|
||||||
|
help=argparse.SUPPRESS)
|
||||||
|
|
||||||
add_extra_docker_options(sanity, integration=False)
|
add_extra_docker_options(sanity, integration=False)
|
||||||
|
|
||||||
shell = subparsers.add_parser('shell',
|
shell = subparsers.add_parser('shell',
|
||||||
|
|
Loading…
Reference in a new issue