A developer working on an AWS CodeBuild project wants to override a build command as part of a build run to test a change.
The developer has access to run the builds but does not have access to the code and to edit the CodeBuild project. What process should the Developer use to override the build command?
Click on the arrows to vote for the correct answer
A. B. C. D.Answer - C.
Use the AWS CLI command to specify different parameters that need to be run for the build.
Since the developer can run the build, he can run the build by changing the parameters from the command line.
The same is also mentioned in the AWS Documentation.
Option A is incorrect because A buildspec is a collection of build commands and related settings, in YAML format, that CodeBuild uses to run a build.
You can include a buildspec as part of the source code, or you can define a buildspec when you create a build project.
However, the developer does not have access to the code.
Option B is incorrect because the developer does not have access to the code and to edit the CodeBuild project.
Option D is incorrect because it should be the buildspecOverride property instead of buildspec property.
For more information on running the command via the CLI, please refer to the below Link-
https://docs.aws.amazon.com/codebuild/latest/userguide/run-build.html#run-build-cliNote:
As per the question, the developer doesn't have access to edit the code build project but only have access to run the build.
So for overriding the existing build we can make use of the BuildspecOverride attribute.
As per AWS,
buildspecOverride.
: Optional string.
A build spec declaration that overrides for this build the one defined in the build project.
If this value is set, it can be either an inline build spec definition or the path to an alternate build spec file relative to the value of the built-in
CODEBUILD_SRC_DIR.
environment variable.
The correct answer for this scenario is C - Run the start build AWS CLI command with buildspecOverride property set to the new buildspec.yml file.
Here's an explanation of why the other options are not correct:
A. Update the buildspec.yml configuration file that is part of the source code and run a new build. This option is not feasible because the developer does not have access to the code. Even if the developer had access to the code, updating the buildspec.yml file would require committing the change to the repository and triggering a new build run, which could take time and may not be desirable if the developer just needs to test a quick change.
B. Update the command in the Build Commands section during the build run in the AWS console. This option is not feasible because the developer does not have access to edit the CodeBuild project. The Build Commands section can only be edited by users with permissions to modify the CodeBuild project.
D. Update the buildspec property in the StartBuild API to override the build command during build run. This option is not entirely correct because the buildspec property in the StartBuild API is used to specify the location of the buildspec.yml file, but it does not allow for overriding the build commands. However, the buildspecOverride property in the StartBuild API can be used to specify a new buildspec.yml file to override the build commands.
Therefore, the best option for the developer is to use the AWS CLI to start a new build run and pass the buildspecOverride property with the location of the new buildspec.yml file containing the updated build commands. This approach will allow the developer to quickly test their changes without having to commit any changes to the source code or have permissions to edit the CodeBuild project.