简体   繁体   中英

How to deploy a .NET Core AWS Lambda project using Buddy.Works as a pipeline?

I'm trying to set up a pipeline in Buddy.Works to deploy a .NET Core AWS Lambda project to AWS. Buddy has a super handy AWS_LAMBDA_DEPLOY action that will do the actual deployment, but unfortunately it only pulls from "local_path" (ie, the repository) instead of the Buddy Filesystem, negating any build actions that were done to publish the lambda to the Filesystem. Thus I'm receiving an error at the deploy function as Buddy cannot find the "/bin/release/netcoreapp2.1/publish" files. Here is my current example yaml file:

- action: "Execute: dotnet build"
type: "BUILD"
working_directory: "/buddy/lambda_name"
docker_image_name: "microsoft/dotnet"
docker_image_tag: "2-sdk"
execute_commands:
- "dotnet build"
- "dotnet publish --configuration release --framework netcoreapp2.1"
mount_file_system_path: "/buddy/lambda_name"
shell: "BASH"
trigger_condition: "ALWAYS"
- action: "Deploy function "
type: "AWS_LAMBDA_DEPLOY"
local_path: "/bin/release/netcoreapp2.1/publish"
region: "us-west-2"
function_name: "AWSLambdaName"
trigger_condition: "ALWAYS"
integration_id: IntegrationID

Got this working, so figured I would answer in case this helps anyone else out... It looks like the difference was adding the name of the lambda to the beginning of the "local_path", with the name being the name of the project folder the lambda is contained in.

- action: "Execute: dotnet build"
type: "BUILD"
working_directory: "/lambda_name"
docker_image_name: "microsoft/dotnet"
docker_image_tag: "2-sdk"
execute_commands:
- "dotnet restore"
- "dotnet build"
- "dotnet publish --configuration release --framework netcoreapp2.1"
mount_filesystem_path: "/lambda_name"
shell: "BASH"
trigger_condition: "ALWAYS"
- action: "Deploy function "
type: "AWS_LAMBDA_DEPLOY"
local_path: "lambda_name/bin/Release/netcoreapp2.1/publish/"
region: "us-west-2"
function_name: "AWSLambdaName"
trigger_condition: "ALWAYS"
integration_id: IntegrationID

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM