@@ -14,16 +14,14 @@ const (
1414 repoScaffoldingPluginName = "repo-scaffolding"
1515)
1616
17- type (
18- appRaw struct {
19- Name string `yaml:"name" mapstructure:"name"`
20- Spec map [string ]any `yaml:"spec" mapstructure:"spec"`
21- Repo * scm.SCMInfo `yaml:"repo" mapstructure:"repo"`
22- RepoTemplate * scm.SCMInfo `yaml:"repoTemplate" mapstructure:"repoTemplate"`
23- CIRawConfigs []pipelineRaw `yaml:"ci" mapstructure:"ci"`
24- CDRawConfigs []pipelineRaw `yaml:"cd" mapstructure:"cd"`
25- }
26- )
17+ type RawApp struct {
18+ Name string `yaml:"name" mapstructure:"name"`
19+ Spec map [string ]any `yaml:"spec" mapstructure:"spec"`
20+ Repo * scm.SCMInfo `yaml:"repo" mapstructure:"repo"`
21+ RepoTemplate * scm.SCMInfo `yaml:"repoTemplate" mapstructure:"repoTemplate"`
22+ CIRawConfigs []pipelineRaw `yaml:"ci" mapstructure:"ci"`
23+ CDRawConfigs []pipelineRaw `yaml:"cd" mapstructure:"cd"`
24+ }
2725
2826// getToolsFromApp return app tools
2927func getToolsFromApp (appStr string , globalVars map [string ]any , templateMap map [string ]string ) (Tools , error ) {
@@ -33,8 +31,8 @@ func getToolsFromApp(appStr string, globalVars map[string]any, templateMap map[s
3331 log .Debugf ("configmanager/app %s render globalVars %+v failed" , appRenderStr , globalVars )
3432 return nil , fmt .Errorf ("app render globalVars failed: %w" , err )
3533 }
36- // 2. unmarshal appRaw config for render pipelineTemplate
37- var rawData appRaw
34+ // 2. unmarshal RawApp config for render pipelineTemplate
35+ var rawData RawApp
3836 if err := yaml .Unmarshal ([]byte (appRenderStr ), & rawData ); err != nil {
3937 return nil , fmt .Errorf ("app parse yaml failed: %w" , err )
4038 }
@@ -57,7 +55,7 @@ func getToolsFromApp(appStr string, globalVars map[string]any, templateMap map[s
5755}
5856
5957// getAppPipelineTool generate ci/cd tools from app config
60- func (a * appRaw ) generateCICDToolsFromAppConfig (templateMap map [string ]string , appVars map [string ]any ) (Tools , error ) {
58+ func (a * RawApp ) generateCICDToolsFromAppConfig (templateMap map [string ]string , appVars map [string ]any ) (Tools , error ) {
6159 allPipelineRaw := append (a .CIRawConfigs , a .CDRawConfigs ... )
6260 var tools Tools
6361 for _ , p := range allPipelineRaw {
@@ -76,7 +74,7 @@ func (a *appRaw) generateCICDToolsFromAppConfig(templateMap map[string]string, a
7674}
7775
7876// getRepoTemplateTool will use repo-scaffolding plugin for app
79- func (a * appRaw ) getRepoTemplateTool (appVars map [string ]any ) (* Tool , error ) {
77+ func (a * RawApp ) getRepoTemplateTool (appVars map [string ]any ) (* Tool , error ) {
8078 if a .Repo == nil {
8179 return nil , fmt .Errorf ("app.repo field can't be empty" )
8280 }
@@ -101,14 +99,14 @@ func (a *appRaw) getRepoTemplateTool(appVars map[string]any) (*Tool, error) {
10199}
102100
103101// setDefault will set repoName to appName if repo.name field is empty
104- func (a * appRaw ) setDefault () {
102+ func (a * RawApp ) setDefault () {
105103 if a .Repo != nil && a .Repo .Name == "" {
106104 a .Repo .Name = a .Name
107105 }
108106}
109107
110108// since all plugin depends on code is deployed, get dependsOn for repoTemplate
111- func (a * appRaw ) getRepoTemplateDependants () []string {
109+ func (a * RawApp ) getRepoTemplateDependants () []string {
112110 var dependsOn []string
113111 // if a.RepoTemplate is configured, pipeline need to wait reposcaffolding finished
114112 if a .RepoTemplate != nil {
0 commit comments