nephio-project / nephio

Nephio is a Kubernetes-based automation platform for deploying and managing highly distributed, interconnected workloads such as 5G Network Functions, and the underlying infrastructure on which those workloads depend.
Apache License 2.0
104 stars 53 forks source link

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

Open liamfallon opened 5 months ago

liamfallon commented 5 months ago

Original issue URL: https://github.com/kptdev/kpt/issues/3501 Original issue user: https://github.com/ChristopherFry Original issue created at: 2022-08-25T18:27:41Z Original issue last updated at: 2023-01-13T13:41:17Z Original issue body: ### 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.

Original issue comments: Comment user: https://github.com/ChristopherFry Comment created at: 2022-08-25T18:43:10Z Comment last updated at: 2022-08-25T18:43:10Z Comment body: cc @johnbelamaric