diff --git a/.github/workflows/NetcoreSampleApp-ci.yml b/.github/workflows/NetcoreSampleApp-ci.yml index 4052d42..54e2f4f 100644 --- a/.github/workflows/NetcoreSampleApp-ci.yml +++ b/.github/workflows/NetcoreSampleApp-ci.yml @@ -23,8 +23,11 @@ env: REGISTRY_URL: ${{ secrets.REGISTRY_URL }} jobs: - build: + ci: runs-on: ubuntu-latest + permissions: + contents: read + packages: write steps: - name: Checkout code uses: actions/checkout@v4 @@ -38,34 +41,12 @@ jobs: dotnet restore "tests/SampleApi.Tests/SampleApi.Tests.csproj" dotnet build "src/SampleApi/SampleApi.csproj" --configuration Release --no-restore dotnet build "tests/SampleApi.Tests/SampleApi.Tests.csproj" --configuration Release --no-restore - - test: - needs: build - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: 'Set up .NET' - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.0.x' - name: 'Run unit tests' run: | cat > coverlet.runsettings <<'EOF' opencover EOF dotnet test "tests/SampleApi.Tests/SampleApi.Tests.csproj" --configuration Release --verbosity normal --collect:"XPlat Code Coverage" --settings coverlet.runsettings --results-directory ./TestResults - - sonarqube: - needs: test - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: 'Set up .NET' - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.0.x' - name: 'Sonar: set up JDK' uses: actions/setup-java@v4 with: @@ -84,65 +65,42 @@ jobs: - name: 'Sonar scan end' run: | dotnet-sonarscanner end /d:sonar.token="$SONAR_TOKEN" - - security: - needs: test - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Run SAST (Fortify) - run: echo "SAST analysis via Fortify integration (placeholder)" - - - name: Run SCA (Sonatype) - run: echo "SCA analysis via Sonatype integration (placeholder)" - - # DAST stage disabled in configuration - # needs: build - # runs-on: ubuntu-latest - # steps: - # - name: Run DAST (Fortify WebInspect) - # run: echo 'DAST analysis via Fortify WebInspect (placeholder)' - - container: - needs: security - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Log in to GHCR + # SAST - not selected in the orchestrator UI + # - name: 'Run SAST (not selected)' + # run: | + # echo "SAST analysis via not selected (placeholder)" + # SCA - not selected in the orchestrator UI + # - name: 'Run SCA (not selected)' + # run: | + # echo "SCA analysis via not selected (placeholder)" + # DAST - not selected in the orchestrator UI + # - name: 'Run DAST (not selected)' + # run: | + # echo "DAST analysis via not selected (placeholder)" + # IMGSCAN - not selected in the orchestrator UI + # - name: 'Scan container image (not selected)' + # run: | + # echo "Container image scan via not selected (placeholder)" + # ARTIFACT - not selected in the orchestrator UI + # - name: 'Publish artifacts (not selected)' + # run: | + # echo "Publish build artifacts to not selected (placeholder)" + - name: 'Log in to registry (GHCR)' uses: docker/login-action@v3 with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push image + registry: 'ghcr.io' + username: '${{ github.actor }}' + password: '${{ secrets.GITHUB_TOKEN }}' + - name: 'Build and push image' run: | REPO=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') IMAGE=ghcr.io/$REPO:${{ github.sha }} docker build -t "$IMAGE" . docker push "$IMAGE" - - name: Generate SBOM - run: echo 'SBOM generation (placeholder — e.g. Trivy/Syft)' - - helm: - needs: container - runs-on: ubuntu-latest - steps: - - name: Update Helm Chart - run: echo 'Update Helm chart (placeholder)' - - notify: - needs: [build, test, sonarqube, security] - runs-on: ubuntu-latest - if: always() - steps: - - name: Notify Dynatrace - run: echo "Send build metrics to Dynatrace (placeholder)" - - - name: Notify Splunk - run: echo "Send execution logs to Splunk (placeholder)" + - name: 'Generate SBOM' + run: | + echo "SBOM generation (placeholder - e.g. Trivy/Syft)" + # MONITORING - not selected in the orchestrator UI + # - name: 'Send telemetry (not selected)' + # run: | + # echo "Send build metrics/logs to not selected (placeholder)"