UNPKG

3.52 kBTypeScriptView Raw
1import { EventBridgeEvent, EventBridgeHandler } from './eventbridge';
2
3export type CodeBuildCloudWatchStateHandler = EventBridgeHandler<'CodeBuild Build State Change', CodeBuildStateEventDetail, void>;
4
5export type CodeBuildStateType = 'IN_PROGRESS' | 'SUCCEEDED' | 'FAILED' | 'STOPPED';
6export type CodeBuildPhaseType =
7 | 'COMPLETED'
8 | 'FINALIZING'
9 | 'UPLOAD_ARTIFACTS'
10 | 'POST_BUILD'
11 | 'BUILD'
12 | 'PRE_BUILD'
13 | 'INSTALL'
14 | 'QUEUED'
15 | 'DOWNLOAD_SOURCE'
16 | 'PROVISIONING'
17 | 'SUBMITTED';
18export type CodeBuildPhaseStatusType =
19 | 'TIMED_OUT'
20 | 'STOPPED'
21 | 'FAILED'
22 | 'SUCCEEDED'
23 | 'FAULT'
24 | 'CLIENT_ERROR';
25export type CodeBuildCacheType = 'NO_CACHE' | 'LOCAL' | 'S3';
26export type CodeBuildSourceLocationType =
27 | 'CODECOMMIT'
28 | 'CODEPIPELINE'
29 | 'GITHUB'
30 | 'GITHUB_ENTERPRISE'
31 | 'BITBUCKET'
32 | 'S3'
33 | 'NO_SOURCE';
34export type CodeBuildEnvironmentType =
35 | 'LINUX_CONTAINER'
36 | 'LINUX_GPU_CONTAINER'
37 | 'WINDOWS_CONTAINER'
38 | 'ARM_CONTAINER';
39export type CodeBuildEnvironmentPullCredentialsType = 'CODEBUILD' | 'SERVICE_ROLE';
40export type CodeBuildEnvironmentComputeType =
41 | 'BUILD_GENERAL1_SMALL'
42 | 'BUILD_GENERAL1_MEDIUM'
43 | 'BUILD_GENERAL1_LARGE'
44 | 'BUILD_GENERAL1_2XLARGE';
45export type CodeBuildEnvironmentVariableType = 'PARAMETER_STORE' | 'PLAINTEXT' | 'SECRETS_MANAGER';
46
47export interface CodeBuildStateEventDetail {
48 'build-status': CodeBuildStateType;
49 'project-name': string;
50 'build-id': string;
51 'current-phase': CodeBuildPhaseType;
52 'current-phase-context': string;
53 version: string;
54 'additional-information': {
55 cache: {
56 type: CodeBuildCacheType;
57 };
58 'build-number': number;
59 'timeout-in-minutes': number;
60 'build-complete': boolean;
61 initiator: string;
62 'build-start-time': string;
63 source: {
64 buildspec: string;
65 location: string;
66 type: CodeBuildSourceLocationType;
67 };
68 'source-version': string;
69 artifact: {
70 location: string;
71 };
72 environment: {
73 image: string;
74 'privileged-mode': boolean;
75 'image-pull-credentials-type'?: CodeBuildEnvironmentPullCredentialsType | undefined;
76 'compute-type': CodeBuildEnvironmentComputeType;
77 type: CodeBuildEnvironmentType;
78 'environment-variables': Array<{
79 name: string;
80 type?: CodeBuildEnvironmentVariableType | undefined;
81 value: string;
82 }>;
83 };
84 'project-file-system-locations': [];
85 logs: {
86 'group-name': string;
87 'stream-name': string;
88 'deep-link': string;
89 };
90 phases: Array<{
91 'phase-context'?: string[] | undefined; // Not available for COMPLETED phase-type
92 'start-time': string;
93 'end-time'?: string | undefined; // Not available for COMPLETED phase-type
94 'duration-in-seconds'?: number | undefined; // Not available for COMPLETED phase-type
95 'phase-type': CodeBuildPhaseType;
96 'phase-status'?: CodeBuildPhaseStatusType | undefined; // Not available for COMPLETED phase-type
97 }>;
98 'queued-timeout-in-minutes': number;
99 };
100}
101
102export interface CodeBuildCloudWatchStateEvent extends EventBridgeEvent<'CodeBuild Build State Change', CodeBuildStateEventDetail> {
103 source: 'aws.codebuild';
104}