Escribo este rápido post por un error que me acaba de ocurrir y ha sido utilizando Sonar Cloud lanzando el flujo de trabajo desde Git Hub actions al hacer un push en el código o un PR. El problema ha surgido con un código que llevaba funcionando desde hace 2 semana pero de repente ha dejado de funcionar dando el siguiente mensaje de error.
Run SonarSource/sonarqube-scan-action@v4.0.0
Run ${GITHUB_ACTION_PATH}/sanity-checks.sh
Run actions/cache@v4.0.2
Cache not found for input keys: sonar-scanner-cli-6.2.1.4610-Linux-X64
Run ${GITHUB_ACTION_PATH}/install-sonar-scanner-cli.sh
+ mkdir -p /home/runner/work/_temp/sonarscanner
+ cd /home/runner/work/_temp/sonarscanner
+ wget --no-verbose --user-agent=sonarqube-scan-action https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.2.1.4610-linux-x64.zip
2025-01-29 15:22:36 URL:https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.2.1.4610-linux-x64.zip [57996219/57996219] -> "sonar-scanner-cli-6.2.1.4610-linux-x64.zip" [1]
+ unzip -q sonar-scanner-cli-6.2.1.4610-linux-x64.zip
+ mv sonar-scanner-6.2.1.4610-linux-x64 /home/runner/work/_temp/sonar-scanner-cli-6.2.1.4610-Linux-X64
Run echo "${RUNNER_TEMP}/sonar-scanner-cli-6.2.1.4610-Linux-X64/bin" >> $GITHUB_PATH
Run ${GITHUB_ACTION_PATH}/run-sonar-scanner.sh -Dsonar.projectKey=antuansoft_sonarcloudtest-int -Dsonar.organization=antuansoft
+ sonar-scanner -Dsonar.projectKey=antuansoft_sonarcloudtest-int -Dsonar.organization=antuansoft
15:22:38.057 INFO Scanner configuration file: /home/runner/work/_temp/sonar-scanner-cli-6.2.1.4610-Linux-X64/conf/sonar-scanner.properties
15:22:38.060 INFO Project root configuration file: /home/runner/work/sonarcloudtest-int/sonarcloudtest-int/sonar-project.properties
15:22:38.075 INFO SonarScanner CLI 6.2.1.4610
15:22:38.077 INFO Java 17.0.12 Eclipse Adoptium (64-bit)
15:22:38.078 INFO Linux 6.8.0-1020-azure amd64
15:22:38.103 INFO User cache: /home/runner/.sonar/cache
15:22:38.577 INFO JRE provisioning: os[linux], arch[x86_64]
15:22:39.966 INFO EXECUTION FAILURE
15:22:39.967 INFO Total time: 1.912s
15:22:39.968 ERROR Error during SonarScanner CLI execution
java.lang.IllegalStateException: Call to URL [https://scanner.sonarcloud.io/jres/OpenJDK17U-jre_x64_linux_hotspot_17.0.11_9.tar.gz] failed
at org.sonarsource.scanner.lib.internal.http.ScannerHttpClient.callUrl(ScannerHttpClient.java:159)
at org.sonarsource.scanner.lib.internal.http.ScannerHttpClient.downloadFile(ScannerHttpClient.java:90)
at org.sonarsource.scanner.lib.internal.http.ScannerHttpClient.downloadFromExternalUrl(ScannerHttpClient.java:72)
at org.sonarsource.scanner.lib.internal.JavaRunnerFactory$JreDownloader.download(JavaRunnerFactory.java:253)
at org.sonarsource.scanner.lib.internal.cache.FileCache.download(FileCache.java:101)
at org.sonarsource.scanner.lib.internal.cache.FileCache.getOrDownload(FileCache.java:88)
at org.sonarsource.scanner.lib.internal.JavaRunnerFactory.getJreFromServer(JavaRunnerFactory.java:143)
at org.sonarsource.scanner.lib.internal.JavaRunnerFactory.createRunner(JavaRunnerFactory.java:85)
at org.sonarsource.scanner.lib.internal.ScannerEngineLauncherFactory.createLauncher(ScannerEngineLauncherFactory.java:53)
at org.sonarsource.scanner.lib.ScannerEngineBootstrapper.bootstrap(ScannerEngineBootstrapper.java:123)
at org.sonarsource.scanner.cli.Main.analyze(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:63)
Caused by: java.net.UnknownHostException: scanner.sonarcloud.io: Name or service not known
at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
El código utilizado para lanzar este análisis ha sido desde una github action con este código:
El principal problema es que la versión que estamos utilizando de la github action se ha quedado obsoleta, la 4.0.0 y hay que utilizar la versión nueva que a fecha de hoy es la versión 4.2.1name: SonarCloud analysis on: push: branches: [ "main" ] pull_request: branches: [ "main" ] workflow_dispatch: permissions: pull-requests: read # allows SonarCloud to decorate PRs with analysis results jobs: Analysis: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: # Disabling shallow clones is recommended for improving the relevancy of reporting fetch-depth: 0 - name: Analyze with SonarCloud # You can pin the exact commit or the version. # uses: SonarSource/sonarcloud-github-action@v2.2.0 uses: SonarSource/sonarqube-scan-action@v4.0.0 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret) with: # Additional arguments for the SonarScanner CLI args: # Unique keys of your project and organization. You can find them in SonarCloud > Information (bottom-left menu) # mandatory -Dsonar.projectKey=antuansoft_sonarcloudtest-int -Dsonar.organization=antuansoft # Comma-separated paths to directories containing main source files. #-Dsonar.sources= # optional, default is project base directory # Comma-separated paths to directories containing test source files. #-Dsonar.tests= # optional. For more info about Code Coverage, please refer to https://docs.sonarcloud.io/enriching/test-coverage/overview/ # Adds more detail to both client and server-side analysis logs, activating DEBUG mode for the scanner, and adding client-side environment variables and system properties to the server-side log of analysis report processing. #-Dsonar.verbose= # optional, default is false # When you need the analysis to take place in a directory other than the one from which it was launched, default is . # projectBaseDir: .
Con lo cual cambiando esta línea a la versión actual todo vuelve a funcionar:
uses: SonarSource/sonarqube-scan-action@v4.2.1
Referencias:
No hay comentarios:
Publicar un comentario