diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 49ae99b7f8b..93bf788caa1 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -30,6 +30,11 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '9.0.x' + - name: Initialize CodeQL uses: github/codeql-action/init@v3 with: diff --git a/.github/workflows/deploy-designer.yaml b/.github/workflows/deploy-designer.yaml index c5d6eed5e74..34e66fe2784 100644 --- a/.github/workflows/deploy-designer.yaml +++ b/.github/workflows/deploy-designer.yaml @@ -106,7 +106,7 @@ jobs: artifact-environment: ${{ matrix.environment == 'preapproved-prod' && 'prod' || matrix.environment }} config-chart-name: altinn-designer-config artifact-name: altinn-designer - helm-set-arguments: environmentName=${{ matrix.environment == 'preapproved-prod' && 'prod' || matrix.environment }},chartVersion=0.1.0+${{ needs.determine-tag.outputs.tag }},imageTag=${{ needs.determine-tag.outputs.tag }},dbMigrationsTag=${{ needs.determine-tag.outputs.tag }} + helm-set-arguments: environmentName=${{ matrix.environment == 'preapproved-prod' && 'prod' || matrix.environment }},chartVersion=0.1.0+${{ needs.determine-tag.outputs.tag }},imageTag=${{ needs.determine-tag.outputs.tag }},dbMigrationsTag=${{ needs.determine-tag.outputs.tag }},replicas=${{ matrix.environment == 'dev' && 1 || 2 }} trace-workflow: true trace-team-name: 'team-studio' secrets: diff --git a/.github/workflows/designer-dotnet-test.yaml b/.github/workflows/designer-dotnet-test.yaml index 7f0df1bc60b..7e91e2bb1fb 100644 --- a/.github/workflows/designer-dotnet-test.yaml +++ b/.github/workflows/designer-dotnet-test.yaml @@ -27,7 +27,7 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | - 8.0.x + 9.0.x - uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis diff --git a/.github/workflows/dotnet-format.yaml b/.github/workflows/dotnet-format.yaml index 6f2ff345f56..bcff1afad91 100644 --- a/.github/workflows/dotnet-format.yaml +++ b/.github/workflows/dotnet-format.yaml @@ -20,7 +20,7 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | - 8.0.x + 9.0.x - uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis diff --git a/.github/workflows/dotnet-migrations-ensure-compatibility.yaml b/.github/workflows/dotnet-migrations-ensure-compatibility.yaml new file mode 100644 index 00000000000..ce5dc94fa09 --- /dev/null +++ b/.github/workflows/dotnet-migrations-ensure-compatibility.yaml @@ -0,0 +1,37 @@ +name: Ensure Migrations Compatibility +on: + pull_request: + branches: [ main ] + types: [opened, synchronize, reopened] + paths: + - 'backend/**' + - '.github/workflows/dotnet-migrations-ensure-compatibility.yaml' + workflow_dispatch: + +jobs: + ensure-migrations-compatibility: + name: Try to generate script and to add a new migrations + runs-on: ubuntu-latest + env: + OidcLoginSettings__FetchClientIdAndSecretFromRootEnvFile: 'false' + OidcLoginSettings__ClientId: 'dummyRequired' + OidcLoginSettings__ClientSecret: 'dummyRequired' + steps: + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 9.0.x + + - uses: actions/checkout@v4 + + - name: Install dotnet ef # Version should be the same as Migrations docker file and project + run: dotnet tool install --version 8.0.7 --global dotnet-ef + + - name: Check if migrations script can be generated + run: | + dotnet ef migrations script --project backend/src/Designer + + - name: Check if it's possible to add a new migration + run: | + dotnet ef migrations add Test --project backend/src/Designer diff --git a/.github/workflows/gitea-designer-integration-tests.yaml b/.github/workflows/gitea-designer-integration-tests.yaml index d7cc63e5667..a792c66655b 100644 --- a/.github/workflows/gitea-designer-integration-tests.yaml +++ b/.github/workflows/gitea-designer-integration-tests.yaml @@ -25,7 +25,7 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | - 8.0.x + 9.0.x - uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis diff --git a/Dockerfile b/Dockerfile index d5d8ca10c3f..e4d36091075 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,7 @@ COPY . . RUN yarn build # Building the backend -FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS generate-studio-backend +FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS generate-studio-backend ARG DESIGNER_VERSION='' WORKDIR /build COPY backend . @@ -52,7 +52,7 @@ WORKDIR /version RUN echo "{\"designerVersion\":\"$DESIGNER_VERSION\",\"appTemplateVersion\":\"$(curl -s https://api.github.com/repos/Altinn/app-template-dotnet/releases/latest | jq -r .tag_name)\"}" > version.json # Building the final image -FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS final +FROM mcr.microsoft.com/dotnet/aspnet:9.0-alpine AS final EXPOSE 80 WORKDIR /app ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \ diff --git a/README.md b/README.md index be372772241..8af19271dfb 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ See deployment for notes on how to deploy the project on a live system. ### Prerequisites -1. Newest [.NET 8 SDK][5] +1. Newest [.NET 9 SDK][5] 2. [Node.js][6] (Latest LTS version, v20.\*) 3. Newest [Git][7] 4. A code editor - we like [Visual Studio Code][8] @@ -184,10 +184,10 @@ See also the [list of contributors][26] who participated in this project. This project is licensed under the 3-Clause BSD License - see the [LICENSE.md](LICENSE.md) file for details. [1]: https://docs.altinn.studio/ -[2]: https://docs.altinn.studio/app/getting-started/ -[3]: https://docs.altinn.studio/app/app-dev-course/ +[2]: https://docs.altinn.studio/altinn-studio/getting-started/ +[3]: https://docs.altinn.studio/altinn-studio/getting-started/app-dev-course/ [4]: https://github.com/Altinn/app-localtest -[5]: https://dotnet.microsoft.com/download/dotnet/8.0 +[5]: https://dotnet.microsoft.com/download/dotnet/9.0 [6]: https://nodejs.org [7]: https://git-scm.com/downloads [8]: https://code.visualstudio.com/Download diff --git a/backend/Directory.Build.props b/backend/Directory.Build.props index 29f8cbdfd70..b81d75c4147 100644 --- a/backend/Directory.Build.props +++ b/backend/Directory.Build.props @@ -1,6 +1,6 @@ - net8.0 + net9.0 Altinn Altinn Studio diff --git a/backend/Migrations.Dockerfile b/backend/Migrations.Dockerfile index bd314773319..6523121e42b 100644 --- a/backend/Migrations.Dockerfile +++ b/backend/Migrations.Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build +FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build WORKDIR /app diff --git a/backend/packagegroups/NuGet.props b/backend/packagegroups/NuGet.props index 82b74f8b1a1..389193bbd30 100644 --- a/backend/packagegroups/NuGet.props +++ b/backend/packagegroups/NuGet.props @@ -19,20 +19,20 @@ - + - + + - @@ -40,11 +40,12 @@ + - + @@ -58,8 +59,8 @@ - - + + diff --git a/backend/src/Designer/Controllers/AppDevelopmentController.cs b/backend/src/Designer/Controllers/AppDevelopmentController.cs index 0c9ed9a261f..37a2d40c08b 100644 --- a/backend/src/Designer/Controllers/AppDevelopmentController.cs +++ b/backend/src/Designer/Controllers/AppDevelopmentController.cs @@ -136,8 +136,11 @@ await _mediator.Publish(new ComponentIdChangedEvent } if (!formLayouts.ContainsKey(layoutName)) { + LayoutSetConfig layoutSetConfig = await _appDevelopmentService.GetLayoutSetConfig(editingContext, layoutSetName, cancellationToken); await _mediator.Publish(new LayoutPageAddedEvent { + LayoutSetConfig = layoutSetConfig, + LayoutName = layoutName, EditingContext = editingContext, }, cancellationToken); } @@ -347,6 +350,11 @@ public async Task AddLayoutSet(string org, string app, [FromBody] var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, app, developer); bool layoutIsInitialForPaymentTask = layoutSetPayload.TaskType == TaskType.Payment; LayoutSets layoutSets = await _appDevelopmentService.AddLayoutSet(editingContext, layoutSetPayload.LayoutSetConfig, layoutIsInitialForPaymentTask, cancellationToken); + await _mediator.Publish(new LayoutSetCreatedEvent + { + EditingContext = editingContext, + LayoutSet = layoutSetPayload.LayoutSetConfig + }, cancellationToken); return Ok(layoutSets); } diff --git a/backend/src/Designer/Controllers/OptionsController.cs b/backend/src/Designer/Controllers/OptionsController.cs index cf1d2d45aaa..4d6d139e356 100644 --- a/backend/src/Designer/Controllers/OptionsController.cs +++ b/backend/src/Designer/Controllers/OptionsController.cs @@ -119,7 +119,7 @@ public async Task>> GetOptionsList(string org, string [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [Route("{optionsListId}")] - public async Task CreateOrOverwriteOptionsList(string org, string repo, [FromRoute] string optionsListId, [FromBody] List