@@ -5,22 +5,28 @@ def send_sonar_results_to_github(commit_sha, result, status, sonar_output, pr_nu
55 withCredentials([
66 usernamePassword(credentialsId : ' Matter-Extension-GitHub' , usernameVariable : ' GITHUB_APP' , passwordVariable : ' GITHUB_ACCESS_TOKEN' )
77 ]) {
8- // Escape sonar output for shell command
9- def escapedOutput = sonar_output. replace(' "' , ' \\ "' ). replace(' `' , ' \\ `' ). replace(' $' , ' \\ $' )
8+ // Write sonar output to a temporary file to avoid "Argument list too long" error
9+ def tempFile = " ${ env.WORKSPACE} /sonar_output_${ BUILD_NUMBER} .txt"
10+ writeFile file : tempFile, text : sonar_output
1011
11- sh """
12- python3 -u jenkins_integration/github/send_sonar_results_to_github.py \\
13- --github_token \$ {GITHUB_ACCESS_TOKEN} \\
14- --repo_owner "SiliconLabsSoftware" \\
15- --repo_name "matter_extension" \\
16- --pr_number ${ pr_number} \\
17- --commit_sha ${ commit_sha} \\
18- --result ${ result} \\
19- --status ${ status} \\
20- --branch_name "${ branch_name} " \\
21- --target_branch "${ target_branch} " \\
22- --sonar_output "${ escapedOutput} "
23- """
12+ try {
13+ sh """
14+ python3 -u jenkins_integration/github/send_sonar_results_to_github.py \\
15+ --github_token \$ {GITHUB_ACCESS_TOKEN} \\
16+ --repo_owner "SiliconLabsSoftware" \\
17+ --repo_name "matter_sdk" \\
18+ --pr_number ${ pr_number} \\
19+ --commit_sha ${ commit_sha} \\
20+ --result ${ result} \\
21+ --status ${ status} \\
22+ --branch_name "${ branch_name} " \\
23+ --target_branch "${ target_branch} " \\
24+ --sonar_output_file "${ tempFile} "
25+ """
26+ } finally {
27+ // Clean up temporary file
28+ sh " rm -f '${ tempFile} '"
29+ }
2430 }
2531}
2632
@@ -43,7 +49,7 @@ def publishSonarAnalysis() {
4349
4450 // Prepare global SonarQube parameters
4551 def sonarqubeParams = [
46- " -Dsonar.projectKey=github_matter_sdk " ,
52+ " -Dsonar.projectKey=matter_sdk " ,
4753 " -Dsonar.projectBaseDir=${ env.WORKSPACE} " ,
4854 " -Dsonar.working.directory=${ env.WORKSPACE} /sonar" ,
4955 " -Dsonar.token=${ SONAR_SECRET} " ,
0 commit comments