Integrating SonarQube as a pull request approver on AWS CodeCommit

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    1.sonarQube version:9.9
    2.sonar-scanner version:sonar-scanner-

  • how is SonarQube deployed: zip, Docker, Helm
    Source code deployment used in windows

  • what are you trying to achieve
    Integrating SonarQube as a pull request approver on AWS CodeCommit

  • what have you tried so far to achieve this
    1、MGT-workspace repository is created in aws codecommit, and the buildspec.yml configuration file is created in the library. The content of buildspec.yml is as follows:

1    version: 0.2
3	phases:
4	  install:
5	    runtime-versions:
6	      nodejs: 10
7	    commands:
9	      - wget
10	      - export SONAR_SCANNER_VERSION=
11	      - export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
12	      - curl --create-dirs -sSLo $HOME/.sonar/$
13	      - unzip -o $HOME/.sonar/ -d $HOME/.sonar/
14	      - export PATH=$SONAR_SCANNER_HOME/bin:$PATH
15	      - export SONAR_SCANNER_OPTS="-server"
16	  pre_build:
17	    commands:
18	      - sonar-scanner -Dsonar.projectKey=goadmin -Dsonar.projectName=goadmin -Dsonar.sources=.*.*:9000 -Dsonar.login=sqp_ec76ba88cacabd169b6aced86593760508******
19	      - sleep 5
20	      - curl > analysis.json
21	      - cat analysis.json
22	  build:
23	    commands:
24	      - echo Building Project
25	      - echo Finished Building
27	cache:
28	  paths:
29	    - "node_modules/**/*"

2、Click build in codebuild,The error message is as follows:
[Container] 2023/03/13 08:01:38 Running command sonar-scanner -Dsonar.projectKey=goadmin -Dsonar.projectName=goadmin -Dsonar.sources=. -Dsonar.login=sqp_ec76ba88cacabd169b6aced865937605083208d5

/root/.sonar/sonar-scanner- line 66: /root/.sonar/sonar-scanner- cannot execute binary file

3、I suspect that it is a problem with the java version. I try to add “yum install java-17” to buildspec.yml, but I also prompt that the yum command is not found

I think you’ll just need to recursively make the /.sonar/ directory executable, so that the embedded java executable can be excuted.