diff --git a/src/Agent.Worker/Build/BuildDirectoryManager.cs b/src/Agent.Worker/Build/BuildDirectoryManager.cs index b6a01548ed..0da3f6c24e 100644 --- a/src/Agent.Worker/Build/BuildDirectoryManager.cs +++ b/src/Agent.Worker/Build/BuildDirectoryManager.cs @@ -208,7 +208,7 @@ private bool ShouldOverrideBuildDirectory(IList repositories { if (repositories?.Count == 1 && repositories[0].Type == RepositoryTypes.Tfvc) { - return settings.IsHosted; + return settings.IsMSHosted; } else { diff --git a/src/Agent.Worker/JobRunner.cs b/src/Agent.Worker/JobRunner.cs index e2f54e6fe7..2a49c0d0d3 100644 --- a/src/Agent.Worker/JobRunner.cs +++ b/src/Agent.Worker/JobRunner.cs @@ -179,6 +179,7 @@ public async Task RunAsync(Pipelines.AgentJobRequestMessage message, jobContext.SetVariable(Constants.Variables.Agent.HomeDirectory, HostContext.GetDirectory(WellKnownDirectory.Root), isFilePath: true); jobContext.SetVariable(Constants.Variables.Agent.JobName, message.JobDisplayName); jobContext.SetVariable(Constants.Variables.Agent.CloudId, settings.AgentCloudId); + jobContext.SetVariable(Constants.Variables.Agent.IsSelfHosted, settings.IsMSHosted ? "0" : "1"); jobContext.SetVariable(Constants.Variables.Agent.MachineName, Environment.MachineName); jobContext.SetVariable(Constants.Variables.Agent.Name, settings.AgentName); jobContext.SetVariable(Constants.Variables.Agent.OS, VarUtil.OS); diff --git a/src/Agent.Worker/TaskRunner.cs b/src/Agent.Worker/TaskRunner.cs index d6a63919e0..d1c2e55c84 100644 --- a/src/Agent.Worker/TaskRunner.cs +++ b/src/Agent.Worker/TaskRunner.cs @@ -577,18 +577,24 @@ private void PublishTelemetry(Definition taskDefinition, HandlerData handlerData var useNode10 = AgentKnobs.UseNode10.GetValue(ExecutionContext).AsString(); var expectedExecutionHandler = (taskDefinition.Data.Execution?.All != null) ? string.Join(", ", taskDefinition.Data.Execution.All) : ""; + var systemVersion = PlatformUtil.GetSystemVersion(); Dictionary telemetryData = new Dictionary { { "TaskName", Task.Reference.Name }, { "TaskId", Task.Reference.Id.ToString() }, { "Version", Task.Reference.Version }, - { "OS", PlatformUtil.HostOS.ToString() }, + { "OS", PlatformUtil.GetSystemId() ?? "" }, + { "OSVersion", systemVersion?.Name?.ToString() ?? "" }, + { "OSBuild", systemVersion?.Version?.ToString() ?? "" }, { "ExpectedExecutionHandler", expectedExecutionHandler }, { "RealExecutionHandler", handlerData.ToString() }, { "UseNode10", useNode10 }, { "JobId", ExecutionContext.Variables.System_JobId.ToString()}, - { "PlanId", ExecutionContext.Variables.Get("system.planId")} + { "PlanId", ExecutionContext.Variables.Get(Constants.Variables.System.JobId)}, + { "AgentName", ExecutionContext.Variables.Get(Constants.Variables.Agent.Name)}, + { "MachineName", ExecutionContext.Variables.Get(Constants.Variables.Agent.MachineName)}, + { "IsSelfHosted", ExecutionContext.Variables.Get(Constants.Variables.Agent.IsSelfHosted)} }; var cmd = new Command("telemetry", "publish"); diff --git a/src/Microsoft.VisualStudio.Services.Agent/ConfigurationStore.cs b/src/Microsoft.VisualStudio.Services.Agent/ConfigurationStore.cs index 3c99a551d2..92d6f6c2a8 100644 --- a/src/Microsoft.VisualStudio.Services.Agent/ConfigurationStore.cs +++ b/src/Microsoft.VisualStudio.Services.Agent/ConfigurationStore.cs @@ -51,7 +51,7 @@ public sealed class AgentSettings public bool EnableServiceSidTypeUnrestricted { get; set; } [IgnoreDataMember] - public bool IsHosted => AgentCloudId != null; + public bool IsMSHosted => AgentCloudId != null; [DataMember(EmitDefaultValue = false)] public string Fingerprint diff --git a/src/Microsoft.VisualStudio.Services.Agent/Constants.cs b/src/Microsoft.VisualStudio.Services.Agent/Constants.cs index ac6282ee78..0aa9696c27 100644 --- a/src/Microsoft.VisualStudio.Services.Agent/Constants.cs +++ b/src/Microsoft.VisualStudio.Services.Agent/Constants.cs @@ -286,6 +286,7 @@ public static class Agent public static readonly string Diagnostic = "agent.diagnostic"; public static readonly string HomeDirectory = "agent.homedirectory"; public static readonly string Id = "agent.id"; + public static readonly string IsSelfHosted = "agent.isselfhosted"; public static readonly string GitUseSChannel = "agent.gituseschannel"; public static readonly string JobName = "agent.jobname"; public static readonly string JobStatus = "agent.jobstatus"; @@ -431,6 +432,7 @@ public static class System public static readonly string PhaseAttempt = "system.phaseAttempt"; public static readonly string PhaseDisplayName = "system.phaseDisplayName"; public static readonly string PhaseName = "system.phaseName"; + public static readonly string PlanId = "system.planId"; public static readonly string PreferGitFromPath = "system.prefergitfrompath"; public static readonly string PullRequestTargetBranchName = "system.pullrequest.targetbranch"; public static readonly string SelfManageGitCreds = "system.selfmanagegitcreds"; @@ -472,6 +474,7 @@ public static class Task Agent.GitUseSChannel, Agent.HomeDirectory, Agent.Id, + Agent.IsSelfHosted, Agent.JobName, Agent.JobStatus, Agent.MachineName, @@ -571,6 +574,7 @@ public static class Task System.PhaseAttempt, System.PhaseDisplayName, System.PhaseName, + System.PlanId, System.PreferGitFromPath, System.PullRequestTargetBranchName, System.SelfManageGitCreds,