diff --git a/src/Agent.Sdk/Knob/AgentKnobs.cs b/src/Agent.Sdk/Knob/AgentKnobs.cs index 71eba87cd1..a3c31740a3 100644 --- a/src/Agent.Sdk/Knob/AgentKnobs.cs +++ b/src/Agent.Sdk/Knob/AgentKnobs.cs @@ -786,5 +786,13 @@ public class AgentKnobs "Timeout for channel communication between agent listener and worker processes.", new EnvironmentKnobSource("PIPELINE_ARTIFACT_ASSOCIATE_TIMEOUT"), new BuiltInDefaultKnobSource("900")); // 15 * 60 - Setting the timeout to 15 minutes to account for slowness from azure storage and retries. + + public static readonly Knob RollbackToDefaultTfExe = new Knob( + nameof(RollbackToDefaultTfExe), + "If true, the agent will install the default versions of TF, vstsom", + new RuntimeKnobSource("ROLLBACK_TO_DEFAULT_TF_EXE"), + new EnvironmentKnobSource("ROLLBACK_TO_DEFAULT_TF_EXE"), + new PipelineFeatureSource("RollbackToDefaultTfExe"), + new BuiltInDefaultKnobSource("false")); } } diff --git a/src/Agent.Worker/TfManager.cs b/src/Agent.Worker/TfManager.cs index 0dc7f33e84..d1f12da1ca 100644 --- a/src/Agent.Worker/TfManager.cs +++ b/src/Agent.Worker/TfManager.cs @@ -6,6 +6,7 @@ using System.Net.Http; using System.Threading; using System.Threading.Tasks; +using Agent.Sdk.Knob; namespace Microsoft.VisualStudio.Services.Agent.Worker { @@ -34,7 +35,17 @@ public static async Task DownloadLegacyTfToolsAsync(IExecutionContext executionC if (!Directory.Exists(tfLegacyExternalsPath)) { - const string tfDownloadUrl = "https://vstsagenttools.blob.core.windows.net/tools/vstsom/m153_47c0856d/vstsom.zip"; + string tfDownloadUrl; + if (!AgentKnobs.RollbackToDefaultTfExe.GetValue(executionContext).AsBoolean()) + { + tfDownloadUrl = "https://vstsagenttools.blob.core.windows.net/tools/vstsom/m153_47c0856d/vstsom.zip"; + executionContext.Debug("Using the legacy version of tf.exe"); + } + else + { + tfDownloadUrl = "https://vstsagenttools.blob.core.windows.net/tools/vstsom/m153_47c0856d_adhoc/vstsom.zip"; + executionContext.Debug("Using the default version of tf.exe"); + } string tempTfDirectory = Path.Combine(externalsPath, "tf_download_temp"); await DownloadAsync(executionContext, tfDownloadUrl, tempTfDirectory, tfLegacyExternalsPath, retryOptions); @@ -48,7 +59,17 @@ public static async Task DownloadLegacyTfToolsAsync(IExecutionContext executionC if (!Directory.Exists(vstsomLegacyExternalsPath)) { - const string vstsomDownloadUrl = "https://vstsagenttools.blob.core.windows.net/tools/vstsom/m122_887c6659/vstsom.zip"; + string vstsomDownloadUrl; + if (!AgentKnobs.RollbackToDefaultTfExe.GetValue(executionContext).AsBoolean()) + { + vstsomDownloadUrl = "https://vstsagenttools.blob.core.windows.net/tools/vstsom/m122_887c6659/vstsom.zip"; + executionContext.Debug("Using the legacy version of vstsom"); + } + else + { + vstsomDownloadUrl = "https://vstsagenttools.blob.core.windows.net/tools/vstsom/m153_47c0856d_adhoc/vstsom.zip"; + executionContext.Debug("Using the default version of vstsom"); + } string tempVstsomDirectory = Path.Combine(externalsPath, "vstsom_download_temp"); await DownloadAsync(executionContext, vstsomDownloadUrl, tempVstsomDirectory, vstsomLegacyExternalsPath, retryOptions); diff --git a/src/Misc/externals.sh b/src/Misc/externals.sh index b68dc57dbf..93062de959 100644 --- a/src/Misc/externals.sh +++ b/src/Misc/externals.sh @@ -173,14 +173,14 @@ if [[ "$PACKAGERUNTIME" == "win-x"* ]]; then BIT="64" acquireExternalTool "$CONTAINER_URL/azcopy/1/azcopy.zip" azcopy acquireExternalTool "$CONTAINER_URL/vstshost/m122_887c6659_binding_redirect_patched/vstshost.zip" vstshost - acquireExternalTool "$CONTAINER_URL/vstsom/m153_47c0856d_adhoc/vstsom.zip" vstsom + acquireExternalTool "$CONTAINER_URL/vstsom/dev17.11vs_c0748e6e/vstsom.zip" vstsom fi acquireExternalTool "$CONTAINER_URL/mingit/${MINGIT_VERSION}/MinGit-${MINGIT_VERSION}-${BIT}-bit.zip" git acquireExternalTool "$CONTAINER_URL/git-lfs/${LFS_VERSION}/x${BIT}/git-lfs.exe" "git/mingw${BIT}/bin" acquireExternalTool "$CONTAINER_URL/pdbstr/1/pdbstr.zip" pdbstr acquireExternalTool "$CONTAINER_URL/symstore/1/symstore.zip" symstore - acquireExternalTool "$CONTAINER_URL/vstsom/m153_47c0856d_adhoc/vstsom.zip" tf + acquireExternalTool "$CONTAINER_URL/vstsom/dev17.11vs_c0748e6e/vstsom.zip" tf acquireExternalTool "$CONTAINER_URL/vswhere/2_8_4/vswhere.zip" vswhere acquireExternalTool "https://dist.nuget.org/win-x86-commandline/v4.6.4/nuget.exe" nuget @@ -205,14 +205,14 @@ elif [[ "$PACKAGERUNTIME" == "win-arm64" || "$PACKAGERUNTIME" == "win-arm32" ]]; # acquireExternalTool "$CONTAINER_URL/azcopy/1/azcopy.zip" azcopy # Unavailable for Win ARM 64 - https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-v10?tabs=dnf#download-the-azcopy-portable-binary acquireExternalTool "$CONTAINER_URL/vstshost/m122_887c6659_binding_redirect_patched/vstshost.zip" vstshost # Custom package. Will the same work for Win ARM 64? - acquireExternalTool "$CONTAINER_URL/vstsom/m153_47c0856d_adhoc/vstsom.zip" vstsom # Custom package. Will the same work for Win ARM 64? + acquireExternalTool "$CONTAINER_URL/vstsom/dev17.11vs_c0748e6e/vstsom.zip" vstsom # Custom package. Will the same work for Win ARM 64? fi acquireExternalTool "$CONTAINER_URL/mingit/${MINGIT_VERSION}/MinGit-${MINGIT_VERSION}-${BIT}-bit.zip" git # Unavailable for Win ARM 64 - https://github.com/git-for-windows/git/releases acquireExternalTool "$CONTAINER_URL/git-lfs/${LFS_VERSION}/win-arm${BIT}/git-lfs.exe" "git/mingw${BIT}/bin" acquireExternalTool "$CONTAINER_URL/pdbstr/win-arm${BIT}/1/pdbstr.zip" pdbstr acquireExternalTool "$CONTAINER_URL/symstore/win-arm${BIT}/1/symstore.zip" symstore - acquireExternalTool "$CONTAINER_URL/vstsom/m153_47c0856d_adhoc/vstsom.zip" tf + acquireExternalTool "$CONTAINER_URL/vstsom/dev17.11vs_c0748e6e/vstsom.zip" tf acquireExternalTool "$CONTAINER_URL/vswhere/2_8_4/vswhere.zip" vswhere acquireExternalTool "https://dist.nuget.org/win-x86-commandline/v4.6.4/nuget.exe" nuget diff --git a/src/Test/L0/Worker/TfManagerL0.cs b/src/Test/L0/Worker/TfManagerL0.cs index 64077afa72..15b0747930 100644 --- a/src/Test/L0/Worker/TfManagerL0.cs +++ b/src/Test/L0/Worker/TfManagerL0.cs @@ -78,7 +78,7 @@ public async Task DownloadAsync_Retries() retryOptions.Setup(opt => opt.ToString()).Throws(); retryOptions.Setup(opt => opt.Limit).Returns(3); - const string downloadUrl = "https://vstsagenttools.blob.core.windows.net/tools/vstsom/m122_887c6659/vstsom.zip"; + const string downloadUrl = "https://vstsagenttools.blob.core.windows.net/tools/vstsom/dev17.11vs_c0748e6e/vstsom.zip"; string tempDirectory = Path.Combine(hostContext.GetDirectory(WellKnownDirectory.Externals), "temp-test"); string extractDirectory = Path.Combine(hostContext.GetDirectory(WellKnownDirectory.Externals), "test"); @@ -110,7 +110,7 @@ public async Task DownloadAsync_Cancellation() retryOptions.Setup(opt => opt.ToString()).Callback(() => tokenSource.Cancel()); retryOptions.Setup(opt => opt.Limit).Returns(3); - const string downloadUrl = "https://vstsagenttools.blob.core.windows.net/tools/vstsom/m122_887c6659/vstsom.zip"; + const string downloadUrl = "https://vstsagenttools.blob.core.windows.net/tools/vstsom/dev17.11vs_c0748e6e/vstsom.zip"; string tempDirectory = Path.Combine(hostContext.GetDirectory(WellKnownDirectory.Externals), "temp-test"); string extractDirectory = Path.Combine(hostContext.GetDirectory(WellKnownDirectory.Externals), "test");