Previous lab: Introduction
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"
- Open a new web browser instance in Incognito, Private or InPrivate mode to avoid any signed-in session conflict.
- Go to your VSTS account
https://<yourvstsaccount>.visualstudio.com
and open your existing empty project (default: MyFirstProject, otherwise create a new one). - Navigate to the Code tab
- Use the "Import into an existing empty repository" feature by hitting the Import button like illustrated on the image below.
- Set the fields Source type to
Git
and Clone URL tohttps://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!
- 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:
- Enable Protect this branch and then enable Check for linked work items and Check for comment resolution as well.
- Then, click on the Save changes toolbar button at the top of this page.
- Sign-in with your Slack account for this lab - for example:
https://<your-slack-account>.slack.com
. - 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.
-
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. -
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.
- 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:
(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