def AddGitLabEnterpriseTriggerArgs(parser):
  """Set up the generic argparse flags for creating or updating a build trigger for GitLab Enterprise.

  Args:
    parser: An argparse.ArgumentParser-like object.

  Returns:
    An empty parser group to be populated with flags specific to a trigger-type.
  """

  parser.display_info.AddFormat("""
          table(
            name,
            createTime.date('%Y-%m-%dT%H:%M:%S%Oz', undefined='-'),
            status
          )
        """)

  trigger_config = parser.add_mutually_exclusive_group(required=True)

  AddTriggerConfigFilePathArg(trigger_config)

  # Trigger configuration
  flag_config = trigger_config.add_argument_group(
      help='Flag based trigger configuration')
  build_flags.AddRegionFlag(flag_config, hidden=False, required=True)
  AddFlagConfigArgs(flag_config)

  return flag_config
Beispiel #2
0
 def Args(parser):
     flags.AddRegionFlag(parser)
     parser.add_argument(
         'builds',
         completer=flags.BuildsCompleter,
         nargs='+',  # Accept multiple builds.
         help='IDs of builds to cancel')
     parser.display_info.AddFormat(None)
Beispiel #3
0
 def Args(parser):
     flags.AddRegionFlag(parser)
     flags.AddBuildArg(parser,
                       intro='The build whose logs shall be printed.')
     parser.add_argument(
         '--stream',
         help=('If a build is ongoing, stream the logs to stdout until '
               'the build completes.'),
         action='store_true')
Beispiel #4
0
def _CommonArgs(parser):
    """Register flags for this command.

  Args:
    parser: An argparse.ArgumentParser-like object. It is mocked out in order to
      capture some information, but behaves like an ArgumentParser.
  """
    source = parser.add_mutually_exclusive_group()
    source.add_argument(
        'source',
        nargs='?',
        default='.',  # By default, the current directory is used.
        help='The location of the source to build. The location can be a '
        'directory on a local disk or a gzipped archive file (.tar.gz) in '
        'Google Cloud Storage. If the source is a local directory, this '
        'command skips the files specified in the `--ignore-file`. If '
        '`--ignore-file` is not specified, use`.gcloudignore` file. If a '
        '`.gcloudignore` file is absent and a `.gitignore` file is present in '
        'the local source directory, gcloud will use a generated Git-compatible '
        '`.gcloudignore` file that respects your .gitignored files. The global '
        '`.gitignore` is not respected. For more information on `.gcloudignore`, '
        'see `gcloud topic gcloudignore`.',
    )
    source.add_argument(
        '--no-source',
        action='store_true',
        help='Specify that no source should be uploaded with this build.')

    flags.AddRegionFlag(parser)
    flags.AddGcsSourceStagingDirFlag(parser)
    flags.AddGcsLogDirFlag(parser)
    flags.AddTimeoutFlag(parser)

    flags.AddMachineTypeFlag(parser)
    flags.AddDiskSizeFlag(parser)
    flags.AddSubstitutionsFlag(parser)
    flags.AddWorkerPoolFlag(parser)

    flags.AddNoCacheFlag(parser)
    flags.AddAsyncFlag(parser)
    parser.display_info.AddFormat("""
        table(
          id,
          createTime.date('%Y-%m-%dT%H:%M:%S%Oz', undefined='-'),
          duration(start=startTime,end=finishTime,precision=0,calendar=false,undefined="  -").slice(2:).join(""):label=DURATION,
          build_source(undefined="-"):label=SOURCE,
          build_images(undefined="-"):label=IMAGES,
          status
        )
      """)
    # Do not try to create a URI to update the cache.
    parser.display_info.AddCacheUpdater(None)

    flags.AddIgnoreFileFlag(parser)
    flags.AddConfigFlags(parser)
Beispiel #5
0
    def Args(parser):
        """Register flags for this command.

    Args:
      parser: An argparse.ArgumentParser-like object. It is mocked out in order
        to capture some information, but behaves like an ArgumentParser.
    """

        build_flags.AddRegionFlag(parser)
        parser.add_argument('--source',
                            metavar='PATH',
                            required=True,
                            help="""\
File path where trigger should be imported from.
        """)
Beispiel #6
0
  def Args(parser):
    """Register flags for this command.

    Args:
      parser: An argparse.ArgumentParser-like object. It is mocked out in order
        to capture some information, but behaves like an ArgumentParser.
    """
    flags.AddRegionFlag(parser)
    parser.add_argument(
        '--ongoing',
        help='Only list builds that are currently QUEUED or WORKING.',
        action='store_true')
    base.LIMIT_FLAG.SetDefault(parser, 50)
    base.PAGE_SIZE_FLAG.SetDefault(parser, 20)

    # Default help for base.FILTER_FLAG is inaccurate because GCB does some
    # server-side filtering.
    base.FILTER_FLAG.RemoveFromParser(parser)
    base.Argument(
        '--filter',
        metavar='EXPRESSION',
        require_coverage_in_tests=False,
        category=base.LIST_COMMAND_FLAGS,
        help="""\
        Apply a Boolean filter _EXPRESSION_ to each resource item to be listed.
        If the expression evaluates `True`, then that item is listed. For more
        details and examples of filter expressions, run $ gcloud topic filters.
        With the exception of regex matching, this flag interacts with other
        flags that are applied in this order: *--flatten*, *--sort-by*,
        *--filter*, *--limit*. Any regex operations specified by *--filter* are
        applied client-side, after *--limit*.""").AddToParser(parser)

    parser.display_info.AddFormat("""
        table(
            id,
            createTime.date('%Y-%m-%dT%H:%M:%S%Oz', undefined='-'),
            duration(start=startTime,end=finishTime,precision=0,calendar=false,undefined="  -").slice(2:).join(""):label=DURATION,
            build_source(undefined="-"):label=SOURCE,
            build_images(undefined="-"):label=IMAGES,
            status
        )
    """)
Beispiel #7
0
 def Args(parser):
     flags.AddRegionFlag(parser)
     flags.AddBuildArg(parser, intro='The build to describe.')
 def Args(parser):
     build_flags.AddRegionFlag(parser)