Skip to content

Commit

Permalink
Increase heap only for Sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
asolimando committed Jul 26, 2024
1 parent bc04b80 commit 88e7e27
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,15 @@ node('ubuntu') {
timeout(time: 1, unit: 'HOURS') {
withEnv(["Path+JDK=$JAVA_JDK_17/bin","JAVA_HOME=$JAVA_JDK_17"]) {
withCredentials([string(credentialsId: 'SONARCLOUD_TOKEN', variable: 'SONAR_TOKEN')]) {
if ( env.BRANCH_NAME.startsWith("PR-") ) {
sh './gradlew build --no-parallel --no-daemon jacocoAggregateTestReport sonar -PenableJacoco -Porg.sonarqube.version=4.4.1.3373 -Dsonar.pullrequest.branch=${CHANGE_BRANCH} -Dsonar.pullrequest.base=${CHANGE_TARGET} -Dsonar.pullrequest.key=${CHANGE_ID} -Dsonar.token=${SONAR_TOKEN}'
def JVM_ARGS = "-XX:+UseG1GC -Xmx1536m -XX:MaxMetaspaceSize=512m"
def COMMON_ARGS = "build --no-parallel --no-daemon jacocoAggregateTestReport sonar -PenableJacoco -Porg.sonarqube.version=4.4.1.3373 -Dsonar.token=${SONAR_TOKEN} -Dorg.gradle.jvmargs='${JVM_ARGS}' "

if (env.BRANCH_NAME.startsWith("PR-")) {
def PR_ARGS = "-Dsonar.pullrequest.branch=${CHANGE_BRANCH} -Dsonar.pullrequest.base=${CHANGE_TARGET} -Dsonar.pullrequest.key=${CHANGE_ID}"
sh "./gradlew ${COMMON_ARGS} ${PR_ARGS}"
} else {
sh './gradlew build --no-parallel --no-daemon jacocoAggregateTestReport sonar -PenableJacoco -Porg.sonarqube.version=4.4.1.3373 -Dsonar.branch.name=${BRANCH_NAME} -Dsonar.token=${SONAR_TOKEN}'
def BRANCH_ARGS = "-Dsonar.branch.name=${BRANCH_NAME}"
sh "./gradlew ${COMMON_ARGS} ${BRANCH_ARGS}"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
org.gradle.jvmargs=-XX:+UseG1GC -Xmx1536m -XX:MaxMetaspaceSize=512m
org.gradle.jvmargs=-XX:+UseG1GC -Xmx1g -XX:MaxMetaspaceSize=512m
org.gradle.parallel=true
# Build cache can be disabled with --no-build-cache option
org.gradle.caching=true
Expand Down

0 comments on commit 88e7e27

Please sign in to comment.