| ... | @@ -28,7 +28,7 @@ |
... | @@ -28,7 +28,7 @@ |
|
|
- Local or public Gitlab installation.
|
|
- Local or public Gitlab installation.
|
|
|
- Minimum RAM 8Gb.
|
|
- Minimum RAM 8Gb.
|
|
|
|
|
|
|
|
### Step 1: Make an example project in Gitlab
|
|
## Step 1: Make an example project in Gitlab
|
|
|
|
|
|
|
|
- Sign in to Gitlab and start new project
|
|
- Sign in to Gitlab and start new project
|
|
|
|
|
|
| ... | @@ -92,7 +92,7 @@ $ git push origin master |
... | @@ -92,7 +92,7 @@ $ git push origin master |
|
|
|
|
|
|
|
- Now we have finished the first part, so time to move the second part
|
|
- Now we have finished the first part, so time to move the second part
|
|
|
|
|
|
|
|
### Step 2: SonarQube to virtual machine
|
|
## Step 2: SonarQube to virtual machine
|
|
|
|
|
|
|
|
- In this part we need to install virtual machine with Ubuntu 18.04 x64 version and set up SonarQube in it
|
|
- In this part we need to install virtual machine with Ubuntu 18.04 x64 version and set up SonarQube in it
|
|
|
- First we need to download and install software that can make virtual machine, in this guide I use [Oracle VirtualBox](https://www.virtualbox.org/wiki/Downloads)
|
|
- First we need to download and install software that can make virtual machine, in this guide I use [Oracle VirtualBox](https://www.virtualbox.org/wiki/Downloads)
|
| ... | @@ -211,7 +211,7 @@ Started SonarQube. |
... | @@ -211,7 +211,7 @@ Started SonarQube. |
|
|
|
|
|
|
|
- Now SonarQube is up and running and it is available in same network <virtual machine ip>:9000
|
|
- Now SonarQube is up and running and it is available in same network <virtual machine ip>:9000
|
|
|
|
|
|
|
|
### Step 3: Installing Gitlab Runner to Windows 10
|
|
## Step 3: Installing Gitlab Runner to Windows 10
|
|
|
|
|
|
|
|
- To automate code analysis we need the runner for it
|
|
- To automate code analysis we need the runner for it
|
|
|
- Next we will install Gitlab Runner on Windows 10 and configure it
|
|
- Next we will install Gitlab Runner on Windows 10 and configure it
|
| ... | @@ -227,7 +227,7 @@ Started SonarQube. |
... | @@ -227,7 +227,7 @@ Started SonarQube. |
|
|

|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
### Step 4: SonarScanner for project
|
|
## Step 4: SonarScanner for project
|
|
|
|
|
|
|
|
- We can't scan anything yet to SonarQube because we haven't yet installed SonarScanner for project.
|
|
- We can't scan anything yet to SonarQube because we haven't yet installed SonarScanner for project.
|
|
|
- Because the example project that we downloaded earlier is written in javascript we will just point focus on [SonarScanner](https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner#AnalyzingwithSonarQubeScanner-Installation)
|
|
- Because the example project that we downloaded earlier is written in javascript we will just point focus on [SonarScanner](https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner#AnalyzingwithSonarQubeScanner-Installation)
|
| ... | @@ -252,7 +252,7 @@ sonar.host.url=http://<virtual machine's ip-adress>:9000 |
... | @@ -252,7 +252,7 @@ sonar.host.url=http://<virtual machine's ip-adress>:9000 |
|
|
|
|
|
|
|
- Now SonarScanner is ready to use but we still need to do few steps
|
|
- Now SonarScanner is ready to use but we still need to do few steps
|
|
|
|
|
|
|
|
### Step 5: Setting project ready for first scan
|
|
## Step 5: Setting project ready for first scan
|
|
|
|
|
|
|
|
- To analyze project it needs .gitlab-ci.yml and sonar-project.properties files
|
|
- To analyze project it needs .gitlab-ci.yml and sonar-project.properties files
|
|
|
- But first we need to make project on SonarQube
|
|
- But first we need to make project on SonarQube
|
| ... | @@ -346,7 +346,7 @@ C:\GitLab-Runner>gitlab-runner.exe restart |
... | @@ -346,7 +346,7 @@ C:\GitLab-Runner>gitlab-runner.exe restart |
|
|
|
|
|
|
|

|
|

|
|
|
|
|
|
|
|
### Step 6: Unit tests and code coverage
|
|
## Step 6: Unit tests and code coverage
|
|
|
|
|
|
|
|
***HOX!*** To do this step you need to install database to virtual machine so unit tests can be performed! [GUIDE](https://gitlab.labranet.jamk.fi/Iotitude/Virtuaalikaveri/blob/gRPC/DATABASE.md#linux-installation)
|
|
***HOX!*** To do this step you need to install database to virtual machine so unit tests can be performed! [GUIDE](https://gitlab.labranet.jamk.fi/Iotitude/Virtuaalikaveri/blob/gRPC/DATABASE.md#linux-installation)
|
|
|
|
|
|
| ... | @@ -426,10 +426,34 @@ $ git commit -m "edited sonar-project.properties and .gitlab-ci.yml for unit tes |
... | @@ -426,10 +426,34 @@ $ git commit -m "edited sonar-project.properties and .gitlab-ci.yml for unit tes |
|
|
$ git push origin master
|
|
$ git push origin master
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
- If you are getting error
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
'jest' is not recognized as an internal or external command,
|
|
|
|
operable program or batch file.
|
|
|
|
ERROR: Job failed: exit status 1
|
|
|
|
```
|
|
|
|
|
|
|
|
|
- Go and edit system variables, search from windows environment variables -> Click **Edit the system environment variables** -> Click from **Environment Variables...**
|
|
|
|
- Add new variable to **System Variables**
|
|
|
|
- Add for Variable name "NODE_PATH"
|
|
|
|
- Add for Variable value "C:\Users\(Name)\AppData\Roaming\npm"
|
|
|
|
- Click OK
|
|
|
|
- Next choose **Path** from "System Variables" and next click Edit...
|
|
|
|
- Click "New"
|
|
|
|
- Add Path **C:\Users\(Name)\AppData\Roaming\npm**
|
|
|
|
- Next press enter and move added variable to the top by clicking "Move Up"
|
|
|
|
- Click OK
|
|
|
|
- Now start cmd.exe as administrator
|
|
|
|
- Go to C:\GitLab-Runner
|
|
|
|
- And restart gitlab-runner.exe
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
cd C:\GitLab-Runner
|
|
|
|
gitlab-runner.exe restart
|
|
|
|
```
|
|
|
|
|
|
|
|
|
- Now runner should work correctly
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|