Skip to content

Commit

Permalink
Catool summary (#222)
Browse files Browse the repository at this point in the history
* Added the summary

* changes in package file

* changes for unoffical

* Data constant change

---------

Co-authored-by: Malavika <[email protected]>
  • Loading branch information
1 parent 8f68d69 commit b3fbc51
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/LCT.Common/Constants/Dataconstant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public static class Dataconstant
public const string PackageUrlNotFound = "Package URL not found";
public const string PackageNameNotFoundInJfrog = "Package name not found in Jfrog";
public const string JfrogRepoPathNotFound = "Jfrog repo path not found";
public const string NotFoundInJFrog = "Not Found in JFrogRepo";
public const string LinkedByCATool = "Linked by CA Tool";
public const string LinkedByCAToolReleaseRelation = "UNKNOWN";
public const string LinkedByCAToolReleaseRelationContained = "CONTAINED";
Expand Down
4 changes: 4 additions & 0 deletions src/LCT.PackageIdentifier/BomHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public void WriteBomKpiDataToConsole(BomKpiData bomKpiData)
{CommonHelper.Convert(bomKpiData,nameof(bomKpiData.ComponentsExcluded)),bomKpiData.ComponentsExcluded},
{CommonHelper.Convert(bomKpiData,nameof(bomKpiData.DuplicateComponents)),bomKpiData.DuplicateComponents},
{CommonHelper.Convert(bomKpiData,nameof(bomKpiData.InternalComponents)),bomKpiData.InternalComponents},
{CommonHelper.Convert(bomKpiData,nameof(bomKpiData.ThirdPartyRepoComponents)),bomKpiData.ThirdPartyRepoComponents},
{CommonHelper.Convert(bomKpiData,nameof(bomKpiData.DevdependencyComponents)),bomKpiData.DevdependencyComponents},
{CommonHelper.Convert(bomKpiData,nameof(bomKpiData.ReleaseRepoComponents)),bomKpiData.ReleaseRepoComponents},
{CommonHelper.Convert(bomKpiData,nameof(bomKpiData.UnofficialComponents)),bomKpiData.UnofficialComponents},
{CommonHelper.Convert(bomKpiData,nameof(bomKpiData.ComponentsinSBOMTemplateFile)),bomKpiData.ComponentsinSBOMTemplateFile},
{CommonHelper.Convert(bomKpiData,nameof(bomKpiData.ComponentsUpdatedFromSBOMTemplateFile)),bomKpiData.ComponentsUpdatedFromSBOMTemplateFile},
{CommonHelper.Convert(bomKpiData,nameof(bomKpiData.ComponentsInComparisonBOM)),bomKpiData.ComponentsInComparisonBOM }
Expand Down
17 changes: 17 additions & 0 deletions src/LCT.PackageIdentifier/ConanProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,23 @@ public async Task<List<Component>> GetJfrogRepoDetailsOfAComponent(List<Componen
Property artifactoryrepo = new() { Name = Dataconstant.Cdx_ArtifactoryRepoName, Value = repoName };
Property jfrogRepoPathProperty = new() { Name = Dataconstant.Cdx_JfrogRepoPath, Value = jfrogRepoPath };
Component componentVal = component;
if (artifactoryrepo.Value == appSettings.Conan.JfrogDevDestRepoName)
{
BomCreator.bomKpiData.DevdependencyComponents++;
}
if (artifactoryrepo.Value == appSettings.Conan.JfrogThirdPartyDestRepoName)
{
BomCreator.bomKpiData.ThirdPartyRepoComponents++;
}
if (artifactoryrepo.Value == appSettings.Conan.JfrogInternalDestRepoName)
{
BomCreator.bomKpiData.ReleaseRepoComponents++;
}

if (artifactoryrepo.Value == Dataconstant.NotFoundInJFrog || artifactoryrepo.Value == "")
{
BomCreator.bomKpiData.UnofficialComponents++;
}

if (componentVal.Properties?.Count == null || componentVal.Properties?.Count <= 0)
{
Expand Down
17 changes: 17 additions & 0 deletions src/LCT.PackageIdentifier/DebianProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,23 @@ public async Task<List<Component>> GetJfrogRepoDetailsOfAComponent(List<Componen
Property jfrogFileNameProperty = new() { Name = Dataconstant.Cdx_Siemensfilename, Value = jfrogRepoPackageName };
Property jfrogRepoPathProperty = new() { Name = Dataconstant.Cdx_JfrogRepoPath, Value = jfrogRepoPath };
Component componentVal = component;
if (artifactoryrepo.Value == appSettings.Debian.JfrogDevDestRepoName)
{
BomCreator.bomKpiData.DevdependencyComponents++;
}
if (artifactoryrepo.Value == appSettings.Debian.JfrogThirdPartyDestRepoName)
{
BomCreator.bomKpiData.ThirdPartyRepoComponents++;
}
if (artifactoryrepo.Value == appSettings.Debian.JfrogInternalDestRepoName)
{
BomCreator.bomKpiData.ReleaseRepoComponents++;
}

if (artifactoryrepo.Value == Dataconstant.NotFoundInJFrog || artifactoryrepo.Value == "")
{
BomCreator.bomKpiData.UnofficialComponents++;
}

if (componentVal.Properties?.Count == null || componentVal.Properties?.Count <= 0)
{
Expand Down
17 changes: 17 additions & 0 deletions src/LCT.PackageIdentifier/MavenProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,23 @@ public async Task<List<Component>> GetJfrogRepoDetailsOfAComponent(List<Componen
Property artifactoryrepo = new() { Name = Dataconstant.Cdx_ArtifactoryRepoName, Value = finalRepoData.Repo };

Component componentVal = component;
if (artifactoryrepo.Value == appSettings.Maven.JfrogDevDestRepoName)
{
BomCreator.bomKpiData.DevdependencyComponents++;
}
if (artifactoryrepo.Value == appSettings.Maven.JfrogThirdPartyDestRepoName)
{
BomCreator.bomKpiData.ThirdPartyRepoComponents++;
}
if (artifactoryrepo.Value == appSettings.Maven.JfrogInternalDestRepoName)
{
BomCreator.bomKpiData.ReleaseRepoComponents++;
}

if (artifactoryrepo.Value == Dataconstant.NotFoundInJFrog || artifactoryrepo.Value == "")
{
BomCreator.bomKpiData.UnofficialComponents++;
}
if (componentVal.Properties?.Count == null || componentVal.Properties?.Count <= 0)
{
componentVal.Properties = new List<Property>();
Expand Down
13 changes: 13 additions & 0 deletions src/LCT.PackageIdentifier/Model/BomKpiData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ public class BomKpiData
[DisplayName(@"Internal Components Identified")]
public int InternalComponents { get; set; }

[DisplayName(@"Components already present in 3rd party repo(s) ")]
public int ThirdPartyRepoComponents { get; set; }

[DisplayName(@"Components already present in devdep repo(s)")]
public int DevdependencyComponents { get; set; }

[DisplayName(@"Components already present in release repo(s)")]
public int ReleaseRepoComponents { get; set; }

[DisplayName(@"Components not from official repo(s)")]
public int UnofficialComponents { get; set; }


[DisplayName(@"Total Components Excluded")]
public int ComponentsExcluded { get; set; }

Expand Down
18 changes: 18 additions & 0 deletions src/LCT.PackageIdentifier/NpmProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,27 @@ public async Task<List<Component>> GetJfrogRepoDetailsOfAComponent(List<Componen
string jfrogRepoPath = string.Empty;
AqlResult finalRepoData = GetJfrogArtifactoryRepoDetials(aqlResultList, component, bomhelper, out jfrogRepoPath);
Property artifactoryrepo = new() { Name = Dataconstant.Cdx_ArtifactoryRepoName, Value = finalRepoData.Repo };

Property siemensfileNameProp = new() { Name = Dataconstant.Cdx_Siemensfilename, Value = finalRepoData?.Name ?? Dataconstant.PackageNameNotFoundInJfrog };
Property jfrogRepoPathProp = new() { Name = Dataconstant.Cdx_JfrogRepoPath, Value = jfrogRepoPath };
Component componentVal = component;
if (artifactoryrepo.Value == appSettings.Npm.JfrogDevDestRepoName)
{
BomCreator.bomKpiData.DevdependencyComponents++;
}
if (artifactoryrepo.Value == appSettings.Npm.JfrogThirdPartyDestRepoName)
{
BomCreator.bomKpiData.ThirdPartyRepoComponents++;
}
if (artifactoryrepo.Value == appSettings.Npm.JfrogInternalDestRepoName)
{
BomCreator.bomKpiData.ReleaseRepoComponents++;
}

if (artifactoryrepo.Value == Dataconstant.NotFoundInJFrog || artifactoryrepo.Value == "")
{
BomCreator.bomKpiData.UnofficialComponents++;
}

if (componentVal.Properties?.Count == null || componentVal.Properties?.Count <= 0)
{
Expand Down
16 changes: 16 additions & 0 deletions src/LCT.PackageIdentifier/NugetProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,23 @@ public async Task<List<Component>> GetJfrogRepoDetailsOfAComponent(List<Componen
Property siemensfileNameProp = new() { Name = Dataconstant.Cdx_Siemensfilename, Value = finalRepoData?.Name ?? Dataconstant.PackageNameNotFoundInJfrog };
Property jfrogRepoPathProp = new() { Name = Dataconstant.Cdx_JfrogRepoPath, Value = jfrogRepoPath };
Component componentVal = component;
if (artifactoryrepo.Value == appSettings.Nuget.JfrogDevDestRepoName)
{
BomCreator.bomKpiData.DevdependencyComponents++;
}
if (artifactoryrepo.Value == appSettings.Nuget.JfrogThirdPartyDestRepoName)
{
BomCreator.bomKpiData.ThirdPartyRepoComponents++;
}
if (artifactoryrepo.Value == appSettings.Nuget.JfrogInternalDestRepoName)
{
BomCreator.bomKpiData.ReleaseRepoComponents++;
}

if (artifactoryrepo.Value == Dataconstant.NotFoundInJFrog || artifactoryrepo.Value == "")
{
BomCreator.bomKpiData.UnofficialComponents++;
}
if (componentVal.Properties?.Count == null || componentVal.Properties?.Count <= 0)
{
componentVal.Properties = new List<Property>();
Expand Down
17 changes: 17 additions & 0 deletions src/LCT.PackageIdentifier/PythonProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,23 @@ public async Task<List<Component>> GetJfrogRepoDetailsOfAComponent(List<Componen
Property fileNameProperty = new() { Name = Dataconstant.Cdx_Siemensfilename, Value = jfrogPackageNameWhlExten };
Property jfrogRepoPathProperty = new() { Name = Dataconstant.Cdx_JfrogRepoPath, Value = jfrogRepoPath };
Component componentVal = component;
if (artifactoryrepo.Value == appSettings.Python.JfrogDevDestRepoName)
{
BomCreator.bomKpiData.DevdependencyComponents++;
}
if (artifactoryrepo.Value == appSettings.Python.JfrogThirdPartyDestRepoName)
{
BomCreator.bomKpiData.ThirdPartyRepoComponents++;
}
if (artifactoryrepo.Value == appSettings.Python.JfrogInternalDestRepoName)
{
BomCreator.bomKpiData.ReleaseRepoComponents++;
}

if (artifactoryrepo.Value == Dataconstant.NotFoundInJFrog || artifactoryrepo.Value == "")
{
BomCreator.bomKpiData.UnofficialComponents++;
}

if (componentVal.Properties?.Count == null || componentVal.Properties?.Count <= 0)
{
Expand Down

0 comments on commit b3fbc51

Please sign in to comment.