From 31b1ff330a4b0983f8e29a1156faaa0c702584d5 Mon Sep 17 00:00:00 2001 From: Matias Quaranta Date: Tue, 11 Apr 2023 11:48:29 -0700 Subject: [PATCH] [Internal] Pipelines: Adds nightly build to produce packages (#3802) * Support cleaning * wire previous content delete * as text * with variable * another test * param with types * as string * no delete * no quotes * undoing * re-adding quotes * testing empty * trying another test * readding version * fixing publishing artifacts * fixing parameter * Fixing official pipeline * version 5 * fixing main pipeline * test with true * using start time * nightly preview * passing parameters to pack * Fixing nuget version * arguments on the nuget pack * folder structure * testing v5 * Using only content * Removing currentDate --- .../src/Microsoft.Azure.Cosmos.csproj | 3 +- azure-pipelines-nightly.yml | 72 ++++++------------- azure-pipelines-official.yml | 3 +- azure-pipelines.yml | 1 - templates/nuget-pack.yml | 67 ++++++++++------- 5 files changed, 63 insertions(+), 83 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj b/Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj index 7ba4e9213d..6a5be8ccbb 100644 --- a/Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj +++ b/Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj @@ -9,8 +9,9 @@ $([System.DateTime]::Now.ToString(yyyyMMdd)) $(ClientOfficialVersion) $(ClientPreviewVersion) - nightly-$(CurrentDate) $(ClientPreviewSuffixVersion) + nightly-$(CurrentDate) + $(VersionSuffix)-nightly-$(CurrentDate) $(ClientVersion) $(ClientVersion)-$(VersionSuffix) $(ClientVersion) diff --git a/azure-pipelines-nightly.yml b/azure-pipelines-nightly.yml index 8db3ff01e6..04a53968aa 100644 --- a/azure-pipelines-nightly.yml +++ b/azure-pipelines-nightly.yml @@ -13,64 +13,32 @@ schedules: variables: - ReleaseArguments: ' --filter "TestCategory!=Quarantine" --verbosity normal ' VmImage: windows-latest # https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops - BuildConfiguration: Release - IsNightly: true - + BuildConfiguration: Release + Packaging.EnableSBOMSigning: true stages: - stage: - displayName: Gate + displayName: Generate nightly GA jobs: - - template: templates/static-tools.yml - parameters: - BuildConfiguration: $(BuildConfiguration) - VmImage: $(VmImage) - - - - template: templates/build-test.yml + - template: templates/nuget-pack.yml parameters: - BuildConfiguration: $(BuildConfiguration) - Arguments: $(ReleaseArguments) /p:IsNightly=true /p:GeneratePackageOnBuild=true + BuildConfiguration: Release + Arguments: /p:IsNightly=true VmImage: $(VmImage) - - + ReleasePackage: true + OutputPath: '$(Build.ArtifactStagingDirectory)/bin/AnyCPU/$(BuildConfiguration)/Microsoft.Azure.Cosmos' + BlobVersion: 'nightly' + CleanupFolder: true - stage: - displayName: Publish + displayName: Generate nightly preview jobs: - - job: - pool: - vmImage: $(VmImage) - - steps: - - task: DotNetCoreCLI@2 - displayName: Build Microsoft.Azure.Cosmos - inputs: - command: build - configuration: $(BuildConfiguration) - nugetConfigPath: NuGet.config - projects: Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj - arguments: --configuration $(BuildConfiguration) - versioningScheme: OFF - - - task: DotNetCoreCLI@2 - displayName: Pack Microsoft.Azure.Cosmos - inputs: - command: pack - configuration: $(BuildConfiguration) - searchPatternPack: Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj - arguments: --configuration $(BuildConfiguration) - versioningScheme: OFF - - - task: DotNetCoreCLI@2 - displayName: Push Microsoft.Azure.Cosmos - inputs: - command: push - configuration: $(BuildConfiguration) - searchPatternPack: Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj - arguments: --configuration $(BuildConfiguration) - packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg' - nuGetFeedType: 'internal' - publishVstsFeed: '4000bd49-81c3-47f2-94d8-d1392b95c228/04efb628-f46d-4b48-ac4d-5af5b1c75043' #azure-cosmos-dotnet - versioningScheme: OFF + - template: templates/nuget-pack.yml + parameters: + BuildConfiguration: Release + Arguments: /p:IsNightly=true /p:IsPreview=true + VmImage: $(VmImage) + ReleasePackage: true + OutputPath: '$(Build.ArtifactStagingDirectory)/bin/AnyCPU/$(BuildConfiguration)/Microsoft.Azure.Cosmos' + BlobVersion: 'nightly-preview' + CleanupFolder: true \ No newline at end of file diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index 1aff6dbfd2..510bf5f6f8 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -29,8 +29,7 @@ stages: - template: templates/nuget-pack.yml parameters: BuildConfiguration: Release - Arguments: $(ReleaseArguments) VmImage: $(VmImage) ReleasePackage: true OutputPath: '$(Build.ArtifactStagingDirectory)/bin/AnyCPU/$(BuildConfiguration)/Microsoft.Azure.Cosmos' - BlobVersion: variables['BlobVersion'] + BlobVersion: $(BlobVersion) \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 98490f0a62..aae5115a5e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -29,7 +29,6 @@ jobs: - template: templates/nuget-pack.yml parameters: BuildConfiguration: Release - Arguments: $(ReleaseArguments) VmImage: $(VmImage) ReleasePackage: false OutputPath: '$(Build.ArtifactStagingDirectory)/bin/AnyCPU/Release/Microsoft.Azure.Cosmos' diff --git a/templates/nuget-pack.yml b/templates/nuget-pack.yml index 874676d3e1..095b1b52ff 100644 --- a/templates/nuget-pack.yml +++ b/templates/nuget-pack.yml @@ -1,13 +1,27 @@ # File: templates/nuget-pack.yml parameters: - BuildConfiguration: '' - Arguments: '' - VmImage: '' # https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops - OS: 'Windows' - OutputPath: '' - ReleasePackage: false - BlobVersion: '' + - name: BuildConfiguration + type: string + default: '' + - name: Arguments + type: string + default: '' + - name: VmImage + type: string + default: '' + - name: OutputPath + type: string + default: '' + - name: BlobVersion + type: string + default: '' + - name: ReleasePackage + type: boolean + default: false + - name: CleanupFolder + type: boolean + default: false jobs: - job: GenerateNugetPackages @@ -23,7 +37,7 @@ jobs: configuration: $(BuildConfiguration) nugetConfigPath: NuGet.config projects: Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj - arguments: --configuration ${{ parameters.BuildConfiguration }} -p:Optimize=true + arguments: --configuration ${{ parameters.BuildConfiguration }} -p:Optimize=true ${{ parameters.Arguments }} versioningScheme: OFF - task: DotNetCoreCLI@2 @@ -32,7 +46,7 @@ jobs: command: custom projects: 'Microsoft.Azure.Cosmos\src\Microsoft.Azure.Cosmos.csproj' custom: pack - arguments: '-v detailed -c ${{ parameters.BuildConfiguration }} --no-build --no-restore -o "${{ parameters.OutputPath }}"' + arguments: '-v detailed -c ${{ parameters.BuildConfiguration }} --no-build ${{ parameters.Arguments }} --no-restore -o "${{ parameters.OutputPath }}"' - ${{ if eq(parameters.ReleasePackage, true) }}: - task: DotNetCoreCLI@2 @@ -41,26 +55,25 @@ jobs: command: custom projects: 'Microsoft.Azure.Cosmos\src\Microsoft.Azure.Cosmos.csproj' custom: pack - arguments: '-v detailed -c ${{ parameters.BuildConfiguration }} --no-build --include-symbols /p:SymbolPackageFormat=snupkg --no-restore -o "${{ parameters.OutputPath }}"' + arguments: '-v detailed -c ${{ parameters.BuildConfiguration }} --no-build --include-symbols /p:SymbolPackageFormat=snupkg ${{ parameters.Arguments }} --no-restore -o "${{ parameters.OutputPath }}"' - task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 inputs: BuildDropPath: '$(Build.ArtifactStagingDirectory)/bin/AnyCPU/$(BuildConfiguration)/Microsoft.Azure.Cosmos' - - task: AzureFileCopy@2 - displayName: ' Copy Artifacts to Azure SDK Release blob storage' - condition: and(succeeded(),ne(${{ parameters.BlobVersion }}, '')) - inputs: - SourcePath: '$(Build.ArtifactStagingDirectory)/bin/AnyCPU/$(BuildConfiguration)/Microsoft.Azure.Cosmos' - azureSubscription: azuresdkpartnerdrops - Destination: AzureBlob - storage: azuresdkpartnerdrops - ContainerName: 'drops' - BlobPrefix: 'cosmosdb/csharp/$(BlobVersion)' - - - task: PublishBuildArtifacts@1 - displayName: 'Publish Artifacts: Microsoft.Azure.Cosmos' - inputs: - artifactName: Microsoft.Azure.Cosmos + - ${{ if ne(parameters.BlobVersion, '') }}: + - task: AzureFileCopy@5 + displayName: 'Copy Artifacts to Azure SDK Release blob storage' + condition: succeeded() + inputs: + SourcePath: '$(Build.ArtifactStagingDirectory)/bin/AnyCPU/$(BuildConfiguration)/Microsoft.Azure.Cosmos/**' + azureSubscription: azuresdkpartnerdrops + Destination: AzureBlob + storage: azuresdkpartnerdrops + ContainerName: 'drops' + BlobPrefix: 'cosmosdb/csharp/${{ parameters.BlobVersion }}' + CleanTargetBeforeCopy: ${{ parameters.CleanupFolder }} - - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 - displayName: 'Component Detection' + - task: PublishBuildArtifacts@1 + displayName: 'Publish Artifacts: Microsoft.Azure.Cosmos' + inputs: + artifactName: Microsoft.Azure.Cosmos