github.com/wmuizelaar/kpt@v0.0.0-20221018115725-bd564717b2ed/site/reference/cli/pkg/get/README.md (about)

     1  ---
     2  title: "`get`"
     3  linkTitle: "get"
     4  type: docs
     5  description: >
     6    Fetch a package from a git repo.
     7  ---
     8  
     9  <!--mdtogo:Short
    10      Fetch a package from a git repo.
    11  -->
    12  
    13  `get` fetches a remote package from a git subdirectory and writes it to a new
    14  local directory.
    15  
    16  ### Synopsis
    17  
    18  <!--mdtogo:Long-->
    19  
    20  ```
    21  kpt pkg get REPO_URI[.git]/PKG_PATH[@VERSION] [LOCAL_DEST_DIRECTORY] [flags]
    22  ```
    23  
    24  #### Args
    25  
    26  ```
    27  REPO_URI:
    28    URI of a git repository containing 1 or more packages as subdirectories.
    29    In most cases the .git suffix should be specified to delimit the REPO_URI
    30    from the PKG_PATH, but this is not required for widely recognized repo
    31    prefixes. If get cannot parse the repo for the directory and version,
    32    then it will print an error asking for '.git' to be specified as part of
    33    the argument.
    34  
    35  PKG_PATH:
    36    Path to remote subdirectory containing Kubernetes resource configuration
    37    files or directories. Defaults to the root directory.
    38    Uses '/' as the path separator (regardless of OS).
    39    e.g. staging/cockroachdb
    40  
    41  VERSION:
    42    A git tag, branch, ref or commit for the remote version of the package
    43    to fetch. Defaults to the default branch of the repository.
    44  
    45  LOCAL_DEST_DIRECTORY:
    46    The local directory to write the package to. Defaults to a subdirectory of the
    47    current working directory named after the upstream package.
    48  ```
    49  
    50  #### Flags
    51  
    52  ```
    53  --strategy:
    54    Defines which strategy should be used to update the package. It defaults to
    55    'resource-merge'.
    56  
    57      * resource-merge: Perform a structural comparison of the original /
    58        updated resources, and merge the changes into the local package.
    59      * fast-forward: Fail without updating if the local package was modified
    60        since it was fetched.
    61      * force-delete-replace: Wipe all the local changes to the package and replace
    62        it with the remote version.
    63  
    64  --for-deployment:
    65    (Experimental) indicates if the fetched package is a deployable instance that
    66    will be deployed to a cluster.
    67    It is `false` by default.
    68  ```
    69  
    70  #### Env Vars
    71  
    72  ```
    73  KPT_CACHE_DIR:
    74    Controls where to cache remote packages when fetching them.
    75    Defaults to <HOME>/.kpt/repos/
    76    On macOS and Linux <HOME> is determined by the $HOME env variable, while on
    77    Windows it is given by the %USERPROFILE% env variable.
    78  ```
    79  
    80  <!--mdtogo-->
    81  
    82  ### Examples
    83  
    84  {{% hide %}}
    85  
    86  <!-- @makeWorkplace @verifyExamples-->
    87  
    88  ```
    89  # Set up workspace for the test.
    90  TEST_HOME=$(mktemp -d)
    91  cd $TEST_HOME
    92  ```
    93  
    94  {{% /hide %}}
    95  
    96  <!--mdtogo:Examples-->
    97  
    98  <!-- @pkgGet @verifyExamples-->
    99  
   100  ```shell
   101  # Fetch package cockroachdb from github.com/kubernetes/examples/staging/cockroachdb
   102  # This creates a new subdirectory 'cockroachdb' for the downloaded package.
   103  $ kpt pkg get https://github.com/kubernetes/examples.git/staging/cockroachdb@master
   104  ```
   105  
   106  <!-- @pkgGet @verifyExamples-->
   107  
   108  ```shell
   109  # Fetch package cockroachdb from github.com/kubernetes/examples/staging/cockroachdb
   110  # This will create a new directory 'my-package' for the downloaded package if it
   111  # doesn't already exist.
   112  $ kpt pkg get https://github.com/kubernetes/examples.git/staging/cockroachdb@master ./my-package/
   113  ```
   114  
   115  <!-- @pkgGet @verifyExamples-->
   116  
   117  ```shell
   118  # Fetch package examples from github.com/kubernetes/examples at the specified
   119  # git hash.
   120  # This will create a new directory 'examples' for the package.
   121  $ kpt pkg get https://github.com/kubernetes/examples.git/@6fe2792
   122  ```
   123  
   124  <!-- @pkgGet @verifyExamples-->
   125  
   126  ```shell
   127  # Create a deployable instance of examples package from github.com/kubernetes/examples
   128  # This will create a new directory 'examples' for the package.
   129  $ kpt pkg get https://github.com/kubernetes/examples.git/@6fe2792 --for-deployment
   130  ```
   131  
   132  <!--mdtogo-->