Dotnetcore, CI, Linux and VSTS

If you have a dotnetcore project, it is a good idea to setup continuous integration on a Linux machine. This will guarantee that the solution actually compiles correctly and all the tests run perfectly, even in  Linux environment. If you are 100% sure that, if a dotnetcore project runs fine under Windows it should run fine under Linux, you will have some interesting surprises. The first and trivial difference is that Linux filesystem is case sensitive.

If you use dotnetcore, it is  always a good idea to immediately setup a Build against a Linux environment to ensure portability.

I’m starting creating a dedicated pool for Linux machines. Actually having a dedicated pool is not necessary, because the build can require Linux capability, but I’d like to start having all the Linux build agent in a single place for easier management.

image

Figure 1: Create a pool dedicated to build agents running Linux operating system

Pressing the button “download agent” you are prompted with a nice UI that explain in a really easy way how you should deploy your agent under your linux machine.

image

Figure 2: You can easily download the agent from VSTS / TFS web interface

Instruction are detailed, and it is really easy to start your agent in this way: just running a configure shell script and then you can run the agent with another run.sh shell script.

There is also another interesting approach, you can give a shot to the official docker image that you can find here: https://github.com/Microsoft/vsts-agent-docker. The only thing I need to do is running the docker image with the command.

sudo docker run   -e VSTS_ACCOUNT=prxm -d -e VSTS_TOKEN=my_PAT_TOKEN-e VSTS_AGENT='schismatrix' -e VSTS_POOL='Linux' -it microsoft/vsts-agent

Please be patient on the first run because the download can take a little bit, the docker image is pretty big, so you need to patiently wait for the download to finish. Once the docker image is running, you should verify with sudo docker ps that the image is really running fine and you should check on the Agent Pool page if the agent is really connected. The drawback of this approach is that currently only Ubuntu is supported with Docker, but the situation will surely change in the future.

Docker is surely the most simple way to run a VSTS / TFS linux build agent.

Another things to pay attention is running the image with the –d option, because whenever you create a new instance of vsts agent from the docker base image, the image will download the latest agent and this imply that you need to wait a decent amount of time before the agent is up and running, especially if you, like me, are on a standard ADSL connection with max download speed of 5 Mbps.

image

Figure 3: Without the –d option, the image will run interactively and you need to wait for the agent to be downloaded

As you can see from the image, running a new docker instance starts from the base docker image, contacts the VSTS server and download and install the latest version of the agent.

image

Figure 4: After the agent is downloaded the image automatically configure and run the agent and you are up and running.

Only when the output of the docker image states Listening for Jobs the agent should be online and usable.

image

Figure 5: Agent is alive and kicking

Another interesting behavior is that, when you press CTRL+C to stop the interactive container instance, the docker image remove the agent from the server, avoiding the risk to left orphan registration in your VSTS Server.

image

Figure 6: When you stop docker image, the agent is de-registered to avoid orphan agents registration.

Please remember that, whenever you stop the container with CTRL+C, the container will stop, and when you will restart it, it will download again the VSTS agent.

This happens because, whenever the container stop and run again, it need to redownload everything that is not included in the state of the container itself. This is usually not a big problem, and I need to admit that this little nuance is overcome by the tremendous simplicity you have, just run a container and you have your agent up and running, with latest version of dotnetcore (2.0) and other goodness.

The real only drawback of this approach, is that you have little control on what is available on the image. As an example, if you need to have some special software installed in the build machine, probably you need to fork the container and configure the docker machine for your need.

Once everything is up and running (docker or manual run.sh) just fire a build and watch it to be executed in your linux machine.

image

Figure 7: Build with tests executed in Linux machine.

Gian Maria

Error in WSUS after Windows Update KB3148812

I have a test lab with a Windows Server 2012 R2 domain controller, and one of the feature I like the most is WSUS, that allows me to spin of an update new Virtual Machines without the need to wait for all Windows Update to be downloaded from the Internet.

Yesterday I noticed that suddently the WSUS service stopped working, a couple of Test VS gaves me error trying to connect to the update service, and in the WSUS Server the service was indeed stopped.

After a look in Event Viewer I was able to track down that the reason is the database is not operational. I fired Sql Server Management studio and connected to the internal database with the address

\\.\pipe\Microsoft##WID\tsql\query

And noticed that the WSUS Database was in Recovering state, the bad stuff is that I restored a previous backup but the problem did not go away. After a quick search I found that someone blamed the update KB3148812 to be the cause of this problem. After uninstalling that update and rebooting the server the issue went away.

Gian Maria.

How I brought my Nexus7 Back to life

I own a Nexus 7 (2012 version) and I was pretty satisifed with it, it is small, and I used primarly with Zite / Flipboard and to quickly read some news feed. The device is nice, but it has crappy hardware and, after a couple of years, it stops charging.

It turns out that there is some problem on the USB port that prevent proper charging, the simplest solution is buying a Docking Station, but asus decided to stop producing it, and now you can find on the internet at really high price.

The cheapest solution is buying a Flex Charger Cable and replace by yourself. After replacing the tablet started to charge correctly.

Then I noticed that even after a full reset, it is really slower than in the past, so I decided to check if it is a problem in the lollipop upgrade. Google has a public page where you can find all the stock roms for Nexus 7, so I downloaded the Android SDK, downloaded kitkat 4.4.4 then restore the device to KitKat in almost less than half an hour.

Now my tablet is back to life, it has no astonishing speed, but it is perfectly usable, as it was in the past. I’m also happy because I was able to avoid wasting a device that can still be useful.

In the end there are a couple of compliants I have on Nexus 7.

1) If the device has a known problem with Usb Charging (lots of user in the internet claim to have this problem) asus should have continued to produce docking station, instead of forcing people to open and fix the device.

2) Lollipop is really slow on Nexus 7, Google should do better testing of new roms against official old devices, and warn the user that upgrading to the latest version can impact on performance. Also I’d like a simple option to being able to rollback to previous Android version directly on my device, even if it will reset to factory settings.

Gian Maria.

Facebook Code Generator on Windows Phone

If you care about your online security, you would probably enable two factor authentication on every service that supports it. If you enable in facebook you would be prompted to enter a code of your Code Generator application. If you do not know how to obtain such code and ask for helps the site tells you that it is available on your Phone application.

Sadly enough, it seems that Windows Phone Facebook app does not have this option. The simplest solution is using Microsoft Authenticator app, as described in this article.

The algorithm behind secure code generation is a standard, and Microsoft Authenticator Windows Phone app works perfectly even for services that ask you for a Google generator.

Gian Maria.

Outlook 2013 social connector does not works with linkedin

It is a couple of days that Outlook 2013 cannot connect with linkedin anymore, I’ve tried to remove and readd again my account but it fails telling me that Password is not valid.

image

After a brief lookup in the internet I’ve found the reason, the certificate that outlook uses to connect to linkedin is expired (check this on https://outlook.linkedinlabs.com/ ) so we need to wait until linkedin updates the certificate.

If you are in a hurry and really want outlook to connect back again to linkedin you can use a dirty developer trick. Just launch fiddler, a web debugging proxy that is used by developer to intercept traffic of web application. In tools-> Options menu you can instruct fiddler to intercept HTTPS traffic and decrypt it

image

This is usually a security hole, but it is the only way a developer can inspect HTTPS traffic of web application. The good side effect of this options, is that outlook now connect to Linkedin through fiddler, and since I’ve told him to ignore server certificate errors, outlook can connect to linkedin.

image

Clearly as soon as you close fiddler connection get lost, but it can be useful if you need to retrieve some information from linkedin (new contact, etc), then you can simply close fiddler.

Do not remember to remove interception certificate once the problem will be corrected with a new official certificate.

Gian Maria.