From 719e373c618bec13fe95d9a6f4b39494659b8980 Mon Sep 17 00:00:00 2001 From: paule96 Date: Fri, 12 Jan 2024 20:43:31 +0000 Subject: [PATCH 01/19] upgrade global.json to use dotnet 8 at least --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index e23437b..9bb4dcb 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.100", + "version": "8.0.101", "rollForward": "latestMajor" } } From bfbe82354648e5884350fbac3ba19507ec946815 Mon Sep 17 00:00:00 2001 From: paule96 Date: Fri, 12 Jan 2024 20:44:33 +0000 Subject: [PATCH 02/19] use new devcontainer images and add the new csharp extension --- .devcontainer/Dockerfile | 2 +- .devcontainer/devcontainer.json | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index aaebc05..e82d92a 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -2,7 +2,7 @@ # [Choice] .NET version: 6.0, 5.0, 3.1, 6.0-bullseye, 5.0-bullseye, 3.1-bullseye, 6.0-focal, 5.0-focal, 3.1-focal ARG VARIANT="6.0-bullseye-slim" -FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} +FROM mcr.microsoft.com/devcontainers/dotnet:0-${VARIANT} # [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 ARG NODE_VERSION="none" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1e2ae76..228d00c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,7 +7,7 @@ "args": { // Update 'VARIANT' to pick a .NET Core version: 3.1, 5.0, 6.0 // Append -bullseye or -focal to pin to an OS version. - "VARIANT": "7.0", + "VARIANT": "8.0-bookworm", // Options "NODE_VERSION": "lts/*" } @@ -47,7 +47,9 @@ "cschleiden.vscode-github-actions", "ms-azure-devops.azure-pipelines", "github.vscode-github-actions", - "ms-vscode.powershell" + "ms-vscode.powershell", + "ms-dotnettools.csdevkit", + "ms-dotnettools.vscodeintellicode-csharp" ] } }, From 743f063922df22f90c60ac095914307b28aeb062 Mon Sep 17 00:00:00 2001 From: paule96 Date: Fri, 12 Jan 2024 20:47:03 +0000 Subject: [PATCH 03/19] fix dockerfile --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index e82d92a..eb5cc23 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -2,7 +2,7 @@ # [Choice] .NET version: 6.0, 5.0, 3.1, 6.0-bullseye, 5.0-bullseye, 3.1-bullseye, 6.0-focal, 5.0-focal, 3.1-focal ARG VARIANT="6.0-bullseye-slim" -FROM mcr.microsoft.com/devcontainers/dotnet:0-${VARIANT} +FROM mcr.microsoft.com/devcontainers/dotnet:${VARIANT} # [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 ARG NODE_VERSION="none" From a0b17d201544ba4d66c5078ad759ead7b9283ea7 Mon Sep 17 00:00:00 2001 From: paule96 Date: Fri, 12 Jan 2024 20:56:10 +0000 Subject: [PATCH 04/19] try to use latest ubuntu instead of debian. maybe that helps for the azure functions tools --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 228d00c..cdb367d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,7 +7,7 @@ "args": { // Update 'VARIANT' to pick a .NET Core version: 3.1, 5.0, 6.0 // Append -bullseye or -focal to pin to an OS version. - "VARIANT": "8.0-bookworm", + "VARIANT": "8.0-jammy", // Options "NODE_VERSION": "lts/*" } From d25a167bb73026c14c5d7b330d94fbd58909b9ab Mon Sep 17 00:00:00 2001 From: paule96 Date: Fri, 12 Jan 2024 21:27:51 +0000 Subject: [PATCH 05/19] upgrade the api first --- src/CZ.Azure.FileExchange.Api/AddMetadata.cs | 9 +++----- .../CZ.Azure.FileExchange.Api.csproj | 23 ++++++++++--------- src/CZ.Azure.FileExchange.Api/GenerateSas.cs | 2 +- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/CZ.Azure.FileExchange.Api/AddMetadata.cs b/src/CZ.Azure.FileExchange.Api/AddMetadata.cs index ba89fc8..2520d5b 100644 --- a/src/CZ.Azure.FileExchange.Api/AddMetadata.cs +++ b/src/CZ.Azure.FileExchange.Api/AddMetadata.cs @@ -3,7 +3,6 @@ namespace CZ.Azure.FileExchange.Api; using System; using System.Net; using Microsoft.Azure.Functions.Worker; -using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Attributes; using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Models; using global::Azure.Messaging.EventGrid; @@ -11,17 +10,15 @@ namespace CZ.Azure.FileExchange.Api; using global::Azure.Messaging.EventGrid.SystemEvents; using global::Azure.Storage.Blobs; using System.Globalization; +using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Attributes; -public class AddMetadata +public class AddMetadata(ILoggerFactory loggerFactory) { - private readonly ILogger logger; + private readonly ILogger logger = loggerFactory.CreateLogger(); private const string BlobChanged = "Microsoft.Storage.BlobTierChanged"; private const string SetBlobTier = "SetBlobTier"; private const string AzureValidation = "Microsoft.EventGrid.SubscriptionValidationEvent"; - - public AddMetadata(ILoggerFactory loggerFactory) => this.logger = loggerFactory.CreateLogger(); - [Function("AddMetadata")] [OpenApiOperation(operationId: "Run")] [OpenApiRequestBody("application/json", typeof(IEnumerable))] diff --git a/src/CZ.Azure.FileExchange.Api/CZ.Azure.FileExchange.Api.csproj b/src/CZ.Azure.FileExchange.Api/CZ.Azure.FileExchange.Api.csproj index abba096..129d7dd 100644 --- a/src/CZ.Azure.FileExchange.Api/CZ.Azure.FileExchange.Api.csproj +++ b/src/CZ.Azure.FileExchange.Api/CZ.Azure.FileExchange.Api.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 v4 Exe enable @@ -8,17 +8,18 @@ 84a717a7-ef76-47be-9101-2a62e74fd7d3 - - - - - - + + + + - - - - + + + + + + + diff --git a/src/CZ.Azure.FileExchange.Api/GenerateSas.cs b/src/CZ.Azure.FileExchange.Api/GenerateSas.cs index f018720..cb30d9d 100644 --- a/src/CZ.Azure.FileExchange.Api/GenerateSas.cs +++ b/src/CZ.Azure.FileExchange.Api/GenerateSas.cs @@ -9,9 +9,9 @@ namespace CZ.Azure.FileExchange.Api; using global::Azure.Storage.Blobs; using global::Azure.Storage.Sas; using System.Net.Http; +using Microsoft.Azure.Functions.Worker.Http; using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Attributes; using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Extensions; -using Microsoft.Azure.Functions.Worker.Http; public class GenerateSas { From 8f87de3e4fe947236963affe07c620daa680e6ac Mon Sep 17 00:00:00 2001 From: paule96 Date: Fri, 12 Jan 2024 21:28:09 +0000 Subject: [PATCH 06/19] upgrade frontend --- .../CZ.Azure.FileExchange.csproj | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/CZ.Azure.FileExchange/CZ.Azure.FileExchange.csproj b/src/CZ.Azure.FileExchange/CZ.Azure.FileExchange.csproj index 31c09cb..cb2e8f8 100644 --- a/src/CZ.Azure.FileExchange/CZ.Azure.FileExchange.csproj +++ b/src/CZ.Azure.FileExchange/CZ.Azure.FileExchange.csproj @@ -1,18 +1,15 @@ - - net7.0 + net8.0 enable enable - - - - - + + + + - @@ -27,9 +24,7 @@ - - \ No newline at end of file From 18f47b63dabc78dc78a1e46e2bc55960452384f2 Mon Sep 17 00:00:00 2001 From: paule96 Date: Fri, 12 Jan 2024 21:40:45 +0000 Subject: [PATCH 07/19] update all the deployment and build scripts --- .github/workflows/main.yml | 3 +++ azure-pipelines.yml | 2 +- deploayWebApp.bicep | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 24d07ec..9dca8b3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,6 +17,9 @@ jobs: - uses: actions/checkout@v2 with: submodules: true + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.0.x' - name: Publish Frontend run: dotnet publish -c Release ./src/CZ.Azure.FileExchange/ -o temp/frontend - name: Publish API diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c06301e..65dce5f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -28,7 +28,7 @@ stages: - task: UseDotNet@2 inputs: packageType: 'sdk' - version: '7.x' + version: '8.x' - task: UseDotNet@2 inputs: packageType: 'sdk' diff --git a/deploayWebApp.bicep b/deploayWebApp.bicep index 12e78f3..6a28b9a 100644 --- a/deploayWebApp.bicep +++ b/deploayWebApp.bicep @@ -77,7 +77,7 @@ resource deployPrWebApp 'Microsoft.Resources/deploymentScripts@2020-10-01' = if Set-Location ./artifact/ $secretProperties = Get-AzStaticWebAppSecret -Name $staticWebAppName -ResourceGroupName $resourceGroupName $token = $secretProperties.Property.Item("apiKey") - ./deploy.ps1 -Token $token -appBuildOutput ./frontend.zip -apiBuildOutput ./api.zip -apiFramework "dotnetisolated" -apiFrameworkVersion "7.0" -workingDir $pwd -branchName $branch -envrionmentName $prNumber -Verbose + ./deploy.ps1 -Token $token -appBuildOutput ./frontend.zip -apiBuildOutput ./api.zip -apiFramework "dotnetisolated" -apiFrameworkVersion "8.0" -workingDir $pwd -branchName $branch -envrionmentName $prNumber -Verbose # for azure Deployment Script output $DeploymentScriptOutputs = @{} $DeploymentScriptOutputs['staticWebUrl'] = "https://$((Get-AzStaticWebAppBuild -Name $staticWebAppName -ResourceGroupName $resourceGroupName -EnvironmentName $prNumber).Hostname)" From a2495e8a0c3666a8e575a39a1afb8fc4108c2ed9 Mon Sep 17 00:00:00 2001 From: paule96 Date: Mon, 15 Jan 2024 19:49:32 +0100 Subject: [PATCH 08/19] Change static we app. Configure to maybe fix the deployment issue --- src/CZ.Azure.FileExchange/staticwebapp.config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CZ.Azure.FileExchange/staticwebapp.config.json b/src/CZ.Azure.FileExchange/staticwebapp.config.json index c1cce95..d988497 100644 --- a/src/CZ.Azure.FileExchange/staticwebapp.config.json +++ b/src/CZ.Azure.FileExchange/staticwebapp.config.json @@ -1,5 +1,5 @@ { "platform": { - "apiRuntime": "dotnet-isolated:7.0" + "apiRuntime": "dotnet-isolated:8.0" } } From 65ba87a655144e28a6a8aca45c5a299d8c5823c8 Mon Sep 17 00:00:00 2001 From: paule96 Date: Tue, 16 Jan 2024 20:36:34 +0000 Subject: [PATCH 09/19] improve the docs a bit --- Readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index 3da23aa..22d30cc 100644 --- a/Readme.md +++ b/Readme.md @@ -41,9 +41,9 @@ $token = Read-Host -MaskInput; > Important: If you want deploy this, build it on linux! ```powershell -dotnet build -dotnet publish .\src\CZ.Azure.FileExchange\ -o temp/fe -dotnet publish .\src\CZ.Azure.FileExchange.Api\ -o temp/api +dotnet build -c Release +dotnet publish -c Release .\src\CZ.Azure.FileExchange\ -o temp/fe +dotnet publish --runtime win-x86 --no-self-contained -c Release .\src\CZ.Azure.FileExchange.Api\ -o temp/api ``` ### Run the App local From fbb2ace29e8ed20b8096d51a8dcde2d7961e4348 Mon Sep 17 00:00:00 2001 From: paule96 Date: Tue, 16 Jan 2024 20:36:51 +0000 Subject: [PATCH 10/19] improve vscode settings --- .vscode/settings.json | 2 +- .vscode/tasks.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index cc25882..0298f5f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,6 @@ { "azureFunctions.projectSubpath": "src/CZ.Azure.FileExchange.Api", - "azureFunctions.deploySubpath": "src/CZ.Azure.FileExchange.Api/bin/Release/net7.0/publish", + "azureFunctions.deploySubpath": "src/CZ.Azure.FileExchange.Api/bin/Release/net8.0/publish", "azureFunctions.projectLanguage": "C#", "azureFunctions.projectRuntime": "~4", "debug.internalConsoleOptions": "neverOpen", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 47d34ac..fb93296 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -107,7 +107,7 @@ "type": "func", "dependsOn": "build (functions)", "options": { - "cwd": "${workspaceFolder}/src/CZ.Azure.FileExchange.Api/bin/Debug/net7.0" + "cwd": "${workspaceFolder}/src/CZ.Azure.FileExchange.Api/bin/Debug/net8.0" }, "command": "host start", "isBackground": true, From 26994539746d5ceed29d3a2987a9ace3ea16db06 Mon Sep 17 00:00:00 2001 From: paule96 Date: Tue, 16 Jan 2024 20:38:10 +0000 Subject: [PATCH 11/19] add dotnet 8.0 to more places --- .devcontainer/devcontainer.json | 2 +- .github/workflows/main.yml | 2 +- src/CZ.Azure.FileExchange/wwwroot/staticwebapp.config.json | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index cdb367d..2e0008f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -17,7 +17,7 @@ "version": "latest" }, "ghcr.io/devcontainers/features/dotnet": { - "version": "7.0", + "version": "8.0", "additionalVersions": "6.0", "runtimeOnly": false }, diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9dca8b3..e4a1540 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -113,5 +113,5 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} continue-on-error: true - name: Deploy - run: './build/deploy.ps1 -Token ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_KINDDUNE004C2C103 }} -appBuildOutput ./temp/frontend/wwwroot/ -apiBuildOutput ./temp/api/ -envrionmentName ${{ github.event.number }} -pullrequestTitle "${{steps.Pr-Title.outputs.pr-title}}" -branchName ${{ github.head_ref }} -apiFramework "dotnetisolated" -apiFrameworkVersion "7.0" -Verbose -Delete' + run: './build/deploy.ps1 -Token ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_KINDDUNE004C2C103 }} -appBuildOutput ./temp/frontend/wwwroot/ -apiBuildOutput ./temp/api/ -envrionmentName ${{ github.event.number }} -pullrequestTitle "${{steps.Pr-Title.outputs.pr-title}}" -branchName ${{ github.head_ref }} -apiFramework "dotnetisolated" -apiFrameworkVersion "8.0" -Verbose -Delete' shell: pwsh \ No newline at end of file diff --git a/src/CZ.Azure.FileExchange/wwwroot/staticwebapp.config.json b/src/CZ.Azure.FileExchange/wwwroot/staticwebapp.config.json index 927e895..e44431e 100644 --- a/src/CZ.Azure.FileExchange/wwwroot/staticwebapp.config.json +++ b/src/CZ.Azure.FileExchange/wwwroot/staticwebapp.config.json @@ -1,4 +1,7 @@ { + "platform": { + "apiRuntime": "dotnet-isolated:8.0" + }, "navigationFallback": { "rewrite": "/index.html", "exclude": [ From 015d8607dd2ef624518363d747f10eeb44a64ac0 Mon Sep 17 00:00:00 2001 From: paule96 Date: Tue, 16 Jan 2024 20:49:14 +0000 Subject: [PATCH 12/19] change even more to dotnet 8 --- deploayWebApp.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploayWebApp.bicep b/deploayWebApp.bicep index 6a28b9a..0d6da96 100644 --- a/deploayWebApp.bicep +++ b/deploayWebApp.bicep @@ -127,7 +127,7 @@ resource deployWebApp 'Microsoft.Resources/deploymentScripts@2020-10-01' = if (e $secretProperties = Get-AzStaticWebAppSecret -Name $staticWebAppName -ResourceGroupName $resourceGroupName $token = $secretProperties.Property.Item("apiKey") $token.Substring(0,5) - ./deploy.ps1 -Token $token -appBuildOutput ./frontend.zip -apiBuildOutput ./api.zip -apiFramework "dotnetisolated" -apiFrameworkVersion "7.0" -workingDir $pwd -Verbose + ./deploy.ps1 -Token $token -appBuildOutput ./frontend.zip -apiBuildOutput ./api.zip -apiFramework "dotnetisolated" -apiFrameworkVersion "8.0" -workingDir $pwd -Verbose $DeploymentScriptOutputs = @{} $DeploymentScriptOutputs['staticWebUrl'] = "https://$((Get-AzStaticWebApp -Name $staticWebAppName -ResourceGroupName $resourceGroupName).DefaultHostname)" ''' From 205137f1e562d45833c03b4b93dda522b93e4188 Mon Sep 17 00:00:00 2001 From: paule96 Date: Tue, 16 Jan 2024 20:52:01 +0000 Subject: [PATCH 13/19] improve logging in bicep --- deploayWebApp.bicep | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/deploayWebApp.bicep b/deploayWebApp.bicep index 0d6da96..6acffb2 100644 --- a/deploayWebApp.bicep +++ b/deploayWebApp.bicep @@ -54,6 +54,8 @@ resource deployPrWebApp 'Microsoft.Resources/deploymentScripts@2020-10-01' = if [string] $branch, [string] $prNumber ) + # this makes it easier for us to read the log output + $PSStyle.OutputRendering = [System.Management.Automation.OutputRendering]::PlainText; try{ # download artifact from pipeline run $workflowArtifactUrl = "$($githubRuntimeApiUrl)_apis/pipelines/workflows/$githubRunId/artifacts"; @@ -112,6 +114,8 @@ resource deployWebApp 'Microsoft.Resources/deploymentScripts@2020-10-01' = if (e [string] $staticWebAppName, [string] $resourceGroupName ) + # this makes it easier for us to read the log output + $PSStyle.OutputRendering = [System.Management.Automation.OutputRendering]::PlainText; # take stable releases here $result = Invoke-RestMethod https://api.github.com/repos/codez-one/CZ.Azure.FileExchange/releases/latest -Headers @{"X-GitHub-Api-Version" = "2022-11-28" } $frontendDownloadUrl = ($result.assets | ? {$_.name -like 'Frontend.zip'}).browser_download_url; From d29aab95d54a02ab1ec18e3b3e1ec808ab9a2bda Mon Sep 17 00:00:00 2001 From: paule96 Date: Tue, 16 Jan 2024 20:53:04 +0000 Subject: [PATCH 14/19] change for the new azure functions host --- src/CZ.Azure.FileExchange.Api/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CZ.Azure.FileExchange.Api/Program.cs b/src/CZ.Azure.FileExchange.Api/Program.cs index b9968b5..2aee59d 100644 --- a/src/CZ.Azure.FileExchange.Api/Program.cs +++ b/src/CZ.Azure.FileExchange.Api/Program.cs @@ -7,7 +7,7 @@ { services.AddHttpClient(); }) - .ConfigureFunctionsWorkerDefaults(worker => worker.UseNewtonsoftJson()) + .ConfigureFunctionsWebApplication(worker => worker.UseNewtonsoftJson()) .ConfigureOpenApi() .Build(); From b9f192e82873b9266f9f0d29cc23790de79d3de7 Mon Sep 17 00:00:00 2001 From: paule96 Date: Tue, 16 Jan 2024 22:08:12 +0000 Subject: [PATCH 15/19] add some recommendations for azure functions projects --- .../CZ.Azure.FileExchange.Api.csproj | 3 +++ src/CZ.Azure.FileExchange.Api/GenerateSas.cs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/CZ.Azure.FileExchange.Api/CZ.Azure.FileExchange.Api.csproj b/src/CZ.Azure.FileExchange.Api/CZ.Azure.FileExchange.Api.csproj index 129d7dd..5906cff 100644 --- a/src/CZ.Azure.FileExchange.Api/CZ.Azure.FileExchange.Api.csproj +++ b/src/CZ.Azure.FileExchange.Api/CZ.Azure.FileExchange.Api.csproj @@ -7,6 +7,9 @@ enable 84a717a7-ef76-47be-9101-2a62e74fd7d3 + + + diff --git a/src/CZ.Azure.FileExchange.Api/GenerateSas.cs b/src/CZ.Azure.FileExchange.Api/GenerateSas.cs index cb30d9d..1054725 100644 --- a/src/CZ.Azure.FileExchange.Api/GenerateSas.cs +++ b/src/CZ.Azure.FileExchange.Api/GenerateSas.cs @@ -52,13 +52,13 @@ public async Task Run( var badResponse = req.CreateResponse(HttpStatusCode.BadRequest); var badContent = new StringContent("Failed to greate SaS token to upload your files. Please try again."); badResponse.Headers.Add("Content-Type", badContent.Headers.ContentType?.ToString()); - badResponse.WriteString(await badContent.ReadAsStringAsync()); + await badResponse.WriteStringAsync(await badContent.ReadAsStringAsync()); return badResponse; } var okResponse = req.CreateResponse(HttpStatusCode.OK); var content = new StringContent(uri.ToString()); okResponse.Headers.Add("Content-Type", content.Headers.ContentType?.ToString()); - okResponse.WriteString(await content.ReadAsStringAsync()); + await okResponse.WriteStringAsync(await content.ReadAsStringAsync()); return okResponse; } From b1452debb3c5b41023c741d53f74fa5ab521d3b2 Mon Sep 17 00:00:00 2001 From: paule96 Date: Tue, 16 Jan 2024 22:08:37 +0000 Subject: [PATCH 16/19] use azurerite v3 for cors settings --- Readme.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 22d30cc..208ce56 100644 --- a/Readme.md +++ b/Readme.md @@ -71,13 +71,14 @@ $body = " " $lenght = $body.Length; +$bodyMd5 = ([System.BitConverter]::ToString((New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider).ComputeHash((New-Object -TypeName System.Text.UTF8Encoding).GetBytes($body)))).Replace("-",""); $hmacsha = New-Object System.Security.Cryptography.HMACSHA256; $hmacsha.key = [Convert]::FromBase64String($accountKey); $date = (Get-Date).ToUniversalTime().ToString("R"); -$test = "PUT`n`n`n$lenght`n`n`n`n`n`n`n`n`nx-ms-date:$($date)`nx-ms-version:2018-03-28`n/devstoreaccount1/devstoreaccount1`ncomp:properties`nrestype:service"; +$test = "PUT`n`n`n$lenght`n`napplication/x-www-form-urlencoded`n`n`n`n`n`n`nx-ms-date:$($date)`nx-ms-version:2024-02-04`n/devstoreaccount1/devstoreaccount1`ncomp:properties`nrestype:service"; $signature1 = $hmacsha.ComputeHash([Text.Encoding]::UTF8.GetBytes($test)); $auth = [System.Convert]::ToBase64String($signature1); -Invoke-WebRequest -Method Put "http://127.0.0.1:10000/devstoreaccount1?restype=service&comp=properties" -Headers @{"Authorization" = "SharedKey devstoreaccount1:$($auth)"; "x-ms-version"= "2018-03-28"; "x-ms-date" = $date } -Body $body +Invoke-WebRequest -Method Put "http://127.0.0.1:10000/devstoreaccount1?restype=service&comp=properties" -Headers @{"Authorization" = "SharedKey devstoreaccount1:$($auth)"; "x-ms-version"= "2024-02-04"; "x-ms-date" = $date } -Body $body ``` From a1d365b822cd97f142a0405576e43d18c57a3fc0 Mon Sep 17 00:00:00 2001 From: Paul Jeschke Date: Sat, 16 Mar 2024 20:14:56 +0000 Subject: [PATCH 17/19] add resource monitor to dev container --- .devcontainer/devcontainer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 2e0008f..cedd39a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -49,7 +49,8 @@ "github.vscode-github-actions", "ms-vscode.powershell", "ms-dotnettools.csdevkit", - "ms-dotnettools.vscodeintellicode-csharp" + "ms-dotnettools.vscodeintellicode-csharp", + "chneau.resource-monitor" ] } }, From b82301bd4c2a87270215dfbbb5cffe83ed2e5663 Mon Sep 17 00:00:00 2001 From: paule96 Date: Wed, 15 May 2024 16:38:56 +0200 Subject: [PATCH 18/19] trigger ci --- Readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Readme.md b/Readme.md index 208ce56..2b3e2fc 100644 --- a/Readme.md +++ b/Readme.md @@ -116,3 +116,4 @@ $PrId = "Replace this string with the Id of your PR here"; $PrTitle = "Replace this string with the title of your PR"; ./build/deploy.ps1 -Token $token -appBuildOutput ./temp/fe/wwwroot/ -apiBuildOutput ./temp/api/ -envrionmentName $PrId -pullrequestTitle $PrTitle -branchName $branchName -Delete ``` + From 91cb374fa9c8f82647291fccc65454d5084e9998 Mon Sep 17 00:00:00 2001 From: paule96 Date: Wed, 15 May 2024 17:11:58 +0200 Subject: [PATCH 19/19] try it with selfcontain --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e4a1540..c827c6c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: - name: Publish Frontend run: dotnet publish -c Release ./src/CZ.Azure.FileExchange/ -o temp/frontend - name: Publish API - run: dotnet publish -c Release ./src/CZ.Azure.FileExchange.Api/ -o temp/api --runtime win-x86 --no-self-contained + run: dotnet publish -c Release ./src/CZ.Azure.FileExchange.Api/ -o temp/api --runtime win-x86 --self-contained - name: zip outputs shell: pwsh run: | @@ -114,4 +114,4 @@ jobs: continue-on-error: true - name: Deploy run: './build/deploy.ps1 -Token ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_KINDDUNE004C2C103 }} -appBuildOutput ./temp/frontend/wwwroot/ -apiBuildOutput ./temp/api/ -envrionmentName ${{ github.event.number }} -pullrequestTitle "${{steps.Pr-Title.outputs.pr-title}}" -branchName ${{ github.head_ref }} -apiFramework "dotnetisolated" -apiFrameworkVersion "8.0" -Verbose -Delete' - shell: pwsh \ No newline at end of file + shell: pwsh