I have to create an Azure pipeline to install and deploy my Angular project, one of those steps is not working, in other words, the project was not found in SonarCloud :
My pipeline is :
parameters:
- name: name
default: '[EPP] Front Client'
type: string
- name: serviceName
default: 'EPP_Client'
type: string
- name: version
default: ''
type: string
jobs:
- job: Build_push_and_deploy_${{ parameters.serviceName }}
displayName: Build push and deploy ${{ parameters.name }}
steps:
- task: AzureKeyVault@1
inputs:
azureSubscription: '$(azureKeyVaultServiceConnection)'
KeyVaultName: '$(azureKeyVaultName)'
SecretsFilter: '*'
RunAsPreJob: false
- task: Docker@2
displayName: 'Build front image'
inputs:
containerRegistry: '$(containerRegistryServiceConnection)'
repository: 'front'
command: 'build'
sonarQubeRunAnalysis: true
arguments: >-
--build-arg ENVFILE=$(environment)
--cache-from $(azAcr)/front:latest
addPipelineData: false
tags: |
$(tag)
latest
- task: Docker@2
displayName: 'Login on ACR $(containerRegistryServiceConnection)'
inputs:
command: login
containerRegistry: $(containerRegistryServiceConnection)
- task: Docker@2
displayName: 'Push front image'
inputs:
containerRegistry: '$(containerRegistryServiceConnection)'
repository: 'front'
command: 'push'
tags: |
$(tag)
- task: HelmInstaller@0
displayName: 'Install Helm and Kubectl'
inputs:
helmVersion: '$(helmVersion)'
checkLatestHelmVersion: false
installKubectl: true
kubectlVersion: '$(kubectlVersion)'
- task: HelmDeploy@0
displayName: 'Deploy EPP-front service'
inputs:
connectionType: 'Kubernetes Service Connection'
kubernetesServiceConnection: '$(kubernetesServiceConnection)'
namespace: 'epp'
command: 'upgrade'
chartType: 'FilePath'
chartPath: 'helm/chart'
releaseName: 'epp-front-service'
overrideValues: 'image.tag=$(tag)'
valueFile: 'helm/values_$(environment).yaml'
arguments: >-
--timeout=15m0s
$(helmExtraArgs)
- task: SonarQubePrepare@5
displayName: 'Prepare analysis configuration'
inputs:
SonarQube: 'EPP'
organization: orga
scannerMode: 'CLI'
configMode: 'manual'
cliProjectKey: 'orga_${{parameters.serviceName}}'
cliProjectName: 'orga_${{parameters.serviceName}}'
cliSources: 'src/app'
extraProperties: |
sonar.projectKey=orga_${{parameters.serviceName}}
sonar.projectName=orga_${{parameters.serviceName}}
sonar.typescript.tsconfigPath=src/app/tsconfig.json
sonar.sources=src/app
sonar.test=src/app
sonar.test.inclusions=src/app/**/*.spec.ts
sonar.exclusions=**/node_modules/*
sonar.javascript.lcov.reportPaths=src/app/coverage/lcov.info,src/app/coverage-e2e/lcov.info
- task: SonarQubeAnalyze@5
displayName: 'Run Code Analysis'
- task: SonarQubePublish@5
displayName: 'Publish results on build summary'
inputs:
pollingTimeoutSec: '300'
on the other side, 'orga' is configured as organization and i had analyse other backedn project. is there a steps that is missing ? or test step ?
PS : all steps are working properly when running this pipeline.
Error log :
2022-09-29T15:18:35.9334213Z ERROR: Error during SonarScanner execution
2022-09-29T15:18:35.9334796Z ERROR: Could not find a default branch to fall back on.
2022-09-29T15:18:35.9335298Z ERROR:
2022-09-29T15:18:35.9336129Z ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
2022-09-29T15:18:36.2621538Z ##[error]The process '/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/5.8.0/sonar-scanner/bin/sonar-scanner' failed with exit code 2
2022-09-29T15:18:36.2678083Z ##[section]Finishing: Run Code Analysis