diff --git a/maven-packages/README.md b/maven-packages/README.md index a63c0074530535a9b9b49a943f4774d988df72fb..f3730059913f2ecebcbedd55d4b428c8d861e3f7 100644 --- a/maven-packages/README.md +++ b/maven-packages/README.md @@ -5,6 +5,7 @@ You can include the jobs in this repository's YAML files as follows: ```yml include: - https://git.code.tecnalia.com/digicon-webxr-store/ci-files/-/raw/master/maven-packages/build.yml + - https://git.code.tecnalia.com/digicon-webxr-store/ci-files/-/raw/master/maven-packages/sonarqube.yml - https://git.code.tecnalia.com/digicon-webxr-store/ci-files/-/raw/master/maven-packages/tests.yml - https://git.code.tecnalia.com/digicon-webxr-store/ci-files/-/raw/master/maven-packages/deploy.yml ``` @@ -14,6 +15,7 @@ You can include the execution order in yout .gitlab-ci.yml file as follows: ```yml stages: - build + - code_analysis - test - deploy ``` @@ -35,6 +37,7 @@ An example of a valid .gitlab-ci.yml can be: ```yml include: - https://git.code.tecnalia.com/digicon-webxr-store/ci-files/-/raw/master/maven-packages/build.yml + - https://git.code.tecnalia.com/digicon-webxr-store/ci-files/-/raw/master/maven-packages/sonarqube.yml - https://git.code.tecnalia.com/digicon-webxr-store/ci-files/-/raw/master/maven-packages/tests.yml - https://git.code.tecnalia.com/digicon-webxr-store/ci-files/-/raw/master/maven-packages/deploy.yml @@ -43,6 +46,7 @@ variables: stages: - build + - code_analysis - test - deploy diff --git a/maven-packages/sonarqube.yml b/maven-packages/sonarqube.yml new file mode 100644 index 0000000000000000000000000000000000000000..82504ce5e72df9d5b9595a923ab819cfd3e76fbd --- /dev/null +++ b/maven-packages/sonarqube.yml @@ -0,0 +1,17 @@ +sonarqube-check: + image: maven:3.6.3-jdk-11 + tags: + - docker + stage: code_analysis + variables: + SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache + GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task + cache: + key: "${CI_JOB_NAME}" + paths: + - .sonar/cache + script: + - mvn verify sonar:sonar + allow_failure: true + only: + - master # or the name of your main branch