Ejemplo n.º 1
0
def get_options(args):
    """Resolve all the command-line options."""

    args, defaults = preprocess_args(
        args, default_home_path_filename='validate_bom.yml')

    parser = argparse.ArgumentParser(prog='validate_bom.sh')
    add_standard_parser_args(parser, defaults)
    # DEPRECATED - use output_dir instead
    add_parser_argument(parser,
                        'log_dir',
                        defaults,
                        './validate_bom_results',
                        help='Path to root directory for report output.')

    MetricsManager.init_argument_parser(parser, defaults)
    validate_bom__config.init_argument_parser(parser, defaults)
    validate_bom__deploy.init_argument_parser(parser, defaults)
    validate_bom__test.init_argument_parser(parser, defaults)

    options = parser.parse_args(args)
    options.program = 'validate_bom'
    options.command = 'validate_bom'  # metrics assumes a "command" value.
    options.log_dir = options.output_dir  # deprecated
    validate_bom__config.validate_options(options)
    validate_bom__test.validate_options(options)

    if not os.path.exists(options.log_dir):
        os.makedirs(options.log_dir)

    if options.influxdb_database == 'SpinnakerBuildTool':
        options.influxdb_database = 'SpinnakerValidate'

    # Add platform/spinnaker_type to each metric we produce.
    # We'll use this to distinguish what was being tested.
    context_labels = 'platform=%s,deployment_type=%s' % (
        validate_bom__deploy.determine_deployment_platform(options),
        options.deploy_spinnaker_type)
    latest_unvalidated_suffix = '-latest-unvalidated'
    if options.deploy_version.endswith(latest_unvalidated_suffix):
        bom_series = options.deploy_version[:-len(latest_unvalidated_suffix)]
    else:
        bom_series = options.deploy_version[:options.deploy_version.rfind('-')]
    context_labels += ',version=%s' % bom_series

    if options.monitoring_context_labels:
        context_labels += ',' + options.monitoring_context_labels
    options.monitoring_context_labels = context_labels

    return options
Ejemplo n.º 2
0
def get_options():
  """Resolve all the command-line options."""

  parser = argparse.ArgumentParser()
  parser.add_argument('--log_dir', default='./validate_bom_results',
                      help='Path to root directory for report output.')

  validate_bom__config.init_argument_parser(parser)
  validate_bom__deploy.init_argument_parser(parser)
  validate_bom__test.init_argument_parser(parser)

  options = parser.parse_args()
  validate_bom__config.validate_options(options)
  validate_bom__test.validate_options(options)

  if not os.path.exists(options.log_dir):
    os.makedirs(options.log_dir)

  return options
Ejemplo n.º 3
0
def get_options():
  """Resolve all the command-line options."""

  parser = argparse.ArgumentParser()
  parser.add_argument('--log_dir', default='./validate_bom_results',
                      help='Path to root directory for report output.')

  validate_bom__config.init_argument_parser(parser)
  validate_bom__deploy.init_argument_parser(parser)
  validate_bom__test.init_argument_parser(parser)

  options = parser.parse_args()
  validate_bom__config.validate_options(options)
  validate_bom__test.validate_options(options)

  if not os.path.exists(options.log_dir):
    os.makedirs(options.log_dir)

  return options