Skip to content

generate report returning TypeError: Cannot read property 'concat' of undefined #43

@iDevoid

Description

@iDevoid

Hi mate,
I tried to use this on GitLab CI,
after experimenting multiple times.
I stuck with the report not generating because of the error:
TypeError: Cannot read property 'concat' of undefined

All Environment variables are written on CI variables settings

.gitlab-ci.yml

sonarqube:
  stage: sonarqube
  needs:
    - job: test
      artifacts: true
  image: dieuhd/sonar-quality-gate
  cache:
    key: "${CI_JOB_NAME}"
    paths:
      - .sonar/cache
  script:
    - quality-gate -p=gitlab -D sonar.login="${SONAR_TOKEN}" --sonar.url="${SONAR_HOST_URL}" --sonar.token="${SONAR_TOKEN}" --sonar.project_key="*********" --git.url="https://gitlab.com" --git.token="${GIT_TOKEN}" --git.project_id=$CI_PROJECT_ID --git.merge_id=$CI_MERGE_REQUEST_IID

log:

_   _   _                                     _          
   __ _   _   _    __ _  | | (_) | |_   _   _            __ _    __ _  | |_    ___ 
  / _` | | | | |  / _` | | | | | | __| | | | |  _____   / _` |  / _` | | __|  / _ \
 | (_| | | |_| | | (_| | | | | | | |_  | |_| | |_____| | (_| | | (_| | | |_  |  __/
  \__, |  \__,_|  \__,_| |_| |_|  \__|  \__, |          \__, |  \__,_|  \__|  \___|
     |_|                                |___/           |___/                      
(node:13) Warning: "version" is a reserved word.
Please do one of the following:
- Disable version with `yargs.version(false)` if using "version" as an option
- Use the built-in `yargs.version` method instead (if applicable)
- Use a different option key
https://yargs.js.org/docs/#api-reference-version
(Use `node --trace-warnings ...` to show where the warning was created)
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /builds/coba[52](https://gitlab.com/********/subgroup/repo/-/jobs/********#L52)13117/subgroup/repo/sonar-project.properties
INFO: SonarScanner 4.6.2.2472
INFO: Java 11.0.14 Alpine (64-bit)
INFO: Linux 5.4.109+ amd64
INFO: User cache: /builds/********/subgroup/repo/.sonar/cache
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /builds/********/subgroup/repo/sonar-project.properties
INFO: Analyzing on SonarQube server 10.0.0.68432
INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=862ms
INFO: Server id: ***********************
INFO: User cache: /builds/********/subgroup/repo/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=327ms
INFO: Load/download plugins (done) | time=450ms
INFO: Process project properties
INFO: Process project properties (done) | time=1ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=1ms
INFO: Project key: ***************************
INFO: Base dir: /builds/********/subgroup/repo
INFO: Working dir: /builds/********/subgroup/repo/.scannerwork
INFO: Load project settings for component key: '******************'
INFO: Load project settings for component key: '*****************' (done) | time=212ms
INFO: Auto-configuring with CI 'Gitlab CI'
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=263ms
INFO: Load active rules
INFO: Load/download plugins (done) | time=450ms
INFO: Process project properties
INFO: Process project properties (done) | time=1ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=1ms
INFO: Project key: ***************
INFO: Base dir: /builds/********/subgroup/repo
INFO: Working dir: /builds/********/subgroup/repo/.scannerwork
INFO: Load project settings for component key: '*****************'
INFO: Load project settings for component key: '*****************' (done) | time=212ms
INFO: Auto-configuring with CI 'Gitlab CI'
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=263ms
INFO: Load active rules
INFO: Load active rules (done) | time=6285ms
INFO: Load analysis cache
INFO: Load analysis cache (404) | time=189ms
WARN: The property 'sonar.login' is deprecated and will be removed in the future. Please use the 'sonar.token' property instead when passing a token.
INFO: Load project repositories
INFO: Load project repositories (done) | time=197ms
INFO: Indexing files...
INFO: Project configuration:
INFO:   Excluded sources: **/*_test.go
INFO: 7 files indexed
INFO: 0 files ignored because of inclusion/exclusion patterns
INFO: 0 files ignored because of scm ignore settings
INFO: Quality profile for go: Sonar way
INFO: Quality profile for json: Sonar way
INFO: ------------- Run sensors on module **************
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=219ms
INFO: Sensor Code Quality and Security for Go [go]
INFO: 1 source file to be analyzed
INFO: 1/1 source file has been analyzed
INFO: Sensor Code Quality and Security for Go [go] (done) | time=243ms
INFO: Sensor Go Unit Test Report [go]
ERROR: Failed to parse unit test report line (file /builds/*******/subgroup/repo/test/gosec-report.json):
 {
INFO: Sensor Go Unit Test Report [go] (done) | time=6ms
INFO: Sensor Go Cover sensor for Go coverage [go]
INFO: Load coverage report from '/builds/******/subgroup/repo/test/coverage.out'
INFO: Sensor Go Cover sensor for Go coverage [go] (done) | time=3ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=5ms
INFO: Sensor IaC CloudFormation Sensor [iac]
INFO: 0 source files to be analyzed
INFO: 0/0 source files have been analyzed
INFO: Sensor IaC CloudFormation Sensor [iac] (done) | time=23ms
INFO: Sensor IaC Kubernetes Sensor [iac]
INFO: 0 source files to be analyzed
INFO: 0/0 source files have been analyzed
INFO: Sensor IaC Kubernetes Sensor [iac] (done) | time=11ms
INFO: Sensor CSS Rules [javascript]
INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
INFO: Sensor CSS Rules [javascript] (done) | time=2ms
INFO: Sensor C# Project Type Information [csharp]
INFO: Sensor C# Project Type Information [csharp] (done) | time=1ms
INFO: Sensor C# Analysis Log [csharp]
INFO: Sensor C# Analysis Log [csharp] (done) | time=16ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=1ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=3ms
INFO: Sensor TextAndSecretsSensor [text]
INFO: 3 source files to be analyzed
INFO: 3/3 source files have been analyzed
INFO: Sensor TextAndSecretsSensor [text] (done) | time=16ms
INFO: Sensor VB.NET Project Type Information [vbnet]
INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=1ms
INFO: Sensor VB.NET Analysis Log [vbnet]
INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=15ms
INFO: Sensor VB.NET Properties [vbnet]
INFO: Sensor VB.NET Properties [vbnet] (done) | time=0ms
INFO: Sensor IaC Docker Sensor [iac]
INFO: 0 source files to be analyzed
INFO: 0/0 source files have been analyzed
INFO: Sensor IaC Docker Sensor [iac] (done) | time=109ms
INFO: ------------- Run sensors on project
INFO: Sensor Analysis Warnings import [csharp]
INFO: Sensor Analysis Warnings import [csharp] (done) | time=1ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=8ms
INFO: CPD Executor Calculating CPD for 1 file
INFO: CPD Executor CPD calculation finished (done) | time=7ms
INFO: Analysis report generated in 91ms, dir size=126.7 kB
INFO: Analysis report compressed in 22ms, zip size=17.4 kB
INFO: Analysis report uploaded in 368ms
INFO: ANALYSIS SUCCESSFUL, you can find the results at: https://sonarqube/dashboard?id=*******
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at https://sonarqube
INFO: Analysis total time: 11.911 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 15.428s
INFO: Final Memory: 18M/64M
INFO: ------------------------------------------------------------------------
0
---- generate report ----
TypeError: Cannot read property 'concat' of undefined
Saving cache for successful job
00:01
Creating cache sonarqube-non_protected...
.sonar/cache: found [55](https://gitlab.com/********/subgroup/repo/-/jobs/*********#L55) matching artifact files and directories 
Archive is up to date!                             
Created cache
Cleaning up project directory and file based variables
00:00
Job succeeded

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions