-
Notifications
You must be signed in to change notification settings - Fork 1.2k
added support for powershell lambda functions #820
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
Conversation
heitorlessa
left a comment
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.
A couple of files to be updated according to the new DotNet sample (being updated in a separate PR) and some minor points to make sure we have a standard simple quickstart for customers.
Thank you so much Brian for taking this to a spin and more importantly congrats to your first PR!!!
samcli/local/init/templates/cookiecutter-aws-sam-hello-powershell/Pipfile
Outdated
Show resolved
Hide resolved
samcli/local/init/templates/cookiecutter-aws-sam-hello-powershell/.gitignore
Show resolved
Hide resolved
samcli/local/init/templates/cookiecutter-aws-sam-hello-powershell/README.md
Outdated
Show resolved
Hide resolved
samcli/local/init/templates/cookiecutter-aws-sam-hello-powershell/tests/test_cookiecutter.py
Show resolved
Hide resolved
...nit/templates/cookiecutter-aws-sam-hello-powershell/{{cookiecutter.project_name}}/.gitignore
Show resolved
Hide resolved
| @@ -0,0 +1,33 @@ | |||
| AWSTemplateFormatVersion: '2010-09-09' | |||
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.
Could you update this template.yaml following this new one for dotnet?
Essentially, it removes Env Variables (not being used) and adds additional comments in the Outputs
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.
Looking at the new file, I don't think I need to change this as I don't include the API in this example (the 50 second warm up time based on module loading makes that prohibitive), let me know if you tihnk anything specific is missing from my file though and ill change it.
| Properties: | ||
| CodeUri: ./artifacts/Function.zip | ||
| Handler: Function::Function.Bootstrap::ExecuteFunction | ||
| Runtime: dotnetcore2.1 |
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.
Is powershell only supported in dotnetcore2.1? Do we want to hardcode that or have some logic like:
{%- if cookiecutter.runtime == 'dotnetcore2.0' %}
Runtime: {{ cookiecutter.runtime }}
{%- elif cookiecutter.runtime == 'dotnetcore2.1' or cookiecutter.runtime == 'dotnet' %}
Runtime: dotnetcore2.1
{%- endif %}That will be parsed at runtime when the customer pass in the flag --runtime <value>
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.
It only works on 2.1 so I hard coded that in, it won't work on 2.0
| Variables: | ||
| PARAM1: VALUE | ||
|
|
||
| Outputs: |
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.
Is PowerShell not support API Gateway Proxy Integration mode?
If it does, would you be able to update the template.yaml to so ``sam local start-api` would work? It's missing the Events and the Outputs section.
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.
It does - but as mentioned above the warm up time on the functions means it usually wouldn't be a use case that most people adopt, so I took it out. Happy to put it in if needed.
...mplates/cookiecutter-aws-sam-hello-powershell/{{cookiecutter.project_name}}/src/Function.ps1
Show resolved
Hide resolved
.../cookiecutter-aws-sam-hello-powershell/{{cookiecutter.project_name}}/test/Function.tests.ps1
Show resolved
Hide resolved
… feature-PowerShellLambda
| ### PowerShell (all Operating Systems) | ||
|
|
||
| ```powershell | ||
| build.ps1 |
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.
Would this require any builder changes to aws-lambda-builders, and additions to sam build?
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.
There is a current .NET builder in the works at aws-lambda-builders, do take a look, if this can take advantage of that.
| * [.NET Core installed](https://www.microsoft.com/net/download) | ||
| * [PowerShell Core installed](https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-powershell?view=powershell-6) | ||
| * [AWSLambdaPSCore PowerShell module](https://www.powershellgallery.com/packages/AWSLambdaPSCore/1.1.0.0) | ||
| * [Pester PowerShell module](https://github.com/pester/Pester) |
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.
Is Pester the most used test framework? We need to start customers off on the right path.
|
We still see value in adding powershell in Closing this PR but we would love a PR for this to our app templates repo that SAM CLI uses for init. |
Took the code I wrote for an old PR in the aws-sam-cli repo (aws/aws-sam-cli#820) and freshened it up for this templates library. I have put them under .net as that's the runtime as far as Lambda is concerned, and have had to use the makefile build approach to get it to properly build out the dependencies (since letting the default dotnet one run wouldn't yield any results in this case).
Description of changes:
Added support for PowerShell lambda functions. This is my first PR here so let me know if I missed anything!
Checklist:
make prpassesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.