diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 75a5464..c746b32 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -24,13 +24,15 @@ jobs: uses: actions/checkout@v4 with: submodules: false - - - name: List files for debugging - run: | - pwd - ls -la - find . -name "*.csproj" - find . -name "*.sln" + + # NuGet Cache + - name: Cache NuGet packages + uses: actions/cache@v3 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} + restore-keys: | + ${{ runner.os }}-nuget- - name: Setup .NET SDK uses: actions/setup-dotnet@v3 @@ -40,10 +42,16 @@ jobs: - name: Restore dependencies run: dotnet restore watcher-monitoring.sln + - name: Build + run: dotnet build watcher-monitoring.sln --configuration Release --no-restore + + - name: Test + run: dotnet test watcher-monitoring.sln --no-build --verbosity normal + continue-on-error: true + set-tag: name: Set Tag Name needs: [dotnet-build-and-test] - #if: ${{ !failure() && !cancelled() && github.event_name != 'pull_request' }} runs-on: ubuntu-latest outputs: tag_name: ${{ steps.set_tag.outputs.tag_name }} @@ -105,6 +113,15 @@ jobs: - name: Setup Docker Buildx uses: docker/setup-buildx-action@v2 + # Docker Layer Cache + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: Login to Gitea Container Registry uses: docker/login-action@v3 with: @@ -112,13 +129,23 @@ jobs: username: ${{ secrets.AUTOMATION_USERNAME }} password: ${{ secrets.AUTOMATION_PASSWORD }} - - name: Build and Push Multi-Arch Docker Image + - name: Build and Push Docker Image + uses: docker/build-push-action@v5 + with: + context: . + platforms: ${{ env.DOCKER_PLATFORMS }} + push: true + tags: ${{ env.REGISTRY_URL }}/triggermeelmo/${{ env.DOCKER_IMAGE_NAME }}:${{ needs.set-tag.outputs.tag_name }} + build-args: | + VERSION=${{ needs.set-tag.outputs.tag_name }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + # Workaround für Cache-Größe + - name: Move cache run: | - docker buildx build \ - --platform linux/amd64 \ - --build-arg VERSION=${{ needs.set-tag.outputs.tag_name }} \ - -t ${{ env.REGISTRY_URL }}/triggermeelmo/${{ env.DOCKER_IMAGE_NAME }}:${{ needs.set-tag.outputs.tag_name }} \ - --push . + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache tag: name: Create Tag diff --git a/watcher-monitoring/Controllers/MonitoringController.cs b/watcher-monitoring/Controllers/MonitoringController.cs index bed6845..f12b524 100644 --- a/watcher-monitoring/Controllers/MonitoringController.cs +++ b/watcher-monitoring/Controllers/MonitoringController.cs @@ -20,8 +20,8 @@ public class MonitoringController : Controller } // Registration Endpoint for watcher-agent - [HttpPost("registration")] - public async Task Registration([FromBody] RegistrationDto dto) + [HttpPost("register")] + public async Task Register([FromBody] RegistrationDto dto) { // payload check if (!ModelState.IsValid)