From fa48974bd0110b340233f8b4d662c1d02b37fcfa Mon Sep 17 00:00:00 2001 From: ysicing Date: Wed, 17 Jul 2024 14:27:09 +0800 Subject: [PATCH] chore: update project configuration and file headers - Change the company name and website in the license header - Add a new staticcheck rule in the golangci.yml file - Remove the color package import in the cmd/app/list.go file Signed-off-by: ysicing --- .go-header.txt | 2 +- .golangci.yml | 3 +++ cmd/app/list.go | 33 ----------------------- cmd/app/restart.go | 8 +++--- hack/manifests/scripts/etcd-snapshot.sh | 0 hack/manifests/scripts/kubectl-restart.sh | 0 hack/manifests/scripts/upgrade-ingress.sh | 4 +++ 7 files changed, 12 insertions(+), 38 deletions(-) mode change 100644 => 100755 hack/manifests/scripts/etcd-snapshot.sh mode change 100644 => 100755 hack/manifests/scripts/kubectl-restart.sh create mode 100755 hack/manifests/scripts/upgrade-ingress.sh diff --git a/.go-header.txt b/.go-header.txt index b30a8cf2..121e26c2 100644 --- a/.go-header.txt +++ b/.go-header.txt @@ -1,4 +1,4 @@ -Copyright (c) 2021-2023 北京渠成软件有限公司(Beijing Qucheng Software Co., Ltd. www.qucheng.com) All rights reserved. +Copyright (c) 2021-2024 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net) All rights reserved. Use of this source code is covered by the following dual licenses: (1) Z PUBLIC LICENSE 1.2 (ZPL 1.2) (2) Affero General Public License 3.0 (AGPL 3.0) diff --git a/.golangci.yml b/.golangci.yml index 306e9b51..3322f29e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -68,6 +68,9 @@ issues: - linters: - goheader text: "rights reserved" + - linters: + - staticcheck + text: "SA1019: common.ZenTaoOldOSSType is deprecated" exclude-dirs: - hack/bin - testdata$ diff --git a/cmd/app/list.go b/cmd/app/list.go index dc44ec8d..5b4e113c 100644 --- a/cmd/app/list.go +++ b/cmd/app/list.go @@ -11,7 +11,6 @@ import ( "fmt" "github.com/cockroachdb/errors" - "github.com/ergoapi/util/color" "github.com/manifoldco/promptui" "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/labels" @@ -19,7 +18,6 @@ import ( "github.com/easysoft/qcadmin/internal/pkg/k8s" "github.com/easysoft/qcadmin/internal/pkg/util/factory" "github.com/easysoft/qcadmin/internal/pkg/util/helm" - "github.com/easysoft/qcadmin/internal/pkg/util/kutil" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -58,37 +56,6 @@ func NewCmdAppList(f factory.Factory) *cobra.Command { } it, _, _ := selectApp.Run() log.Infof("select app: %s", release[it].Name) - - selectInfo := promptui.Select{ - Label: "select action: meta get url info, svc get container service message", - Items: []string{"meta", "svc"}, - } - _, infoAction, _ := selectInfo.Run() - if infoAction == "meta" { - values, err := hc.GetAllValues(release[it].Name) - if err != nil { - return err - } - host := getMapValue(getMap(getMap(values, "global"), "ingress"), "host") - if len(host) != 0 { - if kutil.IsLegalDomain(host) { - host = fmt.Sprintf("https://%s", host) - } else { - host = fmt.Sprintf("http://%s", host) - } - } - auth := getMap(values, "auth") - if auth != nil { - authUsername := getMapValue(auth, "username") - authPassword := getMapValue(auth, "password") - log.Debugf("authUsername: %s, authPassword: %s", authUsername, authPassword) - log.Infof("app meta:\n\t username: %s\n\t password: %s\n\t url: %s", color.SBlue(authUsername), color.SBlue(authPassword), color.SBlue(host)) - } else { - log.Infof("app meta:\n\t url: %s", color.SBlue(host)) - } - return nil - } - k8sClient, err := k8s.NewSimpleClient() if err != nil { log.Errorf("k8s client err: %v", err) diff --git a/cmd/app/restart.go b/cmd/app/restart.go index 000b7438..0fa8b66d 100644 --- a/cmd/app/restart.go +++ b/cmd/app/restart.go @@ -26,10 +26,10 @@ func NewCmdAppRestart(f factory.Factory) *cobra.Command { log := f.GetLog() var useip bool app := &cobra.Command{ - Use: "restart", - Short: "restart app", - Args: cobra.ExactArgs(1), - Example: `z app`, + Use: "restart", + Short: "restart app", + Args: cobra.ExactArgs(1), + Example: `z app`, RunE: func(cmd *cobra.Command, args []string) error { url := args[0] apidebug := log.GetLevel() == logrus.DebugLevel diff --git a/hack/manifests/scripts/etcd-snapshot.sh b/hack/manifests/scripts/etcd-snapshot.sh old mode 100644 new mode 100755 diff --git a/hack/manifests/scripts/kubectl-restart.sh b/hack/manifests/scripts/kubectl-restart.sh old mode 100644 new mode 100755 diff --git a/hack/manifests/scripts/upgrade-ingress.sh b/hack/manifests/scripts/upgrade-ingress.sh new file mode 100755 index 00000000..b5d3bbe8 --- /dev/null +++ b/hack/manifests/scripts/upgrade-ingress.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +z helm repo update +z helm upgrade -i ingress install/nginx-ingress-controller -n quickon-system