Friday, September 30, 2016

VSTS - Manual deploy, Git imports and Queues

Here we are for a new episode of my personal "top 3 new VSTS features" series. Let's talk about September.

Deployment manual intervention

You can now pause execution during deployment to an environment. Including a Manual Intervention task enables you to pause a deployment, perform manual steps, and then resume further automated steps. You can also reject the deployment and prevent further steps from executing after a manual intervention.

You should note that a manual intervention task splits the overall execution into three phases. 

  • The first phase runs on an agent, and after it is done, the agent is released. 
  • The manual intervention phase does not require any agent. 
  • After it is completed, any tasks following the manual intervention task are run in the third phase, possibly on a different agent. The artifacts are downloaded during both the agent phases, since different agents may be used for both of them. You should not assume that the state from the first phase is available during subsequent phases.

Import Git repositories

We can now import a Git repository from GitHub, BitBucket, GitLab, or other locations, into Visual Studio Team Services. You can import into either a new or an existing empty repository.

To import into a new repository, from the repository selector drop-down, click Import repository. 

If the source repository is a publicly available repository, then simply provide the clone URL of the source repository and you are good to go.
However, if the source repository is a private repository and can be accessed using basic authentication (username-password, personal access token, etc.), then check the “Requires authorization” check-box to provide the corresponding credentials.

Instead, to import into an existing empty repository, on the Files page, click the Import repository button and provide the clone URL. You will need to provide credentials if the source repository is private and requires authentication.

Build queue tab

They've implemented a new design for the Queued builds page that shows a longer list of queued and running builds, and in a more intuitive fashion. Looks good...

Monday, September 5, 2016

About Xamarin build (again)

Back in April, in one of my posts (read it here) I explained  that it was no more necessary to  include the "Xamarin License step" when building Xamarin solutions using the Hosted Agents.

Starting from now, it is no more necessary to include this step for every Xamarin builds, for both Hosted and personal agents.

Indeed, as reported on the new Visual Studio Team Service update: 

The Xamarin License step is no longer necessary and has been removed from the build templates shipped with VSTS and TFS 15. As part of this effort we will also deprecate the task. All build definitions that use this task should be updated to remove it in order to prevent any disruption when the task is finally removed.

Have good builds ;)

Friday, August 26, 2016

VSTS - Files, Details and Folders

In august there's been only one update to Visual Studio Team Services. Let's take a look at my 3 favourite new features for this month.

Pull requests Files

The biggest new feature in this release is the ability to see past updates made to a pull request. A few sprints ago (July 7th), they released the ability to properly track comments as a pull request is updated with changes. However, it’s not always easy to see what’s between updates. In the Files view, you can now see exactly what changed each time new code is pushed to your pull request. This is really useful if you’ve given feedback on some code and want to see exactly how it changed isolated from all of the other changes in the review.

Improved build details

When you click down to focus on a specific build, it now gives you a lot more information about what's happening and overall code quality. 

Build Definition folders

Does your team have a lot of build defintions? You can now use folders to keep them organized in the All Definitions tab.

Tip: Have a batch of definitions that need the same permissions? Put them in a folder and then you can give permissions to the folder

Tuesday, August 2, 2016

VSTS - Azure, Comments & Redeploy

Here we go with my 3 favourite new VSTS features for July.

Release management - Azure deployments

Now, setting up an Azure Service endpoint is easy: you just need to select the subscription on which to create a service endpoint, and you are ready to deploy to Azure.

  • Users can now automatically set up an ARM service connection by selecting the subscriptions linked with the Azure Active Directory that is backing the VSTS account.
    • Note: A new Azure Service Principal will be created and assigned the Contributor role, having access to all the resources in the selected subscription. You can modify the Service Principal access from Azure portal > Subscriptions > Users > Roles.
  • Prerequisites: -The VSTS account should be backed by an Azure Active Directory. For more info, see the Visual Studio article Team Services: Access with Azure Active Directory (Azure AD).
    • Note: Only Azure subscriptions that are linked with the Active Directory are listed.

Comment tracking for pull requests

Pull requests in VSTS have been improved to show comments left in files on the proper line, even if those files have been changed since the comments were added. Previously, comments were always shown on the line of the file where they were originally added, even if the file contents changed—in other words, a comment on line 10 would always be shown on line 10. With the latest improvements, the comments follow the code to show what the user expects—if a comment was added on line 10, and two new lines were subsequently added to the beginning of the file, the comment will be shown on line 12.
Here's an example change with a comment on line 13.

Even after the code has changed to shift the line with the original comment from 13 to 14, the comment is appearing in the expected place (line 14).

I think this improvement is a big step forward for improving the code commenting experience in pull requests. In the near future we will have even more improvements coming, including improved comment placement for renamed or moved files.

Release – redeploy after success

When a deployment to an environment fails, you may want to be able to redeploy an older release that already succeeded once in that environment. This feature lets you do just that. 

When you try to redeploy an older release, you will be shown the list of commits as well as the list of work items that will be rolled back. You just need to make sure that the automation scripts for deployment can really handle the rollback scenario. That is still on you.

Tuesday, June 21, 2016

VSTS - SSH, Docker and Tokens

Another month, another update for Visual Studio Team Services! (To be honest, there have been 2 updates in June :) )
This is my favourite 3 new features:

SSH clients can connect to Git repos

Team Services Git repos now support SSH connections. This makes it easy for many development tools, build systems, and other services to connect, especially if you develop on Mac or Linux. You can get the SSH clone URL for your repo from the Clone button on the web, and also manage SSH keys on your profile page.

SSH has been enabled on all existing accounts. For the next sprint, SSH won't be enabled on new accounts until a few hours after the account is created. That restriction will go away shortly.

Docker integration for build and release management

Take advantage of the VS Team Services cloud-based build capabilities to build your Docker images and upload them to the Docker Hub as part of your continuous integration flow. Then, deploy those images to a number of Docker hosts as part of Release Management. The Marketplace extension adds all the service endpoint types and tasks necessary for you to work with Docker from VS Team Services.

Release – Passing oauth tokens to scripts

You might often need to run custom PS scripts in Release Management, which invoke REST APIs to create work items or query for more information about a build. You can now check an option in the environment to make a Visual Studio team Services OAuth token available to such scripts.

Here is a simple example on how to get a build definition:
$url = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECTID/_apis/build/definitions/$($env:SYSTEM_DEFINITIONID)?api-version=2.0" Write-Host "URL: $url" $definition = Invoke-RestMethod -Uri $url -Headers @{ Authorization = "Bearer $env:SYSTEM_ACCESSTOKEN" } Write-Host "Definition = $($definition | ConvertTo-Json -Depth 1000)"