-
Notifications
You must be signed in to change notification settings - Fork 86
Fixed an ElasticBeanstalk deployment issue for Linux platform where Procfile was sometimes being generated with incorrect entrypoint when multiple runtimeconfig.json files were present. #363
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
Fixed an ElasticBeanstalk deployment issue for Linux platform where Procfile was sometimes being generated with incorrect entrypoint when multiple runtimeconfig.json files were present. #363
Conversation
{ | ||
logger?.WriteLine("Found existing Procfile file found and using that for deployment"); | ||
return; | ||
} | ||
|
||
logger?.WriteLine("Writing Procfile for deployment bundle"); | ||
var projectLocation = Utilities.DetermineProjectLocation(command.WorkingDirectory, |
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.
The caller of this method has already used DetermineProjectLocation
to determine the location. Update this method signature to pass in the project location so we don't need to detect the location again. Since this is a tool not a library we can change the public signature.
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.
Fixed in latest commit.
…rocfile was sometimes being generated with incorrect entrypoint when multiple runtimeconfig.json files were present.
bff906a
to
e247673
Compare
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.
Pull Request Overview
This PR fixes an ElasticBeanstalk deployment issue for Linux platforms where the Procfile was being generated with incorrect entrypoints when multiple runtimeconfig.json files were present in the publish directory.
- Replaces unreliable file discovery logic with MSBuild-based assembly name lookup
- Adds a new utility method to extract assembly names from project files
- Updates the SetupPackageForLinux method to accept project location parameter
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/Amazon.ElasticBeanstalk.Tools/EBUtilities.cs | Replaces FirstOrDefault() file discovery with MSBuild-based assembly name lookup and adds projectLocation parameter |
src/Amazon.ElasticBeanstalk.Tools/Commands/DeployEnvironmentCommand.cs | Passes projectLocation parameter to SetupPackageForLinux method |
src/Amazon.Common.DotNetCli.Tools/Utilities.cs | Adds new LookupAssemblyNameFromProjectFile utility method |
.autover/changes/a4b5c0a2-7029-491b-90d1-12bba898c249.json | Adds changelog entry for the bug fix |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Issue #, if available: #285
Description of changes:
Fixed an ElasticBeanstalk deployment issue for Linux platform where
Procfile
was sometimes being generated with incorrect entrypoint when multipleruntimeconfig.json
files were present.The existing logic to determine the project file
.csproj
uses Utilitites.FindProjectFileInDirectory(). It has explicit check here to ensure that we get only one project file; else it returnsnull
. So in case there are multiple project files, it would probably throwNullReferenceException
in subsequent logic. We are using this assumption that we only have one project file for deployment at root of working directory, to get the assembly name (viamsbuild
).Also note that we also invoke BaseCommand.EnsureInProjectDirectory(). This throws generic exception
$"No .NET project found in directory {projectLocation} to build."
in case where more than one project file if found in working directory, which might be incorrect or misleading.NOTE:
Refer Using a Procfile to configure your .NET Core on Linux Elastic Beanstalk environment where it shows below example to configure 2 web applications.
The PR supports one web application as of now to conform to existing logic.
CC @normj
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.