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

refactor: ignore handlers with image.name property #1885

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ilyesBen
Copy link

@ilyesBen ilyesBen commented Aug 10, 2024

What did you implement:

Closes #1884

Ignoring the handlers with the the image.name property the same way the ones with image.uri are ignored as they are lambda containers.

How did you implement it:

How can we verify it:

Create a serverless template with both a lambda handler and a lambda container. The lambda container should have the image.name property poiting to an ecr image defined in the same template. The following example can be used:

service: converter

frameworkVersion: '3'

plugins:
  - serverless-webpack

custom:
  webpack:
    packager: yarn

package:
  individually: true

provider:
  name: aws
  ecr:
    images:
      image-test:
        path: ./

functions:
  functionHandler:
    handler: src/functions/funcionHandler.handler
    name: functionHandler-${sls:stage}
  
  functionContainer:
    name: functionContainer-${sls:stage}
    image:
      name:  image-test
      command:
        - 'functionContainer.handler'

Run serverless package

serverless package

The packager should not throw any error. It should package functionHandler and build the image test-image for the function functionContainer (you would need to make sure you have a valid Dockerfile in the root folder for the image to build).

output in master

Screenshot 2024-08-10 at 13 48 30

output in this branch

Screenshot 2024-08-10 at 13 49 54

Todos:

  • Write tests
  • Write documentation
  • Fix linting errors
  • Make sure code coverage hasn't dropped
  • Provide verification config / commands / resources
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES
Is it a breaking change?: NO

@j0k3r j0k3r changed the title refactor: ignore handlers with image.name property (fixes #1884) refactor: ignore handlers with image.name property Aug 14, 2024
@j0k3r j0k3r changed the title refactor: ignore handlers with image.name property refactor: ignore handlers with image.name property Aug 14, 2024
@j0k3r
Copy link
Member

j0k3r commented Aug 20, 2024

Could you fix failing tests? Thanks

@ilyesBen
Copy link
Author

Could you fix failing tests? Thanks

Sure, I will look into it.

@j0k3r j0k3r added the awaiting reply Awaiting for a reply from the OP label Aug 26, 2024
@ilyesBen
Copy link
Author

ilyesBen commented Oct 12, 2024

Could you fix failing tests? Thanks

@j0k3r I have fixed test. I have removed all the checks around docker based functions as serverless-webpack should not attempt to compile them IMO. I hope it makes sense.

@j0k3r j0k3r removed the awaiting reply Awaiting for a reply from the OP label Oct 14, 2024
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

Successfully merging this pull request may close these issues.

serverless-webpack running webpack on lambda containers with image.name property
2 participants