Skip to content

Commit 9f4f095

Browse files
Fix: Use function architecture for artifact path in PublishLayerCommand (#401)
Co-authored-by: Dyonata <[email protected]>
1 parent b89acd5 commit 9f4f095

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"Projects": [
3+
{
4+
"Name": "Amazon.Lambda.Tools",
5+
"Type": "Patch",
6+
"ChangelogMessages": [
7+
"Fix: Use function architecture to determine artifact path instead of hardcoded \u0027x64\u0027."
8+
]
9+
}
10+
]
11+
}

src/Amazon.Lambda.Tools/Commands/PublishLayerCommand.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,9 @@ private async Task<CreateLayerZipFileResult> CreateRuntimePackageStoreLayerZipFi
246246
}
247247
var architecture = this.GetStringValueOrDefault(this.Architecture, LambdaDefinedCommandOptions.ARGUMENT_FUNCTION_ARCHITECTURE, false);
248248
var cliWrapper = new LambdaDotNetCLIWrapper(this.Logger, this.WorkingDirectory);
249-
if(cliWrapper.Store(defaults: this.DefaultConfig,
249+
if (cliWrapper.Store(defaults: this.DefaultConfig,
250250
projectLocation: projectLocation,
251-
outputLocation: storeOutputDirectory,
251+
outputLocation: storeOutputDirectory,
252252
targetFramework: targetFramework,
253253
packageManifest: convertResult.PackageManifest,
254254
architecture: architecture,
@@ -265,7 +265,8 @@ private async Task<CreateLayerZipFileResult> CreateRuntimePackageStoreLayerZipFi
265265

266266
// The artifact.xml file is generated by the "dotnet store" command that lists the packages that were added to the store.
267267
// It is required during a "dotnet publish" so the NuGet packages in the store will be filtered out.
268-
var artifactXmlPath = Path.Combine(storeOutputDirectory, "x64", targetFramework, "artifact.xml");
268+
var architectureDirectory = this.GetStringValueOrDefault(this.Architecture, LambdaDefinedCommandOptions.ARGUMENT_FUNCTION_ARCHITECTURE, false) ?? "x64";
269+
var artifactXmlPath = Path.Combine(storeOutputDirectory, architectureDirectory, targetFramework, "artifact.xml");
269270
if(!File.Exists(artifactXmlPath))
270271
{
271272
throw new LambdaToolsException($"Failed to find artifact.xml file in created local store.", LambdaToolsException.LambdaErrorCode.FailedToFindArtifactZip);

0 commit comments

Comments
 (0)