Configure Code Coverage for Dotnet Core 2.0 based applications using SonarQube and Azure DevOps

Using MSBuild tool to get code coverage and configure Azure DevOps pipelines to include code coverage results is an easy task for .NET framework based applications. Azure DevOps (formerly VSTS) contains inbuilt functionality to analyze code coverage files generated and publish results back to VSTS itself. However, it is quite a challenge to get it right and working for .NET Core 2.0 based applications. In this blog post, we’ll cover steps on how to get code coverage results for .NET Core based application using SonarQube and Azure DevOps. Continue reading “Configure Code Coverage for Dotnet Core 2.0 based applications using SonarQube and Azure DevOps”

Fixing error with .gitignore file not ignoring files

This happens almost every now and then with the developers who are very new to the Git. I’m writing it down in the hope that if somehow the original post on stackoverflow is not available for one or other reasons, people can still find the solution. Also, even after fixing this for multiple times, I do not remember the exact commands, I still end up googling the solution. Sometimes, it takes a lot of time to find the original post as there are so many reasons for .gitignore file not working in intended ways. So the scenario is like this, that you are very new to Git or have some understanding of Git or you are very excited about an idea, you started coding on it, then you initialize and then commit your files. Continue reading “Fixing error with .gitignore file not ignoring files”

Fail Azure DevOps pipeline if build fail to pass the SonarQube Quality Gate

Using SonarQube extesions from Marketplace for Azure DevOps provides much of the integration functionality between Azure DevOps and SonarQube. Once the build pipeline completes, you can login in SonarQube server and view the code analysis results. Based on the code analysis results against the Quality threshold set or default Quality Gate threshold, it will be assigned a rating. However, there is no way to stop check-in of code, if it fails to passes the Quality Gate criteria. However, we can use some PowerShell and SonarQube Web APIs to do this part for us. In this blog post, we’ll learn steps to do the same. Continue reading “Fail Azure DevOps pipeline if build fail to pass the SonarQube Quality Gate”

Azure DevOps build pipelines fails with error: To use the property “sonar.branch.name”, the branch plugin is required but not installed.

After upgrading our SonarQube Community version to the newly released version, our build pipelines hosted in the Azure DevOps (formerly VSTS) started failing with below errors:

“02:14:02.317 ERROR: Caused by: Validation of project reactor failed:
o To use the property “sonar.branch.name”, the branch plugin is required but not installed. See the documentation of branch support: https://redirect.sonarsource.com/doc/branches.html”

We were using the same release branches that we were using earlier and there was no changes made to the build configuration. Continue reading “Azure DevOps build pipelines fails with error: To use the property “sonar.branch.name”, the branch plugin is required but not installed.”

Use SSL Certificates for Dotnet Core Application in Docker Containers

Using SSL to secure incoming and outgoing traffic from your server is always recommended. When you are developing locally or testing on a server, whether it is Windows or Macintosh or some distribution of Linux like CentOS, fedora, Ubuntu etc, its easy to put the certificate in one of the local directories and then ask server to use the same. However this becomes a little bit different if you are using Containers. Since Docker is the most popular container technology, it has become almost synonymous with containers. When using containers, you can many choices:
1) Map a local volume containing certificate files to the container and then refer to it from inside container
2) Copy certificate directly inside Container during image build process and then refer to it Continue reading “Use SSL Certificates for Dotnet Core Application in Docker Containers”

Use OpenSSL to work with SSL Certificates, CSR and Private Keys

OpenSSL is a robust, commercial-grade, and full-featured toolkit on the Linux that can be used for a large variety of tasks related to Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It is also a general purpose cryptography library. It is licensed under an Apache-style license, which basically means that you are free to get and use it for commercial and non-commercial purposes subject to some simple license conditions.

It is already installed out of the box on the most linux distributions or available in the trusted package repositories. OpenSSL has been kind of standard in the open source domain to work with SSL and TLS protocols. If for some reason, it is not already installed, you can install it by using your distribution specific commands. Continue reading “Use OpenSSL to work with SSL Certificates, CSR and Private Keys”

Install dotnet core SDK and runtime on Ubuntu OS

.NET Core is the cross platform and open-source framework based on .NET framework.  It is maintained by both Microsoft and the community at https://github.com/dotnet/core on Github. In this blog post, we’ll learn to install dotnet core on the  Ubuntu. For the post’s purpose we’ll use Ubuntu 16.04 since that is latest LTS release from Ubuntu which has the support from almost all software vendors.

Register Microsoft key and feed

Before installing .NET, you’ll need to register the Microsoft key, register the product repository, and install required dependencies by running the following commands: Continue reading “Install dotnet core SDK and runtime on Ubuntu OS”