-
Notifications
You must be signed in to change notification settings - Fork 0
Update to .NET 10, adapt code style to Steeltoe conventions #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
2d59a8a
Convert to slnx
bart-vmware 43156f5
Remove dependency on Steeltoe 3.x
bart-vmware 4632e53
Update to .NET 10, run tests during Docker build
bart-vmware e7d9bb4
Use file-scoped namespaces
bart-vmware d8a78db
Additional code cleanup
bart-vmware 216cc66
Apply style settings from Steeltoe
bart-vmware d9fe66c
Enable nullable reference types
bart-vmware 7abf17a
Use top-level statements, replace Swashbuckle with ASP.NET OpenAPI
bart-vmware 03c15f7
Docker tweaks
bart-vmware dae7081
Do not auto-redirect to https
bart-vmware 33fff4b
Delete CODEOWNERS
bart-vmware 5385fff
Only enable health actuator for non-development
bart-vmware 4689968
Disable install/uninstall endpoints by default
bart-vmware c08d956
Fixed: always use forward slashes in paths inside zip
bart-vmware ac2e310
Fixed: do not wrap into multiple exceptions
bart-vmware 6e0af70
Restore original log level
bart-vmware 381c37a
Fix broken error handling
bart-vmware 6c001af
Strip paths from output
bart-vmware e0e2e79
Remove UseAuthorization
bart-vmware 1630ca6
Move setting DOTNET_ENVIRONMENT in Docker, remove unused settings
bart-vmware 81bae95
Add code style verification
bart-vmware 0f3846c
Remove Nerdbank.GitVersioning
bart-vmware df06fe9
Set up vulnerability scans
bart-vmware ea20af3
Apply suggestions from code review
bart-vmware File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "version": 1, | ||
| "isRoot": true, | ||
| "tools": { | ||
| "jetbrains.resharper.globaltools": { | ||
| "version": "2026.1.3", | ||
| "commands": [ | ||
| "jb" | ||
| ], | ||
| "rollForward": false | ||
| }, | ||
| "regitlint": { | ||
| "version": "6.3.13", | ||
| "commands": [ | ||
| "regitlint" | ||
| ], | ||
| "rollForward": false | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| name: Scan vulnerable dependencies | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| DOTNET_CLI_TELEMETRY_OPTOUT: 1 | ||
| DOTNET_NOLOGO: true | ||
| SOLUTION_FILE: 'Steeltoe.NetCoreToolService.slnx' | ||
|
|
||
| jobs: | ||
| scan: | ||
| name: Scan | ||
| timeout-minutes: 15 | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v5 | ||
| with: | ||
| dotnet-version: | | ||
| 10.0.* | ||
|
|
||
| - name: Git checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Report vulnerable dependencies | ||
| shell: pwsh | ||
| run: | | ||
| $ErrorActionPreference = 'Stop' | ||
| $PSNativeCommandUseErrorActionPreference = $true | ||
|
|
||
| $output = dotnet list ${{ env.SOLUTION_FILE }} package --vulnerable --include-transitive --format json --output-version 1 2>&1 | ||
| $text = ($output | Out-String).TrimEnd() | ||
| $json = $text | ConvertFrom-Json | ||
| $hasVulnerabilities = $false | ||
|
|
||
| foreach ($project in $json.projects) { | ||
| if (-not $project.frameworks) { | ||
| continue | ||
| } | ||
|
|
||
| $isTestProject = $project.path -like '*/test/*' | ||
|
|
||
| foreach ($framework in $project.frameworks) { | ||
| foreach ($package in $framework.topLevelPackages) { | ||
| $hasVulnerabilities = $true | ||
|
|
||
| foreach ($vulnerability in $package.vulnerabilities) { | ||
| Write-Host "$($project.path) ($($framework.framework)): top-level $($package.id) $($package.resolvedVersion) – $($vulnerability.severity): $($vulnerability.advisoryurl)" | ||
| } | ||
| } | ||
|
|
||
| if (-not $isTestProject) { | ||
| foreach ($package in $framework.transitivePackages) { | ||
| $hasVulnerabilities = $true | ||
|
|
||
| foreach ($vulnerability in $package.vulnerabilities) { | ||
| Write-Host "$($project.path) ($($framework.framework)): transitive $($package.id) $($package.resolvedVersion) – $($vulnerability.severity): $($vulnerability.advisoryurl)" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if ($hasVulnerabilities) { | ||
| exit 1 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| name: Cleanup Code | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| DOTNET_CLI_TELEMETRY_OPTOUT: 1 | ||
| DOTNET_NOLOGO: true | ||
| SOLUTION_FILE: 'Steeltoe.NetCoreToolService.slnx' | ||
|
|
||
| jobs: | ||
| verify: | ||
| name: Verify Code Style | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v5 | ||
| with: | ||
| dotnet-version: | | ||
| 10.0.* | ||
|
|
||
| - name: Git checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| persist-credentials: false | ||
| fetch-depth: 2 | ||
|
|
||
| - name: Restore tools | ||
| run: dotnet tool restore --verbosity minimal | ||
|
|
||
| - name: Restore packages | ||
| run: dotnet restore ${{ env.SOLUTION_FILE }} /p:Configuration=Release /p:NuGetAudit=false --verbosity minimal | ||
|
|
||
| - name: Build | ||
| run: dotnet build ${{ env.SOLUTION_FILE }} --no-restore --configuration Release /p:RunAnalyzers=false | ||
|
|
||
| - name: CleanupCode (on PR diff) | ||
| if: ${{ github.event_name == 'pull_request' }} | ||
| shell: pwsh | ||
| run: | | ||
| # Not using the environment variables for SHAs, because they may be outdated. This may happen on force-push after the build is queued, but before it starts. | ||
| # The below works because HEAD is detached (at the merge commit), so HEAD~1 is at the base branch. When a PR contains no commits, this job will not run. | ||
| $headCommitHash = git rev-parse HEAD | ||
| $baseCommitHash = git rev-parse HEAD~1 | ||
|
|
||
| Write-Output "Running code cleanup on commit range $baseCommitHash..$headCommitHash in pull request." | ||
| dotnet jb cleanupcode --version | ||
| dotnet regitlint -s $env:SOLUTION_FILE --print-command --skip-tool-check --max-runs=5 --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="Steeltoe Full Cleanup" --jb --no-updates --jb --properties:Configuration=Release --jb --properties:RunAnalyzers=false --jb --properties:NuGetAudit=false --jb --verbosity=WARN -f commits -a $headCommitHash -b $baseCommitHash --fail-on-diff --print-diff | ||
|
|
||
| - name: CleanupCode (on branch) | ||
| if: ${{ github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch' }} | ||
| shell: pwsh | ||
| run: | | ||
| Write-Output 'Running code cleanup on all files.' | ||
| dotnet jb cleanupcode --version | ||
| dotnet regitlint -s $env:SOLUTION_FILE --print-command --skip-tool-check --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="Steeltoe Full Cleanup" --jb --no-updates --jb --properties:Configuration=Release --jb --properties:RunAnalyzers=false --jb --properties:NuGetAudit=false --jb --verbosity=WARN --fail-on-diff --print-diff |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| #Requires -Version 7.4 | ||
|
|
||
| # This script reformats (part of) the codebase to make it compliant with our coding guidelines. | ||
|
|
||
| param( | ||
| # Git branch name or base commit hash to reformat only the subset of changed files. Omit for all files. | ||
| [string] $revision | ||
| ) | ||
|
|
||
| $ErrorActionPreference = "Stop" | ||
| $PSNativeCommandUseErrorActionPreference = $true | ||
| $solutionFile = 'Steeltoe.NetCoreToolService.slnx' | ||
|
|
||
| dotnet tool restore | ||
| dotnet restore $solutionFile /p:NuGetAudit=false | ||
| dotnet build $solutionFile --no-restore --configuration Release /p:RunAnalyzers=false | ||
|
|
||
| if ($revision) { | ||
| $headCommitHash = git rev-parse HEAD | ||
| $baseCommitHash = git rev-parse $revision | ||
|
|
||
| if ($baseCommitHash -eq $headCommitHash) { | ||
| Write-Output "Running code cleanup on staged/unstaged files." | ||
| dotnet jb cleanupcode --version | ||
| dotnet regitlint -s $solutionFile --print-command --skip-tool-check --max-runs=5 --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="Steeltoe Full Cleanup" --jb --no-updates --jb --properties:Configuration=Release --jb --properties:RunAnalyzers=false --jb --properties:NuGetAudit=false --jb --verbosity=WARN -f staged,modified | ||
| } | ||
| else { | ||
| Write-Output "Running code cleanup on commit range $baseCommitHash..$headCommitHash, including staged/unstaged files." | ||
| dotnet jb cleanupcode --version | ||
| dotnet regitlint -s $solutionFile --print-command --skip-tool-check --max-runs=5 --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="Steeltoe Full Cleanup" --jb --no-updates --jb --properties:Configuration=Release --jb --properties:RunAnalyzers=false --jb --properties:NuGetAudit=false --jb --verbosity=WARN -f staged,modified,commits -a $headCommitHash -b $baseCommitHash | ||
| } | ||
| } | ||
| else { | ||
| Write-Output "Running code cleanup on all files." | ||
| dotnet jb cleanupcode --version | ||
| dotnet regitlint -s $solutionFile --print-command --skip-tool-check --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="Steeltoe Full Cleanup" --jb --no-updates --jb --properties:Configuration=Release --jb --properties:RunAnalyzers=false --jb --properties:NuGetAudit=false --jb --verbosity=WARN | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,5 @@ | ||
| services: | ||
| net-core-tool-service: | ||
| build: . | ||
| environment: | ||
| DOTNET_ENVIRONMENT: Development | ||
| ports: | ||
| - "1922:8080" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the Apache 2.0 License. | ||
| // See the LICENSE file in the project root for more information. | ||
|
|
||
| namespace Steeltoe.NetCoreToolService; | ||
|
|
||
| internal sealed class AsyncLock : IDisposable | ||
| { | ||
| private readonly SemaphoreSlim _semaphore = new(1, 1); | ||
|
|
||
| public async Task<IDisposable> AcquireAsync() | ||
| { | ||
| await _semaphore.WaitAsync(); | ||
| return new ReleaseOnDispose(this); | ||
| } | ||
|
|
||
| public void Dispose() | ||
| { | ||
| _semaphore.Dispose(); | ||
| } | ||
|
|
||
| private sealed class ReleaseOnDispose(AsyncLock owner) : IDisposable | ||
| { | ||
| public void Dispose() | ||
| { | ||
| owner._semaphore.Release(); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.