Exemple #1
0
    def Args(parser):
        Deploy.CommonArgs(parser)

        # Flags specific to managed CR
        managed_group = flags.GetManagedArgGroup(parser)
        flags.AddSandboxArg(managed_group)
        flags.AddBinAuthzPolicyFlags(managed_group)
        flags.AddBinAuthzBreakglassFlag(managed_group)

        # Flags specific to connecting to a cluster
        cluster_group = flags.GetClusterArgGroup(parser)
        flags.AddEndpointVisibilityEnum(cluster_group, deprecated=True)

        # Flags not specific to any platform
        flags.AddDeployTagFlag(parser)
        flags.AddIngressFlag(parser)
        flags.AddHttp2Flag(parser)

        # Flags specific to deploy from source
        flags.AddSourceFlag(parser)
        flags.AddConfigFlags(parser)
        # TODO(b/165145546): Remove advanced build flags for 'gcloud run deploy'
        build_flags.AddGcsSourceStagingDirFlag(parser, True)
        build_flags.AddGcsLogDirFlag(parser, True)
        build_flags.AddMachineTypeFlag(parser, True)
        build_flags.AddDiskSizeFlag(parser, True)
        build_flags.AddSubstitutionsFlag(parser, True)
        build_flags.AddWorkerPoolFlag(parser, True)
        build_flags.AddNoCacheFlag(parser, True)
        build_flags.AddIgnoreFileFlag(parser, True)
Exemple #2
0
    def Args(parser):
        Deploy.CommonArgs(parser)

        # Flags specific to VPCAccess
        managed_group = flags.GetManagedArgGroup(parser)
        flags.AddEgressSettingsFlag(managed_group)

        # Flags specific to connecting to a cluster
        cluster_group = flags.GetClusterArgGroup(parser)
        flags.AddEndpointVisibilityEnum(cluster_group, deprecated=True)

        # Flags not specific to any platform
        flags.AddMinInstancesFlag(parser)
        flags.AddDeployTagFlag(parser)
        flags.AddIngressFlag(parser)

        # Flags inherited from gcloud builds submit
        flags.AddConfigFlags(parser)
        flags.AddSourceFlag(parser)
        flags.AddBuildTimeoutFlag(parser)
        # TODO(b/165145546): Remove advanced build flags for 'gcloud run deploy'
        build_flags.AddGcsSourceStagingDirFlag(parser, True)
        build_flags.AddGcsLogDirFlag(parser, True)
        build_flags.AddMachineTypeFlag(parser, True)
        build_flags.AddDiskSizeFlag(parser, True)
        build_flags.AddSubstitutionsFlag(parser, True)
        build_flags.AddWorkerPoolFlag(parser, True)
        build_flags.AddNoCacheFlag(parser, True)
        build_flags.AddIgnoreFileFlag(parser, True)
Exemple #3
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)
Exemple #4
0
  def Args(parser):
    Deploy.CommonArgs(parser)

    # Flags not specific to any platform
    flags.AddMinInstancesFlag(parser)
    flags.AddNoTrafficFlag(parser)
    flags.AddServiceAccountFlagAlpha(parser)

    # Flags inherited from gcloud builds submit
    flags.AddConfigFlags(parser)
    flags.AddSourceFlag(parser)
    flags.AddBuildTimeoutFlag(parser)
    build_flags.AddGcsSourceStagingDirFlag(parser, True)
    build_flags.AddGcsLogDirFlag(parser, True)
    build_flags.AddMachineTypeFlag(parser, True)
    build_flags.AddDiskSizeFlag(parser, True)
    build_flags.AddSubstitutionsFlag(parser, True)
    build_flags.AddNoCacheFlag(parser, True)
    build_flags.AddIgnoreFileFlag(parser, True)