Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packaging should not include service level patterns #324

Closed
estahn opened this issue Sep 20, 2022 · 2 comments
Closed

Packaging should not include service level patterns #324

estahn opened this issue Sep 20, 2022 · 2 comments

Comments

@estahn
Copy link

estahn commented Sep 20, 2022

We have the following config which adds all python code also into the warmUpPluginOfficeHoursWarmer.zip. I tried various variations to exclude the files and the only thing that worked is setting package.individually to true or moving the package block into the function. Moving the package block into the function does not apply the patterns though and we will end up with a large zip file.

Imo package.patterns should not be joined to package the warmer function.

functions:
  app:
    handler: wsgi_handler.handler
    timeout: 30
    layers:
      - Ref: PythonRequirementsLambdaLayer
    warmup:
      officeHoursWarmer:
        enabled: prod

package:
  individually: false
  patterns:
    - "!**"
    - "serverless_sdk*/**"
    - "app/**"
    - "module1/**"
    - "module2/**"
    - "module3/**"
    - "*.py"

What worked:

functions:
  app:
    handler: wsgi_handler.handler
    timeout: 30
    layers:
      - Ref: PythonRequirementsLambdaLayer
    package:
      patterns:
        - "!**"
        - "serverless_sdk*/**"
        - "app/**"
        - "module1/**"
        - "module2/**"
        - "module3/**"
        - "*.py"
    warmup:
      officeHoursWarmer:
        enabled: prod

package:
  individually: true
@juanjoDiaz
Copy link
Owner

juanjoDiaz commented Sep 27, 2022

Hi @estahn ,

Cascading the package settings (i.e. joining the patterns set at package level to the ones set at the function) is the behaviour of the Serverless framework.

You can also exclude the packages from the warmer config:

package:
  individually: false
  patterns:
    - "!**"
    - "serverless_sdk*/**"
    - "app/**"
    - "module1/**"
    - "module2/**"
    - "module3/**"
    - "*.py"

custom:
  warmup:
    officeHoursWarmer:
      package:
        patterns:
          - "!serverless_sdk*/**"
          - "!app/**"
          - "!module1/**"
          - "!module2/**"
          - "!module3/**"
          - "!*.py"

functions:
  app:
    handler: wsgi_handler.handler
    timeout: 30
    layers:
      - Ref: PythonRequirementsLambdaLayer
    warmup:
      officeHoursWarmer:
        enabled: prod

@juanjoDiaz
Copy link
Owner

Closing since a solution has been provided and there has been no more responses

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants