AWS CDK并缓存CDK.Out目录中的构建管道目录

发布于 2025-02-11 15:33:51 字数 321 浏览 2 评论 0原文

我正在使用BitBucket管道使用Python CDK部署应用程序。作为过程的一部分,云汇编cdk.out目录是在 aws docs

我想知道缓存此目录是否有任何好处,以便在管道之间重复使用,就像我们cache pip依赖关系一样,或者只是在每个管道运行中从scratch创建它。

I am using BitBucket pipelines to deploy an app to AWS using the Python CDK. As part of the process the cloud assembly cdk.out directory is created as documents in the AWS docs.

I am wondering if there is any benefit in caching this directory so that it's reused between pipeline runs, just like we cache pip dependencies for example, or just let it be created from scratch on every pipeline run.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

眼眸里的那抹悲凉 2025-02-18 15:33:51

cdk部署 a> cloudAsseMembly .out 每次部署前。缓存无济于事。

但是,CDK显然缓存zipped式伪像(上传到S3之前),因此从理论上讲,您可以通过caching cdk.out/.cache/.cache保存.zip -ing时间。

cdk deploy synthesizes the CloudAssembly artifacts into cdk.out each time before deploying. Caching wouldn't help there.

However, the CDK apparently caches zipped artifacts (before uploading to S3), so in theory you could save .zip-ing time by caching cdk.out/.cache.

蓝颜夕 2025-02-18 15:33:51

Lambdas的资产基于A

如果您有一个侧面影响构建过程,该过程使用Lambdas源目录之外的数据,因为这些副作用不会反映在Hash中,因此不会迫使资产重建。

当我使用脚本并将某些Python软件包的名称传递到我的自定义脚本中时,我发现了这一点。由于图层的源文件夹都是相同的(空),因此即使脚本本身将完全不同的文件,它都重复使用了所有这些资产!

Assets for lambdas are built based on a hash of the source directory for that lambda. So if you copy in your cdk.out even if you are building on a new commit. It will be able to reuse some of those asset files without having to rebuild them.

Be careful doing this if you have a side affecting build process that uses data outside of the lambdas source directory as these side effects wont be reflected in the hash and as such won't force the asset to be rebuilt.

I found this out the hard way when I was local Bundling using a script and passing in some python packages names as in input to my custom script. Since the source folders for layers were all the same (empty) it just reused the same asset for all of them, even though the script itself would have made completely different files!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文