| ... | ... | @@ -407,7 +407,7 @@ sonar.exclusions=**/*Test*/** |
|
|
|
sonar.projectKey=testing
|
|
|
|
sonar.projectName=CI-testing
|
|
|
|
sonar.projectVersion=1.0
|
|
|
|
sonar.sources=server, client, config.js
|
|
|
|
sonar.sources=server, config.js
|
|
|
|
sonar.tests=./server/tests
|
|
|
|
sonar.javascript.lcov.reportPath=coverage/lcov.info
|
|
|
|
sonar.test.inclusions=**/*Test*/**
|
| ... | ... | @@ -454,6 +454,38 @@ gitlab-runner.exe restart |
|
|
|
```
|
|
|
|
|
|
|
|
- Now runner should work correctly
|
|
|
|
- Analyzed project should look like this after the latest passed CI-job
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
## Step 7: Sonar GitLab Plugin
|
|
|
|
|
|
|
|
- We want SonarQube to automatically after analysis to send errors to Gitlab commit
|
|
|
|
- Let's go to SonarQube < virtual machine's ip >:9000
|
|
|
|
- Log in -> Click from Administration -> Click from Marketplace -> Search "gitlab" and install Gitlab plugin
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
- After installation restart SonarQube from link above after installation
|
|
|
|
|
|
|
|
- After restart, in SonarQube navigate to Administration -> Configuration -> General Settings -> GitLab
|
|
|
|
- To GitLab url add your gitlab's url
|
|
|
|
- Click "Comment when no new issue" on
|
|
|
|
- Click "Ping the user" on
|
|
|
|
- Set GitLab API version to **v4**
|
|
|
|
- Click "All issues" on
|
|
|
|
- Check that all settings are saved
|
|
|
|
- Next you want to edit project settings in SonarQube, so navigate Projects -> "CI-testing" project -> Project's Administration -> General Settings -> GitLab
|
|
|
|
- Now you need to add GitLab project's id to settings, navigate in GitLab in your project to Settings -> General -> Expand "General project settings" and copy Project ID number to SonarQube's settings.
|
|
|
|
- We need also to add few variables to GitLab's CI/CD settings, so navigate in your GitLab project -> Settings -> CI/CD -> Expand "Variables"
|
|
|
|
- Add new variable name "SONAR_URL" and to value "http:// < virtual machine's ip > :9000"
|
|
|
|
- Add new variable name "SONAR_LOGIN" and to value you need to get it from your SonarQube
|
|
|
|
- Go to your SonarQube -> Click from top right corner profile logo -> Click from security -> Enter for token's name "gitlab" and click Generate -> Copy the value and add it to "SONAR_LOGIN" value box
|
|
|
|
- Add new variable name "USER_TOKEN" and go to your GitLab's user settings -> Acces Tokens
|
|
|
|
- Give name for token, name it as "sonar", give expire date as long as you want and lastly check all "Scopes"
|
|
|
|
- Click "Create personal access token" and copy Access Token and add it to "USER_TOKEN" in CI/CD Variables settings
|
|
|
|
- Now save variables and
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|