Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

YAML_FILE_ERROR Message: Wrong number of container tags, expected 1

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>"
 }
like image 774
Tamoj Avatar asked Sep 19 '18 14:09

Tamoj


2 Answers

This happened for me when I omitted the first 'version' line from yml:

version: 0.2
like image 74
Rushi Agrawal Avatar answered Nov 13 '22 14:11

Rushi Agrawal


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 
like image 29
ryanjones Avatar answered Nov 13 '22 12:11

ryanjones