GitHub is the leader amongst the offerings for managing Git repositories in the cloud. Learn more about how GitHub repositories can integrate with Azure Pipelines to create the best experiences for developers.
- [Instructor] Even though you may already have your code in Azure Repos, chances are that you also have repositories stored in GitHub. Azure Pipelines integrates with GitHub as great as it does with Azure Repos via GitHub app. Let's take a look at how you can create your first Azure Pipeline from within GitHub. For this scenario, I've created a GitHub repository with the same source code that we have in Azure Repos. The first thing you'll have to do is navigate into GitHub's Marketplace and search for the Azure Pipelines app.
Once you've found it, the next step is clicking into it and setting up your free trial. Something to call out is that this app is available for free for both public and private repositories. Once you click Install, you'll be asked to review your order and complete it. After this, it's all about setting the settings and permissions on your repositories. In this case, for this particular account, I'll give access to all respositories to Azure Pipelines and I'll click Install.
For this particular scenario, I was already logged in in my Azure DevOps account in this browser. If you're not, you may have to introduce your login information. In this particular DevOps organization, what I'll do, because there's no new projects, is I'll create one and I'll give it GitHub Demo as its title and click Continue. Behind the scenes, what's happening is GitHub is establishing a handshake between GitHub and Azure Pipelines and creating that first project.
After this is a normal configuration wizard that we would see for any other pipeline. The first thing is selecting which repository to use from within GitHub. I'll go ahead and select the Azure Pipelines one. Azure Pipelines will run a validation of the source code and will recommend templates depending on the contents. I'll go ahead and select the ASP.NET template. Automatically, Azure Pipelines creates a YAML file for this particular template.
YAML is a human-readable data serialization language that's commonly used for configuration files. In this case, YAML files are used to define build configurations as code. This allows developers to take advantage of all the great capabilities of Git with their build pipelines. YAML files can be versioned and development teams can create branches and use pull requests to ensure that they're always in a clean state. In this case, I won't make any changes to the YAML file and just click Save and run.
In this dialog, I can choose to commit directly to the master branch or create a new branch and start a pull request. Let's just go ahead and commit directly to the master branch. Automatically, a build will be kicked with this new information. And if I were to go back into GitHub, I'll see that that YAML file is now part of my repository, as you can see here.
The last step which is very useful when you want to provide an understanding of the status of your source code is adding a badge into your README file. Azure Pipelines allows that via a badge capability in its Builds page. You can go into your build, select the new build definition that was just created, click on the dot dot dot, and select Status badge. It makes it even easier with a sample markdown that you can simply copy to your clipboard and then use in the README file.
Let's go ahead, click on the pencil, edit this file, and provide the information that we've just copied. And let's go ahead and do a commit. As you can see, now my README file has a link directly into Azure Pipelines where I can change the status of this build that I just created. This integration allows even more flexibility, and you can choose to use your repos whether they're in Azure Repos or hosted in GitHub.
- Tracking your team's work with Azure Boards
- Using dashboards, boards, backlogs, and sprints
- Building a code repository in Azure Repos
- Building pull requests
- Creating a code pipeline
- Extending Azure DevOps