diff --git a/.github/workflows/ingestion_client.yaml b/.github/workflows/ingestion_client.yaml index 17bff3243..f1233c672 100644 --- a/.github/workflows/ingestion_client.yaml +++ b/.github/workflows/ingestion_client.yaml @@ -53,17 +53,17 @@ jobs: run: dotnet publish -c Release -f net8.0 --no-self-contained --output ./StartTranscriptionByTimer samples/ingestion/ingestion-client/StartTranscriptionByTimer/StartTranscriptionByTimer.csproj - name: Zip StartTranscriptionByTimer - run: cd StartTranscriptionByTimer && zip -r ../StartTranscriptionByTimer.zip * + run: cd StartTranscriptionByTimer && zip -r ../StartTranscriptionByTimer.zip . - name: Publish StartTranscriptionByServiceBus function run: dotnet publish -c Release -f net8.0 --no-self-contained --output ./StartTranscriptionByServiceBus samples/ingestion/ingestion-client/StartTranscriptionByServiceBus/StartTranscriptionByServiceBus.csproj - name: Zip StartTranscriptionByServiceBus - run: cd StartTranscriptionByServiceBus && zip -r ../StartTranscriptionByServiceBus.zip * + run: cd StartTranscriptionByServiceBus && zip -r ../StartTranscriptionByServiceBus.zip . - name: Publish FetchTranscription function run: dotnet publish -c Release -f net8.0 --no-self-contained --output ./FetchTranscription samples/ingestion/ingestion-client/FetchTranscription/FetchTranscription.csproj - name: Zip FetchTranscription - run: cd FetchTranscription && zip -r ../FetchTranscription.zip * + run: cd FetchTranscription && zip -r ../FetchTranscription.zip . - name: Create Release id: create_release diff --git a/samples/ingestion/ingestion-client/Connector/Connector.csproj b/samples/ingestion/ingestion-client/Connector/Connector.csproj index b98ce61ed..a6f8e6254 100644 --- a/samples/ingestion/ingestion-client/Connector/Connector.csproj +++ b/samples/ingestion/ingestion-client/Connector/Connector.csproj @@ -8,7 +8,6 @@ - diff --git a/samples/ingestion/ingestion-client/FetchTranscription/Database/DatabaseConfigProvider.cs b/samples/ingestion/ingestion-client/FetchTranscription/Database/DatabaseConfigProvider.cs deleted file mode 100644 index b0e5511c7..000000000 --- a/samples/ingestion/ingestion-client/FetchTranscription/Database/DatabaseConfigProvider.cs +++ /dev/null @@ -1,41 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE.md file in the project root for full license information. -// - -using FetchTranscription; - -using Microsoft.Azure.WebJobs.Hosting; - -[assembly: WebJobsStartup(typeof(DatabaseInitializationService), "DatabaseInitialize")] - -namespace FetchTranscription -{ - using Connector.Database; - - using Microsoft.Azure.WebJobs.Description; - using Microsoft.Azure.WebJobs.Host.Config; - using Microsoft.EntityFrameworkCore; - using Microsoft.Extensions.DependencyInjection; - - [Extension("DatabaseConfig")] - public class DatabaseConfigProvider : IExtensionConfigProvider - { - private readonly IServiceScopeFactory scopeFactory; - - public DatabaseConfigProvider(IServiceScopeFactory scopeFactory) - { - this.scopeFactory = scopeFactory; - } - - public void Initialize(ExtensionConfigContext context) - { - if (FetchTranscriptionEnvironmentVariables.UseSqlDatabase) - { - using var scope = this.scopeFactory.CreateScope(); - var databaseContext = scope.ServiceProvider.GetService(); - databaseContext.Database.Migrate(); - } - } - } -} diff --git a/samples/ingestion/ingestion-client/FetchTranscription/Database/DatabaseInitializationService.cs b/samples/ingestion/ingestion-client/FetchTranscription/Database/DatabaseInitializationService.cs deleted file mode 100644 index 149d1f8aa..000000000 --- a/samples/ingestion/ingestion-client/FetchTranscription/Database/DatabaseInitializationService.cs +++ /dev/null @@ -1,21 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE.md file in the project root for full license information. -// -using FetchTranscription; - -using Microsoft.Azure.WebJobs; -using Microsoft.Azure.WebJobs.Hosting; - -[assembly: WebJobsStartup(typeof(DatabaseInitializationService), "DatabaseInitialize")] - -namespace FetchTranscription -{ - public class DatabaseInitializationService : IWebJobsStartup - { - public void Configure(IWebJobsBuilder builder) - { - builder.AddExtension(); - } - } -} diff --git a/samples/ingestion/ingestion-client/FetchTranscription/FetchTranscription.csproj b/samples/ingestion/ingestion-client/FetchTranscription/FetchTranscription.csproj index 6d04aff1a..08888d244 100644 --- a/samples/ingestion/ingestion-client/FetchTranscription/FetchTranscription.csproj +++ b/samples/ingestion/ingestion-client/FetchTranscription/FetchTranscription.csproj @@ -1,28 +1,32 @@ - - net8.0 - v4 - Exe - - - - - - - - - - - - - - PreserveNewest - - - - - PreserveNewest - Never - - + + net8.0 + v4 + Exe + + + + + + + + + + + + + + + PreserveNewest + + + + + PreserveNewest + Never + + + + + \ No newline at end of file diff --git a/samples/ingestion/ingestion-client/FetchTranscription/Program.cs b/samples/ingestion/ingestion-client/FetchTranscription/Program.cs index bfa5c77ad..f56b41631 100644 --- a/samples/ingestion/ingestion-client/FetchTranscription/Program.cs +++ b/samples/ingestion/ingestion-client/FetchTranscription/Program.cs @@ -5,8 +5,6 @@ namespace FetchTranscription { - using System.Threading.Tasks; - using Connector; using Connector.Database; @@ -16,8 +14,10 @@ namespace FetchTranscription public static class Program { - public static async Task Main(string[] args) + public static void Main(string[] args) { + var useSqlDatabase = FetchTranscriptionEnvironmentVariables.UseSqlDatabase; + var host = new HostBuilder() .ConfigureFunctionsWorkerDefaults() .ConfigureServices(s => @@ -25,7 +25,7 @@ public static async Task Main(string[] args) // This is a unified way to configure logging filter for all functions. s.ConfigureIngestionClientLogging(); - if (FetchTranscriptionEnvironmentVariables.UseSqlDatabase) + if (useSqlDatabase) { s.AddDbContext( options => SqlServerDbContextOptionsExtensions.UseSqlServer(options, FetchTranscriptionEnvironmentVariables.DatabaseConnectionString)); @@ -33,7 +33,15 @@ public static async Task Main(string[] args) }) .Build(); - await host.RunAsync(); + // apply database migrations once during startup (not with every function execution): + if (useSqlDatabase) + { + using var scope = host.Services.CreateScope(); + var ingestionClientDbContext = scope.ServiceProvider.GetRequiredService(); + ingestionClientDbContext.Database.Migrate(); + } + + host.Run(); } } } \ No newline at end of file diff --git a/samples/ingestion/ingestion-client/Setup/ArmTemplateBatch.json b/samples/ingestion/ingestion-client/Setup/ArmTemplateBatch.json index 42105af99..b6034cf37 100644 --- a/samples/ingestion/ingestion-client/Setup/ArmTemplateBatch.json +++ b/samples/ingestion/ingestion-client/Setup/ArmTemplateBatch.json @@ -256,7 +256,7 @@ }, "variables": { - "Version": "v2.1.1", + "Version": "v2.1.2", "AudioInputContainer": "audio-input", "AudioProcessedContainer": "audio-processed", "ErrorFilesOutputContainer": "audio-failed", @@ -895,7 +895,10 @@ "properties": { "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('AppServicePlanName'))]", - "httpsOnly": "true" + "httpsOnly": "true", + "siteConfig": { + "netFrameworkVersion": "v8.0" + } }, "identity": { @@ -966,7 +969,10 @@ "properties": { "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('AppServicePlanName'))]", - "httpsOnly": "true" + "httpsOnly": "true", + "siteConfig": { + "netFrameworkVersion": "v8.0" + } }, "identity": { diff --git a/samples/ingestion/ingestion-client/StartTranscriptionByServiceBus/Program.cs b/samples/ingestion/ingestion-client/StartTranscriptionByServiceBus/Program.cs index 196ce545c..a1ed7cf00 100644 --- a/samples/ingestion/ingestion-client/StartTranscriptionByServiceBus/Program.cs +++ b/samples/ingestion/ingestion-client/StartTranscriptionByServiceBus/Program.cs @@ -5,7 +5,6 @@ namespace StartTranscription { - using System.Threading.Tasks; using Connector; using Microsoft.Extensions.Hosting; @@ -18,8 +17,7 @@ public static class Program /// Main entry point of the function app. /// /// - /// A representing the result of the asynchronous operation. - public static async Task Main(string[] args) + public static void Main(string[] args) { var host = new HostBuilder() .ConfigureFunctionsWorkerDefaults() @@ -30,7 +28,7 @@ public static async Task Main(string[] args) }) .Build(); - await host.RunAsync(); + host.Run(); } } } \ No newline at end of file diff --git a/samples/ingestion/ingestion-client/StartTranscriptionByServiceBus/StartTranscriptionByServiceBus.csproj b/samples/ingestion/ingestion-client/StartTranscriptionByServiceBus/StartTranscriptionByServiceBus.csproj index 841de81eb..490189107 100644 --- a/samples/ingestion/ingestion-client/StartTranscriptionByServiceBus/StartTranscriptionByServiceBus.csproj +++ b/samples/ingestion/ingestion-client/StartTranscriptionByServiceBus/StartTranscriptionByServiceBus.csproj @@ -6,6 +6,7 @@ Exe + @@ -26,4 +27,7 @@ + + + diff --git a/samples/ingestion/ingestion-client/StartTranscriptionByTimer/Program.cs b/samples/ingestion/ingestion-client/StartTranscriptionByTimer/Program.cs index 4f32531b7..110ea2a5d 100644 --- a/samples/ingestion/ingestion-client/StartTranscriptionByTimer/Program.cs +++ b/samples/ingestion/ingestion-client/StartTranscriptionByTimer/Program.cs @@ -5,13 +5,12 @@ namespace StartTranscriptionByTimer { - using System.Threading.Tasks; using Connector; using Microsoft.Extensions.Hosting; public static class Program { - public static async Task Main(string[] args) + public static void Main(string[] args) { var host = new HostBuilder() .ConfigureFunctionsWorkerDefaults() @@ -22,7 +21,7 @@ public static async Task Main(string[] args) }) .Build(); - await host.RunAsync(); + host.Run(); } } } \ No newline at end of file diff --git a/samples/ingestion/ingestion-client/StartTranscriptionByTimer/StartTranscriptionByTimer.csproj b/samples/ingestion/ingestion-client/StartTranscriptionByTimer/StartTranscriptionByTimer.csproj index 311eece4e..8212aed48 100644 --- a/samples/ingestion/ingestion-client/StartTranscriptionByTimer/StartTranscriptionByTimer.csproj +++ b/samples/ingestion/ingestion-client/StartTranscriptionByTimer/StartTranscriptionByTimer.csproj @@ -5,6 +5,7 @@ Exe + @@ -26,4 +27,7 @@ Never + + + \ No newline at end of file diff --git a/samples/ingestion/ingestion-client/versions.nugets.props b/samples/ingestion/ingestion-client/versions.nugets.props index 60c6fe56b..39806e422 100644 --- a/samples/ingestion/ingestion-client/versions.nugets.props +++ b/samples/ingestion/ingestion-client/versions.nugets.props @@ -9,12 +9,11 @@ [2.22.0] - [1.1.0] [1.22.0] - [5.20.0] + [5.13.0] [4.3.1] [1.2.0] - [1.17.1] + [1.15.1] [8.0.6] [8.0.6]