-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[WIP] White-list nodejs for aws-lambda-builders #845
Conversation
@gojko Thanks for submitting this. I have just merged the NPM building into aws-lambda-builders. We still need to test this end-to-end from sam cli and publish a new version of the aws-lambda-builders. We will need to include that version into this PR otherwise, building node will not work. I am doing some testing locally and using the |
Tested with nodejs8.10:
The
When running
This is due to the cli that is within the aws-lambda-builders doing validation. Looks like we missed this during the implementation for the node builder. I am looking at how to address this now. |
any version of node is OK for this (it's executing the I've not tried the |
Testing locally with a dev build of the container is not trivial right now. :( @gojko How should we go about validating? The build for python checks for explicit versions. By the sounds of it, we only care about npm? I am not super familiar with the nodejs world and how to go about this right now. |
@jfuss I think the python validation problem is specific because SAM is a python app building other python apps potentially needing different virtualenvs. My best guess is that for node we only care about Until someone complains and actually has a problem that we could test against I suggest we don't do any additional validation apart from checking for NPM. |
@gojko I updated the nodejs init examples and updated the |
@thesriram When you get some time, can you please review. @gojko If you could look at the changes to the nodejs example I made, I would really appreciate it. I want to make sure the example aligns with what the community would expect. My one concern is that the |
@@ -51,6 +51,12 @@ def _get_workflow_config(runtime): | |||
dependency_manager="pip", | |||
application_framework=None, | |||
manifest_name="requirements.txt") | |||
elif runtime.startswith("nodejs"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noo, lets not do if else's again, this might become like our entrypoint file. Given that there may be more runtimes that we support building.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is your suggestion then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion is to be encapsulate in a dictionary, and invoke corresponding actions based on a match. But I will not block on this. we can address this separately, I'll create an issue.
@@ -16,7 +16,7 @@ Resources: | |||
HelloWorldFunction: | |||
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction | |||
Properties: | |||
CodeUri: hello_world/ | |||
CodeUri: hello-world/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just curious: any reason for the change in the name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conversations with people familiar with Node.js said dashes are used not underscores. So I changed this to make it match what the community is doing/the Node.js style
|
||
FUNCTION_LOGICAL_ID = "Function" | ||
|
||
@parameterized.expand([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brilliant! thanks for adding all cases!
self._verify_resource_property(str(self.built_template), | ||
"OtherRelativePathResource", | ||
"BodyS3Location", | ||
os.path.relpath( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats a lotta path heh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly stolen from the python above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved. 👍
It looks fine to me. My workflow is usually to whitelist files/directories by including them into
but both approaches are equally valid. Regarding test execution, I think this is OK. There are tools like lerna that help manage multi-directory projects, but there isn't anything that could be called standard, at least not that I know of it. I usually just script it using a makefile. |
Issue #, if available: #798
Description of changes: White-list nodejs for aws-lambda-builders, required to use the
nodejs_npm
builder from SAM CLI. This should be merged only after aws/aws-lambda-builders#44 is mergedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.