Skip to content

Commit

Permalink
Fix the application spec path (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinuxSuRen committed Apr 1, 2022
1 parent 57a1d71 commit 38ba795
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions kubectl-plugin/app/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ func getApplication(name, namespace string, client dynamic.Interface) (app *appl
return
}

gitRepo, _, _ := unstructured.NestedString(unstructedObject.Object, "spec", "argoApp", "source", "repoURL")
branch, _, _ := unstructured.NestedString(unstructedObject.Object, "spec", "argoApp", "source", "targetRevision")
directory, _, _ := unstructured.NestedString(unstructedObject.Object, "spec", "argoApp", "source", "path")
gitRepo, _, _ := unstructured.NestedString(unstructedObject.Object, "spec", "argoApp", "spec", "source", "repoURL")
branch, _, _ := unstructured.NestedString(unstructedObject.Object, "spec", "argoApp", "spec", "source", "targetRevision")
directory, _, _ := unstructured.NestedString(unstructedObject.Object, "spec", "argoApp", "spec", "source", "path")

app = &application{
namespace: namespace,
Expand Down
8 changes: 4 additions & 4 deletions kubectl-plugin/app/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ func Test_getApplication(t *testing.T) {
defaultApp.SetAPIVersion("gitops.kubesphere.io/v1alpha1")
defaultApp.SetNamespace("ns")
defaultApp.SetName("fake")
_ = unstructured.SetNestedField(defaultApp.Object, "http://git.com", "spec", "argoApp", "source", "repoURL")
_ = unstructured.SetNestedField(defaultApp.Object, "master", "spec", "argoApp", "source", "targetRevision")
_ = unstructured.SetNestedField(defaultApp.Object, "current", "spec", "argoApp", "source", "path")
_ = unstructured.SetNestedField(defaultApp.Object, "http://git.com", "spec", "argoApp", "spec", "source", "repoURL")
_ = unstructured.SetNestedField(defaultApp.Object, "master", "spec", "argoApp", "spec", "source", "targetRevision")
_ = unstructured.SetNestedField(defaultApp.Object, "current", "spec", "argoApp", "spec", "source", "path")

invalidApp := defaultApp.DeepCopy()
_ = unstructured.SetNestedField(invalidApp.Object, "", "spec", "argoApp", "source", "repoURL")
_ = unstructured.SetNestedField(invalidApp.Object, "", "spec", "argoApp", "spec", "source", "repoURL")

scheme := runtime.NewScheme()

Expand Down

0 comments on commit 38ba795

Please sign in to comment.