ci: mount workspace explicitly for sonar scanner
This commit is contained in:
parent
94be980c95
commit
b5e9111039
1 changed files with 5 additions and 4 deletions
|
|
@ -34,6 +34,7 @@ jobs:
|
|||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }}
|
||||
run: |
|
||||
WORKDIR=${GITHUB_WORKSPACE:-$PWD}
|
||||
HOST_URL=${SONAR_HOST_URL:?SONAR_HOST_URL secret not set}
|
||||
PROJECT_KEY=${SONAR_PROJECT_KEY:-}
|
||||
if [ -z "$PROJECT_KEY" ] && [ -f sonar-project.properties ]; then
|
||||
|
|
@ -49,19 +50,19 @@ jobs:
|
|||
echo "Sample files:"
|
||||
find . -maxdepth 2 -type f | head -n 20
|
||||
echo "Check files inside scanner container:"
|
||||
docker run --rm -v "$PWD:/usr/src" -w /usr/src alpine sh -c "ls -la /usr/src | head && find /usr/src -maxdepth 2 -type f -name '*.js' | head -n 20"
|
||||
docker run --rm -v "$WORKDIR:/project" -w /project alpine sh -c "pwd; ls -la . | head && find . -maxdepth 2 -type f -name '*.js' | head -n 20"
|
||||
docker run --rm \
|
||||
-e SONAR_HOST_URL="$HOST_URL" \
|
||||
-e SONAR_TOKEN="$SONAR_TOKEN" \
|
||||
-v "$PWD:/usr/src" \
|
||||
-w /usr/src \
|
||||
-v "$WORKDIR:/project" \
|
||||
-w /project \
|
||||
sonarsource/sonar-scanner-cli \
|
||||
sonar-scanner \
|
||||
-Dsonar.host.url="$HOST_URL" \
|
||||
-Dsonar.projectKey="$PROJECT_KEY" \
|
||||
-Dsonar.sources=. \
|
||||
-Dsonar.scm.disabled=true \
|
||||
-Dsonar.projectBaseDir=/usr/src
|
||||
-Dsonar.projectBaseDir=/project
|
||||
|
||||
docker:
|
||||
needs: [lint, sonar]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue