Sonarsource/sonarqube-quality-gate-action@master unable to find Report.txt

I am also facing similar issue
I am working on Github actions and trying to integrate Sonarqube in GitHub actions.
The project is based on C++ & C#
I am using build-wrapper-win-x86-64.exe and dotnet-sonarscanner to scan the application. Workflow is scanning and publishing the results to SQ as well , But the issue is sonarsource/sonarqube-quality-gate-action@master is not able to find the Report.txt

.\.sonar\scanner\dotnet-sonarscanner begin /k:"$env:PROJECT_KEY" /d:sonar.login="$env:SONAR_TOKEN" /d:sonar.host.url="$env:SONAR_HOST_URL" /d:sonar.cfamily.build-wrapper-output="build_wrapper_output_directory"
nuget restore test.sln
.\build\build-wrapper-win-x86\build-wrapper-win-x86-64.exe --out-dir build_wrapper_output_directory  msbuild.exe test.sln -p:Platform=x86 -p:Configuration=Release -p:DeployOnBuild=true -p:PublishProfile=FolderProfile
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="$env:SONAR_TOKEN"

Hi,

Welcome to the community!

Can you share your YAML?

 
Thx,
Ann

I am also facing similar issue
I am working on Github actions and trying to integrate Sonarqube in GitHub actions.
The project is based on C++ & C#
I am using build-wrapper-win-x86-64.exe and dotnet-sonarscanner to scan the application. Workflow is scanning and publishing the results to SQ as well , But the issue is sonarsource/sonarqube-quality-gate-action@master is not able to find the Report.txt

.\.sonar\scanner\dotnet-sonarscanner begin /k:"$env:PROJECT_KEY" /d:sonar.login="$env:SONAR_TOKEN" /d:sonar.host.url="$env:SONAR_HOST_URL" /d:sonar.cfamily.build-wrapper-output="build_wrapper_output_directory"
nuget restore test.sln
.\build\build-wrapper-win-x86\build-wrapper-win-x86-64.exe --out-dir build_wrapper_output_directory  msbuild.exe test.sln -p:Platform=x86 -p:Configuration=Release -p:DeployOnBuild=true -p:PublishProfile=FolderProfile
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="$env:SONAR_TOKEN"
name: "build-assist"
description: encapsulates common build steps
inputs:
  SONAR_TOKEN:
    required: true
  SONAR_HOST_URL:
    required: true
  PROJECT_KEY:
    required: true

runs:
  using: "composite"
  steps:
    - name: Set up JDK 11
      uses: actions/setup-java@v1
      with:
        java-version: 1.11

    - name: Cache SonarQube packages
      uses: actions/cache@v1
      with:
        path: ~\sonar\cache
        key: ${{ runner.os }}-sonar
        restore-keys: ${{ runner.os }}-sonar

    - name: Cache SonarQube scanner
      id: cache-sonar-scanner
      uses: actions/cache@v1
      with:
        path: .\.sonar\scanner
        key: ${{ runner.os }}-sonar-scanner
        restore-keys: ${{ runner.os }}-sonar-scanner

    - name: Install SonarQube scanner
      if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
      shell: powershell
      run: |
        New-Item -Path .\.sonar\scanner -ItemType Directory
        dotnet tool update  dotnet-sonarscanner --version 5.4.1 --tool-path .\.sonar\scanner
    
    - name: Install Build-wrapper
      shell: powershell
      env:
       SONAR_WRAPPER_URL: ${{env.SONAR_HOST_URL}}static/cpp/build-wrapper-win-x86.zip
      run: |
        Invoke-WebRequest -Uri "${{ env.SONAR_WRAPPER_URL }}" -OutFile build-wrapper.zip
        Expand-Archive -LiteralPath build-wrapper.zip -DestinationPath .\build   
        tree /f
    
    - name: Setup MSBuild.exe
      uses: microsoft/setup-msbuild@v1.0.2

    - name: Build and analyze
      env:
        SONAR_TOKEN: ${{ inputs.SONAR_TOKEN }}
        SONAR_HOST_URL: ${{ inputs.SONAR_HOST_URL }}
        PROJECT_KEY: ${{ inputs.PROJECT_KEY }}
      shell: powershell
      run: |
        .\.sonar\scanner\dotnet-sonarscanner begin /k:"$env:PROJECT_KEY" /d:sonar.login="$env:SONAR_TOKEN" /d:sonar.host.url="$env:SONAR_HOST_URL" /d:sonar.cfamily.build-wrapper-output="build_wrapper_output_directory" 
        nuget restore test.sln 
        .\build\build-wrapper-win-x86\build-wrapper-win-x86-64.exe --out-dir build_wrapper_output_directory  msbuild.exe test.sln -p:Platform=x86 -p:Configuration=Release -p:DeployOnBuild=true -p:PublishProfile=FolderProfile
        .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="$env:SONAR_TOKEN"
        tree /f
name: Developer-CI

on:
  workflow_dispatch:
  pull_request:
    branches:
      - main
      - 'release/*'
    types: [opened, synchronize, reopened]
    paths-ignore:
      - '**/*.md'
      - '**/*.gitignore'
      - '**/*.gitattributes'
  push:
    branches:
      - main
      - 'release/*'
    paths-ignore:
      - '**/*.md'
      - '**/*.gitignore'
      - '**/*.gitattributes'

jobs:
  build:
    runs-on: windows-2019

    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
          lfs: true
          
      - name: Checkout LFS objects
        run: git lfs checkout

      - name: build and analyze
        uses: ./.github/sonarqube-net
        with:
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
          SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
          PROJECT_KEY: ${{ secrets.PROJECT_KEY }}

      - name: SonarQube Quality Gate check
        uses: sonarsource/sonarqube-quality-gate-action@master
        # Force to fail step after specific time
        # timeout-minutes: 15
        env:
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
      

Hello Ann,

Hope you could look through the YAML ??
Eagerly waiting for some help.

Regards,
Rashmi B K

Hi,

Thanks for the YAML. Could you also provide a full analysis log (the console output from the analysis command).

 
Ann

logs_36.zip (366.7 KB)
build-wrapper.log (71.9 KB)
build-wrapper-dump.json (44.5 KB)

Hey there.

sonarsource/sonarqube-quality-gate-action can only be used with sonarsource/sonarqube-scan-action which is not compatible with the Scanner for .NET.

You can still use sonar.qualitygate.wait=true as an analysis parameter to pass/fail the build based on the Quality Gate.