Skip to content

Commit 2af16fd

Browse files
committed
Merged PR 735951: Update SBOM related packages
Updates various SBOM related packages to work with the new Component Detector. These changes are necessary in order for CloudBuild Repo to update to the new version of Component Detector and SBOM tooling
1 parent ddc826c commit 2af16fd

File tree

8 files changed

+40
-39
lines changed

8 files changed

+40
-39
lines changed

Public/Src/Tools/DropDaemon/DropDaemon.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ private async Task<IIpcResult> GenerateAndUploadBuildManifestFileWithSignedCatal
885885
hasMoreData = bxlResult.Result.HasMoreData;
886886
} while (hasMoreData);
887887

888-
IEnumerable<SBOMFile> manifestFileList = fileList.Select(ToSbomFile);
888+
IEnumerable<SbomFile> manifestFileList = fileList.Select(ToSbomFile);
889889

890890
string sbomGenerationRootDirectory = null;
891891
var logger = GetDropSpecificLogger(dropConfig);
@@ -905,13 +905,13 @@ private async Task<IIpcResult> GenerateAndUploadBuildManifestFileWithSignedCatal
905905
FileUtilities.CreateDirectory(sbomGenerationRootDirectory);
906906

907907
// Always generate SPDX, but exclude CloudBuild manifest if configured to do so
908-
var specs = new List<SBOMSpecification>() { new("SPDX", "2.2") };
908+
var specs = new List<SbomSpecification>() { new("SPDX", "2.2") };
909909
if (!m_disableCloudBuildManifest)
910910
{
911911
specs.Add(new("CloudBuildManifest", "1.0.0"));
912912
}
913913

914-
Possible<IEnumerable<SBOMPackage>> maybePackages;
914+
Possible<IEnumerable<SbomPackage>> maybePackages;
915915
using (m_counters.StartStopwatch(DropDaemonCounter.BuildManifestComponentConversionDuration))
916916
{
917917
maybePackages = await GetSbomPackagesAsync(logger);
@@ -924,7 +924,7 @@ private async Task<IIpcResult> GenerateAndUploadBuildManifestFileWithSignedCatal
924924

925925
var packages = maybePackages.Result;
926926
logger.Verbose("Starting SBOM Generation");
927-
var result = await m_sbomGenerator.GenerateSBOMAsync(sbomGenerationRootDirectory, manifestFileList, packages, metadata, specs);
927+
var result = await m_sbomGenerator.GenerateSbomAsync(sbomGenerationRootDirectory, manifestFileList, packages, metadata, specs);
928928
logger.Verbose("Finished SBOM Generation");
929929

930930
if (!result.IsSuccessful)
@@ -991,7 +991,7 @@ private static string GetSbomGenerationErrorDetails(IList<EntityError> errors)
991991
return sb.ToString();
992992
}
993993

994-
private SBOMFile ToSbomFile(BuildXL.Ipc.ExternalApi.Commands.BuildManifestFileInfo fileInfo)
994+
private SbomFile ToSbomFile(BuildXL.Ipc.ExternalApi.Commands.BuildManifestFileInfo fileInfo)
995995
{
996996
// Include artifacts hash only when computing CloudBuildV1 Manifest
997997
var maybeArtifactsHash = m_disableCloudBuildManifest ? Array.Empty<ContentHash>() : new[] { fileInfo.AzureArtifactsHash };
@@ -1021,14 +1021,14 @@ static AlgorithmName mapHashType(HashType hashType)
10211021
}
10221022

10231023
/// <summary>
1024-
/// Tries to convert output from component detection to a list of <see cref="SBOMPackage"/>.
1024+
/// Tries to convert output from component detection to a list of <see cref="SbomPackage"/>.
10251025
/// </summary>
10261026
/// <returns>
1027-
/// A converted list of <see cref="SBOMPackage"/> if successful.
1027+
/// A converted list of <see cref="SbomPackage"/> if successful.
10281028
/// If not successful, errors messages will be logged and also returned as a Failure{string}.
10291029
/// Any warnings raised by the tooling are also logged via the APIServer.
10301030
/// </returns>
1031-
private async Task<Possible<IEnumerable<SBOMPackage>>> GetSbomPackagesAsync(IIpcLogger logger)
1031+
private async Task<Possible<IEnumerable<SbomPackage>>> GetSbomPackagesAsync(IIpcLogger logger)
10321032
{
10331033
// Read Path for bcde output from environment, this should already be set by Cloudbuild
10341034
var bcdeOutputJsonPath = Environment.GetEnvironmentVariable(Constants.ComponentGovernanceBCDEOutputFilePath);
@@ -1039,7 +1039,7 @@ private async Task<Possible<IEnumerable<SBOMPackage>>> GetSbomPackagesAsync(IIpc
10391039
// and the SBOM creation here can still happen without a set of packages.
10401040
// Log a message on the ApiServer it and return an empty set.
10411041
Analysis.IgnoreResult(await ApiClient.LogMessage($"[GetSbomPackages] The '{Constants.ComponentGovernanceBCDEOutputFilePath}' environment variable was not found. This happens when component governance on the build runner is disabled. Component detection data will not be included in build manifest.", isWarning: false));
1042-
return new List<SBOMPackage>();
1042+
return new List<SbomPackage>();
10431043
}
10441044
else if (!System.IO.File.Exists(bcdeOutputJsonPath))
10451045
{

Public/Src/Tools/DropDaemon/Tool.DropDaemon.dsc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export namespace DropDaemon {
1616
appConfig: f`DropDaemon.exe.config`,
1717
assemblyBindingRedirects: dropDaemonBindingRedirects(),
1818
sources: globR(d`.`, "*.cs"),
19-
2019
references: [
2120
importFrom("BuildXL.Cache.ContentStore").Hashing.dll,
2221
importFrom("BuildXL.Utilities.Instrumentation").Tracing.dll,
@@ -56,6 +55,7 @@ export namespace DropDaemon {
5655
internalsVisibleTo: [
5756
"Test.Tool.DropDaemon",
5857
],
58+
deploymentOptions: { ignoredSelfContainedRuntimeFilenames: [a`System.Text.Encodings.Web.dll`, a`System.Text.Json.dll`] },
5959
runtimeContentToSkip: dropDaemonRuntimeContentToSkip()
6060
});
6161

@@ -136,15 +136,15 @@ export namespace DropDaemon {
136136
name: "System.Text.Json",
137137
publicKeyToken: "cc7b13ffcd2ddd51",
138138
culture: "neutral",
139-
oldVersion: "0.0.0.0-5.0.0.0",
140-
newVersion: "5.0.0.0",
139+
oldVersion: "0.0.0.0-7.0.0.0",
140+
newVersion: "7.0.0.0"
141141
},
142142
{
143143
name: "System.Text.Encodings.Web",
144144
publicKeyToken: "cc7b13ffcd2ddd51",
145145
culture: "neutral",
146-
oldVersion: "0.0.0.0-5.0.0.1",
147-
newVersion: "5.0.0.1", // Corresponds to { id: "System.Text.Encodings.Web", version: "4.7.2" },
146+
oldVersion: "0.0.0.0-7.0.0.0",
147+
newVersion: "7.0.0.0"
148148
}
149149
];
150150
}
@@ -172,9 +172,9 @@ export namespace DropDaemon {
172172
importFrom("Microsoft.ComponentDetection.Contracts").pkg,
173173
importFrom("Microsoft.Sbom.Adapters").pkg,
174174
importFrom("packageurl-dotnet").pkg,
175-
importFrom("System.Text.Json.v5.0.0").pkg,
175+
importFrom("System.Text.Json.v7.0.0").pkg,
176176
importFrom("Newtonsoft.Json").pkg,
177-
importFrom("System.Text.Encodings.Web.v5.0.1").pkg,
177+
importFrom("System.Text.Encodings.Web.v7.0.0").pkg,
178178
];
179179
}
180180

Public/Src/Tools/UnitTests/DropDaemon/SbomGenerationTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ public async Task GenerateSbom()
6767

6868
var sbomGenerationRootDirectory = Path.Combine(Path.GetTempPath(), "sbom");
6969

70-
var specs = new List<SBOMSpecification>() { new("SPDX", "2.2"), new("CloudBuildManifest", "1.0.0") };
70+
var specs = new List<SbomSpecification>() { new("SPDX", "2.2"), new("CloudBuildManifest", "1.0.0") };
7171

7272
// A file with VSO and SHA1 hashes to generate both SPDX and CBManifest
73-
var myfile = new SBOMFile()
73+
var myfile = new SbomFile()
7474
{
7575
Id = "MyFileId",
7676
Path = "Oh/What/A/Cool/Path.txt",
@@ -93,7 +93,7 @@ public async Task GenerateSbom()
9393
},
9494
}
9595
};
96-
IEnumerable<SBOMFile> files = new List<SBOMFile>() { myfile };
96+
IEnumerable<SbomFile> files = new List<SbomFile>() { myfile };
9797

9898
var (adapterReport, packages) = new ComponentDetectionToSBOMPackageAdapter().TryConvert(GenerateBcdeOutput(Path.GetTempFileName()));
9999
XAssert.IsNotNull(packages);
@@ -105,7 +105,7 @@ public async Task GenerateSbom()
105105
}
106106
}
107107

108-
var result = await sbomGenerator.GenerateSBOMAsync(sbomGenerationRootDirectory, files, packages, metadata, specs);
108+
var result = await sbomGenerator.GenerateSbomAsync(sbomGenerationRootDirectory, files, packages, metadata, specs);
109109
if (!result.IsSuccessful)
110110
{
111111
var errorDetails = GetSbomGenerationErrorDetails(result.Errors);

Public/Src/Tools/UnitTests/DropDaemon/Test.Tool.DropDaemon.dsc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ namespace Test.Tool.DropDaemon {
3939
...importFrom("BuildXL.Tools.DropDaemon").dropDaemonSbomPackages(),
4040
],
4141

42+
deploymentOptions: { ignoredSelfContainedRuntimeFilenames: [a`System.Text.Encodings.Web.dll`, a`System.Text.Json.dll`] },
4243
runtimeContentToSkip: importFrom("BuildXL.Tools.DropDaemon").dropDaemonRuntimeContentToSkip(),
4344
});
4445
}

cg/nuget/cgmanifest.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@
11221122
"Type": "NuGet",
11231123
"NuGet": {
11241124
"Name": "Microsoft.ComponentDetection.Contracts",
1125-
"Version": "2.0.2"
1125+
"Version": "3.6.4"
11261126
}
11271127
}
11281128
},
@@ -1779,7 +1779,7 @@
17791779
"Type": "NuGet",
17801780
"NuGet": {
17811781
"Name": "Microsoft.Parsers.ManifestGenerator",
1782-
"Version": "2.3.3"
1782+
"Version": "3.7.0"
17831783
}
17841784
}
17851785
},
@@ -1815,7 +1815,7 @@
18151815
"Type": "NuGet",
18161816
"NuGet": {
18171817
"Name": "Microsoft.SBOMCore",
1818-
"Version": "2.3.3"
1818+
"Version": "3.8.0"
18191819
}
18201820
}
18211821
},
@@ -1824,7 +1824,7 @@
18241824
"Type": "NuGet",
18251825
"NuGet": {
18261826
"Name": "Microsoft.Sbom.Adapters",
1827-
"Version": "0.2.6"
1827+
"Version": "1.5.2"
18281828
}
18291829
}
18301830
},
@@ -1833,7 +1833,7 @@
18331833
"Type": "NuGet",
18341834
"NuGet": {
18351835
"Name": "Microsoft.Sbom.Contracts",
1836-
"Version": "0.2.6"
1836+
"Version": "1.5.2"
18371837
}
18381838
}
18391839
},
@@ -1842,7 +1842,7 @@
18421842
"Type": "NuGet",
18431843
"NuGet": {
18441844
"Name": "Microsoft.Sbom.Extensions",
1845-
"Version": "0.2.6"
1845+
"Version": "1.5.2"
18461846
}
18471847
}
18481848
},
@@ -1851,7 +1851,7 @@
18511851
"Type": "NuGet",
18521852
"NuGet": {
18531853
"Name": "Microsoft.Sbom.Parsers.Spdx22SbomParser",
1854-
"Version": "0.2.6"
1854+
"Version": "1.5.2"
18551855
}
18561856
}
18571857
},
@@ -4029,7 +4029,7 @@
40294029
"Type": "NuGet",
40304030
"NuGet": {
40314031
"Name": "System.Text.Encodings.Web",
4032-
"Version": "5.0.1"
4032+
"Version": "7.0.0"
40334033
}
40344034
}
40354035
},
@@ -4047,7 +4047,7 @@
40474047
"Type": "NuGet",
40484048
"NuGet": {
40494049
"Name": "System.Text.Json",
4050-
"Version": "5.0.0"
4050+
"Version": "7.0.0"
40514051
}
40524052
}
40534053
},

config.dsc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ config({
396396

397397
// Needed for SBOM Generation
398398
{ id: "Microsoft.Extensions.Logging.Abstractions", version: "6.0.3", alias: "Microsoft.Extensions.Logging.Abstractions.v6.0.3", dependentPackageIdsToSkip: ["System.Buffers", "System.Memory"] },
399-
{ id: "System.Text.Encodings.Web", version: "5.0.1", dependentPackageIdsToSkip: ["System.Buffers", "System.Memory"], alias: "System.Text.Encodings.Web.v5.0.1" },
399+
{ id: "System.Text.Encodings.Web", version: "7.0.0", dependentPackageIdsToSkip: ["System.Buffers", "System.Memory"], alias: "System.Text.Encodings.Web.v7.0.0" },
400400
{ id: "packageurl-dotnet", version: "1.1.0" },
401401
{ id: "System.Reactive", version: "4.4.1" },
402402

config.microsoftInternal.dsc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ export const pkgs = isMicrosoftInternal ? [
7979
{ id: "VisualCppTools.Internal.VS2017Layout", version: "14.16.27034", osSkip: [ "macOS", "unix" ] },
8080

8181
// SBOM Generation
82-
{ id: "Microsoft.SBOMCore", version: "2.3.3" },
83-
{ id: "Microsoft.Parsers.ManifestGenerator", version: "2.3.3", dependentPackageIdsToIgnore: ["BuildXL.Cache.Hashing"] },
84-
{ id: "Microsoft.Sbom.Parsers.Spdx22SbomParser", version: "0.2.6" },
85-
{ id: "Microsoft.Sbom.Adapters", version: "0.2.6" },
86-
{ id: "Microsoft.ComponentDetection.Contracts", version: "2.0.2" },
87-
{ id: "Microsoft.Sbom.Contracts", version: "0.2.6" },
88-
{ id: "Microsoft.Sbom.Extensions", version: "0.2.6", dependentPackageIdsToSkip: ["System.Text.Json"] },
82+
{ id: "Microsoft.SBOMCore", version: "3.8.0" },
83+
{ id: "Microsoft.Parsers.ManifestGenerator", version: "3.7.0", dependentPackageIdsToIgnore: ["BuildXL.Cache.Hashing"] },
84+
{ id: "Microsoft.Sbom.Parsers.Spdx22SbomParser", version: "1.5.2" },
85+
{ id: "Microsoft.Sbom.Adapters", version: "1.5.2" },
86+
{ id: "Microsoft.ComponentDetection.Contracts", version: "3.6.4" },
87+
{ id: "Microsoft.Sbom.Contracts", version: "1.5.2" },
88+
{ id: "Microsoft.Sbom.Extensions", version: "1.5.2", dependentPackageIdsToSkip: ["System.Text.Json"] },
8989
{ id: "Microsoft.Bcl.HashCode", version: "1.1.1" },
9090

9191
// Process remoting

config.nuget.dotnetcore.dsc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ export const pkgs = [
244244
{ id: "System.Text.Json", version: "4.7.2",
245245
dependentPackageIdsToSkip: ["System.Memory", "System.ValueTuple", "System.Runtime.CompilerServices.Unsafe", "System.Numerics.Vectors", "System.Threading.Tasks.Extensions", "Microsoft.Bcl.AsyncInterfaces"],
246246
},
247-
{ id: "System.Text.Json", version: pkgVersion5,
247+
{ id: "System.Text.Json", version: pkgVersion7,
248248
dependentPackageIdsToSkip: ["System.Memory", "System.Buffers", "System.ValueTuple", "System.Runtime.CompilerServices.Unsafe", "System.Numerics.Vectors", "System.Threading.Tasks.Extensions", "Microsoft.Bcl.AsyncInterfaces", "System.Text.Encodings.Web"],
249-
alias: "System.Text.Json.v5.0.0"
249+
alias: "System.Text.Json.v7.0.0"
250250
},
251251
{ id: "System.Threading.AccessControl", version: pkgVersionNext },
252252

0 commit comments

Comments
 (0)