After Microsoft's acquisition of GitHub, many people suspect that Microsoft may be able to cut VSTS, but the fact that VSTS has not been cut off, more information about Azure DevOps can be viewed in this blog, if you want to view the original text can also be viewed from the source address provided in the link.
Today's introduction to the CI section of Azure DevOps: Azure Pipeline
. The big good news for open source developers after the VSTS upgrade to Azure DevOps is that GitHub open source projects are free, unlimited, and run 10 ci/cd jobs in parallel.
Here's a brief introduction to Azure pipeline and how to combine Azure pipeline with GitHub for automated builds.
About Azure Pipeline
Pipeline literally means piping, pipelining, as it literally means. Azure pipeline can split a build task into parts and then concatenate it together to form a pipeline job. Depending on the build business, a pipeline may contain only one or two steps, or it can be more than 10 or even dozens of steps. Azure PipeLine is similar to Jenkins PipeLine, with the advantage of a very clear structure compared to traditional automated builds, and the difficulty of building a link in a pipeline is easy to navigate to (students who have used the traditional Jenkins freestyle task may experience For some complex build tasks, when problems arise, troubleshooting is a headache, and the complexity of console output can be overwhelming. Of course, this section does not introduce very complex building knowledge, but an introductory tutorial for the vast number of open source authors and enthusiasts to build a pipeline quickly.
Azure Pipeline is currently supported Node.js, Python, Java, PHP, Ruby, C/C++, .NET, Android, and iOS
, and it is very gratifying that Azure Pipeline does not require you to have professional devops knowledge even if you are completely not aware of devops it is convenient to build a Pipeline job quickly. So don't hesitate, Don't worry about it, try it decisively.
Azure pipeline integrates with GitHub to quickly build a pipeline job.
Readers can read this article without any automated build or devops experience, but only if you have a GitHub account and a Microsoft account, both of which are free to register and are not very complex. Because we already have an account, So later in the tutorial it is assumed that you have logged into your GitHub account and your Microsoft account.
Create a GitHub project
For more information on how to create a project on GitHub, you can view the relevant article or GitHub help to get the relevant knowledge. I'm using a gitShow
. NET project in my GitHub repository, Readers can upload a. NET project can also be supported by other projects (JAVA,PYTHON,NODEJS, etc.) to the GitHub warehouse, without worrying about the project type, we do not need to write a line of code to take advantage of the Azure Pipeline powerful features create a simple automated build pipeline job. My project structure is as follows:
Create an Azure pipeline project in Azure DevOps
Our browser input dev.azure.com
will enter the Azure DevOps interface
If you do not log in, see the interface may not be the same as above, after landing, if you do not create any organization, the left will not have any organization list information, the interface will prompt you to create an organization, you can also click add organization
to create an organization, the organization is equivalent to a team, An organization can contain a number of items.
Click on the left of any organization into the organization, I entered the last one inside, of course, it doesn't matter, you can enter any organization.
This is an empty organization and the page will prompt us to create a project
We enter the project name and the Create Project button activates and we click it to create a project.
After a while an empty project is generated, this time the page will prompt you to create a pipeline job
Click on the ' New PipeLine ' button to enter the line job creation page
The page will prompt you to select the source of the warehouse, we selectGithub
The first connection with GitHub will appear the authorization choice, here do not click Authorize
, but click on the link below, Install our app from the GitHub Marketplace
go to the plug-in installation page, this time will let you choose an organization, according to your organization, there is not the same content, choose one of their own rights of the Organization can
Click on the organization name to go to the Warehouse selection page
Can select all warehouses or designated warehouses, I choose all the warehouses here, and then click the ' Install ' button, after a few seconds, will enter a page to let you chooseMicrosoft账户
Click on the account name to
At this point, if you choose all of them, you'll list all of the GitHub repositories.
I choose GitShow
the project here, and the Azure DevOps platform will intelligently analyze the project and then let you choose the project type (or perhaps no step directly into the pipeline Code interface), where Azure DevOps automatically generates the pipeline script for us
Then we click on the top left Run
button to run the pipeline script, this step is the longest waiting time
From here we can see the execution status of the pipeline, identified as the steps that have been successfully executed, with the identified steps for the 对勾
三角
currently executing step, with the 钟表
identified as pending steps. Waiting for all the steps to be identified becomes a tick, The whole pipeline is done.
If the project is eventually built successfully, a large identity will appear to 绿色对勾
build the entire project successfully
We can click on one of these steps to see the detailed CLI output information built by the current step, similar to the Jenkins CLI output
Display the Azure pipeline build status logo on the GitHub project page
If we jump to the Azure DevOps interface to see the project every time we build it, it's obviously too much of a hassle, and many times we may only be concerned with the build state, so long as the build is successful we don't see the details. If it fails, then go to the build page to see the build details. In fact, many open source projects will have a Build status logo displayed on the project page, allowing you to view the project's build status directly. Here's how to add an Azure pipeline build status logo for your GitHub project
For example, we click the button in the left navigation bar PipeLines
, then click the Builds
button, the following screen appears
We click ...
on the symbol, in the pop-up drop-down list selection Status Badge
, the following interface appears
At the top is the Markdown sample link, which we copy. Then we go to GitHub, open our project page, and click on the README.md
file to edit (if the reader does not have this file in the project can add one, note that the name must be readme.md, add very simple, If no GitHub will prompt you to add one, follow the prompts to add it), we add the copied content to the README.md
Then click Save to return to the project home page to see the build status logo you just added
The above status is updated in real-time, we modify the source code, deliberately make some mistakes, after the completion of the Azure pipeline build, the status of the GitHub page will be updated
This greatly improves the collaboration efficiency of the Open source project, and if a user submits the code, the code reviewer can first see if the build status succeeds or fails, and if it fails, it can directly allow the code submitter to build the project successfully before committing it, reducing unnecessary duplication of manual build work.
The above display status logo is just a simple example, readers can also refer to the layout of other open source projects, the layout of their own design more generous and beautiful
Because Azure pipeline just launched, here is just a preliminary attempt, the actual work by the automatic generation of scripts may be far from enough, We need to customize the pipeline construction plan according to our own project situation. But it's enough to build a project for an open-source program. There will be time to share more of the devops knowledge of the. NET platform. I hope that we can communicate more, and also hope that the experts to criticize, more comments.
Open Source Project Benefits-github Open Source project free use of azure PipeLine