def main(): parser = argparse.ArgumentParser(prog=sys.argv[0]) parser.add_argument( '--host', type=str, default=None, help=( 'Host to build on. Can also be specified using the {} environment ' + 'variable.').format(remote.REMOTE_BUILD_HOST_ENV_VAR)) home = os.path.expanduser('~') cwd = os.getcwd() default_path = '~/{0}'.format( cwd[len(home) + 1:] if cwd.startswith(home) else 'code/yugabyte') # Note: don't specify default arguments here, because they may come from the "profile". parser.add_argument('--remote-path', type=str, default=None, help='path used for build') parser.add_argument('--branch', type=str, default=None, help='base branch for build') parser.add_argument('--build-type', type=str, default=None, help='build type, defaults to release') parser.add_argument('--skip-build', action='store_true', help='skip build, only sync files') parser.add_argument('--build-args', type=str, default=None, help='build arguments to pass') parser.add_argument('--wait-for-ssh', action='store_true', help='Wait for the remote server to be ssh-able') parser.add_argument('--profile', help='Use a "profile" specified in the {} file'.format( remote.CONFIG_FILE_PATH)) args = parser.parse_args() remote.load_profile(args, args.profile) # --------------------------------------------------------------------------------------------- # Default arguments go here. args.host = remote.apply_default_host_value(args.host) if args.branch is None: args.branch = remote.DEFAULT_BASE_BRANCH if args.remote_path is None: args.remote_path = default_path if args.build_type is None: args.build_type = "release" # End of default arguments. # --------------------------------------------------------------------------------------------- os.chdir(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) print("Host: {0}, build type: {1}, remote path: {2}".format( args.host, args.build_type, args.remote_path)) print("Arguments to remote build: {}".format(args.build_args)) escaped_remote_path = remote.sync_changes(args.host, args.branch, args.remote_path, args.wait_for_ssh) if args.skip_build: sys.exit(0) remote_args = [] remote_args.append("--build {}".format(args.build_type)) remote_args.append("--force") if args.build_args is not None: remote_args.append("--build_args=\"{}\"".format(args.build_args)) remote.exec_command(args.host, escaped_remote_path, 'yb_release', remote_args, False)
def main(): parser = argparse.ArgumentParser(prog=sys.argv[0]) parser.add_argument('--host', type=str, default=None, help=('Host to build on. Can also be specified using the {} environment ' + 'variable.').format(remote.REMOTE_BUILD_HOST_ENV_VAR)) home = os.path.expanduser('~') cwd = os.getcwd() default_path = '~/{0}'.format(cwd[len(home) + 1:] if cwd.startswith(home) else 'code/yugabyte') # Note: don't specify default arguments here, because they may come from the "profile". parser.add_argument('--remote-path', type=str, help='path used for build') parser.add_argument('--branch', type=str, default=None, help='base branch for build') parser.add_argument('--build-type', type=str, default=None, help='build type') parser.add_argument('--skip-build', action='store_true', help='skip build, only sync files') parser.add_argument('--wait-for-ssh', action='store_true', help='Wait for the remote server to be ssh-able') parser.add_argument('--profile', help='Use a "profile" specified in the {} file'.format( remote.CONFIG_FILE_PATH)) parser.add_argument('build_args', nargs=argparse.REMAINDER, help='arguments for yb_build.sh') if len(sys.argv) >= 2 and sys.argv[1] in ['ybd', 'yb_build.sh']: # Allow the first argument to be 'ybd' so we can copy and paste a ybd command line directly # after remote_build.py. sys.argv[1:2] = ['--'] args = parser.parse_args() remote.load_profile(['host', 'remote_path', 'branch'], args, args.profile) # --------------------------------------------------------------------------------------------- # Default arguments go here. args.host = remote.apply_default_host_value(args.host) if args.branch is None: args.branch = remote.DEFAULT_BASE_BRANCH if args.remote_path is None: args.remote_path = default_path # End of default arguments. # --------------------------------------------------------------------------------------------- os.chdir(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) print("Host: {0}, build type: {1}, remote path: {2}".format(args.host, args.build_type or 'N/A', args.remote_path)) print("Arguments to remote build: {}".format(args.build_args)) escaped_remote_path = \ remote.sync_changes(args.host, args.branch, args.remote_path, args.wait_for_ssh) if args.skip_build: sys.exit(0) remote_args = [] if args.build_type: remote_args.append(args.build_type) if len(args.build_args) != 0 and args.build_args[0] == '--': remote_args += args.build_args[1:] else: remote_args += args.build_args if '--host-for-tests' not in remote_args and 'YB_HOST_FOR_RUNNING_TESTS' in os.environ: remote_args = add_extra_ybd_args(remote_args, ['--host-for-tests', os.environ['YB_HOST_FOR_RUNNING_TESTS']]) remote.exec_command(args.host, escaped_remote_path, 'yb_build.sh', remote_args, do_quote_args=True)