fix(Lambda.Tools): map Lambda architecture to .NET store directory for publish-layer - #458
Draft
GarrettBeatty wants to merge 1 commit into
Draft
GarrettBeatty wants to merge 1 commit into
GarrettBeatty wants to merge 1 commit into
Conversation
publish-layer built the artifact.xml lookup path using the AWS Lambda architecture value (e.g. x86_64) verbatim as the .NET store subdirectory name. 'dotnet store' writes under the .NET RID arch folder (x64), not the Lambda name (x86_64), so --function-architecture x86_64 failed with 'Failed to find artifact.xml file in created local store.' Add LambdaUtilities.DetermineStoreArchitectureDirectory to translate the Lambda arch name to the .NET store dir name, mirroring DetermineRuntimeParameter, and use it in PublishLayerCommand. Preserves the previous '?? x64' default for null/empty/unspecified. Adds a regression [Theory] in UtilitiesTests. Fixes #457
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.
Issue
Fixes #457
dotnet lambda publish-layerfails withFailed to find artifact.xml file in created local store.when--function-architecture x86_64is specified.Root cause
In
PublishLayerCommand.CreateRuntimePackageStoreLayerZipFile, the AWS Lambda architecture value (e.g.x86_64) was used verbatim as the .NET store subdirectory name when building theartifact.xmllookup path.dotnet store(viaLambdaDotNetCLIWrapper.Store, which passes--runtime linux-x64) writes output under the .NET RID architecture folder namex64, not the Lambda namex86_64. So the lookup built.../store/x86_64/<tfm>/artifact.xmlwhile the file actually existed at.../store/x64/<tfm>/artifact.xml, failing theFile.Existscheck.arm64worked because the Lambda name equals the .NET folder name.?? "x64"default.Fix
LambdaUtilities.DetermineStoreArchitectureDirectoryto translate the AWS Lambda architecture value to the .NET store directory name, mirroring the existingDetermineRuntimeParameterlogic (arm64->arm64; everything else, includingx86_64, null, empty ->x64, preserving the previous default).PublishLayerCommandwhen composing theartifact.xmlpath.Testing
[Theory]TestDetermineStoreArchitectureDirectoryintest/Amazon.Lambda.Tools.Test/UtilitiesTests.cscoveringx86_64->x64,arm64->arm64,ARM64(case-insensitive)->arm64,null->x64,""->x64, and an unexpected value (foo)->x64.dotnet test --filter TestDetermineStoreArchitectureDirectory: 6 passed, 0 failed.Amazon.Lambda.Tools.csprojbuilds clean (0 warnings / 0 errors).