Open fade2black opened 1 year ago
Thank you @fade2black for sharing us about the error you have found and also the workaround!
Cause:
Currently copilot pipeline buildspec Ruby runtime-version is 2.6 . But the customer is using Ruby 3.1.2, so the script ruby -ryaml -rjson -e 'puts JSON.pretty_generate(YAML.load(ARGF))
does not seem to be working well for Ruby 3.1.2.
What we can do:
Codebuild already supports Ruby runtime version 3.x
https://docs.aws.amazon.com/codebuild/latest/userguide/runtime-versions.html
Update ruby runtime to 3.1 as default and also update the script to ruby -ryaml -rjson -e 'require "date"; puts JSON.pretty_generate(YAML.load(ARGF, permitted_classes:[Date]))
Check if updating the version and script in buildspec.yml
is backward compatible
and works well with previous version 2.6
My goal is to use Ruby 3.1.2 (since my RoR app uses 3.1.2), so I specify an image inside the pipeline manifest file like this
When I start build it fails with the following error:
which is caused by parsing manifest file inside the
buildspec.yml
. It is a ruby script. The following fixes it:We simply need to
require "date"
and pass the classDate
inside thepermitted_classes
array.