package config_handler import ( "git.icechen.cn/pkg/drone_plugin/git" "gopkg.in/yaml.v3" ) const TypeMonorepo = "monorepo" // 单库类型 type Config struct { Kind string `json:"kind" yaml:"kind"` Type string `json:"type" yaml:"type"` Name string `json:"name" yaml:"name"` Api ApiList `json:"api" yaml:"api"` Service ServiceList `json:"service" yaml:"service"` } type ( ApiList []Api Api struct { Name string `json:"name" yaml:"name"` Root string `json:"root" yaml:"root"` Type string `json:"type" yaml:"type"` } ) type ( ServiceList []Service Service struct { Name string `json:"name" yaml:"name"` Root string `json:"root" yaml:"root"` Type string `json:"type" yaml:"type"` } ) // getRealConfig 获取原始配置文件内容 func getRealConfig(client git.Client) (Config, error) { var c Config realConfigContent, err := client.GetRealConfig() if err != nil { return c, err } err = yaml.Unmarshal([]byte(realConfigContent), &c) return c, err }