Skip to content

Commit b268bf1

Browse files
Merge pull request #4173 from Azure/skuznets/fixup-entrypoints
topology: remove standalone entrypoints for svc and mgmt infra
2 parents ec4344d + 15e6fef commit b268bf1

File tree

2 files changed

+38
-53
lines changed

2 files changed

+38
-53
lines changed

tooling/templatize/internal/well_formed_test.go

Lines changed: 38 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -76,57 +76,50 @@ func TestStepsWellFormed(t *testing.T) {
7676
t.Fatalf("failed to validate topology: %v", err)
7777
}
7878

79-
serviceGroup := "Microsoft.Azure.ARO.HCP.Global"
80-
service, err := topo.Lookup(serviceGroup)
81-
if err != nil {
82-
t.Fatalf("failed to look up entrypoint %s in topology: %v", serviceGroup, err)
83-
}
84-
85-
var e *topology.Entrypoint
86-
for _, option := range topo.Entrypoints {
87-
if option.Identifier == serviceGroup {
88-
e = &option
89-
}
90-
}
91-
if e == nil {
92-
t.Fatalf("no entrypoint found for service group %s", serviceGroup)
93-
}
79+
for _, entrypoint := range topo.Entrypoints {
80+
t.Run(entrypoint.Identifier, func(t *testing.T) {
81+
service, err := topo.Lookup(entrypoint.Identifier)
82+
if err != nil {
83+
t.Fatalf("failed to look up entrypoint %s in topology: %v", entrypoint.Identifier, err)
84+
}
9485

95-
pipelines := map[string]*types.Pipeline{}
96-
if err := entrypointutils.LoadPipelines(service, repoRootDir, pipelines, cfg); err != nil {
97-
t.Fatalf("failed to load pipelines: %v", err)
98-
}
86+
pipelines := map[string]*types.Pipeline{}
87+
if err := entrypointutils.LoadPipelines(service, repoRootDir, pipelines, cfg); err != nil {
88+
t.Fatalf("failed to load pipelines: %v", err)
89+
}
9990

100-
executionGraph, graphConstructionErr := graph.ForEntrypoint(&topo, e, pipelines)
101-
if graphConstructionErr != nil {
102-
t.Fatalf("failed to construct graph: %v", graphConstructionErr)
103-
}
91+
executionGraph, graphConstructionErr := graph.ForEntrypoint(&topo, &entrypoint, pipelines)
92+
if graphConstructionErr != nil {
93+
t.Fatalf("failed to construct graph: %v", graphConstructionErr)
94+
}
10495

105-
illFormed := map[string]map[string]map[string]string{}
106-
for serviceGroupName, resourceGroups := range executionGraph.Steps {
107-
for resourceGroupName, steps := range resourceGroups {
108-
for stepName, step := range steps {
109-
if !step.IsWellFormedOverInputs() {
110-
reason := "unknown"
111-
switch s := step.(type) {
112-
case *types.ShellStep:
113-
if strings.Contains(s.Command, "make") && strings.Contains(s.Command, "deploy") {
114-
reason = "helm step needing migration"
115-
} else if s.WorkingDir == "" {
116-
reason = "raw shell step needing working directory"
96+
illFormed := map[string]map[string]map[string]string{}
97+
for serviceGroupName, resourceGroups := range executionGraph.Steps {
98+
for resourceGroupName, steps := range resourceGroups {
99+
for stepName, step := range steps {
100+
if !step.IsWellFormedOverInputs() {
101+
reason := "unknown"
102+
switch s := step.(type) {
103+
case *types.ShellStep:
104+
if strings.Contains(s.Command, "make") && strings.Contains(s.Command, "deploy") {
105+
reason = "helm step needing migration"
106+
} else if s.WorkingDir == "" {
107+
reason = "raw shell step needing working directory"
108+
}
109+
}
110+
111+
if _, exists := illFormed[serviceGroupName]; !exists {
112+
illFormed[serviceGroupName] = map[string]map[string]string{}
113+
}
114+
if _, exists := illFormed[serviceGroupName][resourceGroupName]; !exists {
115+
illFormed[serviceGroupName][resourceGroupName] = map[string]string{}
116+
}
117+
illFormed[serviceGroupName][resourceGroupName][stepName] = reason
118+
t.Errorf("%s/%s/%s: step is ill-formed over inputs: %v", serviceGroupName, resourceGroupName, stepName, reason)
117119
}
118120
}
119-
120-
if _, exists := illFormed[serviceGroupName]; !exists {
121-
illFormed[serviceGroupName] = map[string]map[string]string{}
122-
}
123-
if _, exists := illFormed[serviceGroupName][resourceGroupName]; !exists {
124-
illFormed[serviceGroupName][resourceGroupName] = map[string]string{}
125-
}
126-
illFormed[serviceGroupName][resourceGroupName][stepName] = reason
127-
t.Errorf("%s/%s/%s: step is ill-formed over inputs: %v", serviceGroupName, resourceGroupName, stepName, reason)
128121
}
129122
}
130-
}
123+
})
131124
}
132125
}

topology.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@ entrypoints:
88
metadata:
99
name: Region
1010
scopeDoc: high-level-architecture.md#regional-scope
11-
- identifier: 'Microsoft.Azure.ARO.HCP.Service.Infra'
12-
metadata:
13-
name: Service Cluster
14-
scopeDoc: high-level-architecture.md#service-cluster
15-
- identifier: 'Microsoft.Azure.ARO.HCP.Management.Infra'
16-
metadata:
17-
name: Management Cluster
18-
scopeDoc: high-level-architecture.md#management-clusters
1911
services:
2012
- serviceGroup: Microsoft.Azure.ARO.HCP.Global
2113
children:

0 commit comments

Comments
 (0)