Closed ricochetbrown closed 8 months ago
let branch = ''; if (options.branches) { branch = execSync('git rev-parse --abbrev-ref HEAD').toString(); }
This code will always return HEAD for Azure Devops
Same issue with Github actions on PR build. It's not recognized as PR.
In azure devops, a detached head is created, forcing us to do this with nx:
- script: yarn nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) --target=sonar --parallel=1 env: SONAR_TOKEN: $(SONAR_TOKEN)
When we turn branches: true, it only ever shows 'HEAD' in sonarqube as a result. Using SONAR_BRANCH also does not work because sonar.branch is deprecated and we have to use sonar.branch.name
@ricochetbrown The original goal was to to determine the branch for the user, but it has become apparent that the plugin cannot account for every CI provider and how it determines the current branch. I am going to replace the branches
flag with a branch
string property, and it is up to the consumer to pass said property with their nx command
Same issue with Github actions on PR build. It's not recognized as PR.
@frantisekdolsky Please see this comment. Are you looking for Sonar's Pull Request Analysis feature? There are certain properties that the scanner needs to enable that feature which this plugin doesn't support currently.
In azure devops, a detached head is created, forcing us to do this with nx:
- script: yarn nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) --target=sonar --parallel=1 env: SONAR_TOKEN: $(SONAR_TOKEN)
When we turn branches: true, it only ever shows 'HEAD' in sonarqube as a result. Using SONAR_BRANCH also does not work because sonar.branch is deprecated and we have to use sonar.branch.name