Skip to content

Commit

Permalink
Excluding symbols in SymbolsPublishingExclusion.txt to publish to sym…
Browse files Browse the repository at this point in the history
…bol server (#7733)

* Excluding symbols in SymbolsPublishingExclusion.txt to publish to symbol server
  • Loading branch information
epananth authored Aug 10, 2021
1 parent 4211eec commit 6c28cee
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 4 deletions.
26 changes: 25 additions & 1 deletion eng/common/templates/job/publish-build-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion eng/publishing/v3/publish-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
AssetManifests/**
BlobArtifacts/MergedManifest.xml
PdbArtifacts/**
ReleaseConfigs/SymbolPublishingExclusionsFile.txt
downloadPath: '$(Build.ArtifactStagingDirectory)'

- task: NuGetToolInstaller@1
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,27 @@ public async Task PublishSymbolsUsingStreamingAsync(
HashSet<TargetFeedConfig> feedConfigsForSymbols = FeedConfigs[symbolCategory];
Dictionary<string, string> serversToPublish =
GetTargetSymbolServers(feedConfigsForSymbols, msdlToken, symWebToken);
HashSet<string> excludeFiles = null;

if(File.Exists(symbolPublishingExclusionsFile))
{
Log.LogMessage(MessageImportance.Normal, $"SymbolPublishingExclusionFile exists");
string[] files = File.ReadAllLines(symbolPublishingExclusionsFile);
excludeFiles = new HashSet<string>();

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())
{
Expand Down Expand Up @@ -471,7 +492,7 @@ await PublishSymbolsHelper.PublishAsync(
token,
symbolFiles,
null,
null,
excludeFiles,
ExpirationInDays,
false,
publishSpecialClrFiles,
Expand Down Expand Up @@ -537,7 +558,7 @@ await PublishSymbolsHelper.PublishAsync(
token,
null,
filesToSymbolServer,
null,
excludeFiles,
ExpirationInDays,
false,
publishSpecialClrFiles,
Expand Down

0 comments on commit 6c28cee

Please sign in to comment.