This is a step-by-step guide to using Azure Pipelines to build a GitHub repository.
Prerequisites
- A GitHub account, where you can create a repository. If you don't have one, you can create one for free.
- An Azure DevOps organization. If you don't have one, you can create one for free. (An Azure DevOps organization is different from your GitHub organization. Give them the same name if you want alignment between them.)If your team already has one, then make sure you're an administrator of the Azure DevOps project that you want to use.
Get the sample code
You can use Azure Pipelines to build an app written in any language. For this quickstart, we will use Java.
To get started, fork the following repository into your GitHub account.
https://github.com/MicrosoftDocs/pipelines-java
Get your first run
- Sign in to your Azure DevOps organization and navigate to your project.
- In your project, navigate to the Pipelines page. Then choose the action to create a new pipeline.
- Walk through the steps of the wizard by first selecting GitHub as the location of your source code.
- You might be redirected to GitHub to sign in. If so, enter your GitHub credentials.
- When the list of repositories appears, select your desired sample app repository.
- Azure Pipelines will analyze your repository and recommend a Maven pipeline template. Select Save and run, then select Commit directly to the master branch, and then choose Save and run again.
- A new run is started. Wait for the run to finish.
Add a status badge to your repository
Many developers like to show that they're keeping their code quality high by displaying a status badge in their repo.
To copy the status badge to your clipboard:
- In Azure Pipelines, go to the Pipelines page to view the list of pipelines. Select the pipeline you created in the previous section.
- In the context menu for the pipeline, select Status badge.
- Copy the sample Markdown from the status badge panel.
Now with the badge Markdown in your clipboard, take the following steps in GitHub:
- Go to the list of files and select
Readme.md
. Select the pencil icon to edit. - Paste the status badge Markdown at the beginning of the file.
- Commit the change to the
master
branch. - Notice that the status badge appears in the description of your repository.
To configure the Allow anonymous access to badges setting:
- Navigate to Project Settings
- Open the Settings tab under Pipelines
- Select the Allow anonymous access to badges checkbox under General
Note
Even in a private project, anonymous badge access is enabled by default. With anonymous badge access enabled, users outside your organization might be able to query information such as project names, branch names, job names, and build status through the badge status API.
Because you just changed the
Readme.md
file in this repository, Azure Pipelines automatically builds your code, according to the configuration in the azure-pipelines.yml
file at the root of your repository. Back in Azure Pipelines, observe that a new run appears. Each time you make an edit, Azure Pipelines starts a new run.
No comments:
Post a Comment