I got reminded recently about two cases why it may be actually a bad idea to do a complex initialization in a class constructor in C#. All the code samples below are written just for the purpose of this post but are based on real code I either written or came across at some point. Case 1 - instance resolved via an IoC container Recently I was facing an issue that application started but remained non-functional.

Read more →

Pull Requests are sometimes not sufficient - they allow to see changes, perhaps you can even see that a test build passed but these do not allow for actual functional testing or even navigating thru the code. Some times it is convenient to see all the changes in staging area (similar to TFS unshelve functionality) so functional test can be done and code can be reviewed more deeply. Below steps allow to achieve the same state as for TFS unshelve - you end-up with code checked out and staged in GIT:

Read more →

In this post are my notes on how to get working git commands from Jenkinsfile running on Windows build agents. Password authentication Setting up username and password in Jenkins server First in Jenkins server add a new Credentials entry of type Username with password: . Set ID to repo_auth This is later referenced in Jenkinsfile step withCredentials Set Username Set Password Sample Jenkinsfile Now the system is ready to use above information from Jenkinsfile Build script then does following: Fetches username and password into environment variables Invokes any git command which requires authentication pipeline { agent { label 'vs2017' } environment { RELEASE_NUMBER = '1.

Read more →

I spent quite some time on getting this working on Windows with Windows Docker slaves. In the end it turned out to be mostly matter of using correct Jenkins docker plugin. Jenkins docker slave Use Yet Another Docker Plugin With this plugin it just works (Docker Plugin doesn’t work) Install JAVA into docker image and make it available on PATH In Configuration add Yet Another Docker Plugin as a Cloud Point it to Docker server Test that it is available Add the docker image Add label which can be references from builds Jenkins now automatically creates a docker container as a build is executed It does not require any additional changes It properly handles the operating system (Windows) For local only images make sure that the Pull option is set to Never Base Dockerfile This Dockerfile creates the base image for Windows build agent The only requirements is that java.

Read more →

Operating system preparation These notes assume since beginning separation of the Jenkins server and individual build agents so on the server will not be any build utilities except git which is necessary for repository polling. Install Chocolatey (see instructions on web). Install Google Chrome (using Chocolatey is actually much easier than trying to download it from web). choco install -y googlechrome Install git choco install -y git /NoShellIntegration Jenkins Server Setup This is fairly simple:

Read more →