简体   繁体   English

如果没有 function 代码更改,如何使用 Codepipeline 部署 AWS Lambda 而无需重建它?

[英]How to deploy AWS Lambda using Codepipeline without rebuilding it if there are no function code changes?

so we have a pipeline that zips code functions for our Lambda, uploads it to S3 and builds the every lambda we have again with new version of zipped codes.所以我们有一个管道,可以为我们的 Lambda 压缩代码功能,将其上传到 S3 并使用新版本的压缩代码再次构建我们拥有的每个 lambda。

Now, the problem is, every single Lambda is being Built every pipeline run.现在,问题是,每个管道运行时都会构建每个 Lambda。 even if there are no changes to other lambda code function. ex.即使其他 lambda 代码 function.ex 没有变化。 (only 1 of 10 lambda has code change) (10 个 lambda 中只有 1 个有代码更改)

What would be the best approach or checking that we need to add in our pipeline in order to build the only Lambda that has code change?最好的方法或检查我们需要添加到管道中以构建唯一具有代码更改的 Lambda 的方法是什么? open for any suggestions even creating new pipeline and breaking this lambdas into pieces接受任何建议,甚至创建新管道并将此 lambda 分解成多个部分

I think the best way is to add a stage before the zipfile to see with files changes in the code in the last merge.我认为最好的方法是在 zipfile 之前添加一个阶段,以查看上次合并中代码中的文件更改。

Simply take those names and check which lambda was affected.只需获取这些名称并检查哪个 lambda 受到了影响。

Then it will pass the list of lambdas need to redeploy.然后它将传递需要重新部署的 lambda 列表。

What we do at our company is have a single pipeline per lambda / repo.我们在我们公司所做的是按照 lambda / repo 有一个单一的管道。 We have a few mono repos that when they deploy they deploy all the lambdas in that repo at once but still through a single pipeline.我们有一些 mono 存储库,当他们部署时,他们会立即在该存储库中部署所有 lambda,但仍然通过单个管道。 If you concerned about cost in the pipeline sticking around you could always delete them and then have another job to recreate them when you need to feploy a new change.如果您担心管道中的成本一直存在,您可以随时删除它们,然后在需要部署新更改时使用另一个作业重新创建它们。

We've got everything done through cloud formation scripts so it's all simple scripts running here and there to create pipelines.我们已经通过云形成脚本完成了所有工作,因此所有简单的脚本都在这里和那里运行以创建管道。

Curious what is the reason to have one pipeline deploy all 10 lambdas?好奇用一个管道部署所有 10 个 lambda 的原因是什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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