kpt icon indicating copy to clipboard operation
kpt copied to clipboard

Slight differences in Kptfile upstream formatting with `kpt get` and `kpt alpha rpkg clone`

Open ChristopherFry opened this issue 2 years ago • 1 comments

Expected behavior

The Kptfile upstream(Lock).git.repo is formatted the same when cloning the same package using kpt get and kpt alpha rpkg clone.

Actual behavior

The repo and directory fields in the Kptfile upstream(Lock).git.repo varies slightly with the two commands.

Steps to reproduce the behavior

To reproduce, clone the same package with two different commands. Using basens in the kpt-samples repository as an example:

With kpt get:

> kpt pkg get https://github.com/GoogleContainerTools/kpt-samples.git/basens@basens/v0

Kptfile snippet:

upstream:
  type: git
  git:
    repo: https://github.com/GoogleContainerTools/kpt-samples
    directory: /basens
    ref: basens/v0
  updateStrategy: resource-merge
upstreamLock:
  type: git
  git:
    repo: https://github.com/GoogleContainerTools/kpt-samples
    directory: /basens
    ref: basens/v0
    commit: 026dfe8e3ef8d99993bc8f7c0c6ba639faa9a634

With kpt alpha rpkg clone:

> kpt alpha rpkg clone kpt-samples-afcf4d1fac605a60ba1ea4b87b5b5b82e222cb69 basens-clone -n default --repository application-blueprints

Kptfile snippet:

upstream:
  type: git
  git:
    repo: https://github.com/GoogleContainerTools/kpt-samples.git
    directory: basens
    ref: basens/v0
upstreamLock:
  type: git
  git:
    repo: https://github.com/GoogleContainerTools/kpt-samples.git
    directory: basens
    ref: basens/v0
    commit: 026dfe8e3ef8d99993bc8f7c0c6ba639faa9a634

Note the repo and directory field varies slightly between the two. The kpt alpha rpkg command adds .git to the repo field whereas kpt get does not, and kpt get prefixes directory with the a forward slash whereas kpt alpha rpkg does not.

ChristopherFry avatar Aug 25 '22 18:08 ChristopherFry

cc @johnbelamaric

ChristopherFry avatar Aug 25 '22 18:08 ChristopherFry