Error in pipeline execution

Good morning,

I am telling you that I am developing an application with Angular, which I want to inspect with SonarQube.

My source code is in GitLab, and my SonarQube is on a GCP server, however when I run the pipeline I get the attached error:

Code:

stages:
  - build
  - sonarqube

workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop"
      variables:
        ENV: ${ENV_DEVELOP}
build app:
  stage: build
  image: node:18-alpine
  tags:
    - angular
  script:
    - npm set strict-ssl false
    - npm install --force --silent
    - npm run build:$ENV
    - npm install -g sonarqube-scanner 
  artifacts:
    paths:
      - dist

sonarqube-check:
  stage: sonarqube
  image:
    name: sonarsource/sonar-scanner-cli:latest
    entrypoint: [""]
  tags:
    - angular
  variables:
    SONAR_USER_HOME: "${SONAR_HOST_URL}/.sonar"
    GIT_DEPTH: "0" # Tells git to fetch all the branches of the project
  cache:
    key: "${SONAR_PROJECT_KEY}"
    paths:
      - .sonar/cache
  script:
    - sonar-scanner -X
      -Dsonar.host.url=${SONAR_HOST_URL}
      -Dsonar.token=${SONAR_TOKEN}
      -Dsonar.language=ts
      -Dsonar.exclusions=**/node_modules/**
      -Dsonar.sourceEncoding=UTF-8
      -Dsonar.sources=src/app/
      #-Dsonar.typescript.tsconfigPath=tsconfig.json
  dependencies:
    - build app
  only:
    - merge_requests

Error:

$ sonar-scanner -X -Dsonar.host.url=${SONAR_HOST_URL} -Dsonar.token=${SONAR_TOKEN} -Dsonar.language=ts -Dsonar.exclusions=**/node_modules/** -Dsonar.sourceEncoding=UTF-8 -Dsonar.sources=src/app/ -Dsonar.typescript.tsconfigPath=tsconfig.json
17:46:49.547 INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
17:46:49.573 INFO: Project root configuration file: /builds/outsourcing/app_login/sonar-project.properties
17:46:49.646 INFO: SonarScanner 5.0.1.3006
17:46:49.647 INFO: Java 17.0.11 Alpine (64-bit)
17:46:49.647 INFO: Linux 5.10.223-212.873.amzn2.x86_64 amd64
17:46:50.009 DEBUG: keyStore is : 
17:46:50.010 DEBUG: keyStore type is : pkcs12
17:46:50.011 DEBUG: keyStore provider is : 
17:46:50.012 DEBUG: init keystore
17:46:50.013 DEBUG: init keymanager of type SunX509
17:46:50.298 DEBUG: Create: http:/x.x.x.x/.sonar/cache
17:46:50.300 INFO: User cache: http:/x.x.x.x/.sonar/cache
17:46:50.300 DEBUG: Create: http:/x.x.x.x/.sonar/cache/_tmp
17:46:50.302 DEBUG: Extract sonar-scanner-api-batch in temp...
17:46:50.306 DEBUG: Get bootstrap index...
17:46:50.306 DEBUG: Download: http://x.x.x.x/batch/index
17:47:20.478 ERROR: SonarQube server [http://x.x.x.x] can not be reached
17:47:20.479 INFO: ------------------------------------------------------------------------
17:47:20.479 INFO: EXECUTION FAILURE
17:47:20.479 INFO: ------------------------------------------------------------------------
17:47:20.480 INFO: Total time: 30.960s
17:47:20.535 INFO: Final Memory: 3M/31M
17:47:20.535 INFO: ------------------------------------------------------------------------
17:47:20.535 ERROR: Error during SonarScanner execution
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarScanner analysis
	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:85)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:74)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:70)
	at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:185)
	at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:123)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:74)
	at org.sonarsource.scanner.cli.Main.main(Main.java:62)
Caused by: java.lang.IllegalStateException: Fail to get bootstrap index from server
	at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:42)
	at org.sonarsource.scanner.api.internal.JarDownloader.getScannerEngineFiles(JarDownloader.java:58)
	at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:53)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:76)
	... 7 more
Caused by: java.net.SocketTimeoutException: Connect timed out
	at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:551)
	at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:602)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
	at java.base/java.net.Socket.connect(Socket.java:633)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.platform.Platform.connectSocket(Platform.java:130)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.RealConnection.connectSocket(RealConnection.java:263)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.RealConnection.connect(RealConnection.java:183)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.java:224)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.java:108)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.ExchangeFinder.find(ExchangeFinder.java:88)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.Transmitter.newExchange(Transmitter.java:169)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:41)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.RealCall.getResponseWithInterceptorChain(RealCall.java:221)
	at org.sonarsource.scanner.api.internal.shaded.okhttp.RealCall.execute(RealCall.java:81)
	at org.sonarsource.scanner.api.internal.ServerConnection.callUrl(ServerConnection.java:115)
	at org.sonarsource.scanner.api.internal.ServerConnection.downloadString(ServerConnection.java:99)
	at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:39)
	... 10 more
Cleaning up project directory and file based variables

Could you advise me what I’m doing wrong?

Hi,

The error is pretty clear

You should double-check your sonar.host.url setting. If it’s correct, then you need to talk to your network folks.

 
HTH,
Ann