Showing error while SonarQube Quality Gate via GitHub Actions,

1.3k views Asked by At

I just integrated the Sonarqube with Github .. Used Github actions for integration with the sonarqube in which sonarqube quality gate template is used as the pipeline script and the over each pull request the sonarqube will check the code and will give the status.. Error is coming if I run this pipeline in github actions

This is the workflow Pipelines

name: SonarQube Qualitygate check
on:
  # Trigger analysis when pushing in master or pull requests, and when creating
  # a pull request. 
  push:
    branches:
      - development
  pull_request:
      types: [opened, synchronize, reopened]
jobs:
  sonarqube:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
      with:
        # Disabling shallow clone is recommended for improving relevancy of reporting.
        fetch-depth: 0
        
    # Triggering SonarQube analysis as results of it are required by Quality Gate check.
    - name: SonarQube Scan
      uses: SonarSource/sonarqube-scan-action@master
      with:
        projectBaseDir: .
      env:
        SONAR_TOKEN: ${{ secrets.TM_SONAR_TOKEN }}
        SONAR_HOST_URL: ${{ secrets.TM_SONAR_HOST_URL }}

    # Check the Quality Gate status.
    - name: SonarQube Quality Gate check
      id: sonarqube-quality-gate-check
      uses: SonarSource/sonarqube-quality-gate-action@master 
      # Force to fail step after specific time.
      timeout-minutes: 5
      env:
        SONAR_LOGIN: ${{ secrets.TM_SONAR_TOKEN }}
        SONAR_HOST_URL: ${{ secrets.TM_SONAR_HOST_URL }}

Above is having an error

Run SonarSource/sonarqube-scan-action@master

32/usr/bin/docker run --name bebb0b4094726a38064eeeb945753_521cb3 --label 290506 --workdir /github/workspace --rm -e "SONAR_TOKEN" -e "SONAR_HOST_URL" -e "INPUT_PROJECTBASEDIR" -e "INPUT_ARGS" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_DEBUG" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e GITHUB_ACTIONS=true -e CI=true --entrypoint "/entrypoint.sh" -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/\_temp/\_github_home":"/github/home" -v "/home/runner/work/\_temp/\_github_workflow":"/github/workflow" -v "/home/runner/work/\_temp/\_runner_file_commands":"/github/file_commands" -v "/home/runner/work/tokenmetrics-2.0/tokenmetrics-2.0":"/github/workspace" 290506:793bebb0b4094726a38064eeeb945753

33INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties

34INFO: Project root configuration file: NONE

35INFO: SonarScanner 4.8.0.2856

36INFO: Java 11.0.17 Alpine (64-bit)

37INFO: Linux 5.15.0-1024-azure amd64

38INFO: User cache: /opt/sonar-scanner/.sonar/cache

39ERROR: Failed bootstrap index response: \<!doctype html\>\<html lang="en"\>\<head\>\<meta http-equiv="content-type" content="text/html; charset=UTF-8" charset="UTF-8"/\>\<meta http-equiv="X-UA-Compatible" content="IE=edge"\>\<link rel="apple-touch-icon" href="/apple-touch-icon.png"\>\<link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png"\>\<link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png"\>\<link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png"\>\<link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png"\>\<link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png"\>\<link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png"\>\<link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png"\>\<link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png"\>\<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png"\>\<link rel="icon" type="image/x-icon" href="/favicon.ico"\>\<meta name="application-name" content="SonarQube"/\>\<meta name="msapplication-TileColor" content="#FFFFFF"/\>\<meta name="msapplication-TileImage" content="/mstile-512x512.png"/\>\<title\>SonarQube\</title\>\<style\>\*,:after,:before{margin:0;padding:0}body,html{background-color:#f3f3f3}body{overflow

Another syntax I used:

name: SonarQube Qualitygate check
on:
  # Trigger analysis when pushing in master or pull requests, and when creating
  # a pull request. 
  push:
    branches:
      - development
  pull_request:
      types: [opened, synchronize, reopened]
jobs:
  sonarqube:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
      with:
        # Disabling shallow clone is recommended for improving relevancy of reporting.
        fetch-depth: 0

    - name: SonarQube Quality Gate check
      uses: sonarsource/sonarqube-quality-gate-action@master
      with:
        scanMetadataReportFile: target/sonar/report-task.txt

    # Triggering SonarQube analysis as results of it are required by Quality Gate check.
    - name: SonarQube Scan
      uses: SonarSource/sonarqube-scan-action@master
      with:
        projectBaseDir: .
      env:
        SONAR_TOKEN: ${{ secrets.TM_SONAR_TOKEN }}
        SONAR_HOST_URL: ${{ secrets.TM_SONAR_HOST_URL }}

    # Check the Quality Gate status.
    - name: SonarQube Quality Gate check
      id: sonarqube-quality-gate-check
      uses: SonarSource/sonarqube-quality-gate-action@master 
      # Force to fail step after specific time.
      timeout-minutes: 5
      env:
        SONAR_TOKEN: ${{ secrets.TM_SONAR_TOKEN }}
        SONAR_HOST_URL: ${{ secrets.TM_SONAR_HOST_URL }}

Error of console output for this is :

##[debug]..=> '$GITHUB_ACTION_PATH/script/check-quality-gate.sh {0}'
##[debug]..Evaluating Index:
##[debug]....Evaluating inputs:
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'scanMetadataReportFile'
##[debug]..=> 'target/sonar/report-task.txt'
##[debug]=> '$GITHUB_ACTION_PATH/script/check-quality-gate.sh target/sonar/report-task.txt'
##[debug]Result: '$GITHUB_ACTION_PATH/script/check-quality-gate.sh target/sonar/report-task.txt'
##[debug]Loading env
Run $GITHUB_ACTION_PATH/script/check-quality-gate.sh target/sonar/report-task.txt
  $GITHUB_ACTION_PATH/script/check-quality-gate.sh target/sonar/report-task.txt
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
##[debug]/usr/bin/bash --noprofile --norc -e -o pipefail /home/runner/work/_temp/e081469c-67c3-4cd2-a060-9cc26d01d502.sh
Set the SONAR_TOKEN env variable.
Error: Process completed with exit code 1.
##[debug]Finished: run
##[debug]Evaluating: steps.quality-gate-check.outputs.quality-gate-status
##[debug]Evaluating Index:
##[debug]..Evaluating Index:
##[debug]....Evaluating Index:
##[debug]......Evaluating steps:
##[debug]......=> Object
##[debug]......Evaluating String:
##[debug]......=> 'quality-gate-check'
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'outputs'

Which pipeline have to use?

0

There are 0 answers