interface BucketCacheOptions
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.CodeBuild.BucketCacheOptions |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awscodebuild#BucketCacheOptions |
![]() | software.amazon.awscdk.services.codebuild.BucketCacheOptions |
![]() | aws_cdk.aws_codebuild.BucketCacheOptions |
![]() | aws-cdk-lib » aws_codebuild » BucketCacheOptions |
Example
declare const sourceBucket: s3.Bucket;
declare const myCachingBucket: s3.Bucket;
new codebuild.Project(this, 'ProjectA', {
source: codebuild.Source.s3({
bucket: sourceBucket,
path: 'path/to/source-a.zip',
}),
// configure the same bucket and path prefix
cache: codebuild.Cache.bucket(myCachingBucket, {
prefix: 'cache',
// use the same cache namespace
cacheNamespace: 'cache-namespace',
}),
buildSpec: codebuild.BuildSpec.fromObject({
version: '0.2',
phases: {
build: {
commands: ['...'],
},
},
// specify the same cache key and paths
cache: {
key: 'unique-key',
paths: [
'/root/cachedir/**/*',
],
},
}),
});
new codebuild.Project(this, 'ProjectB', {
source: codebuild.Source.s3({
bucket: sourceBucket,
path: 'path/to/source-b.zip',
}),
// configure the same bucket and path prefix
cache: codebuild.Cache.bucket(myCachingBucket, {
prefix: 'cache',
// use the same cache namespace
cacheNamespace: 'cache-namespace',
}),
buildSpec: codebuild.BuildSpec.fromObject({
version: '0.2',
phases: {
build: {
commands: ['...'],
},
},
// specify the same cache key and paths
cache: {
key: 'unique-key',
paths: [
'/root/cachedir/**/*',
],
},
}),
});
Properties
Name | Type | Description |
---|---|---|
cache | string | Defines the scope of the cache. |
prefix? | string | The prefix to use to store the cache in the bucket. |
cacheNamespace?
Type:
string
(optional, default: undefined - No cache namespace, which means that the cache is not shared across multiple projects.)
Defines the scope of the cache.
You can use this namespace to share a cache across multiple projects.
prefix?
Type:
string
(optional)
The prefix to use to store the cache in the bucket.