Skip to content

Commit

Permalink
Fix requirements support to allow requirements for "Windows 10" string
Browse files Browse the repository at this point in the history
  • Loading branch information
kir committed Dec 12, 2022
1 parent 6ebddd4 commit 0067984
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
3 changes: 1 addition & 2 deletions .teamcity/generated/PublishHubVersion.kts
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ onDependencyFailure = FailureAction.FAIL_TO_START
requirements {
noLessThanVer("docker.version", "18.05.0")
contains("docker.server.osType", "windows")
contains("system.agent.name", "docker")
contains("system.agent.name", "windows10")
contains("teamcity.agent.jvm.os.name", "Windows 10")
}
features {
dockerSupport {
Expand Down
3 changes: 1 addition & 2 deletions .teamcity/generated/PublishLocal.kts
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ onDependencyFailure = FailureAction.FAIL_TO_START
requirements {
noLessThanVer("docker.version", "18.05.0")
contains("docker.server.osType", "windows")
contains("system.agent.name", "docker")
contains("system.agent.name", "windows10")
contains("teamcity.agent.jvm.os.name", "Windows 10")
}
features {
dockerSupport {
Expand Down
3 changes: 1 addition & 2 deletions .teamcity/generated/PushHubWindows.kts
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,7 @@ param("system.teamcity.agent.ensure.free.space", "52gb")
}
requirements {
contains("docker.server.osType", "windows")
contains("system.agent.name", "docker")
contains("system.agent.name", "windows10")
contains("teamcity.agent.jvm.os.name", "Windows 10")
}
dependencies {
snapshot(PublishLocal.publish_local)
Expand Down
3 changes: 1 addition & 2 deletions .teamcity/generated/PushLocalWindows1809.kts
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,7 @@ params {
param("system.teamcity.agent.ensure.free.space", "43gb")
}
requirements {
contains("system.agent.name", "docker")
contains("system.agent.name", "windows10")
contains("teamcity.agent.jvm.os.name", "Windows 10")
}
})

3 changes: 1 addition & 2 deletions .teamcity/generated/PushLocalWindows2004.kts
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,7 @@ params {
param("system.teamcity.agent.ensure.free.space", "43gb")
}
requirements {
contains("system.agent.name", "docker")
contains("system.agent.name", "windows10")
contains("teamcity.agent.jvm.os.name", "Windows 10")
}
})

17 changes: 16 additions & 1 deletion tool/TeamCity.Docker/DockerGraphFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,22 @@ public Result<IGraph<IArtifact, Dependency>> Create(IEnumerable<Template> templa
var values = expression.Split(" ");
if (values.Length >= 2 && Enum.TryParse<RequirementType>(values[1], true, out var requirementType))
{
requirements.Add(new Requirement(values[0], requirementType, values.Length > 2 ? values[2] : string.Empty));
// todo: simplify/improve this code, my C#-fu is poor
if (values.Length > 2)
{
if (values.Length > 3)
{
requirements.Add(new Requirement(values[0], requirementType, values[2] + " " + values[3]));
}
else
{
requirements.Add(new Requirement(values[0], requirementType, values[2]));
}
}
else
{
requirements.Add(new Requirement(values[0], requirementType, string.Empty));
}
}
});
}
Expand Down

0 comments on commit 0067984

Please sign in to comment.