Skip to content

Commit

Permalink
Feat: upgrade kubevela and pkg (#848)
Browse files Browse the repository at this point in the history
* Feat: upgrade kubevela and pkg

Signed-off-by: Qiaozp <[email protected]>

* reviewable

Signed-off-by: Qiaozp <[email protected]>

* Fix nil pointer

Signed-off-by: Qiaozp <[email protected]>

* Migrate cloudprovider

Signed-off-by: Qiaozp <[email protected]>

* Upgrade ginkgo to v2

Signed-off-by: Qiaozp <[email protected]>

* fix: add cloudshell to scheme

Signed-off-by: Qiaozp <[email protected]>

* Fix: ginkgo by clause

Signed-off-by: Qiaozp <[email protected]>

* Fix: addon dependency test

Signed-off-by: Qiaozp <[email protected]>

* rollback pending test

Signed-off-by: Qiaozp <[email protected]>

---------

Signed-off-by: Qiaozp <[email protected]>
  • Loading branch information
chivalryq authored Jun 26, 2023
1 parent 7a81518 commit ff8382c
Show file tree
Hide file tree
Showing 109 changed files with 1,092 additions and 840 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/commit-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: thehanimo/pr-title-checker@v1.3.1
- uses: thehanimo/pr-title-checker@v1.4.0
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pass_on_octokit_error: true
Expand Down
7 changes: 3 additions & 4 deletions cmd/server/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
"os/signal"
"syscall"

"github.com/kubevela/pkg/util/profiling"

restfulspec "github.com/emicklei/go-restful-openapi/v2"
"github.com/fatih/color"
"github.com/go-openapi/spec"
Expand All @@ -33,7 +35,6 @@ import (
"github.com/kubevela/velaux/cmd/server/app/options"
"github.com/kubevela/velaux/pkg/server"

"github.com/oam-dev/kubevela/pkg/utils"
"github.com/oam-dev/kubevela/version"
)

Expand Down Expand Up @@ -111,9 +112,7 @@ func Run(s *options.ServerRunOptions) error {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

if s.GenericServerRunOptions.PprofAddr != "" {
go utils.EnablePprof(s.GenericServerRunOptions.PprofAddr, errChan)
}
go profiling.StartProfilingServer(errChan)

go func() {
if err := run(ctx, s, errChan); err != nil {
Expand Down
7 changes: 7 additions & 0 deletions e2e-test/addon/bar/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: bar
version: 1.0.0
description: Vela test addon named bar
icon: https://www.nar.com/icon
url: https://www.bar.com


2 changes: 1 addition & 1 deletion e2e-test/addon/testdata/mock-dep-addon/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: mock-dep-addon
version: v1.0.0
version: 1.0.0
description: Vela test addon named mock-dep-addon
icon: https://www.test.com/icon
url: https://www.test.com
Expand Down
Binary file added e2e-test/addon/testrepo/helm-repo/bar-1.0.0.tgz
Binary file not shown.
Binary file added e2e-test/addon/testrepo/helm-repo/bar-2.0.0.tgz
Binary file not shown.
Binary file removed e2e-test/addon/testrepo/helm-repo/bar-v1.0.0.tgz
Binary file not shown.
Binary file removed e2e-test/addon/testrepo/helm-repo/bar-v2.0.0.tgz
Binary file not shown.
Binary file added e2e-test/addon/testrepo/helm-repo/foo-1.0.0.tgz
Binary file not shown.
Binary file removed e2e-test/addon/testrepo/helm-repo/foo-v1.0.0.tgz
Binary file not shown.
16 changes: 8 additions & 8 deletions e2e-test/addon/testrepo/helm-repo/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,32 @@ entries:
icon: https://www.test.com
name: mock-be-dep-addon
urls:
- http://127.0.0.1:9098/helm/mock-be-dep-addon-v1.0.0.tgz
version: v1.0.0
- http://127.0.0.1:9098/helm/mock-be-dep-addon-1.0.0.tgz
version: 1.0.0
foo:
- created: "2022-10-29T09:11:16.865230605Z"
description: Vela test addon named foo
home: https://www.foo.com/icon
icon: https://www.foo.com
name: foo
urls:
- http://127.0.0.1:9098/helm/foo-v1.0.0.tgz
version: v1.0.0
- http://127.0.0.1:9098/helm/foo-1.0.0.tgz
version: 1.0.0
bar:
- created: "2022-10-29T09:11:16.865230605Z"
description: Vela test addon named bar
home: https://www.bar.com/icon
icon: https://www.bar.com
name: foo
urls:
- http://127.0.0.1:9098/helm/bar-v1.0.0.tgz
version: v1.0.0
- http://127.0.0.1:9098/helm/bar-1.0.0.tgz
version: 1.0.0
- created: "2022-10-29T09:11:16.865230605Z"
description: Vela test addon named bar
home: https://www.bar.com/icon
icon: https://www.bar.com
name: foo
urls:
- http://127.0.0.1:9098/helm/bar-v2.0.0.tgz
version: v2.0.0
- http://127.0.0.1:9098/helm/bar-2.0.0.tgz
version: 2.0.0
generated: "2022-06-15T13:17:04.733573+08:00"
Binary file not shown.
Binary file not shown.
34 changes: 8 additions & 26 deletions e2e-test/addon/vela_addon_mock_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,44 +114,26 @@ var helmHandler http.HandlerFunc = func(rw http.ResponseWriter, req *http.Reques
_, _ = rw.Write([]byte(err.Error()))
}
_, _ = rw.Write(file)
case strings.Contains(req.URL.Path, "fluxcd-test-version-1.0.0.tgz"):
file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/fluxcd-test-version-1.0.0.tgz")
case strings.Contains(req.URL.Path, "foo-1.0.0.tgz"):
file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/foo-1.0.0.tgz")
if err != nil {
_, _ = rw.Write([]byte(err.Error()))
}
_, _ = rw.Write(file)
case strings.Contains(req.URL.Path, "fluxcd-test-version-2.0.0.tgz"):
file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/fluxcd-test-version-2.0.0.tgz")
case strings.Contains(req.URL.Path, "bar-1.0.0.tgz"):
file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/bar-1.0.0.tgz")
if err != nil {
_, _ = rw.Write([]byte(err.Error()))
}
_, _ = rw.Write(file)
case strings.Contains(req.URL.Path, "vela-workflow-v0.3.5.tgz"):
file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/vela-workflow-v0.3.5.tgz")
case strings.Contains(req.URL.Path, "bar-2.0.0.tgz"):
file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/bar-2.0.0.tgz")
if err != nil {
_, _ = rw.Write([]byte(err.Error()))
}
_, _ = rw.Write(file)
case strings.Contains(req.URL.Path, "foo-v1.0.0.tgz"):
file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/foo-v1.0.0.tgz")
if err != nil {
_, _ = rw.Write([]byte(err.Error()))
}
_, _ = rw.Write(file)
case strings.Contains(req.URL.Path, "bar-v1.0.0.tgz"):
file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/bar-v1.0.0.tgz")
if err != nil {
_, _ = rw.Write([]byte(err.Error()))
}
_, _ = rw.Write(file)
case strings.Contains(req.URL.Path, "bar-v2.0.0.tgz"):
file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/bar-v2.0.0.tgz")
if err != nil {
_, _ = rw.Write([]byte(err.Error()))
}
_, _ = rw.Write(file)
case strings.Contains(req.URL.Path, "mock-be-dep-addon-v1.0.0.tgz"):
file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/mock-be-dep-addon-v1.0.0.tgz")
case strings.Contains(req.URL.Path, "mock-be-dep-addon-1.0.0.tgz"):
file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/mock-be-dep-addon-1.0.0.tgz")
if err != nil {
_, _ = rw.Write([]byte(err.Error()))
}
Expand Down
6 changes: 3 additions & 3 deletions e2e-test/addon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"strings"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/oam-dev/kubevela/pkg/addon"
Expand Down Expand Up @@ -229,7 +229,7 @@ var _ = Describe("Test addon rest api", func() {
var newaddonStatus apisv1.AddonStatusResponse
g.Expect(decodeResponseBody(status, &newaddonStatus)).Should(Succeed())
g.Expect(newaddonStatus.Name).Should(BeEquivalentTo("bar"))
g.Expect(newaddonStatus.InstalledVersion).Should(BeEquivalentTo("v1.0.0"))
g.Expect(newaddonStatus.InstalledVersion).Should(BeEquivalentTo("1.0.0"))
}, 30*time.Second, 300*time.Millisecond).Should(Succeed())
})
})
Expand All @@ -248,7 +248,7 @@ var _ = Describe("Test addon rest api", func() {
var newaddonStatus apisv1.AddonStatusResponse
g.Expect(decodeResponseBody(status, &newaddonStatus)).Should(Succeed())
g.Expect(newaddonStatus.Name).Should(BeEquivalentTo("mock-dep-addon"))
g.Expect(newaddonStatus.InstalledVersion).Should(BeEquivalentTo("v1.0.0"))
g.Expect(newaddonStatus.InstalledVersion).Should(BeEquivalentTo("1.0.0"))
g.Expect(newaddonStatus.Phase).Should(BeEquivalentTo(apisv1.AddonPhaseEnabled))
}, 30*time.Second, 300*time.Millisecond).Should(Succeed())
})
Expand Down
2 changes: 1 addition & 1 deletion e2e-test/application_rollback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"time"

"github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
Expand Down
2 changes: 1 addition & 1 deletion e2e-test/application_sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"time"

"github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/types"

Expand Down
2 changes: 1 addition & 1 deletion e2e-test/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"time"

"github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/types"

Expand Down
2 changes: 1 addition & 1 deletion e2e-test/application_workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"time"

"github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/kubevela/workflow/api/v1alpha1"
Expand Down
2 changes: 1 addition & 1 deletion e2e-test/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"os"
"time"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/kubevela/pkg/util/rand"
Expand Down
2 changes: 1 addition & 1 deletion e2e-test/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"context"
"fmt"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/oam-dev/kubevela/apis/types"
Expand Down
2 changes: 1 addition & 1 deletion e2e-test/definition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"context"
"fmt"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"

Expand Down
2 changes: 1 addition & 1 deletion e2e-test/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"time"

"github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/oam-dev/kubevela/pkg/multicluster"
Expand Down
2 changes: 1 addition & 1 deletion e2e-test/oam_application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"time"

"github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"sigs.k8s.io/controller-runtime/pkg/client"

Expand Down
2 changes: 1 addition & 1 deletion e2e-test/pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

"github.com/google/go-cmp/cmp"
"github.com/kubevela/workflow/api/v1alpha1"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
Expand Down
14 changes: 4 additions & 10 deletions e2e-test/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"fmt"

"cuelang.org/go/pkg/strings"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"

Expand All @@ -36,9 +36,7 @@ func enablePlugin(id string) {
}

var _ = Describe("Test the plugin rest api", func() {
Context("Test manage plugin API", func() {
By("Request to /manage/plugins")

Context("Test manage plugin API. Request to /manage/plugins", func() {
It("Test list installed plugins", func() {
defer GinkgoRecover()
res := get("/manage/plugins")
Expand Down Expand Up @@ -109,9 +107,7 @@ var _ = Describe("Test the plugin rest api", func() {
})
})

Context("Test plugin API", func() {
By("Request to /proxy/plugins")

Context("Test plugin API. Request to /proxy/plugins", func() {
It("Test to request the kube API", func() {
defer GinkgoRecover()
By("Before enable the plugin, request the plugin API should return 400")
Expand All @@ -131,9 +127,7 @@ var _ = Describe("Test the plugin rest api", func() {
})
})

Context("Test to request the plugin static files", func() {
By("Request to /public/plugins")

Context("Test to request the plugin static files. Request to /public/plugins", func() {
It("Test to get the module file", func() {
defer GinkgoRecover()
res := get(baseDomain + "/public/plugins/app-demo/module.js")
Expand Down
2 changes: 1 addition & 1 deletion e2e-test/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"time"

"github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

apisv1 "github.com/kubevela/velaux/pkg/server/interfaces/api/dto/v1"
Expand Down
2 changes: 1 addition & 1 deletion e2e-test/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package e2e_test
import (
"io"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

Expand Down
4 changes: 2 additions & 2 deletions e2e-test/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"time"

"github.com/google/uuid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -147,7 +147,7 @@ var _ = BeforeSuite(func() {
err = json.NewDecoder(resp.Body).Decode(code)
Expect(err).Should(BeNil())
return fmt.Errorf("rest service not ready code:%d message:%s", resp.StatusCode, code.Message)
}, time.Second*60, time.Millisecond*200).Should(Succeed())
}).WithTimeout(time.Second * 60).WithPolling(time.Millisecond * 200).Should(Succeed())
var err error
k8sClient, err = clients.GetKubeClient()
Expect(err).ShouldNot(HaveOccurred())
Expand Down
2 changes: 1 addition & 1 deletion e2e-test/system_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package e2e_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

apisv1 "github.com/kubevela/velaux/pkg/server/interfaces/api/dto/v1"
Expand Down
2 changes: 1 addition & 1 deletion e2e-test/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package e2e_test
import (
"fmt"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

apisv1 "github.com/kubevela/velaux/pkg/server/interfaces/api/dto/v1"
Expand Down
2 changes: 1 addition & 1 deletion e2e-test/velaql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

types2 "github.com/oam-dev/kubevela/pkg/velaql/providers/query/types"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/pkg/errors"
batchv1 "k8s.io/api/batch/v1"
Expand Down
Loading

0 comments on commit ff8382c

Please sign in to comment.