<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Jitendra Kumar</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/jikuma/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/jikuma/feed.xml</link>
    <description>Product Management, DevOps, Programming</description>
    <lastBuildDate>Wed, 17 Apr 2019 04:08:17 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Error //./pipe/docker_engine: Access is denied. In the default daemon configuration on Windows.</title>
      <link>https://docs.microsoft.com/archive/blogs/jikuma/error-pipedocker_engine-access-is-denied-in-the-default-daemon-configuration-on-windows</link>
      <pubDate>Mon, 19 Mar 2018 15:19:21 GMT</pubDate>
      <dc:creator><![CDATA[jikuma]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jikuma/?p=465</guid>
      <description><![CDATA[While executing VSTS\TFS docker task, you might get the following error.




error during...]]></description>
      <content:encoded><![CDATA[<div>
<div>While executing VSTS\TFS docker task, you might get the following error.<br /><br /></div>
</div>
<div></div>
<div></div>
<div>
<div><em>error during connect: Post &lt;url&gt;: open //./pipe/docker_engine: Access is denied. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.</em><br /><br /></div>
</div>
<div></div>
<div></div>
<div>The error means that the VSTS agent which is executing the docker client does not have permission to write to the named pipe '<span>docker_engine'. </span><br /><br /></div>
<div></div>
<div></div>
<div>When you install docker engine by default only the administrator group has the permission to write to the 'docker_engine' named pipe. If you configure VSTS agent service with the user account which is not the agent machine administrator, you will face this issue.<br /><br /></div>
<div></div>
<div></div>
<div><strong>Solution 1:</strong><br /><br /></div>
<div></div>
<div></div>
<div>Step 1. Add the user\group used to configure VSTS agent as an administrator.</div>
<div>Step 2. Restart the VSTS agent service.</div>
<div></div>
<div></div>
<br /><br />
<div><strong>Solution 2</strong><br /><br /></div>
<div></div>
<div></div>
<div>Step 1: Create a new group. Say 'docker_engine'</div>
<div>Step 2: Add the user which is used to configure VSTS agent to this group.</div>
<div>Step 3: edit the docker daemon configuration json file to add  ("group": "docker_engine"). More info <a href="https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/configure-docker-daemon#set-docker-security-group">here</a>.</div>
<div>Step 4: Restart the VSTS agent service.</div>]]></content:encoded>
    </item>
    <item>
      <title>Kubernetes Services task failing in VSTS.</title>
      <link>https://docs.microsoft.com/archive/blogs/jikuma/kubernetes-services-task-failing-in-vsts</link>
      <pubDate>Tue, 19 Dec 2017 23:06:06 GMT</pubDate>
      <dc:creator><![CDATA[jikuma]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jikuma/?p=407</guid>
      <description><![CDATA[Fix for this issue has been deployed. Now you can pin your kubernetes task to a particular version...]]></description>
      <content:encoded><![CDATA[Fix for this issue has been deployed. Now you can pin your kubernetes task to a particular version of kubectl client by specifying the version in the Advance section of the task.

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/solution-1024x269.png" alt="" width="1024" height="269" class="alignnone size-large wp-image-445" />

&nbsp;

<hr />



<hr />

&nbsp;

&nbsp;

<hr />

If your kubernetes task is failing since 17/12/2017, this is because latest version 1.9.0 of kubectl is released. Unfortunately, kubernetes task always pulls the latest version of kubectl which is not compatible with the older kubectl server.

The workaround involves having kubectl setup on the agent machine so that task does not pull the latest version.

<strong>If you are running release on your private agent.</strong>

Download the version of kubectl you want from https://storage.googleapis.com/kubernetes-release/release/%version%/bin/windows/amd64/kubectl.exe like https://storage.googleapis.com/kubernetes-release/release/v1.8.0/bin/windows/amd64/kubectl.exe

Keep it in a folder say "C:\kube\".

Now update the Path variable to include the folder path.

Once u have made the change make sure to restart the agent and if running agent as service restart the service. Check by echoing Path variable if the change is reflecting or not. You might have to also restart your command prompt.

<strong>If you are running release on hosted agent</strong>

Download the desired kubectl version.

Check it in the source code or add it as a part of artifact.

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/kube1.png" alt="" width="246" height="277" class="alignnone size-full wp-image-416" />

In the release definition add a powershell task and set Type to file path.

Use file picker in Script path to navigate to kubectl.exe

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/kube2.png" alt="" width="555" height="563" class="alignnone size-full wp-image-426" />

&nbsp;

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/kube3-1024x299.png" alt="" width="1024" height="299" class="alignnone size-large wp-image-435" />

Select till folder path of kubectl.exe in above example "$(System.DefaultWorkingDirectory)/first/"

Switch the type to Inline script.

In inline script add

Write-Host "##vso[task.setvariable variable=path;]$env:path;$Args"

In Argument section add the folder path of kubectl.

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/kube4-1024x518.png" alt="" width="1024" height="518" class="alignnone size-large wp-image-436" />

This will fix the release add the k8 task will start using the k8 client which is part of the artifact.

If you face any issue, you can add command line task to echo Path variable to check if it is updated or not. You can also execute where kubectl to check which kubectl is being used.

&nbsp;

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Setting up continuous deployment from Docker Hub using VSTS Release Management</title>
      <link>https://docs.microsoft.com/archive/blogs/jikuma/setting-continuous-deployment-from-dockerhub-using-vsts-release-management</link>
      <pubDate>Tue, 05 Dec 2017 20:25:39 GMT</pubDate>
      <dc:creator><![CDATA[jikuma]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jikuma/?p=175</guid>
      <description><![CDATA[Now you can set up continuous deployment from DockerHub using Visual Studio Team Services Release...]]></description>
      <content:encoded><![CDATA[Now you can set up continuous deployment from DockerHub using Visual Studio Team Services Release management. A release can get triggered automatically once an image is updated in docker hub.

We will see how this can help us automatically keep our Azure web app updated with the source code sitting in GitHub.

<strong>Step 1: (Code):</strong> You can keep your code on GitHub. For example <a href="https://github.com/jikuma/nodeJsSampleService"><em>https://github.com/jikuma/nodeJsSampleService</em></a>. This is a simple site which displays "Hello Docker Hub".

We want to automatically create/update a container image once any edit is made to source code. Once an image is pushed to Docker hub, we further want to automatically trigger VSTS release to update my website hosted in Azure web app.

<strong>Step 2: (CI):</strong> Once we have a code we want to automatically build and push an image to docker hub.

<strong>Step: 2.1</strong> <strong>(Link GitHub to your Docker Hub Account):</strong>

Log in to your docker hub account

If you have not already connected your GitHub account to DockerHub account, you will have to link these account. Here are steps to do it.

<strong>Step: 2.1.a:  </strong>Click on link account

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/createCI1.png" alt="" width="797" height="246" class="alignnone size-full wp-image-225" />

&nbsp;

Select link GitHub and then provide details to link your GitHub account

If a GitHub account is already linked you will get list of your GitHub repository

<strong>Step: 2.2</strong> <strong>(Create a Docker Hub image/repository using GitHub repo)</strong>

Click on Create -&gt; Create Automated Build -&gt; Github

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/listrepo2-1024x207.png" alt="" width="1024" height="207" class="alignnone size-large wp-image-256" />

Select the repository you want to create image from

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/createrepo3-1024x359.png" alt="" width="1024" height="359" class="alignnone size-large wp-image-235" />

Enter repo details and select Create.

A docker hub repository will be created for you.

<strong>Step: 2.3 (Verify that CI is set up for you):</strong>

Go to Build settings tab of Docker hub repo and check if the setting is correct.

&nbsp;

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/replacement1-1024x481.png" alt="" width="1024" height="481" class="alignnone size-large wp-image-306" />

It's saying that whenever a change is made to master branch of the GitHub repo it will trigger image build and will update the docker hub repo.

Your CI is set up. You can now make changes to your Github repo and check if Docker hub repository/image is getting updated or not.

You can see a build getting triggered in the Build Details tab.

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/builddetails5-1024x458.png" alt="" width="1024" height="458" class="alignnone size-large wp-image-207" />

&nbsp;

<strong>Step 3: (Setting up CD: update my website as soon as the new image is pushed to Docker hub).</strong>

<strong>Step 3.1: </strong> Let's create an Azure web app using this docker hub image.

<strong>Step 3.1.a </strong> Log into the Azure portal <a href="https://portal.azure.com">https://portal.azure.com</a>

<strong>Step 3.1.b  </strong>Select App service

Click on the plus to create new web app.

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/webapp1.png" alt="" width="294" height="366" class="alignnone size-full wp-image-315" />

&nbsp;

Search for ‘Web App for Containers’, and press 'Create'.

Give details, like app name and click on 'Configure Container'.

Input the image details.

&nbsp;

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/webapp.png" alt="" width="888" height="590" class="alignnone size-full wp-image-286" />

Click ok, to create the web app.

Once the web app is created, visit the site to check if deployment is successful.

&nbsp;

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/azurewebapp.png" alt="" width="421" height="103" class="alignnone size-full wp-image-205" />

Once you have successfully deployed your web app, we will set up a CD so that whenever the image is updated in the DockerHub, web app gets updated automatically.

<strong>Step 3.2: (Setup CD using VSTS Release Definition):</strong>

Let's create a Release Definition in VSTS to achieve Continuous deployment

Log in to your VSTS account. If you don't already have a VSTS account, <a href="https://blogs.msdn.microsoft.com/uk_faculty_connection/2016/11/09/getting-started-with-visual-studio-team-services/">here</a> are steps to get started.

<strong>Step 3.2.a</strong> <strong>(Create a Docker Registry endpoint.)</strong> In the VSTS Project, create a service endpoint by clicking on the Gear icon -&gt; Services.

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/endpoint1-1024x403.png" alt="" width="1024" height="403" class="alignnone size-large wp-image-316" />

&nbsp;

&nbsp;

<strong>Step 3.2.b:</strong> Select “+ New Service Endpoint" -&gt; Docker Registry.

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/endpoint2.png" alt="" width="278" height="550" class="alignnone size-full wp-image-326" />

<strong>Step 3.2.c:</strong> Create a Docker Registry endpoint by entering docker hub credentials.<b> </b>

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/dockerhubEndpoint.png" alt="" width="615" height="524" class="alignnone size-full wp-image-245" />

Click on 'Verify Connection' to check if provided credentials are valid. Click "OK" to create an endpoint.

<strong>Step 3.2.d: </strong>Now<strong>, </strong>Create new release definition.

Hower over "Build and Release" and select Release.

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/releas1final.png" alt="" width="818" height="245" class="alignnone size-full wp-image-366" />

&nbsp;

Click on "+" icon and select "Create release Definition."

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/release2final.png" alt="" width="259" height="253" class="alignnone size-full wp-image-375" />

&nbsp;

Let's start with an empty template.

&nbsp;

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/empthtemplatefinal-1024x212.png" alt="" width="1024" height="212" class="alignnone size-large wp-image-357" />

&nbsp;

<strong>Step 3.2.e: </strong>Add an Artifact.

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/artifactfinal.png" alt="" width="792" height="503" class="alignnone size-full wp-image-355" />

Select an artifact of type Docker hub and select the namespace and repo from the drop-down.

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/AddArtifact.png" alt="" width="671" height="977" class="alignnone size-full wp-image-185" />

<strong>Step 3.2.f: </strong>Once Artifact is created click on the lightning icon and enable continuous deployment.

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/enableTrigger-1024x285.png" alt="" width="1024" height="285" class="alignnone size-large wp-image-255" />

<strong>Step 3.2.g: </strong>Now, let's add the tasks to update the web app.

Go to add task ui of 'Environment 1' by clicking on "1 phase, 0 task".

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/gotoenv.png" alt="" width="712" height="344" class="alignnone size-full wp-image-385" />

Add a task to deploy web app and another to restart the web app.

<strong>Deploy Web app</strong>: Enter the details of the web app. Inside tag field input the variable name $(BUILD.BUILDID). The value of BUILD.BUILDID is the image tag name for which release has been queued.

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/DeployWebApp-1024x520.png" alt="" width="1024" height="520" class="alignnone size-large wp-image-236" />

Restart Web App:

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/restartWebApp-1024x388.png" alt="" width="1024" height="388" class="alignnone size-large wp-image-275" />

Enter the details in the task and save the RD.

Now you are all set.

<strong>Step 4: Validation (Validate that a </strong>check-in<strong> in </strong>GitHub<strong> will automatically update your </strong>web app<strong>)</strong>

<strong>Step 4.1: Make a change in your github repo.</strong>

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/updateWebsite-1024x420.png" alt="" width="1024" height="420" class="alignnone size-large wp-image-285" />

We have changed the message on the site from "Hello DockerHub - updated  - 15" to "<span>Hello Docker hub. CD should automatically update the azure web app.</span>"

Commit the change.

<strong>Step 4.2: (Validate CI)</strong>

It will automatically trigger a build in docker hub to update the docker hub repo. Validate that in docker hub, check if a new build to update the image is triggered.

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/QueuedImageBuild-1024x329.png" alt="" width="1024" height="329" class="alignnone size-large wp-image-266" />

&nbsp;

<strong>Step 4.3 (Validate CD):  </strong>

Once new image in dockerhub is updated, a release will automatically get triggered in VSTS. This will update your webapp.

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/AutoTriggerDockerHubCD-1024x141.png" alt="" width="1024" height="141" class="alignnone size-large wp-image-195" />

<strong>Step 4.4 (Validate web app):</strong>

Refresh the website for the change to take effect

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/UpdatedWebApp.png" alt="" width="688" height="124" class="alignnone size-full wp-image-276" />

You can also manually select the image tag to deploy without setting the CD. For this, you have to create a release and select the tag from the drop-down with which you want to update the web app.

<img src="https://msdnshared.blob.core.windows.net/media/2017/12/manuallselection.png" alt="" width="671" height="550" class="alignnone size-full wp-image-287" />]]></content:encoded>
    </item>
    <item>
      <title>Running tests in parallel using VSTS Release Management</title>
      <link>https://docs.microsoft.com/archive/blogs/jikuma/run-phase-on-multiple-agents-in-parallel</link>
      <pubDate>Tue, 13 Dec 2016 18:57:04 GMT</pubDate>
      <dc:creator><![CDATA[jikuma]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/jikuma/?p=26</guid>
      <description><![CDATA[Release Management now supports running the tasks inside a phase in parallel on multiple agents.  In...]]></description>
      <content:encoded><![CDATA[Release Management now supports running the tasks inside a phase in parallel on multiple agents.  In this blog post, I will walk you through how this can be leveraged to run tests in parallel.

<strong>Scenario:</strong>  I have a dotnet core project. I want to test it against Windows, Linux, iOS. Additionally, I want these tests to run in parallel.

<strong>Step 1:</strong>  Create a new variable <strong><em>TargetOS</em> </strong>variable and initialize it with <em><strong>Windows_NT ,linux ,darwin</strong></em>.

<img src="https://msdnshared.blob.core.windows.net/media/2016/12/TargetOSVariable-1024x141.png" alt="targetosvariable" width="1024" height="141" class="alignnone size-large wp-image-145" />

<strong>Step 2.</strong> Add two dotnet core tasks for restore and test.

<img src="https://msdnshared.blob.core.windows.net/media/2016/12/dotnetcoretask-1024x351.png" alt="dotnetcoretask" width="1024" height="351" class="alignnone size-large wp-image-126" />

<strong>Step 3:</strong> Select <em><strong>Multi-Configuration</strong></em> from <strong><em>Type of parallelism</em></strong>.

<strong>Step 4:</strong> Specify <em><strong>Multipliers</strong></em> as <strong><em>TargetOS</em></strong> and set <em><strong>Maximum number<span style="text-decoration: underline"> of </span>agents</strong></em><span style="text-decoration: underline"></span> as equal to more than the OS in <strong><em>TargetOS</em></strong> variable.

If you have lots of runtimes and want to run those in parallel, but you want to limit the concurrency so that you do not starve another build/release for an agent. Then you should set <em><strong>Maximum number of agents</strong></em> to the value equal to the desired number of agent it is allowed to take simultaneously.

<strong>Step 5:</strong>  In demand specify <em><strong>Agent.OS -equals $(TargetOS)</strong></em>

Depending on the number of OS specified in <em><strong>TargetOS</strong> variable, </em>test runs will be created. Here three test run will be created each having the corresponding value of variable <em><strong>TargetOS </strong></em>variable. For example, the test run for Windows_NT will have <em><strong>TargetOs</strong> </em>as <em><strong>Windows_NT</strong></em>.

We use this variable in demand to target appropriate agent. For Windows demand will evaluate to  <span><em><strong>Agent.OS -equals Windows_NT</strong></em>. This test will run on the agent with the capability Agent.OS as Windows_NT.</span>

Also, make sure that the agent capabilities match the demands after the variable is replaced.

<strong>Step 6:</strong> Queue the release

<img src="https://msdnshared.blob.core.windows.net/media/2016/12/ParallelExecutionList.png" alt="parallelexecutionlist" width="408" height="597" class="alignnone size-full wp-image-155" />

This will create three test run and each will target agent with respective OS. The first test run is for iOS, second for Windows and third for Linux. We can check this in the name of Multiplier Node.

If your tests take very long to run and you want to cut the time, there is an upcoming version of VS Test task which can slice the tests in a single test run, each of which can run parallelly.  To use this new task, you can use Multi-Agent parallel execution. If you chose to run release with Parallel execution as Multi-Agent, the test is simply duplicated to run on multiple agents and each agent pull the appropirate slice from the server.]]></content:encoded>
    </item>
  </channel>
</rss>