简体   繁体   中英

Codebuild, buildspec error ;Phase context status code: YAML_FILE_ERROR Message: Expected to be of struct type: found string instead at line 1

I am having trouble running the buildspec file stored in an s3 bucket , the following error ocurs when I am in the build step of the pipeline;

"Phase context status code: YAML_FILE_ERROR Message: Expected to be of struct type: found string instead at line 1, check indentation or content around the line num"

The Following is how I have my buildspec.yml

 version: 0.2 env: variables: APP_NAME: "angular-cicd-pipeline-demo" phases: install: runtime-versions: nodejs: 16.x commands: - echo install process started - npm install && npm install -g @angular/cli build: commands: - echo build process started now - cd software/frontend/culturi - ng build --configuration=production post_build: commands: - echo build process finished, we should uplload to S3 now - cd dist/$APP_NAME - ls -la - aws s3 sync . s3://app-culturi --delete

I spent hours trying to figure this out for myself. The yml file needs to be structured very precisely. I had the same error when my "command" lines had the same indentation as the "build/ post_build" lines. It worked when I indented the "command" lines a little further like you have now. For you, I recommend leaving an empty line after your "version" line. I hope that works!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM