From df713504a613733cdd14b60d8d996aa8e49561e6 Mon Sep 17 00:00:00 2001 From: Brian Barthel Date: Mon, 27 Jan 2025 16:36:39 -0500 Subject: [PATCH 1/4] update to m251 version of ADO client package --- src/Common.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Common.props b/src/Common.props index 2f037412e7..26692efd24 100644 --- a/src/Common.props +++ b/src/Common.props @@ -11,7 +11,7 @@ OS_UNKNOWN ARCH_UNKNOWN - 0.5.247-private + 0.5.251-private $(CodeAnalysis) false false From 0f9827829519d1df7503ecf0860cd697aed6302f Mon Sep 17 00:00:00 2001 From: Brian Barthel Date: Mon, 10 Feb 2025 09:17:53 -0500 Subject: [PATCH 2/4] Update dependencies and react to interface changes --- src/Agent.Sdk/Agent.Sdk.csproj | 1 + src/Agent.Worker/Release/Artifacts/CustomArtifact.cs | 9 ++++++--- src/Agent.Worker/TestResults/Parser.cs | 3 +-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Agent.Sdk/Agent.Sdk.csproj b/src/Agent.Sdk/Agent.Sdk.csproj index bf8e97fc35..84a31e0caa 100644 --- a/src/Agent.Sdk/Agent.Sdk.csproj +++ b/src/Agent.Sdk/Agent.Sdk.csproj @@ -21,6 +21,7 @@ + \ No newline at end of file diff --git a/src/Agent.Worker/Release/Artifacts/CustomArtifact.cs b/src/Agent.Worker/Release/Artifacts/CustomArtifact.cs index 5fb6fee708..b80eeea881 100644 --- a/src/Agent.Worker/Release/Artifacts/CustomArtifact.cs +++ b/src/Agent.Worker/Release/Artifacts/CustomArtifact.cs @@ -40,7 +40,8 @@ public async Task DownloadAsync(IExecutionContext executionContext, ArtifactDefi customArtifactDetails.ResultSelector, customArtifactDetails.ResultTemplate, customArtifactDetails.AuthorizationHeaders?.Select(header => ToAuthorizationHeader(header)).ToList(), - customArtifactDetails.ArtifactVariables); + customArtifactDetails.ArtifactVariables, + new PclCryptoRsaProvider()); // the other option in hosted is BouncyCastle, but it is not available in dotnet 8 var artifactDownloadDetailList = new List(); artifactDetails.ToList().ForEach(x => artifactDownloadDetailList.Add(JToken.Parse(x).ToObject())); @@ -123,7 +124,8 @@ private async Task DownloadArtifact( { IEndpointAuthorizer authorizer = SchemeBasedAuthorizerFactory.GetEndpointAuthorizer( ToServiceEndpoint(customArtifactDetails.Endpoint), - customArtifactDetails.AuthorizationHeaders?.Select(header => ToAuthorizationHeader(header)).ToList()); + customArtifactDetails.AuthorizationHeaders?.Select(header => ToAuthorizationHeader(header)).ToList(), + new PclCryptoRsaProvider()); // the other option in hosted is BouncyCastle, but it is not available in dotnet 8 using (HttpWebResponse webResponse = GetWebResponse(executionContext, artifact.DownloadUrl, authorizer)) { @@ -198,7 +200,8 @@ private void EnsureVersionBelongsToLinkedDefinition(ArtifactDefinition artifactD customArtifactDetails.VersionsResultSelector, customArtifactDetails.VersionsResultTemplate, customArtifactDetails.AuthorizationHeaders?.Select(header => ToAuthorizationHeader(header)).ToList(), - customArtifactDetails.ArtifactVariables); + customArtifactDetails.ArtifactVariables, + new PclCryptoRsaProvider()); // the other option in hosted is BouncyCastle, but it is not available in dotnet 8 foreach (var version in versions) { diff --git a/src/Agent.Worker/TestResults/Parser.cs b/src/Agent.Worker/TestResults/Parser.cs index a81478db10..ad20bc483c 100644 --- a/src/Agent.Worker/TestResults/Parser.cs +++ b/src/Agent.Worker/TestResults/Parser.cs @@ -73,9 +73,8 @@ protected override ITestResultParser GetTestResultParser(IExecutionContext execu { var traceListener = new CommandTraceListener(executionContext); var featureFlagService = executionContext.GetHostContext().GetService(); - var enableJunitAttachments = featureFlagService.GetFeatureFlagState(TestResultsConstants.JUnitTestCaseAttachmentsEnabled, TestResultsConstants.TCMServiceInstanceGuid); bool enableCustomTestFields = featureFlagService.GetFeatureFlagState(TestResultsConstants.CustomTestFieldsInPTRInputFilesEnabled, TestResultsConstants.TCMServiceInstanceGuid); - return new JUnitResultParser(traceListener, false, enableJunitAttachments,enableCustomTestFields); + return new JUnitResultParser(traceListener, false, enableCustomTestFields); } } From cc2b7d8f7c50e015371c6eeea68211069a3637e7 Mon Sep 17 00:00:00 2001 From: Brian Barthel Date: Mon, 10 Feb 2025 09:51:17 -0500 Subject: [PATCH 3/4] Switch to BouncyCastle RSA Provider. --- src/Agent.Worker/Release/Artifacts/CustomArtifact.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Agent.Worker/Release/Artifacts/CustomArtifact.cs b/src/Agent.Worker/Release/Artifacts/CustomArtifact.cs index b80eeea881..7ab64b368a 100644 --- a/src/Agent.Worker/Release/Artifacts/CustomArtifact.cs +++ b/src/Agent.Worker/Release/Artifacts/CustomArtifact.cs @@ -41,7 +41,7 @@ public async Task DownloadAsync(IExecutionContext executionContext, ArtifactDefi customArtifactDetails.ResultTemplate, customArtifactDetails.AuthorizationHeaders?.Select(header => ToAuthorizationHeader(header)).ToList(), customArtifactDetails.ArtifactVariables, - new PclCryptoRsaProvider()); // the other option in hosted is BouncyCastle, but it is not available in dotnet 8 + new BouncyCastleRsaProvider()); var artifactDownloadDetailList = new List(); artifactDetails.ToList().ForEach(x => artifactDownloadDetailList.Add(JToken.Parse(x).ToObject())); @@ -125,7 +125,7 @@ private async Task DownloadArtifact( IEndpointAuthorizer authorizer = SchemeBasedAuthorizerFactory.GetEndpointAuthorizer( ToServiceEndpoint(customArtifactDetails.Endpoint), customArtifactDetails.AuthorizationHeaders?.Select(header => ToAuthorizationHeader(header)).ToList(), - new PclCryptoRsaProvider()); // the other option in hosted is BouncyCastle, but it is not available in dotnet 8 + new BouncyCastleRsaProvider()); using (HttpWebResponse webResponse = GetWebResponse(executionContext, artifact.DownloadUrl, authorizer)) { @@ -201,7 +201,7 @@ private void EnsureVersionBelongsToLinkedDefinition(ArtifactDefinition artifactD customArtifactDetails.VersionsResultTemplate, customArtifactDetails.AuthorizationHeaders?.Select(header => ToAuthorizationHeader(header)).ToList(), customArtifactDetails.ArtifactVariables, - new PclCryptoRsaProvider()); // the other option in hosted is BouncyCastle, but it is not available in dotnet 8 + new BouncyCastleRsaProvider()); foreach (var version in versions) { From 979a16592ea4461c47190d5b7f9e6a4c7fff5917 Mon Sep 17 00:00:00 2001 From: Grzegorz Gurgul Date: Thu, 13 Feb 2025 16:41:21 +0100 Subject: [PATCH 4/4] Fix the version of the api used --- src/Microsoft.VisualStudio.Services.Agent/TaskServer.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.VisualStudio.Services.Agent/TaskServer.cs b/src/Microsoft.VisualStudio.Services.Agent/TaskServer.cs index caf622860c..8990810b44 100644 --- a/src/Microsoft.VisualStudio.Services.Agent/TaskServer.cs +++ b/src/Microsoft.VisualStudio.Services.Agent/TaskServer.cs @@ -69,7 +69,14 @@ private void CheckConnection() public Task GetTaskContentZipAsync(Guid taskId, TaskVersion taskVersion, CancellationToken token) { CheckConnection(); - return _taskAgentClient.GetTaskContentZipAsync(taskId, taskVersion, cancellationToken: token); + return _taskAgentClient.GetTaskContentZipAsync( + taskId, + versionString: taskVersion, + visibility: null, + scopeLocal: null, + userState: null, + cancellationToken: token + ); } public async Task TaskDefinitionEndpointExist()