Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

add dependency map #1613

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Microsoft.Tye.Core/ConfigModel/ConfigService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,7 @@ public class ConfigService
public string? Version { get; set; }
public string? Architecture { get; set; }
public string? CloneDirectory { get; internal set; }

public List<string> DependsOn { get; set; } = new List<string>();
}
}
16 changes: 16 additions & 0 deletions src/Microsoft.Tye.Core/Serialization/ConfigServiceParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ private static void HandleServiceNameMapping(YamlMappingNode yamlMappingNode, Co
case "cloneDirectory":
service.CloneDirectory = YamlParser.GetScalarValue(key, child.Value);
break;
case "dependsOn":
if (child.Value.NodeType != YamlNodeType.Sequence)
{
throw new TyeYamlException(child.Value.Start, CoreStrings.FormatExpectedYamlSequence(key));
}
HandleDependencies((child.Value as YamlSequenceNode)!, service.DependsOn);
break;
default:
throw new TyeYamlException(child.Key.Start, CoreStrings.FormatUnrecognizedKey(key));
}
Expand Down Expand Up @@ -578,6 +585,15 @@ private static void HandleServiceTags(YamlSequenceNode yamlSequenceNode, List<st
tags.Add(tag);
}
}

private static void HandleDependencies(YamlSequenceNode yamlSequenceNode, List<string> dependencies)
{
foreach (var child in yamlSequenceNode!.Children)
{
var dependsOn = YamlParser.GetScalarValue(child);
dependencies.Add(dependsOn);
}
}

private static void HandleServiceBindingRoutes(YamlSequenceNode yamlSequenceNode, List<string> routes)
{
Expand Down
2 changes: 2 additions & 0 deletions test/E2ETest/testassets/projects/multirepo/vote/tye.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: VotingSample
services:
- name: vote
project: vote.csproj
dependsOn:
- redis
- name: worker
include: ../worker/tye.yaml
- name: redis
Expand Down