serverless-offline icon indicating copy to clipboard operation
serverless-offline copied to clipboard

Add ruby3.2 runtime

Open jeremiahlukus opened this issue 2 years ago • 5 comments

Description

Add ruby3.2 runtime.

Motivation and Context

This is required to run ruby 3.2 or you get unsupported runtime. Since ruby2.7 is deprecated in Dec 7, 2023 I just replaced with ruby3.2 instead of adding a ruby 3.2 folder in the tests.

How Has This Been Tested?

I ran npm test locally and in the workflow. I then tested on a local app and its running without issues.

Screenshots (if appropriate):

Screenshot 2023-09-09 at 11 47 55 PM

jeremiahlukus avatar Sep 10 '23 03:09 jeremiahlukus

A test failed in ci I’ll fix one moment

jeremiahlukus avatar Sep 10 '23 12:09 jeremiahlukus

After some testing i found https://github.com/lambci/docker-lambda is now moved to ecr https://gallery.ecr.aws/lambda/ruby.

For now I will leave the ruby2.7 docker test. In another PR I will migrate to use ecr, but this is out of scope for this PR.

jeremiahlukus avatar Sep 10 '23 13:09 jeremiahlukus

After some testing i found https://github.com/lambci/docker-lambda is now moved to ecr https://gallery.ecr.aws/lambda/ruby.

For now I will leave the ruby2.7 docker test. In another PR I will migrate to use ecr, but this is out of scope for this PR.

I think you could change this line to be something like:

  if (runtime.indexOf('ruby:') == 0) {
    return `amazon/aws-lambda-${runtime}`

  } else {
    return `lambci/lambda:${runtime}`
  }

I'm not sure if that repo has all the other required images.

(thanks for picking this up BTW - I've just run into it myself)

dereke avatar Sep 10 '23 14:09 dereke

ok added

EDIT:

its still broken ill message when done

jeremiahlukus avatar Sep 10 '23 16:09 jeremiahlukus

I am unable to get it to work in docker it spins up the img Screenshot 2023-09-10 at 2 25 58 PM

But gets stuck.

Screenshot 2023-09-10 at 2 26 23 PM

Ive spent a few hours on it but i think this belongs in a different PR.

some notes: You might have to run docker logout

  #baseImage(runtime) {
    // The new docker img has to be pulled like:
    // docker pull amazon/aws-lambda-ruby:3.2
    // so we must split the string at the first occurance of a number
    const splitRuntime = runtime.split(/(\d.*)/, 2)
    return `amazon/aws-lambda-${splitRuntime[0]}:${splitRuntime[1]}`
  }

im going to revert the docker code for now.

jeremiahlukus avatar Sep 10 '23 18:09 jeremiahlukus

@jeremiahlukus I think that this PR can be closed. serverless-offline already supports ruby 3.2

DorianMazur avatar Apr 23 '24 21:04 DorianMazur