Hi All
I am trying to use the Sonar SonarCloudPrepare@1 task in Azure DevOps within an extension i have created.
The purpose is to use the extension to ensure that all projects will use SonarQube for analysis.
When I hard code the values for the inputs to the task all works fine - but then the analysis will only be done on the project with key(myAppKey).
e.g.
- task: SonarCloudPrepare@1
displayName: ‘SonarQube - Initialize’
inputs:Hard coded values work - but would be project specific when the extension runs
We want to be able to specify different projects at this point
SonarCloud: SonarQube
organization: myOrg
projectKey: myAppKey
projectName: myAppKey
So i have a csv file for each application repo with a different project key.
The valuses are read from the file and set as follows:
Write-Host “##vso[task.setvariable variable=sonarProjectKey]$sqPK” where $sqPK is read from a csv file
The value is picked up correctly as i output it (in another task) using
Write-Host “Using key: $env:sonarProjectKey”
However when i try to use these environment variables the task does not work…
- task: SonarCloudPrepare@1
displayName: ‘SonarQube - Initialize’
inputs:
SonarCloud: ‘$(env:sonarConnection)’
organization: ‘$(env:sonarOrganization)’
projectKey: ‘$(env:sonarProjectKey)’
projectName: ‘$(env:sonarProjectName)’
Maybe my syntax is wrong.
Any help appreciated.
Thanks Will