From a0811d62e72183841a91fb8d7120731a58053a8a Mon Sep 17 00:00:00 2001 From: zeaslity Date: Mon, 10 Feb 2025 11:15:35 +0800 Subject: [PATCH] =?UTF-8?q?[agent-wdd]-=E9=87=8D=E6=9E=84agent=E7=9A=84bas?= =?UTF-8?q?tion=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agent-go/main.go | 1 + agent-operator/CmiiDeployOperator_test.go | 21 +++++++ agent-operator/CmiiImageSyncOperator_test.go | 2 +- agent-operator/CmiiK8sHigherOperator_test.go | 6 +- agent-wdd/Makefile | 8 +++ agent-wdd/cmd/root.go | 65 ++++++++++++++++++++ agent-wdd/go.mod | 31 ++++++++++ agent-wdd/main.go | 7 +++ 8 files changed, 138 insertions(+), 3 deletions(-) create mode 100644 agent-wdd/Makefile create mode 100644 agent-wdd/cmd/root.go create mode 100644 agent-wdd/go.mod create mode 100644 agent-wdd/main.go diff --git a/agent-go/main.go b/agent-go/main.go index 4b896af..2c35135 100755 --- a/agent-go/main.go +++ b/agent-go/main.go @@ -10,6 +10,7 @@ import ( var log = logger.Log // C:\Users\wddsh\go\bin\gox.exe -osarch="linux/amd64" -output "build/octopus-agent_{{.OS}}_{{.Arch}}" +// C:\Users\wdd\go\bin\gox.exe -osarch="linux/arm64" -output "build/octopus-agent_{{.OS}}_{{.Arch}}" // C:\Users\wdd\go\bin\gox.exe -osarch="linux/amd64" -output "build/octopus-agent_{{.OS}}_{{.Arch}}" // /root/go/bin/gox -osarch="linux/amd64" -output "build/octopus-agent_{{.OS}}_{{.Arch}}" diff --git a/agent-operator/CmiiDeployOperator_test.go b/agent-operator/CmiiDeployOperator_test.go index 361874e..94a38e6 100755 --- a/agent-operator/CmiiDeployOperator_test.go +++ b/agent-operator/CmiiDeployOperator_test.go @@ -405,6 +405,27 @@ func TestCmiiEnvDeploy_YunNanErJiXin(t *testing.T) { } +func TestCmiiEnvDeploy_ShenZhenGuiZiXiangMu(t *testing.T) { + + // 深圳规自项目 + commonEnv := &z_dep.CommonEnvironmentConfig{ + WebIP: "39.129.174.66", + WebPort: "8088", + HarborIPOrCustomImagePrefix: "192.168.186.11", + HarborPort: "8033", + Namespace: "ynydapp", + TagVersion: "6.1.0", + TenantEnv: "", + MinioPublicIP: "", + MinioInnerIP: "192.168.186.15", + NFSServerIP: "192.168.186.15", + ApplyFilePrefix: "", + } + + CmiiEnvDeployOffline(commonEnv, true, real_project.Cmii611ImageList) + +} + func TestCmiiNewAppDeploy(t *testing.T) { deployNamespace := config.DevOperation diff --git a/agent-operator/CmiiImageSyncOperator_test.go b/agent-operator/CmiiImageSyncOperator_test.go index 8a480b4..b8ebfed 100644 --- a/agent-operator/CmiiImageSyncOperator_test.go +++ b/agent-operator/CmiiImageSyncOperator_test.go @@ -22,7 +22,7 @@ func TestFetchDependencyRepos_Middle(t *testing.T) { func TestFetchDependencyRepos_RKE(t *testing.T) { - errorPullImageList, errorGzipImageList, realCmiiImageName, allGzipFileNameList := C_DownloadCompressUploadDependency(true, true, true) + errorPullImageList, errorGzipImageList, realCmiiImageName, allGzipFileNameList := C_DownloadCompressUploadDependency(true, false, true) utils.BeautifulPrintListWithTitle(errorPullImageList, "errorPullImageList") utils.BeautifulPrintListWithTitle(errorGzipImageList, "errorGzipImageList") diff --git a/agent-operator/CmiiK8sHigherOperator_test.go b/agent-operator/CmiiK8sHigherOperator_test.go index 726fa30..375810f 100644 --- a/agent-operator/CmiiK8sHigherOperator_test.go +++ b/agent-operator/CmiiK8sHigherOperator_test.go @@ -271,7 +271,7 @@ func TestUpdateCmiiDeploymentImageTag(t *testing.T) { now := time.Now() - targetTime := time.Date(now.Year(), now.Month(), now.Day(), 17, 46, 00, 0, now.Location()) + targetTime := time.Date(now.Year(), now.Month(), now.Day(), 17, 23, 00, 0, now.Location()) duration := time.Duration(0) @@ -292,7 +292,9 @@ func TestUpdateCmiiDeploymentImageTag(t *testing.T) { appNameTagMap := map[string]string{ //"cmii-app-release": "6.1.0-122001", - "cmii-uas-lifecycle": "6.2.0-master-1.1-012201", + //"cmii-uav-platform-oms": "6.2.0-012201", + //"cmii-uas-lifecycle": "6.2.0-012301", + "cmii-uav-advanced5g": "6.2.0-master-012301", //"cmii-uav-platform-pilot2-to-cloud": "6.1.0-32030-123101", //"cmii-uav-industrial-portfolio": "6.1.0-20241125-121702", } diff --git a/agent-wdd/Makefile b/agent-wdd/Makefile new file mode 100644 index 0000000..2d6e024 --- /dev/null +++ b/agent-wdd/Makefile @@ -0,0 +1,8 @@ + + + + +.PHONY: build-linux +build-linux: ## Install dependencies + @C:\Users\wddsh\go\bin\gox.exe -osarch="linux/amd64" -output "build/agent-wdd_{{.OS}}_{{.Arch}}" + diff --git a/agent-wdd/cmd/root.go b/agent-wdd/cmd/root.go new file mode 100644 index 0000000..119feda --- /dev/null +++ b/agent-wdd/cmd/root.go @@ -0,0 +1,65 @@ +package cmd + +import ( + "fmt" + "github.com/spf13/cobra" + "github.com/spf13/viper" + "os" +) + +const WddConfigFilePath = "/usr/local/etc/wdd/" + +var rootCmd = &cobra.Command{ + Use: "wdd", + Short: "wdd应用程序是wdd封装的NB工具", + Long: `使用golang的强大特性,加上wdd的高超技术,\n打造一个方便、高效、适用于各种LINUX系统的瑞士军刀工具\n 尽情享用!`, + Run: func(cmd *cobra.Command, args []string) { + // Do Stuff Here + }, +} +var cfgFile = "" +var userLicense = "" +var projectBase = "" + +func init() { + + cobra.OnInitialize(initConfig) + + rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.cobra.yaml)") + rootCmd.PersistentFlags().StringVarP(&projectBase, "projectbase", "b", "", + "base project directory eg. github.com/spf13/") + rootCmd.PersistentFlags().StringP("author", "a", "YOUR NAME", "Author name for copyright attribution") + rootCmd.PersistentFlags().StringVarP(&userLicense, "license", "l", "", "Name of license for the project (can provide `licensetext` in config)") + rootCmd.PersistentFlags().Bool("viper", true, "Use Viper for configuration") + viper.BindPFlag("author", rootCmd.PersistentFlags().Lookup("author")) + viper.BindPFlag("projectbase", rootCmd.PersistentFlags().Lookup("projectbase")) + viper.BindPFlag("useViper", rootCmd.PersistentFlags().Lookup("viper")) + viper.SetDefault("author", "Esdeath Wang(zeaslity@gamil.com)") + viper.SetDefault("license", "apache") +} + +func initConfig() { + // Don't forget to read config either from cfgFile or from home directory! + if cfgFile != "" { + // Use config file from the flag. + viper.SetConfigFile(cfgFile) + } else { + + // Search config in home directory with name ".cobra" (without extension). + viper.AddConfigPath(WddConfigFilePath) + viper.SetConfigName(".cobra") + } + + if err := viper.ReadInConfig(); err != nil { + fmt.Println("Can't read config:", err) + os.Exit(1) + } +} + +func Execute() { + + if err := rootCmd.Execute(); err != nil { + fmt.Println(err) + os.Exit(1) + } +} diff --git a/agent-wdd/go.mod b/agent-wdd/go.mod new file mode 100644 index 0000000..54fe5bf --- /dev/null +++ b/agent-wdd/go.mod @@ -0,0 +1,31 @@ +module agent-wdd + +go 1.23.5 + +require ( + github.com/spf13/cobra v1.8.1 + github.com/spf13/viper v1.19.0 +) + +require ( + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/magiconair/properties v1.8.7 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.6.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + go.uber.org/atomic v1.9.0 // indirect + go.uber.org/multierr v1.9.0 // indirect + golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect + golang.org/x/sys v0.18.0 // indirect + golang.org/x/text v0.14.0 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/agent-wdd/main.go b/agent-wdd/main.go new file mode 100644 index 0000000..ef080d5 --- /dev/null +++ b/agent-wdd/main.go @@ -0,0 +1,7 @@ +package main + +import "agent-wdd/cmd" + +func main() { + cmd.Execute() +}