Skip to content

Commit b3fbc51

Browse files
Catool summary (#222)
* Added the summary * changes in package file * changes for unoffical * Data constant change --------- Co-authored-by: Malavika <malavika.krishnan@siemens.com>
1 parent 8f68d69 commit b3fbc51

File tree

9 files changed

+120
-0
lines changed

9 files changed

+120
-0
lines changed

src/LCT.Common/Constants/Dataconstant.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public static class Dataconstant
4747
public const string PackageUrlNotFound = "Package URL not found";
4848
public const string PackageNameNotFoundInJfrog = "Package name not found in Jfrog";
4949
public const string JfrogRepoPathNotFound = "Jfrog repo path not found";
50+
public const string NotFoundInJFrog = "Not Found in JFrogRepo";
5051
public const string LinkedByCATool = "Linked by CA Tool";
5152
public const string LinkedByCAToolReleaseRelation = "UNKNOWN";
5253
public const string LinkedByCAToolReleaseRelationContained = "CONTAINED";

src/LCT.PackageIdentifier/BomHelper.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ public void WriteBomKpiDataToConsole(BomKpiData bomKpiData)
5151
{CommonHelper.Convert(bomKpiData,nameof(bomKpiData.ComponentsExcluded)),bomKpiData.ComponentsExcluded},
5252
{CommonHelper.Convert(bomKpiData,nameof(bomKpiData.DuplicateComponents)),bomKpiData.DuplicateComponents},
5353
{CommonHelper.Convert(bomKpiData,nameof(bomKpiData.InternalComponents)),bomKpiData.InternalComponents},
54+
{CommonHelper.Convert(bomKpiData,nameof(bomKpiData.ThirdPartyRepoComponents)),bomKpiData.ThirdPartyRepoComponents},
55+
{CommonHelper.Convert(bomKpiData,nameof(bomKpiData.DevdependencyComponents)),bomKpiData.DevdependencyComponents},
56+
{CommonHelper.Convert(bomKpiData,nameof(bomKpiData.ReleaseRepoComponents)),bomKpiData.ReleaseRepoComponents},
57+
{CommonHelper.Convert(bomKpiData,nameof(bomKpiData.UnofficialComponents)),bomKpiData.UnofficialComponents},
5458
{CommonHelper.Convert(bomKpiData,nameof(bomKpiData.ComponentsinSBOMTemplateFile)),bomKpiData.ComponentsinSBOMTemplateFile},
5559
{CommonHelper.Convert(bomKpiData,nameof(bomKpiData.ComponentsUpdatedFromSBOMTemplateFile)),bomKpiData.ComponentsUpdatedFromSBOMTemplateFile},
5660
{CommonHelper.Convert(bomKpiData,nameof(bomKpiData.ComponentsInComparisonBOM)),bomKpiData.ComponentsInComparisonBOM }

src/LCT.PackageIdentifier/ConanProcessor.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,23 @@ public async Task<List<Component>> GetJfrogRepoDetailsOfAComponent(List<Componen
133133
Property artifactoryrepo = new() { Name = Dataconstant.Cdx_ArtifactoryRepoName, Value = repoName };
134134
Property jfrogRepoPathProperty = new() { Name = Dataconstant.Cdx_JfrogRepoPath, Value = jfrogRepoPath };
135135
Component componentVal = component;
136+
if (artifactoryrepo.Value == appSettings.Conan.JfrogDevDestRepoName)
137+
{
138+
BomCreator.bomKpiData.DevdependencyComponents++;
139+
}
140+
if (artifactoryrepo.Value == appSettings.Conan.JfrogThirdPartyDestRepoName)
141+
{
142+
BomCreator.bomKpiData.ThirdPartyRepoComponents++;
143+
}
144+
if (artifactoryrepo.Value == appSettings.Conan.JfrogInternalDestRepoName)
145+
{
146+
BomCreator.bomKpiData.ReleaseRepoComponents++;
147+
}
148+
149+
if (artifactoryrepo.Value == Dataconstant.NotFoundInJFrog || artifactoryrepo.Value == "")
150+
{
151+
BomCreator.bomKpiData.UnofficialComponents++;
152+
}
136153

137154
if (componentVal.Properties?.Count == null || componentVal.Properties?.Count <= 0)
138155
{

src/LCT.PackageIdentifier/DebianProcessor.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,23 @@ public async Task<List<Component>> GetJfrogRepoDetailsOfAComponent(List<Componen
145145
Property jfrogFileNameProperty = new() { Name = Dataconstant.Cdx_Siemensfilename, Value = jfrogRepoPackageName };
146146
Property jfrogRepoPathProperty = new() { Name = Dataconstant.Cdx_JfrogRepoPath, Value = jfrogRepoPath };
147147
Component componentVal = component;
148+
if (artifactoryrepo.Value == appSettings.Debian.JfrogDevDestRepoName)
149+
{
150+
BomCreator.bomKpiData.DevdependencyComponents++;
151+
}
152+
if (artifactoryrepo.Value == appSettings.Debian.JfrogThirdPartyDestRepoName)
153+
{
154+
BomCreator.bomKpiData.ThirdPartyRepoComponents++;
155+
}
156+
if (artifactoryrepo.Value == appSettings.Debian.JfrogInternalDestRepoName)
157+
{
158+
BomCreator.bomKpiData.ReleaseRepoComponents++;
159+
}
160+
161+
if (artifactoryrepo.Value == Dataconstant.NotFoundInJFrog || artifactoryrepo.Value == "")
162+
{
163+
BomCreator.bomKpiData.UnofficialComponents++;
164+
}
148165

149166
if (componentVal.Properties?.Count == null || componentVal.Properties?.Count <= 0)
150167
{

src/LCT.PackageIdentifier/MavenProcessor.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,23 @@ public async Task<List<Component>> GetJfrogRepoDetailsOfAComponent(List<Componen
225225
Property artifactoryrepo = new() { Name = Dataconstant.Cdx_ArtifactoryRepoName, Value = finalRepoData.Repo };
226226

227227
Component componentVal = component;
228+
if (artifactoryrepo.Value == appSettings.Maven.JfrogDevDestRepoName)
229+
{
230+
BomCreator.bomKpiData.DevdependencyComponents++;
231+
}
232+
if (artifactoryrepo.Value == appSettings.Maven.JfrogThirdPartyDestRepoName)
233+
{
234+
BomCreator.bomKpiData.ThirdPartyRepoComponents++;
235+
}
236+
if (artifactoryrepo.Value == appSettings.Maven.JfrogInternalDestRepoName)
237+
{
238+
BomCreator.bomKpiData.ReleaseRepoComponents++;
239+
}
240+
241+
if (artifactoryrepo.Value == Dataconstant.NotFoundInJFrog || artifactoryrepo.Value == "")
242+
{
243+
BomCreator.bomKpiData.UnofficialComponents++;
244+
}
228245
if (componentVal.Properties?.Count == null || componentVal.Properties?.Count <= 0)
229246
{
230247
componentVal.Properties = new List<Property>();

src/LCT.PackageIdentifier/Model/BomKpiData.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,19 @@ public class BomKpiData
3333
[DisplayName(@"Internal Components Identified")]
3434
public int InternalComponents { get; set; }
3535

36+
[DisplayName(@"Components already present in 3rd party repo(s) ")]
37+
public int ThirdPartyRepoComponents { get; set; }
38+
39+
[DisplayName(@"Components already present in devdep repo(s)")]
40+
public int DevdependencyComponents { get; set; }
41+
42+
[DisplayName(@"Components already present in release repo(s)")]
43+
public int ReleaseRepoComponents { get; set; }
44+
45+
[DisplayName(@"Components not from official repo(s)")]
46+
public int UnofficialComponents { get; set; }
47+
48+
3649
[DisplayName(@"Total Components Excluded")]
3750
public int ComponentsExcluded { get; set; }
3851

src/LCT.PackageIdentifier/NpmProcessor.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,27 @@ public async Task<List<Component>> GetJfrogRepoDetailsOfAComponent(List<Componen
408408
string jfrogRepoPath = string.Empty;
409409
AqlResult finalRepoData = GetJfrogArtifactoryRepoDetials(aqlResultList, component, bomhelper, out jfrogRepoPath);
410410
Property artifactoryrepo = new() { Name = Dataconstant.Cdx_ArtifactoryRepoName, Value = finalRepoData.Repo };
411+
411412
Property siemensfileNameProp = new() { Name = Dataconstant.Cdx_Siemensfilename, Value = finalRepoData?.Name ?? Dataconstant.PackageNameNotFoundInJfrog };
412413
Property jfrogRepoPathProp = new() { Name = Dataconstant.Cdx_JfrogRepoPath, Value = jfrogRepoPath };
413414
Component componentVal = component;
415+
if (artifactoryrepo.Value == appSettings.Npm.JfrogDevDestRepoName)
416+
{
417+
BomCreator.bomKpiData.DevdependencyComponents++;
418+
}
419+
if (artifactoryrepo.Value == appSettings.Npm.JfrogThirdPartyDestRepoName)
420+
{
421+
BomCreator.bomKpiData.ThirdPartyRepoComponents++;
422+
}
423+
if (artifactoryrepo.Value == appSettings.Npm.JfrogInternalDestRepoName)
424+
{
425+
BomCreator.bomKpiData.ReleaseRepoComponents++;
426+
}
427+
428+
if (artifactoryrepo.Value == Dataconstant.NotFoundInJFrog || artifactoryrepo.Value == "")
429+
{
430+
BomCreator.bomKpiData.UnofficialComponents++;
431+
}
414432

415433
if (componentVal.Properties?.Count == null || componentVal.Properties?.Count <= 0)
416434
{

src/LCT.PackageIdentifier/NugetProcessor.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,23 @@ public async Task<List<Component>> GetJfrogRepoDetailsOfAComponent(List<Componen
232232
Property siemensfileNameProp = new() { Name = Dataconstant.Cdx_Siemensfilename, Value = finalRepoData?.Name ?? Dataconstant.PackageNameNotFoundInJfrog };
233233
Property jfrogRepoPathProp = new() { Name = Dataconstant.Cdx_JfrogRepoPath, Value = jfrogRepoPath };
234234
Component componentVal = component;
235+
if (artifactoryrepo.Value == appSettings.Nuget.JfrogDevDestRepoName)
236+
{
237+
BomCreator.bomKpiData.DevdependencyComponents++;
238+
}
239+
if (artifactoryrepo.Value == appSettings.Nuget.JfrogThirdPartyDestRepoName)
240+
{
241+
BomCreator.bomKpiData.ThirdPartyRepoComponents++;
242+
}
243+
if (artifactoryrepo.Value == appSettings.Nuget.JfrogInternalDestRepoName)
244+
{
245+
BomCreator.bomKpiData.ReleaseRepoComponents++;
246+
}
235247

248+
if (artifactoryrepo.Value == Dataconstant.NotFoundInJFrog || artifactoryrepo.Value == "")
249+
{
250+
BomCreator.bomKpiData.UnofficialComponents++;
251+
}
236252
if (componentVal.Properties?.Count == null || componentVal.Properties?.Count <= 0)
237253
{
238254
componentVal.Properties = new List<Property>();

src/LCT.PackageIdentifier/PythonProcessor.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,23 @@ public async Task<List<Component>> GetJfrogRepoDetailsOfAComponent(List<Componen
415415
Property fileNameProperty = new() { Name = Dataconstant.Cdx_Siemensfilename, Value = jfrogPackageNameWhlExten };
416416
Property jfrogRepoPathProperty = new() { Name = Dataconstant.Cdx_JfrogRepoPath, Value = jfrogRepoPath };
417417
Component componentVal = component;
418+
if (artifactoryrepo.Value == appSettings.Python.JfrogDevDestRepoName)
419+
{
420+
BomCreator.bomKpiData.DevdependencyComponents++;
421+
}
422+
if (artifactoryrepo.Value == appSettings.Python.JfrogThirdPartyDestRepoName)
423+
{
424+
BomCreator.bomKpiData.ThirdPartyRepoComponents++;
425+
}
426+
if (artifactoryrepo.Value == appSettings.Python.JfrogInternalDestRepoName)
427+
{
428+
BomCreator.bomKpiData.ReleaseRepoComponents++;
429+
}
430+
431+
if (artifactoryrepo.Value == Dataconstant.NotFoundInJFrog || artifactoryrepo.Value == "")
432+
{
433+
BomCreator.bomKpiData.UnofficialComponents++;
434+
}
418435

419436
if (componentVal.Properties?.Count == null || componentVal.Properties?.Count <= 0)
420437
{

0 commit comments

Comments
 (0)