Last active
March 15, 2019 11:45
-
-
Save nikhuber/bd2e35193ec95a576f4f9caf8aead2b1 to your computer and use it in GitHub Desktop.
Gitlab CI pipeline definition for sonar scanner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before_script: | |
- export VERSION="${CI_PROJECT_NAMESPACE}_${CI_BUILD_ID}_$(date "+%Y-%m-%d-%H:%M:%S")" | |
- export PROJECTROOT=`pwd` | |
- export DOCKERPROJECTROOT='/srv/example/' | |
stages: | |
- test | |
- analysis | |
unittests: | |
stage: test | |
script: | |
- phpunit --verbose -c phpunit.xml # Log files are configured in phpunit.xml | |
artifacts: # Persist the files that we use as input for the analysis step | |
paths: | |
- *.xml | |
when: on_success | |
sonar: | |
stage: analysis | |
dependencies: # Include the log files produced during test stage | |
- unittests | |
script: | |
- docker run --rm --mount type=bind,source=$PROJECTROOT,target=$DOCKERPROJECTROOT --tmpfs $DOCKERPROJECTROOT/.scannerwork -w=$DOCKERPROJECTROOT nikhuber/sonar-scanner:3.0.3.778 sonar-scanner -Dsonar.projectVersion=$VERSION |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Nik,
To begin with, congratulations for this great works !
I try to use your sonar scanner in my CI Pipeline Integration.
And I get this error during pipeline running :
And my .gitlab-ci.yml looks like this :
Do you have any idea about this issue ?
Thk's