feat: add native engine support for AWS Lambda bundle and deploy#126
Merged
Conversation
Gates the Lambda binary download, runtime, handler, env vars and SnapStart on engine type so the native imposter-go binary can be bundled and deployed alongside the existing JVM flavour. When the engine type is not specified but a version is, the engine is derived from the version (v5+ → native). Adds an --architecture flag to `imposter bundle` so per-architecture native binaries can be selected, with the value threaded through to the binary download and cache paths.
The imposter-go releases ship per-arch `imposter-go_linux_<arch>.tar.gz` artefacts containing a plain `imposter-go` binary, not a pre-built Lambda zip. Download that tarball, extract the binary, and write a Lambda-ready zip containing a single executable `bootstrap` entry for the provided.al2023 custom runtime.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #61.
Adds support for bundling and deploying the native imposter-go binary to AWS Lambda alongside the existing JVM flavour, with engine type derived from version when not specified explicitly.
Summary
internal/engine/version.goand reuse it from bothUsesEnvConfigand the newDeriveEngineTypeFromVersion. v5+ derives to the native engine;latestkeeps the existing default untillatestis rebased onto v5.GetConfiguredTypeWithVersionso commands that already accept a--versionflag (e.g.up,bundle) can derive the engine type without going through viper.internal/engine/awslambda/binary.goon the engine type — JVM uses the existingimposter-jvm-enginezip, native pulls per-architectureimposter-awslambda_<arch>.zipfromimposter-goand caches it by arch + version.lambdaFlavourabstraction (internal/remote/awslambda/flavour.go) so the deploy path picks the right runtime, handler, environment variables and SnapStart support per engine. Native deploys ontoprovided.al2023with thebootstraphandler, no JVM-only env vars, and SnapStart disabled (with a warning if the user has it enabled).--architecture/-aflag toimposter bundle(defaultamd64) that flows through to the binary fetch and zip contents.internal/remote/awslambda/deploy.gointoCreateDeploymentPackagevia a newgoArchFortranslator so AWS Lambda arch (x86_64/arm64) maps to the Go arch (amd64/arm64) used by the native binary releases.Implementation details
DeriveEngineTypeFromVersionreturnsEngineTypeNonefor empty/latest/unparseable versions so callers fall back to their own default without spreading the v5 cut-off across the codebase.LambdaProvidergained anArchitecturefield rather than another constructor parameter, so theengine.Providerinterface and its other implementations stay untouched;cmd/bundle.gotype-asserts to set it.imposter-awslambda_<arch>.zip) follows the convention used by the imposter-go release pipeline; if that naming changes before v5 ships it is a single edit inbinary.go.