From b256d61dd73c0f093c8d0906f62595fcea9e4e5d Mon Sep 17 00:00:00 2001 From: Karol Berezicki Date: Sun, 19 Mar 2023 16:23:03 +0100 Subject: [PATCH 1/6] Update Episerver packages, enable Multitargeting --- .gitignore | 3 ++- Directory.Build.props | 5 ++--- build/dependencies.props | 11 ++++++----- build/version.props | 4 ++-- docker-compose.yml | 10 +++++----- global.json | 8 ++++---- sample/AlloyMvcTemplate/AlloyMvcTemplates.csproj | 9 ++++----- src/EPiServer.Search.Cms/EPiServer.Search.Cms.csproj | 7 +++---- src/EPiServer.Search.Cms/Job/IndexingJob.cs | 8 +++++++- .../EPiServer.Search.IndexingService.csproj | 10 +++++----- .../Search.Dockerfile | 6 +++--- .../Core/ContentSearchHandlerTests.cs | 8 ++++---- .../EPiServer.Search.Cms.Test.csproj | 12 ++++++------ .../EPiServer.Search.IndexingService.Test.csproj | 12 ++++++------ 14 files changed, 59 insertions(+), 54 deletions(-) diff --git a/.gitignore b/.gitignore index 3cde79f..ff4cc4f 100644 --- a/.gitignore +++ b/.gitignore @@ -179,4 +179,5 @@ EPiServer.Search.Cms.zip sample/AlloyMvcTemplate/App_Data/** sample/AlloyMvcTemplate/App_Code/** /nupkgs -/modules \ No newline at end of file +/modules +.idea diff --git a/Directory.Build.props b/Directory.Build.props index bc92b93..884d0c2 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,9 +2,8 @@ - net5.0 - 9.0 - true + net6.0;net7.0 + latest false true true diff --git a/build/dependencies.props b/build/dependencies.props index 08a3170..4d54213 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,14 +1,15 @@ - 12.5.0 - [12.5.0,13) + [12.17.1,13) + [12.13.1,13) + [12.17.1,13) 4.8.0-beta00015 - + - - + + diff --git a/build/version.props b/build/version.props index f6263bd..b3322a2 100644 --- a/build/version.props +++ b/build/version.props @@ -1,8 +1,8 @@ - 10.0.0 + 10.1.0 - \ No newline at end of file + diff --git a/docker-compose.yml b/docker-compose.yml index 1a575ca..e4ee4d5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,17 +4,17 @@ services: search: build: dockerfile: ./src/EPiServer.Search.IndexingService/Search.Dockerfile - context: . + context: . environment: ASPNETCORE_URLS: http://*:80 ASPNETCORE_ENVIRONMENT: Production - + ports: - - 5000:80 + - 5997:80 image: episerver.search.indexingservice:latest - container_name: EPiServer.Search.IndexingService + container_name: EPiServer.Search.IndexingService volumes: - shared-folder:/app/App_Data volumes: - shared-folder: \ No newline at end of file + shared-folder: diff --git a/global.json b/global.json index 4ba0352..36e1a9e 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,7 @@ { "sdk": { - "version": "6.0.100", - "architecture": "x64", - "rollForward": "minor" + "version": "7.0.0", + "rollForward": "latestMajor", + "allowPrerelease": false } -} +} \ No newline at end of file diff --git a/sample/AlloyMvcTemplate/AlloyMvcTemplates.csproj b/sample/AlloyMvcTemplate/AlloyMvcTemplates.csproj index 43e26c1..7996936 100644 --- a/sample/AlloyMvcTemplate/AlloyMvcTemplates.csproj +++ b/sample/AlloyMvcTemplate/AlloyMvcTemplates.csproj @@ -1,15 +1,14 @@ - - net6.0 + net7.0 NU5100 - - - + + + diff --git a/src/EPiServer.Search.Cms/EPiServer.Search.Cms.csproj b/src/EPiServer.Search.Cms/EPiServer.Search.Cms.csproj index 28f84c7..8be3b26 100644 --- a/src/EPiServer.Search.Cms/EPiServer.Search.Cms.csproj +++ b/src/EPiServer.Search.Cms/EPiServer.Search.Cms.csproj @@ -1,8 +1,7 @@ - net6.0 + net6.0;net7.0 - @@ -10,7 +9,7 @@ - - + + diff --git a/src/EPiServer.Search.Cms/Job/IndexingJob.cs b/src/EPiServer.Search.Cms/Job/IndexingJob.cs index 9c4f1c7..f536f92 100644 --- a/src/EPiServer.Search.Cms/Job/IndexingJob.cs +++ b/src/EPiServer.Search.Cms/Job/IndexingJob.cs @@ -1,3 +1,5 @@ +using System; +using EPiServer.Core; using EPiServer.DataAbstraction; using EPiServer.PlugIn; using EPiServer.ServiceLocation; @@ -31,7 +33,11 @@ public IndexingJob(IIndexingJobService indexingJobService) /// /// Executes the specified context. /// - public override string Execute() => _indexingJobService.Start(OnStatusChanged); + public override string Execute() + { + using var contentCacheScope = new ContentCacheScope { SlidingExpiration = TimeSpan.Zero }; + return _indexingJobService.Start(OnStatusChanged); + } /// /// Stops the indexing job. diff --git a/src/EPiServer.Search.IndexingService/EPiServer.Search.IndexingService.csproj b/src/EPiServer.Search.IndexingService/EPiServer.Search.IndexingService.csproj index 9672a41..8cf1457 100644 --- a/src/EPiServer.Search.IndexingService/EPiServer.Search.IndexingService.csproj +++ b/src/EPiServer.Search.IndexingService/EPiServer.Search.IndexingService.csproj @@ -1,13 +1,13 @@  - net6.0 + net6.0;net7.0 - - - - + + + + diff --git a/src/EPiServer.Search.IndexingService/Search.Dockerfile b/src/EPiServer.Search.IndexingService/Search.Dockerfile index a77e906..9839872 100644 --- a/src/EPiServer.Search.IndexingService/Search.Dockerfile +++ b/src/EPiServer.Search.IndexingService/Search.Dockerfile @@ -1,8 +1,8 @@ -FROM mcr.microsoft.com/dotnet/aspnet:6.0-bullseye-slim AS base +FROM mcr.microsoft.com/dotnet/aspnet:7.0-bullseye-slim AS base WORKDIR /app EXPOSE 8000 -FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:7.0-bullseye-slim AS build WORKDIR /src COPY ["src/EPiServer.Search.IndexingService/EPiServer.Search.IndexingService.csproj", "EPiServer.Search.IndexingService/"] RUN dotnet restore "EPiServer.Search.IndexingService/EPiServer.Search.IndexingService.csproj" @@ -11,7 +11,7 @@ COPY ["src/EPiServer.Search.IndexingService/", "EPiServer.Search.IndexingService RUN dotnet build "EPiServer.Search.IndexingService/EPiServer.Search.IndexingService.csproj" -c Release -o /app/build FROM build AS publish -RUN dotnet publish "EPiServer.Search.IndexingService/EPiServer.Search.IndexingService.csproj" -c Release -o /app/publish +RUN dotnet publish "EPiServer.Search.IndexingService/EPiServer.Search.IndexingService.csproj" -c Release -o /app/publish --framework net7.0 FROM base AS final WORKDIR /app diff --git a/test/EPiServer.Search.Cms.Test/Core/ContentSearchHandlerTests.cs b/test/EPiServer.Search.Cms.Test/Core/ContentSearchHandlerTests.cs index 6527fc0..938f63a 100644 --- a/test/EPiServer.Search.Cms.Test/Core/ContentSearchHandlerTests.cs +++ b/test/EPiServer.Search.Cms.Test/Core/ContentSearchHandlerTests.cs @@ -100,7 +100,7 @@ public void Dispose() public void UpdateItem_WhenContentIsProvided_ShouldUseContentGuidAndLanguageAsId() { var sharedBlockCreator = new SharedBlockFactory(null, new ConstructorParameterResolver(), - new ServiceLocation.ServiceAccessor(() => new ContentDataInterceptor(new ContentDataInterceptorHandler(new ConstructorParameterResolver())))); + new ServiceLocation.ServiceAccessor(() => new ContentDataInterceptor(new ContentDataInterceptorHandler(new ConstructorParameterResolver()))), _contentTypeRepositoryMock.Object); _testSubject.ServiceActive = true; var block = sharedBlockCreator.CreateSharedBlock(typeof(BlockData)); @@ -119,7 +119,7 @@ public void UpdateItem_WhenContentIsProvided_ShouldUseContentGuidAndLanguageAsId public void UpdateItem_WhenContentIsProvided_ShouldUseNameAsTitle() { var sharedBlockCreator = new SharedBlockFactory(null, new ConstructorParameterResolver(), - new ServiceLocation.ServiceAccessor(() => new ContentDataInterceptor(new ContentDataInterceptorHandler(new ConstructorParameterResolver())))); + new ServiceLocation.ServiceAccessor(() => new ContentDataInterceptor(new ContentDataInterceptorHandler(new ConstructorParameterResolver()))), _contentTypeRepositoryMock.Object); _testSubject.ServiceActive = true; var block = sharedBlockCreator.CreateSharedBlock(typeof(BlockData)); @@ -427,7 +427,7 @@ public void GetSearchResult_WhenQueryIsExecuted_ShouldUseSuppliedExpression() public void GetSearchResult_WhenQueryIsExecuted_ContentQueryShouldBeAdded() { var sharedBlockCreator = new SharedBlockFactory(null, new ConstructorParameterResolver(), - new ServiceLocation.ServiceAccessor(() => new ContentDataInterceptor(new ContentDataInterceptorHandler(new ConstructorParameterResolver())))); + new ServiceLocation.ServiceAccessor(() => new ContentDataInterceptor(new ContentDataInterceptorHandler(new ConstructorParameterResolver()))), _contentTypeRepositoryMock.Object); var content = sharedBlockCreator.CreateSharedBlock(typeof(BlockData)); content.ContentLink = new ContentReference(1); _contentRepositoryMock.Setup(r => r.Get(It.IsAny())).Returns(content); @@ -456,7 +456,7 @@ public void GetSearchResult_WhenQueryIsExecuted_CurrentUserShouldBeAddedToAcl() .Callback((q, p, o) => { q.AddUser(p.Identity.Name); }); var sharedBlockCreator = new SharedBlockFactory(null, new ConstructorParameterResolver(), - new ServiceLocation.ServiceAccessor(() => new ContentDataInterceptor(new ContentDataInterceptorHandler(new ConstructorParameterResolver())))); + new ServiceLocation.ServiceAccessor(() => new ContentDataInterceptor(new ContentDataInterceptorHandler(new ConstructorParameterResolver()))), _contentTypeRepositoryMock.Object); var content = sharedBlockCreator.CreateSharedBlock(typeof(BlockData)); content.ContentLink = new ContentReference(1); _contentRepositoryMock.Setup(r => r.Get(It.IsAny())).Returns(content); diff --git a/test/EPiServer.Search.Cms.Test/EPiServer.Search.Cms.Test.csproj b/test/EPiServer.Search.Cms.Test/EPiServer.Search.Cms.Test.csproj index 191ed2e..29037dd 100644 --- a/test/EPiServer.Search.Cms.Test/EPiServer.Search.Cms.Test.csproj +++ b/test/EPiServer.Search.Cms.Test/EPiServer.Search.Cms.Test.csproj @@ -1,20 +1,20 @@  - net6.0 + net7.0 false - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/test/EPiServer.Search.IndexingService.Test/EPiServer.Search.IndexingService.Test.csproj b/test/EPiServer.Search.IndexingService.Test/EPiServer.Search.IndexingService.Test.csproj index 7319a5c..353ab93 100644 --- a/test/EPiServer.Search.IndexingService.Test/EPiServer.Search.IndexingService.Test.csproj +++ b/test/EPiServer.Search.IndexingService.Test/EPiServer.Search.IndexingService.Test.csproj @@ -7,15 +7,15 @@ - - - - - + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all From 21ea89ee93026f4551480e4b32ba98978d6ee214 Mon Sep 17 00:00:00 2001 From: Karol Berezicki Date: Sun, 19 Mar 2023 20:53:31 +0100 Subject: [PATCH 2/6] Revert port change in docker-compose --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index e4ee4d5..d61c7ae 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,7 @@ services: ASPNETCORE_ENVIRONMENT: Production ports: - - 5997:80 + - 5000:80 image: episerver.search.indexingservice:latest container_name: EPiServer.Search.IndexingService volumes: From 1e1ced69f979c20548af53e17a830b58d8a86d9a Mon Sep 17 00:00:00 2001 From: Karol Berezicki Date: Sat, 25 Mar 2023 19:58:29 +0100 Subject: [PATCH 3/6] Use depenedencies defined in props --- src/EPiServer.Search.Cms/EPiServer.Search.Cms.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EPiServer.Search.Cms/EPiServer.Search.Cms.csproj b/src/EPiServer.Search.Cms/EPiServer.Search.Cms.csproj index 8be3b26..646068c 100644 --- a/src/EPiServer.Search.Cms/EPiServer.Search.Cms.csproj +++ b/src/EPiServer.Search.Cms/EPiServer.Search.Cms.csproj @@ -9,7 +9,7 @@ - - + + From 37fb28ba842373ec51b789e1aa5a286ced94fbd8 Mon Sep 17 00:00:00 2001 From: Karol Berezicki Date: Sat, 25 Mar 2023 19:59:07 +0100 Subject: [PATCH 4/6] Default target LTS --- Directory.Build.props | 2 +- src/EPiServer.Search.Cms/EPiServer.Search.Cms.csproj | 2 +- test/EPiServer.Search.Cms.Test/EPiServer.Search.Cms.Test.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 884d0c2..5b74807 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,7 +2,7 @@ - net6.0;net7.0 + net6.0 latest false true diff --git a/src/EPiServer.Search.Cms/EPiServer.Search.Cms.csproj b/src/EPiServer.Search.Cms/EPiServer.Search.Cms.csproj index 646068c..0754c17 100644 --- a/src/EPiServer.Search.Cms/EPiServer.Search.Cms.csproj +++ b/src/EPiServer.Search.Cms/EPiServer.Search.Cms.csproj @@ -1,6 +1,6 @@ - net6.0;net7.0 + net6.0 diff --git a/test/EPiServer.Search.Cms.Test/EPiServer.Search.Cms.Test.csproj b/test/EPiServer.Search.Cms.Test/EPiServer.Search.Cms.Test.csproj index 29037dd..8219588 100644 --- a/test/EPiServer.Search.Cms.Test/EPiServer.Search.Cms.Test.csproj +++ b/test/EPiServer.Search.Cms.Test/EPiServer.Search.Cms.Test.csproj @@ -1,7 +1,7 @@  - net7.0 + net6.0 false From a008689a678635008e61af1abca793fb6d7f2389 Mon Sep 17 00:00:00 2001 From: Karol Berezicki Date: Sat, 25 Mar 2023 19:59:30 +0100 Subject: [PATCH 5/6] Target .NET 7 in IndexingService --- .../EPiServer.Search.IndexingService.csproj | 2 +- .../EPiServer.Search.IndexingService.Test.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EPiServer.Search.IndexingService/EPiServer.Search.IndexingService.csproj b/src/EPiServer.Search.IndexingService/EPiServer.Search.IndexingService.csproj index 8cf1457..aa17496 100644 --- a/src/EPiServer.Search.IndexingService/EPiServer.Search.IndexingService.csproj +++ b/src/EPiServer.Search.IndexingService/EPiServer.Search.IndexingService.csproj @@ -1,6 +1,6 @@  - net6.0;net7.0 + net7.0 diff --git a/test/EPiServer.Search.IndexingService.Test/EPiServer.Search.IndexingService.Test.csproj b/test/EPiServer.Search.IndexingService.Test/EPiServer.Search.IndexingService.Test.csproj index 353ab93..438b99b 100644 --- a/test/EPiServer.Search.IndexingService.Test/EPiServer.Search.IndexingService.Test.csproj +++ b/test/EPiServer.Search.IndexingService.Test/EPiServer.Search.IndexingService.Test.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 false From 556d1dd500860b33b0c133df293f1409a5317b00 Mon Sep 17 00:00:00 2001 From: Karol Berezicki Date: Wed, 12 Apr 2023 18:53:00 +0200 Subject: [PATCH 6/6] Updated checkout and setup-dotnet actions --- .github/workflows/ci-client.yml | 11 ++++++----- .github/workflows/ci-service.yml | 10 ++++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-client.yml b/.github/workflows/ci-client.yml index 32e045f..b0683d7 100644 --- a/.github/workflows/ci-client.yml +++ b/.github/workflows/ci-client.yml @@ -23,19 +23,20 @@ jobs: versionSuffix: ${{ github.ref == 'refs/heads/develop' && 'pre-' || 'ci-' }}${{github.RUN_NUMBER }} steps: - name: Checkout repository - uses: actions/checkout@v1 - - name: Setup .NET Core @ Latest - uses: actions/setup-dotnet@v1 + uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 with: + dotnet-version: '7.0.x' source-url: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json env: NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - + - name: Restore run: dotnet restore - name: Build (Release version) if: ${{ github.ref == 'refs/heads/main' }} - run: dotnet build --no-restore --configuration $env:buildConfiguration + run: dotnet build --no-restore --configuration $env:buildConfiguration - name: Build (Pre-Release version) if: ${{ github.ref != 'refs/heads/main' }} run: dotnet build --no-restore --configuration $env:buildConfiguration --version-suffix $env:versionSuffix diff --git a/.github/workflows/ci-service.yml b/.github/workflows/ci-service.yml index b46d7c5..f28a1f5 100644 --- a/.github/workflows/ci-service.yml +++ b/.github/workflows/ci-service.yml @@ -10,7 +10,7 @@ on: # - 'src/EPiServer.Search.IndexingService/**' # - 'test/EPiServer.Search.IndexingService.Test/**' # - 'docker-compose.yml' - + jobs: build_test_pack: name: Build, test & push image @@ -23,9 +23,11 @@ jobs: IMAGE_NAME: ${{ github.repository }} steps: - name: Checkout repository - uses: actions/checkout@v1 - - name: Setup .NET Core @ Latest - uses: actions/setup-dotnet@v1 + uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '7.0.x' - name: Restore run: dotnet restore - name: Test