1 | import * as codecommit from '@aws-cdk/aws-codecommit';
|
2 | import * as s3 from '@aws-cdk/aws-s3';
|
3 | import { CfnProject } from './codebuild.generated';
|
4 | import { IProject } from './project';
|
5 | import { Construct as CoreConstruct } from '@aws-cdk/core';
|
6 |
|
7 |
|
8 |
|
9 | export interface SourceConfig {
|
10 | readonly sourceProperty: CfnProject.SourceProperty;
|
11 | readonly buildTriggers?: CfnProject.ProjectTriggersProperty;
|
12 | |
13 |
|
14 |
|
15 |
|
16 |
|
17 | readonly sourceVersion?: string;
|
18 | }
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | export interface ISource {
|
24 | readonly identifier?: string;
|
25 | readonly type: string;
|
26 | readonly badgeSupported: boolean;
|
27 | bind(scope: CoreConstruct, project: IProject): SourceConfig;
|
28 | }
|
29 |
|
30 |
|
31 |
|
32 | export interface SourceProps {
|
33 | |
34 |
|
35 |
|
36 |
|
37 | readonly identifier?: string;
|
38 | }
|
39 |
|
40 |
|
41 |
|
42 | export declare abstract class Source implements ISource {
|
43 | static s3(props: S3SourceProps): ISource;
|
44 | static codeCommit(props: CodeCommitSourceProps): ISource;
|
45 | static gitHub(props: GitHubSourceProps): ISource;
|
46 | static gitHubEnterprise(props: GitHubEnterpriseSourceProps): ISource;
|
47 | static bitBucket(props: BitBucketSourceProps): ISource;
|
48 | readonly identifier?: string;
|
49 | abstract readonly type: string;
|
50 | readonly badgeSupported: boolean;
|
51 | protected constructor(props: SourceProps);
|
52 | /**
|
53 | * Called by the project when the source is added so that the source can perform
|
54 | * binding operations on the source. For example, it can grant permissions to the
|
55 | * code build project to read from the S3 bucket.
|
56 | */
|
57 | bind(_scope: CoreConstruct, _project: IProject): SourceConfig;
|
58 | }
|
59 | /**
|
60 | * The construction properties common to all build sources that are backed by Git.
|
61 | */
|
62 | interface GitSourceProps extends SourceProps {
|
63 | |
64 |
|
65 |
|
66 |
|
67 |
|
68 | readonly cloneDepth?: number;
|
69 | |
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 | readonly branchOrRef?: string;
|
77 | |
78 |
|
79 |
|
80 |
|
81 |
|
82 | readonly fetchSubmodules?: boolean;
|
83 | }
|
84 |
|
85 |
|
86 |
|
87 | export declare enum EventAction {
|
88 | |
89 |
|
90 |
|
91 | PUSH = "PUSH",
|
92 | |
93 |
|
94 |
|
95 | PULL_REQUEST_CREATED = "PULL_REQUEST_CREATED",
|
96 | |
97 |
|
98 |
|
99 | PULL_REQUEST_UPDATED = "PULL_REQUEST_UPDATED",
|
100 | |
101 |
|
102 |
|
103 | PULL_REQUEST_MERGED = "PULL_REQUEST_MERGED",
|
104 | |
105 |
|
106 |
|
107 |
|
108 | PULL_REQUEST_REOPENED = "PULL_REQUEST_REOPENED"
|
109 | }
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 | export declare class FilterGroup {
|
120 | |
121 |
|
122 |
|
123 |
|
124 |
|
125 | static inEventOf(...actions: EventAction[]): FilterGroup;
|
126 | private readonly actions;
|
127 | private readonly filters;
|
128 | private constructor();
|
129 | /**
|
130 | * Create a new FilterGroup with an added condition:
|
131 | * the event must affect the given branch.
|
132 | *
|
133 | * @param branchName the name of the branch (can be a regular expression)
|
134 | */
|
135 | andBranchIs(branchName: string): FilterGroup;
|
136 | /**
|
137 | * Create a new FilterGroup with an added condition:
|
138 | * the event must not affect the given branch.
|
139 | *
|
140 | * @param branchName the name of the branch (can be a regular expression)
|
141 | */
|
142 | andBranchIsNot(branchName: string): FilterGroup;
|
143 | /**
|
144 | * Create a new FilterGroup with an added condition:
|
145 | * the event must affect a head commit with the given message.
|
146 | *
|
147 | * @param commitMessage the commit message (can be a regular expression)
|
148 | */
|
149 | andCommitMessageIs(commitMessage: string): FilterGroup;
|
150 | /**
|
151 | * Create a new FilterGroup with an added condition:
|
152 | * the event must not affect a head commit with the given message.
|
153 | *
|
154 | * @param commitMessage the commit message (can be a regular expression)
|
155 | */
|
156 | andCommitMessageIsNot(commitMessage: string): FilterGroup;
|
157 | /**
|
158 | * Create a new FilterGroup with an added condition:
|
159 | * the event must affect the given tag.
|
160 | *
|
161 | * @param tagName the name of the tag (can be a regular expression)
|
162 | */
|
163 | andTagIs(tagName: string): FilterGroup;
|
164 | /**
|
165 | * Create a new FilterGroup with an added condition:
|
166 | * the event must not affect the given tag.
|
167 | *
|
168 | * @param tagName the name of the tag (can be a regular expression)
|
169 | */
|
170 | andTagIsNot(tagName: string): FilterGroup;
|
171 | /**
|
172 | * Create a new FilterGroup with an added condition:
|
173 | * the event must affect a Git reference (ie., a branch or a tag)
|
174 | * that matches the given pattern.
|
175 | *
|
176 | * @param pattern a regular expression
|
177 | */
|
178 | andHeadRefIs(pattern: string): FilterGroup;
|
179 | /**
|
180 | * Create a new FilterGroup with an added condition:
|
181 | * the event must not affect a Git reference (ie., a branch or a tag)
|
182 | * that matches the given pattern.
|
183 | *
|
184 | * @param pattern a regular expression
|
185 | */
|
186 | andHeadRefIsNot(pattern: string): FilterGroup;
|
187 | /**
|
188 | * Create a new FilterGroup with an added condition:
|
189 | * the account ID of the actor initiating the event must match the given pattern.
|
190 | *
|
191 | * @param pattern a regular expression
|
192 | */
|
193 | andActorAccountIs(pattern: string): FilterGroup;
|
194 | /**
|
195 | * Create a new FilterGroup with an added condition:
|
196 | * the account ID of the actor initiating the event must not match the given pattern.
|
197 | *
|
198 | * @param pattern a regular expression
|
199 | */
|
200 | andActorAccountIsNot(pattern: string): FilterGroup;
|
201 | /**
|
202 | * Create a new FilterGroup with an added condition:
|
203 | * the Pull Request that is the source of the event must target the given base branch.
|
204 | * Note that you cannot use this method if this Group contains the `PUSH` event action.
|
205 | *
|
206 | * @param branchName the name of the branch (can be a regular expression)
|
207 | */
|
208 | andBaseBranchIs(branchName: string): FilterGroup;
|
209 | /**
|
210 | * Create a new FilterGroup with an added condition:
|
211 | * the Pull Request that is the source of the event must not target the given base branch.
|
212 | * Note that you cannot use this method if this Group contains the `PUSH` event action.
|
213 | *
|
214 | * @param branchName the name of the branch (can be a regular expression)
|
215 | */
|
216 | andBaseBranchIsNot(branchName: string): FilterGroup;
|
217 | /**
|
218 | * Create a new FilterGroup with an added condition:
|
219 | * the Pull Request that is the source of the event must target the given Git reference.
|
220 | * Note that you cannot use this method if this Group contains the `PUSH` event action.
|
221 | *
|
222 | * @param pattern a regular expression
|
223 | */
|
224 | andBaseRefIs(pattern: string): FilterGroup;
|
225 | /**
|
226 | * Create a new FilterGroup with an added condition:
|
227 | * the Pull Request that is the source of the event must not target the given Git reference.
|
228 | * Note that you cannot use this method if this Group contains the `PUSH` event action.
|
229 | *
|
230 | * @param pattern a regular expression
|
231 | */
|
232 | andBaseRefIsNot(pattern: string): FilterGroup;
|
233 | /**
|
234 | * Create a new FilterGroup with an added condition:
|
235 | * the push that is the source of the event must affect a file that matches the given pattern.
|
236 | * Note that you can only use this method if this Group contains only the `PUSH` event action,
|
237 | * and only for GitHub, Bitbucket and GitHubEnterprise sources.
|
238 | *
|
239 | * @param pattern a regular expression
|
240 | */
|
241 | andFilePathIs(pattern: string): FilterGroup;
|
242 | /**
|
243 | * Create a new FilterGroup with an added condition:
|
244 | * the push that is the source of the event must not affect a file that matches the given pattern.
|
245 | * Note that you can only use this method if this Group contains only the `PUSH` event action,
|
246 | * and only for GitHub, Bitbucket and GitHubEnterprise sources.
|
247 | *
|
248 | * @param pattern a regular expression
|
249 | */
|
250 | andFilePathIsNot(pattern: string): FilterGroup;
|
251 | /** @internal */
|
252 | get _actions(): EventAction[];
|
253 | /** @internal */
|
254 | get _filters(): CfnProject.WebhookFilterProperty[];
|
255 | /** @internal */
|
256 | _toJson(): CfnProject.WebhookFilterProperty[];
|
257 | private addCommitMessageFilter;
|
258 | private addHeadBranchFilter;
|
259 | private addHeadTagFilter;
|
260 | private addHeadRefFilter;
|
261 | private addActorAccountId;
|
262 | private addBaseBranchFilter;
|
263 | private addBaseRefFilter;
|
264 | private addFilePathFilter;
|
265 | private addFilter;
|
266 | }
|
267 | /**
|
268 | * The construction properties common to all third-party build sources that are backed by Git.
|
269 | */
|
270 | interface ThirdPartyGitSourceProps extends GitSourceProps {
|
271 | |
272 |
|
273 |
|
274 |
|
275 |
|
276 | readonly reportBuildStatus?: boolean;
|
277 | |
278 |
|
279 |
|
280 |
|
281 |
|
282 | readonly webhook?: boolean;
|
283 | |
284 |
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 | readonly webhookTriggersBatchBuild?: boolean;
|
291 | |
292 |
|
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 | readonly webhookFilters?: FilterGroup[];
|
299 | |
300 |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 |
|
306 |
|
307 |
|
308 |
|
309 | readonly buildStatusUrl?: string;
|
310 | }
|
311 |
|
312 |
|
313 |
|
314 | export interface CodeCommitSourceProps extends GitSourceProps {
|
315 | readonly repository: codecommit.IRepository;
|
316 | }
|
317 |
|
318 |
|
319 |
|
320 | export interface S3SourceProps extends SourceProps {
|
321 | readonly bucket: s3.IBucket;
|
322 | readonly path: string;
|
323 | |
324 |
|
325 |
|
326 |
|
327 |
|
328 | readonly version?: string;
|
329 | }
|
330 |
|
331 |
|
332 |
|
333 | interface CommonGithubSourceProps extends ThirdPartyGitSourceProps {
|
334 | |
335 |
|
336 |
|
337 |
|
338 |
|
339 |
|
340 |
|
341 |
|
342 |
|
343 |
|
344 | readonly buildStatusContext?: string;
|
345 | }
|
346 |
|
347 |
|
348 |
|
349 | export interface GitHubSourceProps extends CommonGithubSourceProps {
|
350 | |
351 |
|
352 |
|
353 |
|
354 |
|
355 | readonly owner: string;
|
356 | |
357 |
|
358 |
|
359 |
|
360 |
|
361 | readonly repo: string;
|
362 | }
|
363 |
|
364 |
|
365 |
|
366 | export interface GitHubEnterpriseSourceProps extends CommonGithubSourceProps {
|
367 | |
368 |
|
369 |
|
370 | readonly httpsCloneUrl: string;
|
371 | |
372 |
|
373 |
|
374 |
|
375 |
|
376 | readonly ignoreSslErrors?: boolean;
|
377 | }
|
378 |
|
379 |
|
380 |
|
381 | export interface BitBucketSourceProps extends ThirdPartyGitSourceProps {
|
382 | |
383 |
|
384 |
|
385 |
|
386 |
|
387 | readonly owner: string;
|
388 | |
389 |
|
390 |
|
391 |
|
392 |
|
393 | readonly repo: string;
|
394 | |
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 | readonly buildStatusName?: string;
|
405 | }
|
406 | export {};
|