diff --git a/eng/pipelines/common/templates/jobs/build-signed-package-job.yml b/eng/pipelines/common/templates/jobs/build-signed-package-job.yml index 0061a2874f..f812941968 100644 --- a/eng/pipelines/common/templates/jobs/build-signed-package-job.yml +++ b/eng/pipelines/common/templates/jobs/build-signed-package-job.yml @@ -23,7 +23,7 @@ jobs: displayName: 'Build Signed MDS Package' pool: type: windows # read more about custom job pool types at https://aka.ms/obpipelines/yaml/jobs - + variables: - template: /eng/pipelines/libraries/variables.yml@self - ${{ if parameters.isPreview }}: @@ -38,22 +38,25 @@ jobs: Write-Host "##vso[task.setvariable variable=CDP_BUILD_TYPE_COPY;isOutput=true]$($env:CDP_BUILD_TYPE)" name: GetBuildType + # Install the .NET SDK. + - template: /eng/pipelines/steps/install-dotnet.yml@self + # Build our tooling, which is required by the analysis step below, but # shouldn't be analyzed itself. - task: MSBuild@1 displayName: 'Build Tooling' inputs: solution: '**/build.proj' - configuration: $(Configuration) + configuration: Release msbuildArguments: -t:BuildTools # Perform analysis before building, since this step will clobber build output. - template: /eng/pipelines/common/templates/steps/code-analyze-step.yml@self - + # Build MDS in Package mode, producing signed DLLs. - template: /eng/pipelines/common/templates/steps/build-all-configurations-signed-dlls-step.yml@self parameters: - buildConfiguration: $(Configuration) + buildConfiguration: Release # These variables are sourced from common-variables.yml. mdsAssemblyFileVersion: $(mdsAssemblyFileVersion) mdsPackageVersion: $(mdsPackageVersion) @@ -62,7 +65,7 @@ jobs: - template: /eng/pipelines/common/templates/steps/esrp-code-signing-step.yml@self parameters: artifactType: dll - + - template: /eng/pipelines/common/templates/steps/generate-nuget-package-step.yml@self parameters: buildConfiguration: Release @@ -72,11 +75,11 @@ jobs: outputDirectory: $(artifactDirectory) packageVersion: $(mdsPackageVersion) referenceType: Package - + - template: /eng/pipelines/common/templates/steps/esrp-code-signing-step.yml@self parameters: artifactType: pkg - + - template: /eng/pipelines/common/templates/steps/copy-dlls-for-test-step.yml@self parameters: buildConfiguration: Release diff --git a/eng/pipelines/common/templates/jobs/validate-signed-package-job.yml b/eng/pipelines/common/templates/jobs/validate-signed-package-job.yml index b734f70de7..6dba0a8eab 100644 --- a/eng/pipelines/common/templates/jobs/validate-signed-package-job.yml +++ b/eng/pipelines/common/templates/jobs/validate-signed-package-job.yml @@ -38,13 +38,13 @@ jobs: isCustom: true name: ADO-1ES-Pool vmImage: 'ADO-MMS22-SQL19' - + variables: # More settings at https://aka.ms/obpipelines/yaml/jobs - template: /eng/pipelines/libraries/mds-validation-variables.yml@self - + - name: pathToDownloadedNuget # path to the downloaded nuget files value: $(Pipeline.Workspace)\${{parameters.packageFolderName }} - + - name: BuildType value: $[ stageDependencies.buildMDS.build_signed_package.outputs['GetBuildType.CDP_BUILD_TYPE_COPY'] ] @@ -61,21 +61,10 @@ jobs: - task: NuGetToolInstaller@1 displayName: 'Use NuGet' - - powershell: | - # Sets the pipeline ASSEMBLY_VERSION variable. - - [Xml] $versionprops = Get-Content -Path ".\tools\props\Versions.props" - Write-Host $versionprops.Project.PropertyGroup[0].AssemblyFileVersion - - $AssemblyVersion = $versionprops.Project.PropertyGroup[0].AssemblyVersion - - Write-Host "##vso[task.setvariable variable=ASSEMBLY_VERSION;]$AssemblyVersion" - displayName: 'Update assembly version property' - - powershell: | # Displays the paths of all the local cache directories nuget locals all -List - + #Clears all files from all local cache directories nuget locals all -Clear displayName: 'Clear local cache' @@ -99,7 +88,7 @@ jobs: Write-Host "--------------------------------------------------" Write-Host "This will verify the artifact signature" -ForegroundColor Green Write-Host "--------------------------------------------------" - + if ($packageType -eq 'dll' -or $packageType -eq 'both') { nuget verify -All $(pathToDownloadedNuget)\*.nupkg @@ -111,7 +100,7 @@ jobs: displayName: 'Verify nuget signature' - powershell: | - $buildType = [string]"$(BuildType)" + $buildType = [string]"$(BuildType)" if($buildType -eq 'Official') { @@ -119,7 +108,7 @@ jobs: # Microsoft.Data.SqlClient.dll and Microsoft.Data.SqlClient.resources.dll (in localized folders) should have strong name $dllFiles = Get-ChildItem -Path $(TempFolderName) -Recurse -Filter *.dll $badDlls = @() - foreach ($file in $dllFiles) + foreach ($file in $dllFiles) { # Run sn.k to verify the strong name on each dll $result = & "C:\Program Files (x86)\Microsoft SDKs\Windows\*\bin\NETFX 4.8.1 Tools\sn.exe" -vf $file.FullName @@ -137,7 +126,7 @@ jobs: foreach($dll in $badDlls) { Write-Output $dll - } + } Exit -1 } Write-Host "Strong name has been verified for all dlls" @@ -179,7 +168,7 @@ jobs: } } } - + elseif ($_.Name -eq 'runtimes'){ Get-ChildItem -Depth 3 -Path $_.FullName -Exclude $excludNamesFromRuntimeFolder -Directory | foreach{ if('$(expectedDotnetVersions)'.Contains($_.Name)){ @@ -211,15 +200,15 @@ jobs: - powershell: | # list all the child items of created temp folder - + #Verify all DLLs unzipped match "expected" hierarchy - + foreach( $folderName in (Get-ChildItem -Path $(extractedNugetPath) -Directory).Name) { # List all Childerns of the Path - Get-ChildItem -Path $(extractedNugetPath)\$folderName -Recurse -File - $subFiles = Get-ChildItem -Path $(extractedNugetPath)\$folderName -Recurse -File - + Get-ChildItem -Path $(extractedNugetPath)\$folderName -Recurse -File + $subFiles = Get-ChildItem -Path $(extractedNugetPath)\$folderName -Recurse -File + foreach($file in $subFiles) { if($subFiles[0].Name -like "*.dll" ) @@ -238,7 +227,7 @@ jobs: Write-Host "Expected file pattern for localization did not match to *.dll" -ForegroundColor Red Exit -1 } - } + } } else { @@ -252,7 +241,7 @@ jobs: displayName: 'Verify all DLLs unzipped match "expected" hierarchy' - powershell: | # Verify all dlls status are Valid - + $dlls = Get-ChildItem -Path $(extractedNugetPath) -Recurse -Include *.dll foreach ($status in $dlls | Get-AuthenticodeSignature) { @@ -274,18 +263,18 @@ jobs: # expected values. $failed = 0 - foreach ( $pVersion in Get-ChildItem *.dll -Path $(extractedNugetPath) -Recurse | ForEach-Object versioninfo ) + foreach ( $pVersion in Get-ChildItem *.dll -Path $(extractedNugetPath) -Recurse | ForEach-Object versioninfo ) { if ($pVersion.ProductVersion -Like '$(mdsPackageVersion)*') { Write-Host -ForegroundColor Green "Correct ProductVersion detected for $($pVersion.FileName): $($pVersion.ProductVersion)" } else - { + { Write-Host -ForegroundColor Red "Wrong ProductVersion detected for $($pVersion.FileName); expected: $(mdsPackageVersion); found: $($pVersion.ProductVersion)" $failed = 1 } - + if ($pVersion.FileVersion -eq '$(mdsAssemblyFileVersion)') { Write-Host -ForegroundColor Green "Correct FileVersion detected for $($pVersion.FileName): $($pVersion.FileVersion)" @@ -296,7 +285,7 @@ jobs: $failed = 1 } } - + if ($failed -ne 0) { Exit -1 @@ -314,10 +303,10 @@ jobs: # TODO: This also isn't checking the versions of the actual assemblies in # the package, so it isn't terribly useful. - [Xml] $versionprops = Get-Content -Path "tools/props/Versions.props" + [Xml] $versionprops = Get-Content -Path "tools/props/Versions.props" $AssemblyFileVersion = $versionprops.Project.PropertyGroup[2].AssemblyFileVersion $AssemblyVersion = $versionprops.Project.PropertyGroup[2].AssemblyVersion - + if($AssemblyFileVersion -eq $AssemblyVersion) { Write-Host AssemblyFileVersion: $AssemblyFileVersion should not be equal to: $AssemblyVersion diff --git a/eng/pipelines/common/templates/steps/build-all-configurations-signed-dlls-step.yml b/eng/pipelines/common/templates/steps/build-all-configurations-signed-dlls-step.yml index c446ab7baf..5c7a3c8828 100644 --- a/eng/pipelines/common/templates/steps/build-all-configurations-signed-dlls-step.yml +++ b/eng/pipelines/common/templates/steps/build-all-configurations-signed-dlls-step.yml @@ -43,5 +43,5 @@ steps: -p:ReferenceType=${{ parameters.referenceType }} -p:GenerateNuget=false -p:SigningKeyPath=$(Agent.TempDirectory)\netfxKeypair.snk - -p:MdsAssemblyFileVersion=${{ parameters.mdsAssemblyFileVersion }} + -p:AssemblyFileVersion=${{ parameters.mdsAssemblyFileVersion }} -p:MdsPackageVersion=${{ parameters.mdsPackageVersion }} diff --git a/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml b/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml index 1a260430e7..78c0f230b6 100644 --- a/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml +++ b/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml @@ -74,15 +74,15 @@ parameters: # parameters are shown up in ADO UI in a build queue time variables: - template: /eng/pipelines/libraries/variables.yml@self - - name: packageFolderName - value: packages + - name: mdsArtifactName + value: drop_buildMDS_build_signed_package - name: PublishSymbols value: ${{ parameters['publishSymbols'] }} - name: CurrentNetFxVersion value: ${{ parameters['CurrentNetFxVersion'] }} resources: - repositories: + repositories: - repository: templates type: git name: OneBranch.Pipelines/GovernedTemplates @@ -124,7 +124,7 @@ extends: break: true # always break the build on policheck issues. You can disable it by setting to 'false' exclusionsFile: $(REPOROOT)\.config\PolicheckExclusions.xml asyncSdl: - enabled: false + enabled: false credscan: enabled: ${{ not(parameters['isPreview']) }} suppressionsFile: $(REPOROOT)/.config/CredScanSuppressions.json @@ -159,11 +159,11 @@ extends: jobs: - template: /eng/pipelines/common/templates/jobs/validate-signed-package-job.yml@self parameters: - packageFolderName: $(packageFolderName) + packageFolderName: $(mdsArtifactName) isPreview: ${{ parameters['isPreview'] }} downloadPackageStep: download: current - artifact: $(packageFolderName) + artifact: $(mdsArtifactName) patterns: '**/*.*nupkg' displayName: 'Download NuGet Package' @@ -174,6 +174,6 @@ extends: # timeout: ${{ parameters.testJobTimeout }} # downloadPackageStep: # download: current -# artifact: $(packageFolderName) +# artifact: $(mdsArtifactName) # patterns: '**/*.nupkg' # displayName: 'Download NuGet Package' diff --git a/eng/pipelines/libraries/build-variables.yml b/eng/pipelines/libraries/build-variables.yml index 67a374143a..6bb5d224ee 100644 --- a/eng/pipelines/libraries/build-variables.yml +++ b/eng/pipelines/libraries/build-variables.yml @@ -7,5 +7,5 @@ # This file is only included in MDS OneBranch Official pipelines. variables: + - group: Release Variables - template: /eng/pipelines/libraries/common-variables.yml@self - - template: /eng/pipelines/libraries/mds-variables.yml@self diff --git a/eng/pipelines/libraries/common-variables.yml b/eng/pipelines/libraries/common-variables.yml index 25a2e6cd38..1d241c1c05 100644 --- a/eng/pipelines/libraries/common-variables.yml +++ b/eng/pipelines/libraries/common-variables.yml @@ -17,7 +17,7 @@ variables: # AuthSignCertName - name: CommitHead - value: '' # the value will be extracted from the repo's head + value: '' # the value will be extracted from the repo's head - name: REPOROOT value: $(Build.SourcesDirectory) - name: softwareFolder @@ -47,39 +47,34 @@ variables: # The NuGet package version for GA releases (non-preview). - name: abstractionsPackageVersion value: '1.0.0' - + # The NuGet package version for preview releases. - name: abstractionsPackagePreviewVersion value: 1.0.0-preview1.$(Build.BuildNumber) # The AssemblyFileVersion for all assemblies in the Abstractions package. - # - name: abstractionsAssemblyFileVersion value: 1.0.0.$(assemblyBuildNumber) - + # ---------------------------------------------------------------------------- # MDS Package Versions + # + # These are version values that will be used by the official build. They + # should be updated after each release to reflect the next release's versions. - # Update this after every release. This is used to generate the MDS NuGet package version. - - name: Major - value: '7' - - name: Minor - value: '0' - - name: Patch - value: '0' - - # Update this for preview releases. - - name: Preview - value: '-preview' - - name: Revision - value: '3' - + # The NuGet package version for GA releases (non-preview). - name: mdsPackageVersion - value: $(Major).$(Minor).$(Patch) + value: '7.0.0' + + # The NuGet package version for preview releases. - name: previewMdsPackageVersion - value: $(Major).$(Minor).$(Patch)$(Preview)$(Revision).$(Build.BuildNumber) + value: 7.0.0-preview4.$(Build.BuildNumber) + + # The AssemblyFileVersion for all assemblies in the MDS package. - name: mdsAssemblyFileVersion - value: $(Major).$(Minor).$(Patch).$(assemblyBuildNumber) + value: 7.0.0.$(assemblyBuildNumber) + + # The path to the NuGet packaging specification file used to generate the MDS NuGet package. - name: nuspecPath value: '$(REPOROOT)/tools/specs/Microsoft.Data.SqlClient.nuspec' @@ -92,12 +87,11 @@ variables: # The NuGet package version for GA releases (non-preview). - name: azurePackageVersion value: '1.0.0' - + # The NuGet package version for preview releases. - name: azurePackagePreviewVersion value: 1.0.0-preview1.$(Build.BuildNumber) # The AssemblyFileVersion for all assemblies in the Azure package. - # - name: azureAssemblyFileVersion value: 1.0.0.$(assemblyBuildNumber) diff --git a/eng/pipelines/libraries/mds-validation-variables.yml b/eng/pipelines/libraries/mds-validation-variables.yml index 067faf8b88..4ca60db05e 100644 --- a/eng/pipelines/libraries/mds-validation-variables.yml +++ b/eng/pipelines/libraries/mds-validation-variables.yml @@ -7,8 +7,8 @@ # This file is only included in MDS OneBranch Official pipelines. variables: + - group: Release Variables - template: /eng/pipelines/libraries/common-variables.yml@self - - template: /eng/pipelines/libraries/mds-variables.yml@self - name: TempFolderName # extract the nuget package here value: temp diff --git a/eng/pipelines/libraries/mds-variables.yml b/eng/pipelines/libraries/mds-variables.yml deleted file mode 100644 index 60638988bd..0000000000 --- a/eng/pipelines/libraries/mds-variables.yml +++ /dev/null @@ -1,10 +0,0 @@ -################################################################################# -# Licensed to the .NET Foundation under one or more agreements. # -# The .NET Foundation licenses this file to you under the MIT license. # -# See the LICENSE file in the project root for more information. # -################################################################################# - -# This file is only included in MDS OneBranch Official pipelines. - -variables: - - group: Release Variables