Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.

Commit f1d5a2a

Browse files
SCSCANGHA-13 Warning instead of failure for Maven/Gradle projects
1 parent 714bd35 commit f1d5a2a

File tree

2 files changed

+20
-22
lines changed

2 files changed

+20
-22
lines changed

.github/workflows/qa.yml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ jobs:
6363
run: |
6464
echo "Expected previous step to fail"
6565
exit 1
66-
failFastGradleTest:
66+
dontFailGradleTest:
6767
name: >
68-
Fail fast on Gradle project
68+
Don't fail on Gradle project
6969
runs-on: ubuntu-latest
7070
steps:
7171
- uses: actions/checkout@v4
@@ -79,14 +79,13 @@ jobs:
7979
SONAR_TOKEN: FAKE_TOKEN
8080
with:
8181
projectBaseDir: ./test/gradle-project
82-
- name: Previous should have failed
83-
if: ${{ steps.runTest.outcome == 'success'}}
82+
args: -Dsonar.scanner.dumpToFile=./output.properties
83+
- name: Assert
8484
run: |
85-
echo "Expected previous step to fail"
86-
exit 1
87-
failFastGradleKotlinTest:
85+
./test/assertFileExists ./output.properties
86+
dontFailGradleKotlinTest:
8887
name: >
89-
Fail fast on Kotlin Gradle project
88+
Don't fail on Kotlin Gradle project
9089
runs-on: ubuntu-latest
9190
steps:
9291
- uses: actions/checkout@v4
@@ -100,14 +99,13 @@ jobs:
10099
SONAR_TOKEN: FAKE_TOKEN
101100
with:
102101
projectBaseDir: ./test/gradle-project-kotlin
103-
- name: Previous should have failed
104-
if: ${{ steps.runTest.outcome == 'success'}}
102+
args: -Dsonar.scanner.dumpToFile=./output.properties
103+
- name: Assert
105104
run: |
106-
echo "Expected previous step to fail"
107-
exit 1
108-
failFastMavenTest:
105+
./test/assertFileExists ./output.properties
106+
dontFailMavenTest:
109107
name: >
110-
Fail fast on Maven project
108+
Don't fail on Maven project
111109
runs-on: ubuntu-latest
112110
steps:
113111
- uses: actions/checkout@v4
@@ -121,11 +119,10 @@ jobs:
121119
SONAR_TOKEN: FAKE_TOKEN
122120
with:
123121
projectBaseDir: ./test/maven-project
124-
- name: Previous should have failed
125-
if: ${{ steps.runTest.outcome == 'success'}}
122+
args: -Dsonar.scanner.dumpToFile=./output.properties
123+
- name: Assert
126124
run: |
127-
echo "Expected previous step to fail"
128-
exit 1
125+
./test/assertFileExists ./output.properties
129126
runnerDebugUsedTest:
130127
name: >
131128
'RUNNER_DEBUG' is used
@@ -144,3 +141,4 @@ jobs:
144141
- name: Assert
145142
run: |
146143
./test/assertFileContains ./output.properties "sonar.verbose=true"
144+

entrypoint.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ if [[ -z "${SONAR_TOKEN}" ]]; then
88
fi
99

1010
if [[ -f "${INPUT_PROJECTBASEDIR%/}/pom.xml" ]]; then
11-
echo "Maven project detected. You should run the goal 'org.sonarsource.scanner.maven:sonar' during build rather than using this GitHub Action."
12-
exit 1
11+
echo "WARNING! Maven project detected. Sonar recommends running the 'org.sonarsource.scanner.maven:sonar-maven-plugin:sonar' goal during the build process instead of using this GitHub Action
12+
to get more accurate results."
1313
fi
1414

1515
if [[ -f "${INPUT_PROJECTBASEDIR%/}/build.gradle" || -f "${INPUT_PROJECTBASEDIR%/}/build.gradle.kts" ]]; then
16-
echo "Gradle project detected. You should use the SonarQube plugin for Gradle during build rather than using this GitHub Action."
17-
exit 1
16+
echo "WARNING! Gradle project detected. Sonar recommends using the SonarQube plugin for Gradle during the build process instead of using this GitHub Action
17+
to get more accurate results."
1818
fi
1919

2020
if [[ -z "${SONARCLOUD_URL}" ]]; then

0 commit comments

Comments
 (0)