GithubHelp home page GithubHelp logo

Comments (9)

elboletaire avatar elboletaire commented on July 20, 2024

You need a sonar-project.properties file, with the sonar.projectKey set, among others. Here's an example sonar-project.properties file:

# sonar project id
sonar.projectKey=YOUR_SONAR_PROJECT_KEY_ID
# main language to be analyzed
sonar.language=php
# included folders
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Since SonarQube 4.2, this property is optional if sonar.modules is set.
# If not set, SonarQube starts looking for source code from the directory containing
# the sonar-project.properties file.
sonar.sources=config, plugins, src

# excluded folders
sonar.exclusions=plugins/**/tests/**, src/Console/Installer.php, plugins/**/config/**, config/Migrations/**

# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8
# Set gitlab analysis to exit instead of notifying via commit message
sonar.gitlab.failure_notification_mode=exit-code

You can see more information about this file in: https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner

Please, don't close the issue as we'll try to add a note about this file our readme file.

from gitlab-sonar-scanner.

gudge25 avatar gudge25 commented on July 20, 2024

Thanks for reply
i create sonar-project.properties file
Picture (dev)
http://imgur.com/UjHFgpXl.png

# sonar project id
sonar.projectKey=Krusher
# main language to be analyzed
sonar.language=JavaScript
# included folders
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Since SonarQube 4.2, this property is optional if sonar.modules is set.
# If not set, SonarQube starts looking for source code from the directory containing
# the sonar-project.properties file.
sonar.sources=config, plugins, src

# excluded folders
sonar.exclusions=plugins/**/tests/**, src/Console/Installer.php, plugins/**/config/**, config/Migrations/**

# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8
# Set gitlab analysis to exit instead of notifying via commit message
sonar.gitlab.failure_notification_mode=exit-code

BUT STILL the same issue

Cloning repository...
Cloning into '/builds/satskiy.a/KRUSHER'...
Checking out 15883a03 as dev...
Skipping Git submodules setup
$ unset CI_BUILD_REF && /usr/bin/sonar-scanner-run.sh
INFO: Scanner configuration file: /sonar-scanner-3.0.3.778/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 3.0.3.778
INFO: Java 1.8.0_131 Oracle Corporation (64-bit)
INFO: Linux 4.11.12-coreos-r1 amd64
INFO: User cache: /root/.sonar/cache
INFO: Publish mode
INFO: Load global settings
INFO: Load global settings (done) | time=722ms
INFO: User cache: /root/.sonar/cache
INFO: Load plugins index
INFO: Load plugins index (done) | time=176ms
INFO: Download sonar-flex-plugin-2.3.jar
INFO: Download sonar-scm-git-plugin-1.2.jar
INFO: Download sonar-gitlab-plugin-2.1.0.jar
INFO: Download sonar-l10n-ru-plugin-1.6.jar
INFO: Download sonar-scm-svn-plugin-1.5.0.715.jar
INFO: Download sonar-javascript-plugin-3.2.0.5506.jar
INFO: Download sonar-java-plugin-4.15.0.12310.jar
INFO: SonarQube server 6.6.0
INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Process project properties
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 8.319s
INFO: Final Memory: 45M/178M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: You must define the following mandatory properties for 'Unknown': sonar.projectKey, sonar.sources
ERROR: 
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

Maybe wrong place ?
Thanks

from gitlab-sonar-scanner.

elboletaire avatar elboletaire commented on July 20, 2024

Your runner is not taking the sonar-project.properties. Take a look to the line which says:

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

Now take a look to the first comment you wrote. Both have exactly the same path, so, obviously, your runner is not taking the sonar-project.properties file.

Is that file added to the root of the project, commited, and pushed?

from gitlab-sonar-scanner.

gudge25 avatar gudge25 commented on July 20, 2024

yes
check a picture
http://imgur.com/UjHFgpXl.png

from gitlab-sonar-scanner.

elboletaire avatar elboletaire commented on July 20, 2024

Please, paste here how have you configured the runner in .gitlab-ci.yml (replace any sensible information with ** if required).

from gitlab-sonar-scanner.

gudge25 avatar gudge25 commented on July 20, 2024
stages:
- analysis

sonarqube:
  stage: analysis
  image: ciricihq/gitlab-sonar-scanner
  variables:
    SONAR_URL: "https://www.krusher.duckdns.org"
    SONAR_PROJECT_VERSION: "$CI_BUILD_ID"
    SONAR_ANALYSIS_MODE: "issues"
  script:
  - /usr/bin/sonar-scanner-run.sh

sonarqube-reports:
  stage: analysis
  image: ciricihq/gitlab-sonar-scanner
  variables:
    SONAR_URL: "https://www.krusher.duckdns.org"
    SONAR_PROJECT_VERSION: "$CI_BUILD_ID"
    SONAR_ANALYSIS_MODE: "publish"
  script:
  - unset CI_BUILD_REF && /usr/bin/sonar-scanner-run.sh

from gitlab-sonar-scanner.

gudge25 avatar gudge25 commented on July 20, 2024
# must be unique in a given SonarQube instance
sonar.projectKey=Krusher
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=Webfax
sonar.projectVersion=1.0

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# This property is optional if sonar.modules is set.
sonar.sources=.

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8

working exammple!!!!

from gitlab-sonar-scanner.

elboletaire avatar elboletaire commented on July 20, 2024

What do you mean with "working example"? Did you finally got it working?

from gitlab-sonar-scanner.

elboletaire avatar elboletaire commented on July 20, 2024

Currently available under the develop docker tag.

from gitlab-sonar-scanner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.