Reputation: 291
I am new to AWS CodePipeline and I am getting this Error on AWS CodeBuild
"YAML_FILE_ERROR Message: Wrong number of container tags, expected 1"
I have setup AWS CodePipeline with CodeBuild and CloudFormation for aspnet core 2.1 project. Here is my buildspec.yml
{
"name": "Utility",
"source": {
"type": "S3",
"location": "<location>/windows-dotnetcore.zip"
},
"artifacts": {
"type": "S3",
"location": "<location>",
"packaging": "ZIP",
"name": "Utility.zip"
},
"environment": {
"type": "LINUX_CONTAINER",
"image": "aws/codebuild/dot-net:core-2.1",
"computeType": "BUILD_GENERAL1_SMALL"
},
"serviceRole": "<value>",
"encryptionKey": "<value>"
}
Upvotes: 21
Views: 15521
Reputation: 3588
This happened for me when I omitted the first 'version' line from yml:
version: 0.2
Upvotes: 52
Reputation: 5511
I received this error when I had a blank buildspec.yml checked in to CodeCommit. Once I updated it with something like this I was good to go:
version: 0.2
phases:
install:
commands:
- echo Installing Mocha...
- npm install -g mocha
pre_build:
commands:
- echo Installing source NPM dependencies...
- npm install unit.js
build:
commands:
- echo Build started on `date`
- echo Compiling the Node.js code
- mocha HelloWorld.js
post_build:
commands:
- echo Build completed on `date`
artifacts:
files:
- HelloWorld.js
Out of curiosity I thought it might have been a formatting error, but I tried checking in some garbage text and received the following error instead:
Phase context status code: YAML_FILE_ERROR Message: stat
Upvotes: 13