Runner register labels during configuration (#130)

* Runners will add os and architecture labels during registration

* support github.localhost for dev.
This commit is contained in:
Tingluo Huang
2019-10-17 16:33:43 -04:00
committed by Christopher Johnson
parent 2f261f2c31
commit f5f14d4811
16 changed files with 52 additions and 408 deletions

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace GitHub.DistributedTask.WebApi
@@ -27,29 +26,6 @@ namespace GitHub.DistributedTask.WebApi
this.OwnerName = ownerName;
}
/// <summary>
/// Initializes a new <c>TaskAgentSession</c> isntance with the specified owner name, agent, and capabilities.
/// </summary>
/// <param name="ownerName">The name of the owner for this session. This should typically be the agent machine</param>
/// <param name="agent">The target agent for the session</param>
/// <param name="systemCapabilities">A collection of capabilities to publish on session creation</param>
public TaskAgentSession(
String ownerName,
TaskAgentReference agent,
IDictionary<String, String> systemCapabilities)
{
this.Agent = agent;
this.OwnerName = ownerName;
foreach (var capability in systemCapabilities)
{
if (capability.Value != null)
{
this.SystemCapabilities.Add(capability.Key, capability.Value);
}
}
}
/// <summary>
/// Gets the unique identifier for this session.
/// </summary>
@@ -89,33 +65,5 @@ namespace GitHub.DistributedTask.WebApi
get;
set;
}
/// <summary>
/// Gets the collection of system capabilities used for this session.
/// </summary>
public IDictionary<String, String> SystemCapabilities
{
get
{
if (m_systemCapabilities == null)
{
m_systemCapabilities = new Dictionary<String, String>(StringComparer.OrdinalIgnoreCase);
}
return m_systemCapabilities;
}
}
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
if (m_systemCapabilities?.Count == 0)
{
m_systemCapabilities = null;
}
}
[DataMember(IsRequired = false, EmitDefaultValue = false, Name = "SystemCapabilities")]
private IDictionary<String, String> m_systemCapabilities;
}
}