From 0fcdc7057b2e536a118e4061cc816ac0de0818b7 Mon Sep 17 00:00:00 2001 From: Rolf Kristensen Date: Mon, 29 Jan 2024 20:48:23 +0100 Subject: [PATCH 1/7] Updated NLog.Targets.Stackify to NLog v4.7.15 --- .gitignore | 3 +- .../NLog.Targets.Stackify.csproj | 4 +- Src/NLog.Targets.Stackify/StackifyTarget.cs | 2 +- .../NLog.Web.Stackify.csproj | 14 +- samples/CoreWebApp/nlogfile.txt | 212 ------------------ 5 files changed, 12 insertions(+), 223 deletions(-) delete mode 100644 samples/CoreWebApp/nlogfile.txt diff --git a/.gitignore b/.gitignore index 37e506f..965513a 100644 --- a/.gitignore +++ b/.gitignore @@ -31,4 +31,5 @@ packages/ **/obj/* BuildOutput/ *.pfx -*.snk \ No newline at end of file +*.snk +/.vs \ No newline at end of file diff --git a/Src/NLog.Targets.Stackify/NLog.Targets.Stackify.csproj b/Src/NLog.Targets.Stackify/NLog.Targets.Stackify.csproj index d6ee117..cc73d47 100644 --- a/Src/NLog.Targets.Stackify/NLog.Targets.Stackify.csproj +++ b/Src/NLog.Targets.Stackify/NLog.Targets.Stackify.csproj @@ -15,7 +15,7 @@ false false false - 2.1.8-beta + 2.2.13 https://github.com/stackify/stackify-api-dotnet/blob/master/LICENSE https://github.com/stackify/stackify-api-dotnet https://stackify.com/wp-content/uploads/2017/02/stk.png @@ -26,7 +26,7 @@ - + diff --git a/Src/NLog.Targets.Stackify/StackifyTarget.cs b/Src/NLog.Targets.Stackify/StackifyTarget.cs index 2b6efa3..a87fcb5 100644 --- a/Src/NLog.Targets.Stackify/StackifyTarget.cs +++ b/Src/NLog.Targets.Stackify/StackifyTarget.cs @@ -133,7 +133,7 @@ protected override void Write(AsyncLogEventInfo logEvent) } catch (Exception ex) { - InternalLogger.Error("StackifyTarget: Failed to send"); + InternalLogger.Error(ex, "StackifyTarget: Failed to send"); logEvent.Continuation(ex); // Signal failure to NLog StackifyAPILogger.Log(ex.ToString()); } diff --git a/Src/NLog.Web.Stackify/NLog.Web.Stackify.csproj b/Src/NLog.Web.Stackify/NLog.Web.Stackify.csproj index a8f7062..5a8f29b 100644 --- a/Src/NLog.Web.Stackify/NLog.Web.Stackify.csproj +++ b/Src/NLog.Web.Stackify/NLog.Web.Stackify.csproj @@ -15,7 +15,7 @@ false false false - 2.1.1 + 2.2.13 https://github.com/stackify/stackify-api-dotnet/blob/master/LICENSE https://github.com/stackify/stackify-api-dotnet https://stackify.com/wp-content/uploads/2017/02/stk.png @@ -25,13 +25,13 @@ - + - - + + NETCORE - + NETFULL @@ -40,10 +40,10 @@ - + - + diff --git a/samples/CoreWebApp/nlogfile.txt b/samples/CoreWebApp/nlogfile.txt deleted file mode 100644 index 61ab140..0000000 --- a/samples/CoreWebApp/nlogfile.txt +++ /dev/null @@ -1,212 +0,0 @@ -2017-02-14 19:10:27.2426|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:10:28.6468|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:10:29.5559|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:11:16.8566|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:11:18.0675|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:11:18.5775|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:11:18.9914|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:11:33.6552|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:11:34.1401|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:11:34.5777|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:12:40.4808|DEBUG|Microsoft.AspNetCore.Hosting.Internal.WebHost|Hosting starting -2017-02-14 19:12:40.8980|DEBUG|Microsoft.AspNetCore.Hosting.Internal.WebHost|Hosting started -2017-02-14 19:12:41.1380|DEBUG|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HL2L7UUIO3VF" started. -2017-02-14 19:12:41.1380|DEBUG|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HL2L7UUIO3VE" started. -2017-02-14 19:12:41.4458|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request starting HTTP/1.1 GET http://localhost:15950/api/values -2017-02-14 19:12:41.4458|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request starting HTTP/1.1 DEBUG http://localhost:15950/ 0 -2017-02-14 19:12:41.6906|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request finished in 285.3018ms 200 -2017-02-14 19:12:41.8560|DEBUG|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HL2L7UUIO3VF" completed keep alive response. -2017-02-14 19:12:42.0491|DEBUG|Microsoft.AspNetCore.Routing.Tree.TreeRouter|Request successfully matched the route with name '' and template 'api/Values'. -2017-02-14 19:12:42.0832|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ActionSelector|Action 'CoreWebApp.Controllers.ValuesController.Post (CoreWebApp)' with id 'db673db1-f2ee-4038-b084-9a7d765e3e14' did not match the constraint 'Microsoft.AspNetCore.Mvc.Internal.HttpMethodActionConstraint' -2017-02-14 19:12:42.1198|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) -2017-02-14 19:12:42.2145|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) with arguments () - ModelState is Valid -2017-02-14 19:12:42.2145|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:12:42.2300|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp), returned result Microsoft.AspNetCore.Mvc.ObjectResult. -2017-02-14 19:12:42.2712|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|No information found on request to perform content negotiation. -2017-02-14 19:12:42.2837|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter' and content type 'application/json' to write the response. -2017-02-14 19:12:42.2935|INFO|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. -2017-02-14 19:12:42.4805|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) in 347.1495ms -2017-02-14 19:12:42.4951|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request finished in 1111.4673ms 200 application/json; charset=utf-8 -2017-02-14 19:12:42.5066|DEBUG|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HL2L7UUIO3VE" completed keep alive response. -2017-02-14 19:12:43.7480|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request starting HTTP/1.1 GET http://localhost:15950/api/values -2017-02-14 19:12:43.7695|DEBUG|Microsoft.AspNetCore.Routing.Tree.TreeRouter|Request successfully matched the route with name '' and template 'api/Values'. -2017-02-14 19:12:43.7966|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ActionSelector|Action 'CoreWebApp.Controllers.ValuesController.Post (CoreWebApp)' with id 'db673db1-f2ee-4038-b084-9a7d765e3e14' did not match the constraint 'Microsoft.AspNetCore.Mvc.Internal.HttpMethodActionConstraint' -2017-02-14 19:12:43.8096|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) -2017-02-14 19:12:43.8252|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) with arguments () - ModelState is Valid -2017-02-14 19:12:43.8397|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:12:43.8508|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp), returned result Microsoft.AspNetCore.Mvc.ObjectResult. -2017-02-14 19:12:43.8658|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|No information found on request to perform content negotiation. -2017-02-14 19:12:43.8658|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter' and content type 'application/json' to write the response. -2017-02-14 19:12:43.8909|INFO|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. -2017-02-14 19:12:43.9024|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) in 77.5067ms -2017-02-14 19:12:43.9204|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request finished in 178.623ms 200 application/json; charset=utf-8 -2017-02-14 19:12:43.9380|DEBUG|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HL2L7UUIO3VF" completed keep alive response. -2017-02-14 19:12:44.4390|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request starting HTTP/1.1 GET http://localhost:15950/api/values -2017-02-14 19:12:44.4746|DEBUG|Microsoft.AspNetCore.Routing.Tree.TreeRouter|Request successfully matched the route with name '' and template 'api/Values'. -2017-02-14 19:12:44.4942|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ActionSelector|Action 'CoreWebApp.Controllers.ValuesController.Post (CoreWebApp)' with id 'db673db1-f2ee-4038-b084-9a7d765e3e14' did not match the constraint 'Microsoft.AspNetCore.Mvc.Internal.HttpMethodActionConstraint' -2017-02-14 19:12:44.5142|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) -2017-02-14 19:12:44.5343|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) with arguments () - ModelState is Valid -2017-02-14 19:12:44.5538|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:12:44.5714|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp), returned result Microsoft.AspNetCore.Mvc.ObjectResult. -2017-02-14 19:12:44.5889|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|No information found on request to perform content negotiation. -2017-02-14 19:12:44.6055|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter' and content type 'application/json' to write the response. -2017-02-14 19:12:44.6265|INFO|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. -2017-02-14 19:12:44.6471|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) in 112.8046ms -2017-02-14 19:12:44.6631|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request finished in 226.7328ms 200 application/json; charset=utf-8 -2017-02-14 19:12:44.6777|DEBUG|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HL2L7UUIO3VE" completed keep alive response. -2017-02-14 19:16:43.0726|DEBUG|Microsoft.AspNetCore.Hosting.Internal.WebHost|Hosting starting -2017-02-14 19:16:43.6079|DEBUG|Microsoft.AspNetCore.Hosting.Internal.WebHost|Hosting started -2017-02-14 19:16:43.8644|DEBUG|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HL2L816TILCN" started. -2017-02-14 19:16:43.8650|DEBUG|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HL2L816TILCO" started. -2017-02-14 19:16:44.2579|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request starting HTTP/1.1 GET http://localhost:15950/api/values -2017-02-14 19:16:44.2579|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request starting HTTP/1.1 DEBUG http://localhost:15950/ 0 -2017-02-14 19:16:44.5202|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request finished in 300.844ms 200 -2017-02-14 19:16:44.7382|DEBUG|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HL2L816TILCO" completed keep alive response. -2017-02-14 19:16:44.9508|DEBUG|Microsoft.AspNetCore.Routing.Tree.TreeRouter|Request successfully matched the route with name '' and template 'api/Values'. -2017-02-14 19:16:44.9864|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ActionSelector|Action 'CoreWebApp.Controllers.ValuesController.Post (CoreWebApp)' with id '845869a3-f12b-473d-b4b3-a7b6b9927275' did not match the constraint 'Microsoft.AspNetCore.Mvc.Internal.HttpMethodActionConstraint' -2017-02-14 19:16:45.0275|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) -2017-02-14 19:16:45.1403|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) with arguments () - ModelState is Valid -2017-02-14 19:16:45.1503|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:16:45.1503|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp), returned result Microsoft.AspNetCore.Mvc.ObjectResult. -2017-02-14 19:16:45.2020|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|No information found on request to perform content negotiation. -2017-02-14 19:16:45.2185|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter' and content type 'application/json' to write the response. -2017-02-14 19:16:45.2315|INFO|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. -2017-02-14 19:16:45.3633|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) in 319.3589ms -2017-02-14 19:16:45.3784|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request finished in 1181.9364ms 200 application/json; charset=utf-8 -2017-02-14 19:16:45.3914|DEBUG|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HL2L816TILCN" completed keep alive response. -2017-02-14 19:16:46.8607|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request starting HTTP/1.1 GET http://localhost:15950/api/values -2017-02-14 19:16:46.8878|DEBUG|Microsoft.AspNetCore.Routing.Tree.TreeRouter|Request successfully matched the route with name '' and template 'api/Values'. -2017-02-14 19:16:46.9173|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ActionSelector|Action 'CoreWebApp.Controllers.ValuesController.Post (CoreWebApp)' with id '845869a3-f12b-473d-b4b3-a7b6b9927275' did not match the constraint 'Microsoft.AspNetCore.Mvc.Internal.HttpMethodActionConstraint' -2017-02-14 19:16:46.9419|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) -2017-02-14 19:16:46.9760|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) with arguments () - ModelState is Valid -2017-02-14 19:16:47.0066|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:16:47.0777|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp), returned result Microsoft.AspNetCore.Mvc.ObjectResult. -2017-02-14 19:16:47.1037|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|No information found on request to perform content negotiation. -2017-02-14 19:16:47.1313|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter' and content type 'application/json' to write the response. -2017-02-14 19:16:47.1699|INFO|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. -2017-02-14 19:16:47.2035|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) in 229.7681ms -2017-02-14 19:16:47.2346|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request finished in 376.9427ms 200 application/json; charset=utf-8 -2017-02-14 19:16:47.2516|DEBUG|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HL2L816TILCO" completed keep alive response. -2017-02-14 19:16:47.5229|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request starting HTTP/1.1 GET http://localhost:15950/api/values -2017-02-14 19:16:47.5389|DEBUG|Microsoft.AspNetCore.Routing.Tree.TreeRouter|Request successfully matched the route with name '' and template 'api/Values'. -2017-02-14 19:16:47.5389|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ActionSelector|Action 'CoreWebApp.Controllers.ValuesController.Post (CoreWebApp)' with id '845869a3-f12b-473d-b4b3-a7b6b9927275' did not match the constraint 'Microsoft.AspNetCore.Mvc.Internal.HttpMethodActionConstraint' -2017-02-14 19:16:47.5640|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) -2017-02-14 19:16:47.5795|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) with arguments () - ModelState is Valid -2017-02-14 19:16:47.5900|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:16:47.5998|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp), returned result Microsoft.AspNetCore.Mvc.ObjectResult. -2017-02-14 19:16:47.5998|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|No information found on request to perform content negotiation. -2017-02-14 19:16:47.6214|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter' and content type 'application/json' to write the response. -2017-02-14 19:16:47.6328|INFO|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. -2017-02-14 19:16:47.6328|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) in 65.9748ms -2017-02-14 19:16:47.6584|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request finished in 135.6668ms 200 application/json; charset=utf-8 -2017-02-14 19:16:47.6720|DEBUG|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HL2L816TILCN" completed keep alive response. -2017-02-14 19:16:47.8931|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request starting HTTP/1.1 GET http://localhost:15950/api/values -2017-02-14 19:16:47.9056|DEBUG|Microsoft.AspNetCore.Routing.Tree.TreeRouter|Request successfully matched the route with name '' and template 'api/Values'. -2017-02-14 19:16:47.9202|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ActionSelector|Action 'CoreWebApp.Controllers.ValuesController.Post (CoreWebApp)' with id '845869a3-f12b-473d-b4b3-a7b6b9927275' did not match the constraint 'Microsoft.AspNetCore.Mvc.Internal.HttpMethodActionConstraint' -2017-02-14 19:16:47.9337|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) -2017-02-14 19:16:47.9503|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) with arguments () - ModelState is Valid -2017-02-14 19:16:47.9603|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:16:47.9603|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp), returned result Microsoft.AspNetCore.Mvc.ObjectResult. -2017-02-14 19:16:47.9798|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|No information found on request to perform content negotiation. -2017-02-14 19:16:47.9798|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter' and content type 'application/json' to write the response. -2017-02-14 19:16:48.0016|INFO|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. -2017-02-14 19:16:48.0156|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) in 64.3705ms -2017-02-14 19:16:48.0653|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request finished in 155.316ms 200 application/json; charset=utf-8 -2017-02-14 19:16:48.0853|DEBUG|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HL2L816TILCO" completed keep alive response. -2017-02-14 19:18:18.0424|DEBUG|Microsoft.AspNetCore.Hosting.Internal.WebHost|Hosting starting -2017-02-14 19:18:18.4005|DEBUG|Microsoft.AspNetCore.Hosting.Internal.WebHost|Hosting started -2017-02-14 19:18:18.4806|DEBUG|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HL2L8233VVDJ" started. -2017-02-14 19:18:18.4806|DEBUG|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HL2L8233VVDI" started. -2017-02-14 19:18:18.6706|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request starting HTTP/1.1 GET http://localhost:15950/api/values -2017-02-14 19:18:18.6706|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request starting HTTP/1.1 DEBUG http://localhost:15950/ 0 -2017-02-14 19:18:18.9117|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request finished in 291.4936ms 200 -2017-02-14 19:18:19.0170|DEBUG|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HL2L8233VVDI" completed keep alive response. -2017-02-14 19:18:19.2145|DEBUG|Microsoft.AspNetCore.Routing.Tree.TreeRouter|Request successfully matched the route with name '' and template 'api/Values'. -2017-02-14 19:18:19.2597|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ActionSelector|Action 'CoreWebApp.Controllers.ValuesController.Post (CoreWebApp)' with id '001b3cf6-6196-4cbc-ba9c-884c28540321' did not match the constraint 'Microsoft.AspNetCore.Mvc.Internal.HttpMethodActionConstraint' -2017-02-14 19:18:19.3028|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) -2017-02-14 19:18:19.4035|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) with arguments () - ModelState is Valid -2017-02-14 19:18:19.4131|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:18:19.4131|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp), returned result Microsoft.AspNetCore.Mvc.ObjectResult. -2017-02-14 19:18:19.5038|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|No information found on request to perform content negotiation. -2017-02-14 19:18:19.5219|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter' and content type 'application/json' to write the response. -2017-02-14 19:18:19.5219|INFO|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. -2017-02-14 19:18:19.6958|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) in 380.2094ms -2017-02-14 19:18:19.7159|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request finished in 1104.1954ms 200 application/json; charset=utf-8 -2017-02-14 19:18:19.7314|DEBUG|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HL2L8233VVDJ" completed keep alive response. -2017-02-14 19:18:24.1854|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request starting HTTP/1.1 GET http://localhost:15950/api/values -2017-02-14 19:18:24.1959|DEBUG|Microsoft.AspNetCore.Routing.Tree.TreeRouter|Request successfully matched the route with name '' and template 'api/Values'. -2017-02-14 19:18:24.1959|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ActionSelector|Action 'CoreWebApp.Controllers.ValuesController.Post (CoreWebApp)' with id '001b3cf6-6196-4cbc-ba9c-884c28540321' did not match the constraint 'Microsoft.AspNetCore.Mvc.Internal.HttpMethodActionConstraint' -2017-02-14 19:18:24.2155|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) -2017-02-14 19:18:24.2285|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) with arguments () - ModelState is Valid -2017-02-14 19:18:24.2285|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:18:24.2456|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp), returned result Microsoft.AspNetCore.Mvc.ObjectResult. -2017-02-14 19:18:24.2456|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|No information found on request to perform content negotiation. -2017-02-14 19:18:24.2642|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter' and content type 'application/json' to write the response. -2017-02-14 19:18:24.2752|INFO|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. -2017-02-14 19:18:24.2752|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) in 59.1742ms -2017-02-14 19:18:24.3008|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request finished in 116.0666ms 200 application/json; charset=utf-8 -2017-02-14 19:18:24.3138|DEBUG|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HL2L8233VVDI" completed keep alive response. -2017-02-14 19:18:25.0001|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request starting HTTP/1.1 GET http://localhost:15950/api/values -2017-02-14 19:18:25.0157|DEBUG|Microsoft.AspNetCore.Routing.Tree.TreeRouter|Request successfully matched the route with name '' and template 'api/Values'. -2017-02-14 19:18:25.0242|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request starting HTTP/1.1 GET http://localhost:15950/api/values -2017-02-14 19:18:25.0242|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ActionSelector|Action 'CoreWebApp.Controllers.ValuesController.Post (CoreWebApp)' with id '001b3cf6-6196-4cbc-ba9c-884c28540321' did not match the constraint 'Microsoft.AspNetCore.Mvc.Internal.HttpMethodActionConstraint' -2017-02-14 19:18:25.0402|DEBUG|Microsoft.AspNetCore.Routing.Tree.TreeRouter|Request successfully matched the route with name '' and template 'api/Values'. -2017-02-14 19:18:25.0718|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) -2017-02-14 19:18:25.1009|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ActionSelector|Action 'CoreWebApp.Controllers.ValuesController.Post (CoreWebApp)' with id '001b3cf6-6196-4cbc-ba9c-884c28540321' did not match the constraint 'Microsoft.AspNetCore.Mvc.Internal.HttpMethodActionConstraint' -2017-02-14 19:18:25.1525|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) with arguments () - ModelState is Valid -2017-02-14 19:18:25.1525|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) -2017-02-14 19:18:25.1906|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:18:25.2423|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executing action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) with arguments () - ModelState is Valid -2017-02-14 19:18:25.2423|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp), returned result Microsoft.AspNetCore.Mvc.ObjectResult. -2017-02-14 19:18:25.2799|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:18:25.2879|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|No information found on request to perform content negotiation. -2017-02-14 19:18:25.3180|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action method CoreWebApp.Controllers.ValuesController.Get (CoreWebApp), returned result Microsoft.AspNetCore.Mvc.ObjectResult. -2017-02-14 19:18:25.3591|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|No information found on request to perform content negotiation. -2017-02-14 19:18:25.3711|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter' and content type 'application/json' to write the response. -2017-02-14 19:18:25.3812|INFO|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. -2017-02-14 19:18:25.3812|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) in 172.4127ms -2017-02-14 19:18:25.4127|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request finished in 388.6155ms 200 application/json; charset=utf-8 -2017-02-14 19:18:25.4338|DEBUG|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HL2L8233VVDI" completed keep alive response. -2017-02-14 19:18:25.3480|DEBUG|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Selected output formatter 'Microsoft.AspNetCore.Mvc.Formatters.JsonOutputFormatter' and content type 'application/json' to write the response. -2017-02-14 19:18:25.4889|INFO|Microsoft.AspNetCore.Mvc.Internal.ObjectResultExecutor|Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. -2017-02-14 19:18:25.5100|INFO|Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker|Executed action CoreWebApp.Controllers.ValuesController.Get (CoreWebApp) in 375.1392ms -2017-02-14 19:18:25.5335|INFO|Microsoft.AspNetCore.Hosting.Internal.WebHost|Request finished in 529.1203ms 200 application/json; charset=utf-8 -2017-02-14 19:18:25.5521|DEBUG|Microsoft.AspNetCore.Server.Kestrel|Connection id "0HL2L8233VVDJ" completed keep alive response. -2017-02-14 19:20:39.2464|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:20:49.4227|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:20:50.1617|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:20:50.5894|DEBUG|ValuesController|Callng Get() method -2017-02-14 19:20:50.9087|DEBUG|ValuesController|Callng Get() method -2017-02-14 20:01:45.9326|DEBUG|ValuesController|Callng Get() method -2017-02-14 20:02:28.1534|DEBUG|ValuesController|Callng Get() method -2017-02-14 20:02:28.8913|DEBUG|ValuesController|Callng Get() method -2017-02-14 20:03:36.3833|DEBUG|ValuesController|Callng Get() method -2017-02-14 20:03:40.6129|DEBUG|ValuesController|Callng Get() method -2017-02-14 20:03:41.0130|DEBUG|ValuesController|Callng Get() method -2017-02-14 20:04:19.8492|DEBUG|ValuesController|Callng Get() method -2017-02-14 20:05:46.5731|DEBUG|ValuesController|Callng Get() method -2017-02-14 21:35:40.1414|DEBUG|ValuesController|Callng Get() method -2017-02-14 21:37:59.5302|DEBUG|ValuesController|Callng Get() method -2017-02-14 21:38:16.5503|DEBUG|ValuesController|Callng Get() method -2017-02-14 21:38:17.4209|DEBUG|ValuesController|Callng Get() method -2017-02-14 21:38:17.4400|DEBUG|ValuesController|Callng Get() method -2017-02-14 21:38:18.0443|DEBUG|ValuesController|Callng Get() method -2017-02-14 21:38:18.5482|DEBUG|ValuesController|Callng Get() method -2017-02-14 21:39:51.4633|DEBUG|ValuesController|Callng Get() method -2017-02-14 21:40:02.8485|DEBUG|ValuesController|Callng Get() method -2017-02-14 21:40:04.7519|DEBUG|ValuesController|Callng Get() method -2017-02-15 08:29:33.4821|DEBUG|ValuesController|Callng Get() method -2017-02-15 16:02:11.2320|DEBUG|ValuesController|Callng Get() method -2017-02-15 16:02:11.3949|ERROR|ValuesController|Uh oh -2017-02-15 16:02:46.9521|DEBUG|ValuesController|Callng Get() method -2017-02-15 16:02:46.9942|ERROR|ValuesController|Uh oh -2017-02-15 16:02:48.7150|DEBUG|ValuesController|Callng Get() method -2017-02-15 16:02:48.7481|ERROR|ValuesController|Uh oh -2017-02-15 16:02:49.3059|DEBUG|ValuesController|Callng Get() method -2017-02-15 16:02:49.3361|ERROR|ValuesController|Uh oh -2017-02-15 16:02:49.8610|DEBUG|ValuesController|Callng Get() method -2017-02-15 16:02:49.8945|ERROR|ValuesController|Uh oh -2017-02-15 16:04:05.9321|DEBUG|ValuesController|Callng Get() method -2017-02-15 16:07:49.4301|DEBUG|ValuesController|Callng Get() method -2017-02-15 16:12:20.1176|DEBUG|ValuesController|Callng Get() method -2017-02-15 16:19:10.1003|DEBUG|ValuesController|Callng Get() method From 578d726d0c8c92e5732beb825262f4cc42cbd41f Mon Sep 17 00:00:00 2001 From: Michael Mantos Date: Wed, 31 Jan 2024 13:54:37 +0800 Subject: [PATCH 2/7] Update NLog.Targets.Stackify and NLog.Web.Stackify version and dependency --- .../NLog.Targets.Stackify.csproj | 9 +- .../NLog.Web.Stackify.csproj | 4 +- azure-pipelines.yml | 419 ++++++++++-------- templates/build-and-pack.yml | 25 ++ 4 files changed, 274 insertions(+), 183 deletions(-) create mode 100644 templates/build-and-pack.yml diff --git a/Src/NLog.Targets.Stackify/NLog.Targets.Stackify.csproj b/Src/NLog.Targets.Stackify/NLog.Targets.Stackify.csproj index cc73d47..742c498 100644 --- a/Src/NLog.Targets.Stackify/NLog.Targets.Stackify.csproj +++ b/Src/NLog.Targets.Stackify/NLog.Targets.Stackify.csproj @@ -15,7 +15,7 @@ false false false - 2.2.13 + 2.2.0-beta1 https://github.com/stackify/stackify-api-dotnet/blob/master/LICENSE https://github.com/stackify/stackify-api-dotnet https://stackify.com/wp-content/uploads/2017/02/stk.png @@ -23,12 +23,12 @@ git true - + - + - + NETCORE @@ -36,5 +36,4 @@ NETFULL - diff --git a/Src/NLog.Web.Stackify/NLog.Web.Stackify.csproj b/Src/NLog.Web.Stackify/NLog.Web.Stackify.csproj index 5a8f29b..3847e4b 100644 --- a/Src/NLog.Web.Stackify/NLog.Web.Stackify.csproj +++ b/Src/NLog.Web.Stackify/NLog.Web.Stackify.csproj @@ -15,7 +15,7 @@ false false false - 2.2.13 + 2.2.0-beta1 https://github.com/stackify/stackify-api-dotnet/blob/master/LICENSE https://github.com/stackify/stackify-api-dotnet https://stackify.com/wp-content/uploads/2017/02/stk.png @@ -24,7 +24,7 @@ - + diff --git a/azure-pipelines.yml b/azure-pipelines.yml index be91e43..94901f7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -4,13 +4,39 @@ trigger: - develop schedules: - - cron: "0 21-22 31 * *" + - cron: '0 21-22 31 * *' displayName: Monthly build branches: include: - develop always: true +parameters: +- name: 'Build StackifyLib' + type: boolean + default: true +- name: 'Build StackifyLib Signed' + type: boolean + default: true +- name: 'Build StackifyLib.AspNetCore' + type: boolean + default: true +- name: 'Build StackifyLib.CoreLogger' + type: boolean + default: true +- name: 'Build StackifyLib.log4net' + type: boolean + default: true +- name: 'Build Nlog.Targets.Stackify' + type: boolean + default: true +- name: 'Build NLog.Web.Stackify' + type: boolean + default: true +- name: 'Build StackifyLib.StackifyTraceListener' + type: boolean + default: true + pool: name: win2016-vs2017 # name: Azure Pipelines @@ -27,180 +53,221 @@ parameters: variables: - group: code-signing -steps: - - checkout: self - clean: true - lfs: true - - task: AzureKeyVault@2 - displayName: 'Azure Key Vault: keyvault-build-resources' - inputs: - ConnectedServiceName: 514ed7d6-3846-4422-8013-af27483dd22c - KeyVaultName: keyvault-build-resources - RunAsPreJob: true - - task: PowerShell@2 - displayName: 'Veracode SCA Scan' - condition: and(succeeded(), eq('${{ parameters.RUN_VERACODE_SCA }}', 'true')) - inputs: - targetType: inline - script: > - $Env:SRCCLR_API_TOKEN="$(SRCCLR_API_TOKEN)"; Set-ExecutionPolicy AllSigned -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://download.sourceclear.com/ci.ps1')); srcclr scan .\Src\StackifyLib; - - task: DownloadSecureFile@1 - name: SNK - displayName: Download Strong Name Key - inputs: - secureFile: 9d810a2d-d090-431c-9012-df939a4b1afe - - task: PowerShell@2 - displayName: Move Signing Key To Project Directory - inputs: - targetType: inline - filePath: Src/StackifyLib - script: | - # Write your PowerShell commands here. - ls - Move-Item $(SNK.secureFilePath) Src/StackifyLib/Netreo.snk - - task: PowerShell@2 - displayName: Update csproj for .snk - inputs: - targetType: inline - script: > - (Get-Content -path Src\StackifyLib\StackifyLib.csproj -Raw) -replace 'StackifyLib','StackifyLib.signed' | Set-Content -Path Src\StackifyLib\StackifyLib.csproj -Encoding utf8 - - # note: the signing attribute here is commented out so we can build locally - - powershell: | - $filename = Get-ChildItem ".\src\*\AssemblyInfo.cs" -Recurse - $filename | %{ - (gc $_) -replace ([regex]::Escape("//[assembly: AssemblyKeyFile")), "[assembly: AssemblyKeyFile" | Set-Content $_.FullName -Encoding utf8 - } - displayName: Uncoment signing attribute - - - task: DotNetCoreCLI@2 - displayName: dotnet restore - inputs: - command: restore - restoreArguments: .\Src - - task: DotNetCoreCLI@2 - displayName: dotnet build - inputs: - projects: | - Src\StackifyLib\*.csproj - Src\StackifyLib.AspNetCore\*.csproj - Src\StackifyLib.CoreLogger\*.csproj - Src\StackifyLib.log4net\*.csproj - Src\Nlog.Targets.Stackify\*.csproj - Src\NLog.Web.Stackify\*.csproj - Src\StackifyLib.StackifyTraceListener\*.csproj - arguments: '-c $(BuildConfiguration)' - - task: DotNetCoreCLI@2 - displayName: dotnet pack signed stackify lib - inputs: - command: pack - searchPatternPack: Src\StackifyLib\*.csproj; - nobuild: true - - task: DotNetCoreCLI@2 - continueOnError: true - inputs: - command: 'custom' - custom: 'tool' - arguments: 'install --global NuGetKeyVaultSignTool' - displayName: Install NuGetKeyVaultSignTool - - task: CmdLine@2 - displayName: 'Sign nuget package' - inputs: - script: NuGetKeyVaultSignTool sign $(Build.ArtifactStagingDirectory)\StackifyLib.signed.*.nupkg -kvu "$(SigningVaultURL)" -kvi "$(SigningAppClientId)" -kvt "$(SigningAppTenantId)" -kvs "$(SigningClientSecret)" -kvc "$(SigningCertName)" -tr http://timestamp.digicert.com - workingDirectory: $(Build.SourcesDirectory) - - task: PowerShell@2 - displayName: Rename signed assemblies - enabled: False - inputs: - targetType: inline - script: "$files = @(Get-ChildItem -Path . -File -Filter *.nupkg)\n\nforeach($file in $files) {\n $BaseFilename = $file.BaseName\n $BaseFilenameSplit = $file.BaseName.Split(\".\")\n $LastVersionDigit = \"\"\n $NewFilenameBase = \"\"\n $PackageVersion = \"\"\n $IsBeta = \"False\"\n if ($BaseFilename.contains(\"beta\")) {\n $IsBeta = \"True\"\n $LastVersionDigit = $file.BaseName.Substring($BaseFilename.length - 6,1)\n }\n else {\n $LastVersionDigit = $file.BaseName.Substring($BaseFilename.length - 1)\n }\n foreach($namePart in $BaseFilenameSplit) {\n if (!$namePart.contains(\"beta\") -and $namePart -notmatch \"^\\d+$\") {\n $NewFilenameBase = $NewFilenameBase + $namePart + \".\"\n } else {\n # check for beta\n if ($namePart.contains(\"beta\")) {\n $PackageVersion = $PackageVersion + $namePart.Substring(0,1)\n } else {\n $PackageVersion = $PackageVersion + $namePart\n }\n # check length to append a .\n if ($namePart -notmatch $LastVersionDigit) {\n $PackageVersion = $PackageVersion + \".\"\n }\n }\n }\n \n # check beta\n $FinalFilenameBase = \"\"\n if ($IsBeta -match \"True\") {\n $FinalFilenameBase = $NewFilenameBase + \"snk.\" + $PackageVersion + \"-beta\"\n } else {\n $FinalFilenameBase = $NewFilenameBase + \"snk.\" + $PackageVersion\n }\n $FinalFilename = $FinalFilenameBase + $file.Extension\n Rename-Item -Path $file -NewName $FinalFilename\n}" - workingDirectory: $(Build.ArtifactStagingDirectory) - - task: PublishPipelineArtifact@1 - displayName: Publish Pipeline Artifact - inputs: - path: $(Build.ArtifactStagingDirectory) - artifactName: Signed NuGet Packages - - task: PowerShell@2 - displayName: Delete signed assemblies - enabled: true - inputs: - targetType: inline - script: > - Remove-Item *.signed*.nupkg - workingDirectory: $(Build.ArtifactStagingDirectory) - - task: PowerShell@2 - displayName: Remove Sign Code - enabled: false - inputs: - targetType: filePath - arguments: '' - filePath: Scripts/RemoveSignCode.ps1 - workingDirectory: $(Build.SourcesDirectory) - - task: PowerShell@2 - displayName: Remove Sign Code Inline - inputs: - targetType: 'inline' - script: | - function Remove-SignCode { - param ( - $ASMFile - ) - Set-Content -Path $ASMFile -Value (Get-Content -Path $ASMFile | Select-String -Pattern AssemblyKeyFileAttribute -NotMatch ) +jobs: + - job: Checkout repo + steps: + - checkout: self + clean: true + lfs: true + - job: Setup Prerequisites + steps: + - task: AzureKeyVault@2 + displayName: 'Azure Key Vault: keyvault-build-resources' + inputs: + ConnectedServiceName: 514ed7d6-3846-4422-8013-af27483dd22c + KeyVaultName: keyvault-build-resources + RunAsPreJob: true + - task: PowerShell@2 + displayName: 'Veracode SCA Scan' + condition: and(succeeded(), eq('${{ parameters.RUN_VERACODE_SCA }}', 'true')) + inputs: + targetType: inline + script: > + $Env:SRCCLR_API_TOKEN="$(SRCCLR_API_TOKEN)"; Set-ExecutionPolicy AllSigned -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://download.sourceclear.com/ci.ps1')); srcclr scan .\Src\StackifyLib; + - job: Prepare StackifyLib Signing + condition: and(succeeded(), eq(parameters['Build StackifyLib Signed'], true)) + steps: + - task: DownloadSecureFile@1 + name: SNK + displayName: Download Strong Name Key + inputs: + secureFile: 9d810a2d-d090-431c-9012-df939a4b1afe + - task: PowerShell@2 + displayName: Move Signing Key To Project Directory + inputs: + targetType: inline + filePath: Src/StackifyLib + script: | + # Write your PowerShell commands here. + ls + Move-Item $(SNK.secureFilePath) Src/StackifyLib/Netreo.snk + - task: PowerShell@2 + displayName: Update csproj for .snk + inputs: + targetType: inline + script: > + (Get-Content -path Src\StackifyLib\StackifyLib.csproj -Raw) -replace 'StackifyLib','StackifyLib.signed' | Set-Content -Path Src\StackifyLib\StackifyLib.csproj -Encoding utf8 + # note: the signing attribute here is commented out so we can build locally + - powershell: | + $filename = Get-ChildItem ".\src\*\AssemblyInfo.cs" -Recurse + $filename | %{ + (gc $_) -replace ([regex]::Escape("//[assembly: AssemblyKeyFile")), "[assembly: AssemblyKeyFile" | Set-Content $_.FullName -Encoding utf8 } - - $files = @(Get-ChildItem -Path . -Directory -Filter Stackify*) - - foreach ($file in $files) { - $asmInfo = Get-ChildItem -Path $file/Properties/AssemblyInfo.cs - Remove-SignCode -ASMFile $asmInfo - } - - task: PowerShell@2 - displayName: Update csproj for no .snk - inputs: - targetType: inline - script: > - (Get-Content -path Src\StackifyLib\StackifyLib.csproj -Raw) -replace 'StackifyLib.signed','StackifyLib' | Set-Content -Path Src\StackifyLib\StackifyLib.csproj - - task: DotNetCoreCLI@2 - displayName: dotnet build [Unsigned] - inputs: - projects: | - Src\StackifyLib\*.csproj - Src\StackifyLib.AspNetCore\*.csproj - Src\StackifyLib.CoreLogger\*.csproj - Src\StackifyLib.log4net\*.csproj - Src\Nlog.Targets.Stackify\*.csproj - Src\NLog.Web.Stackify\*.csproj - Src\StackifyLib.StackifyTraceListener\*.csproj - arguments: '-c $(BuildConfiguration)' - - task: DotNetCoreCLI@2 - displayName: dotnet pack copy [Unsigned] - inputs: - command: pack - searchPatternPack: 'Src\StackifyLib\*.csproj;Src\StackifyLib.AspNetCore\*.csproj;Src\StackifyLib.CoreLogger\*.csproj;Src\StackifyLib.log4net\*.csproj;Src\Nlog.Targets.Stackify\*.csproj;Src\NLog.Web.Stackify\*.csproj;Src\StackifyLib.StackifyTraceListener\*.csproj ' + displayName: Uncoment signing attribute + - job: Restore Project + steps: + - task: DotNetCoreCLI@2 + displayName: dotnet restore + inputs: + command: restore + restoreArguments: .\Src + - job: Build StackifyLib Project + dependsOn: 'Prepare StackifyLib Signing' + condition: and(succeeded(), eq(parameters['Build StackifyLib'], true)) + steps: + - task: DotNetCoreCLI@2 + displayName: dotnet build + inputs: + projects: | + Src\StackifyLib\*.csproj + arguments: '-c $(BuildConfiguration)' + - task: DotNetCoreCLI@2 + displayName: dotnet pack signed stackify lib + inputs: + command: pack + searchPatternPack: Src\StackifyLib\*.csproj; + nobuild: true + - job: Sign StackifyLib Project + dependsOn: 'Build StackifyLib Project' + condition: and(succeeded(), eq(parameters['Build StackifyLib Signed'], true)) + steps: nobuild: true - - task: PublishPipelineArtifact@1 - displayName: Publish Pipeline Artifact [Unsigned] - inputs: - path: $(Build.ArtifactStagingDirectory) - artifactName: Unsigned NuGet Packages - - task: PowerShell@2 - displayName: PowerShell Script - inputs: - targetType: inline - script: | - $xml = [Xml] (Get-Content .\Src\StackifyLib\StackifyLib.csproj) - $version = $xml.Project.PropertyGroup.Version - echo $version - $version = "$version".Trim() - echo "##vso[task.setvariable variable=version]$version" - echo "StackifyLib."$version".nupkg" - workingDirectory: $(Build.SourcesDirectory) - - task: Veracode@3 - displayName: 'Upload and scan: $(Build.ArtifactStagingDirectory)/StackifyLib.$(version).nupkg' - condition: and(succeeded(), eq('${{ parameters.RUN_VERACODE_SCAN }}', 'true')) - enabled: True - inputs: - AnalysisService: 51003f89-58ab-463c-8e20-41484888d9c7 - veracodeAppProfile: Retrace .Net StackifyLib - version: AZ-Devops-Build-$(build.buildNumber) - filepath: $(Build.ArtifactStagingDirectory)/StackifyLib.$(version).nupkg + - task: DotNetCoreCLI@2 + displayName: Install NuGetKeyVaultSignTool + continueOnError: true + inputs: + command: 'custom' + custom: 'tool' + arguments: 'install --global NuGetKeyVaultSignTool' + - task: CmdLine@2 + displayName: 'Sign nuget package' + inputs: + script: NuGetKeyVaultSignTool sign $(Build.ArtifactStagingDirectory)\StackifyLib.signed.*.nupkg -kvu "$(SigningVaultURL)" -kvi "$(SigningAppClientId)" -kvt "$(SigningAppTenantId)" -kvs "$(SigningClientSecret)" -kvc "$(SigningCertName)" -tr http://timestamp.digicert.com + workingDirectory: $(Build.SourcesDirectory) + - task: PowerShell@2 + displayName: Rename signed assemblies + enabled: False + inputs: + targetType: inline + script: "$files = @(Get-ChildItem -Path . -File -Filter *.nupkg)\n\nforeach($file in $files) {\n $BaseFilename = $file.BaseName\n $BaseFilenameSplit = $file.BaseName.Split(\".\")\n $LastVersionDigit = \"\"\n $NewFilenameBase = \"\"\n $PackageVersion = \"\"\n $IsBeta = \"False\"\n if ($BaseFilename.contains(\"beta\")) {\n $IsBeta = \"True\"\n $LastVersionDigit = $file.BaseName.Substring($BaseFilename.length - 6,1)\n }\n else {\n $LastVersionDigit = $file.BaseName.Substring($BaseFilename.length - 1)\n }\n foreach($namePart in $BaseFilenameSplit) {\n if (!$namePart.contains(\"beta\") -and $namePart -notmatch \"^\\d+$\") {\n $NewFilenameBase = $NewFilenameBase + $namePart + \".\"\n } else {\n # check for beta\n if ($namePart.contains(\"beta\")) {\n $PackageVersion = $PackageVersion + $namePart.Substring(0,1)\n } else {\n $PackageVersion = $PackageVersion + $namePart\n }\n # check length to append a .\n if ($namePart -notmatch $LastVersionDigit) {\n $PackageVersion = $PackageVersion + \".\"\n }\n }\n }\n \n # check beta\n $FinalFilenameBase = \"\"\n if ($IsBeta -match \"True\") {\n $FinalFilenameBase = $NewFilenameBase + \"snk.\" + $PackageVersion + \"-beta\"\n } else {\n $FinalFilenameBase = $NewFilenameBase + \"snk.\" + $PackageVersion\n }\n $FinalFilename = $FinalFilenameBase + $file.Extension\n Rename-Item -Path $file -NewName $FinalFilename\n}" + workingDirectory: $(Build.ArtifactStagingDirectory) + - task: PublishPipelineArtifact@1 + displayName: Publish Signed Artifact + inputs: + path: $(Build.ArtifactStagingDirectory) + artifactName: Signed NuGet Packages + - task: PowerShell@2 + displayName: Delete signed assemblies + enabled: true + inputs: + targetType: inline + script: > + Remove-Item *.signed*.nupkg + workingDirectory: $(Build.ArtifactStagingDirectory) + - task: PowerShell@2 + displayName: Remove Sign Code + enabled: false + inputs: + targetType: filePath + arguments: '' + filePath: Scripts/RemoveSignCode.ps1 + workingDirectory: $(Build.SourcesDirectory) + - task: PowerShell@2 + displayName: Remove Sign Code Inline + inputs: + targetType: 'inline' + script: | + function Remove-SignCode { + param ( + $ASMFile + ) + Set-Content -Path $ASMFile -Value (Get-Content -Path $ASMFile | Select-String -Pattern AssemblyKeyFileAttribute -NotMatch ) + } + + $files = @(Get-ChildItem -Path . -Directory -Filter Stackify*) + + foreach ($file in $files) { + $asmInfo = Get-ChildItem -Path $file/Properties/AssemblyInfo.cs + Remove-SignCode -ASMFile $asmInfo + } + - task: PowerShell@2 + displayName: Update csproj for no .snk + inputs: + targetType: inline + script: > + (Get-Content -path Src\StackifyLib\StackifyLib.csproj -Raw) -replace 'StackifyLib.signed','StackifyLib' | Set-Content -Path Src\StackifyLib\StackifyLib.csproj + - template: templates/build-and-pack.yml + condition: and(succeeded(), eq(parameters['Build StackifyLib.AspNetCore'], true)) + displayName: Build StackifyLib.AspNetCore + variables: + BuildConfiguration: '$(BuildConfiguration)', + ProjectName: 'StackifyLib.AspNetCore' + ProjectLocation: 'Src\StackifyLib.AspNetCore\*.csproj' + - template: templates/build-and-pack.yml + condition: and(succeeded(), eq(parameters['Build StackifyLib.CoreLogger'], true)) + displayName: Build StackifyLib.CoreLogger + variables: + BuildConfiguration: '$(BuildConfiguration)', + ProjectName: 'StackifyLib.CoreLogger' + ProjectLocation: 'Src\StackifyLib.CoreLogger\*.csproj' + - template: templates/build-and-pack.yml + condition: and(succeeded(), eq(parameters['Build StackifyLib.log4net'], true)) + displayName: Build StackifyLib.log4net + variables: + BuildConfiguration: '$(BuildConfiguration)', + ProjectName: 'StackifyLib.log4net' + ProjectLocation: 'Src\StackifyLib.log4net\*.csproj' + - template: templates/build-and-pack.yml + condition: and(succeeded(), eq(parameters['Build Nlog.Targets.Stackify'], true)) + displayName: Build Nlog.Targets.Stackify + variables: + BuildConfiguration: '$(BuildConfiguration)', + ProjectName: 'Nlog.Targets.Stackify' + ProjectLocation: 'Src\Nlog.Targets.Stackify\*.csproj' + - task: DotNetCoreCLI@2 + - template: templates/build-and-pack.yml + condition: and(succeeded(), eq(parameters['Build NLog.Web.Stackify'], true)) + displayName: Build NLog.Web.Stackify + variables: + BuildConfiguration: '$(BuildConfiguration)', + ProjectName: 'NLog.Web.Stackify' + ProjectLocation: 'Src\NLog.Web.Stackify\*.csproj' + - template: templates/build-and-pack.yml + condition: and(succeeded(), eq(parameters['Build StackifyLib.StackifyTraceListener'], true)) + displayName: Build StackifyLib.StackifyTraceListener + variables: + BuildConfiguration: '$(BuildConfiguration)', + ProjectName: 'StackifyLib.StackifyTraceListener' + ProjectLocation: 'Src\StackifyLib.StackifyTraceListener\*.csproj' + - job: Publish Artifact Unsigned Packages + steps: + - task: PublishPipelineArtifact@1 + displayName: Publish Pipeline Artifact [Unsigned] + inputs: + path: $(Build.ArtifactStagingDirectory) + artifactName: Unsigned NuGet Packages + - task: PowerShell@2 + displayName: PowerShell Script + inputs: + targetType: inline + script: | + $xml = [Xml] (Get-Content .\Src\StackifyLib\StackifyLib.csproj) + $version = $xml.Project.PropertyGroup.Version + echo $version + $version = "$version".Trim() + echo "##vso[task.setvariable variable=version]$version" + echo "StackifyLib."$version".nupkg" + workingDirectory: $(Build.SourcesDirectory) + - job: Send StackifyLib to Veracode + dependsOn: 'Build StackifyLib Project' + condition: and(succeeded(), eq(parameters['Build StackifyLib Signed'], true)) + steps: + - task: Veracode@3 + displayName: 'Upload and scan: $(Build.ArtifactStagingDirectory)/StackifyLib.$(version).nupkg' + condition: and(succeeded(), eq('${{ parameters.RUN_VERACODE_SCAN }}', 'true')) + enabled: True + inputs: + AnalysisService: 51003f89-58ab-463c-8e20-41484888d9c7 + veracodeAppProfile: Retrace .Net StackifyLib + version: AZ-Devops-Build-$(build.buildNumber) + filepath: $(Build.ArtifactStagingDirectory)/StackifyLib.$(version).nupkg diff --git a/templates/build-and-pack.yml b/templates/build-and-pack.yml new file mode 100644 index 0000000..eecb572 --- /dev/null +++ b/templates/build-and-pack.yml @@ -0,0 +1,25 @@ +# BuildAndPack.yml + +parameters: + - name: ProjectLocation + type: string + - name: ProjectName + type: string + - name: BuildConfiguration + type: string + +jobs: +- job: Build ${{ parameters.ProjectName }} + steps: + - task: DotNetCoreCLI@2 + displayName: dotnet build ${{parameters.ProjectName}} [Unsigned] + inputs: + projects: | + ${{ parameters.ProjectLocation }} + arguments: '-c $(BuildConfiguration)' + - task: DotNetCoreCLI@2 + displayName: dotnet pack copy ${{parameters.ProjectName}} [Unsigned] + inputs: + command: pack + searchPatternPack: '$(ProjectLocation)' + nobuild: true \ No newline at end of file From 3eb3c6bc7c6dc1dff0aa4c73128cbada958ba9b3 Mon Sep 17 00:00:00 2001 From: Michael Mantos Date: Wed, 31 Jan 2024 17:05:44 +0800 Subject: [PATCH 3/7] Update pipeline for all packages --- azure-pipelines.yml | 269 +++++++++++++++++------------------ templates/build-and-pack.yml | 30 ++-- 2 files changed, 142 insertions(+), 157 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 94901f7..7d4f931 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -11,32 +11,6 @@ schedules: - develop always: true -parameters: -- name: 'Build StackifyLib' - type: boolean - default: true -- name: 'Build StackifyLib Signed' - type: boolean - default: true -- name: 'Build StackifyLib.AspNetCore' - type: boolean - default: true -- name: 'Build StackifyLib.CoreLogger' - type: boolean - default: true -- name: 'Build StackifyLib.log4net' - type: boolean - default: true -- name: 'Build Nlog.Targets.Stackify' - type: boolean - default: true -- name: 'Build NLog.Web.Stackify' - type: boolean - default: true -- name: 'Build StackifyLib.StackifyTraceListener' - type: boolean - default: true - pool: name: win2016-vs2017 # name: Azure Pipelines @@ -50,33 +24,52 @@ parameters: displayName: 'Execute Veracode SCA' type: boolean default: false + - name: 'Build StackifyLib' + type: boolean + default: true + - name: 'Build StackifyLib Signed' + type: boolean + default: true + - name: 'Build StackifyLib.AspNetCore' + type: boolean + default: true + - name: 'Build StackifyLib.CoreLogger' + type: boolean + default: true + - name: 'Build StackifyLib.log4net' + type: boolean + default: true + - name: 'Build NLog.Targets.Stackify' + type: boolean + default: true + - name: 'Build NLog.Web.Stackify' + type: boolean + default: true + - name: 'Build StackifyLib.StackifyTraceListener' + type: boolean + default: true + variables: - group: code-signing -jobs: - - job: Checkout repo - steps: - - checkout: self - clean: true - lfs: true - - job: Setup Prerequisites - steps: - - task: AzureKeyVault@2 - displayName: 'Azure Key Vault: keyvault-build-resources' - inputs: - ConnectedServiceName: 514ed7d6-3846-4422-8013-af27483dd22c - KeyVaultName: keyvault-build-resources - RunAsPreJob: true - - task: PowerShell@2 - displayName: 'Veracode SCA Scan' - condition: and(succeeded(), eq('${{ parameters.RUN_VERACODE_SCA }}', 'true')) - inputs: - targetType: inline - script: > - $Env:SRCCLR_API_TOKEN="$(SRCCLR_API_TOKEN)"; Set-ExecutionPolicy AllSigned -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://download.sourceclear.com/ci.ps1')); srcclr scan .\Src\StackifyLib; - - job: Prepare StackifyLib Signing - condition: and(succeeded(), eq(parameters['Build StackifyLib Signed'], true)) - steps: +steps: + - checkout: self + clean: true + lfs: true + - task: AzureKeyVault@2 + displayName: 'Azure Key Vault: keyvault-build-resources' + inputs: + ConnectedServiceName: 514ed7d6-3846-4422-8013-af27483dd22c + KeyVaultName: keyvault-build-resources + RunAsPreJob: true + - task: PowerShell@2 + displayName: 'Veracode SCA Scan' + condition: and(succeeded(), eq('${{ parameters.RUN_VERACODE_SCA }}', 'true')) + inputs: + targetType: inline + script: > + $Env:SRCCLR_API_TOKEN="$(SRCCLR_API_TOKEN)"; Set-ExecutionPolicy AllSigned -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://download.sourceclear.com/ci.ps1')); srcclr scan .\Src\StackifyLib; + - ${{ if eq(parameters['Build StackifyLib Signed'], true) }}: - task: DownloadSecureFile@1 name: SNK displayName: Download Strong Name Key @@ -104,17 +97,19 @@ jobs: (gc $_) -replace ([regex]::Escape("//[assembly: AssemblyKeyFile")), "[assembly: AssemblyKeyFile" | Set-Content $_.FullName -Encoding utf8 } displayName: Uncoment signing attribute - - job: Restore Project - steps: - - task: DotNetCoreCLI@2 - displayName: dotnet restore - inputs: - command: restore - restoreArguments: .\Src - - job: Build StackifyLib Project - dependsOn: 'Prepare StackifyLib Signing' - condition: and(succeeded(), eq(parameters['Build StackifyLib'], true)) - steps: + - task: DotNetCoreCLI@2 + displayName: dotnet restore + inputs: + command: restore + projects: | + Src\StackifyLib\*.csproj + Src\StackifyLib.AspNetCore\*.csproj + Src\StackifyLib.CoreLogger\*.csproj + Src\StackifyLib.log4net\*.csproj + Src\Nlog.Targets.Stackify\*.csproj + Src\NLog.Web.Stackify\*.csproj + Src\StackifyLib.StackifyTraceListener\*.csproj + - ${{ if eq(parameters['Build StackifyLib'], true) }}: - task: DotNetCoreCLI@2 displayName: dotnet build inputs: @@ -126,12 +121,8 @@ jobs: inputs: command: pack searchPatternPack: Src\StackifyLib\*.csproj; - nobuild: true - - job: Sign StackifyLib Project - dependsOn: 'Build StackifyLib Project' - condition: and(succeeded(), eq(parameters['Build StackifyLib Signed'], true)) - steps: - nobuild: true + nobuild: true + - ${{ if eq(parameters['Build StackifyLib Signed'], true) }}: - task: DotNetCoreCLI@2 displayName: Install NuGetKeyVaultSignTool continueOnError: true @@ -196,78 +187,72 @@ jobs: targetType: inline script: > (Get-Content -path Src\StackifyLib\StackifyLib.csproj -Raw) -replace 'StackifyLib.signed','StackifyLib' | Set-Content -Path Src\StackifyLib\StackifyLib.csproj - - template: templates/build-and-pack.yml - condition: and(succeeded(), eq(parameters['Build StackifyLib.AspNetCore'], true)) - displayName: Build StackifyLib.AspNetCore - variables: - BuildConfiguration: '$(BuildConfiguration)', - ProjectName: 'StackifyLib.AspNetCore' - ProjectLocation: 'Src\StackifyLib.AspNetCore\*.csproj' - - template: templates/build-and-pack.yml - condition: and(succeeded(), eq(parameters['Build StackifyLib.CoreLogger'], true)) - displayName: Build StackifyLib.CoreLogger - variables: - BuildConfiguration: '$(BuildConfiguration)', - ProjectName: 'StackifyLib.CoreLogger' - ProjectLocation: 'Src\StackifyLib.CoreLogger\*.csproj' - - template: templates/build-and-pack.yml - condition: and(succeeded(), eq(parameters['Build StackifyLib.log4net'], true)) - displayName: Build StackifyLib.log4net - variables: - BuildConfiguration: '$(BuildConfiguration)', - ProjectName: 'StackifyLib.log4net' - ProjectLocation: 'Src\StackifyLib.log4net\*.csproj' - - template: templates/build-and-pack.yml - condition: and(succeeded(), eq(parameters['Build Nlog.Targets.Stackify'], true)) - displayName: Build Nlog.Targets.Stackify - variables: - BuildConfiguration: '$(BuildConfiguration)', - ProjectName: 'Nlog.Targets.Stackify' - ProjectLocation: 'Src\Nlog.Targets.Stackify\*.csproj' - - task: DotNetCoreCLI@2 - - template: templates/build-and-pack.yml - condition: and(succeeded(), eq(parameters['Build NLog.Web.Stackify'], true)) - displayName: Build NLog.Web.Stackify - variables: - BuildConfiguration: '$(BuildConfiguration)', - ProjectName: 'NLog.Web.Stackify' - ProjectLocation: 'Src\NLog.Web.Stackify\*.csproj' - - template: templates/build-and-pack.yml - condition: and(succeeded(), eq(parameters['Build StackifyLib.StackifyTraceListener'], true)) - displayName: Build StackifyLib.StackifyTraceListener - variables: - BuildConfiguration: '$(BuildConfiguration)', - ProjectName: 'StackifyLib.StackifyTraceListener' - ProjectLocation: 'Src\StackifyLib.StackifyTraceListener\*.csproj' - - job: Publish Artifact Unsigned Packages - steps: - - task: PublishPipelineArtifact@1 - displayName: Publish Pipeline Artifact [Unsigned] - inputs: - path: $(Build.ArtifactStagingDirectory) - artifactName: Unsigned NuGet Packages - - task: PowerShell@2 - displayName: PowerShell Script - inputs: - targetType: inline - script: | - $xml = [Xml] (Get-Content .\Src\StackifyLib\StackifyLib.csproj) - $version = $xml.Project.PropertyGroup.Version - echo $version - $version = "$version".Trim() - echo "##vso[task.setvariable variable=version]$version" - echo "StackifyLib."$version".nupkg" - workingDirectory: $(Build.SourcesDirectory) - - job: Send StackifyLib to Veracode - dependsOn: 'Build StackifyLib Project' - condition: and(succeeded(), eq(parameters['Build StackifyLib Signed'], true)) - steps: - - task: Veracode@3 - displayName: 'Upload and scan: $(Build.ArtifactStagingDirectory)/StackifyLib.$(version).nupkg' - condition: and(succeeded(), eq('${{ parameters.RUN_VERACODE_SCAN }}', 'true')) - enabled: True - inputs: - AnalysisService: 51003f89-58ab-463c-8e20-41484888d9c7 - veracodeAppProfile: Retrace .Net StackifyLib - version: AZ-Devops-Build-$(build.buildNumber) - filepath: $(Build.ArtifactStagingDirectory)/StackifyLib.$(version).nupkg + - ${{ if eq(parameters['Build StackifyLib.AspNetCore'], true) }}: + - template: templates/build-and-pack.yml + parameters: + BuildConfiguration: '$(BuildConfiguration)' + ProjectJobName: 'StackifyLib_AspNetCore' + ProjectName: 'StackifyLib.AspNetCore' + ProjectLocation: 'Src\StackifyLib.AspNetCore\*.csproj' + - ${{ if eq(parameters['Build StackifyLib.CoreLogger'], true) }}: + - template: templates/build-and-pack.yml + parameters: + BuildConfiguration: '$(BuildConfiguration)' + ProjectJobName: 'StackifyLib_CoreLogger' + ProjectName: 'StackifyLib.CoreLogger' + ProjectLocation: 'Src\StackifyLib.CoreLogger\*.csproj' + - ${{ if eq(parameters['Build StackifyLib.log4net'], true) }}: + - template: templates/build-and-pack.yml + parameters: + BuildConfiguration: '$(BuildConfiguration)' + ProjectName: 'StackifyLib.log4net' + ProjectJobName: 'StackifyLib_log4net' + ProjectLocation: 'Src\StackifyLib.log4net\*.csproj' + - ${{ if eq(parameters['Build NLog.Targets.Stackify'], true) }}: + - template: templates/build-and-pack.yml + parameters: + BuildConfiguration: '$(BuildConfiguration)' + ProjectName: 'NLog.Targets.Stackify' + ProjectJobName: 'NLog_Targets_Stackify' + ProjectLocation: 'Src\NLog.Targets.Stackify\*.csproj' + - ${{ if eq(parameters['Build NLog.Web.Stackify'], true) }}: + - template: templates/build-and-pack.yml + parameters: + BuildConfiguration: '$(BuildConfiguration)' + ProjectName: 'NLog.Web.Stackify' + ProjectJobName: 'NLog_Web_Stackify' + ProjectLocation: 'Src\NLog.Web.Stackify\*.csproj' + - ${{ if eq(parameters['Build StackifyLib.StackifyTraceListener'], true) }}: + - template: templates/build-and-pack.yml + parameters: + BuildConfiguration: '$(BuildConfiguration)' + ProjectName: 'StackifyLib.StackifyTraceListener' + ProjectJobName: 'StackifyLib_StackifyTraceListener' + ProjectLocation: 'Src\StackifyLib.StackifyTraceListener\*.csproj' + - task: PublishPipelineArtifact@1 + displayName: Publish Pipeline Artifact [Unsigned] + inputs: + path: $(Build.ArtifactStagingDirectory) + artifactName: Unsigned NuGet Packages + - ${{ if eq(parameters['Build StackifyLib'], true) }}: + - task: PowerShell@2 + displayName: PowerShell Script + inputs: + targetType: inline + script: | + $xml = [Xml] (Get-Content .\Src\StackifyLib\StackifyLib.csproj) + $version = $xml.Project.PropertyGroup.Version + echo $version + $version = "$version".Trim() + echo "##vso[task.setvariable variable=version]$version" + echo "StackifyLib."$version".nupkg" + workingDirectory: $(Build.SourcesDirectory) + - task: Veracode@3 + displayName: 'Upload and scan: $(Build.ArtifactStagingDirectory)/StackifyLib.$(version).nupkg' + condition: and(succeeded(), eq('${{ parameters.RUN_VERACODE_SCAN }}', 'true')) + enabled: True + inputs: + AnalysisService: 51003f89-58ab-463c-8e20-41484888d9c7 + veracodeAppProfile: Retrace .Net StackifyLib + version: AZ-Devops-Build-$(build.buildNumber) + filepath: $(Build.ArtifactStagingDirectory)/StackifyLib.$(version).nupkg diff --git a/templates/build-and-pack.yml b/templates/build-and-pack.yml index eecb572..3a47eab 100644 --- a/templates/build-and-pack.yml +++ b/templates/build-and-pack.yml @@ -5,21 +5,21 @@ parameters: type: string - name: ProjectName type: string + - name: ProjectJobName + type: string - name: BuildConfiguration type: string -jobs: -- job: Build ${{ parameters.ProjectName }} - steps: - - task: DotNetCoreCLI@2 - displayName: dotnet build ${{parameters.ProjectName}} [Unsigned] - inputs: - projects: | - ${{ parameters.ProjectLocation }} - arguments: '-c $(BuildConfiguration)' - - task: DotNetCoreCLI@2 - displayName: dotnet pack copy ${{parameters.ProjectName}} [Unsigned] - inputs: - command: pack - searchPatternPack: '$(ProjectLocation)' - nobuild: true \ No newline at end of file +steps: +- task: DotNetCoreCLI@2 + displayName: dotnet build ${{parameters.ProjectName}} [Unsigned] + inputs: + projects: | + ${{ parameters.ProjectLocation }} + arguments: '-c ${{ parameters.BuildConfiguration }}' +- task: DotNetCoreCLI@2 + displayName: dotnet pack copy ${{parameters.ProjectName}} [Unsigned] + inputs: + command: pack + searchPatternPack: ${{ parameters.ProjectLocation }} + nobuild: true \ No newline at end of file From 7ec2d4267558baaf183da41f73a9d7935e06327f Mon Sep 17 00:00:00 2001 From: Todd Lair <26470949+t-lair@users.noreply.github.com> Date: Mon, 5 Feb 2024 14:24:30 -0600 Subject: [PATCH 4/7] Fix Veracode pipeline for SCA scanning job with different image (#147) * Updated the pipelines for develop branch * Updated veracodes SCA flag default to true * Fixed the yml syntax --- azure-pipelines.yml | 413 ++++++++++++++++++++++---------------------- 1 file changed, 210 insertions(+), 203 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7d4f931..5aa5fb7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -23,7 +23,7 @@ parameters: - name: RUN_VERACODE_SCA displayName: 'Execute Veracode SCA' type: boolean - default: false + default: true - name: 'Build StackifyLib' type: boolean default: true @@ -52,207 +52,214 @@ parameters: variables: - group: code-signing -steps: - - checkout: self - clean: true - lfs: true - - task: AzureKeyVault@2 - displayName: 'Azure Key Vault: keyvault-build-resources' - inputs: - ConnectedServiceName: 514ed7d6-3846-4422-8013-af27483dd22c - KeyVaultName: keyvault-build-resources - RunAsPreJob: true - - task: PowerShell@2 - displayName: 'Veracode SCA Scan' - condition: and(succeeded(), eq('${{ parameters.RUN_VERACODE_SCA }}', 'true')) - inputs: - targetType: inline - script: > - $Env:SRCCLR_API_TOKEN="$(SRCCLR_API_TOKEN)"; Set-ExecutionPolicy AllSigned -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://download.sourceclear.com/ci.ps1')); srcclr scan .\Src\StackifyLib; - - ${{ if eq(parameters['Build StackifyLib Signed'], true) }}: - - task: DownloadSecureFile@1 - name: SNK - displayName: Download Strong Name Key - inputs: - secureFile: 9d810a2d-d090-431c-9012-df939a4b1afe - - task: PowerShell@2 - displayName: Move Signing Key To Project Directory - inputs: - targetType: inline - filePath: Src/StackifyLib - script: | - # Write your PowerShell commands here. - ls - Move-Item $(SNK.secureFilePath) Src/StackifyLib/Netreo.snk - - task: PowerShell@2 - displayName: Update csproj for .snk - inputs: - targetType: inline - script: > - (Get-Content -path Src\StackifyLib\StackifyLib.csproj -Raw) -replace 'StackifyLib','StackifyLib.signed' | Set-Content -Path Src\StackifyLib\StackifyLib.csproj -Encoding utf8 - # note: the signing attribute here is commented out so we can build locally - - powershell: | - $filename = Get-ChildItem ".\src\*\AssemblyInfo.cs" -Recurse - $filename | %{ - (gc $_) -replace ([regex]::Escape("//[assembly: AssemblyKeyFile")), "[assembly: AssemblyKeyFile" | Set-Content $_.FullName -Encoding utf8 - } - displayName: Uncoment signing attribute - - task: DotNetCoreCLI@2 - displayName: dotnet restore - inputs: - command: restore - projects: | - Src\StackifyLib\*.csproj - Src\StackifyLib.AspNetCore\*.csproj - Src\StackifyLib.CoreLogger\*.csproj - Src\StackifyLib.log4net\*.csproj - Src\Nlog.Targets.Stackify\*.csproj - Src\NLog.Web.Stackify\*.csproj - Src\StackifyLib.StackifyTraceListener\*.csproj - - ${{ if eq(parameters['Build StackifyLib'], true) }}: - - task: DotNetCoreCLI@2 - displayName: dotnet build - inputs: - projects: | - Src\StackifyLib\*.csproj - arguments: '-c $(BuildConfiguration)' - - task: DotNetCoreCLI@2 - displayName: dotnet pack signed stackify lib - inputs: - command: pack - searchPatternPack: Src\StackifyLib\*.csproj; - nobuild: true - - ${{ if eq(parameters['Build StackifyLib Signed'], true) }}: - - task: DotNetCoreCLI@2 - displayName: Install NuGetKeyVaultSignTool - continueOnError: true - inputs: - command: 'custom' - custom: 'tool' - arguments: 'install --global NuGetKeyVaultSignTool' - - task: CmdLine@2 - displayName: 'Sign nuget package' - inputs: - script: NuGetKeyVaultSignTool sign $(Build.ArtifactStagingDirectory)\StackifyLib.signed.*.nupkg -kvu "$(SigningVaultURL)" -kvi "$(SigningAppClientId)" -kvt "$(SigningAppTenantId)" -kvs "$(SigningClientSecret)" -kvc "$(SigningCertName)" -tr http://timestamp.digicert.com - workingDirectory: $(Build.SourcesDirectory) - - task: PowerShell@2 - displayName: Rename signed assemblies - enabled: False - inputs: - targetType: inline - script: "$files = @(Get-ChildItem -Path . -File -Filter *.nupkg)\n\nforeach($file in $files) {\n $BaseFilename = $file.BaseName\n $BaseFilenameSplit = $file.BaseName.Split(\".\")\n $LastVersionDigit = \"\"\n $NewFilenameBase = \"\"\n $PackageVersion = \"\"\n $IsBeta = \"False\"\n if ($BaseFilename.contains(\"beta\")) {\n $IsBeta = \"True\"\n $LastVersionDigit = $file.BaseName.Substring($BaseFilename.length - 6,1)\n }\n else {\n $LastVersionDigit = $file.BaseName.Substring($BaseFilename.length - 1)\n }\n foreach($namePart in $BaseFilenameSplit) {\n if (!$namePart.contains(\"beta\") -and $namePart -notmatch \"^\\d+$\") {\n $NewFilenameBase = $NewFilenameBase + $namePart + \".\"\n } else {\n # check for beta\n if ($namePart.contains(\"beta\")) {\n $PackageVersion = $PackageVersion + $namePart.Substring(0,1)\n } else {\n $PackageVersion = $PackageVersion + $namePart\n }\n # check length to append a .\n if ($namePart -notmatch $LastVersionDigit) {\n $PackageVersion = $PackageVersion + \".\"\n }\n }\n }\n \n # check beta\n $FinalFilenameBase = \"\"\n if ($IsBeta -match \"True\") {\n $FinalFilenameBase = $NewFilenameBase + \"snk.\" + $PackageVersion + \"-beta\"\n } else {\n $FinalFilenameBase = $NewFilenameBase + \"snk.\" + $PackageVersion\n }\n $FinalFilename = $FinalFilenameBase + $file.Extension\n Rename-Item -Path $file -NewName $FinalFilename\n}" - workingDirectory: $(Build.ArtifactStagingDirectory) - - task: PublishPipelineArtifact@1 - displayName: Publish Signed Artifact - inputs: - path: $(Build.ArtifactStagingDirectory) - artifactName: Signed NuGet Packages - - task: PowerShell@2 - displayName: Delete signed assemblies - enabled: true - inputs: - targetType: inline - script: > - Remove-Item *.signed*.nupkg - workingDirectory: $(Build.ArtifactStagingDirectory) - - task: PowerShell@2 - displayName: Remove Sign Code - enabled: false - inputs: - targetType: filePath - arguments: '' - filePath: Scripts/RemoveSignCode.ps1 - workingDirectory: $(Build.SourcesDirectory) - - task: PowerShell@2 - displayName: Remove Sign Code Inline - inputs: - targetType: 'inline' - script: | - function Remove-SignCode { - param ( - $ASMFile - ) - Set-Content -Path $ASMFile -Value (Get-Content -Path $ASMFile | Select-String -Pattern AssemblyKeyFileAttribute -NotMatch ) - } - - $files = @(Get-ChildItem -Path . -Directory -Filter Stackify*) - - foreach ($file in $files) { - $asmInfo = Get-ChildItem -Path $file/Properties/AssemblyInfo.cs - Remove-SignCode -ASMFile $asmInfo - } - - task: PowerShell@2 - displayName: Update csproj for no .snk - inputs: - targetType: inline - script: > - (Get-Content -path Src\StackifyLib\StackifyLib.csproj -Raw) -replace 'StackifyLib.signed','StackifyLib' | Set-Content -Path Src\StackifyLib\StackifyLib.csproj - - ${{ if eq(parameters['Build StackifyLib.AspNetCore'], true) }}: - - template: templates/build-and-pack.yml - parameters: - BuildConfiguration: '$(BuildConfiguration)' - ProjectJobName: 'StackifyLib_AspNetCore' - ProjectName: 'StackifyLib.AspNetCore' - ProjectLocation: 'Src\StackifyLib.AspNetCore\*.csproj' - - ${{ if eq(parameters['Build StackifyLib.CoreLogger'], true) }}: - - template: templates/build-and-pack.yml - parameters: - BuildConfiguration: '$(BuildConfiguration)' - ProjectJobName: 'StackifyLib_CoreLogger' - ProjectName: 'StackifyLib.CoreLogger' - ProjectLocation: 'Src\StackifyLib.CoreLogger\*.csproj' - - ${{ if eq(parameters['Build StackifyLib.log4net'], true) }}: - - template: templates/build-and-pack.yml - parameters: - BuildConfiguration: '$(BuildConfiguration)' - ProjectName: 'StackifyLib.log4net' - ProjectJobName: 'StackifyLib_log4net' - ProjectLocation: 'Src\StackifyLib.log4net\*.csproj' - - ${{ if eq(parameters['Build NLog.Targets.Stackify'], true) }}: - - template: templates/build-and-pack.yml - parameters: - BuildConfiguration: '$(BuildConfiguration)' - ProjectName: 'NLog.Targets.Stackify' - ProjectJobName: 'NLog_Targets_Stackify' - ProjectLocation: 'Src\NLog.Targets.Stackify\*.csproj' - - ${{ if eq(parameters['Build NLog.Web.Stackify'], true) }}: - - template: templates/build-and-pack.yml - parameters: - BuildConfiguration: '$(BuildConfiguration)' - ProjectName: 'NLog.Web.Stackify' - ProjectJobName: 'NLog_Web_Stackify' - ProjectLocation: 'Src\NLog.Web.Stackify\*.csproj' - - ${{ if eq(parameters['Build StackifyLib.StackifyTraceListener'], true) }}: - - template: templates/build-and-pack.yml - parameters: - BuildConfiguration: '$(BuildConfiguration)' - ProjectName: 'StackifyLib.StackifyTraceListener' - ProjectJobName: 'StackifyLib_StackifyTraceListener' - ProjectLocation: 'Src\StackifyLib.StackifyTraceListener\*.csproj' - - task: PublishPipelineArtifact@1 - displayName: Publish Pipeline Artifact [Unsigned] - inputs: - path: $(Build.ArtifactStagingDirectory) - artifactName: Unsigned NuGet Packages - - ${{ if eq(parameters['Build StackifyLib'], true) }}: - - task: PowerShell@2 - displayName: PowerShell Script +stages: + - stage: FirstStage + jobs: + - job: Build + steps: + - checkout: self + clean: true + lfs: true + - task: AzureKeyVault@2 + displayName: 'Azure Key Vault: keyvault-build-resources' + inputs: + ConnectedServiceName: 514ed7d6-3846-4422-8013-af27483dd22c + KeyVaultName: keyvault-build-resources + RunAsPreJob: true + - ${{ if eq(parameters['Build StackifyLib Signed'], true) }}: + - task: DownloadSecureFile@1 + name: SNK + displayName: Download Strong Name Key + inputs: + secureFile: 9d810a2d-d090-431c-9012-df939a4b1afe + - task: PowerShell@2 + displayName: Move Signing Key To Project Directory + inputs: + targetType: inline + filePath: Src/StackifyLib + script: | + # Write your PowerShell commands here. + ls + Move-Item $(SNK.secureFilePath) Src/StackifyLib/Netreo.snk + - task: PowerShell@2 + displayName: Update csproj for .snk + inputs: + targetType: inline + script: > + (Get-Content -path Src\StackifyLib\StackifyLib.csproj -Raw) -replace 'StackifyLib','StackifyLib.signed' | Set-Content -Path Src\StackifyLib\StackifyLib.csproj -Encoding utf8 + # note: the signing attribute here is commented out so we can build locally + - powershell: | + $filename = Get-ChildItem ".\src\*\AssemblyInfo.cs" -Recurse + $filename | %{ + (gc $_) -replace ([regex]::Escape("//[assembly: AssemblyKeyFile")), "[assembly: AssemblyKeyFile" | Set-Content $_.FullName -Encoding utf8 + } + displayName: Uncoment signing attribute + - task: DotNetCoreCLI@2 + displayName: dotnet restore + inputs: + command: restore + projects: | + Src\StackifyLib\*.csproj + Src\StackifyLib.AspNetCore\*.csproj + Src\StackifyLib.CoreLogger\*.csproj + Src\StackifyLib.log4net\*.csproj + Src\Nlog.Targets.Stackify\*.csproj + Src\NLog.Web.Stackify\*.csproj + Src\StackifyLib.StackifyTraceListener\*.csproj + - ${{ if eq(parameters['Build StackifyLib'], true) }}: + - task: DotNetCoreCLI@2 + displayName: dotnet build + inputs: + projects: | + Src\StackifyLib\*.csproj + arguments: '-c $(BuildConfiguration)' + - task: DotNetCoreCLI@2 + displayName: dotnet pack signed stackify lib + inputs: + command: pack + searchPatternPack: Src\StackifyLib\*.csproj; + nobuild: true + - ${{ if eq(parameters['Build StackifyLib Signed'], true) }}: + - task: DotNetCoreCLI@2 + displayName: Install NuGetKeyVaultSignTool + continueOnError: true + inputs: + command: 'custom' + custom: 'tool' + arguments: 'install --global NuGetKeyVaultSignTool' + - task: CmdLine@2 + displayName: 'Sign nuget package' + inputs: + script: NuGetKeyVaultSignTool sign $(Build.ArtifactStagingDirectory)\StackifyLib.signed.*.nupkg -kvu "$(SigningVaultURL)" -kvi "$(SigningAppClientId)" -kvt "$(SigningAppTenantId)" -kvs "$(SigningClientSecret)" -kvc "$(SigningCertName)" -tr http://timestamp.digicert.com + workingDirectory: $(Build.SourcesDirectory) + - task: PowerShell@2 + displayName: Rename signed assemblies + enabled: False + inputs: + targetType: inline + script: "$files = @(Get-ChildItem -Path . -File -Filter *.nupkg)\n\nforeach($file in $files) {\n $BaseFilename = $file.BaseName\n $BaseFilenameSplit = $file.BaseName.Split(\".\")\n $LastVersionDigit = \"\"\n $NewFilenameBase = \"\"\n $PackageVersion = \"\"\n $IsBeta = \"False\"\n if ($BaseFilename.contains(\"beta\")) {\n $IsBeta = \"True\"\n $LastVersionDigit = $file.BaseName.Substring($BaseFilename.length - 6,1)\n }\n else {\n $LastVersionDigit = $file.BaseName.Substring($BaseFilename.length - 1)\n }\n foreach($namePart in $BaseFilenameSplit) {\n if (!$namePart.contains(\"beta\") -and $namePart -notmatch \"^\\d+$\") {\n $NewFilenameBase = $NewFilenameBase + $namePart + \".\"\n } else {\n # check for beta\n if ($namePart.contains(\"beta\")) {\n $PackageVersion = $PackageVersion + $namePart.Substring(0,1)\n } else {\n $PackageVersion = $PackageVersion + $namePart\n }\n # check length to append a .\n if ($namePart -notmatch $LastVersionDigit) {\n $PackageVersion = $PackageVersion + \".\"\n }\n }\n }\n \n # check beta\n $FinalFilenameBase = \"\"\n if ($IsBeta -match \"True\") {\n $FinalFilenameBase = $NewFilenameBase + \"snk.\" + $PackageVersion + \"-beta\"\n } else {\n $FinalFilenameBase = $NewFilenameBase + \"snk.\" + $PackageVersion\n }\n $FinalFilename = $FinalFilenameBase + $file.Extension\n Rename-Item -Path $file -NewName $FinalFilename\n}" + workingDirectory: $(Build.ArtifactStagingDirectory) + - task: PublishPipelineArtifact@1 + displayName: Publish Signed Artifact + inputs: + path: $(Build.ArtifactStagingDirectory) + artifactName: Signed NuGet Packages + - task: PowerShell@2 + displayName: Delete signed assemblies + enabled: true + inputs: + targetType: inline + script: > + Remove-Item *.signed*.nupkg + workingDirectory: $(Build.ArtifactStagingDirectory) + - task: PowerShell@2 + displayName: Remove Sign Code + enabled: false + inputs: + targetType: filePath + arguments: '' + filePath: Scripts/RemoveSignCode.ps1 + workingDirectory: $(Build.SourcesDirectory) + - task: PowerShell@2 + displayName: Remove Sign Code Inline + inputs: + targetType: 'inline' + script: | + function Remove-SignCode { + param ( + $ASMFile + ) + Set-Content -Path $ASMFile -Value (Get-Content -Path $ASMFile | Select-String -Pattern AssemblyKeyFileAttribute -NotMatch ) + } + + $files = @(Get-ChildItem -Path . -Directory -Filter Stackify*) + + foreach ($file in $files) { + $asmInfo = Get-ChildItem -Path $file/Properties/AssemblyInfo.cs + Remove-SignCode -ASMFile $asmInfo + } + - task: PowerShell@2 + displayName: Update csproj for no .snk + inputs: + targetType: inline + script: > + (Get-Content -path Src\StackifyLib\StackifyLib.csproj -Raw) -replace 'StackifyLib.signed','StackifyLib' | Set-Content -Path Src\StackifyLib\StackifyLib.csproj + - ${{ if eq(parameters['Build StackifyLib.AspNetCore'], true) }}: + - template: templates/build-and-pack.yml + parameters: + BuildConfiguration: '$(BuildConfiguration)' + ProjectJobName: 'StackifyLib_AspNetCore' + ProjectName: 'StackifyLib.AspNetCore' + ProjectLocation: 'Src\StackifyLib.AspNetCore\*.csproj' + - ${{ if eq(parameters['Build StackifyLib.CoreLogger'], true) }}: + - template: templates/build-and-pack.yml + parameters: + BuildConfiguration: '$(BuildConfiguration)' + ProjectJobName: 'StackifyLib_CoreLogger' + ProjectName: 'StackifyLib.CoreLogger' + ProjectLocation: 'Src\StackifyLib.CoreLogger\*.csproj' + - ${{ if eq(parameters['Build StackifyLib.log4net'], true) }}: + - template: templates/build-and-pack.yml + parameters: + BuildConfiguration: '$(BuildConfiguration)' + ProjectName: 'StackifyLib.log4net' + ProjectJobName: 'StackifyLib_log4net' + ProjectLocation: 'Src\StackifyLib.log4net\*.csproj' + - ${{ if eq(parameters['Build NLog.Targets.Stackify'], true) }}: + - template: templates/build-and-pack.yml + parameters: + BuildConfiguration: '$(BuildConfiguration)' + ProjectName: 'NLog.Targets.Stackify' + ProjectJobName: 'NLog_Targets_Stackify' + ProjectLocation: 'Src\NLog.Targets.Stackify\*.csproj' + - ${{ if eq(parameters['Build NLog.Web.Stackify'], true) }}: + - template: templates/build-and-pack.yml + parameters: + BuildConfiguration: '$(BuildConfiguration)' + ProjectName: 'NLog.Web.Stackify' + ProjectJobName: 'NLog_Web_Stackify' + ProjectLocation: 'Src\NLog.Web.Stackify\*.csproj' + - ${{ if eq(parameters['Build StackifyLib.StackifyTraceListener'], true) }}: + - template: templates/build-and-pack.yml + parameters: + BuildConfiguration: '$(BuildConfiguration)' + ProjectName: 'StackifyLib.StackifyTraceListener' + ProjectJobName: 'StackifyLib_StackifyTraceListener' + ProjectLocation: 'Src\StackifyLib.StackifyTraceListener\*.csproj' + - task: PublishPipelineArtifact@1 + displayName: Publish Pipeline Artifact [Unsigned] inputs: - targetType: inline - script: | - $xml = [Xml] (Get-Content .\Src\StackifyLib\StackifyLib.csproj) - $version = $xml.Project.PropertyGroup.Version - echo $version - $version = "$version".Trim() - echo "##vso[task.setvariable variable=version]$version" - echo "StackifyLib."$version".nupkg" - workingDirectory: $(Build.SourcesDirectory) - - task: Veracode@3 - displayName: 'Upload and scan: $(Build.ArtifactStagingDirectory)/StackifyLib.$(version).nupkg' - condition: and(succeeded(), eq('${{ parameters.RUN_VERACODE_SCAN }}', 'true')) - enabled: True + path: $(Build.ArtifactStagingDirectory) + artifactName: Unsigned NuGet Packages + - ${{ if eq(parameters['Build StackifyLib'], true) }}: + - task: PowerShell@2 + displayName: PowerShell Script + inputs: + targetType: inline + script: | + $xml = [Xml] (Get-Content .\Src\StackifyLib\StackifyLib.csproj) + $version = $xml.Project.PropertyGroup.Version + echo $version + $version = "$version".Trim() + echo "##vso[task.setvariable variable=version]$version" + echo "StackifyLib."$version".nupkg" + workingDirectory: $(Build.SourcesDirectory) + - task: Veracode@3 + displayName: 'Upload and scan: $(Build.ArtifactStagingDirectory)/StackifyLib.$(version).nupkg' + condition: and(succeeded(), eq('${{ parameters.RUN_VERACODE_SCAN }}', 'true')) + enabled: True + inputs: + AnalysisService: 51003f89-58ab-463c-8e20-41484888d9c7 + veracodeAppProfile: Retrace .Net StackifyLib + version: AZ-Devops-Build-$(build.buildNumber) + filepath: $(Build.ArtifactStagingDirectory)/StackifyLib.$(version).nupkg + + - job: SCA + pool: + vmImage: 'windows-latest' + steps: + - task: PowerShell@2 inputs: - AnalysisService: 51003f89-58ab-463c-8e20-41484888d9c7 - veracodeAppProfile: Retrace .Net StackifyLib - version: AZ-Devops-Build-$(build.buildNumber) - filepath: $(Build.ArtifactStagingDirectory)/StackifyLib.$(version).nupkg + targetType: 'inline' + script: $Env:SRCCLR_API_TOKEN="$(SRCCLR_API_TOKEN)"; Set-ExecutionPolicy AllSigned -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://download.srcclr.com/ci.ps1')); srcclr scan --allow-dirty .; + condition: and(succeeded(), eq('${{ parameters.RUN_VERACODE_SCA }}', 'true')) \ No newline at end of file From 15b2c860c51af6a4b67006c36ff41d4054bc51b3 Mon Sep 17 00:00:00 2001 From: Todd Lair Date: Fri, 10 Jan 2025 14:25:34 -0600 Subject: [PATCH 5/7] Updated the azure pipelines for new service connection --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5aa5fb7..02872f1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -63,7 +63,7 @@ stages: - task: AzureKeyVault@2 displayName: 'Azure Key Vault: keyvault-build-resources' inputs: - ConnectedServiceName: 514ed7d6-3846-4422-8013-af27483dd22c + ConnectedServiceName: 6d8c8cb2-5e16-4db5-9cf2-da22abf7f285 KeyVaultName: keyvault-build-resources RunAsPreJob: true - ${{ if eq(parameters['Build StackifyLib Signed'], true) }}: From 14d349d7ca12d33f234325d139cf03af556506ef Mon Sep 17 00:00:00 2001 From: Todd Lair Date: Fri, 10 Jan 2025 16:03:29 -0600 Subject: [PATCH 6/7] Added the uuid for the wif service --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 02872f1..b940ce9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -63,7 +63,7 @@ stages: - task: AzureKeyVault@2 displayName: 'Azure Key Vault: keyvault-build-resources' inputs: - ConnectedServiceName: 6d8c8cb2-5e16-4db5-9cf2-da22abf7f285 + ConnectedServiceName: 5313674e-7e2b-426b-9eaf-8d3d5bd22e2c KeyVaultName: keyvault-build-resources RunAsPreJob: true - ${{ if eq(parameters['Build StackifyLib Signed'], true) }}: From d4827964b649a8697d8a7a47a8235a385295bdaf Mon Sep 17 00:00:00 2001 From: Todd Lair Date: Mon, 3 Nov 2025 16:52:07 -0600 Subject: [PATCH 7/7] Removing Veracode scanning from build pipeline --- azure-pipelines.yml | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b940ce9..eb6a775 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,14 +16,6 @@ pool: # name: Azure Pipelines parameters: - - name: RUN_VERACODE_SCAN - displayName: 'Upload to Veracode' - type: boolean - default: true - - name: RUN_VERACODE_SCA - displayName: 'Execute Veracode SCA' - type: boolean - default: true - name: 'Build StackifyLib' type: boolean default: true @@ -243,23 +235,4 @@ stages: $version = "$version".Trim() echo "##vso[task.setvariable variable=version]$version" echo "StackifyLib."$version".nupkg" - workingDirectory: $(Build.SourcesDirectory) - - task: Veracode@3 - displayName: 'Upload and scan: $(Build.ArtifactStagingDirectory)/StackifyLib.$(version).nupkg' - condition: and(succeeded(), eq('${{ parameters.RUN_VERACODE_SCAN }}', 'true')) - enabled: True - inputs: - AnalysisService: 51003f89-58ab-463c-8e20-41484888d9c7 - veracodeAppProfile: Retrace .Net StackifyLib - version: AZ-Devops-Build-$(build.buildNumber) - filepath: $(Build.ArtifactStagingDirectory)/StackifyLib.$(version).nupkg - - - job: SCA - pool: - vmImage: 'windows-latest' - steps: - - task: PowerShell@2 - inputs: - targetType: 'inline' - script: $Env:SRCCLR_API_TOKEN="$(SRCCLR_API_TOKEN)"; Set-ExecutionPolicy AllSigned -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://download.srcclr.com/ci.ps1')); srcclr scan --allow-dirty .; - condition: and(succeeded(), eq('${{ parameters.RUN_VERACODE_SCA }}', 'true')) \ No newline at end of file + workingDirectory: $(Build.SourcesDirectory) \ No newline at end of file