From 9dbab2cee47f0d0fd13822e52d49fce4772c0a5d Mon Sep 17 00:00:00 2001 From: Carlos Alexandre Date: Mon, 3 Sep 2018 11:10:58 +0100 Subject: [PATCH] updated to dotnet-2.1.401-sdk --- Dockerfile | 2 +- README.md | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3b1c6ab..e0ff41d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/dotnet:2.1-sdk +FROM microsoft/dotnet:2.1.401-sdk ENV SONAR_SCANNER_MSBUILD_VERSION 4.3.1.1372 ENV DOCKER_VERSION 17.06.2 diff --git a/README.md b/README.md index 6833c24..9faa093 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ It also allows you to run Docker in Docker using a docker.sock mount. This image was built with the following components: -* dotnet-sdk-2.1 (stretch) +* dotnet-sdk-2.1.401 (stretch) * SonarQube MSBuild Scanner 4.3.1.1372 * OpenJDK Java 8 (required for Sonar Scanner) * Docker binaries 17.06.2 (for running Docker in Docker using the docker.sock mount) @@ -15,6 +15,7 @@ This image was built with the following components: Tags are written using the following pattern: `dotnet-sonar:..` +* dotnet-sonar:18.09.0 * dotnet-sonar:18.07.0 * dotnet-sonar:18.03.1 * dotnet-sonar:18.03.0 @@ -64,7 +65,7 @@ The following pipeline code will: * Start a sonar scanning session * Build dotnet projects -* Run tests and publish them using the Jenkins XUnit publisher +* Run tests with coverage analysis and publish them using the Jenkins XUnit publisher * End a sonar scanning session * [OPTIONAL] In the end, it waits for sonar's quality gate status and sets the build outcome @@ -75,10 +76,10 @@ node('somenode-with-docker') { withEnv(['HOME=/tmp/home','DOTNET_CLI_TELEMETRY_OPTOUT=1']) { stage('build') { checkout scm - sh "dotnet /sonar-scanner/SonarScanner.MSBuild.dll begin /k:someKey /name:someName /version:someVersion" + sh "dotnet /sonar-scanner/SonarScanner.MSBuild.dll begin /k:someKey /name:someName /version:someVersion /d:sonar.cs.opencover.reportsPaths='tests/**/coverage.opencover.xml'" sh "dotnet build -c Release /property:Version=someVersion" sh "rm -drf ${env.WORKSPACE}/testResults" - sh (returnStatus: true, script: "find tests/**/* -name \'*.csproj\' -print0 | xargs -L1 -0 -P 8 dotnet test --no-build -c Release --logger trx --results-directory ${env.WORKSPACE}/testResults") + sh (returnStatus: true, script: "find tests/**/* -name \'*.csproj\' -print0 | xargs -L1 -0 -P 8 dotnet test --no-build -c Release --logger trx --results-directory ${env.WORKSPACE}/testResults /p:CollectCoverage=true /p:CoverletOutputFormat=opencover") step([$class: 'XUnitPublisher', testTimeMargin: '3000', thresholdMode: 1, thresholds: [[$class: 'FailedThreshold', unstableThreshold: '0'] , [$class: 'SkippedThreshold']], tools: [[$class: 'MSTestJunitHudsonTestType', deleteOutputFiles: true, failIfNotNew: false , pattern: 'testResults/**/*.trx', skipNoTestFiles: true, stopProcessingIfError: true]]]) @@ -119,7 +120,5 @@ The above code will: ## Code Coverage -if you want to add code coverage to your analyses please follow this great instructions - -https://medium.com/@equiman/net-core-unit-test-and-code-coverage-with-visual-studio-code-1a384b462c5f - +The above examples already implement the code-coverage analysis. +If you want to know more, check: . \ No newline at end of file