UNPKG

1.61 kBTypeScriptView Raw
1import { IBucket } from '@aws-cdk/aws-s3';
2import { CfnProject } from './codebuild.generated';
3import { IProject } from './project';
4export interface BucketCacheOptions {
5 /**
6 * The prefix to use to store the cache in the bucket
7 */
8 readonly prefix?: string;
9}
10/**
11 * Local cache modes to enable for the CodeBuild Project
12 */
13export declare enum LocalCacheMode {
14 /**
15 * Caches Git metadata for primary and secondary sources
16 */
17 SOURCE = "LOCAL_SOURCE_CACHE",
18 /**
19 * Caches existing Docker layers
20 */
21 DOCKER_LAYER = "LOCAL_DOCKER_LAYER_CACHE",
22 /**
23 * Caches directories you specify in the buildspec file
24 */
25 CUSTOM = "LOCAL_CUSTOM_CACHE"
26}
27/**
28 * Cache options for CodeBuild Project.
29 * A cache can store reusable pieces of your build environment and use them across multiple builds.
30 * @see https://docs.aws.amazon.com/codebuild/latest/userguide/build-caching.html
31 */
32export declare abstract class Cache {
33 static none(): Cache;
34 /**
35 * Create a local caching strategy.
36 * @param modes the mode(s) to enable for local caching
37 */
38 static local(...modes: LocalCacheMode[]): Cache;
39 /**
40 * Create an S3 caching strategy.
41 * @param bucket the S3 bucket to use for caching
42 * @param options additional options to pass to the S3 caching
43 */
44 static bucket(bucket: IBucket, options?: BucketCacheOptions): Cache;
45 /**
46 * @internal
47 */
48 abstract _toCloudFormation(): CfnProject.ProjectCacheProperty | undefined;
49 /**
50 * @internal
51 */
52 abstract _bind(project: IProject): void;
53}