-
Notifications
You must be signed in to change notification settings - Fork 152
Support go1.x builder with the provided.al2 runtime #387
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
|
Interesting, thanks for diving into this and giving a working example! I wonder if it might be better if we looked up extra options that were being passed in from build method to determine which workflow is chosen and set that runtime dynamically, instead of it being statically set within the workflow (though this works). |
I'm not SAM expert enough to know what you meant by this :) This referring to options that a user can define in the template, or stuff internal to the builders lib? |
|
Something like referenced here: https://github.com/aws/aws-lambda-builders/blob/develop/aws_lambda_builders/workflows/go_modules/workflow.py#L29 (pass in something like build_runtime with options). This is then something that can be passed in within the template under a BuildProperties section of the Metadata, and all the places where we validate with a runtime we can substitute with the value of the BuildProperties. This way it will be generic for all builders? I understand this looks to be duplicated, this is because of the selection of the builders associated within I'm open to suggestions, just trying to see how we can make this generic across other runtimes, another example creating your |
|
You mean as a way to parameterize the builder with the (infeered) toolchain path, right? So, using your python example: or the golang If that's what you mean, totally agree that's a nice looking feature to build. It wouldn't make sense to me though without doing the |
|
In re-reading, I saw that the validator isn't involved in constructing the toolchain path, which is what I thought when I posted this PR. It's used to validate the toolchain path already selected. 05b184f is equivalent to my initial commit, in that it doesen't barf when |
sriram-mv
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.
Approving with the current changes.
|
Thanks for your contribution @bmoffatt ! There are some failures with Windows CI jobs, do you know what could be the reason with them? |
|
My first guess is that it looks like |
|
yeah that looks to be what's happened from my last good build: https://ci.appveyor.com/project/AWSSAMCLI/aws-lambda-builders/builds/44768289/job/580kni5mitk2o876
and my latest failing build: https://ci.appveyor.com/project/AWSSAMCLI/aws-lambda-builders/builds/45120452/job/5u9ch5ef0hv2qo5y
notice: |
|
@mndeveci and it passes now... seems I was unlucky and triggered CI during a bad ~week. |
Issue #, if available:
N/A
Description of changes:
I ran into this when trying to deploy a go function with the
arm64platform.go1.xisx86_64only, so this requires theprovided.al2runtime. The docs for the go runtime demonstrate using theMakefilebuilder for usingprovided.al2. This works, but requires an extra project file compared togo1.x. I also saw in the docs thatBuildMethodcan be set the the value of a runtime, so tried that!from: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-build.html
Here's my test template.yaml:
And the error
sam buildthrows:From a quick read, the runtime validator for the go modules builder seems to conflate the runtime enumeration value with the lookup path for the go compiler. This of course barfs if the runtime is anything other than
go*.I manually tested this fix by following CONTRIBUTING.md to setup
samdev.Happy to follow any guidance for updating this project's testing for additional coverage, I didn't get a chance to dig deeper into what's already present.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.