feat(gen2-migration): generate code for non-JS Lambda functions - #14972
Conversation
9caa448 to
268ade1
Compare
CodeBuild Batch FAILED — Attempt 1Batch: ❌
|
268ade1 to
911df30
Compare
Simone319
left a comment
There was a problem hiding this comment.
Thanks for this — the runtime-mapping coverage and the dependency-manifest preservation are nice touches. One overall question before this is mergeable: has the generated output been deployed and invoked end-to-end for at least one non-JS runtime (e.g. run gen2-migration generate on a Python or Go function, then npx ampx sandbox and a live invoke)? The validation listed is at the transformer/schema level, and several of the inline points below (the Go bootstrap handler, the dropped env vars/permissions, the dummy bundling image) would only surface at deploy/runtime — a single real deploy would confirm the generated function actually stands up.
13155e8 to
d35e8cf
Compare
|
On the end-to-end verification question: no — the generated output has not yet been deployed and invoked live for a non-JS runtime. Verification so far is unit/renderer-level (46 function-suite tests, 450 gen2-migration tests, prettier + version-match green). A real Flagging this as the open manual-verification item. The inline fixes just pushed (env vars, forced Go |
…-migration Support Python, Go, Java, .NET, and Ruby runtimes in the gen2-migration generate command. Previously non-JS functions threw an UnsupportedRuntimeError; now they produce a resource.ts using Gen2's custom function pattern (defineFunction((scope) => new Function(scope, ...))) with the appropriate CDK Runtime enum, runtime-specific bundling, and source copying that retains non-JS dependency manifests (requirements.txt, go.mod, pom.xml, etc.). - FunctionAssessor: mark all runtimes as supported for generate - FunctionRenderer: add renderCustomFunction(), mapToCdkRuntime(), renderBundlingBlock() - FunctionGenerator: branch non-JS runtimes into the custom function path; runtime-aware copyFunctionSource - Tests updated/added across assessor, renderer, generator, and orchestrator suites (444 gen2-migration tests pass) Closes #14535
d35e8cf to
2845b27
Compare
Description of changes
Resolves #14535 —
gen2-migration generatenow produces Gen2 code for non-JS Lambda functions (Python, Go, Java, .NET, Ruby) instead of throwing or skipping them.Previously, the generate command only supported Node.js runtimes. PR #14744 added a skip path (via
--skip-validations), but left users to hand-code the Gen2 definition. This PR completes the feature by generating the fullresource.tsusing Gen2's custom functions pattern.What it generates (example for Python):
Key changes:
FunctionAssessor: All runtimes are nowsupportedfor generate (removed theisNonJsRuntimegate)FunctionRenderer: NewrenderCustomFunction()method emits the CDK Function construct pattern with runtime-specific bundlingFunctionGenerator: Removed the throw for non-JS runtimes; branches into custom path when!runtime.startsWith('nodejs')copyFunctionSource: Preserves dependency files (requirements.txt, go.mod, pom.xml) for non-JS functionsmapToCdkRuntime(): Maps Lambda runtime strings → CDKRuntime.*enum membersRuntime support:
Issue #, if available
Closes #14535
Description of how you validated changes
validFor('generate')does not render runtime for non-nodejsstill passes (Node.js path unchanged)Checklist
yarn testpasses (gen2-migration tests)By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.