From aaf4ced980c7368cc4854a91a4b9bef2c78093ef Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 14 Jan 2025 12:38:24 -0500 Subject: [PATCH 1/4] fix: browser/wasm message handler being returned was incompatible Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 487 +++++++++--------- .github/workflows/build-and-test.yml | 2 + .github/workflows/sonarcloud.yml | 2 + src/http/httpClient/KiotaClientFactory.cs | 34 +- ...rosoft.Kiota.Http.HttpClientLibrary.csproj | 2 +- 5 files changed, 266 insertions(+), 261 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 2143875..08c4a0e 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -13,15 +13,15 @@ pr: - main variables: - buildPlatform: 'Any CPU' - buildConfiguration: 'Release' + buildPlatform: "Any CPU" + buildConfiguration: "Release" resources: repositories: - - repository: 1ESPipelineTemplates - type: git - name: 1ESPipelineTemplates/1ESPipelineTemplates - ref: refs/tags/release + - repository: 1ESPipelineTemplates + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release extends: template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates @@ -30,259 +30,260 @@ extends: name: Azure-Pipelines-1ESPT-ExDShared vmImage: windows-latest stages: + - stage: build + jobs: + - job: build + templateContext: + outputs: + - output: pipelineArtifact + displayName: "Publish Microsoft.Kiota.*.nupkg and release pipeline scripts" + artifactName: ArtifactsForRelease + targetPath: $(Build.ArtifactStagingDirectory) + steps: + - task: UseDotNet@2 # needed for ESRP sign + displayName: "Use .NET 6" + inputs: + version: 6.x - - stage: build - jobs: - - job: build - templateContext: - outputs: - - output: pipelineArtifact - displayName: 'Publish Microsoft.Kiota.*.nupkg and release pipeline scripts' - artifactName: ArtifactsForRelease - targetPath: $(Build.ArtifactStagingDirectory) - steps: + - task: UseDotNet@2 + displayName: "Use .NET 9" + inputs: + version: 9.x - - task: UseDotNet@2 # needed for ESRP sign - displayName: 'Use .NET 6' - inputs: - version: 6.x + - pwsh: dotnet workload install wasm-tools + displayName: "Install browser workload wasm-tools" - - task: UseDotNet@2 - displayName: 'Use .NET 9' - inputs: - version: 9.x - - - task: PowerShell@2 - displayName: 'Enable signing' - inputs: - targetType: filePath - filePath: 'scripts\EnableSigning.ps1' - arguments: '-projectPath "$(Build.SourcesDirectory)/Directory.Build.props"' - pwsh: true - enabled: true + - task: PowerShell@2 + displayName: "Enable signing" + inputs: + targetType: filePath + filePath: 'scripts\EnableSigning.ps1' + arguments: '-projectPath "$(Build.SourcesDirectory)/Directory.Build.props"' + pwsh: true + enabled: true - - task: PowerShell@2 - displayName: 'Validate project version has been incremented' - condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), succeeded()) - inputs: - targetType: 'filePath' - filePath: $(System.DefaultWorkingDirectory)\scripts\ValidateProjectVersionUpdated.ps1 - arguments: '-projectPath "$(Build.SourcesDirectory)/Directory.Build.props" -packageName "Microsoft.Kiota.Abstractions"' - pwsh: true + - task: PowerShell@2 + displayName: "Validate project version has been incremented" + condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), succeeded()) + inputs: + targetType: "filePath" + filePath: $(System.DefaultWorkingDirectory)\scripts\ValidateProjectVersionUpdated.ps1 + arguments: '-projectPath "$(Build.SourcesDirectory)/Directory.Build.props" -packageName "Microsoft.Kiota.Abstractions"' + pwsh: true - # Install the nuget tool. - - task: NuGetToolInstaller@1 - displayName: 'Install Nuget dependency manager' - inputs: - versionSpec: '>=6.11.0' - checkLatest: true + # Install the nuget tool. + - task: NuGetToolInstaller@1 + displayName: "Install Nuget dependency manager" + inputs: + versionSpec: ">=6.11.0" + checkLatest: true - # Build the Product project - - task: DotNetCoreCLI@2 - displayName: 'Build projects in Microsoft.Kiota' - inputs: - projects: '$(Build.SourcesDirectory)\Microsoft.Kiota.sln' - arguments: '--configuration $(BuildConfiguration) --no-incremental' + # Build the Product project + - task: DotNetCoreCLI@2 + displayName: "Build projects in Microsoft.Kiota" + inputs: + projects: '$(Build.SourcesDirectory)\Microsoft.Kiota.sln' + arguments: "--configuration $(BuildConfiguration) --no-incremental" - # Run the Unit test - - task: DotNetCoreCLI@2 - displayName: 'Test projects in Microsoft.Kiota' - inputs: - command: test - projects: '$(Build.SourcesDirectory)\Microsoft.Kiota.sln' - arguments: '--configuration $(BuildConfiguration) --no-build --framework net9.0' + # Run the Unit test + - task: DotNetCoreCLI@2 + displayName: "Test projects in Microsoft.Kiota" + inputs: + command: test + projects: '$(Build.SourcesDirectory)\Microsoft.Kiota.sln' + arguments: "--configuration $(BuildConfiguration) --no-build --framework net9.0" - - task: EsrpCodeSigning@5 - displayName: 'ESRP DLL Strong Name' - inputs: - ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection' - AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' - AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' - AuthAKVName: 'akv-prod-eastus' - AuthCertName: 'ReferenceLibraryPrivateCert' - AuthSignCertName: 'ReferencePackagePublisherCertificate' - FolderPath: src # This path should already omit test dlls as they exist in the `tests` folder - Pattern: '**\*Microsoft.Kiota.*.dll' - signConfigType: inlineSignParams - UseMinimatch: true - inlineOperation: | - [ - { - "keyCode": "CP-233863-SN", - "operationSetCode": "StrongNameSign", - "parameters": [], - "toolName": "sign", - "toolVersion": "1.0" - }, - { - "keyCode": "CP-233863-SN", - "operationSetCode": "StrongNameVerify", - "parameters": [], - "toolName": "sign", - "toolVersion": "1.0" - } - ] - SessionTimeout: 20 - MaxConcurrency: 50 - MaxRetryAttempts: 5 - PendingAnalysisWaitTimeoutMinutes: 5 - - - task: EsrpCodeSigning@5 - displayName: 'ESRP DLL CodeSigning' - inputs: - ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection' - AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' - AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' - AuthAKVName: 'akv-prod-eastus' - AuthCertName: 'ReferenceLibraryPrivateCert' - AuthSignCertName: 'ReferencePackagePublisherCertificate' - FolderPath: src # This path should already omit test dlls as they exist in the `tests` folder - signConfigType: inlineSignParams - UseMinimatch: true - Pattern: '**\*Microsoft.Kiota.*.dll' - inlineOperation: | - [ - { - "keyCode": "CP-230012", - "operationSetCode": "SigntoolSign", - "parameters": [ + - task: EsrpCodeSigning@5 + displayName: "ESRP DLL Strong Name" + inputs: + ConnectedServiceName: "Federated DevX ESRP Managed Identity Connection" + AppRegistrationClientId: "65035b7f-7357-4f29-bf25-c5ee5c3949f8" + AppRegistrationTenantId: "cdc5aeea-15c5-4db6-b079-fcadd2505dc2" + AuthAKVName: "akv-prod-eastus" + AuthCertName: "ReferenceLibraryPrivateCert" + AuthSignCertName: "ReferencePackagePublisherCertificate" + FolderPath: src # This path should already omit test dlls as they exist in the `tests` folder + Pattern: '**\*Microsoft.Kiota.*.dll' + signConfigType: inlineSignParams + UseMinimatch: true + inlineOperation: | + [ { - "parameterName": "OpusName", - "parameterValue": "Microsoft" + "keyCode": "CP-233863-SN", + "operationSetCode": "StrongNameSign", + "parameters": [], + "toolName": "sign", + "toolVersion": "1.0" }, { - "parameterName": "OpusInfo", - "parameterValue": "http://www.microsoft.com" - }, + "keyCode": "CP-233863-SN", + "operationSetCode": "StrongNameVerify", + "parameters": [], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + SessionTimeout: 20 + MaxConcurrency: 50 + MaxRetryAttempts: 5 + PendingAnalysisWaitTimeoutMinutes: 5 + + - task: EsrpCodeSigning@5 + displayName: "ESRP DLL CodeSigning" + inputs: + ConnectedServiceName: "Federated DevX ESRP Managed Identity Connection" + AppRegistrationClientId: "65035b7f-7357-4f29-bf25-c5ee5c3949f8" + AppRegistrationTenantId: "cdc5aeea-15c5-4db6-b079-fcadd2505dc2" + AuthAKVName: "akv-prod-eastus" + AuthCertName: "ReferenceLibraryPrivateCert" + AuthSignCertName: "ReferencePackagePublisherCertificate" + FolderPath: src # This path should already omit test dlls as they exist in the `tests` folder + signConfigType: inlineSignParams + UseMinimatch: true + Pattern: '**\*Microsoft.Kiota.*.dll' + inlineOperation: | + [ { - "parameterName": "FileDigest", - "parameterValue": "/fd \"SHA256\"" + "keyCode": "CP-230012", + "operationSetCode": "SigntoolSign", + "parameters": [ + { + "parameterName": "OpusName", + "parameterValue": "Microsoft" + }, + { + "parameterName": "OpusInfo", + "parameterValue": "http://www.microsoft.com" + }, + { + "parameterName": "FileDigest", + "parameterValue": "/fd \"SHA256\"" + }, + { + "parameterName": "PageHash", + "parameterValue": "/NPH" + }, + { + "parameterName": "TimeStamp", + "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + } + ], + "toolName": "sign", + "toolVersion": "1.0" }, { - "parameterName": "PageHash", - "parameterValue": "/NPH" + "keyCode": "CP-230012", + "operationSetCode": "SigntoolVerify", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + SessionTimeout: 20 + MaxConcurrency: 50 + MaxRetryAttempts: 5 + PendingAnalysisWaitTimeoutMinutes: 5 + + # arguments are not parsed in DotNetCoreCLI@2 task for `pack` command, that's why we have a custom pack command here + - pwsh: dotnet pack /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg --no-build --output $env:BUILD_ARTIFACTSTAGINGDIRECTORY --configuration $env:BUILD_CONFIGURATION + env: + BUILD_CONFIGURATION: $(BuildConfiguration) + displayName: Dotnet pack + + - task: EsrpCodeSigning@5 + displayName: "ESRP CodeSigning Nuget Packages" + inputs: + ConnectedServiceName: "Federated DevX ESRP Managed Identity Connection" + AppRegistrationClientId: "65035b7f-7357-4f29-bf25-c5ee5c3949f8" + AppRegistrationTenantId: "cdc5aeea-15c5-4db6-b079-fcadd2505dc2" + AuthAKVName: "akv-prod-eastus" + AuthCertName: "ReferenceLibraryPrivateCert" + AuthSignCertName: "ReferencePackagePublisherCertificate" + FolderPath: "$(Build.ArtifactStagingDirectory)" + Pattern: "*.nupkg" + signConfigType: inlineSignParams + UseMinimatch: true + inlineOperation: | + [ + { + "keyCode": "CP-401405", + "operationSetCode": "NuGetSign", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" }, { - "parameterName": "TimeStamp", - "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + "keyCode": "CP-401405", + "operationSetCode": "NuGetVerify", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" } - ], - "toolName": "sign", - "toolVersion": "1.0" - }, - { - "keyCode": "CP-230012", - "operationSetCode": "SigntoolVerify", - "parameters": [ ], - "toolName": "sign", - "toolVersion": "1.0" - } - ] - SessionTimeout: 20 - MaxConcurrency: 50 - MaxRetryAttempts: 5 - PendingAnalysisWaitTimeoutMinutes: 5 - - # arguments are not parsed in DotNetCoreCLI@2 task for `pack` command, that's why we have a custom pack command here - - pwsh: dotnet pack /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg --no-build --output $env:BUILD_ARTIFACTSTAGINGDIRECTORY --configuration $env:BUILD_CONFIGURATION - env: - BUILD_CONFIGURATION: $(BuildConfiguration) - displayName: Dotnet pack + ] + SessionTimeout: 20 + MaxConcurrency: 50 + MaxRetryAttempts: 5 + PendingAnalysisWaitTimeoutMinutes: 5 - - task: EsrpCodeSigning@5 - displayName: 'ESRP CodeSigning Nuget Packages' - inputs: - ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection' - AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' - AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' - AuthAKVName: 'akv-prod-eastus' - AuthCertName: 'ReferenceLibraryPrivateCert' - AuthSignCertName: 'ReferencePackagePublisherCertificate' - FolderPath: '$(Build.ArtifactStagingDirectory)' - Pattern: '*.nupkg' - signConfigType: inlineSignParams - UseMinimatch: true - inlineOperation: | - [ - { - "keyCode": "CP-401405", - "operationSetCode": "NuGetSign", - "parameters": [ ], - "toolName": "sign", - "toolVersion": "1.0" - }, - { - "keyCode": "CP-401405", - "operationSetCode": "NuGetVerify", - "parameters": [ ], - "toolName": "sign", - "toolVersion": "1.0" - } - ] - SessionTimeout: 20 - MaxConcurrency: 50 - MaxRetryAttempts: 5 - PendingAnalysisWaitTimeoutMinutes: 5 - - - task: CopyFiles@2 - displayName: 'Copy release scripts to artifact staging directory' - condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), succeeded()) - inputs: - SourceFolder: '$(Build.SourcesDirectory)' - Contents: 'scripts\**' - TargetFolder: '$(Build.ArtifactStagingDirectory)' + - task: CopyFiles@2 + displayName: "Copy release scripts to artifact staging directory" + condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), succeeded()) + inputs: + SourceFolder: "$(Build.SourcesDirectory)" + Contents: 'scripts\**' + TargetFolder: "$(Build.ArtifactStagingDirectory)" - - stage: deploy - condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), succeeded()) - dependsOn: build - jobs: - - deployment: deploy_dotnet_kiota_libs - dependsOn: [] - environment: nuget-org - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: ArtifactsForRelease - targetPath: $(Pipeline.Workspace) - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - # Install the nuget tool. - - task: NuGetToolInstaller@1 - displayName: 'Use NuGet >=6.11.0' - inputs: - versionSpec: '>=6.11.0' - checkLatest: true - - task: PowerShell@2 - displayName: 'Extract release information to pipeline' - inputs: - targetType: 'filePath' - filePath: $(Pipeline.Workspace)\scripts\GetNugetPackageVersion.ps1 - pwsh: true - arguments: '-packageDirPath "$(Pipeline.Workspace)/"' - - task: 1ES.PublishNuget@1 - displayName: 'Push Nuget for Kiota libraries' - inputs: - command: push - packagesToPush: '$(Pipeline.Workspace)/Microsoft.Kiota.*.nupkg' - packageParentPath: '$(Pipeline.Workspace)' - nuGetFeedType: external - publishFeedCredentials: 'Kiota Nuget Connection' - - task: GitHubRelease@1 - displayName: 'GitHub release (create)' - inputs: - gitHubConnection: 'Kiota_Release' - target: $(Build.SourceVersion) - repositoryName: '$(Build.Repository.Name)' - action: edit - tag: 'v$(VERSION_STRING)' - addChangeLog: false - assetUploadMode: replace - assets: | - !**/** - $(Pipeline.Workspace)/Microsoft.Kiota.*.*nupkg + - stage: deploy + condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), succeeded()) + dependsOn: build + jobs: + - deployment: deploy_dotnet_kiota_libs + dependsOn: [] + environment: nuget-org + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: ArtifactsForRelease + targetPath: $(Pipeline.Workspace) + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + # Install the nuget tool. + - task: NuGetToolInstaller@1 + displayName: "Use NuGet >=6.11.0" + inputs: + versionSpec: ">=6.11.0" + checkLatest: true + - task: PowerShell@2 + displayName: "Extract release information to pipeline" + inputs: + targetType: "filePath" + filePath: $(Pipeline.Workspace)\scripts\GetNugetPackageVersion.ps1 + pwsh: true + arguments: '-packageDirPath "$(Pipeline.Workspace)/"' + - task: 1ES.PublishNuget@1 + displayName: "Push Nuget for Kiota libraries" + inputs: + command: push + packagesToPush: "$(Pipeline.Workspace)/Microsoft.Kiota.*.nupkg" + packageParentPath: "$(Pipeline.Workspace)" + nuGetFeedType: external + publishFeedCredentials: "Kiota Nuget Connection" + - task: GitHubRelease@1 + displayName: "GitHub release (create)" + inputs: + gitHubConnection: "Kiota_Release" + target: $(Build.SourceVersion) + repositoryName: "$(Build.Repository.Name)" + action: edit + tag: "v$(VERSION_STRING)" + addChangeLog: false + assetUploadMode: replace + assets: | + !**/** + $(Pipeline.Workspace)/Microsoft.Kiota.*.*nupkg diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index c9278be..7c83b2c 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -23,6 +23,8 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: 9.x + - name: Install browser workload wasm-tools + run: dotnet workload install wasm-tools - name: Initialize CodeQL uses: github/codeql-action/init@v3 with: diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 2ef3c74..ea4f1b1 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -44,6 +44,8 @@ jobs: dotnet-version: | 5.x 9.x + - name: Install browser workload wasm-tools + run: dotnet workload install wasm-tools - uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis diff --git a/src/http/httpClient/KiotaClientFactory.cs b/src/http/httpClient/KiotaClientFactory.cs index d7dee71..b456e76 100644 --- a/src/http/httpClient/KiotaClientFactory.cs +++ b/src/http/httpClient/KiotaClientFactory.cs @@ -28,11 +28,11 @@ public static HttpClient Create(HttpMessageHandler? finalHandler = null, IReques { var defaultHandlersEnumerable = CreateDefaultHandlers(optionsForHandlers); int count = 0; - foreach(var _ in defaultHandlersEnumerable) count++; + foreach (var _ in defaultHandlersEnumerable) count++; var defaultHandlersArray = new DelegatingHandler[count]; int index = 0; - foreach(var handler2 in defaultHandlersEnumerable) + foreach (var handler2 in defaultHandlersEnumerable) { defaultHandlersArray[index++] = handler2; } @@ -48,11 +48,11 @@ public static HttpClient Create(HttpMessageHandler? finalHandler = null, IReques /// The with the custom handlers. public static HttpClient Create(IList handlers, HttpMessageHandler? finalHandler = null) { - if(handlers == null || handlers.Count == 0) + if (handlers == null || handlers.Count == 0) return Create(finalHandler); DelegatingHandler[] handlersArray = new DelegatingHandler[handlers.Count]; - for(int i = 0; i < handlers.Count; i++) + for (int i = 0; i < handlers.Count; i++) { handlersArray[i] = handlers[i]; } @@ -91,21 +91,21 @@ public static IList CreateDefaultHandlers(IRequestOption[]? o HeadersInspectionHandlerOption? headersInspectionHandlerOption = null; BodyInspectionHandlerOption? bodyInspectionHandlerOption = null; - foreach(var option in optionsForHandlers) + foreach (var option in optionsForHandlers) { - if(uriReplacementOption == null && option is UriReplacementHandlerOption uriOption) + if (uriReplacementOption == null && option is UriReplacementHandlerOption uriOption) uriReplacementOption = uriOption; - else if(retryHandlerOption == null && option is RetryHandlerOption retryOption) + else if (retryHandlerOption == null && option is RetryHandlerOption retryOption) retryHandlerOption = retryOption; - else if(redirectHandlerOption == null && option is RedirectHandlerOption redirectOption) + else if (redirectHandlerOption == null && option is RedirectHandlerOption redirectOption) redirectHandlerOption = redirectOption; - else if(parametersNameDecodingOption == null && option is ParametersNameDecodingOption parametersOption) + else if (parametersNameDecodingOption == null && option is ParametersNameDecodingOption parametersOption) parametersNameDecodingOption = parametersOption; - else if(userAgentHandlerOption == null && option is UserAgentHandlerOption userAgentOption) + else if (userAgentHandlerOption == null && option is UserAgentHandlerOption userAgentOption) userAgentHandlerOption = userAgentOption; - else if(headersInspectionHandlerOption == null && option is HeadersInspectionHandlerOption headersInspectionOption) + else if (headersInspectionHandlerOption == null && option is HeadersInspectionHandlerOption headersInspectionOption) headersInspectionHandlerOption = headersInspectionOption; - else if(bodyInspectionHandlerOption == null && option is BodyInspectionHandlerOption bodyInspectionOption) + else if (bodyInspectionHandlerOption == null && option is BodyInspectionHandlerOption bodyInspectionOption) bodyInspectionHandlerOption = bodyInspectionOption; } @@ -148,19 +148,19 @@ public static IList CreateDefaultHandlers(IRequestOption[]? o /// The created . public static DelegatingHandler? ChainHandlersCollectionAndGetFirstLink(HttpMessageHandler? finalHandler, params DelegatingHandler[] handlers) { - if(handlers == null || handlers.Length == 0) return default; + if (handlers == null || handlers.Length == 0) return default; var handlersCount = handlers.Length; - for(var i = 0; i < handlersCount; i++) + for (var i = 0; i < handlersCount; i++) { var handler = handlers[i]; var previousItemIndex = i - 1; - if(previousItemIndex >= 0) + if (previousItemIndex >= 0) { var previousHandler = handlers[previousItemIndex]; previousHandler.InnerHandler = handler; } } - if(finalHandler != null) + if (finalHandler != null) handlers[handlers.Length - 1].InnerHandler = finalHandler; return handlers[0];//first } @@ -185,7 +185,7 @@ public static HttpMessageHandler GetDefaultHttpMessageHandler(IWebProxy? proxy = // https://github.com/dotnet/runtime/blob/main/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs#L575 var proxyPolicy = proxy != null ? WindowsProxyUsePolicy.UseCustomProxy : WindowsProxyUsePolicy.UseWinHttpProxy; return new WinHttpHandler { Proxy = proxy, AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate, WindowsProxyUsePolicy = proxyPolicy, SendTimeout = System.Threading.Timeout.InfiniteTimeSpan, ReceiveDataTimeout = System.Threading.Timeout.InfiniteTimeSpan, ReceiveHeadersTimeout = System.Threading.Timeout.InfiniteTimeSpan, EnableMultipleHttp2Connections = true }; -#elif NET5_0_OR_GREATER +#elif NET5_0_OR_GREATER && !BROWSER return new SocketsHttpHandler { Proxy = proxy, AllowAutoRedirect = false, EnableMultipleHttp2Connections = true, AutomaticDecompression = DecompressionMethods.All }; #else return new HttpClientHandler { Proxy = proxy, AllowAutoRedirect = false, AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate }; diff --git a/src/http/httpClient/Microsoft.Kiota.Http.HttpClientLibrary.csproj b/src/http/httpClient/Microsoft.Kiota.Http.HttpClientLibrary.csproj index ddfc9ed..436ed8f 100644 --- a/src/http/httpClient/Microsoft.Kiota.Http.HttpClientLibrary.csproj +++ b/src/http/httpClient/Microsoft.Kiota.Http.HttpClientLibrary.csproj @@ -5,7 +5,7 @@ Kiota Http provider implementation for dotnet with HttpClient. Kiota Http Library for dotnet - netstandard2.0;netstandard2.1;net5.0;net6.0;net8.0;net462 + netstandard2.0;netstandard2.1;net5.0;net6.0;net8.0;net462;net5.0-browser;net6.0-browser;net8.0-browser; true From e05eb98afb1c12e4a6984217d294f764dbd0891b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 14 Jan 2025 12:44:42 -0500 Subject: [PATCH 2/4] chore: removes unexistant TFMs Signed-off-by: Vincent Biret --- .../httpClient/Microsoft.Kiota.Http.HttpClientLibrary.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/http/httpClient/Microsoft.Kiota.Http.HttpClientLibrary.csproj b/src/http/httpClient/Microsoft.Kiota.Http.HttpClientLibrary.csproj index 436ed8f..a3d153e 100644 --- a/src/http/httpClient/Microsoft.Kiota.Http.HttpClientLibrary.csproj +++ b/src/http/httpClient/Microsoft.Kiota.Http.HttpClientLibrary.csproj @@ -5,7 +5,7 @@ Kiota Http provider implementation for dotnet with HttpClient. Kiota Http Library for dotnet - netstandard2.0;netstandard2.1;net5.0;net6.0;net8.0;net462;net5.0-browser;net6.0-browser;net8.0-browser; + netstandard2.0;netstandard2.1;net5.0;net6.0;net8.0;net462;net8.0-browser; true From 45a41a9679b3f8cd0badeffbbe7ad4450f825dc6 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 14 Jan 2025 12:48:37 -0500 Subject: [PATCH 3/4] fix: removes message handler properties that don't exist for browser Signed-off-by: Vincent Biret --- src/http/httpClient/KiotaClientFactory.cs | 34 ++++++++++++----------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/http/httpClient/KiotaClientFactory.cs b/src/http/httpClient/KiotaClientFactory.cs index b456e76..fa0089e 100644 --- a/src/http/httpClient/KiotaClientFactory.cs +++ b/src/http/httpClient/KiotaClientFactory.cs @@ -28,11 +28,11 @@ public static HttpClient Create(HttpMessageHandler? finalHandler = null, IReques { var defaultHandlersEnumerable = CreateDefaultHandlers(optionsForHandlers); int count = 0; - foreach (var _ in defaultHandlersEnumerable) count++; + foreach(var _ in defaultHandlersEnumerable) count++; var defaultHandlersArray = new DelegatingHandler[count]; int index = 0; - foreach (var handler2 in defaultHandlersEnumerable) + foreach(var handler2 in defaultHandlersEnumerable) { defaultHandlersArray[index++] = handler2; } @@ -48,11 +48,11 @@ public static HttpClient Create(HttpMessageHandler? finalHandler = null, IReques /// The with the custom handlers. public static HttpClient Create(IList handlers, HttpMessageHandler? finalHandler = null) { - if (handlers == null || handlers.Count == 0) + if(handlers == null || handlers.Count == 0) return Create(finalHandler); DelegatingHandler[] handlersArray = new DelegatingHandler[handlers.Count]; - for (int i = 0; i < handlers.Count; i++) + for(int i = 0; i < handlers.Count; i++) { handlersArray[i] = handlers[i]; } @@ -91,21 +91,21 @@ public static IList CreateDefaultHandlers(IRequestOption[]? o HeadersInspectionHandlerOption? headersInspectionHandlerOption = null; BodyInspectionHandlerOption? bodyInspectionHandlerOption = null; - foreach (var option in optionsForHandlers) + foreach(var option in optionsForHandlers) { - if (uriReplacementOption == null && option is UriReplacementHandlerOption uriOption) + if(uriReplacementOption == null && option is UriReplacementHandlerOption uriOption) uriReplacementOption = uriOption; - else if (retryHandlerOption == null && option is RetryHandlerOption retryOption) + else if(retryHandlerOption == null && option is RetryHandlerOption retryOption) retryHandlerOption = retryOption; - else if (redirectHandlerOption == null && option is RedirectHandlerOption redirectOption) + else if(redirectHandlerOption == null && option is RedirectHandlerOption redirectOption) redirectHandlerOption = redirectOption; - else if (parametersNameDecodingOption == null && option is ParametersNameDecodingOption parametersOption) + else if(parametersNameDecodingOption == null && option is ParametersNameDecodingOption parametersOption) parametersNameDecodingOption = parametersOption; - else if (userAgentHandlerOption == null && option is UserAgentHandlerOption userAgentOption) + else if(userAgentHandlerOption == null && option is UserAgentHandlerOption userAgentOption) userAgentHandlerOption = userAgentOption; - else if (headersInspectionHandlerOption == null && option is HeadersInspectionHandlerOption headersInspectionOption) + else if(headersInspectionHandlerOption == null && option is HeadersInspectionHandlerOption headersInspectionOption) headersInspectionHandlerOption = headersInspectionOption; - else if (bodyInspectionHandlerOption == null && option is BodyInspectionHandlerOption bodyInspectionOption) + else if(bodyInspectionHandlerOption == null && option is BodyInspectionHandlerOption bodyInspectionOption) bodyInspectionHandlerOption = bodyInspectionOption; } @@ -148,19 +148,19 @@ public static IList CreateDefaultHandlers(IRequestOption[]? o /// The created . public static DelegatingHandler? ChainHandlersCollectionAndGetFirstLink(HttpMessageHandler? finalHandler, params DelegatingHandler[] handlers) { - if (handlers == null || handlers.Length == 0) return default; + if(handlers == null || handlers.Length == 0) return default; var handlersCount = handlers.Length; - for (var i = 0; i < handlersCount; i++) + for(var i = 0; i < handlersCount; i++) { var handler = handlers[i]; var previousItemIndex = i - 1; - if (previousItemIndex >= 0) + if(previousItemIndex >= 0) { var previousHandler = handlers[previousItemIndex]; previousHandler.InnerHandler = handler; } } - if (finalHandler != null) + if(finalHandler != null) handlers[handlers.Length - 1].InnerHandler = finalHandler; return handlers[0];//first } @@ -187,6 +187,8 @@ public static HttpMessageHandler GetDefaultHttpMessageHandler(IWebProxy? proxy = return new WinHttpHandler { Proxy = proxy, AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate, WindowsProxyUsePolicy = proxyPolicy, SendTimeout = System.Threading.Timeout.InfiniteTimeSpan, ReceiveDataTimeout = System.Threading.Timeout.InfiniteTimeSpan, ReceiveHeadersTimeout = System.Threading.Timeout.InfiniteTimeSpan, EnableMultipleHttp2Connections = true }; #elif NET5_0_OR_GREATER && !BROWSER return new SocketsHttpHandler { Proxy = proxy, AllowAutoRedirect = false, EnableMultipleHttp2Connections = true, AutomaticDecompression = DecompressionMethods.All }; +#elif BROWSER + return new HttpClientHandler { AllowAutoRedirect = false }; #else return new HttpClientHandler { Proxy = proxy, AllowAutoRedirect = false, AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate }; #endif From a006107a55a4a5ac1985178f5f857d24aa5fd04c Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 14 Jan 2025 12:49:45 -0500 Subject: [PATCH 4/4] ci: reverts unecessary workload install changes --- .azure-pipelines/ci-build.yml | 487 +++++++++++++-------------- .github/workflows/build-and-test.yml | 2 - .github/workflows/sonarcloud.yml | 2 - 3 files changed, 243 insertions(+), 248 deletions(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 08c4a0e..2143875 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -13,15 +13,15 @@ pr: - main variables: - buildPlatform: "Any CPU" - buildConfiguration: "Release" + buildPlatform: 'Any CPU' + buildConfiguration: 'Release' resources: repositories: - - repository: 1ESPipelineTemplates - type: git - name: 1ESPipelineTemplates/1ESPipelineTemplates - ref: refs/tags/release + - repository: 1ESPipelineTemplates + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release extends: template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates @@ -30,260 +30,259 @@ extends: name: Azure-Pipelines-1ESPT-ExDShared vmImage: windows-latest stages: - - stage: build - jobs: - - job: build - templateContext: - outputs: - - output: pipelineArtifact - displayName: "Publish Microsoft.Kiota.*.nupkg and release pipeline scripts" - artifactName: ArtifactsForRelease - targetPath: $(Build.ArtifactStagingDirectory) - steps: - - task: UseDotNet@2 # needed for ESRP sign - displayName: "Use .NET 6" - inputs: - version: 6.x - - task: UseDotNet@2 - displayName: "Use .NET 9" - inputs: - version: 9.x + - stage: build + jobs: + - job: build + templateContext: + outputs: + - output: pipelineArtifact + displayName: 'Publish Microsoft.Kiota.*.nupkg and release pipeline scripts' + artifactName: ArtifactsForRelease + targetPath: $(Build.ArtifactStagingDirectory) + steps: - - pwsh: dotnet workload install wasm-tools - displayName: "Install browser workload wasm-tools" + - task: UseDotNet@2 # needed for ESRP sign + displayName: 'Use .NET 6' + inputs: + version: 6.x - - task: PowerShell@2 - displayName: "Enable signing" - inputs: - targetType: filePath - filePath: 'scripts\EnableSigning.ps1' - arguments: '-projectPath "$(Build.SourcesDirectory)/Directory.Build.props"' - pwsh: true - enabled: true + - task: UseDotNet@2 + displayName: 'Use .NET 9' + inputs: + version: 9.x + + - task: PowerShell@2 + displayName: 'Enable signing' + inputs: + targetType: filePath + filePath: 'scripts\EnableSigning.ps1' + arguments: '-projectPath "$(Build.SourcesDirectory)/Directory.Build.props"' + pwsh: true + enabled: true - - task: PowerShell@2 - displayName: "Validate project version has been incremented" - condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), succeeded()) - inputs: - targetType: "filePath" - filePath: $(System.DefaultWorkingDirectory)\scripts\ValidateProjectVersionUpdated.ps1 - arguments: '-projectPath "$(Build.SourcesDirectory)/Directory.Build.props" -packageName "Microsoft.Kiota.Abstractions"' - pwsh: true + - task: PowerShell@2 + displayName: 'Validate project version has been incremented' + condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), succeeded()) + inputs: + targetType: 'filePath' + filePath: $(System.DefaultWorkingDirectory)\scripts\ValidateProjectVersionUpdated.ps1 + arguments: '-projectPath "$(Build.SourcesDirectory)/Directory.Build.props" -packageName "Microsoft.Kiota.Abstractions"' + pwsh: true - # Install the nuget tool. - - task: NuGetToolInstaller@1 - displayName: "Install Nuget dependency manager" - inputs: - versionSpec: ">=6.11.0" - checkLatest: true + # Install the nuget tool. + - task: NuGetToolInstaller@1 + displayName: 'Install Nuget dependency manager' + inputs: + versionSpec: '>=6.11.0' + checkLatest: true - # Build the Product project - - task: DotNetCoreCLI@2 - displayName: "Build projects in Microsoft.Kiota" - inputs: - projects: '$(Build.SourcesDirectory)\Microsoft.Kiota.sln' - arguments: "--configuration $(BuildConfiguration) --no-incremental" + # Build the Product project + - task: DotNetCoreCLI@2 + displayName: 'Build projects in Microsoft.Kiota' + inputs: + projects: '$(Build.SourcesDirectory)\Microsoft.Kiota.sln' + arguments: '--configuration $(BuildConfiguration) --no-incremental' - # Run the Unit test - - task: DotNetCoreCLI@2 - displayName: "Test projects in Microsoft.Kiota" - inputs: - command: test - projects: '$(Build.SourcesDirectory)\Microsoft.Kiota.sln' - arguments: "--configuration $(BuildConfiguration) --no-build --framework net9.0" + # Run the Unit test + - task: DotNetCoreCLI@2 + displayName: 'Test projects in Microsoft.Kiota' + inputs: + command: test + projects: '$(Build.SourcesDirectory)\Microsoft.Kiota.sln' + arguments: '--configuration $(BuildConfiguration) --no-build --framework net9.0' - - task: EsrpCodeSigning@5 - displayName: "ESRP DLL Strong Name" - inputs: - ConnectedServiceName: "Federated DevX ESRP Managed Identity Connection" - AppRegistrationClientId: "65035b7f-7357-4f29-bf25-c5ee5c3949f8" - AppRegistrationTenantId: "cdc5aeea-15c5-4db6-b079-fcadd2505dc2" - AuthAKVName: "akv-prod-eastus" - AuthCertName: "ReferenceLibraryPrivateCert" - AuthSignCertName: "ReferencePackagePublisherCertificate" - FolderPath: src # This path should already omit test dlls as they exist in the `tests` folder - Pattern: '**\*Microsoft.Kiota.*.dll' - signConfigType: inlineSignParams - UseMinimatch: true - inlineOperation: | - [ + - task: EsrpCodeSigning@5 + displayName: 'ESRP DLL Strong Name' + inputs: + ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection' + AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' + AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' + AuthAKVName: 'akv-prod-eastus' + AuthCertName: 'ReferenceLibraryPrivateCert' + AuthSignCertName: 'ReferencePackagePublisherCertificate' + FolderPath: src # This path should already omit test dlls as they exist in the `tests` folder + Pattern: '**\*Microsoft.Kiota.*.dll' + signConfigType: inlineSignParams + UseMinimatch: true + inlineOperation: | + [ + { + "keyCode": "CP-233863-SN", + "operationSetCode": "StrongNameSign", + "parameters": [], + "toolName": "sign", + "toolVersion": "1.0" + }, + { + "keyCode": "CP-233863-SN", + "operationSetCode": "StrongNameVerify", + "parameters": [], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + SessionTimeout: 20 + MaxConcurrency: 50 + MaxRetryAttempts: 5 + PendingAnalysisWaitTimeoutMinutes: 5 + + - task: EsrpCodeSigning@5 + displayName: 'ESRP DLL CodeSigning' + inputs: + ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection' + AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' + AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' + AuthAKVName: 'akv-prod-eastus' + AuthCertName: 'ReferenceLibraryPrivateCert' + AuthSignCertName: 'ReferencePackagePublisherCertificate' + FolderPath: src # This path should already omit test dlls as they exist in the `tests` folder + signConfigType: inlineSignParams + UseMinimatch: true + Pattern: '**\*Microsoft.Kiota.*.dll' + inlineOperation: | + [ + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolSign", + "parameters": [ { - "keyCode": "CP-233863-SN", - "operationSetCode": "StrongNameSign", - "parameters": [], - "toolName": "sign", - "toolVersion": "1.0" + "parameterName": "OpusName", + "parameterValue": "Microsoft" }, { - "keyCode": "CP-233863-SN", - "operationSetCode": "StrongNameVerify", - "parameters": [], - "toolName": "sign", - "toolVersion": "1.0" - } - ] - SessionTimeout: 20 - MaxConcurrency: 50 - MaxRetryAttempts: 5 - PendingAnalysisWaitTimeoutMinutes: 5 - - - task: EsrpCodeSigning@5 - displayName: "ESRP DLL CodeSigning" - inputs: - ConnectedServiceName: "Federated DevX ESRP Managed Identity Connection" - AppRegistrationClientId: "65035b7f-7357-4f29-bf25-c5ee5c3949f8" - AppRegistrationTenantId: "cdc5aeea-15c5-4db6-b079-fcadd2505dc2" - AuthAKVName: "akv-prod-eastus" - AuthCertName: "ReferenceLibraryPrivateCert" - AuthSignCertName: "ReferencePackagePublisherCertificate" - FolderPath: src # This path should already omit test dlls as they exist in the `tests` folder - signConfigType: inlineSignParams - UseMinimatch: true - Pattern: '**\*Microsoft.Kiota.*.dll' - inlineOperation: | - [ - { - "keyCode": "CP-230012", - "operationSetCode": "SigntoolSign", - "parameters": [ - { - "parameterName": "OpusName", - "parameterValue": "Microsoft" - }, - { - "parameterName": "OpusInfo", - "parameterValue": "http://www.microsoft.com" - }, - { - "parameterName": "FileDigest", - "parameterValue": "/fd \"SHA256\"" - }, - { - "parameterName": "PageHash", - "parameterValue": "/NPH" - }, - { - "parameterName": "TimeStamp", - "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" - } - ], - "toolName": "sign", - "toolVersion": "1.0" + "parameterName": "OpusInfo", + "parameterValue": "http://www.microsoft.com" }, { - "keyCode": "CP-230012", - "operationSetCode": "SigntoolVerify", - "parameters": [ ], - "toolName": "sign", - "toolVersion": "1.0" - } - ] - SessionTimeout: 20 - MaxConcurrency: 50 - MaxRetryAttempts: 5 - PendingAnalysisWaitTimeoutMinutes: 5 - - # arguments are not parsed in DotNetCoreCLI@2 task for `pack` command, that's why we have a custom pack command here - - pwsh: dotnet pack /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg --no-build --output $env:BUILD_ARTIFACTSTAGINGDIRECTORY --configuration $env:BUILD_CONFIGURATION - env: - BUILD_CONFIGURATION: $(BuildConfiguration) - displayName: Dotnet pack - - - task: EsrpCodeSigning@5 - displayName: "ESRP CodeSigning Nuget Packages" - inputs: - ConnectedServiceName: "Federated DevX ESRP Managed Identity Connection" - AppRegistrationClientId: "65035b7f-7357-4f29-bf25-c5ee5c3949f8" - AppRegistrationTenantId: "cdc5aeea-15c5-4db6-b079-fcadd2505dc2" - AuthAKVName: "akv-prod-eastus" - AuthCertName: "ReferenceLibraryPrivateCert" - AuthSignCertName: "ReferencePackagePublisherCertificate" - FolderPath: "$(Build.ArtifactStagingDirectory)" - Pattern: "*.nupkg" - signConfigType: inlineSignParams - UseMinimatch: true - inlineOperation: | - [ + "parameterName": "FileDigest", + "parameterValue": "/fd \"SHA256\"" + }, { - "keyCode": "CP-401405", - "operationSetCode": "NuGetSign", - "parameters": [ ], - "toolName": "sign", - "toolVersion": "1.0" + "parameterName": "PageHash", + "parameterValue": "/NPH" }, { - "keyCode": "CP-401405", - "operationSetCode": "NuGetVerify", - "parameters": [ ], - "toolName": "sign", - "toolVersion": "1.0" + "parameterName": "TimeStamp", + "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" } - ] - SessionTimeout: 20 - MaxConcurrency: 50 - MaxRetryAttempts: 5 - PendingAnalysisWaitTimeoutMinutes: 5 + ], + "toolName": "sign", + "toolVersion": "1.0" + }, + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolVerify", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + SessionTimeout: 20 + MaxConcurrency: 50 + MaxRetryAttempts: 5 + PendingAnalysisWaitTimeoutMinutes: 5 + + # arguments are not parsed in DotNetCoreCLI@2 task for `pack` command, that's why we have a custom pack command here + - pwsh: dotnet pack /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg --no-build --output $env:BUILD_ARTIFACTSTAGINGDIRECTORY --configuration $env:BUILD_CONFIGURATION + env: + BUILD_CONFIGURATION: $(BuildConfiguration) + displayName: Dotnet pack - - task: CopyFiles@2 - displayName: "Copy release scripts to artifact staging directory" - condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), succeeded()) - inputs: - SourceFolder: "$(Build.SourcesDirectory)" - Contents: 'scripts\**' - TargetFolder: "$(Build.ArtifactStagingDirectory)" + - task: EsrpCodeSigning@5 + displayName: 'ESRP CodeSigning Nuget Packages' + inputs: + ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection' + AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' + AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' + AuthAKVName: 'akv-prod-eastus' + AuthCertName: 'ReferenceLibraryPrivateCert' + AuthSignCertName: 'ReferencePackagePublisherCertificate' + FolderPath: '$(Build.ArtifactStagingDirectory)' + Pattern: '*.nupkg' + signConfigType: inlineSignParams + UseMinimatch: true + inlineOperation: | + [ + { + "keyCode": "CP-401405", + "operationSetCode": "NuGetSign", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" + }, + { + "keyCode": "CP-401405", + "operationSetCode": "NuGetVerify", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + SessionTimeout: 20 + MaxConcurrency: 50 + MaxRetryAttempts: 5 + PendingAnalysisWaitTimeoutMinutes: 5 + + - task: CopyFiles@2 + displayName: 'Copy release scripts to artifact staging directory' + condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), succeeded()) + inputs: + SourceFolder: '$(Build.SourcesDirectory)' + Contents: 'scripts\**' + TargetFolder: '$(Build.ArtifactStagingDirectory)' - - stage: deploy - condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), succeeded()) - dependsOn: build - jobs: - - deployment: deploy_dotnet_kiota_libs - dependsOn: [] - environment: nuget-org - templateContext: - type: releaseJob - isProduction: true - inputs: - - input: pipelineArtifact - artifactName: ArtifactsForRelease - targetPath: $(Pipeline.Workspace) - strategy: - runOnce: - deploy: - pool: - vmImage: ubuntu-latest - steps: - # Install the nuget tool. - - task: NuGetToolInstaller@1 - displayName: "Use NuGet >=6.11.0" - inputs: - versionSpec: ">=6.11.0" - checkLatest: true - - task: PowerShell@2 - displayName: "Extract release information to pipeline" - inputs: - targetType: "filePath" - filePath: $(Pipeline.Workspace)\scripts\GetNugetPackageVersion.ps1 - pwsh: true - arguments: '-packageDirPath "$(Pipeline.Workspace)/"' - - task: 1ES.PublishNuget@1 - displayName: "Push Nuget for Kiota libraries" - inputs: - command: push - packagesToPush: "$(Pipeline.Workspace)/Microsoft.Kiota.*.nupkg" - packageParentPath: "$(Pipeline.Workspace)" - nuGetFeedType: external - publishFeedCredentials: "Kiota Nuget Connection" - - task: GitHubRelease@1 - displayName: "GitHub release (create)" - inputs: - gitHubConnection: "Kiota_Release" - target: $(Build.SourceVersion) - repositoryName: "$(Build.Repository.Name)" - action: edit - tag: "v$(VERSION_STRING)" - addChangeLog: false - assetUploadMode: replace - assets: | - !**/** - $(Pipeline.Workspace)/Microsoft.Kiota.*.*nupkg + - stage: deploy + condition: and(contains(variables['build.sourceBranch'], 'refs/heads/main'), succeeded()) + dependsOn: build + jobs: + - deployment: deploy_dotnet_kiota_libs + dependsOn: [] + environment: nuget-org + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: ArtifactsForRelease + targetPath: $(Pipeline.Workspace) + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + # Install the nuget tool. + - task: NuGetToolInstaller@1 + displayName: 'Use NuGet >=6.11.0' + inputs: + versionSpec: '>=6.11.0' + checkLatest: true + - task: PowerShell@2 + displayName: 'Extract release information to pipeline' + inputs: + targetType: 'filePath' + filePath: $(Pipeline.Workspace)\scripts\GetNugetPackageVersion.ps1 + pwsh: true + arguments: '-packageDirPath "$(Pipeline.Workspace)/"' + - task: 1ES.PublishNuget@1 + displayName: 'Push Nuget for Kiota libraries' + inputs: + command: push + packagesToPush: '$(Pipeline.Workspace)/Microsoft.Kiota.*.nupkg' + packageParentPath: '$(Pipeline.Workspace)' + nuGetFeedType: external + publishFeedCredentials: 'Kiota Nuget Connection' + - task: GitHubRelease@1 + displayName: 'GitHub release (create)' + inputs: + gitHubConnection: 'Kiota_Release' + target: $(Build.SourceVersion) + repositoryName: '$(Build.Repository.Name)' + action: edit + tag: 'v$(VERSION_STRING)' + addChangeLog: false + assetUploadMode: replace + assets: | + !**/** + $(Pipeline.Workspace)/Microsoft.Kiota.*.*nupkg diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 7c83b2c..c9278be 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -23,8 +23,6 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: 9.x - - name: Install browser workload wasm-tools - run: dotnet workload install wasm-tools - name: Initialize CodeQL uses: github/codeql-action/init@v3 with: diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index ea4f1b1..2ef3c74 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -44,8 +44,6 @@ jobs: dotnet-version: | 5.x 9.x - - name: Install browser workload wasm-tools - run: dotnet workload install wasm-tools - uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis