Reputation: 1296
I'm implementing a codebuild project, but I'm getting the error YAML_FILE_ERROR Message: batch yaml definition is required. Searched everywhere but with no luck.
Full Error:
[Container] 2021/07/13 17:09:46 Waiting for agent ping
[Container] 2021/07/13 17:09:49 Waiting for DOWNLOAD_SOURCE
[Container] 2021/07/13 17:09:56 Phase is DOWNLOAD_SOURCE
[Container] 2021/07/13 17:09:56 CODEBUILD_SRC_DIR=/codebuild/output/src805371762/src/git-codecommit.us-east-1.amazonaws.com/v1/repos/test_repo
[Container] 2021/07/13 17:09:56 YAML location is /codebuild/output/src805371762/src/git-codecommit.us-east-1.amazonaws.com/v1/repos/test_repo/buildspec.yaml
[Container] 2021/07/13 17:09:56 Phase complete: DOWNLOAD_SOURCE State: FAILED
[Container] 2021/07/13 17:09:56 Phase context status code: YAML_FILE_ERROR Message: batch yaml definition is required
Here is my buildspec.yaml (I even put this "batch" attribute but the same error occurs.
version: 0.2
batch:
fast-fail: false
phases:
pre_build:
commands:
- echo Logging in to Amazon ECR...
- $(aws ecr get-login --no-include-email --region us-east-1)
build:
commands:
- echo Build started on `date`
- echo Set script permissions...
- chmod a+x docker-entrypoint.sh
- chmod a+x docker-entrypoint.d/*
- echo Building the Docker image...
- docker image build -f $DOCKER_FILE -t $IMAGE_REPO_NAME .
- docker image tag $IMAGE_REPO_NAME $AWS_ACCOUNT_ID.dkr.ecr.us-east-1.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker image...
- docker image push $AWS_ACCOUNT_ID.dkr.ecr.us-east-1.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG
- echo Writing ECSForceNewDeployment definition file...
- cat ecs-force-deploy.json > ECSForceNewDeployment.json
artifacts:
files: ECSForceNewDeployment.json
Thanks for all the help.
Upvotes: 3
Views: 3977
Reputation: 746
if there is no pipeline , start the build with Start build with overrides
Instead of the default start build .
After pressing Start build with overrides
you have to option to change back to Single build
from Batch Build
Upvotes: 0
Reputation: 31
Check your codebuild project configuration and make sure it has the CodeBuild action setting "build type" to "single build" and not to "batch build".
If you need it as "batch build" then you have to configure it properly in the buildspec. But I understand from the question that is not the case.
To edit this go to your pipeline -> edit -> edit stage (build) -> and then click on edit icon in AwsCodeBuild action card:
If you go through CDK then make sure CodeBuildAction have this property set to false:
executeBatchBuild: false
(Which is the default value, but I'm putting like this to avoid confusion.)
Upvotes: 3
Reputation: 332
I had the same problem and it was caused by my "Primary source webhook events" being configured to do a 'batch build', rather than a 'single build'
Upvotes: 1
Reputation: 9088
I don't think you want the batch build settings. The rest of your buildspec looks like a "single build".
batch:
fast-fail: false
Upvotes: 1