From 6da9d3b34fb0dd61cf8a81290e573e54851fcd07 Mon Sep 17 00:00:00 2001 From: vnugent Date: Sun, 24 Mar 2024 21:17:57 -0400 Subject: Squashed commit of the following: commit 0103116bdc79d2ea8cfeba99d78fed976373f0da Author: vnugent Date: Thu Mar 21 14:36:12 2024 -0400 chore: Update core ReadonlyJWK deserialization commit 2c07ebbbcfdbc0989685de2af85adb0dcf731d30 Author: vnugent Date: Sun Mar 10 21:58:28 2024 -0400 source tree project location updated commit f0c2f505c80d7bec0d674c67439f3f692d44bca7 Merge: d1c17d8 e548175 Author: vnugent Date: Sun Mar 10 16:49:17 2024 -0400 Merge remote-tracking branch 'origin/master' into develop commit d1c17d845d55bdb3c8c51b619ca2c6b5393bc08b Author: vnugent Date: Sat Mar 9 16:30:44 2024 -0500 package updates commit 7a263bf54b7967ddeb9f6b662339ec1c74546ce8 Author: vnugent Date: Sat Mar 9 14:19:31 2024 -0500 refactor: Overhaul secret loading. Remove VaultSharp as a dep commit 766e179d110db4f955fffce55f2b0ad41c139179 Author: vnugent Date: Wed Mar 6 21:35:35 2024 -0500 refactor: changed how service constructors are invoked, moved routing --- Module.Taskfile.yaml | 25 ++++++++++------------ Taskfile.yaml | 11 ++++------ .../src/VNLib.Plugins.Extensions.Data.csproj | 2 +- .../src/Secrets/VaultSecrets.cs | 8 +++---- .../src/VNLib.Plugins.Extensions.Loading.csproj | 8 +++---- .../src/VNLib.Plugins.Extensions.Validation.csproj | 2 +- 6 files changed, 25 insertions(+), 31 deletions(-) diff --git a/Module.Taskfile.yaml b/Module.Taskfile.yaml index 378faca..0d4cd95 100644 --- a/Module.Taskfile.yaml +++ b/Module.Taskfile.yaml @@ -17,13 +17,13 @@ vars: tasks: -#called by build pipeline to sync repo + #called by build pipeline to sync repo update: cmds: - - git remote update - - git reset --hard + - git reset --hard #clean up any local changes + - git remote update - git pull origin {{.BRANCH_NAME}} --verify-signatures - #re-write semver after hard reset so build still works properly + #re-write semver after hard reset - dotnet-gitversion.exe /updateprojectfiles #called by build pipeline to build module @@ -35,24 +35,21 @@ tasks: - task: build_debug - task: build_release - postbuild_success: + publish: cmds: + #git archive in the module directory + - git archive --format {{.ARCHIVE_FILE_FORMAT}} --output {{.ARCHIVE_FILE_NAME}} HEAD #push packages to the sleet feed (feed path is vnbuild global) - sleet push "{{.PACK_OUT}}/debug/" --source debug --config "{{.SLEET_CONFIG_PATH}}" --force - sleet push "{{.PACK_OUT}}/release/" --source release --config "{{.SLEET_CONFIG_PATH}}" --force - #git archive in the module directory - - git archive --format {{.ARCHIVE_FILE_FORMAT}} --output {{.ARCHIVE_FILE_NAME}} HEAD - - postbuild_failed: - cmds: - - echo "postbuild failed {{.MODULE_NAME}}" - #called by build pipeline to clean module clean: cmds: - #clean solution - - dotnet clean /p:BuildInParallel=true /p:MultiProcessorCompilation=true + #clean solution + - dotnet clean /p:BuildInParallel=true /p:MultiProcessorCompilation=true + - cmd: powershell -Command "rm {{ .ARCHIVE_FILE_NAME }} --Force" + ignore_error: true #Internal tasks diff --git a/Taskfile.yaml b/Taskfile.yaml index 2c45b70..2857d21 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -12,7 +12,6 @@ version: '3' vars: TARGET: '{{.USER_WORKING_DIR}}/bin' RELEASE_DIR: "./bin/release/{{.TARGET_FRAMEWORK}}/publish" - SOURCE_OUT: "{{.USER_WORKING_DIR}}/bin/source" tasks: @@ -37,8 +36,7 @@ tasks: postbuild_failed: dir: '{{.USER_WORKING_DIR}}' - cmds: - - echo "postbuild failed {{.PROJECT_NAME}}" + cmds: [] postbuild: @@ -66,8 +64,7 @@ tasks: #Remove the output dirs on clean clean: dir: '{{.USER_WORKING_DIR}}' + ignore_error: true cmds: - - cmd: powershell Remove-Item -Recurse './bin' - ignore_error: true - - cmd: powershell Remove-Item -Recurse './obj' - ignore_error: true + - for: ['bin/', 'obj/'] + cmd: powershell Remove-Item -Recurse '{{.ITEM}}' diff --git a/lib/VNLib.Plugins.Extensions.Data/src/VNLib.Plugins.Extensions.Data.csproj b/lib/VNLib.Plugins.Extensions.Data/src/VNLib.Plugins.Extensions.Data.csproj index a614c31..f846193 100644 --- a/lib/VNLib.Plugins.Extensions.Data/src/VNLib.Plugins.Extensions.Data.csproj +++ b/lib/VNLib.Plugins.Extensions.Data/src/VNLib.Plugins.Extensions.Data.csproj @@ -51,7 +51,7 @@ - + diff --git a/lib/VNLib.Plugins.Extensions.Loading/src/Secrets/VaultSecrets.cs b/lib/VNLib.Plugins.Extensions.Loading/src/Secrets/VaultSecrets.cs index a5ba550..9be74ee 100644 --- a/lib/VNLib.Plugins.Extensions.Loading/src/Secrets/VaultSecrets.cs +++ b/lib/VNLib.Plugins.Extensions.Loading/src/Secrets/VaultSecrets.cs @@ -214,7 +214,7 @@ namespace VNLib.Plugins.Extensions.Loading /// public static PrivateKey GetPrivateKey(this ISecretResult secret) { - _ = secret ?? throw new ArgumentNullException(nameof(secret)); + ArgumentNullException.ThrowIfNull(secret); return new PrivateKey(secret); } @@ -228,15 +228,15 @@ namespace VNLib.Plugins.Extensions.Loading /// public static ReadOnlyJsonWebKey GetJsonWebKey(this ISecretResult secret) { - _ = secret ?? throw new ArgumentNullException(nameof(secret)); - + ArgumentNullException.ThrowIfNull(secret); + //Alloc buffer, utf8 so 1 byte per char using IMemoryHandle buffer = MemoryUtil.SafeAlloc(secret.Result.Length); //Get utf8 bytes int count = Encoding.UTF8.GetBytes(secret.Result, buffer.Span); - return new ReadOnlyJsonWebKey(buffer.Span[..count]); + return ReadOnlyJsonWebKey.FromUtf8Bytes(buffer.Span[..count]); } #nullable disable diff --git a/lib/VNLib.Plugins.Extensions.Loading/src/VNLib.Plugins.Extensions.Loading.csproj b/lib/VNLib.Plugins.Extensions.Loading/src/VNLib.Plugins.Extensions.Loading.csproj index 1dfaa30..be21770 100644 --- a/lib/VNLib.Plugins.Extensions.Loading/src/VNLib.Plugins.Extensions.Loading.csproj +++ b/lib/VNLib.Plugins.Extensions.Loading/src/VNLib.Plugins.Extensions.Loading.csproj @@ -49,10 +49,10 @@ - - - - + + + + diff --git a/lib/VNLib.Plugins.Extensions.Validation/src/VNLib.Plugins.Extensions.Validation.csproj b/lib/VNLib.Plugins.Extensions.Validation/src/VNLib.Plugins.Extensions.Validation.csproj index d56576f..c6c08f9 100644 --- a/lib/VNLib.Plugins.Extensions.Validation/src/VNLib.Plugins.Extensions.Validation.csproj +++ b/lib/VNLib.Plugins.Extensions.Validation/src/VNLib.Plugins.Extensions.Validation.csproj @@ -50,7 +50,7 @@ - + -- cgit