Merge "release_config: Do not force ranking in inheritance graph" into main
This commit is contained in:
@@ -87,17 +87,16 @@ func (configs *ReleaseConfigs) WriteInheritanceGraph(outFile string) error {
|
|||||||
data := []string{}
|
data := []string{}
|
||||||
usedAliases := make(map[string]bool)
|
usedAliases := make(map[string]bool)
|
||||||
priorStages := make(map[string][]string)
|
priorStages := make(map[string][]string)
|
||||||
rankedStageNames := make(map[string]bool)
|
|
||||||
for _, config := range configs.ReleaseConfigs {
|
for _, config := range configs.ReleaseConfigs {
|
||||||
|
if config.Name == "root" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
var fillColor string
|
var fillColor string
|
||||||
inherits := []string{}
|
inherits := []string{}
|
||||||
for _, inherit := range config.InheritNames {
|
for _, inherit := range config.InheritNames {
|
||||||
if inherit == "root" {
|
if inherit == "root" {
|
||||||
// Only show "root" if we have no other inheritance.
|
|
||||||
if len(config.InheritNames) > 1 {
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
|
||||||
data = append(data, fmt.Sprintf(`"%s" -> "%s"`, config.Name, inherit))
|
data = append(data, fmt.Sprintf(`"%s" -> "%s"`, config.Name, inherit))
|
||||||
inherits = append(inherits, inherit)
|
inherits = append(inherits, inherit)
|
||||||
// If inheriting an alias, add a link from the alias to that release config.
|
// If inheriting an alias, add a link from the alias to that release config.
|
||||||
@@ -113,14 +112,9 @@ func (configs *ReleaseConfigs) WriteInheritanceGraph(outFile string) error {
|
|||||||
}
|
}
|
||||||
// Add links for all of the advancement progressions.
|
// Add links for all of the advancement progressions.
|
||||||
for priorStage := range config.PriorStagesMap {
|
for priorStage := range config.PriorStagesMap {
|
||||||
stageName := config.Name
|
|
||||||
if len(config.OtherNames) > 0 {
|
|
||||||
stageName = config.OtherNames[0]
|
|
||||||
}
|
|
||||||
data = append(data, fmt.Sprintf(`"%s" -> "%s" [ style=dashed color="#81c995" ]`,
|
data = append(data, fmt.Sprintf(`"%s" -> "%s" [ style=dashed color="#81c995" ]`,
|
||||||
priorStage, stageName))
|
priorStage, config.Name))
|
||||||
priorStages[stageName] = append(priorStages[stageName], priorStage)
|
priorStages[config.Name] = append(priorStages[config.Name], priorStage)
|
||||||
rankedStageNames[stageName] = true
|
|
||||||
}
|
}
|
||||||
label := config.Name
|
label := config.Name
|
||||||
if len(inherits) > 0 {
|
if len(inherits) > 0 {
|
||||||
@@ -129,16 +123,24 @@ func (configs *ReleaseConfigs) WriteInheritanceGraph(outFile string) error {
|
|||||||
if len(config.OtherNames) > 0 {
|
if len(config.OtherNames) > 0 {
|
||||||
label += "\\nother names: " + strings.Join(config.OtherNames, " ")
|
label += "\\nother names: " + strings.Join(config.OtherNames, " ")
|
||||||
}
|
}
|
||||||
|
switch config.Name {
|
||||||
|
case *configs.Artifact.ReleaseConfig.Name:
|
||||||
// The active release config has a light blue fill.
|
// The active release config has a light blue fill.
|
||||||
if config.Name == *configs.Artifact.ReleaseConfig.Name {
|
|
||||||
fillColor = `fillcolor="#d2e3fc" `
|
fillColor = `fillcolor="#d2e3fc" `
|
||||||
|
case "trunk", "trunk_staging":
|
||||||
|
// Certain workflow stages have a light green fill.
|
||||||
|
fillColor = `fillcolor="#ceead6" `
|
||||||
|
default:
|
||||||
|
// Look for "next" and "*_next", make them light green as well.
|
||||||
|
for _, n := range config.OtherNames {
|
||||||
|
if n == "next" || strings.HasSuffix(n, "_next") {
|
||||||
|
fillColor = `fillcolor="#ceead6" `
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
data = append(data,
|
data = append(data,
|
||||||
fmt.Sprintf(`"%s" [ label="%s" %s]`, config.Name, label, fillColor))
|
fmt.Sprintf(`"%s" [ label="%s" %s]`, config.Name, label, fillColor))
|
||||||
}
|
}
|
||||||
if len(rankedStageNames) > 0 {
|
|
||||||
data = append(data, fmt.Sprintf("subgraph {rank=same %s}", strings.Join(SortedMapKeys(rankedStageNames), " ")))
|
|
||||||
}
|
|
||||||
slices.Sort(data)
|
slices.Sort(data)
|
||||||
data = append([]string{
|
data = append([]string{
|
||||||
"digraph {",
|
"digraph {",
|
||||||
|
Reference in New Issue
Block a user