UNPKG

3.44 kBTypeScriptView Raw
1import * as s3 from '@aws-cdk/aws-s3';
2import { CfnProject } from './codebuild.generated';
3import { IProject } from './project';
4import { Construct as CoreConstruct } from '@aws-cdk/core';
5/**
6 * The type returned from {@link IArtifacts#bind}.
7 */
8export interface ArtifactsConfig {
9 /**
10 * The low-level CloudFormation artifacts property.
11 */
12 readonly artifactsProperty: CfnProject.ArtifactsProperty;
13}
14/**
15 * The abstract interface of a CodeBuild build output.
16 * Implemented by {@link Artifacts}.
17 */
18export interface IArtifacts {
19 /**
20 * The artifact identifier.
21 * This property is required on secondary artifacts.
22 */
23 readonly identifier?: string;
24 /**
25 * The CodeBuild type of this artifact.
26 */
27 readonly type: string;
28 /**
29 * Callback when an Artifacts class is used in a CodeBuild Project.
30 *
31 * @param scope a root Construct that allows creating new Constructs
32 * @param project the Project this Artifacts is used in
33 */
34 bind(scope: CoreConstruct, project: IProject): ArtifactsConfig;
35}
36/**
37 * Properties common to all Artifacts classes.
38 */
39export interface ArtifactsProps {
40 /**
41 * The artifact identifier.
42 * This property is required on secondary artifacts.
43 */
44 readonly identifier?: string;
45}
46/**
47 * Artifacts definition for a CodeBuild Project.
48 */
49export declare abstract class Artifacts implements IArtifacts {
50 static s3(props: S3ArtifactsProps): IArtifacts;
51 readonly identifier?: string;
52 abstract readonly type: string;
53 protected constructor(props: ArtifactsProps);
54 bind(_scope: CoreConstruct, _project: IProject): ArtifactsConfig;
55}
56/**
57 * Construction properties for {@link S3Artifacts}.
58 */
59export interface S3ArtifactsProps extends ArtifactsProps {
60 /**
61 * The name of the output bucket.
62 */
63 readonly bucket: s3.IBucket;
64 /**
65 * The path inside of the bucket for the build output .zip file or folder.
66 * If a value is not specified, then build output will be stored at the root of the
67 * bucket (or under the <build-id> directory if `includeBuildId` is set to true).
68 *
69 * @default the root of the bucket
70 */
71 readonly path?: string;
72 /**
73 * The name of the build output ZIP file or folder inside the bucket.
74 *
75 * The full S3 object key will be "<path>/<build-id>/<name>" or
76 * "<path>/<name>" depending on whether `includeBuildId` is set to true.
77 *
78 * If not set, `overrideArtifactName` will be set and the name from the
79 * buildspec will be used instead.
80 *
81 * @default undefined, and use the name from the buildspec
82 */
83 readonly name?: string;
84 /**
85 * Indicates if the build ID should be included in the path. If this is set to true,
86 * then the build artifact will be stored in "<path>/<build-id>/<name>".
87 *
88 * @default true
89 */
90 readonly includeBuildId?: boolean;
91 /**
92 * If this is true, all build output will be packaged into a single .zip file.
93 * Otherwise, all files will be uploaded to <path>/<name>
94 *
95 * @default true - files will be archived
96 */
97 readonly packageZip?: boolean;
98 /**
99 * If this is false, build output will not be encrypted.
100 * This is useful if the artifact to publish a static website or sharing content with others
101 *
102 * @default true - output will be encrypted
103 */
104 readonly encryption?: boolean;
105}