rubyonjets / jets

Ruby on Jets
http://rubyonjets.com
MIT License
2.6k stars 181 forks source link

doesn't include the Jets layer when config.gems.disabled = true #541

Closed jdaviderb closed 3 years ago

jdaviderb commented 3 years ago

Checklist

My Environment

Software Version
Operating System
Jets 3.0.4
Ruby 2.5.0

Description

We have an enterprise app running on jets but we have a custom layer for this application, when we try to add our custom layer the deployments fail because it exceeds the layer limit on lambda, I did a quick research and I realized that when I add a custom layer, Jets stills uploading its layer.

Expected Behaviour

if I set this config config.gems.disabled = true on config/application.rb jets should not upload its lambda layer

Current Behavior

when I added my custom layer with this config, the deployment fails because it reaches the layer limit on lambda(size)

# config/application.rb
config.gems.disable = true
config.lambda.layers = ["my_custom_layer_arn"]

Step-by-step reproduction instructions

Code Sample

Solution Suggestion

if a user adds a custom layer, jets should not upload its gem layer, I think we can fix it by adding this condition here

def get_layers(runtime)
  return nil unless runtime =~ /^ruby/
  return Jets.config.lambda.layers if Jets.config.gems.disable

  ["!Ref GemLayer"] + Jets.config.lambda.layers
end
jdaviderb commented 3 years ago

Hello @tongueroo this PR fix this problem https://github.com/boltops-tools/jets/pull/542/files, that solved the problem in our project

gem "jets", github: "moonshot-partners/jets", branch: "fix/layers"