AZ-400 Question 205
Single answerYou are a DevOps Engineer for a SaaS solution deployed on Azure Kubernetes Service (AKS). Your build pipeline runs on a self-hosted agent and automatically triggers on every commit to both the main and feature branches. One significant bottleneck is dependency restoration for each microservice, which consumes about 40% of the total pipeline time. The CFO has expressed concerns over escalating infrastructure costs, and developers report intermittent build failures that disrupt their workflows. Which action should you take first to reduce build time and costs while maintaining reliability?
- A
Configure separate pipelines for each microservice so that they all run in parallel on multiple large agents.
- B
Enable a pipeline cache for common dependencies and implement incremental builds to skip rebuilding unchanged microservices.
- C
Reduce the build frequency by triggering runs only once a day on the main branch and disabling PR validation builds.
- D
Increase the size of the self-hosted agent to leverage more CPU and memory for faster overall execution.
Show answer and explanation
Correct answer: B
Explanation
Implementing a pipeline cache for common dependencies and using incremental builds are key methods to optimize cost, time, performance, and reliability. These practices reduce redundant work, shorten build times, and help avoid intermittent failures caused by unnecessary tasks. For more details, refer to Microsoft� official documentation on Azure Pipelines caching best practices.
- A. Incorrect.
Option 1 is incorrect because running multiple pipelines in parallel on large agents may speed up some builds, but it can also significantly increase infrastructure costs. It doesn't address the underlying dependency restoration bottleneck.
- B. Correct.
Option 2 is correct. Enabling pipeline caching and using incremental builds can reduce the time spent restoring dependencies across microservices. By only rebuilding services that have changed, you save on both build time and associated costs. This also helps maintain reliability by minimizing redundant tasks.
- C. Incorrect.
Option 3 is incorrect because limiting builds to once a day can reduce costs, but it risks merging broken changes into the main branch, which can lead to bigger failures later. It also doesn't directly address the dependency restoration bottleneck or intermittent failures.
- D. Incorrect.
Option 4 is incorrect. Simply increasing agent size does not solve the fundamental issue of repeated dependency fetching and doesn�t necessarily improve reliability. It might reduce build time slightly, but it also increases hosting costs without addressing the core bottleneck.