AWS SAM CodePipelines是否按提交进行整个重建? [英] Does AWS SAM CodePipelines do whole rebuild per commit?

查看:101
本文介绍了AWS SAM CodePipelines是否按提交进行整个重建?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在AWS中构建一个分布式应用程序,其中包括基础资源(iam等),数据仓库,但主要是无服务器资源,如lambda,sns,mongodb等。

I am building a distributed app in AWS consisting of base resource (iam etc), data-warehousing but mostly serverless resources like lambdas, sns, mongodb,..

要通过OTAP进行部署,我正在研究用于此的AWS工具,主要概述了

For deploying this over an OTAP I am looking into AWS tooling for this, mostly outlined here.

这意味着CodeCommit中的1个回购将触发CodePipeline,它将在正确的位置包含这些组件(实现顺序)控制):

This means that the 1 repo in CodeCommit will trigger the CodePipeline, which will have these components in de right places (realizing order control):


  • 部署CF堆栈

  • 使用CodeBuild打包(AWS sam软件包)SAM resource->使用构建步骤为每个SAM资源

  • 创建一个变更集->使用构建步骤为每个SAM资源使用一个

  • 执行一个变更集->每个变更集一个

  • deploying CF stacks
  • using CodeBuild to package (AWS sam package) a SAM resource-> for every SAM resource one
  • using a build step to create a change set -> one per SAM resource
  • using a build step to execute a change set -> one per change-set

因此,作为示例,我将需要一个buildspec.yml用于旁边的每个lambda该lambda的.js文件以及l ambda将需要在SAM模板(它自己的或组合的模板)中构造。

So as an example, I will need a buildspec.yml for every lambda beside the .js file for that lambda and also the lambda will need to be constructed in a SAM template (its own or a grouped one). Also a build-change-set step and execute-change-set step for each.

我的问题:
设置,对于整个分布式应用程序的1个存储库,我更改了1个小笨蛋,例如超时了许多lambda中的1个,是否会重新构建应用程序的所有元素?

My question: If in this setup, for 1 repo for the whole distributed app, I change 1 tiny dumb thing like the time-out of 1 of the many lambdas, will this rebuild en redeploy all elements of the app?

如果没有,谢谢上帝,但是它如何工作? CodeCommit将所有源的完整zip发送到S3,而不仅仅是更改。因此,所有元素都将被触发,并且在取消部署堆栈(CF或SAM)期间,底层技术可能很聪明,并且仅执行需要更改的操作。但是,仍然会触发CodePipeline中的所有元素(并且有很多),这种方法效率低下,而目标是尽快完成整个部署。

If no, thank god, but how does it work? CodeCommit sends a whole zip of all sources to S3, NOT changes only. So all elements will be triggered and during de deployments of a stack (CF or SAM) the underlying tech could be smart and only do what needs to be changed. But still, all elements in CodePipeline (and there are many) will be triggered which is inefficient where the goal is to finish the whole deployment as fast as possible.

如果是,那会很糟,然后我会在管道中找到另一种带有自定义代码(lambda)的解决方案,仅从CodeCommit API提取更改,然后执行cretae-change-set和执行。使用aws sdk的主要缺点是无法进行顺序控制,并且在sdk中无法使用 aws sam package之类的东西。

If yes, well that would suck and I would then find another solution with custom code (lambdas) in the pipeline extracting changes only from CodeCommit API and do cretae-change-set and execute. Using aws sdk with main drawback giving in on order control and some things like "aws sam package" are not available in sdk.

推荐答案

@TimR如果您有10个资源,则不需要在P中重建/重新部署它们。那是非常糟糕的。每个资源都需要最大的正常运行时间。

@TimR If you have 10's of resources you don't want to rebuild/redeploy them in P if not needed. That is very bad. Each resource needs max uptime.

要回答我自己的问题,当使用codePipeline或任何部署更改的东西时,它将检查整个模板的不同之处以及根据资源类型以及更改后的内容重新部署该资源。未更改的资源仅被检查,而大部分未被修改。因此,唯一的好处是,除了CP是异步拱门之外,整个CodePipeline中的所有动作都将花费大量时间来触发,因此退出速度也很慢。中等大小的小钱包大约需要10分钟。现在说您每30分钟提交10-20个开发人员。

To answer my own question, When using codePipeline or whatever to deploy changes, it will check the whole template(s) for what is different and depending on the resource type and what has changed redeploy that resource. Non changed resources are only checked but mostly untouched. So this is good only thing is that all actions in the whole CodePipeline will be triggered taking a lot of time besides that CP is Async arch and therefore also quit slow. A mid size one takes around 10 minutes for a small change. Now say you have 10-20 dev committing every 30 minutes..

SAM / Lambdas但是在AWS中存在一个错误。使用Lambda代码的MD5计算时,它将检查是否更新/重新部署Lambda。该算法考虑了文件属性(如上次更改等),从而得出结论,所有lambda都已更改,这是愚蠢的。

SAM/Lambdas however has a bug in AWS. When using MD5 calculation of the Lambda code it checks whether to update/redeploy the lambda. The algorithm takes into account file properties like last changed etc resulting in concluding that all lambdas have changed which is stupid.

这篇关于AWS SAM CodePipelines是否按提交进行整个重建?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆