nosinovacao / dotnet-sonar Goto Github PK
View Code? Open in Web Editor NEWdotnet core build environment with SonarQube MSBuild Scanner integration
License: BSD 3-Clause "New" or "Revised" License
dotnet core build environment with SonarQube MSBuild Scanner integration
License: BSD 3-Clause "New" or "Revised" License
With the current CalVer system for versioning the generated images, a breaking change can be experienced by upgrading from the lowest to highest patch version.
Everyone who uses this image likely knows why this is (different dotnet versions) and can refrain from upgrading this image, but automated tools that upgrade dependencies for projects, such as renovate, do not know about this limitation and therefore mistakenly upgrade. This upgrade is often done as one upgrade among several, which also breaks the other upgrades.
Do not control for the dotnet version within the image versioning scheme, but rather append a version suffix when publishing the image (so 23.12.3 -> 23.12.0-dotnet6, 23.12.4 -> 23.12.0-dotnet7, 23.12.5 -> 23.12.0-dotnet8)
Making this change would be greatly appreciated, since every automated dependency update made on my server code repository has been foiled by this versioning issue.
Hello,
on the start: Thank you for this awesome image it helps a lot.
Can I ask you to update builds on docker hub (https://hub.docker.com/r/nosinovacao/dotnet-sonar/tags)?
Update dotNet Core SDK to v2.1
Docker Tag: 2.1-sdk-stretch
When I run the command
docker run -it --rm -v //c/dev/repo:/source nosinovacao/dotnet-sonar:latest bash -c "cd source \
&& dotnet /sonar-scanner/SonarScanner.MSBuild.dll begin -key:MYKEY -d:sonar.host=http://localhost:9000 \
&& dotnet build -c Debug \
&& dotnet /sonar-scanner/SonarScanner.MSBuild.dll end"
I get an exception (first few lines shown)
21:11:47.87 Updating build integration targets...
21:11:48.014 Failed to request and parse 'http://localhost:9000/api/server/version': Cannot assign requested address (localhost:9000)
Unhandled exception. System.Net.Http.HttpRequestException: Cannot assign requested address (localhost:9000)
What causes this and how to fix? I am running SonarQube server locally from it's own docker container, and it exposes the endpoint as http://localhost:9000
on my local machine (host).
SonarScanner for MSBuild 4.7.1
Using the .NET Core version of the Scanner for MSBuild
Pre-processing started.
Preparing working directories...
08:05:10.146 Updating build integration targets...
08:05:10.163 Fetching analysis configuration settings...
08:05:12.114 Provisioning analyzer assemblies for cs...
08:05:12.115 Installing required Roslyn analyzers...
08:05:13.929 Provisioning analyzer assemblies for vbnet...
08:05:13.929 Installing required Roslyn analyzers...
08:05:13.993 Pre-processing succeeded.
Microsoft (R) Build Engine version 16.3.0+0f4c62fea for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.Restore completed in 19.54 ms for /app/Case1.MVC.Test/Case1.MVC.Test.csproj.
Restore completed in 19.31 ms for /app/Case1.MVC/Case1.MVC.csproj.
CSC : error CS0006: Metadata file '/tmp/.sonarqube/resources/2/analyzers/dotnet/YamlDotNet.dll' could not be found [/app/Case1.MVC/Case1.MVC.csproj]
CSC : error CS0006: Metadata file '/tmp/.sonarqube/resources/2/analyzers/dotnet/SecurityCodeScan.dll' could not be found [/app/Case1.MVC/Case1.MVC.csproj]Build FAILED.
CSC : error CS0006: Metadata file '/tmp/.sonarqube/resources/2/analyzers/dotnet/YamlDotNet.dll' could not be found [/app/Case1.MVC/Case1.MVC.csproj]
CSC : error CS0006: Metadata file '/tmp/.sonarqube/resources/2/analyzers/dotnet/SecurityCodeScan.dll' could not be found [/app/Case1.MVC/Case1.MVC.csproj]
0 Warning(s)
2 Error(s)
`FROM nosinovacao/dotnet-sonar AS build
WORKDIR /app
COPY ./Frontend /app/RUN dotnet restore
&& dotnet /sonar-scanner/SonarScanner.MSBuild.dll begin
/k:survivorbat-frontend
/d:sonar.login=(login)
/d:sonar.host.url=(host)
&& dotnet build
&& dotnet /sonar-scanner/SonarScanner.MSBuild.dll end
/d:sonar.login=(login)`
netcoreapp3.0<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> <DocumentationFile>bin\Debug\Case1.API.xml</DocumentationFile> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <DocumentationFile>bin\Release\Case1.API.xml</DocumentationFile> </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.2" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc4" /> </ItemGroup>
The build works entirely without sonarscanner, I just can't find what is causing this weird manifest error, I've tried it before with my own image and wanted to try out this one, unfortunately this one has the same error.
Sonar will be retiring the Java 11 runtime on October 31st, 2023. (announcement) (docs)
Since it looks like this image uses Java 11, the dockerfile should be updated before then.
Warning log I'm seeing in job execution:
WARN: The version of Java (11.0.18) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Image version I'm using: 23.06.3
Update SonarQube MSBuild scanner to v4.3.1
https://github.com/SonarSource/sonar-scanner-msbuild/releases/tag/4.3.1.1372
I have a .net 4.6 project and use a VM to build and do SonarQube scan.
But I want to find a docker solution to replace the VM, I can use this image to call SonarQube now,
but it's obvious I cannot build my project because this image only supports .NET 5/6/7.
I'm not sure, is it possible to build .net 4 in this image?
The 23.02.4 is actually dotnet 6: https://github.com/nosinovacao/dotnet-sonar/blob/23.02.4/Dockerfile
23.02.3 is dotnet 7: https://github.com/nosinovacao/dotnet-sonar/blob/23.02.3/Dockerfile
The docker image is correct but the tags don't appear to be.
I have followed the instructions in here: https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+MSBuild
And when I execute: 'dotnet sonarscanner end'
I get the following output:
`SonarScanner for MSBuild 4.3.1
Using the .NET Core version of the Scanner for MSBuild
Default properties file was found at /opt/programas/jenkins2/.dotnet/tools/.store/dotnet-sonarscanner/4.3.1/dotnet-sonarscanner/4.3.1/tools/netcoreapp2.1/any/SonarQube.Analysis.xml
Loading analysis properties from /opt/programas/jenkins2/.dotnet/tools/.store/dotnet-sonarscanner/4.3.1/dotnet-sonarscanner/4.3.1/tools/netcoreapp2.1/any/SonarQube.Analysis.xml
Post-processing started.
11:15:10.274 Loading the SonarQube analysis config from /opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/.sonarqube/conf/SonarQubeAnalysisConfig.xml
11:15:10.302 Not running under TeamBuild
11:15:10.303 Analysis base directory: /opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/.sonarqube
Build directory:
Bin directory: /opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/.sonarqube/bin
Config directory: /opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/.sonarqube/conf
Output directory: /opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/.sonarqube/out
Config file: /opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/.sonarqube/conf/SonarQubeAnalysisConfig.xml
Generating SonarQube project properties file to /opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/.sonarqube/out/sonar-project.properties
Setting analysis property: sonar.visualstudio.enable=false
The supplied Code Analysis ErrorLog file is a valid json file and does not need to be fixed: /opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/dist/APISN.Webservices.Opcao.dll.RoslynCA.json
Using longest common projects root path as project base directory: '/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/APISN.Webservices.Opcao'.
Dumping content of sonar-project.properties
sonar.projectKey=DEBHE.DE605.APISN.Webservices.Opcao
sonar.projectName=DEBHE.DE605.APISN.Webservices.Opcao
sonar.projectVersion=0.0.1
sonar.working.directory=/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/.sonarqube/out/.sonar
sonar.projectBaseDir=/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/APISN.Webservices.Opcao
C78B51AA-1311-4EFE-BDB7-5FE10BEE452E.sonar.projectKey=DEBHE.DE605.APISN.Webservices.Opcao:C78B51AA-1311-4EFE-BDB7-5FE10BEE452E
C78B51AA-1311-4EFE-BDB7-5FE10BEE452E.sonar.projectName=APISN.Webservices.Opcao
C78B51AA-1311-4EFE-BDB7-5FE10BEE452E.sonar.projectBaseDir=/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/APISN.Webservices.Opcao
C78B51AA-1311-4EFE-BDB7-5FE10BEE452E.sonar.sourceEncoding=utf-8
C78B51AA-1311-4EFE-BDB7-5FE10BEE452E.sonar.sources=\
"/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/APISN.Webservices.Opcao/Authentication/JwtTokenConfiguration.cs",\
"/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/APISN.Webservices.Opcao/Controllers/OpcaoController.cs",\
"/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/APISN.Webservices.Opcao/Helpers/HttpHelper.cs",\
"/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/APISN.Webservices.Opcao/Models/Erro.cs",\
"/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/APISN.Webservices.Opcao/Models/OpcaoSn.cs",\
"/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/APISN.Webservices.Opcao/Models/PeriodoMei.cs",\
"/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/APISN.Webservices.Opcao/Models/PeriodoSimples.cs",\
"/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/APISN.Webservices.Opcao/Program.cs",\
"/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/APISN.Webservices.Opcao/Startup.cs",\
"/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/APISN.Webservices.Opcao/obj/Release/netcoreapp2.1/APISN.Webservices.Opcao.RazorAssemblyInfo.cs",\
"/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/APISN.Webservices.Opcao/obj/Release/netcoreapp2.1/APISN.Webservices.Opcao.AssemblyInfo.cs",\
"/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/APISN.Webservices.Opcao/nuget.config",\
"/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/APISN.Webservices.Opcao/appsettings.Development.json",\
"/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/APISN.Webservices.Opcao/appsettings.json",\
"/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/APISN.Webservices.Opcao/Properties/launchSettings.json"
C78B51AA-1311-4EFE-BDB7-5FE10BEE452E.sonar.cs.roslyn.reportFilePath=/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/dist/APISN.Webservices.Opcao.dll.RoslynCA.json
C78B51AA-1311-4EFE-BDB7-5FE10BEE452E.sonar.cs.analyzer.projectOutPath=/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/.sonarqube/out/0
C78B51AA-1311-4EFE-BDB7-5FE10BEE452E.sonar.cs.analyzer.projectOutPaths=\
"/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/.sonarqube/out/0"
C78B51AA-1311-4EFE-BDB7-5FE10BEE452E.sonar.cs.roslyn.reportFilePaths=\
"/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/src/dist/APISN.Webservices.Opcao.dll.RoslynCA.json"
sonar.host.url=http://sonar.aic.serpro:8080
sonar.cs.vstest.reportsPaths=%CD%TestResults*.trx
sonar.cs.vscoveragexml.reportsPaths=%CD%VisualStudio.coveragexml
sonar.buildbreaker.queryMaxAttempts=60
sonar.verbose=true
sonar.exclusions=/*.css,/.js,**/.xhtml,**/*.xml
sonar.visualstudio.enable=false
sonar.modules=C78B51AA-1311-4EFE-BDB7-5FE10BEE452E
Writing processing summary to /opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/.sonarqube/out/ProjectInfo.log
SONAR_SCANNER_OPTS is not configured. Setting it to the default value of -Xmx1024m
Calling the SonarQube Scanner...
Setting environment variable 'SONAR_SCANNER_OPTS'. Value: -Xmx1024m
Executing file /opt/programas/jenkins2/.dotnet/tools/.store/dotnet-sonarscanner/4.3.1/dotnet-sonarscanner/4.3.1/tools/netcoreapp2.1/any/sonar-scanner-3.2.0.1227/bin/sonar-scanner
Args: -Dsonar.scanAllFiles=true -Dproject.settings=/opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore/.sonarqube/out/sonar-project.properties --embedded
Working directory: /opt/programas/jenkins2/workspace/DEBHE/DE605/NetCore
Timeout (ms):-1
Process id: 28083
which: no java in (/usr/local/bin:/usr/bin:/opt/programas/jenkins2/.dotnet/tools:/opt/programas/jenkins2/bin)
/opt/programas/jenkins2/.dotnet/tools/.store/dotnet-sonarscanner/4.3.1/dotnet-sonarscanner/4.3.1/tools/netcoreapp2.1/any/sonar-scanner-3.2.0.1227/bin/sonar-scanner: line 59: exec: : not found
Process returned exit code 127
The SonarQube Scanner did not complete successfully
11:15:10.647 Creating a summary markdown file...
11:15:10.65 Post-processing failed. Exit code: 1
script returned exit code 1`
I'm working on a project based on .net 8, can you please add support for .net in the docker image?
if not possible can you guide me how to do it myself?
NodeJS v16 reached end of life.
Can you please update it to 18 or 20?
I'm mostly interested in .NET 6 images.
Update dotNet Core sdk to v3.0
tag: mcr.microsoft.com/dotnet/core/sdk:3.0
Is there any plan to update Dockerhub with the latest version?
Hi,
Nice Dockerfile
.
I'm a member of a team finding it useful in our c# build pipeline.
We've found previous issues with handy Dockerfile
's that end up having inappropriate licenses.
Could you please make your License for this explicit?
Error running SonarScanner when the project is in DotNetCore 3.x returns the following error:
It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '2.0.0' was not found.
- The following frameworks were found:
3.0.0 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Link publish at the end of your README was writhed for me, but was moved to: https://dev.to/deinsoftware/net-core-unit-test-and-code-coverage-with-visual-studio-code-37bp
Thanks, to mention it on your documentation.
Hi,
did you face this problem: NuGet/Announcements#49 ?
I see your base image is the debian image of the sdk the certs are updated: https://github.com/nosinovacao/dotnet-sonar/blob/master/Dockerfile#L21
Probably a rebuild of the image will fix the problem, any chance to re-trigger it?
Thanks in advance
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.