Skip to content

Commit

Permalink
chore: Output failure telemetry if signing validation fails (microsof…
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveTryon authored and tarun06 committed Jul 21, 2024
1 parent 03bd7a4 commit 60aebb1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/Microsoft.Sbom.Api/Entities/ErrorType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,8 @@ public enum ErrorType
ReferencedSbomFile = 10,

[EnumMember(Value = "No packages found")]
NoPackagesFound = 11
NoPackagesFound = 11,

[EnumMember(Value = "Manifest file signing error")]
ManifestFileSigningError = 12
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public async Task<bool> RunAsync()
if (!signValidator.Validate())
{
log.Error("Sign validation failed.");
validFailures = new List<FileValidationResult> { new FileValidationResult { ErrorType = ErrorType.ManifestFileSigningError } };
return false;
}
}
Expand Down Expand Up @@ -190,7 +191,7 @@ public async Task<bool> RunAsync()

private void LogIndividualFileResults(IEnumerable<FileValidationResult> validFailures)
{
if (validFailures == null)
if (validFailures == null || validFailures.Any(v => v.ErrorType == ErrorType.ManifestFileSigningError))
{
// We failed to generate the output due to a workflow error.
return;
Expand Down Expand Up @@ -232,7 +233,7 @@ private void LogIndividualFileResults(IEnumerable<FileValidationResult> validFai

private void LogResultsSummary(ValidationResult validationResultOutput, IEnumerable<FileValidationResult> validFailures)
{
if (validationResultOutput == null || validFailures == null)
if (validationResultOutput == null || validFailures == null || validFailures.Any(v => v.ErrorType == ErrorType.ManifestFileSigningError))
{
// We failed to generate the output due to a workflow error.
return;
Expand Down

0 comments on commit 60aebb1

Please sign in to comment.