Open-source development has enabled greater collaboration than ever before. Whole communities of people who have never met in person can work together to create just about anything. However, this does not come without its challenges. One such challenge is quality control. Even with strict pull request requirements, it can be difficult to ensure every pull request receives proper testing. Kubernetes preview environments and build validations in Azure Pipelines can make this easier.

Preview Environments in Kubernetes

Kubernetes is an open-source, container orchestration tool that automates deployment, scaling, and management of containerized applications. It enables developers to deploy quickly into test and production environments. A preview environment is an ephemeral environment created with the code of your pull requests. By using a preview environment, you can see your changes live and test-drive features before merging to master. Furthermore, by using namespaces within your Kubernetes cluster, you can test your changes in a fully isolated environment that can be destroyed when you’re finished by simply closing the PR.

To deploy pull requests for review with Azure DevOps, you need to add a build validation branch policy to your Azure Pipeline.

Build Validations

Build validations are tests that run on a build to check changes made before a release. In the Repos submenu in Azure DevOps, you’ll define the requirements for pull requests that are being made against your selected branch. With these policies in place, every time someone creates a new pull request targeting the branch you defined the policy for, a reviewer can manually decide to deploy the changes to a dedicated Kubernetes namespace for detailed review within your preview environment. Alternately, you can choose to have this deployment to the namespace happen automatically.

In modern DevOps development, deploying quickly and often is critical. Equally important is making sure the code you’re putting into production is valuable to your end users. For more information, or to get started today, contact our team of experts here at PRAKTIK.