如何使用Buddy.Works作为管道来部署.NET Core AWS Lambda项目?

时间:2019-01-17 17:59:01

标签: amazon-web-services aws-lambda

我正在尝试在Buddy.Works中建立管道,以将.NET Core AWS Lambda项目部署到AWS。 Buddy有一个超级方便的AWS_LAMBDA_DEPLOY操作,可以进行实际部署,但是不幸的是,它仅从“ local_path”(即存储库)中提取,而不是从Buddy Filesystem中提取,否定了将lambda发布到Filesystem的任何构建操作。因此,由于Buddy找不到“ /bin/release/netcoreapp2.1/publish”文件,因此在部署功能处收到错误。这是我当前的示例yaml文件:

- 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

1 个答案:

答案 0 :(得分:0)

做好了这项工作,所以我想我会回答,以防万一这可以帮助其他人。...看起来区别是将lambda的名称添加到了“ local_path”的开头,名称是lambda所在的项目文件夹。

- 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