Skip to content

Commit 2cf0af1

Browse files
authored
Merge pull request #336 from siemens/hotfix/8.2.1
fix: v8.2.1
2 parents cdb27c6 + 00fad0f commit 2cf0af1

File tree

21 files changed

+603
-64
lines changed

21 files changed

+603
-64
lines changed

.github/workflows/build-and-release.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ jobs:
4949

5050
- name: Build Docker Image
5151
run: |
52-
docker build . --file Dockerfile --tag ${{ github.repository }}:continuous-clearing-v8.2.0
53-
docker save ${{ github.repository }}:continuous-clearing-v8.2.0 -o continuous-clearing-v8.2.0.tar
52+
docker build . --file Dockerfile --tag ${{ github.repository }}:continuous-clearing-v8.2.1
53+
docker save ${{ github.repository }}:continuous-clearing-v8.2.1 -o continuous-clearing-v8.2.1.tar
5454
5555
- name: Upload Docker Image
5656
uses: actions/upload-artifact@v4
@@ -74,7 +74,7 @@ jobs:
7474

7575
- name: Pack NuGet Package
7676
run: |
77-
nuget pack CA.nuspec -Version 8.2.0
77+
nuget pack CA.nuspec -Version 8.2.1
7878
7979
- name: Upload NuGet Package
8080
uses: actions/upload-artifact@v4
@@ -114,25 +114,25 @@ jobs:
114114
env:
115115
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
116116
with:
117-
tag_name: v8.2.0
118-
release_name: Release v8.2.0
117+
tag_name: v8.2.1
118+
release_name: Release v8.2.1
119119
body: |
120120
${{ github.event.head_commit.message }}
121121
draft: true
122122
prerelease: false
123123

124124
- name: Compress Full Build Output into ZIP
125125
run: |
126-
powershell -Command "& {Compress-Archive -Path ${{ github.workspace }}/out/* -DestinationPath ${{ github.workspace }}/continuous-clearing-v8.2.0.zip}"
126+
powershell -Command "& {Compress-Archive -Path ${{ github.workspace }}/out/* -DestinationPath ${{ github.workspace }}/continuous-clearing-v8.2.1.zip}"
127127
128128
- name: Upload Full Build Output ZIP to Release
129129
uses: actions/upload-release-asset@v1
130130
env:
131131
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
132132
with:
133133
upload_url: ${{ steps.create_release.outputs.upload_url }}
134-
asset_path: ${{ github.workspace }}/continuous-clearing-v8.2.0.zip
135-
asset_name: continuous-clearing-v8.2.0.zip
134+
asset_path: ${{ github.workspace }}/continuous-clearing-v8.2.1.zip
135+
asset_name: continuous-clearing-v8.2.1.zip
136136
asset_content_type: application/zip
137137

138138
- name: Upload Docker Image(tar) to Release
@@ -141,8 +141,8 @@ jobs:
141141
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
142142
with:
143143
upload_url: ${{ steps.create_release.outputs.upload_url }}
144-
asset_path: ./continuous-clearing-v8.2.0.tar
145-
asset_name: continuous-clearing-v8.2.0.tar
144+
asset_path: ./continuous-clearing-v8.2.1.tar
145+
asset_name: continuous-clearing-v8.2.1.tar
146146
asset_content_type: application/x-tar
147147

148148
- name: Upload NuGet Package to Release
@@ -151,8 +151,8 @@ jobs:
151151
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
152152
with:
153153
upload_url: ${{ steps.create_release.outputs.upload_url }}
154-
asset_path: ./continuous-clearing.8.2.0.nupkg
155-
asset_name: continuous-clearing.8.2.0.nupkg
154+
asset_path: ./continuous-clearing.8.2.1.nupkg
155+
asset_name: continuous-clearing.8.2.1.nupkg
156156
asset_content_type: application/octet-stream
157157

158158
- name: Upload ReadmeOSS_nupkg file to Release

CA.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<package >
55
<metadata>
66
<id>continuous-clearing</id>
7-
<version>8.2.0</version>
7+
<version>8.2.1</version>
88
<authors>Siemens AG</authors>
99
<owners>continuous-clearing contributors</owners>
1010
<projectUrl>https://github.com/siemens/continuous-clearing</projectUrl>

src/ArtifactoryUploader/LCT.ArtifactoryUploader.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<OutputType>Exe</OutputType>
55
<TargetFramework>net8.0</TargetFramework>
66
<AssemblyName>ArtifactoryUploader</AssemblyName>
7-
<Version>8.2.0</Version>
7+
<Version>8.2.1</Version>
88
</PropertyGroup>
99

1010
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

src/LCT.APICommunications/LCT.APICommunications.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<OutputType>Library</OutputType>
55
<TargetFramework>net8.0</TargetFramework>
6-
<Version>8.2.0</Version>
6+
<Version>8.2.1</Version>
77
</PropertyGroup>
88

99
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

src/LCT.Common.UTests/CommonHelperTest.cs

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
using LCT.Common.Constants;
99
using LCT.Common.Model;
1010
using log4net;
11+
using log4net.Appender;
1112
using NUnit.Framework;
1213
using System;
1314
using System.Collections.Generic;
1415
using System.IO;
1516
using System.Linq;
17+
using System.Reflection;
1618
using System.Runtime.InteropServices;
1719
using File = System.IO.File;
1820

@@ -1064,7 +1066,77 @@ public void ProcessInternalComponentIdentification_PreservesOriginalComponentDat
10641066
// Should have added one property (internal) to the existing empty list
10651067
Assert.AreEqual(1, processedComponent.Properties.Count);
10661068
}
1069+
[Test]
1070+
public void LogDuplicateComponentsByPurlId_LogsExpectedOutput_MemoryAppender()
1071+
{
1072+
// Arrange
1073+
var components = new List<Components>
1074+
{
1075+
new Components { Name = "CompA", Version = "1.0", ComponentId = "cid1" },
1076+
new Components { Name = "CompB", Version = "2.0", ComponentId = "cid2" }
1077+
};
1078+
string sw360Url = "http://sw360";
1079+
1080+
// Set up MemoryAppender
1081+
var memoryAppender = new MemoryAppender();
1082+
var loggerField = typeof(CommonHelper).GetField("Logger", BindingFlags.Static | BindingFlags.NonPublic);
1083+
var logger = (ILog)loggerField.GetValue(null);
1084+
1085+
// Attach the appender to the logger's repository
1086+
var log = LogManager.GetLogger(typeof(CommonHelper));
1087+
((log4net.Repository.Hierarchy.Logger)log.Logger).AddAppender(memoryAppender);
1088+
1089+
// Act
1090+
var logMethod = typeof(CommonHelper).GetMethod("LogDuplicateComponentsByPurlId", BindingFlags.Static | BindingFlags.NonPublic);
1091+
Assert.IsNotNull(logMethod, "LogDuplicateComponentsByPurlId method not found in CommonHelper.");
1092+
logMethod.Invoke(null, new object[] { components, sw360Url });
1093+
1094+
// Get log events
1095+
var events = memoryAppender.GetEvents();
1096+
var messages = events.Select(e => e.RenderedMessage).ToList();
1097+
1098+
// Assert
1099+
Assert.IsTrue(messages.Any(m => m.Contains("not created in SW360 due to Invalid Purl ids")), "Missing expected summary log.");
1100+
Assert.IsTrue(messages.Any(m => m.Contains("Component Name already exists in SW360")), "Missing expected warning log.");
1101+
Assert.IsTrue(messages.Any(m => m.Contains("CompA")), "Missing CompA in log.");
1102+
Assert.IsTrue(messages.Any(m => m.Contains("CompB")), "Missing CompB in log.");
1103+
Assert.IsTrue(messages.Any(m => m.Contains("http://sw360/group/guest/components/-/component/detail/cid1")), "Missing CompA URL in log.");
1104+
Assert.IsTrue(messages.Any(m => m.Contains("http://sw360/group/guest/components/-/component/detail/cid2")), "Missing CompB URL in log.");
1105+
1106+
// Clean up
1107+
((log4net.Repository.Hierarchy.Logger)log.Logger).RemoveAppender(memoryAppender);
1108+
}
1109+
1110+
[Test]
1111+
public void LogDuplicateComponentsByPurlId_DoesNothing_WhenListIsEmpty_MemoryAppender()
1112+
{
1113+
// Arrange
1114+
var components = new List<Components>();
1115+
string sw360Url = "http://sw360";
1116+
1117+
// Set up MemoryAppender
1118+
var memoryAppender = new MemoryAppender();
1119+
var loggerField = typeof(CommonHelper).GetField("Logger", BindingFlags.Static | BindingFlags.NonPublic);
1120+
var logger = (ILog)loggerField.GetValue(null);
1121+
1122+
// Attach the appender to the logger's repository
1123+
var log = LogManager.GetLogger(typeof(CommonHelper));
1124+
((log4net.Repository.Hierarchy.Logger)log.Logger).AddAppender(memoryAppender);
10671125

1126+
// Act
1127+
var logMethod = typeof(CommonHelper).GetMethod("LogDuplicateComponentsByPurlId", BindingFlags.Static | BindingFlags.NonPublic);
1128+
Assert.IsNotNull(logMethod, "LogDuplicateComponentsByPurlId method not found in CommonHelper.");
1129+
logMethod.Invoke(null, new object[] { components, sw360Url });
1130+
1131+
// Get log events
1132+
var events = memoryAppender.GetEvents();
1133+
1134+
// Assert
1135+
Assert.IsTrue(events.Length == 0 || events.All(e => string.IsNullOrWhiteSpace(e.RenderedMessage)), "No logs should be written when the list is empty.");
1136+
1137+
// Clean up
1138+
((log4net.Repository.Hierarchy.Logger)log.Logger).RemoveAppender(memoryAppender);
1139+
}
10681140

10691141
#region SetComponentPropertiesAndHashes Tests
10701142

src/LCT.Common/CommonHelper.cs

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,12 @@ public static void WriteToConsoleTable(Dictionary<string, int> printData, Dictio
153153
}
154154
}
155155

156-
public static void WriteComponentsWithoutDownloadURLToKpi(List<ComparisonBomData> componentInfo, List<Components> lstReleaseNotCreated, string sw360URL)
156+
public static void WriteComponentsWithoutDownloadURLToKpi(List<ComparisonBomData> componentInfo, List<Components> lstReleaseNotCreated, string sw360URL,List<Components> DuplicateComponentsByPurlId)
157157
{
158158
const string Name = "Name";
159159
const string Version = "Version";
160160
const string URL = "SW360 Release URL";
161+
161162
if (componentInfo.Count > 0 || lstReleaseNotCreated.Count > 0)
162163
{
163164
Logger.Logger.Log(null, Level.Alert, "Action Item required by the user:\n", null);
@@ -199,8 +200,38 @@ public static void WriteComponentsWithoutDownloadURLToKpi(List<ComparisonBomData
199200
}
200201
Logger.Info("\n");
201202
}
203+
LogDuplicateComponentsByPurlId(DuplicateComponentsByPurlId, sw360URL);
204+
202205
}
206+
private static void LogDuplicateComponentsByPurlId(List<Components> duplicateComponents, string sw360URL)
207+
{
208+
if (duplicateComponents.Count > 0)
209+
{
210+
Logger.Logger.Log(null, Level.Alert, "* List of components or releases not created in SW360 due to Invalid Purl ids found in Components ExternalID field in sw360", null);
211+
Logger.Logger.Log(null, Level.Alert, " Component Name already exists in SW360 with a different package type PurlId. Manually update the component details.", null);
212+
213+
const int nameWidth = 45;
214+
const int versionWidth = 25;
215+
const int urlWidth = 120;
216+
const int totalWidth = nameWidth + versionWidth + urlWidth + 10;
203217

218+
string border = new string('=', totalWidth);
219+
string separator = new string('-', totalWidth);
220+
221+
Logger.Logger.Log(null, Level.Alert, border, null);
222+
Logger.Logger.Log(null, Level.Alert, string.Format("| {0,-45} | {1,-25} | {2,-120} |", "Name", "Version", "SW360 Component URL"), null);
223+
Logger.Logger.Log(null, Level.Alert, border, null);
224+
225+
foreach (var item in duplicateComponents)
226+
{
227+
string link = Sw360ComponentURL(sw360URL, item.ComponentId);
228+
Logger.Logger.Log(null, Level.Alert, string.Format("| {0,-45} | {1,-25} | {2,-120} |", item.Name, item.Version, link), null);
229+
Logger.Logger.Log(null, Level.Alert, separator, null);
230+
}
231+
232+
Logger.Info("\n");
233+
}
234+
}
204235
public static void WriteComponentsNotLinkedListInConsole(List<Components> components)
205236
{
206237
const string Name = "Name";
@@ -565,6 +596,11 @@ private static string Sw360URL(string sw360Env, string releaseId)
565596
string sw360URL = $"{sw360Env}{"/group/guest/components/-/component/release/detailRelease/"}{releaseId}";
566597
return sw360URL;
567598
}
599+
private static string Sw360ComponentURL(string sw360Env, string componentId)
600+
{
601+
string sw360URL = $"{sw360Env}{"/group/guest/components/-/component/detail/"}{componentId}";
602+
return sw360URL;
603+
}
568604

569605
private static void AddExcludedComponentsPropertyFromPurl(List<Component> ComponentList, List<string> ExcludedComponentsFromPurl, ref int noOfExcludedComponents)
570606
{

src/LCT.Common/LCT.Common.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<OutputType>Library</OutputType>
55
<TargetFramework>net8.0</TargetFramework>
6-
<Version>8.2.0</Version>
6+
<Version>8.2.1</Version>
77
</PropertyGroup>
88

99
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

src/LCT.Common/Model/Components.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ public class Components
6565
public string ExcludeComponent { get; set; }
6666
[JsonIgnore]
6767
public string ReleaseCreatedBy { get; set; }
68+
[JsonIgnore]
69+
public bool InvalidComponentByPurlId { get; set; }=false;
70+
[JsonIgnore]
71+
public string ComponentLink { get; set; }
72+
[JsonIgnore]
73+
public string ComponentId { get; set; }
6874

6975
}
7076
}

src/LCT.CycloneDxProcessor/LCT.CycloneDxProcessor.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
5-
<Version>8.2.0</Version>
5+
<Version>8.2.1</Version>
66
</PropertyGroup>
77

88
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">

src/LCT.Facade/LCT.Facade.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
5-
<Version>8.2.0</Version>
5+
<Version>8.2.1</Version>
66
</PropertyGroup>
77

88
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">

0 commit comments

Comments
 (0)