A game studio's CodeBuild project compiles its client for four platforms in one long build that runs on every pull request. Each platform takes about 20 minutes, and most pull requests change the code for only one platform.
The build runs the same buildspec in every case, so a change to a shell script for one platform can break the others without warning. The studio wants pull requests to build only the platforms whose folders changed, and wants those builds to run in parallel so that results arrive sooner.
The team wants to stay inside CodeBuild and add as little new infrastructure as possible.
Which approach meets these requirements?
Choose one answer.
AA. Create one CodeBuild project per platform and keep a shared buildspec that builds all four platforms in every project, so that each project can report its own status on the pull request.
BB. Add a Lambda function that compares each commit with the previous build and starts the full four-platform build only when any file changed, leaving the buildspec as it is.
CC. Run each platform's build on a separate EC2 instance in an Auto Scaling group, and have the pipeline start those instances with Systems Manager Run Command whenever a pull request is created.
DD. Create one CodeBuild project per platform, each with a webhook filter group on its folder's FILE_PATH, so that the projects run in parallel and only for their platform's changes.
Show the answer and explanation
Answer: D
A. Wrong: Separate projects run in parallel, but each one still builds all four platforms for every change. This misses the goal of building only the platforms that changed.
B. Wrong: The check runs, but a full build still starts for any change, so most of the work remains. The studio would also have to maintain the Lambda function and its comparison logic.
D. Right: Correct. CodeBuild webhook filter groups can match pull request events on file paths, so each platform's project starts only when its folder changes. Separate projects run in parallel, and nothing is added beyond CodeBuild itself. Learn more: Filter GitHub webhook events (console) (opens in a new tab)
Explanation
CodeBuild webhook filter groups can match pull request events on file paths, so each platform's project starts only when its own folder changes. Separate projects run in parallel, which shortens the wait, and no new service is needed. Building everything in every project, scripted skips and EC2 fleets each leave too much work or infrastructure in place.
Want more on Builds with CodeBuild and buildspec? The 5 full-length practice sets have 6 more Builds with CodeBuild and buildspec questions, 375 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets →