
    ;                     R   S r SSKrSSKJr  SSKJr  SrS-S jrS-S jrS-S jrS-S	 jr	S-S
 jr
S-S jrS-S jrS-S jrS-S jrS.S jrS/S jrS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS  r S! r!S" r"S# r#S$ r$S% r%S& r&S' r'S( r(S-S) jr)S0S* jr*S-S+ jr+S-S, jr,g)1z#Flags for the deploy command group.    N)arg_parsers)baseaw  
The location of the source that contains skaffold.yaml. 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.
c                 &    U R                  SUSS9  g)zAAdds a Google Cloud Storage directory flag for staging the build.z--gcs-source-staging-dirzA directory in Google Cloud Storage to copy the source used for staging the build. If the specified bucket does not exist, Cloud Deploy will create one. If you don't set this field, ```gs://[DELIVERY_PIPELINE_ID]_clouddeploy/source``` is used.hiddenhelpNadd_argumentparserr   s     .lib/googlecloudsdk/command_lib/deploy/flags.pyAddGcsSourceStagingDirFlagr      s!     J	  	    c                 &    U R                  SUSS9  g)zAdds an ignore file flag.z--ignore-filezEOverride the `.gcloudignore` file and use the specified file instead.r   Nr	   r   s     r   AddIgnoreFileFlagr   ,   s     	  r   c                 &    U R                  SUSS9  g)Adds to-target flag.--to-targetz8Specifies a target to deliver into upon release creationr   Nr	   r   s     r   AddToTargetFlagr   8   s    E  r   c           	          U R                  5       nUR                  SS[        R                  " 5       U[        R
                  " S5      S9  UR                  SUSS9  g)	zAdds Images flag.z--imageszNAME=TAGz      Reference to a collection of individual image name to image full path replacements.

      For example:

          $ gcloud deploy releases create foo \
              --images image1=path/to/image1:v1@sha256:45db24
      metavartyper   r   z--build-artifactszReference to a Skaffold build artifacts output file from skaffold build --file-output=BUILD_ARTIFACTS. If you aren't using Skaffold, use the --images flag below to specify the image-names-to-tagged-image references.r   N)add_mutually_exclusive_groupr
   r   ArgDicttextwrapdedent)r   r   images_groups      r   AddImagesGroupr   A   si    446, ?? 
    5	  	r   c                 (    U R                  SUSSS9  g)zAdds config flag.z--fileTzUPath to yaml file containing Delivery Pipeline(s), Target(s) declarative definitions.)r   requiredr   Nr	   r   s     r   AddConfigFiler"   ^   s#    &  r   c                 &    U R                  SUSS9  g)r   r   z#Destination target to promote into.r   Nr	   r   s     r   AddToTargetr$   k   s    F)N  r   c                 &    U R                  SUSS9  g)zAdds rollout-id flag.z--rollout-idz4ID to assign to the generated rollout for promotion.r   Nr	   r   s     r   AddRolloutIDr&   r   s    A  r   c                 $    U R                  SX!S9  g)zAdds release flag.z	--releaser   Nr	   r   	help_textr   s      r   
AddReleaser*   {   s    k&Ar   c                 (    U R                  SUSUS9  g)zAdds force flag.z--force
store_true)r   actionr   Nr	   r(   s      r   AddForcer.      s!    	  r   c                 $    U R                  UUS9  g)zAdds description related flag.r   Nr	   )r   r)   names      r   AddDescriptionr2      s    
  r   c                 &    U R                  SSUS9  g)zAdds delivery pipeline flag.z--delivery-pipelinez.The name of the Cloud Deploy delivery pipeline)r   r!   Nr	   )r   r!   s     r   AddDeliveryPipeliner4      s    ;  r   c                     [         R                  " S5      U-  nU R                  SS[        R                  " 5       US9  g)zAdds --annotations flag.z  Annotations to apply to the %s. Annotations take the form of key/value string pairs.

  Examples:

  Add annotations:

    $ {command} --annotations="from_target=test,status=stable"

  z--annotations	KEY=VALUEr   r   r   Nr   r   r
   r   r   r   resource_typer)   s      r   AddAnnotationsFlagr;      sI    oo 	 	 	) 	 	  r   c                     [         R                  " S5      U-  nU R                  SS[        R                  " 5       US9  g)zAdd --labels flag.z  Labels to apply to the %s. Labels take the form of key/value string pairs.

  Examples:

  Add labels:

    $ {command} --labels="commit=abc123,author=foo"

z--labelsr6   r7   Nr8   r9   s      r   AddLabelsFlagr=      sI    oo 	 	 		) 	 	  r   c                 .    U R                  SS[        S9  g)zAdds docker version flag.z--docker-versionzVersion of the Docker binary.r   r   Nr
   strr   s    r   AddDockerVersionrC      s    *  r   c                 .    U R                  SS[        S9  g)zAdds helm version flag.z--helm-versionzVersion of the Helm binary.r?   Nr@   rB   s    r   AddHelmVersionrE      s    (  r   c                 .    U R                  SS[        S9  g)zAdds kpt version flag.z--kpt-versionzVersion of the Kpt binary.r?   Nr@   rB   s    r   AddKptVersionrG      s    '  r   c                 .    U R                  SS[        S9  g)zAdds kubectl version flag.z--kubectl-versionzVersion of the Kubectl binary.r?   Nr@   rB   s    r   AddKubectlVersionrI      s    +  r   c                 .    U R                  SS[        S9  g)zAdds kustomize version flag.z--kustomize-versionz Version of the Kustomize binary.r?   Nr@   rB   s    r   AddKustomizeVersionrK      s    -  r   c                 .    U R                  SS[        S9  g)zAdds skaffold version flag.z--skaffold-versionzVersion of the Skaffold binary.r?   Nr@   rB   s    r   AddSkaffoldVersionrM      s    !B  r   c                  X    [         R                  " S5      n [        R                  " SU S9$ )zAdd --skaffold-file flag.a    Path of the skaffold file absolute or relative to the source directory.

  Examples:

  Use Skaffold file with relative path:
  The current working directory is expected to be some part of the skaffold path (e.g. the current working directory could be /home/user)

    $ {command} --source=/home/user/source --skaffold-file=config/skaffold.yaml

  The skaffold file absolute file path is expected to be:
  /home/user/source/config/skaffold.yaml


  Use Skaffold file with absolute path and with or without source argument:


    $ {command} --source=/home/user/source --skaffold-file=/home/user/source/config/skaffold.yaml

    $ {command} --skaffold-file=/home/user/source/config/skaffold.yaml

  z--skaffold-filer0   r   r   r   Argumentr)   s    r   AddSkaffoldFileFlagrR      s)    oo  ), 
(y	99r   c                  6    [         R                  " S[        SS9$ )zAdds source flag.z--source.)r   default)r   rP   _SOURCE_HELP_TEXT r   r   AddSourceFlagrX     s    	(#
 r   c                  ,    [         R                  " SSS9$ )Nz--from-k8s-manifesta-  The path to a Kubernetes manifest, which Cloud Deploy will use to generate a skaffold.yaml file for you (for example, foo/bar/k8.yaml). The generated Skaffold file will be available in the Google Cloud Storage source staging directory (see --gcs-source-staging-dir flag) after the release is complete.r0   r   rP   rW   r   r   AddKubernetesFileFlagr[     s    	J	
 	r   c                  ,    [         R                  " SSS9$ )Nz--from-run-manifesta1  The path to a Cloud Run manifest, which Cloud Deploy will use to generate a skaffold.yaml file for you (for example, foo/bar/service.yaml). The generated Skaffold file will be available in the Google Cloud Storage source staging directory (see --gcs-source-staging-dir flag) after the release is complete.r0   rZ   rW   r   r   AddCloudRunFileFlagr]   (  s    	K	
 	r   c                 
   U R                  5       n[        5       R                  U5        [        5       R                  U5        UR	                  SS9n[        5       R                  U5        [        5       R                  U5        g)zAdd Skaffold sources.FmutexN)r   r[   AddToParserr]   	add_grouprX   rR   )r   config_groupsource_groups      r   AddSkaffoldSourcesre   5  sf    446,%%l3##L1''e'4,/l+##L1r   c                 *    U R                  SSSSSS9  g)zAdd --description flag.--descriptionz1Description of rollout created during a rollback.FNr   r   rU   r!   r	   rB   s    r   AddDescriptionFlagri   @  s$    >  r   c                 T    [         R                  " S5      nU R                  SSSUS9  g)zAdd --list-all-pipelines flag.zi  List all Delivery Pipelines associated with a target.

  Usage:

    $ {command} --list-all-pipelines

z--list-all-pipelinesr,   Nr-   rU   r   r   r   r
   r   r)   s     r   AddListAllPipelinesrn   K  s3    oo  ) 	\4i  r   c                 T    [         R                  " S5      nU R                  SSSUS9  g)z Add --skip-pipeline-lookup flag.z  If set, skip fetching details of associated pipelines when describing a target.

  Usage:

    $ {command} --skip-pipeline-lookup

z--skip-pipeline-lookupr,   Frk   Nrl   rm   s     r   AddSkipPipelineLookuprp   [  s6    oo  ) 		  r   c                 V    [         R                  " S5      nU R                  SUSSSS9  g)zAdd --rollback-of-rollout flag.af    If set, this validates whether the rollout name specified by the flag matches
  the rollout on the target.

  Examples:

  Validate that `test-rollout` is the rollout to rollback on the target.

    $ {command} --rollback-of-rollout=projects/test-project/locations/us-central1/deliveryPipelines/test-pipeline/releases/test-release/rollouts/test-rollout

  z--rollback-of-rolloutFNrh   rl   rm   s     r   AddRollbackOfRolloutrr   n  s9    oo 
 
) 	  r   c                 V    [         R                  " S5      nU R                  SUSSSS9  g)zAdd --starting-phase-id flag.z  If set, starts the created rollout at the specified phase.

  Start rollout at `stable` phase:

    $ {command} --starting-phase-id=stable

  z--starting-phase-idFNrh   rl   rm   s     r   AddStartingPhaseIdrt     s9    oo  ) 	  r   c                      [         R                  " S5      n [        R                  " SU S[        R
                  " 5       S9$ )z"Add --initial-rollout-labels flag.z  Labels to apply to the initial rollout when creating the release. Labels take
  the form of key/value string pairs.

  Examples:

  Add labels:

    $ {command} initial-rollout-labels="commit=abc123,author=foo"

z--initial-rollout-labelsr6   r   r   r   r   r   r   rP   r   r   rQ   s    r   AddInitialRolloutLabelsFlagrx     s=    oo 
 
) 
  	
 r   c                      [         R                  " S5      n [        R                  " SU S[        R
                  " 5       S9$ )z(Adds --initial-rollout-annotations flag.z  Annotations to apply to the initial rollout when creating the release.
  Annotations take the form of key/value string pairs.

  Examples:

  Add annotations:

    $ {command} --initial-rollout-annotations="from_target=test,status=stable"

  z--initial-rollout-annotationsr6   rv   rw   rQ   s    r    AddInitialRolloutAnnotationsFlagrz     s=    oo 
 
) 
% 	
 r   c                  ^    [         R                  " S5      n [        R                  " SU SSSS9$ )z%Adds --initial-rollout-phase-id flag.a'    The phase to start the initial rollout at when creating the release.
  The phase ID must be a valid phase on the rollout. If not specified, then the
  rollout will start at the first phase.

  Examples:

  Start rollout at `stable` phase:

    $ {command} --initial-rollout-phase-id=stable

  z--initial-rollout-phase-idFNrh   rO   rQ   s    r   AddInitialRolloutPhaseIDFlagr|     s7    oo  ) 
"
 r   c                  0    [         R                  " SSSSS9$ )z#Adds --enable-initial-rollout flag.z--enable-initial-rolloutstore_constzeCreates a rollout in the first target defined in the delivery pipeline. This is the default behavior.Tr-   r   constrZ   rW   r   r   AddEnableInitialRolloutFlagr     s%     
 5 
 r   c                  0    [         R                  " SSSSS9$ )z$Adds --disable-initial-rollout flag.z--disable-initial-rolloutr~   zNSkips creating a rollout in the first target defined in the delivery pipeline.Tr   rZ   rW   r   r   AddDisableInitialRolloutFlagr     s%     
! 
 r   c                 <   U R                  5       nUR                  SS9n[        5       R                  U5        [	        5       R                  U5        [        5       R                  U5        [        5       R                  U5        [        5       R                  U5        g)z Adds initial-rollout flag group.Fr_   N)r   rb   rx   ra   rz   r|   r   r   )r   groupenable_initial_rollout_groups      r   AddInitialRolloutGroupr     s|    

-
-
/% "'u!=++,HI"$001MN ,,-IJ++,HI ,,U3r   c                 (    U R                  SUSSS9  g)zAdds job-id flag.z--job-idzJob ID on a rollout resourceTr   r   r!   Nr	   r   s     r   AddJobIdr   
  s!    )	  r   c                 (    U R                  SUSUS9  g)zAdds phase-id flag.z
--phase-idzPhase ID on a rollout resourcer   Nr	   )r   r!   r   s      r   
AddPhaseIdr     s!    +	  r   c                 |    [         R                  " S5      nU R                  SS[        R                  " 5       UUS9  g)zAdd --deploy-parameters flag.z  Deployment parameters to apply to the release. Deployment parameters take the form of key/value string pairs.

  Examples:

  Add deployment parameters:

    $ {command} --deploy-parameters="key1=value1,key2=value2"

z--deploy-parametersr6   r   Nr8   )r   r   r)   s      r   AddDeployParametersFlagr     sB    oo 	 	) 	   r   c                 P    U R                  SSU[        R                  " 5       SS9  g)z#Adds override-deploy-policies flag.z--override-deploy-policiesPOLICYzDeploy policies to override)r   r   r   r   N)r
   r   ArgListr   s     r   AddOverrideDeployPoliciesr   4  s-    " (  r   )F)rg   )T)TF)-__doc__r   googlecloudsdk.callioper   r   rV   r   r   r   r   r"   r$   r&   r*   r.   r2   r4   r;   r=   rC   rE   rG   rI   rK   rM   rR   rX   r[   r]   re   ri   rn   rp   rr   rt   rx   rz   r|   r   r   r   r   r   r   r   rW   r   r   <module>r      s    *  / ( 	:
B
**:6

2 &0**,24,r   