ERROR: SonarQube server [http://sonar.my.domain] can not be reached <GitHub Action>

Hi, i have an issue with sonarqube analyzing code with github action using this YAML

name: Build

on:
  push:
    branches:
      - master

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    permissions: read-all
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v2
          
      - name: SonarQube Scan
        uses: sonarsource/sonarqube-scan-action@master
        with:
          projectBaseDir: .
        env:
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
          SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
          # SONAR_SCANNER_OPTS: -X

      # - name: SonarQube Quality Gate
      #   uses: sonarsource/sonarqube-quality-gate-action@master
      #   timeout-minutes: 5
      #   with:
      #     scanMetadataReportFile: .scannerwork/report-task.txt
      #   env:
      #     SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
      #     # SONAR_SCANNER_OPTS: -X

it didn’t reached my server. i have tried it with local server sonarqube before and it was working well. it just a different SONAR_HOST_URL value but why does it show error??

anyone can help?

1 Like

Hi,
make sure that:

  • SonarQube token is correct.
  • your SonarQube server is up and running.
  • SonarQube url is correct, it must include / at the end: https://sonarqa.shinraxxxxxxx.es/
  • there is not vpn or any other networking issues.

Below you may find an example of execution for SonarQube in GH actions:

1 Like