Skip to content

Set up Azure DevOps

An administrator does these two tasks once, in Azure DevOps. Modellers connect VS Code to the repository themselves, with Connect to Azure DevOps, and reviewers only need access to the repository.

An administrator of your Azure DevOps organisation installs Pywr for Azure DevOps from the Visual Studio Marketplace, once for the whole organisation. It adds the Model reviews page to Azure Repos, where reviewers read the changes to a model and record their decision. See Review in Azure DevOps.

It works with Pywr 1 and Pywr 2 models on Azure DevOps Services, the cloud version of Azure DevOps.

A project administrator sets the policies once for the main branch, in Azure DevOps: open Project settings, then Repositories, pick the repository, then Policies, and pick the main branch under Branch policies.

These policies fit a model repository:

Policy What it enforces
Require a minimum number of reviewers A change needs the approval of, for example, one or two people other than its author. Turn off Allow requestors to approve their own changes, and pick Reset all approval votes for new changes, so the version that is merged is the version that was approved.
Automatically included reviewers Adds a person or a group as a required reviewer, for example the line manager for every change, or only for the files of one model with a path filter such as /models/*.
Check for comment resolution A change cannot be merged while a comment is still active.
Check for linked work items Each change is linked to the task or request that asked for it.
Limit merge types Keeps the history in one shape, for example squash commits, so each completed pull request is one commit on the main branch.

Once the main branch has a required policy, its commits can only come from pull requests. Only the people an administrator gives the Bypass policies when pushing permission can push to it directly, so keep that list short.

The extension shows the policies of a pull request and what it is still waiting for. When you complete a pull request from VS Code, Azure DevOps checks the policies again and refuses a change they block.

Pywr for VS Code and Pywr for Azure DevOps are developed and maintained by Stefano Simoncelli.