@@ -151,56 +151,102 @@ export class CodePipelineSource extends BuildSource {
151
151
*/
152
152
export interface GitHubSourceProps extends BuildSourceProps {
153
153
/**
154
- * The git url to clone for this code build project.
154
+ * The GitHub account/user that owns the repo.
155
+ *
156
+ * @example 'awslabs'
155
157
*/
156
- cloneUrl : string ;
158
+ owner : string ;
159
+
160
+ /**
161
+ * The name of the repo (without the username).
162
+ *
163
+ * @example 'aws-cdk'
164
+ */
165
+ repo : string ;
157
166
158
167
/**
159
168
* The oAuthToken used to authenticate when cloning source git repo.
169
+ * Note that you need to give CodeBuild permissions to your GitHub account in order for the token to work.
170
+ * That is a one-time operation that can be done through the AWS Console for CodeBuild.
160
171
*/
161
172
oauthToken : cdk . Secret ;
173
+
174
+ /**
175
+ * Whether to send GitHub notifications on your build's start and end.
176
+ *
177
+ * @default true
178
+ */
179
+ reportBuildStatus ?: boolean ;
162
180
}
163
181
164
182
/**
165
183
* GitHub Source definition for a CodeBuild project.
166
184
*/
167
185
export class GitHubSource extends BuildSource {
168
186
public readonly type : SourceType = SourceType . GitHub ;
169
- private readonly cloneUrl : string ;
187
+ private readonly httpsCloneUrl : string ;
170
188
private readonly oauthToken : cdk . Secret ;
189
+ private readonly reportBuildStatus : boolean ;
171
190
172
191
constructor ( props : GitHubSourceProps ) {
173
192
super ( props ) ;
174
- this . cloneUrl = props . cloneUrl ;
193
+ this . httpsCloneUrl = `https://github.com/ ${ props . owner } / ${ props . repo } .git` ;
175
194
this . oauthToken = props . oauthToken ;
195
+ this . reportBuildStatus = props . reportBuildStatus === undefined ? true : props . reportBuildStatus ;
176
196
}
177
197
178
198
protected toSourceProperty ( ) : any {
179
199
return {
180
200
auth : { type : 'OAUTH' , resource : this . oauthToken } ,
181
- location : this . cloneUrl ,
201
+ location : this . httpsCloneUrl ,
202
+ reportBuildStatus : this . reportBuildStatus ,
182
203
} ;
183
204
}
184
205
}
185
206
207
+ /**
208
+ * Construction properties for {@link GitHubEnterpriseSource}.
209
+ */
210
+ export interface GitHubEnterpriseSourceProps extends BuildSourceProps {
211
+ /**
212
+ * The HTTPS URL of the repository in your GitHub Enterprise installation.
213
+ */
214
+ httpsCloneUrl : string ;
215
+
216
+ /**
217
+ * The OAuth token used to authenticate when cloning the git repository.
218
+ */
219
+ oauthToken : cdk . Secret ;
220
+
221
+ /**
222
+ * Whether to ignore SSL errors when connecting to the repository.
223
+ *
224
+ * @default false
225
+ */
226
+ ignoreSslErrors ?: boolean ;
227
+ }
228
+
186
229
/**
187
230
* GitHub Enterprise Source definition for a CodeBuild project.
188
231
*/
189
232
export class GitHubEnterpriseSource extends BuildSource {
190
233
public readonly type : SourceType = SourceType . GitHubEnterPrise ;
191
- private readonly cloneUrl : string ;
234
+ private readonly httpsCloneUrl : string ;
192
235
private readonly oauthToken : cdk . Secret ;
236
+ private readonly ignoreSslErrors ?: boolean ;
193
237
194
- constructor ( props : GitHubSourceProps ) {
238
+ constructor ( props : GitHubEnterpriseSourceProps ) {
195
239
super ( props ) ;
196
- this . cloneUrl = props . cloneUrl ;
240
+ this . httpsCloneUrl = props . httpsCloneUrl ;
197
241
this . oauthToken = props . oauthToken ;
242
+ this . ignoreSslErrors = props . ignoreSslErrors ;
198
243
}
199
244
200
245
protected toSourceProperty ( ) : any {
201
246
return {
202
247
auth : { type : 'OAUTH' , resource : this . oauthToken } ,
203
- location : this . cloneUrl ,
248
+ location : this . httpsCloneUrl ,
249
+ insecureSsl : this . ignoreSslErrors ,
204
250
} ;
205
251
}
206
252
}
@@ -209,7 +255,19 @@ export class GitHubEnterpriseSource extends BuildSource {
209
255
* Construction properties for {@link BitBucketSource}.
210
256
*/
211
257
export interface BitBucketSourceProps extends BuildSourceProps {
212
- httpsCloneUrl : string ;
258
+ /**
259
+ * The BitBucket account/user that owns the repo.
260
+ *
261
+ * @example 'awslabs'
262
+ */
263
+ owner : string ;
264
+
265
+ /**
266
+ * The name of the repo (without the username).
267
+ *
268
+ * @example 'aws-cdk'
269
+ */
270
+ repo : string ;
213
271
}
214
272
215
273
/**
@@ -221,7 +279,7 @@ export class BitBucketSource extends BuildSource {
221
279
222
280
constructor ( props : BitBucketSourceProps ) {
223
281
super ( props ) ;
224
- this . httpsCloneUrl = props . httpsCloneUrl ;
282
+ this . httpsCloneUrl = `https://bitbucket.org/ ${ props . owner } / ${ props . repo } .git` ;
225
283
}
226
284
227
285
protected toSourceProperty ( ) : any {
0 commit comments