我正在实现一个代码构建项目,但收到错误 YAML_FILE_ERROR 消息:需要批处理 yaml 定义。到处寻找但没有运气。
完整错误:
[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
这是我的 buildspec.yaml (我什至放置了这个“batch”属性,但发生了同样的错误。
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
感谢大家的帮助。
我认为您不需要批量构建设置。您的构建规范的其余部分看起来像“单一构建”。
batch:
fast-fail: false
我遇到了同样的问题,这是由于我的“主源 webhook 事件”被配置为执行“批量构建”而不是“单个构建”导致的
如果没有 pipeline ,请使用
Start build with overrides
启动构建,而不是默认的启动构建。
按
Start build with overrides
后,您必须选择从 Single build
改回
Batch Build
这次我遇到了同样的错误,伙计们。 下载源 失败的 YAML_FILE_ERROR:需要批量 yaml 定义。
请问有什么解决办法吗