From ce442c3834bba2daf8720daee1e677e10792084a Mon Sep 17 00:00:00 2001 From: "Liangying.Wei" Date: Tue, 9 Jan 2024 10:14:52 +0800 Subject: [PATCH] Add azure pipeline (#1885) * Update release.yml for Azure Pipelines --- .azure/pipelines/release.yml | 178 ++++++++++++++++++ .../DependencyInjectionExtensionFacts.cs | 4 +- .../NegotiateProcessorFacts.cs | 2 +- .../RestApiProviderFacts.cs | 2 +- .../ServiceManagerFacts.cs | 2 +- .../NegotiateHandlerFacts.cs | 8 +- .../ServiceEndpointProviderFacts.cs | 2 +- 7 files changed, 188 insertions(+), 10 deletions(-) create mode 100644 .azure/pipelines/release.yml diff --git a/.azure/pipelines/release.yml b/.azure/pipelines/release.yml new file mode 100644 index 000000000..95ee58dc7 --- /dev/null +++ b/.azure/pipelines/release.yml @@ -0,0 +1,178 @@ +name: $(Date:yyyyMMdd).$(Rev:r) +variables: + - name: BuildConfiguration + value: Release + - name: BuildNumber + value: $[counter('versioncounter', 11128)] + - name: Codeql.Enabled + value: true + - name: IsTargetMultiFramework + value: true + - name: LocalFeed + value: $(UserProfile)\localfeed + - name: MSBuildProperties + value: Configuration=$(BuildConfiguration);BuildNumber=$(BuildNumber);VersionSuffix=$(VersionSuffix);IsTargetMultiFramework=$(IsTargetMultiFramework);SignType=$(SignType) + - name: SignType + value: real + - name: TeamName + value: Azure SignalR Team + - name: VersionSuffix + value: preview1-$(BuildNumber) +parameters: + - name: isFinalBuild + type: boolean + default: false + - name: releaseEmulator + type: boolean + default: false + - name: releaseSDKCore + type: boolean + default: false + - name: releaseServerlessProtocol + type: boolean + default: false +resources: + repositories: + - repository: self + type: git + ref: refs/heads/dev + - repository: 1esPipelines + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release +trigger: + branches: + include: + - dev + paths: + include: + - src + batch: true +pr: none +extends: + template: v1/1ES.Unofficial.PipelineTemplate.yml@1esPipelines + parameters: + pool: + os: windows + name: MSEngSS-MicroBuild2022-1ES + customBuildTags: + - MigrationTooling-mseng-VSJava-8484-Tool + sdl: + eslint: + enabled: false + stages: + - stage: Stage + jobs: + - job: Phase_1 + displayName: Phase 1 + cancelTimeoutInMinutes: 1 + templateContext: + outputs: + - output: pipelineArtifact + artifactName: Artifact + targetPath: artifacts + displayName: Publish nupkg to VSTS + - output: nuget + displayName: Push packages to azure-signalr-dev feed + nuGetFeedType: external + packagesToPush: artifacts/**/*.nupkg;artifacts/**/*.snupkg + packageParentPath: artifacts + publishFeedCredentials: azure-signalr-dev + steps: + - checkout: self + clean: true + submodules: true + fetchDepth: 1 + fetchTags: false + persistCredentials: true + - ${{ if eq(parameters.isFinalBuild, true) }}: + - bash: | + echo "##vso[task.setvariable variable=VersionSuffix]rtm" + echo $(VersionSuffix) # outputs VersionSuffix + displayName: Set VersionSuffix to rtm if it is final build + - task: ms-vseng.MicroBuildTasks.30666190-6959-11e5-9f96-f56098202fef.MicroBuildSigningPlugin@3 + displayName: Install Signing Plugin + condition: and(succeeded(), in(variables.SignType, 'real', 'test'))  + inputs: + signType: $(SignType) + zipSources: false + feedSource: https://pkgs.dev.azure.com/mseng/_packaging/MicroBuildToolset/nuget/v3/index.json + - task: UseDotNet@2 + displayName: Add 6.x + inputs: + version: 6.x + performMultiLevelLookup: true + - task: UseDotNet@2 + displayName: Add 7.x + inputs: + version: 7.x + performMultiLevelLookup: true + - ${{ if or( eq(parameters.isFinalBuild, false), eq(parameters.releaseSDKCore, true)) }}: + - task: DotNetCoreCLI@2 + displayName: dotnet build AzureSignalR.sln + inputs: + projects: AzureSignalR.sln + arguments: /p:$(MSBuildProperties) + - task: DotNetCoreCLI@2 + displayName: dotnet test + inputs: + command: test + arguments: /p:$(MSBuildProperties) + - task: DotNetCoreCLI@2 + displayName: dotnet pack SDK Core + inputs: + command: pack + searchPatternPack: src/Microsoft*/*.csproj;!src\Microsoft.Azure.SignalR.Emulator\Microsoft.Azure.SignalR.Emulator.csproj;!src\Microsoft.Azure.SignalR.Serverless.Protocols\Microsoft.Azure.SignalR.Serverless.Protocols.csproj + outputDir: artifacts + includesymbols: true + buildProperties: $(MSBuildProperties);SymbolPackageFormat=snupkg + verbosityPack: Normal + - ${{ if or( eq(parameters.isFinalBuild, false), eq(parameters.releaseEmulator, true)) }}: + - task: DotNetCoreCLI@2 + displayName: dotnet pack emulator when only dev or release emulator + inputs: + command: pack + searchPatternPack: src/Microsoft.Azure.SignalR.Emulator/Microsoft.Azure.SignalR.Emulator.csproj + outputDir: artifacts + includesymbols: true + buildProperties: $(MSBuildProperties);SymbolPackageFormat=snupkg + verbosityPack: Normal + - ${{ if or( eq(parameters.isFinalBuild, false), eq(parameters.releaseServerlessProtocol, true)) }}: + - task: DotNetCoreCLI@2 + displayName: "dotnet pack serverless protocol when only dev or release " + inputs: + command: pack + searchPatternPack: src/Microsoft.Azure.SignalR.Serverless.Protocols/Microsoft.Azure.SignalR.Serverless.Protocols.csproj + outputDir: artifacts + includesymbols: true + buildProperties: $(MSBuildProperties);SymbolPackageFormat=snupkg + verbosityPack: Normal + - task: CmdLine@2 + displayName: Clean Local Feed + inputs: + script: if exist $(LocalFeed)\ del /s /q $(LocalFeed) + - task: NuGetCommand@2 + displayName: Initialize Local Feed + inputs: + command: custom + arguments: init artifacts $(LocalFeed) + - task: MSBuild@1 + displayName: Test Restoring Packages + inputs: + solution: build/package-test.3.proj + msbuildArchitecture: x64 + msbuildArguments: /p:$(MSBuildProperties) /p:UseLocalFeed=true /p:LocalFeed=$(LocalFeed) /t:Restore + - task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 + displayName: "Manifest Generator " + inputs: + BuildDropPath: artifacts + - ${{ if eq(parameters.isFinalBuild, true) }}: + - task: AzureFileCopy@4 + displayName: SDK Partner Release AzCopy + inputs: + SourcePath: artifacts/* + ConnectedServiceNameARM: azuresdkpartnerdrops + Destination: AzureBlob + StorageAccountRM: azuresdkpartnerdrops + ContainerName: drops + BlobPrefix: azure-signalr/dotnet/$(BuildNumber) diff --git a/test/Microsoft.Azure.SignalR.Management.Tests/DependencyInjectionExtensionFacts.cs b/test/Microsoft.Azure.SignalR.Management.Tests/DependencyInjectionExtensionFacts.cs index c97131e39..53279c0bd 100644 --- a/test/Microsoft.Azure.SignalR.Management.Tests/DependencyInjectionExtensionFacts.cs +++ b/test/Microsoft.Azure.SignalR.Management.Tests/DependencyInjectionExtensionFacts.cs @@ -28,7 +28,7 @@ namespace Microsoft.Azure.SignalR.Management.Tests public class DependencyInjectionExtensionFacts { private const string Url = "https://abc"; - private const string AccessKey = "nOu3jXsHnsO5urMumc87M9skQbUWuQ+PE5IvSUEic8w="; + private const string AccessKey = "fake_key"; private static readonly string TestConnectionString = $"Endpoint={Url};AccessKey={AccessKey};Version=1.0;"; private readonly ITestOutputHelper _outputHelper; @@ -254,7 +254,7 @@ public async Task ProxyApplyToTransientModeTestAsync() var serviceManager = new ServiceManagerBuilder().WithOptions(o => { // use http schema to avoid SSL handshake - o.ConnectionString = "Endpoint=http://abc;AccessKey=nOu3jXsHnsO5urMumc87M9skQbUWuQ+PE5IvSUEic8w=;Version=1.0;"; + o.ConnectionString = "Endpoint=http://abc;AccessKey=fake_key;Version=1.0;"; o.Proxy = new WebProxy(app.Services.GetRequiredService().Features.Get().Addresses.First()); }).BuildServiceManager(); Assert.True(await serviceManager.IsServiceHealthy(default)); diff --git a/test/Microsoft.Azure.SignalR.Management.Tests/NegotiateProcessorFacts.cs b/test/Microsoft.Azure.SignalR.Management.Tests/NegotiateProcessorFacts.cs index 72cd15943..cf98ad00d 100644 --- a/test/Microsoft.Azure.SignalR.Management.Tests/NegotiateProcessorFacts.cs +++ b/test/Microsoft.Azure.SignalR.Management.Tests/NegotiateProcessorFacts.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.SignalR.Management.Tests { public class NegotiateProcessorFacts { - private const string AccessKey = "nOu3jXsHnsO5urMumc87M9skQbUWuQ+PE5IvSUEic8w="; + private const string AccessKey = "fake_key"; private const string HubName = "signalrBench"; private const string UserId = "UserA"; private static readonly TimeSpan _tokenLifeTime = TimeSpan.FromSeconds(99); diff --git a/test/Microsoft.Azure.SignalR.Management.Tests/RestApiProviderFacts.cs b/test/Microsoft.Azure.SignalR.Management.Tests/RestApiProviderFacts.cs index a99dd570e..68991a25f 100644 --- a/test/Microsoft.Azure.SignalR.Management.Tests/RestApiProviderFacts.cs +++ b/test/Microsoft.Azure.SignalR.Management.Tests/RestApiProviderFacts.cs @@ -13,7 +13,7 @@ namespace Microsoft.Azure.SignalR.Management.Tests public class RestApiProviderFacts { private const string _endpoint = "https://abc"; - private const string _accessKey = "nOu3jXsHnsO5urMumc87M9skQbUWuQ+PE5IvSUEic8w="; + private const string _accessKey = "fake_key"; private static readonly string _connectionString = $"Endpoint={_endpoint};AccessKey={_accessKey};Version=1.0;"; diff --git a/test/Microsoft.Azure.SignalR.Management.Tests/ServiceManagerFacts.cs b/test/Microsoft.Azure.SignalR.Management.Tests/ServiceManagerFacts.cs index a76556755..d3fe5355b 100644 --- a/test/Microsoft.Azure.SignalR.Management.Tests/ServiceManagerFacts.cs +++ b/test/Microsoft.Azure.SignalR.Management.Tests/ServiceManagerFacts.cs @@ -23,7 +23,7 @@ namespace Microsoft.Azure.SignalR.Management.Tests public class ServiceManagerFacts { private const string Endpoint = "https://abc"; - private const string AccessKey = "nOu3jXsHnsO5urMumc87M9skQbUWuQ+PE5IvSUEic8w="; + private const string AccessKey = "fake_key"; private const string HubName = "signalrBench"; private const string UserId = "UserA"; private const string UserAgent = "userAgent"; diff --git a/test/Microsoft.Azure.SignalR.Tests/NegotiateHandlerFacts.cs b/test/Microsoft.Azure.SignalR.Tests/NegotiateHandlerFacts.cs index 45a70e196..7fe89cba1 100644 --- a/test/Microsoft.Azure.SignalR.Tests/NegotiateHandlerFacts.cs +++ b/test/Microsoft.Azure.SignalR.Tests/NegotiateHandlerFacts.cs @@ -35,10 +35,10 @@ public class NegotiateHandlerFacts private const string CustomClaimType = "custom.claim"; private const string CustomUserId = "customUserId"; private const string DefaultUserId = "nameId"; - private const string DefaultConnectionString = "Endpoint=https://localhost;AccessKey=nOu3jXsHnsO5urMumc87M9skQbUWuQ+PE5IvSUEic8w=;ClientEndpoint=http://redirect"; - private const string ConnectionString2 = "Endpoint=http://localhost2;AccessKey=ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789;"; - private const string ConnectionString3 = "Endpoint=http://localhost3;AccessKey=ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789;"; - private const string ConnectionString4 = "Endpoint=http://localhost4;AccessKey=ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789;"; + private const string DefaultConnectionString = "Endpoint=https://localhost;AccessKey=fake_key;ClientEndpoint=http://redirect"; + private const string ConnectionString2 = "Endpoint=http://localhost2;AccessKey=fake_key;"; + private const string ConnectionString3 = "Endpoint=http://localhost3;AccessKey=fake_key;"; + private const string ConnectionString4 = "Endpoint=http://localhost4;AccessKey=fake_key;"; private static readonly JwtSecurityTokenHandler JwtSecurityTokenHandler = new JwtSecurityTokenHandler(); diff --git a/test/Microsoft.Azure.SignalR.Tests/ServiceEndpointProviderFacts.cs b/test/Microsoft.Azure.SignalR.Tests/ServiceEndpointProviderFacts.cs index 2c2b87200..22ecdba7c 100644 --- a/test/Microsoft.Azure.SignalR.Tests/ServiceEndpointProviderFacts.cs +++ b/test/Microsoft.Azure.SignalR.Tests/ServiceEndpointProviderFacts.cs @@ -14,7 +14,7 @@ namespace Microsoft.Azure.SignalR.Tests public class ServiceEndpointProviderFacts { private const string Endpoint = "https://myendpoint"; - private const string AccessKey = "nOu3jXsHnsO5urMumc87M9skQbUWuQ+PE5IvSUEic8w="; + private const string AccessKey = "fake_key"; private static readonly string HubName = nameof(TestHub).ToLower(); private static readonly string AppName = "testapp";