stages:
  - sonar_scan

sonar_scan:
  stage: sonar_scan
  only : 
    - test-sonar   
  image: maven:3.8.1-jdk-11 # Use an appropriate image
  script:
    - apt-get update && apt-get install -y wget unzip
    - wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-linux.zip
    - unzip sonar-scanner-cli-4.6.2.2472-linux.zip
    - export PATH="$PATH:$(pwd)/sonar-scanner-4.6.2.2472-linux/bin"
    - sonar-scanner -D"sonar.projectKey=SpnPatchLaravel" -D"sonar.sources=." -D"sonar.host.url=https://sonarqube.netbay.co.th/sonarqube" -D"sonar.login=910cc03c818c8884525a2c3f2b1d19cd8d98104f"