Repository: GoogleContainerTools/kpt
Pull request #3082 (2022-05-03 21:43:01)

Upgrade dependencies
Upgrade:
- k8s to 1.24.0
- cli-utils to 0.29.4



mengqiy: cc: @Liujingfang1 

Patch:
diff --git a/Makefile b/Makefile
index 405d392c..cd6be768 100644
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,7 @@
 .PHONY: docs license fix vet fmt lint test build tidy
 
 GOBIN := $(shell go env GOPATH)/bin
+GIT_COMMIT := $(shell git rev-parse --short HEAD)
 
 # T refers to an e2e test case matcher. This enables running e2e tests
 # selectively.  For example,
@@ -27,7 +28,7 @@ T ?= ".*"
 all: generate license fix vet fmt lint license-check test build buildall tidy
 
 build:
-	go build -o $(GOBIN)/kpt -v .
+	go build -ldflags "-X github.com/GoogleContainerTools/kpt/run.version=${GIT_COMMIT}" -o $(GOBIN)/kpt -v .
 
 buildall:
 	GOOS=windows go build -o /dev/null
diff --git a/go.mod b/go.mod
index a21d6e9b..7214e381 100644
--- a/go.mod
+++ b/go.mod
@@ -17,15 +17,15 @@ require (
 	golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3
 	gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
 	gotest.tools v2.2.0+incompatible
-	k8s.io/api v0.24.0-rc.0
-	k8s.io/apiextensions-apiserver v0.24.0-rc.0
-	k8s.io/apimachinery v0.24.0-rc.0
-	k8s.io/cli-runtime v0.24.0-rc.0
-	k8s.io/client-go v0.24.0-rc.0
-	k8s.io/component-base v0.24.0-rc.0
+	k8s.io/api v0.24.0
+	k8s.io/apiextensions-apiserver v0.24.0
+	k8s.io/apimachinery v0.24.0
+	k8s.io/cli-runtime v0.24.0
+	k8s.io/client-go v0.24.0
+	k8s.io/component-base v0.24.0
 	k8s.io/klog/v2 v2.60.1
-	k8s.io/kubectl v0.24.0-rc.0
-	sigs.k8s.io/cli-utils v0.29.2
+	k8s.io/kubectl v0.24.0
+	sigs.k8s.io/cli-utils v0.29.4
 	sigs.k8s.io/controller-runtime v0.11.0
 	sigs.k8s.io/kustomize/api v0.11.4
 	sigs.k8s.io/kustomize/kyaml v0.13.7-0.20220418212550-9d5491c2e20c
diff --git a/go.sum b/go.sum
index e7d20808..7bb5633f 100644
--- a/go.sum
+++ b/go.sum
@@ -1230,36 +1230,36 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9
 k8s.io/api v0.23.0/go.mod h1:8wmDdLBHBNxtOIytwLstXt5E9PddnZb0GaMcqsvDBpg=
 k8s.io/api v0.23.2/go.mod h1:sYuDb3flCtRPI8ghn6qFrcK5ZBu2mhbElxRE95qpwlI=
 k8s.io/api v0.23.5/go.mod h1:Na4XuKng8PXJ2JsploYYrivXrINeTaycCGcYgF91Xm8=
-k8s.io/api v0.24.0-rc.0 h1:0TkqsPskmRuYeIdeliMnWwd5liRAejl0otJRuCLla9Q=
-k8s.io/api v0.24.0-rc.0/go.mod h1:PcpENPRRauvrfEa9i+SJ1ai6mHIv2gD5GRvwfDsp+WM=
+k8s.io/api v0.24.0 h1:J0hann2hfxWr1hinZIDefw7Q96wmCBx6SSB8IY0MdDg=
+k8s.io/api v0.24.0/go.mod h1:5Jl90IUrJHUJYEMANRURMiVvJ0g7Ax7r3R1bqO8zx8I=
 k8s.io/apiextensions-apiserver v0.23.0/go.mod h1:xIFAEEDlAZgpVBl/1VSjGDmLoXAWRG40+GsWhKhAxY4=
-k8s.io/apiextensions-apiserver v0.24.0-rc.0 h1:em8IAQisSjp4knkyK0wyZAo6OnKcqs/WzS54By2YKS8=
-k8s.io/apiextensions-apiserver v0.24.0-rc.0/go.mod h1:nTAG3+EVJ8+ZJiHhNBEfTU//ZvAFasxNwpCEeZedr94=
+k8s.io/apiextensions-apiserver v0.24.0 h1:JfgFqbA8gKJ/uDT++feAqk9jBIwNnL9YGdQvaI9DLtY=
+k8s.io/apiextensions-apiserver v0.24.0/go.mod h1:iuVe4aEpe6827lvO6yWQVxiPSpPoSKVjkq+MIdg84cM=
 k8s.io/apimachinery v0.23.0/go.mod h1:fFCTTBKvKcwTPFzjlcxp91uPFZr+JA0FubU4fLzzFYc=
 k8s.io/apimachinery v0.23.2/go.mod h1:zDqeV0AK62LbCI0CI7KbWCAYdLg+E+8UXJ0rIz5gmS8=
 k8s.io/apimachinery v0.23.5/go.mod h1:BEuFMMBaIbcOqVIJqNZJXGFTP4W6AycEpb5+m/97hrM=
-k8s.io/apimachinery v0.24.0-rc.0 h1:2JM6zl8BsGy9sPsK6yeEnbT3Rv1WNEKOG5wqUu+nrpE=
-k8s.io/apimachinery v0.24.0-rc.0/go.mod h1:82Bi4sCzVBdpYjyI4jY6aHX+YCUchUIrZrXKedjd2UM=
+k8s.io/apimachinery v0.24.0 h1:ydFCyC/DjCvFCHK5OPMKBlxayQytB8pxy8YQInd5UyQ=
+k8s.io/apimachinery v0.24.0/go.mod h1:82Bi4sCzVBdpYjyI4jY6aHX+YCUchUIrZrXKedjd2UM=
 k8s.io/apiserver v0.23.0/go.mod h1:Cec35u/9zAepDPPFyT+UMrgqOCjgJ5qtfVJDxjZYmt4=
-k8s.io/apiserver v0.24.0-rc.0/go.mod h1:9iUrs4qlMOec7B5vlhUm3IzZQpNxxWPcldDAxkJdP3w=
+k8s.io/apiserver v0.24.0/go.mod h1:WFx2yiOMawnogNToVvUYT9nn1jaIkMKj41ZYCVycsBA=
 k8s.io/cli-runtime v0.23.2/go.mod h1:Ag70akCDvwux4HxY+nH2J3UqE2e6iwSSdG1HE6p1VTU=
-k8s.io/cli-runtime v0.24.0-rc.0 h1:1hPCaCibl8DaWUcCNU8iyWHOHJWSUiESHW6uYlGeLDo=
-k8s.io/cli-runtime v0.24.0-rc.0/go.mod h1:bAFKWrpO04tcE3El1PXPprLhgk8VUbA7de2jeAoMmR8=
+k8s.io/cli-runtime v0.24.0 h1:ot3Qf49T852uEyNApABO1UHHpFIckKK/NqpheZYN2gM=
+k8s.io/cli-runtime v0.24.0/go.mod h1:9XxoZDsEkRFUThnwqNviqzljtT/LdHtNWvcNFrAXl0A=
 k8s.io/client-go v0.23.0/go.mod h1:hrDnpnK1mSr65lHHcUuIZIXDgEbzc7/683c6hyG4jTA=
 k8s.io/client-go v0.23.2/go.mod h1:k3YbsWg6GWdHF1THHTQP88X9RhB1DWPo3Dq7KfU/D1c=
 k8s.io/client-go v0.23.5/go.mod h1:flkeinTO1CirYgzMPRWxUCnV0G4Fbu2vLhYCObnt/r4=
-k8s.io/client-go v0.24.0-rc.0 h1:PZerqDccRfhZZ19PYCfO6kJIJhuNOZpRQ9tJzPSFeE4=
-k8s.io/client-go v0.24.0-rc.0/go.mod h1:zH+SNmPKPUz09GNMCW2Bu5reKghTVx6TpYepwG2mCIM=
+k8s.io/client-go v0.24.0 h1:lbE4aB1gTHvYFSwm6eD3OF14NhFDKCejlnsGYlSJe5U=
+k8s.io/client-go v0.24.0/go.mod h1:VFPQET+cAFpYxh6Bq6f4xyMY80G6jKKktU6G0m00VDw=
 k8s.io/code-generator v0.23.0/go.mod h1:vQvOhDXhuzqiVfM/YHp+dmg10WDZCchJVObc9MvowsE=
 k8s.io/code-generator v0.23.2/go.mod h1:S0Q1JVA+kSzTI1oUvbKAxZY/DYbA/ZUb4Uknog12ETk=
 k8s.io/code-generator v0.23.5/go.mod h1:S0Q1JVA+kSzTI1oUvbKAxZY/DYbA/ZUb4Uknog12ETk=
-k8s.io/code-generator v0.24.0-rc.0/go.mod h1:dpVhs00hTuTdTY6jvVxvTFCk6gSMrtfRydbhZwHI15w=
+k8s.io/code-generator v0.24.0/go.mod h1:dpVhs00hTuTdTY6jvVxvTFCk6gSMrtfRydbhZwHI15w=
 k8s.io/component-base v0.23.0/go.mod h1:DHH5uiFvLC1edCpvcTDV++NKULdYYU6pR9Tt3HIKMKI=
 k8s.io/component-base v0.23.2/go.mod h1:wS9Z03MO3oJ0RU8bB/dbXTiluGju+SC/F5i660gxB8c=
-k8s.io/component-base v0.24.0-rc.0 h1:S2xaUcNXdZXHxMjSaVv7vtYgtwYnxqZHB0aHGm9dtVU=
-k8s.io/component-base v0.24.0-rc.0/go.mod h1:ACHgb2t5mV1LZHXVYQB8krxcTq2/dpYsjamlsiZJGXg=
+k8s.io/component-base v0.24.0 h1:h5jieHZQoHrY/lHG+HyrSbJeyfuitheBvqvKwKHVC0g=
+k8s.io/component-base v0.24.0/go.mod h1:Dgazgon0i7KYUsS8krG8muGiMVtUZxG037l1MKyXgrA=
 k8s.io/component-helpers v0.23.2/go.mod h1:J6CMwiaf0izLoNwiLl2OymB4+rGTsTpWp6PL/AqOM4U=
-k8s.io/component-helpers v0.24.0-rc.0/go.mod h1:ZCHo6Gwap4GKV5hYkcCysLT8TW8PGtq+4qqGpNEylJE=
+k8s.io/component-helpers v0.24.0/go.mod h1:Q2SlLm4h6g6lPTC9GMMfzdywfLSvJT2f1hOnnjaWD8c=
 k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
 k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
 k8s.io/gengo v0.0.0-20211129171323-c02415ce4185/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
@@ -1275,10 +1275,10 @@ k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42/go.mod h1:Z/45zLw8lUo4wdi
 k8s.io/kube-openapi v0.0.0-20220401212409-b28bf2818661 h1:nqYOUleKLC/0P1zbU29F5q6aoezM6MOAVz+iyfQbZ5M=
 k8s.io/kube-openapi v0.0.0-20220401212409-b28bf2818661/go.mod h1:daOouuuwd9JXpv1L7Y34iV3yf6nxzipkKMWWlqlvK9M=
 k8s.io/kubectl v0.23.2/go.mod h1:zWm5wt8PdRmHiVhE9a7q7XYW4WFX9StkZGnC18+1v3M=
-k8s.io/kubectl v0.24.0-rc.0 h1:SjAtvBp4oZ+oFMvWVzvrs2EQV2Skn48RjVexaqhBpA4=
-k8s.io/kubectl v0.24.0-rc.0/go.mod h1:PSKGtqIwErHxbej7DOZ2YeuEejQL4nUXYdO5XldVhjo=
+k8s.io/kubectl v0.24.0 h1:nA+WtMLVdXUs4wLogGd1mPTAesnLdBpCVgCmz3I7dXo=
+k8s.io/kubectl v0.24.0/go.mod h1:pdXkmCyHiRTqjYfyUJiXtbVNURhv0/Q1TyRhy2d5ic0=
 k8s.io/metrics v0.23.2/go.mod h1:idJHc+lLK5teHUC6Z2+d6qTKA12d5FLDxmC/DHiUYKc=
-k8s.io/metrics v0.24.0-rc.0/go.mod h1:XqqGXg39Dvzmfl+vvAZhIoU1WsvvfqGQ0idWXEhwSSo=
+k8s.io/metrics v0.24.0/go.mod h1:jrLlFGdKl3X+szubOXPG0Lf2aVxuV3QJcbsgVRAM6fI=
 k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
 k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
 k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
@@ -1290,8 +1290,8 @@ rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
 rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
 sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.25/go.mod h1:Mlj9PNLmG9bZ6BHFwFKDo5afkpWyUISkb9Me0GnK66I=
 sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.30/go.mod h1:fEO7lRTdivWO2qYVCVG7dEADOMo/MLDCVr8So2g88Uw=
-sigs.k8s.io/cli-utils v0.29.2 h1:SaYo2C1xd0MVv65NQXZ6tIqT1W1iWy8CGmC+VnxQGWs=
-sigs.k8s.io/cli-utils v0.29.2/go.mod h1:WDVRa5/eQBKntG++uyKdyT+xU7MLdCR4XsgseqL5uX4=
+sigs.k8s.io/cli-utils v0.29.4 h1:1bsZ5bE90Mbl6Jat4nmZULJCOkLQ9rwJVVrREgqtXT4=
+sigs.k8s.io/cli-utils v0.29.4/go.mod h1:WDVRa5/eQBKntG++uyKdyT+xU7MLdCR4XsgseqL5uX4=
 sigs.k8s.io/controller-runtime v0.11.0 h1:DqO+c8mywcZLFJWILq4iktoECTyn30Bkj0CwgqMpZWQ=
 sigs.k8s.io/controller-runtime v0.11.0/go.mod h1:KKwLiTooNGu+JmLZGn9Sl3Gjmfj66eMbCQznLP5zcqA=
 sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6/go.mod h1:p4QtZmO4uMYipTQNzagwnNoseA6OxSUutVw05NhYDRs=
diff --git a/internal/cmdapply/cmdapply.go b/internal/cmdapply/cmdapply.go
index 9cea0b44..3a5b7842 100644
--- a/internal/cmdapply/cmdapply.go
+++ b/internal/cmdapply/cmdapply.go
@@ -220,7 +220,7 @@ func runApply(r *Runner, invInfo inventory.Info, objs []*unstructured.Unstructur
 
 	// Run the applier. It will return a channel where we can receive updates
 	// to keep track of progress and any issues.
-	invClient, err := inventory.NewClient(r.factory, live.WrapInventoryObj, live.InvToUnstructuredFunc)
+	invClient, err := inventory.NewClient(r.factory, live.WrapInventoryObj, live.InvToUnstructuredFunc, inventory.StatusPolicyAll)
 	if err != nil {
 		return err
 	}
diff --git a/internal/cmddestroy/cmddestroy.go b/internal/cmddestroy/cmddestroy.go
index 20773c31..56d51559 100644
--- a/internal/cmddestroy/cmddestroy.go
+++ b/internal/cmddestroy/cmddestroy.go
@@ -158,7 +158,7 @@ func (r *Runner) runE(c *cobra.Command, args []string) error {
 func runDestroy(r *Runner, inv inventory.Info, dryRunStrategy common.DryRunStrategy) error {
 	// Run the destroyer. It will return a channel where we can receive updates
 	// to keep track of progress and any issues.
-	invClient, err := inventory.NewClient(r.factory, live.WrapInventoryObj, live.InvToUnstructuredFunc)
+	invClient, err := inventory.NewClient(r.factory, live.WrapInventoryObj, live.InvToUnstructuredFunc, inventory.StatusPolicyAll)
 	if err != nil {
 		return err
 	}
diff --git a/internal/cmdmigrate/migratecmd.go b/internal/cmdmigrate/migratecmd.go
index d628ee54..63fd29b6 100644
--- a/internal/cmdmigrate/migratecmd.go
+++ b/internal/cmdmigrate/migratecmd.go
@@ -402,11 +402,11 @@ func validateParams(reader io.Reader, args []string) error {
 }
 
 func rgInvClient(factory util.Factory) (inventory.Client, error) {
-	return inventory.NewClient(factory, live.WrapInventoryObj, live.InvToUnstructuredFunc)
+	return inventory.NewClient(factory, live.WrapInventoryObj, live.InvToUnstructuredFunc, inventory.StatusPolicyAll)
 }
 
 func cmInvClient(factory util.Factory) (inventory.Client, error) {
-	return inventory.NewClient(factory, inventory.WrapInventoryObj, inventory.InvInfoToConfigMap)
+	return inventory.NewClient(factory, inventory.WrapInventoryObj, inventory.InvInfoToConfigMap, inventory.StatusPolicyAll)
 }
 
 // func runLiveMigrateWithRGFile is a modified version of MigrateRunner.Run that stores the
diff --git a/internal/cmdrpkgclone/command.go b/internal/cmdrpkgclone/command.go
index 60f48aba..2817319b 100644
--- a/internal/cmdrpkgclone/command.go
+++ b/internal/cmdrpkgclone/command.go
@@ -20,6 +20,7 @@ import (
 	"strings"
 
 	"github.com/GoogleContainerTools/kpt/internal/errors"
+	"github.com/GoogleContainerTools/kpt/internal/util/parse"
 	"github.com/GoogleContainerTools/kpt/internal/util/porch"
 	porchapi "github.com/GoogleContainerTools/kpt/porch/api/porch/v1alpha1"
 	"github.com/spf13/cobra"
@@ -43,6 +44,11 @@ SOURCE_PACKAGE:
     * http://git-repository.git/package-name
     * package-revision-name
 
+  With git URLs, you can either include the package directory and ref in SOURCE_PACKAGE, or
+  you can individually specify the repo, ref, and directory using flags:
+    * kpt alpha rpkg clone http://git-repository.git/package-name@main target --repository=repo
+    * kpt alpha rpkg clone http://git-repository.git target --directory=package-name --ref=main --repository=repo
+
 NAME:
   Target package revision name (downstream package)
   Example: package-name
@@ -53,7 +59,7 @@ Flags:
   Directory within the repository where the upstream package is located.
 
 --ref
-	Ref in the repository where the upstream package is located (branch, tag, SHA)
+  Ref in the repository where the upstream package is located (branch, tag, SHA). The default is 'main'.
 
 --repository
   Repository to which package will be cloned (downstream repository).
@@ -62,7 +68,7 @@ Flags:
   Revision of the downstream package.
 
 --strategy
-  Update strategy that should be used when updating this package; one of: resource-merge, fast-forward, force-delete-replace
+  Update strategy that should be used when updating this package; one of: resource-merge, fast-forward, force-delete-replace.
 `
 )
 
@@ -96,8 +102,8 @@ func newRunner(ctx context.Context, rcg *genericclioptions.ConfigFlags) *runner
 
 	c.Flags().StringVar(&r.strategy, "strategy", string(porchapi.ResourceMerge),
 		"update strategy that should be used when updating this package; one of: "+strings.Join(strategies, ","))
-	c.Flags().StringVar(&r.directory, "directory", "/", "Directory within the repository where the upstream package is located.")
-	c.Flags().StringVar(&r.ref, "ref", "main", "Branch in the repository where the upstream package is located.")
+	c.Flags().StringVar(&r.directory, "directory", "", "Directory within the repository where the upstream package is located.")
+	c.Flags().StringVar(&r.ref, "ref", "", "Branch in the repository where the upstream package is located.")
 	c.Flags().StringVar(&r.repository, "repository", "", "Repository to which package will be cloned (downstream repository).")
 	c.Flags().StringVar(&r.revision, "revision", "v1", "Revision of the downstream package.")
 
@@ -154,6 +160,35 @@ func (r *runner) preRunE(cmd *cobra.Command, args []string) error {
 		}
 
 	case strings.Contains(source, "/"):
+		if parse.HasGitSuffix(source) { // extra parsing required
+			repo, dir, ref, err := parse.ParseURL(source)
+			if err != nil {
+				return err
+			}
+			// throw error if values set by flags contradict values parsed from SOURCE_PACKAGE
+			if r.directory != "" && dir != "" && r.directory != dir {
+				return errors.E(op, fmt.Errorf("directory %s specified by --directory contradicts directory %s specified by SOURCE_PACKAGE",
+					r.directory, dir))
+			}
+			if r.ref != "" && ref != "" && r.ref != ref {
+				return errors.E(op, fmt.Errorf("ref %s specified by --ref contradicts ref %s specified by SOURCE_PACKAGE",
+					r.ref, ref))
+			}
+			// grab the values parsed from SOURCE_PACKAGE
+			if r.directory == "" {
+				r.directory = dir
+			}
+			if r.ref == "" {
+				r.ref = ref
+			}
+			source = repo + ".git" // parse.ParseURL removes the git suffix, we need to add it back
+		}
+		if r.ref == "" {
+			r.ref = "main"
+		}
+		if r.directory == "" {
+			r.directory = "/"
+		}
 		r.clone.Upstream.Type = porchapi.RepositoryTypeGit
 		r.clone.Upstream.Git = &porchapi.GitPackage{
 			Repo:      source,
@@ -169,7 +204,6 @@ func (r *runner) preRunE(cmd *cobra.Command, args []string) error {
 	}
 
 	r.target = target
-
 	return nil
 }
 
diff --git a/internal/util/parse/parse.go b/internal/util/parse/parse.go
index cfaaaf18..1cd9d5ab 100644
--- a/internal/util/parse/parse.go
+++ b/internal/util/parse/parse.go
@@ -42,11 +42,7 @@ func GitParseArgs(ctx context.Context, args []string) (Target, error) {
 	}
 
 	// Simple parsing if contains .git{$|/)
-	matched, err := regexp.Match(gitSuffixRegexp, []byte(args[0]))
-	if err != nil {
-		return g, err
-	}
-	if matched {
+	if HasGitSuffix(args[0]) {
 		return targetFromPkgURL(ctx, args[0], args[1])
 	}
 
@@ -93,49 +89,51 @@ func GitParseArgs(ctx context.Context, args []string) (Target, error) {
 // targetFromPkgURL parses a pkg url and destination into kptfile git info and local destination Target
 func targetFromPkgURL(ctx context.Context, pkgURL string, dest string) (Target, error) {
 	g := Target{}
-	repo, dir, version, err := parseURL(ctx, pkgURL)
+	repo, dir, ref, err := ParseURL(pkgURL)
 	if err != nil {
 		return g, err
 	}
+	if dir == "" {
+		dir = "/"
+	}
+	if ref == "" {
+		gur, err := gitutil.NewGitUpstreamRepo(ctx, repo)
+		if err != nil {
+			return g, err
+		}
+		defaultRef, err := gur.GetDefaultBranch(ctx)
+		if err != nil {
+			return g, err
+		}
+		ref = defaultRef
+	}
 	destination, err := getDest(dest, repo, dir)
 	if err != nil {
 		return g, err
 	}
-	g.Ref = version
+	g.Ref = ref
 	g.Directory = path.Clean(dir)
 	g.Repo = repo
 	g.Destination = filepath.Clean(destination)
 	return g, nil
 }
 
-// parseURL parses a pkg url and returns the repo, directory, and version
-func parseURL(ctx context.Context, pkgURL string) (repo string, dir string, version string, err error) {
+// ParseURL parses a pkg url (must contain ".git") and returns the repo, directory, and version
+func ParseURL(pkgURL string) (repo string, dir string, ref string, err error) {
 	parts := regexp.MustCompile(gitSuffixRegexp).Split(pkgURL, 2)
 	index := strings.Index(pkgURL, parts[0])
 	repo = strings.Join([]string{pkgURL[:index], parts[0]}, "")
 	switch {
-	case len(parts) == 1:
+	case len(parts) == 1 || parts[1] == "":
 		// do nothing
 	case strings.Contains(parts[1], "@"):
 		parts := strings.Split(parts[1], "@")
-		version = strings.TrimSuffix(parts[1], "/")
+		ref = strings.TrimSuffix(parts[1], "/")
 		dir = string(filepath.Separator) + parts[0]
 	default:
 		dir = string(filepath.Separator) + parts[1]
 	}
-	if version == "" {
-		gur, err := gitutil.NewGitUpstreamRepo(ctx, repo)
-		if err != nil {
-			return "", "", "", err
-		}
-		defaultRef, err := gur.GetDefaultBranch(ctx)
-		if err != nil {
-			return "", "", "", err
-		}
-		version = defaultRef
-	}
-
-	return repo, dir, version, nil
+	return repo, dir, ref, nil
 }
 
 // pkgURLFromGHURL converts a GitHub URL into a well formed pkg url
@@ -287,3 +285,9 @@ func getDest(v, repo, subdir string) (string, error) {
 	}
 	return v, nil
 }
+
+// HasGitSuffix returns true if the provided pkgURL is a git repo containing the ".git" suffix
+func HasGitSuffix(pkgURL string) bool {
+	matched, err := regexp.Match(gitSuffixRegexp, []byte(pkgURL))
+	return matched && err == nil
+}
diff --git a/porch/Makefile b/porch/Makefile
index 05630d8f..1a398bcb 100644
--- a/porch/Makefile
+++ b/porch/Makefile
@@ -28,7 +28,16 @@ MODULES = \
 # GCP project to use for development
 export GCP_PROJECT_ID ?= $(shell gcloud config get-value project)
 export IMAGE_REPO ?= gcr.io/$(GCP_PROJECT_ID)
-export IMAGE_TAG ?= latest
+export IMAGE_TAG
+ifndef IMAGE_TAG
+  git_tag := $(shell git rev-parse --short HEAD || "latest" )
+  $(shell git diff --quiet)
+  ifneq ($(.SHELLSTATUS), 0)
+    git_tag := $(git_tag)-dirty
+  endif
+
+  IMAGE_TAG=$(git_tag)
+endif
 
 PORCH_SERVER_IMAGE ?= porch-server
 PORCH_FUNCTION_RUNNER_IMAGE ?= porch-function-runner
diff --git a/porch/go.mod b/porch/go.mod
index 6b8bec1a..cc7b589f 100644
--- a/porch/go.mod
+++ b/porch/go.mod
@@ -38,11 +38,11 @@ require (
 	google.golang.org/grpc v1.44.0
 	google.golang.org/protobuf v1.28.0
 	gopkg.in/yaml.v2 v2.4.0
-	k8s.io/api v0.24.0-rc.0
-	k8s.io/apimachinery v0.24.0-rc.0
-	k8s.io/apiserver v0.24.0-rc.0
-	k8s.io/client-go v0.24.0-rc.0
-	k8s.io/component-base v0.24.0-rc.0
+	k8s.io/api v0.24.0
+	k8s.io/apimachinery v0.24.0
+	k8s.io/apiserver v0.24.0
+	k8s.io/client-go v0.24.0
+	k8s.io/component-base v0.24.0
 	k8s.io/klog/v2 v2.60.1
 	k8s.io/kube-aggregator v0.24.0-beta.0
 	k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
@@ -175,10 +175,10 @@ require (
 	gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
 	gopkg.in/warnings.v0 v0.1.2 // indirect
 	gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
-	k8s.io/apiextensions-apiserver v0.24.0-rc.0 // indirect
-	k8s.io/cli-runtime v0.24.0-rc.0 // indirect
+	k8s.io/apiextensions-apiserver v0.24.0 // indirect
+	k8s.io/cli-runtime v0.24.0 // indirect
 	k8s.io/kube-openapi v0.0.0-20220401212409-b28bf2818661 // indirect
-	k8s.io/kubectl v0.24.0-rc.0 // indirect
+	k8s.io/kubectl v0.24.0 // indirect
 	sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.30 // indirect
 	sigs.k8s.io/cli-utils v0.29.4 // indirect
 	sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
diff --git a/porch/go.sum b/porch/go.sum
index e807cc14..afc67e84 100644
--- a/porch/go.sum
+++ b/porch/go.sum
@@ -1735,11 +1735,11 @@ k8s.io/api v0.23.2/go.mod h1:sYuDb3flCtRPI8ghn6qFrcK5ZBu2mhbElxRE95qpwlI=
 k8s.io/api v0.23.4/go.mod h1:i77F4JfyNNrhOjZF7OwwNJS5Y1S9dpwvb9iYRYRczfI=
 k8s.io/api v0.23.5/go.mod h1:Na4XuKng8PXJ2JsploYYrivXrINeTaycCGcYgF91Xm8=
 k8s.io/api v0.24.0-beta.0/go.mod h1:D7w5dDA57yCeRJnl0vPuRj6KBAwWYxea4Dwo5kgJGIY=
-k8s.io/api v0.24.0-rc.0 h1:0TkqsPskmRuYeIdeliMnWwd5liRAejl0otJRuCLla9Q=
-k8s.io/api v0.24.0-rc.0/go.mod h1:PcpENPRRauvrfEa9i+SJ1ai6mHIv2gD5GRvwfDsp+WM=
+k8s.io/api v0.24.0 h1:J0hann2hfxWr1hinZIDefw7Q96wmCBx6SSB8IY0MdDg=
+k8s.io/api v0.24.0/go.mod h1:5Jl90IUrJHUJYEMANRURMiVvJ0g7Ax7r3R1bqO8zx8I=
 k8s.io/apiextensions-apiserver v0.23.0/go.mod h1:xIFAEEDlAZgpVBl/1VSjGDmLoXAWRG40+GsWhKhAxY4=
-k8s.io/apiextensions-apiserver v0.24.0-rc.0 h1:em8IAQisSjp4knkyK0wyZAo6OnKcqs/WzS54By2YKS8=
-k8s.io/apiextensions-apiserver v0.24.0-rc.0/go.mod h1:nTAG3+EVJ8+ZJiHhNBEfTU//ZvAFasxNwpCEeZedr94=
+k8s.io/apiextensions-apiserver v0.24.0 h1:JfgFqbA8gKJ/uDT++feAqk9jBIwNnL9YGdQvaI9DLtY=
+k8s.io/apiextensions-apiserver v0.24.0/go.mod h1:iuVe4aEpe6827lvO6yWQVxiPSpPoSKVjkq+MIdg84cM=
 k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU=
 k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU=
 k8s.io/apimachinery v0.20.6/go.mod h1:ejZXtW1Ra6V1O5H8xPBGz+T3+4gfkTCeExAHKU57MAc=
@@ -1748,18 +1748,18 @@ k8s.io/apimachinery v0.23.2/go.mod h1:zDqeV0AK62LbCI0CI7KbWCAYdLg+E+8UXJ0rIz5gmS
 k8s.io/apimachinery v0.23.4/go.mod h1:BEuFMMBaIbcOqVIJqNZJXGFTP4W6AycEpb5+m/97hrM=
 k8s.io/apimachinery v0.23.5/go.mod h1:BEuFMMBaIbcOqVIJqNZJXGFTP4W6AycEpb5+m/97hrM=
 k8s.io/apimachinery v0.24.0-beta.0/go.mod h1:82Bi4sCzVBdpYjyI4jY6aHX+YCUchUIrZrXKedjd2UM=
-k8s.io/apimachinery v0.24.0-rc.0 h1:2JM6zl8BsGy9sPsK6yeEnbT3Rv1WNEKOG5wqUu+nrpE=
-k8s.io/apimachinery v0.24.0-rc.0/go.mod h1:82Bi4sCzVBdpYjyI4jY6aHX+YCUchUIrZrXKedjd2UM=
+k8s.io/apimachinery v0.24.0 h1:ydFCyC/DjCvFCHK5OPMKBlxayQytB8pxy8YQInd5UyQ=
+k8s.io/apimachinery v0.24.0/go.mod h1:82Bi4sCzVBdpYjyI4jY6aHX+YCUchUIrZrXKedjd2UM=
 k8s.io/apiserver v0.20.1/go.mod h1:ro5QHeQkgMS7ZGpvf4tSMx6bBOgPfE+f52KwvXfScaU=
 k8s.io/apiserver v0.20.4/go.mod h1:Mc80thBKOyy7tbvFtB4kJv1kbdD0eIH8k8vianJcbFM=
 k8s.io/apiserver v0.20.6/go.mod h1:QIJXNt6i6JB+0YQRNcS0hdRHJlMhflFmsBDeSgT1r8Q=
 k8s.io/apiserver v0.23.0/go.mod h1:Cec35u/9zAepDPPFyT+UMrgqOCjgJ5qtfVJDxjZYmt4=
 k8s.io/apiserver v0.24.0-beta.0/go.mod h1:pPF5/dEQukQjwauSxjW8IHKn8W1r8u2nERGojwFFlj4=
-k8s.io/apiserver v0.24.0-rc.0 h1:WbEHFdU4BtEMlBPxylg9uZ8e8jYvYQ57yfIW6pdnWY4=
-k8s.io/apiserver v0.24.0-rc.0/go.mod h1:9iUrs4qlMOec7B5vlhUm3IzZQpNxxWPcldDAxkJdP3w=
+k8s.io/apiserver v0.24.0 h1:GR7kGsjOMfilRvlG3Stxv/3uz/ryvJ/aZXc5pqdsNV0=
+k8s.io/apiserver v0.24.0/go.mod h1:WFx2yiOMawnogNToVvUYT9nn1jaIkMKj41ZYCVycsBA=
 k8s.io/cli-runtime v0.23.2/go.mod h1:Ag70akCDvwux4HxY+nH2J3UqE2e6iwSSdG1HE6p1VTU=
-k8s.io/cli-runtime v0.24.0-rc.0 h1:1hPCaCibl8DaWUcCNU8iyWHOHJWSUiESHW6uYlGeLDo=
-k8s.io/cli-runtime v0.24.0-rc.0/go.mod h1:bAFKWrpO04tcE3El1PXPprLhgk8VUbA7de2jeAoMmR8=
+k8s.io/cli-runtime v0.24.0 h1:ot3Qf49T852uEyNApABO1UHHpFIckKK/NqpheZYN2gM=
+k8s.io/cli-runtime v0.24.0/go.mod h1:9XxoZDsEkRFUThnwqNviqzljtT/LdHtNWvcNFrAXl0A=
 k8s.io/client-go v0.20.1/go.mod h1:/zcHdt1TeWSd5HoUe6elJmHSQ6uLLgp4bIJHVEuy+/Y=
 k8s.io/client-go v0.20.4/go.mod h1:LiMv25ND1gLUdBeYxBIwKpkSC5IsozMMmOOeSJboP+k=
 k8s.io/client-go v0.20.6/go.mod h1:nNQMnOvEUEsOzRRFIIkdmYOjAZrC8bgq0ExboWSU1I0=
@@ -1767,23 +1767,23 @@ k8s.io/client-go v0.23.0/go.mod h1:hrDnpnK1mSr65lHHcUuIZIXDgEbzc7/683c6hyG4jTA=
 k8s.io/client-go v0.23.2/go.mod h1:k3YbsWg6GWdHF1THHTQP88X9RhB1DWPo3Dq7KfU/D1c=
 k8s.io/client-go v0.23.5/go.mod h1:flkeinTO1CirYgzMPRWxUCnV0G4Fbu2vLhYCObnt/r4=
 k8s.io/client-go v0.24.0-beta.0/go.mod h1:D4rgRqnNPdFCFMMrcCqCOAouzIwJkPuKXr3zWThEExM=
-k8s.io/client-go v0.24.0-rc.0 h1:PZerqDccRfhZZ19PYCfO6kJIJhuNOZpRQ9tJzPSFeE4=
-k8s.io/client-go v0.24.0-rc.0/go.mod h1:zH+SNmPKPUz09GNMCW2Bu5reKghTVx6TpYepwG2mCIM=
+k8s.io/client-go v0.24.0 h1:lbE4aB1gTHvYFSwm6eD3OF14NhFDKCejlnsGYlSJe5U=
+k8s.io/client-go v0.24.0/go.mod h1:VFPQET+cAFpYxh6Bq6f4xyMY80G6jKKktU6G0m00VDw=
 k8s.io/code-generator v0.23.0/go.mod h1:vQvOhDXhuzqiVfM/YHp+dmg10WDZCchJVObc9MvowsE=
 k8s.io/code-generator v0.23.2/go.mod h1:S0Q1JVA+kSzTI1oUvbKAxZY/DYbA/ZUb4Uknog12ETk=
 k8s.io/code-generator v0.23.5/go.mod h1:S0Q1JVA+kSzTI1oUvbKAxZY/DYbA/ZUb4Uknog12ETk=
 k8s.io/code-generator v0.24.0-beta.0/go.mod h1:dpVhs00hTuTdTY6jvVxvTFCk6gSMrtfRydbhZwHI15w=
-k8s.io/code-generator v0.24.0-rc.0/go.mod h1:dpVhs00hTuTdTY6jvVxvTFCk6gSMrtfRydbhZwHI15w=
+k8s.io/code-generator v0.24.0/go.mod h1:dpVhs00hTuTdTY6jvVxvTFCk6gSMrtfRydbhZwHI15w=
 k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk=
 k8s.io/component-base v0.20.4/go.mod h1:t4p9EdiagbVCJKrQ1RsA5/V4rFQNDfRlevJajlGwgjI=
 k8s.io/component-base v0.20.6/go.mod h1:6f1MPBAeI+mvuts3sIdtpjljHWBQ2cIy38oBIWMYnrM=
 k8s.io/component-base v0.23.0/go.mod h1:DHH5uiFvLC1edCpvcTDV++NKULdYYU6pR9Tt3HIKMKI=
 k8s.io/component-base v0.23.2/go.mod h1:wS9Z03MO3oJ0RU8bB/dbXTiluGju+SC/F5i660gxB8c=
 k8s.io/component-base v0.24.0-beta.0/go.mod h1:UrgHIn7am00FE1rRmr0GHCiNZg7oZO+Oh6iXROJt2oU=
-k8s.io/component-base v0.24.0-rc.0 h1:S2xaUcNXdZXHxMjSaVv7vtYgtwYnxqZHB0aHGm9dtVU=
-k8s.io/component-base v0.24.0-rc.0/go.mod h1:ACHgb2t5mV1LZHXVYQB8krxcTq2/dpYsjamlsiZJGXg=
+k8s.io/component-base v0.24.0 h1:h5jieHZQoHrY/lHG+HyrSbJeyfuitheBvqvKwKHVC0g=
+k8s.io/component-base v0.24.0/go.mod h1:Dgazgon0i7KYUsS8krG8muGiMVtUZxG037l1MKyXgrA=
 k8s.io/component-helpers v0.23.2/go.mod h1:J6CMwiaf0izLoNwiLl2OymB4+rGTsTpWp6PL/AqOM4U=
-k8s.io/component-helpers v0.24.0-rc.0/go.mod h1:ZCHo6Gwap4GKV5hYkcCysLT8TW8PGtq+4qqGpNEylJE=
+k8s.io/component-helpers v0.24.0/go.mod h1:Q2SlLm4h6g6lPTC9GMMfzdywfLSvJT2f1hOnnjaWD8c=
 k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM=
 k8s.io/cri-api v0.20.1/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI=
 k8s.io/cri-api v0.20.4/go.mod h1:2JRbKt+BFLTjtrILYVqQK5jqhI+XNdF6UiGMgczeBCI=
@@ -1807,11 +1807,11 @@ k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42/go.mod h1:Z/45zLw8lUo4wdi
 k8s.io/kube-openapi v0.0.0-20220401212409-b28bf2818661 h1:nqYOUleKLC/0P1zbU29F5q6aoezM6MOAVz+iyfQbZ5M=
 k8s.io/kube-openapi v0.0.0-20220401212409-b28bf2818661/go.mod h1:daOouuuwd9JXpv1L7Y34iV3yf6nxzipkKMWWlqlvK9M=
 k8s.io/kubectl v0.23.2/go.mod h1:zWm5wt8PdRmHiVhE9a7q7XYW4WFX9StkZGnC18+1v3M=
-k8s.io/kubectl v0.24.0-rc.0 h1:SjAtvBp4oZ+oFMvWVzvrs2EQV2Skn48RjVexaqhBpA4=
-k8s.io/kubectl v0.24.0-rc.0/go.mod h1:PSKGtqIwErHxbej7DOZ2YeuEejQL4nUXYdO5XldVhjo=
+k8s.io/kubectl v0.24.0 h1:nA+WtMLVdXUs4wLogGd1mPTAesnLdBpCVgCmz3I7dXo=
+k8s.io/kubectl v0.24.0/go.mod h1:pdXkmCyHiRTqjYfyUJiXtbVNURhv0/Q1TyRhy2d5ic0=
 k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
 k8s.io/metrics v0.23.2/go.mod h1:idJHc+lLK5teHUC6Z2+d6qTKA12d5FLDxmC/DHiUYKc=
-k8s.io/metrics v0.24.0-rc.0/go.mod h1:XqqGXg39Dvzmfl+vvAZhIoU1WsvvfqGQ0idWXEhwSSo=
+k8s.io/metrics v0.24.0/go.mod h1:jrLlFGdKl3X+szubOXPG0Lf2aVxuV3QJcbsgVRAM6fI=
 k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
 k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
 k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
@@ -1827,7 +1827,6 @@ sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyz
 sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.25/go.mod h1:Mlj9PNLmG9bZ6BHFwFKDo5afkpWyUISkb9Me0GnK66I=
 sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.30 h1:dUk62HQ3ZFhD48Qr8MIXCiKA8wInBQCtuE4QGfFW7yA=
 sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.30/go.mod h1:fEO7lRTdivWO2qYVCVG7dEADOMo/MLDCVr8So2g88Uw=
-sigs.k8s.io/cli-utils v0.29.2/go.mod h1:WDVRa5/eQBKntG++uyKdyT+xU7MLdCR4XsgseqL5uX4=
 sigs.k8s.io/cli-utils v0.29.4 h1:1bsZ5bE90Mbl6Jat4nmZULJCOkLQ9rwJVVrREgqtXT4=
 sigs.k8s.io/cli-utils v0.29.4/go.mod h1:WDVRa5/eQBKntG++uyKdyT+xU7MLdCR4XsgseqL5uX4=
 sigs.k8s.io/controller-runtime v0.11.0/go.mod h1:KKwLiTooNGu+JmLZGn9Sl3Gjmfj66eMbCQznLP5zcqA=
diff --git a/porch/scripts/create-deployment-blueprint.sh b/porch/scripts/create-deployment-blueprint.sh
index efec9c0e..55783a13 100755
--- a/porch/scripts/create-deployment-blueprint.sh
+++ b/porch/scripts/create-deployment-blueprint.sh
@@ -131,8 +131,9 @@ function customize-image-in-env {
   local NEW="${2}"
   local TAG="${NEW##*:}"
   local IMG="${NEW%:*}"
+  local FN_CONFIG="${PORCH_DIR}/.build/set-image-config.yaml"
 
-  cat > set-image-config.yaml << EOF
+  cat > "${FN_CONFIG}" << EOF
 apiVersion: fn.kpt.dev/v1alpha1
 kind: SetImage
 metadata:
@@ -140,7 +141,7 @@ metadata:
 image:
   name: ${OLD}
   newName: ${IMG}
-  newTag: "${TAG}"
+  newTag: ${TAG}
 additionalImageFields:
 - group: apps
   version: v1
@@ -148,8 +149,9 @@ additionalImageFields:
   path: spec/template/spec/containers[]/env[]/value
 EOF
 
-  kpt fn eval "${DESTINATION}" --image set-image:v0.1.0 --fn-config set-image-config.yaml
-  rm set-image-config.yaml
+  trap "rm -f ${FN_CONFIG}" EXIT
+
+  kpt fn eval "${DESTINATION}" --image set-image:v0.1.0 --fn-config "${FN_CONFIG}" || echo "kpt fn eval failed"
 }
 
 function customize-sa {
diff --git a/thirdparty/cli-utils/status/cmdstatus.go b/thirdparty/cli-utils/status/cmdstatus.go
index 82dfb3db..6ddfc4ed 100644
--- a/thirdparty/cli-utils/status/cmdstatus.go
+++ b/thirdparty/cli-utils/status/cmdstatus.go
@@ -237,5 +237,5 @@ func pollerFactoryFunc(f util.Factory) (poller.Poller, error) {
 }
 
 func invClient(f util.Factory) (inventory.Client, error) {
-	return inventory.NewClient(f, live.WrapInventoryObj, live.InvToUnstructuredFunc)
+	return inventory.NewClient(f, live.WrapInventoryObj, live.InvToUnstructuredFunc, inventory.StatusPolicyAll)
 }


Test patch:
diff --git a/e2e/testdata/porch/rpkg-clone/config.yaml b/e2e/testdata/porch/rpkg-clone/config.yaml
index d235d975..8c23448f 100644
--- a/e2e/testdata/porch/rpkg-clone/config.yaml
+++ b/e2e/testdata/porch/rpkg-clone/config.yaml
@@ -11,9 +11,7 @@ commands:
       - rpkg
       - clone
       - --namespace=rpkg-clone
-      - https://github.com/platkrm/test-blueprints.git
-      - --directory=basens
-      - --ref=basens/v1
+      - https://github.com/platkrm/test-blueprints.git/basens@basens/v1
       - --repository=git
       - --revision=v0
       - basens-clone
diff --git a/internal/util/parse/parse_test.go b/internal/util/parse/parse_test.go
index cec11b66..47799d9d 100644
--- a/internal/util/parse/parse_test.go
+++ b/internal/util/parse/parse_test.go
@@ -201,7 +201,7 @@ func Test_parseURL(t *testing.T) {
 		},
 		"no ref": {
 			ghURL:    "https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/apply-replacements-simple",
-			expected: expected{repo: "https://github.com/GoogleContainerTools/kpt-functions-catalog", dir: "/examples/apply-replacements-simple", version: "master"},
+			expected: expected{repo: "https://github.com/GoogleContainerTools/kpt-functions-catalog", dir: "/examples/apply-replacements-simple", version: ""},
 		},
 		".git appears in the middle": {
 			ghURL:    "https://my-site.com/root.gitops.git/foo@main",
@@ -211,8 +211,7 @@ func Test_parseURL(t *testing.T) {
 	for name, test := range tests {
 		test := test // capture range variable
 		t.Run(name, func(t *testing.T) {
-			ctx := printer.WithContext(context.Background(), printer.New(nil, nil))
-			repo, dir, version, err := parseURL(ctx, test.ghURL)
+			repo, dir, version, err := ParseURL(test.ghURL)
 			assert.NoError(t, err)
 			assert.Equal(t, expected{repo: repo, dir: dir, version: version}, test.expected)
 		})