Skip to content

Commit 1b7fa9f

Browse files
Upgrate new version of tf.exe - vstsom.zip - AB#2257240 (#5138)
* AB#2257240 update vstsom.zip location * Update rollback changes * Fix L0 test
1 parent 5c07c1d commit 1b7fa9f

File tree

4 files changed

+38
-7
lines changed

4 files changed

+38
-7
lines changed

src/Agent.Sdk/Knob/AgentKnobs.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,5 +786,13 @@ public class AgentKnobs
786786
"Timeout for channel communication between agent listener and worker processes.",
787787
new EnvironmentKnobSource("PIPELINE_ARTIFACT_ASSOCIATE_TIMEOUT"),
788788
new BuiltInDefaultKnobSource("900")); // 15 * 60 - Setting the timeout to 15 minutes to account for slowness from azure storage and retries.
789+
790+
public static readonly Knob RollbackToDefaultTfExe = new Knob(
791+
nameof(RollbackToDefaultTfExe),
792+
"If true, the agent will install the default versions of TF, vstsom",
793+
new RuntimeKnobSource("ROLLBACK_TO_DEFAULT_TF_EXE"),
794+
new EnvironmentKnobSource("ROLLBACK_TO_DEFAULT_TF_EXE"),
795+
new PipelineFeatureSource("RollbackToDefaultTfExe"),
796+
new BuiltInDefaultKnobSource("false"));
789797
}
790798
}

src/Agent.Worker/TfManager.cs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Net.Http;
77
using System.Threading;
88
using System.Threading.Tasks;
9+
using Agent.Sdk.Knob;
910

1011
namespace Microsoft.VisualStudio.Services.Agent.Worker
1112
{
@@ -34,7 +35,17 @@ public static async Task DownloadLegacyTfToolsAsync(IExecutionContext executionC
3435

3536
if (!Directory.Exists(tfLegacyExternalsPath))
3637
{
37-
const string tfDownloadUrl = "https://vstsagenttools.blob.core.windows.net/tools/vstsom/m153_47c0856d/vstsom.zip";
38+
string tfDownloadUrl;
39+
if (!AgentKnobs.RollbackToDefaultTfExe.GetValue(executionContext).AsBoolean())
40+
{
41+
tfDownloadUrl = "https://vstsagenttools.blob.core.windows.net/tools/vstsom/m153_47c0856d/vstsom.zip";
42+
executionContext.Debug("Using the legacy version of tf.exe");
43+
}
44+
else
45+
{
46+
tfDownloadUrl = "https://vstsagenttools.blob.core.windows.net/tools/vstsom/m153_47c0856d_adhoc/vstsom.zip";
47+
executionContext.Debug("Using the default version of tf.exe");
48+
}
3849
string tempTfDirectory = Path.Combine(externalsPath, "tf_download_temp");
3950

4051
await DownloadAsync(executionContext, tfDownloadUrl, tempTfDirectory, tfLegacyExternalsPath, retryOptions);
@@ -48,7 +59,17 @@ public static async Task DownloadLegacyTfToolsAsync(IExecutionContext executionC
4859

4960
if (!Directory.Exists(vstsomLegacyExternalsPath))
5061
{
51-
const string vstsomDownloadUrl = "https://vstsagenttools.blob.core.windows.net/tools/vstsom/m122_887c6659/vstsom.zip";
62+
string vstsomDownloadUrl;
63+
if (!AgentKnobs.RollbackToDefaultTfExe.GetValue(executionContext).AsBoolean())
64+
{
65+
vstsomDownloadUrl = "https://vstsagenttools.blob.core.windows.net/tools/vstsom/m122_887c6659/vstsom.zip";
66+
executionContext.Debug("Using the legacy version of vstsom");
67+
}
68+
else
69+
{
70+
vstsomDownloadUrl = "https://vstsagenttools.blob.core.windows.net/tools/vstsom/m153_47c0856d_adhoc/vstsom.zip";
71+
executionContext.Debug("Using the default version of vstsom");
72+
}
5273
string tempVstsomDirectory = Path.Combine(externalsPath, "vstsom_download_temp");
5374

5475
await DownloadAsync(executionContext, vstsomDownloadUrl, tempVstsomDirectory, vstsomLegacyExternalsPath, retryOptions);

src/Misc/externals.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,14 @@ if [[ "$PACKAGERUNTIME" == "win-x"* ]]; then
173173
BIT="64"
174174
acquireExternalTool "$CONTAINER_URL/azcopy/1/azcopy.zip" azcopy
175175
acquireExternalTool "$CONTAINER_URL/vstshost/m122_887c6659_binding_redirect_patched/vstshost.zip" vstshost
176-
acquireExternalTool "$CONTAINER_URL/vstsom/m153_47c0856d_adhoc/vstsom.zip" vstsom
176+
acquireExternalTool "$CONTAINER_URL/vstsom/dev17.11vs_c0748e6e/vstsom.zip" vstsom
177177
fi
178178

179179
acquireExternalTool "$CONTAINER_URL/mingit/${MINGIT_VERSION}/MinGit-${MINGIT_VERSION}-${BIT}-bit.zip" git
180180
acquireExternalTool "$CONTAINER_URL/git-lfs/${LFS_VERSION}/x${BIT}/git-lfs.exe" "git/mingw${BIT}/bin"
181181
acquireExternalTool "$CONTAINER_URL/pdbstr/1/pdbstr.zip" pdbstr
182182
acquireExternalTool "$CONTAINER_URL/symstore/1/symstore.zip" symstore
183-
acquireExternalTool "$CONTAINER_URL/vstsom/m153_47c0856d_adhoc/vstsom.zip" tf
183+
acquireExternalTool "$CONTAINER_URL/vstsom/dev17.11vs_c0748e6e/vstsom.zip" tf
184184
acquireExternalTool "$CONTAINER_URL/vswhere/2_8_4/vswhere.zip" vswhere
185185
acquireExternalTool "https://dist.nuget.org/win-x86-commandline/v4.6.4/nuget.exe" nuget
186186

@@ -205,14 +205,14 @@ elif [[ "$PACKAGERUNTIME" == "win-arm64" || "$PACKAGERUNTIME" == "win-arm32" ]];
205205

206206
# 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
207207
acquireExternalTool "$CONTAINER_URL/vstshost/m122_887c6659_binding_redirect_patched/vstshost.zip" vstshost # Custom package. Will the same work for Win ARM 64?
208-
acquireExternalTool "$CONTAINER_URL/vstsom/m153_47c0856d_adhoc/vstsom.zip" vstsom # Custom package. Will the same work for Win ARM 64?
208+
acquireExternalTool "$CONTAINER_URL/vstsom/dev17.11vs_c0748e6e/vstsom.zip" vstsom # Custom package. Will the same work for Win ARM 64?
209209
fi
210210

211211
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
212212
acquireExternalTool "$CONTAINER_URL/git-lfs/${LFS_VERSION}/win-arm${BIT}/git-lfs.exe" "git/mingw${BIT}/bin"
213213
acquireExternalTool "$CONTAINER_URL/pdbstr/win-arm${BIT}/1/pdbstr.zip" pdbstr
214214
acquireExternalTool "$CONTAINER_URL/symstore/win-arm${BIT}/1/symstore.zip" symstore
215-
acquireExternalTool "$CONTAINER_URL/vstsom/m153_47c0856d_adhoc/vstsom.zip" tf
215+
acquireExternalTool "$CONTAINER_URL/vstsom/dev17.11vs_c0748e6e/vstsom.zip" tf
216216
acquireExternalTool "$CONTAINER_URL/vswhere/2_8_4/vswhere.zip" vswhere
217217
acquireExternalTool "https://dist.nuget.org/win-x86-commandline/v4.6.4/nuget.exe" nuget
218218

src/Test/L0/Worker/TfManagerL0.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.IO;
66
using System.Threading;
77
using System.Threading.Tasks;
8+
using Agent.Sdk.Knob;
89
using Microsoft.VisualStudio.Services.Agent.Util;
910
using Microsoft.VisualStudio.Services.Agent.Worker;
1011
using Moq;
@@ -31,6 +32,7 @@ public async Task DownloadTfLegacyToolsAsync()
3132
executionContext.Setup(x => x.CancellationToken).Returns(tokenSource.Token);
3233
executionContext.Setup(x => x.GetVariableValueOrDefault(It.Is<string>(s => s == "Agent.HomeDirectory")))
3334
.Returns(hostContext.GetDirectory(WellKnownDirectory.Root));
35+
executionContext.Setup(x => x.GetVariableValueOrDefault("ROLLBACK_TO_DEFAULT_TF_EXE")).Returns("false");
3436

3537
string externalsPath = hostContext.GetDirectory(WellKnownDirectory.Externals);
3638
string tfPath = Path.Combine(externalsPath, TfLegacy);
@@ -78,7 +80,7 @@ public async Task DownloadAsync_Retries()
7880
retryOptions.Setup(opt => opt.ToString()).Throws<Exception>();
7981
retryOptions.Setup(opt => opt.Limit).Returns(3);
8082

81-
const string downloadUrl = "https://vstsagenttools.blob.core.windows.net/tools/vstsom/m122_887c6659/vstsom.zip";
83+
const string downloadUrl = "https://vstsagenttools.blob.core.windows.net/tools/vstsom/m153_47c0856d/vstsom.zip";
8284
string tempDirectory = Path.Combine(hostContext.GetDirectory(WellKnownDirectory.Externals), "temp-test");
8385
string extractDirectory = Path.Combine(hostContext.GetDirectory(WellKnownDirectory.Externals), "test");
8486

0 commit comments

Comments
 (0)