Skip to content

Commit 363ba84

Browse files
Revert "Update tf.exe (#4955)" (#4985)
This reverts commit 39c297f. Co-authored-by: v-levockina <undefined>
1 parent e738e1d commit 363ba84

File tree

16 files changed

+13
-334
lines changed

16 files changed

+13
-334
lines changed

src/Agent.Plugins/TFCliManager.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
using System.Xml;
1313
using System.Security.Cryptography.X509Certificates;
1414
using Microsoft.VisualStudio.Services.Agent.Util;
15-
using Agent.Sdk.Knob;
1615

1716
namespace Agent.Plugins.Repository
1817
{
@@ -38,15 +37,11 @@ public override TfsVCFeatures Features
3837

3938
public static readonly int RetriesOnFailure = 3;
4039

41-
private string TfPath => AgentKnobs.InstallLegacyTfExe.GetValue(ExecutionContext).AsBoolean()
42-
? Path.Combine(ExecutionContext.Variables.GetValueOrDefault("Agent.HomeDirectory")?.Value, "externals", "tf-legacy")
43-
: Path.Combine(ExecutionContext.Variables.GetValueOrDefault("Agent.HomeDirectory")?.Value, "externals", "tf");
40+
public string FilePath => Path.Combine(ExecutionContext.Variables.GetValueOrDefault("Agent.HomeDirectory")?.Value, "externals", "tf", "tf.exe");
4441

45-
public string FilePath => Path.Combine(TfPath, "tf.exe");
42+
private string AppConfigFile => Path.Combine(ExecutionContext.Variables.GetValueOrDefault("Agent.HomeDirectory")?.Value, "externals", "tf", "tf.exe.config");
4643

47-
private string AppConfigFile => Path.Combine(TfPath, "tf.exe.config");
48-
49-
private string AppConfigRestoreFile => Path.Combine(TfPath, "tf.exe.config.restore");
44+
private string AppConfigRestoreFile => Path.Combine(ExecutionContext.Variables.GetValueOrDefault("Agent.HomeDirectory")?.Value, "externals", "tf", "tf.exe.config.restore");
5045

5146
// TODO: Remove AddAsync after last-saved-checkin-metadata problem is fixed properly.
5247
public async Task AddAsync(string localPath)

src/Agent.Plugins/TfsVCSourceProvider.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ public async Task GetSourceAsync(
101101
if (PlatformUtil.RunningOnWindows)
102102
{
103103
// Set TFVC_BUILDAGENT_POLICYPATH
104-
string tfDirectoryName = AgentKnobs.InstallLegacyTfExe.GetValue(executionContext).AsBoolean() ? "tf-legacy" : "tf";
105-
string policyDllPath = Path.Combine(executionContext.Variables.GetValueOrDefault("Agent.HomeDirectory")?.Value, "externals", tfDirectoryName, "Microsoft.TeamFoundation.VersionControl.Controls.dll");
104+
string policyDllPath = Path.Combine(executionContext.Variables.GetValueOrDefault("Agent.HomeDirectory")?.Value, "externals", "tf", "Microsoft.TeamFoundation.VersionControl.Controls.dll");
106105
ArgUtil.File(policyDllPath, nameof(policyDllPath));
107106
const string policyPathEnvKey = "TFVC_BUILDAGENT_POLICYPATH";
108107
executionContext.Output(StringUtil.Loc("SetEnvVar", policyPathEnvKey));

src/Agent.Sdk/Knob/AgentKnobs.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -758,12 +758,5 @@ public class AgentKnobs
758758
"Use PowerShell script wrapper to handle PowerShell ConstrainedLanguage mode.",
759759
new PipelineFeatureSource("UsePSScriptWrapper"),
760760
new BuiltInDefaultKnobSource("false"));
761-
762-
public static readonly Knob InstallLegacyTfExe = new Knob(
763-
nameof(InstallLegacyTfExe),
764-
"If true, agent will install the previous version of TF.exe in the tf-legacy and vstsom-legacy directories",
765-
new RuntimeKnobSource("AGENT_INSTALL_LEGACY_TF_EXE"),
766-
new EnvironmentKnobSource("AGENT_INSTALL_LEGACY_TF_EXE"),
767-
new BuiltInDefaultKnobSource("false"));
768761
}
769762
}

src/Agent.Worker/Build/TFCommandManager.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
using System.Text;
1212
using System.Xml;
1313
using System.Security.Cryptography.X509Certificates;
14-
using Agent.Sdk.Knob;
1514

1615
namespace Microsoft.VisualStudio.Services.Agent.Worker.Build
1716
{
@@ -35,15 +34,11 @@ public override TfsVCFeatures Features
3534

3635
protected override string Switch => "/";
3736

38-
private string TfPath => AgentKnobs.InstallLegacyTfExe.GetValue(ExecutionContext).AsBoolean()
39-
? HostContext.GetDirectory(WellKnownDirectory.TfLegacy)
40-
: HostContext.GetDirectory(WellKnownDirectory.Tf);
37+
public override string FilePath => Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Tf), "tf.exe");
4138

42-
public override string FilePath => Path.Combine(TfPath, "tf.exe");
39+
private string AppConfigFile => Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Tf), "tf.exe.config");
4340

44-
private string AppConfigFile => Path.Combine(TfPath, "tf.exe.config");
45-
46-
private string AppConfigRestoreFile => Path.Combine(TfPath, "tf.exe.config.restore");
41+
private string AppConfigRestoreFile => Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Tf), "tf.exe.config.restore");
4742

4843
// TODO: Remove AddAsync after last-saved-checkin-metadata problem is fixed properly.
4944
public async Task AddAsync(string localPath)

src/Agent.Worker/Build/TfsVCSourceProvider.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
using System.Text;
1818
using System.Threading;
1919
using System.Threading.Tasks;
20-
using Agent.Sdk.Knob;
2120

2221
namespace Microsoft.VisualStudio.Services.Agent.Worker.Build
2322
{
@@ -89,11 +88,7 @@ public async Task GetSourceAsync(
8988
if (PlatformUtil.RunningOnWindows)
9089
{
9190
// Set TFVC_BUILDAGENT_POLICYPATH
92-
string vstsomPath = AgentKnobs.InstallLegacyTfExe.GetValue(executionContext).AsBoolean()
93-
? HostContext.GetDirectory(WellKnownDirectory.ServerOMLegacy)
94-
: HostContext.GetDirectory(WellKnownDirectory.ServerOM);
95-
96-
string policyDllPath = Path.Combine(vstsomPath, "Microsoft.TeamFoundation.VersionControl.Controls.dll");
91+
string policyDllPath = Path.Combine(HostContext.GetDirectory(WellKnownDirectory.ServerOM), "Microsoft.TeamFoundation.VersionControl.Controls.dll");
9792
ArgUtil.File(policyDllPath, nameof(policyDllPath));
9893
const string policyPathEnvKey = "TFVC_BUILDAGENT_POLICYPATH";
9994
executionContext.Output(StringUtil.Loc("SetEnvVar", policyPathEnvKey));

src/Agent.Worker/Handlers/LegacyPowerShellHandler.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
using Microsoft.VisualStudio.Services.WebApi;
1313
using System.Xml;
1414
using Microsoft.TeamFoundation.DistributedTask.Pipelines;
15-
using Agent.Sdk.Knob;
1615

1716
namespace Microsoft.VisualStudio.Services.Agent.Worker.Handlers
1817
{
@@ -206,13 +205,8 @@ public async Task RunAsync()
206205

207206
// Copy the OM binaries into the legacy host folder.
208207
ExecutionContext.Output(StringUtil.Loc("PrepareTaskExecutionHandler"));
209-
210-
string sourceDirectory = AgentKnobs.InstallLegacyTfExe.GetValue(ExecutionContext).AsBoolean()
211-
? HostContext.GetDirectory(WellKnownDirectory.ServerOMLegacy)
212-
: HostContext.GetDirectory(WellKnownDirectory.ServerOM);
213-
214208
IOUtil.CopyDirectory(
215-
source: sourceDirectory,
209+
source: HostContext.GetDirectory(WellKnownDirectory.ServerOM),
216210
target: HostContext.GetDirectory(WellKnownDirectory.LegacyPSHost),
217211
cancellationToken: ExecutionContext.CancellationToken);
218212
Trace.Info("Finished copying files.");

src/Agent.Worker/JobExtension.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,6 @@ public async Task<List<IStep>> InitializeJob(IExecutionContext jobContext, Pipel
269269
}
270270
}
271271

272-
if (AgentKnobs.InstallLegacyTfExe.GetValue(jobContext).AsBoolean())
273-
{
274-
await TfManager.DownloadLegacyTfToolsAsync(context);
275-
}
276-
277272
// build up 3 lists of steps, pre-job, job, post-job
278273
Stack<IStep> postJobStepsBuilder = new Stack<IStep>();
279274
Dictionary<Guid, Variables> taskVariablesMapping = new Dictionary<Guid, Variables>();

src/Agent.Worker/JobRunner.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,7 @@ public async Task<TaskResult> RunAsync(Pipelines.AgentJobRequestMessage message,
177177
jobContext.SetVariable(Constants.Variables.Agent.RootDirectory, HostContext.GetDirectory(WellKnownDirectory.Work), isFilePath: true);
178178
if (PlatformUtil.RunningOnWindows)
179179
{
180-
string serverOMDirectoryVariable = AgentKnobs.InstallLegacyTfExe.GetValue(jobContext).AsBoolean()
181-
? HostContext.GetDirectory(WellKnownDirectory.ServerOMLegacy)
182-
: HostContext.GetDirectory(WellKnownDirectory.ServerOM);
183-
184-
jobContext.SetVariable(Constants.Variables.Agent.ServerOMDirectory, serverOMDirectoryVariable, isFilePath: true);
180+
jobContext.SetVariable(Constants.Variables.Agent.ServerOMDirectory, HostContext.GetDirectory(WellKnownDirectory.ServerOM), isFilePath: true);
185181
}
186182
if (!PlatformUtil.RunningOnWindows)
187183
{

src/Agent.Worker/Release/ReleaseJobExtension.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,6 @@ private async Task DownloadArtifacts(IExecutionContext executionContext,
229229
await teeUtil.DownloadTeeIfAbsent();
230230
}
231231

232-
if (AgentKnobs.InstallLegacyTfExe.GetValue(executionContext).AsBoolean())
233-
{
234-
await TfManager.DownloadLegacyTfToolsAsync(executionContext);
235-
}
236-
237232
try
238233
{
239234
foreach (AgentArtifactDefinition agentArtifactDefinition in agentArtifactDefinitions)

src/Agent.Worker/TfManager.cs

Lines changed: 0 additions & 130 deletions
This file was deleted.

0 commit comments

Comments
 (0)