GitHub with Azure DevOps
This post is brought to you by Brian Blackman, Principal Consultant with Microsoft Premier Developer, focusing on all things DevOps and Developer tools such Visual Studio and unit testing as well as Eldon Gormsen, Senior Consultant with Microsoft Premier Developer, focusing on all things DevOps and more such as containers.
An introduction to GitHub
GitHub has long been known as the home of the largest open source community in the world and it continues to grow. In 2018, open source developers made more than 1.1 billion updates to 96 million repositories on GitHub. GitHub’s dominance in open source is the result of their intense focus on developers. Developers choose GitHub because it focuses on providing the best possible environment for building code, whether that’s alone or together.
GitHub allows hundreds, even thousands, of developers to contribute to the same code base without fear of losing or overwriting work. After seeing the successful projects being built in the open source communities, organization of all shapes and sizes took notice.
Today, GitHub is meeting the demands of some of the most challenging business environments, including highly regulated industries like automotive and finance, to farming and medicine.
GitHub is the home for developers across the world. While it is well known as the destination for open source collaboration, using GitHub as the place where your teams collaborate on private code for your enterprise has many advantages including:
- Familiar tooling
- Open source interoperability
- InnerSoure culture change
- Shift-left on Security
InnerSource with GitHub
GitHub brings premier social coding workflows to your organization by breaking down silos and enabling InnerSource. Where InnerSource is a method of developing software where engineers build their software using best practices from large-scale open source projects. Kubernetes and Microsoft’s Visual Studio Code are two great examples of large successful open source projects that other teams can learn from.
Advantages that GitHub brings to an InnerSource project are:
- Expertise sharing
- Cross-team collaboration
- Improved code reuse
- Increased velocity
- Secure workflows
In our next blog we will share with you using Azure DevOps for InnerSoure. Not all organizations will share their code externally, but they will internally.
GitHub with Azure DevOps
GitHub combines open-source advantages with Azure DevOps enterprise-grade security.
Implementing InnerSource through GitHub can increase teamwork, participation, and productivity—while addressing enterprise-level security and compliance needs that arise as processes become more open.
Azure Pipelines can use GitHub repos as the source repository as shown in Figure 1.
Figure 1: Where is your code?
Note that this requires a GitHub service connection. If you have not already connected to GitHub you will be prompted to authorize the connection. Alternatively, you can create the connection in Project Settings using as shown in figure 3.
Figure 2: GitHub connections
When creating a pipeline using the classic editor you need to select your location for your source code. Then when you select GitHub you need to authorize using OAuth or using a GitHub personal access token as shown in Figure 3.
Figure 3: Select GitHub and Authorize
Grant access to your GitHub repositories
Grant Azure Pipelines access to your repositories to display them, trigger builds, and fetch code during builds. I currently have my pipelines setup using PAT for GitHub authentication.
Authentication types for granting Azure Pipelines access
|Authentication type||Builds run using|
|1. GitHub App||The Azure Pipelines identity|
|2. OAuth||Your personal GitHub identity|
|3. Personal access token (PAT)||Your personal GitHub identity|
In addition to using your GitHub repo in your pipeline we also have GitHub Release task to create, edit, or discard your GitHub Release from your pipeline. And a GitHub Comment task that enables the commenting of a PR or Issue in GitHub as shown in Figure 4.
Figure 4: GitHub Comment Pipeline Task
GitHub with Visual Studio
There a few ways to integrate your tooling with GitHub. First is integration with the Visual Studio IDE.
The GitHub marketplace extension, see Figure 5, for Visual Studio facilitates connecting and working with GitHub repos from Visual Studio. The extension features connecting, cloning, creating, PRs, and more.
Figure 5: GitHub Visual Studio Extension
GitHub with Visual Studio Code
GitHub also has in depth integration with VS Code also. There are many extensions GitHub extensions available. This one is a good one to start as most use cases are supported and there is a team at Microsoft/GitHub supporting its development.
Integrating with Azure Pipelines
Install Azure Pipelines from GitHub Market Place to enable integration with Azure Pipelines and GitHub. With this integration your builds are managed in Azure Pipelines. With this integration you can:
- Use build badge in your GitHub repo’s README.MD file
- Unified Pipelines with YAML-defined CI/CD
- Integrate Azure Pipeline with Azure Kubernetes Service
- Simplified Purchasing for Azure DevOps
- Active Directory Support for GitHub Enterprise
- Sign in to Azure and Azure DevOps with your GitHub account
With GitHub and Azure DevOps you have a powerful combination of tools to help you develop world class applications where you are an open source or enterprise developer. In future articles we will be exploring ways that you can integrate GitHub with Azure DevOps including Azure Pipelines and Azure Boards and InnerSource using Azure DevOps.