Detecting if dotnet core app is running inside docker container

In old days (not so old, albeit like a one or two year(s) ago), we used to insert a docker environment variable like IS_DOCKER_CONTAINER using dockerfile in docker images. This was used to determine if an application is running inside a docker container or not. This helped to set certain attributes of the application like logging level and methods, modify certain environmental settings etc and helped controlling behavior of the application. It can also be useful in other situations like to determine whether you want to run selenium tests or not (as selenium web drivers would not be available inside docker container) to run as part of the integration testing.  Continue reading “Detecting if dotnet core app is running inside docker container”

Updated: Microsoft VSTS converted to Azure DevOps

Visual Studio Team Services (VSTS), Microsoft’s application lifecycle management system, is to undergo a major shake-up and rebranding. Instead of a single Visual Studio-branded service, it’s being split into five separate Azure-branded services, under the banner Azure DevOps.

The five components:

  1. Azure Pipelines, a continuous integration, testing, and deployment system that can connect to any Git repository
  2. Azure Boards, a work tracking system with Kanban boards, dashboards, reporting
    Continue reading “Updated: Microsoft VSTS converted to Azure DevOps”

SonarQube fails to analyze dotnet core code with error Duplicate ProjectGuid: “00000000-0000-0000-0000-000000000000”

After making some changes to the build definition of one of the dotnet core repositories, we started observing this error with the SonarQube tasks inside the build definition in VSTS:

sonarqube code analysis task failed

When we checked the complete logs, we observed below issue:

Continue reading “SonarQube fails to analyze dotnet core code with error Duplicate ProjectGuid: “00000000-0000-0000-0000-000000000000””

Delete Branches in Git using commands

In git workflow, the ideal strategy to work is to fork a new branch, make changes and finally merge in the main development branches. Over the time, this results in creation of large number of branches which are not required and becomes stale. Although a branch is just a pointer to an commit and does not require more than 40 bytes of disk space, it can be painful to search a long list of branches and deciding what you want to work on. Also since we humans are not good with creating unique names for branches, they can also result in confusion.

Below are some steps to clean branches from git repository to remove the clutter. Continue reading “Delete Branches in Git using commands”

Understanding Git Cherry-pick and how it is useful

Git Cherry-pick is used by many Organizations as an alternative to the rebase and merge. Cherry-pick is used to copy selective commits from one branch to another branch. Unlike a merge or rebase, cherry-pick only brings the changes from the commits you select, instead of all the changes in a branch. You can also choose whether to apply only one commit from another branch or a number of commits from another branch.

Why Git Cherry-pick

Cherry-pick is a great way to tackle below common problems:

  1. Accidentally committing on the wrong branch. In this case, one can use git Cherry-pick to apply the change(s) over to the correct branch and then reset the original branch to the previous commit. Continue reading “Understanding Git Cherry-pick and how it is useful”

Understanding Git Garbage Collection

Garbage collection is a well known software practice. The garbage collector, or just collector, attempts to reclaim garbage, or memory occupied by objects that are no longer in use by the program. When we talk about the Git Garbage Collection, we mean almost the same thing. Git garbage collector runs a number of housekeeping tasks within the current repository, such as compressing file revisions (to reduce disk space and increase performance), removing unreachable objects which may have been created from prior invocations of git add, packing refs, pruning reflog or stale working trees.
Continue reading “Understanding Git Garbage Collection”

Publishing Dotnet Core creates multiples nested directories

This is one of the errors that we encountered in the ASP.NET core build process. To this date, this issue can be easily reproduced by creating a ASP.NET core web api process and repeating ‘dotnet publish’ command with using an output directory and parameter –output. However, it does not happen with the simple console applications.

When we try to publish files, it creates nested multiple output directories like below: Continue reading “Publishing Dotnet Core creates multiples nested directories”