Skip to content
This repository has been archived by the owner on Nov 25, 2021. It is now read-only.

Latest commit

 

History

History
67 lines (38 loc) · 4 KB

File metadata and controls

67 lines (38 loc) · 4 KB

Previous lab: Introduction

Lab 1 - Source control (SC)

Duration: 10 min

The goal of this lab is to setup a Git source control with VSTS by importing an existing GitHub repository having a sample ASP.NET Core web application.

Best practices highlighted:

  • Use Git as decentralized source control
  • Configuration of policies regarding branch, commit and pull request
  • Automate communications with your teammates through Slack notifications

You will go through 3 main sections in this lab:

  • Import existing Git repository
  • Setup branch policies
  • Setup Slack notification for "Pull Request created"

Import existing Git repository

  1. Open a new web browser instance in Incognito, Private or InPrivate mode to avoid any signed-in session conflict.
  2. Go to your VSTS account https://<yourvstsaccount>.visualstudio.com and open your existing empty project (default: MyFirstProject, otherwise create a new one).
  3. Navigate to the Code tab
  4. Use the "Import into an existing empty repository" feature by hitting the Import button like illustrated on the image below.

VSTSCode - Import GitHub Repository

  1. Set the fields Source type to Git and Clone URL to https://github.com/mathieu-benoit/DevOpsOnAzureLab.git and click on Import.

Note: this GitHub repository you are importing contains a sample ASP.NET Core web app with unit tests and selenium tests which will be used during the next labs. Stay tuned!

Setup branch policies

  1. Once the repository imported with the previous step, go to the Code tab and navigate to the Branch policies feature of the master branch like illustrated below:

VSTSCode - Go To Branch Policies

  1. Enable Protect this branch and then enable Check for linked work items and Check for comment resolution as well.

VSTSCode - Setup Branch Policies

  1. Then, click on the Save changes toolbar button at the top of this page.

Setup Slack notification for "Pull Request created"

  1. Sign-in with your Slack account for this lab - for example: https://<your-slack-account>.slack.com.
  2. Go to this new app configuration link: https://<your-slack-account>.slack.com/apps/new/A0F81FPF0-visual-studio-team-services, type the #code channel and click on the Add Visual Studio Integration button.

Slack - Add Visual Studio Integration - Code Pushed

  1. Once the result page is displayed ("New integration added!"), copy the WebHook URL field value https://hooks.slack.com/services/... to be used with the next steps.

  2. Go back to your VSTS project and click the Gear icon and navigate to the Service Hooks page and from there click on the Create a new subscription button as illustrated below.

ServiceHooks - Notification To Slack - Setup

  1. On the next pages, select Pull request created for the Trigger on this type of event option and let the default Filters, then click on Next to paste the Slack Webhook URL value https://hooks.slack.com/services/... you copied from the Slack configuration completed earlier. Finally, click on Finish to see the new associated Service Hook entry:

ServiceHooks - Pull Request Created Notification To Slack - Added

(Optional) You could repeat these actions to setup Slack notifications for other actions from VSTS for example: Build completed, Release deployment completed, Work item created, Code pushed, etc. For the Agile Tour Quebec 2017, these 4 other Slack notifications were already completed for you in the accounts provided.

You are now all set for this lab. All these concepts will be used and illustrated with the next labs.

Next lab: Lab 2 - Continuous Integration