diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index 3b9e2524ff3..fe9dfdf720c 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -94,7 +94,31 @@ jobs: PathtoPublish: '$(Build.StagingDirectory)/ReleaseConfigs.txt' PublishLocation: Container ArtifactName: ReleaseConfigs - + + - task: powershell@2 + displayName: Check if SymbolPublishingExclusionsFile.txt exists + inputs: + targetType: inline + script: | + $symbolExclusionfile = "$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt" + if(Test-Path -Path $symbolExclusionfile) + { + Write-Host "SymbolExclusionFile exists" + Write-Host "##vso[task.setvariable variable=SymbolExclusionFile]true" + } + else{ + Write-Host "Symbols Exclusion file does not exists" + Write-Host "##vso[task.setvariable variable=SymbolExclusionFile]false" + } + + - task: PublishBuildArtifacts@1 + displayName: Publish SymbolPublishingExclusionsFile Artifact + condition: eq(variables['SymbolExclusionFile'], 'true') + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' + PublishLocation: Container + ArtifactName: ReleaseConfigs + - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: - template: /eng/common/templates/steps/publish-logs.yml parameters: diff --git a/eng/publishing/v3/publish-assets.yml b/eng/publishing/v3/publish-assets.yml index 33ef36c0979..60dca2adcde 100644 --- a/eng/publishing/v3/publish-assets.yml +++ b/eng/publishing/v3/publish-assets.yml @@ -43,6 +43,7 @@ jobs: AssetManifests/** BlobArtifacts/MergedManifest.xml PdbArtifacts/** + ReleaseConfigs/SymbolPublishingExclusionsFile.txt downloadPath: '$(Build.ArtifactStagingDirectory)' - task: NuGetToolInstaller@1 @@ -84,7 +85,7 @@ jobs: /p:AkaMSClientSecret=$(akams-client-secret) ${{ parameters.artifactsPublishingAdditionalParameters }} /p:PDBArtifactsBasePath='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' - /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' + /p:SymbolPublishingExclusionsFile='$(Build.ArtifactStagingDirectory)/ReleaseConfigs/SymbolPublishingExclusionsFile.txt' ${{ parameters.symbolPublishingAdditionalParameters}} /p:MsdlToken=$(microsoft-symbol-server-pat) /p:SymWebToken=$(symweb-symbol-server-pat) diff --git a/src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifestBase.cs b/src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifestBase.cs index 986f2668445..b626d27ef90 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifestBase.cs +++ b/src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifestBase.cs @@ -426,6 +426,27 @@ public async Task PublishSymbolsUsingStreamingAsync( HashSet feedConfigsForSymbols = FeedConfigs[symbolCategory]; Dictionary serversToPublish = GetTargetSymbolServers(feedConfigsForSymbols, msdlToken, symWebToken); + HashSet excludeFiles = null; + + if(File.Exists(symbolPublishingExclusionsFile)) + { + Log.LogMessage(MessageImportance.Normal, $"SymbolPublishingExclusionFile exists"); + string[] files = File.ReadAllLines(symbolPublishingExclusionsFile); + excludeFiles = new HashSet(); + + foreach(var file in files) + { + if(!string.IsNullOrEmpty(file)) + { + Log.LogMessage(MessageImportance.Normal, $"Exclude the file {file} from publishing to symbol server"); + excludeFiles.Add(file); + } + } + } + else + { + Log.LogMessage(MessageImportance.Normal, $"SymbolPublishingExclusionFile was not found at ${symbolPublishingExclusionsFile} "); + } if (symbolsToPublish != null && symbolsToPublish.Any()) { @@ -471,7 +492,7 @@ await PublishSymbolsHelper.PublishAsync( token, symbolFiles, null, - null, + excludeFiles, ExpirationInDays, false, publishSpecialClrFiles, @@ -537,7 +558,7 @@ await PublishSymbolsHelper.PublishAsync( token, null, filesToSymbolServer, - null, + excludeFiles, ExpirationInDays, false, publishSpecialClrFiles,