AWS CDK并缓存CDK.Out目录中的构建管道目录
我正在使用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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
cdk部署
a> cloudAsseMembly .out 每次部署前。缓存无济于事。但是,CDK显然缓存zipped式伪像(上传到S3之前),因此从理论上讲,您可以通过caching
cdk.out/.cache/.cache
保存.zip
-ing时间。cdk deploy
synthesizes the CloudAssembly artifacts intocdk.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 cachingcdk.out/.cache
.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!