Basic Build Pipeline
In this lab we will cover the below topics
– Create a simple build pipeline that builds your code.
– Configure build triggers and automatic builds on code commits.
– Trigger a build manually and verify the build output. Explain this lab with step by steps instruction and explanation
Step 1: Creating a Basic Build Pipeline
1. Go to Project -> Pipelines
2. Build a new pipeline
3. Choose repositry accordingly, for now, we choose Azure repo we created earlier. Azure DevOps will analyze your repository and suggest pipeline templates
4. For this lab, choose the “Starter pipeline” template, which is a basic build pipeline.
5. Once done, YAML file will be created for the build. You can customize this YAML file, if needed.
6. Click the “Save and Run” button to save the pipeline configuration and start the first build.
Step 2: Configure Build Triggers and Automatic Builds
1. Select the pipeline you have created
2. Click Edit where you can see the YAML file for the build
3. Now click on three dots on right side and click on the ‘Triggers‘
4. Tick “Override the YAML continuous integration trigger from here” on the right side.
5. This will enable continuous integration
6. Save the changes
Step 3: Trigger a Build Manually and Verify Build Output
1. Now go to the directory in your local machine
2. Add some file and push it to the repo
git add .
git commit -m "Updated a comment"
git push origin main
3. The push should have started the build. Go to the Azure DevOps Pipelines section. You will see that the pipeline has automatically started due to the code commit.
4. Verify Output: Once the build is completed, check the build logs for any errors. Also, review the build artifacts and any test results generated.
Explanation:
– Build Pipeline: A build pipeline automates the process of compiling and building your code. It ensures that your code can be compiled and packaged consistently.
– Triggers: Triggers define when a pipeline should be automatically started. Continuous Integration (CI) triggers ensure that the pipeline runs whenever code changes are pushed to the repository.
– Manual Trigger: In addition to automatic triggers, you can manually trigger a pipeline run. This is useful for testing or building specific versions of your code.
– Build Logs: Build logs provide detailed information about each step of the pipeline’s execution. This includes information about successful steps and any errors encountered.
– Artifacts: Build artifacts are the outputs generated by the build process. These could be executable files, libraries, or any other files required to deploy and run your application.
By following these steps, you’ve set up a basic build pipeline, configured automatic build triggers, triggered a build manually, and verified the build output. This process is essential for ensuring code quality and consistency in a development workflow.