devonfw / hangar

devonfw Hangar and Takeoff
Apache License 2.0
6 stars 25 forks source link

Block: Quality pipeline for devon4net #101

Open pmalawsk13 opened 2 years ago

pmalawsk13 commented 2 years ago

User Story: As a Developer (setting up the quality pipeline), I want to have a detailed guide and scripts for setting up .NETenvironment, so that I can get it done fast and without errors.

Details: Modify existing blocks related to pipelines with .NET related information. This includes updating guide and scripts related to "Setup Quality pipeline​"

Acceptance Criteria: TBD

zichriste commented 2 years ago

Since I have not been able to finish this in time, here is what I've come to know so far:

According to the official sonar documentation, the correct way to trigger an analysis is the use of SonarScanner. These are the working commands to trigger this locally from the SonarScanner source folder: dotnet SonarScanner.MSBuild.dll begin -k:<Project key> -d:sonar.host.url=<sonarUrl> -d:sonar.login=<sonarToken> dotnet build <ProjectPath to .sln file> dotnet SonarScanner.MSBuild.dll end -d:sonar.login=<sonarUrl> The Project key would also have to be extracted from the .sln file, to be inserted into the -k tag.

There is also instructions on how to manually set up an analysis pipeline.

My issue was how to combine this, to actually have this whole step automated. The last issue I received was my pipeline failing, because it could not find the SonarScanner command. image

My chain of thought originated from being able to integrate the SonarScanner into the repo somehow. But in order to achieve this in the hangar environment, this would also have to be automated. I am unaware if this is possible without setting up the sonar project manually first.

In my testing attempts, I also had to remove most of the pipeline steps, including the artifact download, since this was failing most of the time. I'm not sure if this was part of the problem.