Intro to Version Control and Git
Non-Azure Repos and Pipelines
The course is part of this learning path
This course explores how to implement version control on Azure repos. It begins with an overview of what source control is and the different types of source control available. It then looks at the key elements of branching, different branching strategies, and how they impact the development process. You'll move on to learn about pull requests and merging as repository functions, and the different merging scenarios available to you. Finally, you'll be guided through using third-party systems in conjunction with Azure DevOps. This course contains several guided demonstrations from inside the Azure portal to give you real-world exposure to the concepts covered throughout the course.
If you have any feedback relating to this course, please feel free to reach out to us at firstname.lastname@example.org with any questions or comments.
- Understand what version control and Git-based repositories are
- Learn about branching and the branching strategies
- Learn about pull requests and merging in Azure DevOps
- Set permissions on repositories and on TVFC in Azure DevOps
- Use Azure DevOps in conjunction with build pipelines set up on other platforms
This is an intermediate level course suited to developers, engineers, and project managers.
To get the most out of this course, you should have a basic understanding of the software development lifecycle. Knowing what's involved in deploying software to a production environment would also be helpful. If you want to follow along with the demonstrations in this course, you'll need to have an Azure DevOps account.
What if you're using or want to use Azure DevOps but you have all your build pipelines set up on another platform like Jenkins? This scenario is easy enough to set up from the Azure DevOps point of view. We can create a service hook trigger that will initiate the build process in a Jenkins pipeline.
First, let's see the process in action. I've got a .NET Core web app with source code in an Azure DevOps repo, and I've set up a service hook connection to a Jenkins instance running on an Azure VM. Azure has a pre-configured Jenkins VM service that is easy to spin up and comes preloaded with the necessary Azure plugins. You can go directly to Jenkins and download the software, but you will have to install the Azure plugins yourself, which isn't a big deal. When I commit a change, a build will be kicked off. We can see that in action over on the Jenkins pipeline view.
Now that the deployment is completed we can see my commit comment is listed under changes and if we drill down into the details it shows what files have been changed. Going back to Azure DevOps, we can see the commit that triggered the build process. To set up the service hook, go to Project Settings under General and click service hooks and click the new service hook plus button. Select the service, in this case Jenkins. Just for ease of demonstration, I'll select code pushed as the trigger in this repository.
Next, I'll fill in the Jenkins detail section. With the Azure end set up, let's go back to Jenkins and see how the integration looks from there. This is a pipeline build with parameters, with the most important parameter being the Azure Service Principal credentials. The actual pipeline code is pretty straight forward, We check out the code from the Azure DevOps repository. If the repository is private we need to supply credentials and wrap the Git command in with credentials using Azure Service Principal.
Next is the publish stage, which is a script calling .net. This is running on a Linux Box so it is called with a shell script command. On Windows, this would be a batch command. Finally, we deploy with azureWebAppPublish using our service principal credential parameter, resource group parameter, and an app name parameter. The source directory is where the built code can be found. The key to this process is the service principal credentials, so let's have a look at that under Jenkins credentials. Subscription, client, and tenant IDs are those of the registered app under Azure Active Directory, and the client secret is the secret associated with that app registration.
Remember to give permissions to access Azure DevOps under API permissions so you can pull code from a private repository. If you have all of these details correctly entered into Jenkins but are getting an invalid subscription message, the chances are you haven't set up the correct role assignments for your service principal.
Hallam is a software architect with over 20 years experience across a wide range of industries. He began his software career as a Delphi/Interbase disciple but changed his allegiance to Microsoft with its deep and broad ecosystem. While Hallam has designed and crafted custom software utilizing web, mobile and desktop technologies, good quality reliable data is the key to a successful solution. The challenge of quickly turning data into useful information for digestion by humans and machines has led Hallam to specialize in database design and process automation. Showing customers how leverage new technology to change and improve their business processes is one of the key drivers keeping Hallam coming back to the keyboard.