예제 #1
0
 def init_argument_parser(parser, defaults):
   """Initialize argument parser with in-memory parameters."""
   if hasattr(parser, 'added_inmemory'):
     return
   add_parser_argument(
       parser, 'metrics_dir', defaults, None,
       help='Path to file to write metrics into')
   parser.added_inmemory = True
예제 #2
0
파일: scm.py 프로젝트: spinnaker/spinnaker
 def add_parser_args(parser, defaults):
   """Add standard parser arguments used by SourceCodeManager."""
   if hasattr(parser, 'added_scm'):
     return
   parser.added_scm = True
   GitRunner.add_parser_args(parser, defaults)
   add_parser_argument(parser, 'github_upstream_owner',
                       defaults, 'spinnaker',
                       help='The standard upstream repository owner.')
예제 #3
0
 def add_parser_args(parser, defaults):
   """Add standard parser arguments used by SourceCodeManager."""
   if hasattr(parser, 'added_scm'):
     return
   parser.added_scm = True
   GitRunner.add_parser_args(parser, defaults)
   add_parser_argument(parser, 'github_upstream_owner',
                       defaults, 'spinnaker',
                       help='The standard upstream repository owner.')
 def init_argument_parser(parser, defaults):
     """Initialize argument parser with in-memory parameters."""
     if hasattr(parser, 'added_inmemory'):
         return
     add_parser_argument(parser,
                         'metrics_dir',
                         defaults,
                         None,
                         help='Path to file to write metrics into')
     parser.added_inmemory = True
예제 #5
0
    def add_bom_parser_args(parser, defaults):
        """Adds arguments shared with creating boms."""
        if hasattr(parser, 'added_gce_image_project'):
            return
        parser.added_gce_image_project = True

        add_parser_argument(parser,
                            'publish_gce_image_project',
                            defaults,
                            None,
                            help='Project to publish images to.')
예제 #6
0
 def add_parser_args(parser, defaults):
   """Add parser arguments used to administer halyard."""
   if hasattr(parser, 'added_halrunner'):
     return
   parser.added_halrunner = True
   add_parser_argument(
       parser, 'hal_path', defaults, '/usr/local/bin/hal',
       help='Path to local Halyard "hal" CLI.')
   add_parser_argument(
       parser, 'halyard_daemon', defaults, 'localhost:8064',
       help='Network location for halyard server.')
예제 #7
0
 def add_parser_args(parser, defaults):
   """Add parser arguments used to administer halyard."""
   if hasattr(parser, 'added_halrunner'):
     return
   parser.added_halrunner = True
   add_parser_argument(
       parser, 'hal_path', defaults, '/usr/local/bin/hal',
       help='Path to local Halyard "hal" CLI.')
   add_parser_argument(
       parser, 'halyard_daemon', defaults, 'localhost:8064',
       help='Network location for halyard server.')
예제 #8
0
  def add_parser_args(parser, defaults):
    """Add standard parser arguments used by SourceCodeManager."""
    if hasattr(parser, 'added_branch_scm'):
      return
    parser.added_branch_scm = True

    SpinnakerSourceCodeManager.add_parser_args(parser, defaults)
    GitRunner.add_parser_args(parser, defaults)
    add_parser_argument(parser, 'git_branch', defaults, None,
                        help='The git branch to operate on.')
    add_parser_argument(parser, 'github_hostname', defaults, 'github.com',
                        help='The hostname of the git server.')
예제 #9
0
  def add_publishing_parser_args(parser, defaults):
    """Add standard parser options used when pushing changes with GitRunner."""
    if hasattr(parser, 'added_publishing'):
      return
    parser.added_publishing = True

    add_parser_argument(
        parser, 'git_allow_publish_master_branch', defaults, True,
        help='If false then push to a version-specific branch'
             ' rather than "master" so it can be reviewed.')
    add_parser_argument(
        parser, 'git_never_push', defaults, False, type=bool,
        help='Disable pushing to git.')
예제 #10
0
 def add_parser_args(parser, defaults):
   """Add standard parser arguments used by SourceCodeManager."""
   if hasattr(parser, 'added_bom_scm'):
     return
   parser.added_bom_scm = True
   SpinnakerSourceCodeManager.add_parser_args(parser, defaults)
   HalRunner.add_parser_args(parser, defaults)
   add_parser_argument(
       parser, 'bom_path', defaults, None,
       help='Use the sources specified in the BOM path.')
   add_parser_argument(
       parser, 'bom_version', defaults, None,
       help='Use the sources specified in the BOM version.')
예제 #11
0
 def add_parser_args(parser, defaults):
   """Add standard parser arguments used by SourceCodeManager."""
   if hasattr(parser, 'added_bom_scm'):
     return
   parser.added_bom_scm = True
   SpinnakerSourceCodeManager.add_parser_args(parser, defaults)
   HalRunner.add_parser_args(parser, defaults)
   add_parser_argument(
       parser, 'bom_path', defaults, None,
       help='Use the sources specified in the BOM path.')
   add_parser_argument(
       parser, 'bom_version', defaults, None,
       help='Use the sources specified in the BOM version.')
예제 #12
0
  def add_publishing_parser_args(parser, defaults):
    """Add standard parser options used when pushing changes with GitRunner."""
    if hasattr(parser, 'added_publishing'):
      return
    parser.added_publishing = True

    add_parser_argument(
        parser, 'git_allow_publish_master_branch', defaults, True,
        help='If false then push to a version-specific branch'
             ' rather than "master" so it can be reviewed.')
    add_parser_argument(
        parser, 'git_never_push', defaults, False, type=bool,
        help='Disable pushing to git.')
예제 #13
0
 def init_argument_parser(parser, defaults):
     """Init argparser with metrics-related options."""
     InMemoryMetricsRegistry.init_argument_parser(parser, defaults)
     InfluxDbMetricsRegistry.init_argument_parser(parser, defaults)
     add_parser_argument(
         parser,
         'metric_name_scope',
         defaults,
         'buildtool',
         help='scope prefix for metrics generated by this tool')
     add_parser_argument(parser,
                         'monitoring_enabled',
                         defaults,
                         False,
                         type=bool,
                         help='Enable monitoring to stackdriver.')
     add_parser_argument(
         parser,
         'monitoring_flush_frequency',
         defaults,
         15,
         help='Frequency at which to push metrics in seconds.')
     add_parser_argument(parser,
                         'monitoring_system',
                         defaults,
                         'file',
                         choices=['file', 'influxdb'],
                         help='Where to store metrics.')
예제 #14
0
 def init_argument_parser(parser, defaults):
     """Init argparser with metrics-related options."""
     InMemoryMetricsRegistry.init_argument_parser(parser, defaults)
     InfluxDbMetricsRegistry.init_argument_parser(parser, defaults)
     add_parser_argument(parser,
                         'monitoring_enabled',
                         defaults,
                         False,
                         type=bool,
                         help='Enable monitoring to stackdriver.')
     add_parser_argument(
         parser,
         'monitoring_flush_frequency',
         defaults,
         15,
         help='Frequency at which to push metrics in seconds.')
     add_parser_argument(parser,
                         'monitoring_system',
                         defaults,
                         'file',
                         choices=['file', 'influxdb'],
                         help='Where to store metrics.')
     add_parser_argument(
         parser,
         'monitoring_context_labels',
         defaults,
         None,
         help='A comma-separated list of additional name=value'
         ' labels to add to each event to associate them together.'
         ' (e.g. version=release-1.2.x)')
예제 #15
0
 def init_argument_parser(parser, defaults):
     InMemoryMetricsRegistry.init_argument_parser(parser, defaults)
     add_parser_argument(parser,
                         'influxdb_url',
                         defaults,
                         'http://localhost:8086',
                         help='Server address to push metrics to.')
     add_parser_argument(parser,
                         'influxdb_database',
                         defaults,
                         'SpinnakerBuildTool',
                         help='Influxdb to push metrics to.')
     add_parser_argument(
         parser,
         'influxdb_reiterate_gauge_secs',
         defaults,
         60,
         help='Reiterate gauge values for the specified period of seconds.'
         ' This is because when they get chunked into time blocks, the'
         'values become lost, in particular settling back to 0.')
     add_parser_argument(
         parser,
         'influxdb_add_context_labels',
         defaults,
         None,
         help='A comma-separated list of additional name=value'
         ' labels to add to each event to associate them together.'
         ' (e.g. xRelease=release-1.2.x)')
예제 #16
0
  def add_parser_args(parser, defaults):
    """Add parser arguments for gradle."""
    if hasattr(parser, 'added_gradle_runner'):
      return
    parser.added_gradle_runner = True

    add_parser_argument(
        parser, 'bintray_jar_repository', defaults, None,
        help='bintray repository in the bintray_org to publish jar files into.')
    add_parser_argument(
        parser, 'gradle_cache_path', defaults,
        '{home}/.gradle'.format(home=os.environ['HOME'])
        if os.environ.get('HOME') else None,
        help='Path to a gradle cache directory to use for the builds.')
    add_parser_argument(
        parser, 'gradle_network_timeout_secs', defaults, 60,
        help='Seconds to configure gradle timeouts (e.g. with bintray).')
    add_parser_argument(
        parser, 'maven_custom_init_file', defaults,
        os.path.join(os.path.dirname(__file__), '..', 'maven-init.gradle'),
        help='Path to a gradle init file to add to the debian builds.'
        ' Used to specify any custom behavior in the gradle builds.'
        ' Argument is a file path relative to the directory this script is'
        ' executed in.'
        ' The default value assumes we run this script from the parent'
        ' directory of spinnaker/spinnaker.')
예제 #17
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
예제 #18
0
    def add_parser_args(parser, defaults):
        """Add standard parser arguments used by SourceCodeManager."""
        if hasattr(parser, 'added_branch_scm'):
            return
        parser.added_branch_scm = True

        SpinnakerSourceCodeManager.add_parser_args(parser, defaults)
        GitRunner.add_parser_args(parser, defaults)
        add_parser_argument(parser,
                            'git_branch',
                            defaults,
                            None,
                            help='The git branch to operate on.')
        add_parser_argument(parser,
                            'github_hostname',
                            defaults,
                            'github.com',
                            help='The hostname of the git server.')
예제 #19
0
 def add_parser_args(parser, defaults):
     """Add parser arguments used to administer halyard."""
     if hasattr(parser, "added_halrunner"):
         return
     parser.added_halrunner = True
     add_parser_argument(
         parser,
         "hal_path",
         defaults,
         "/usr/local/bin/hal",
         help='Path to local Halyard "hal" CLI.',
     )
     add_parser_argument(
         parser,
         "halyard_daemon",
         defaults,
         "localhost:8064",
         help="Network location for halyard server.",
     )
예제 #20
0
    def add_parser_args(parser, defaults):
        """Add parser arguments for gradle."""
        if hasattr(parser, 'added_gradle_runner'):
            return
        parser.added_gradle_runner = True

        add_parser_argument(
            parser,
            'bintray_jar_repository',
            defaults,
            None,
            help=
            'bintray repository in the bintray_org to publish jar files into.')
        add_parser_argument(
            parser,
            'gradle_cache_path',
            defaults,
            '{home}/.gradle'.format(
                home=os.environ['HOME']) if os.environ.get('HOME') else None,
            help='Path to a gradle cache directory to use for the builds.')

        add_parser_argument(
            parser,
            'maven_custom_init_file',
            defaults,
            os.path.join(os.path.dirname(__file__), '..', 'maven-init.gradle'),
            help='Path to a gradle init file to add to the debian builds.'
            ' Used to specify any custom behavior in the gradle builds.'
            ' Argument is a file path relative to the directory this script is'
            ' executed in.'
            ' The default value assumes we run this script from the parent'
            ' directory of spinnaker/spinnaker.')
예제 #21
0
 def init_argument_parser(parser, defaults):
     InMemoryMetricsRegistry.init_argument_parser(parser, defaults)
     add_parser_argument(
         parser,
         "influxdb_url",
         defaults,
         "http://localhost:8086",
         help="Server address to push metrics to.",
     )
     add_parser_argument(
         parser,
         "influxdb_database",
         defaults,
         "SpinnakerBuildTool",
         help="Influxdb to push metrics to.",
     )
     add_parser_argument(
         parser,
         "influxdb_reiterate_gauge_secs",
         defaults,
         60,
         help="Reiterate gauge values for the specified period of seconds."
         " This is because when they get chunked into time blocks, the"
         "values become lost, in particular settling back to 0.",
     )
예제 #22
0
 def init_argument_parser(parser, defaults):
   """Init argparser with metrics-related options."""
   InMemoryMetricsRegistry.init_argument_parser(parser, defaults)
   InfluxDbMetricsRegistry.init_argument_parser(parser, defaults)
   add_parser_argument(
       parser, 'monitoring_enabled', defaults, False, type=bool,
       help='Enable monitoring to stackdriver.')
   add_parser_argument(
       parser, 'monitoring_flush_frequency', defaults, 15,
       help='Frequency at which to push metrics in seconds.')
   add_parser_argument(
       parser, 'monitoring_system', defaults, 'file',
       choices=['file', 'influxdb'],
       help='Where to store metrics.')
   add_parser_argument(
       parser, 'monitoring_context_labels', defaults, None,
       help='A comma-separated list of additional name=value'
            ' labels to add to each event to associate them together.'
            ' (e.g. version=release-1.2.x)')
 def init_argument_parser(parser, defaults):
   InMemoryMetricsRegistry.init_argument_parser(parser, defaults)
   add_parser_argument(parser, 'influxdb_url', defaults,
                       'http://localhost:8086',
                       help='Server address to push metrics to.')
   add_parser_argument(parser, 'influxdb_database', defaults,
                       'SpinnakerBuildTool',
                       help='Influxdb to push metrics to.')
   add_parser_argument(
       parser, 'influxdb_reiterate_gauge_secs', defaults, 60,
       help='Reiterate gauge values for the specified period of seconds.'
            ' This is because when they get chunked into time blocks, the'
            'values become lost, in particular settling back to 0.')
예제 #24
0
    def add_parser_args(parser, defaults):
        """Add parser arguments for gradle."""
        if hasattr(parser, "added_gradle_runner"):
            return
        parser.added_gradle_runner = True

        add_parser_argument(
            parser,
            "bintray_jar_repository",
            defaults,
            None,
            help=
            "bintray repository in the bintray_org to publish jar files into.",
        )
        add_parser_argument(
            parser,
            "gradle_cache_path",
            defaults,
            "{home}/.gradle".format(
                home=os.environ["HOME"]) if os.environ.get("HOME") else None,
            help="Path to a gradle cache directory to use for the builds.",
        )
        add_parser_argument(
            parser,
            "gradle_network_timeout_secs",
            defaults,
            60,
            help="Seconds to configure gradle timeouts (e.g. with bintray).",
        )
        add_parser_argument(
            parser,
            "maven_custom_init_file",
            defaults,
            os.path.join(os.path.dirname(__file__), "..", "maven-init.gradle"),
            help="Path to a gradle init file to add to the debian builds."
            " Used to specify any custom behavior in the gradle builds."
            " Argument is a file path relative to the directory this script is"
            " executed in."
            " The default value assumes we run this script from the parent"
            " directory of spinnaker/buildtool.",
        )
예제 #25
0
 def init_argument_parser(parser, defaults):
     """Init argparser with metrics-related options."""
     InMemoryMetricsRegistry.init_argument_parser(parser, defaults)
     InfluxDbMetricsRegistry.init_argument_parser(parser, defaults)
     add_parser_argument(
         parser,
         "monitoring_enabled",
         defaults,
         False,
         type=bool,
         help="Enable monitoring to stackdriver.",
     )
     add_parser_argument(
         parser,
         "monitoring_flush_frequency",
         defaults,
         15,
         help="Frequency at which to push metrics in seconds.",
     )
     add_parser_argument(
         parser,
         "monitoring_system",
         defaults,
         "file",
         choices=["file", "influxdb"],
         help="Where to store metrics.",
     )
     add_parser_argument(
         parser,
         "monitoring_context_labels",
         defaults,
         None,
         help="A comma-separated list of additional name=value"
         " labels to add to each event to associate them together."
         " (e.g. version=release-1.2.x)",
     )
예제 #26
0
  def add_parser_args(parser, defaults):
    """Add standard parser options used by GitRunner."""
    if hasattr(parser, 'added_git'):
      return
    parser.added_git = True

    add_parser_argument(
        parser, 'github_owner', defaults, None,
        help='Github repository owner whose repositories we should'
             ' be operating on.')
    add_parser_argument(
        parser, 'github_pull_ssh', defaults, False, type=bool,
        help='If True, github pull origin uses ssh rather than https.'
             ' Pulls are https by default since the standard repos are public.')
    add_parser_argument(
        parser, 'github_filesystem_root', defaults, None,
        help='If set, then use this file path as the base origin root where'
             ' all the git repositories are assumed off that. This is only'
             ' intended to support testing.')
    add_parser_argument(
        parser, 'github_push_ssh', defaults, True, type=bool,
        help='If False, github push origin uses https rather than ssh.'
             ' Pushes are ssh by default for enhanced security over https.')
    add_parser_argument(
        parser, 'github_disable_upstream_push', defaults, False, type=bool,
        help='If True then disable upstream git pushes in local repos.'
             ' This is intended as a safety mechanism for testing.')
    add_parser_argument(
        parser, 'git_allow_no_baseline_tag', defaults, True, type=bool,
        help='If True then do not require a baseline tag when searching back'
             ' from a commit to the previous version. Normally this would not'
             ' be allowed.')
예제 #27
0
파일: command.py 프로젝트: zer09/spinnaker
 def add_argument(parser, name, defaults, default_value, **kwargs):
     """See buildtool.util.add_argument."""
     add_parser_argument(parser, name, defaults, default_value, **kwargs)
예제 #28
0
def init_argument_parser(parser, defaults):
    """Add testing related command-line parameters."""
    add_parser_argument(parser,
                        'test_profiles',
                        defaults,
                        os.path.join(os.path.dirname(__file__),
                                     'all_tests.yaml'),
                        help='The path to the set of test profiles.')

    add_parser_argument(
        parser,
        'test_extra_profile_bindings',
        defaults,
        None,
        help='Path to a file with additional bindings that the --test_profiles'
        ' file may reference.')

    add_parser_argument(
        parser,
        'test_concurrency',
        defaults,
        None,
        type=int,
        help='Limits how many tests to run at a time. Default is unbounded')

    add_parser_argument(
        parser,
        'test_service_startup_timeout',
        defaults,
        300,
        type=int,
        help='Number of seconds to permit services to startup before giving up.'
    )

    add_parser_argument(
        parser,
        'test_gce_project_quota_factor',
        defaults,
        1.0,
        type=float,
        help='Default percentage of available project quota to make available'
        ' for tests.')

    add_parser_argument(
        parser,
        'test_gce_region_quota_factor',
        defaults,
        1.0,
        type=float,
        help='Default percentage of available region quota to make available'
        ' for tests.')

    add_parser_argument(
        parser,
        'test_gce_quota_region',
        defaults,
        'us-central1',
        help='GCE Compute Region to gather region quota limits from.')

    add_parser_argument(
        parser,
        'test_default_quota',
        defaults,
        '',
        help='Default quota parameters for values used in the --test_profiles.'
        ' This does not include GCE quota values, which are determined'
        ' at runtime. These value can be further overriden by --test_quota.'
        ' These are meant as built-in defaults, where --test_quota as'
        ' per-execution overriden.')

    add_parser_argument(
        parser,
        'test_quota',
        defaults,
        '',
        help='Comma-delimited name=value list of quota overrides.')

    add_parser_argument(parser,
                        'testing_enabled',
                        defaults,
                        True,
                        type=bool,
                        help='If false then dont run the testing phase.')

    add_parser_argument(parser,
                        'test_disable',
                        defaults,
                        False,
                        action='store_true',
                        dest='testing_enabled',
                        help='DEPRECATED: Use --testing_enabled=false.')

    add_parser_argument(
        parser,
        'test_include',
        defaults,
        '.*',
        help='Regular expression of tests to run or None for all.')

    add_parser_argument(
        parser,
        'test_exclude',
        defaults,
        None,
        help='Regular expression of otherwise runnable tests to skip.')

    add_parser_argument(
        parser,
        'test_stack',
        defaults,
        None,
        help='The --test_stack to pass through to tests indicating which'
        ' Spinnaker application "stack" to use. This is typically'
        ' to help trace the source of resources created within the'
        ' tests.')

    add_parser_argument(parser,
                        'test_jenkins_job_name',
                        defaults,
                        'TriggerBake',
                        help='The Jenkins job name to use in tests.')
예제 #29
0
def init_argument_parser(parser, defaults):
  """Add testing related command-line parameters."""
  add_parser_argument(
      parser, 'test_profiles',
      defaults, os.path.join(os.path.dirname(__file__), 'all_tests.yaml'),
      help='The path to the set of test profiles.')

  add_parser_argument(
      parser, 'test_extra_profile_bindings', defaults, None,
      help='Path to a file with additional bindings that the --test_profiles'
           ' file may reference.')

  add_parser_argument(
      parser, 'test_concurrency', defaults, None, type=int,
      help='Limits how many tests to run at a time. Default is unbounded')

  add_parser_argument(
      parser, 'test_service_startup_timeout', defaults, 300, type=int,
      help='Number of seconds to permit services to startup before giving up.')

  add_parser_argument(
      parser, 'test_gce_project_quota_factor', defaults, 1.0, type=float,
      help='Default percentage of available project quota to make available'
           ' for tests.')

  add_parser_argument(
      parser, 'test_gce_region_quota_factor', defaults, 1.0, type=float,
      help='Default percentage of available region quota to make available'
           ' for tests.')

  add_parser_argument(
      parser, 'test_gce_quota_region', defaults, 'us-central1',
      help='GCE Compute Region to gather region quota limits from.')

  add_parser_argument(
      parser, 'test_default_quota',
      defaults, '',
      help='Default quota parameters for values used in the --test_profiles.'
           ' This does not include GCE quota values, which are determined'
           ' at runtime. These value can be further overriden by --test_quota.'
           ' These are meant as built-in defaults, where --test_quota as'
           ' per-execution overriden.')

  add_parser_argument(
      parser, 'test_quota', defaults, '',
      help='Comma-delimited name=value list of quota overrides.')

  add_parser_argument(
      parser, 'testing_enabled', defaults, True, type=bool,
      help='If false then do not run the testing phase.')

  add_parser_argument(
      parser, 'test_disable', defaults, False, action='store_true',
      dest='testing_enabled',
      help='DEPRECATED: Use --testing_enabled=false.')

  add_parser_argument(
      parser, 'test_wait_on_services', defaults, True, type=bool,
      help='If false then do not wait on services to be ready during'
           ' testing phase.')

  add_parser_argument(
      parser, 'test_include', defaults, '.*',
      help='Regular expression of tests to run or None for all.')

  add_parser_argument(
      parser, 'test_exclude', defaults, None,
      help='Regular expression of otherwise runnable tests to skip.')

  add_parser_argument(
      parser, 'test_stack', defaults, None,
      help='The --test_stack to pass through to tests indicating which'
           ' Spinnaker application "stack" to use. This is typically'
           ' to help trace the source of resources created within the'
           ' tests.')

  add_parser_argument(
      parser, 'test_jenkins_job_name', defaults, 'TriggerBake',
      help='The Jenkins job name to use in tests.')

  add_parser_argument(
      parser, 'test_gate_service_base_url', defaults, None,
      help='Gate base URL (including protocol, host, and port) to use'
           ' rather than port-forwarding.')

  add_parser_argument(
      parser, 'test_gate_iap_client_id', defaults, None,
      help='IAP client ID used to authenticate requests to an'
           ' IAP-protected Spinnaker. The inclusion of this flag'
           ' indicates that the Gate service is IAP-protected.')

  add_parser_argument(
      parser, 'test_gate_iap_credentials', defaults, None,
      help='Path to google credentials file to authenticate requests'
           ' to an IAP-protected Spinnaker. This must be used with the'
           ' test_gate_iap_client_id flag.'
           ' If left empty then use Application Default Credentials.')

  add_parser_argument(
      parser, 'test_gate_iap_impersonated_service_account', defaults, None,
      help='Service account to impersonate to receive the credentials'
           ' to make authenticated requests to an IAP-protected Spinnaker.'
           ' If test_gate_iap_credentials is provided, the service account'
           ' specified by test_gate_iap_credentials will impersonate this'
           ' service account. If test_gate_iap_credentials is not provided,'
           ' the Application Default Credentials will be used to impersonate'
           ' this service account. This must be used with the'
           ' test_gate_iap_client_id flag.'
           ' If left empty then no service account will be impersonated.')

  add_parser_argument(
      parser, 'test_ignore_ssl_cert_verification', defaults, False, type=bool,
      help='Whether or not to ignore SSL certificate verification when making'
           ' requests to Spinnaker. This is False by default.')

  add_parser_argument(
      parser, 'test_appengine_region', defaults, 'us-central',
      help='Region to use for AppEngine tests.')
예제 #30
0
  def add_parser_args(parser, defaults):
    """Add standard parser options used by GitRunner."""
    if hasattr(parser, 'added_git'):
      return
    parser.added_git = True

    add_parser_argument(
        parser, 'github_owner', defaults, None,
        help='Github repository owner whose repositories we should'
             ' be operating on.')
    add_parser_argument(
        parser, 'github_pull_ssh', defaults, False, type=bool,
        help='If True, github pull origin uses ssh rather than https.'
             ' Pulls are https by default since the standard repos are public.')
    add_parser_argument(
        parser, 'github_repository_root', defaults, None,
        help='If set, then use this as the base repository for github.'
             ' This is intended for urls other than https and ssh,'
             ' such as filesystems for testing.'
             ' Otherwise, use github_hostname, github_(push|pull)_ssh.')
    add_parser_argument(
        parser, 'github_push_ssh', defaults, True, type=bool,
        help='If False, github push origin uses https rather than ssh.'
             ' Pushes are ssh by default for enhanced security over https.')
    add_parser_argument(
        parser, 'github_disable_upstream_push', defaults, False, type=bool,
        help='If True then disable upstream git pushes in local repos.'
             ' This is intended as a safety mechanism for testing.')
    add_parser_argument(
        parser, 'git_allow_no_baseline_tag', defaults, True, type=bool,
        help='If True then do not require a baseline tag when searching back'
             ' from a commit to the previous version. Normally this would not'
             ' be allowed.')
예제 #31
0
def init_argument_parser(parser, defaults):
  """Add testing related command-line parameters."""
  add_parser_argument(
      parser, 'test_profiles',
      defaults, os.path.join(os.path.dirname(__file__), 'all_tests.yaml'),
      help='The path to the set of test profiles.')

  add_parser_argument(
      parser, 'test_extra_profile_bindings', defaults, None,
      help='Path to a file with additional bindings that the --test_profiles'
           ' file may reference.')

  add_parser_argument(
      parser, 'test_concurrency', defaults, None, type=int,
      help='Limits how many tests to run at a time. Default is unbounded')

  add_parser_argument(
      parser, 'test_service_startup_timeout', defaults, 300, type=int,
      help='Number of seconds to permit services to startup before giving up.')

  add_parser_argument(
      parser, 'test_default_quota',
      defaults, 'google_backend_services=5,google_forwarding_rules=10'
                ',google_ssl_certificates=5,google_cpu=20'
                ',appengine_deployment=1',
      help='Comma-delimited name=value list of quota limits. This is used'
           ' to rate-limit tests based on their profiled quota specifications.')
  add_parser_argument(
      parser, 'test_quota', defaults, '',
      help='Comma-delimited name=value list of --test_default_quota overrides.')

  add_parser_argument(
      parser, 'testing_enabled', defaults, True, type=bool,
      help='If false then dont run the testing phase.')

  add_parser_argument(
      parser, 'test_disable', defaults, False, action='store_true',
      dest='testing_enabled',
      help='DEPRECATED: Use --testing_enabled=false.')

  add_parser_argument(
      parser, 'test_include', defaults, '.*',
      help='Regular expression of tests to run or None for all.')

  add_parser_argument(
      parser, 'test_exclude', defaults, None,
      help='Regular expression of otherwise runnable tests to skip.')

  add_parser_argument(
      parser, 'test_stack', defaults, None,
      help='The --test_stack to pass through to tests indicating which'
           ' Spinnaker application "stack" to use. This is typically'
           ' to help trace the source of resources created within the'
           ' tests.')

  add_parser_argument(
      parser, 'test_jenkins_job_name', defaults, 'TriggerBake',
      help='The Jenkins job name to use in tests.')
예제 #32
0
def add_standard_parser_args(parser, defaults):
    """Init argparser with command-independent options.

    Args:
      parser: [argparse.Parser]
      defaults: [dict]  Default value overrides keyed by option name.
    """
    parser.add_argument(
        "components",
        nargs="*",
        default=defaults.get("components", None),
        help="Restrict commands to these components or repository names",
    )

    add_parser_argument(
        parser,
        "default_args_file",
        defaults,
        None,
        help="Path to YAML file containing command-line option overrides."
        " The default is $HOME/.spinnaker/buildtool.yml if present."
        " This parameter will overload the defaults. Embedded"
        " default_args_file will also be read at a lower precedence than"
        " the containing file.",
    )

    add_parser_argument(
        parser,
        "log_level",
        defaults,
        "info",
        choices=STANDARD_LOG_LEVELS.keys(),
        help="Set the logging level",
    )
    add_parser_argument(
        parser,
        "output_dir",
        defaults,
        "output",
        help="Directory to write working files.",
    )
    add_parser_argument(
        parser,
        "input_dir",
        defaults,
        "source_code",
        help="Directory to cache input files, such as cloning git repos.",
    )
    add_parser_argument(
        parser,
        "one_at_a_time",
        defaults,
        False,
        type=bool,
        help="Do not perform applicable concurrency, for debugging.",
    )
    add_parser_argument(
        parser,
        "parent_invocation_id",
        defaults,
        "{:%y%m%d}.{}".format(datetime.datetime.utcnow(), os.getpid()),
        help="For identifying the context of the metrics data to be produced.",
    )
예제 #33
0
def init_argument_parser(parser, defaults):
    """Add testing related command-line parameters."""
    add_parser_argument(
        parser,
        "test_profiles",
        defaults,
        os.path.join(os.path.dirname(__file__), "all_tests.yaml"),
        help="The path to the set of test profiles.",
    )

    add_parser_argument(
        parser,
        "test_extra_profile_bindings",
        defaults,
        None,
        help="Path to a file with additional bindings that the --test_profiles"
        " file may reference.",
    )

    add_parser_argument(
        parser,
        "test_concurrency",
        defaults,
        None,
        type=int,
        help="Limits how many tests to run at a time. Default is unbounded",
    )

    add_parser_argument(
        parser,
        "test_service_startup_timeout",
        defaults,
        600,
        type=int,
        help=
        "Number of seconds to permit services to startup before giving up.",
    )

    add_parser_argument(
        parser,
        "test_gce_project_quota_factor",
        defaults,
        1.0,
        type=float,
        help="Default percentage of available project quota to make available"
        " for tests.",
    )

    add_parser_argument(
        parser,
        "test_gce_region_quota_factor",
        defaults,
        1.0,
        type=float,
        help="Default percentage of available region quota to make available"
        " for tests.",
    )

    add_parser_argument(
        parser,
        "test_gce_quota_region",
        defaults,
        "us-central1",
        help="GCE Compute Region to gather region quota limits from.",
    )

    add_parser_argument(
        parser,
        "test_default_quota",
        defaults,
        "",
        help="Default quota parameters for values used in the --test_profiles."
        " This does not include GCE quota values, which are determined"
        " at runtime. These value can be further overriden by --test_quota."
        " These are meant as built-in defaults, where --test_quota as"
        " per-execution overriden.",
    )

    add_parser_argument(
        parser,
        "test_quota",
        defaults,
        "",
        help="Comma-delimited name=value list of quota overrides.",
    )

    add_parser_argument(
        parser,
        "testing_enabled",
        defaults,
        True,
        type=bool,
        help="If false then do not run the testing phase.",
    )

    add_parser_argument(
        parser,
        "test_disable",
        defaults,
        False,
        action="store_true",
        dest="testing_enabled",
        help="DEPRECATED: Use --testing_enabled=false.",
    )

    add_parser_argument(
        parser,
        "test_wait_on_services",
        defaults,
        True,
        type=bool,
        help="If false then do not wait on services to be ready during"
        " testing phase.",
    )

    add_parser_argument(
        parser,
        "test_include",
        defaults,
        ".*",
        help="Regular expression of tests to run or None for all.",
    )

    add_parser_argument(
        parser,
        "test_exclude",
        defaults,
        None,
        help="Regular expression of otherwise runnable tests to skip.",
    )

    add_parser_argument(
        parser,
        "test_stack",
        defaults,
        None,
        help="The --test_stack to pass through to tests indicating which"
        ' Spinnaker application "stack" to use. This is typically'
        " to help trace the source of resources created within the"
        " tests.",
    )

    add_parser_argument(
        parser,
        "test_jenkins_job_name",
        defaults,
        "TriggerBake",
        help="The Jenkins job name to use in tests.",
    )

    add_parser_argument(
        parser,
        "test_gate_service_base_url",
        defaults,
        None,
        help="Gate base URL (including protocol, host, and port) to use"
        " rather than port-forwarding.",
    )

    add_parser_argument(
        parser,
        "test_gate_iap_client_id",
        defaults,
        None,
        help="IAP client ID used to authenticate requests to an"
        " IAP-protected Spinnaker. The inclusion of this flag"
        " indicates that the Gate service is IAP-protected.",
    )

    add_parser_argument(
        parser,
        "test_gate_iap_credentials",
        defaults,
        None,
        help="Path to google credentials file to authenticate requests"
        " to an IAP-protected Spinnaker. This must be used with the"
        " test_gate_iap_client_id flag."
        " If left empty then use Application Default Credentials.",
    )

    add_parser_argument(
        parser,
        "test_gate_iap_impersonated_service_account",
        defaults,
        None,
        help="Service account to impersonate to receive the credentials"
        " to make authenticated requests to an IAP-protected Spinnaker."
        " If test_gate_iap_credentials is provided, the service account"
        " specified by test_gate_iap_credentials will impersonate this"
        " service account. If test_gate_iap_credentials is not provided,"
        " the Application Default Credentials will be used to impersonate"
        " this service account. This must be used with the"
        " test_gate_iap_client_id flag."
        " If left empty then no service account will be impersonated.",
    )

    add_parser_argument(
        parser,
        "test_ignore_ssl_cert_verification",
        defaults,
        False,
        type=bool,
        help="Whether or not to ignore SSL certificate verification when making"
        " requests to Spinnaker. This is False by default.",
    )

    add_parser_argument(
        parser,
        "test_appengine_region",
        defaults,
        "us-central",
        help="Region to use for AppEngine tests.",
    )
예제 #34
0
def add_standard_parser_args(parser, defaults):
  """Init argparser with command-independent options.

  Args:
    parser: [argparse.Parser]
    defaults: [dict]  Default value overrides keyed by option name.
  """
  parser.add_argument(
      'components', nargs='*', default=defaults.get('components', None),
      help='Restrict commands to these components or repository names')

  add_parser_argument(
      parser, 'default_args_file', defaults, None,
      help='Path to YAML file containing command-line option overrides.'
           ' The default is $HOME/.spinnaker/buildtool.yml if present.'
           ' This parameter will overload the defaults. Embedded'
           ' default_args_file will also be read at a lower precedence than'
           ' the containing file.')

  add_parser_argument(
      parser, 'log_level', defaults, 'info',
      choices=STANDARD_LOG_LEVELS.keys(),
      help='Set the logging level')
  add_parser_argument(
      parser, 'output_dir', defaults, 'output',
      help='Directory to write working files.')
  add_parser_argument(
      parser, 'input_dir', defaults, 'source_code',
      help='Directory to cache input files, such as cloning git repos.')
  add_parser_argument(
      parser, 'one_at_a_time', defaults, False, type=bool,
      help='Do not perform applicable concurrency, for debugging.')
  add_parser_argument(
      parser, 'parent_invocation_id', defaults,
      '{:%y%m%d}.{}'.format(datetime.datetime.utcnow(), os.getpid()),
      help='For identifying the context of the metrics data to be produced.')
예제 #35
0
    def add_parser_args(parser, defaults):
        """Add standard parser options used by GitRunner."""
        if hasattr(parser, "added_git"):
            return
        parser.added_git = True

        add_parser_argument(
            parser,
            "github_owner",
            defaults,
            None,
            help="Github repository owner whose repositories we should"
            " be operating on.",
        )
        add_parser_argument(
            parser,
            "github_pull_ssh",
            defaults,
            False,
            type=bool,
            help="If True, github pull origin uses ssh rather than https."
            " Pulls are https by default since the standard repos are public.",
        )
        add_parser_argument(
            parser,
            "github_repository_root",
            defaults,
            None,
            help="If set, then use this as the base repository for github."
            " This is intended for urls other than https and ssh,"
            " such as filesystems for testing."
            " Otherwise, use github_hostname, github_(push|pull)_ssh.",
        )
        add_parser_argument(
            parser,
            "github_push_ssh",
            defaults,
            True,
            type=bool,
            help="If False, github push origin uses https rather than ssh."
            " Pushes are ssh by default for enhanced security over https.",
        )
        add_parser_argument(
            parser,
            "github_disable_upstream_push",
            defaults,
            False,
            type=bool,
            help="If True then disable upstream git pushes in local repos."
            " This is intended as a safety mechanism for testing.",
        )
        add_parser_argument(
            parser,
            "git_allow_no_baseline_tag",
            defaults,
            True,
            type=bool,
            help="If True then do not require a baseline tag when searching back"
            " from a commit to the previous version. Normally this would not"
            " be allowed.",
        )
예제 #36
0
def add_standard_parser_args(parser, defaults):
  """Init argparser with command-independent options.

  Args:
    parser: [argparse.Parser]
    defaults: [dict]  Default value overrides keyed by option name.
  """
  parser.add_argument(
      'components', nargs='*', default=defaults.get('components', None),
      help='Restrict commands to these components or repository names')

  add_parser_argument(
      parser, 'default_args_file', defaults, None,
      help='Path to YAML file containing command-line option overrides.'
           ' The default is $HOME/.spinnaker/buildtool.yml if present.'
           ' This parameter will overload the defaults. Embedded'
           ' default_args_file will also be read at a lower precedence than'
           ' the containing file.')

  add_parser_argument(
      parser, 'log_level', defaults, 'info',
      choices=STANDARD_LOG_LEVELS.keys(),
      help='Set the logging level')
  add_parser_argument(
      parser, 'output_dir', defaults, 'output',
      help='Directory to write working files.')
  add_parser_argument(
      parser, 'input_dir', defaults, 'source_code',
      help='Directory to cache input files, such as cloning git repos.')
  add_parser_argument(
      parser, 'one_at_a_time', defaults, False, type=bool,
      help='Do not perform applicable concurrency, for debugging.')
  add_parser_argument(
      parser, 'parent_invocation_id', defaults,
      '{:%y%m%d}.{}'.format(datetime.datetime.utcnow(), os.getpid()),
      help='For identifying the context of the metrics data to be produced.')