aws-samples / aws-serverless-workshops

Code and walkthrough labs to set up serverless applications for Wild Rydes workshops
http://wildrydes.com
Apache License 2.0
4.2k stars 2.63k forks source link

"YAML_FILE_ERROR: This build image requires selecting at least one runtime version." #231

Closed d970255 closed 5 years ago

d970255 commented 5 years ago

Issue: When I run a build, the DOWNLOAD_SOURCE build phase fails with the error "YAML_FILE_ERROR: This build image requires selecting at least one runtime version."

accrding to aws troubleshooting. https://docs.aws.amazon.com/codebuild/latest/userguide/troubleshooting.html#troubleshooting-build-must-specify-runtime

Possible cause: build uses version 1.0 or later of the Amazon Linux 2 (AL2) standard image, or version 2.0 or later of the Ubuntu standard image, and a runtime is not specified in the buildspec file. Recommended solution: If you use the aws/codebuild/standard:2.0 CodeBuild managed image, you must specify a runtime version in the runtime-versions section of the buildspec file.

[buildspec.yml] phases: install: runtime-versions: docker: 18

I updated this yml file, it can build.

samdengler commented 5 years ago

Thanks for reporting this issue. We're currently testing a fix on the devops-buildspec branch

sendtoshailesh commented 5 years ago

Modified buildspec file which is workaround and working:

version: 0.2

phases:
  install:
    runtime-versions:
      docker: 18

    commands:
      # Install dependencies needed for running tests
      - npm install

      # Upgrade AWS CLI to the latest version
      - pip install --upgrade awscli

  build:
    commands:
      # Use AWS SAM to package the application using AWS CloudFormation
      - aws cloudformation package --template template.yml --s3-bucket $S3_BUCKET --output-template template-export.yml

      # Do not remove this statement. This command is required for AWS CodeStar projects.
      # Update the AWS Partition, AWS Region, account ID and project ID in the project ARN on template-configuration.json file so AWS CloudFormation can tag project resources.
      - sed -i.bak 's/\$PARTITION\$/'${PARTITION}'/g;s/\$AWS_REGION\$/'${AWS_REGION}'/g;s/\$ACCOUNT_ID\$/'${ACCOUNT_ID}'/g;s/\$PROJECT_ID\$/'${PROJECT_ID}'/g' template-configuration.json

artifacts:
  type: zip
  files:
    - template-export.yml
    - template-configuration.json
d970255 commented 5 years ago

Thank you.

samdengler commented 5 years ago

@d970255 - just merged #236 to fix this. Thanks again for your feedback

tjohnson4 commented 4 years ago

Just ran into this issue. Builds had succeeded 10 hours ago (last build) without a runtime specified and then multiple build projects began to fail around 8:30pm PT today