-
Regarding I was hoping this would work... new s3deploy.BucketDeployment(this, 'BucketDeployment1', {
sources: [
s3deploy.Source.asset(props.siteAssetsPath, {
ignoreMode: cdk.IgnoreMode.GIT,
exclude: ['*.*', '!*.js', '!*.css', 'sw.js', '!static/**', '_redirects'],
}),
],
memoryLimit: 512,
cacheControl: [s3deploy.CacheControl.fromString('public,max-age=31536000,immutable')],
destinationBucket: primaryBucket,
prune: true,
})
new s3deploy.BucketDeployment(this, 'BucketDeployment2', {
sources: [
s3deploy.Source.asset(props.siteAssetsPath, {
ignoreMode: cdk.IgnoreMode.GIT,
exclude: [
'*.*',
'!*.html',
'!page-data/**/*.json',
'!sw.js',
'!robots.txt',
'!sitemap/**',
'!_redirects',
],
}),
],
memoryLimit: 512,
cacheControl: [s3deploy.CacheControl.fromString('public,max-age=0,must-revalidate')],
destinationBucket: primaryBucket,
prune: false,
})
new s3deploy.BucketDeployment(this, 'BucketDeployment3', {
sources: [
s3deploy.Source.asset(props.siteAssetsPath, {
ignoreMode: cdk.IgnoreMode.GIT,
exclude: [
'*.html',
'page-data/**/*.json',
'*.js',
'*.css',
'static/**',
'robots.txt',
'sitemap/**',
'_redirects',
],
}),
],
memoryLimit: 512,
destinationBucket: primaryBucket,
prune: false,
// Invalidate the cache for / and index.html when we deploy so that cloudfront serves latest site
// distribution,
// distributionPaths: ['/', `*`],
}) But it appears the ORDER in which these two run is not under our control? The result is that the bucket ends up only with the files of any deploys after the random prune. I guess I would have the same question about the distro invalidation. We'd want it to only happen after the last deploy. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I think you can use the node.addDependency for that. See the Dependencies section of the docs here https://docs.aws.amazon.com/cdk/api/latest/docs/core-readme.html |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
I think you can use the node.addDependency for that. See the Dependencies section of the docs here https://docs.aws.amazon.com/cdk/api/latest/docs/core-readme.html