screwdriver-api 8.0.67 → 8.0.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/custom-environment-variables.yaml +26 -26
- package/config/default.yaml +34 -36
- package/package.json +1 -1
- package/plugins/webhooks/index.js +3 -11
|
@@ -361,32 +361,32 @@ scms:
|
|
|
361
361
|
# # SCM clone type (https or ssh)
|
|
362
362
|
# cloneType: SCM_GITLAB_RO_CLONE_TYPE
|
|
363
363
|
webhooks:
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
364
|
+
scms:
|
|
365
|
+
# Object keyed by scm name with value webhook settings.
|
|
366
|
+
# Value of webhook settings is an object with the following properties:
|
|
367
|
+
# Example:
|
|
368
|
+
# {
|
|
369
|
+
# "github": {
|
|
370
|
+
# # Obtains the SCM token for a given user. If a user does not have a valid SCM token registered with Screwdriver, it will use this user's token instead.
|
|
371
|
+
# "username": "sd-buildbot",
|
|
372
|
+
# # Ignore commits made by these users
|
|
373
|
+
# "ignoreCommitsBy": [],
|
|
374
|
+
# # Restrict PR: all, none, branch, or fork
|
|
375
|
+
# "restrictPR": "none",
|
|
376
|
+
# # Chain PR: true or false
|
|
377
|
+
# "chainPR": false
|
|
378
|
+
# },
|
|
379
|
+
# "github.example.com": {
|
|
380
|
+
# "username": "someuser",
|
|
381
|
+
# "ignoreCommitsBy": ["someuser", "anotheruser"],
|
|
382
|
+
# "restrictPR": "branch",
|
|
383
|
+
# "chainPR": true
|
|
384
|
+
# }
|
|
385
|
+
# }
|
|
386
|
+
__name: WEBHOOK_SETTINGS
|
|
387
|
+
__format: json
|
|
388
|
+
maxBytes: WEBHOOK_MAX_BYTES
|
|
389
|
+
|
|
390
390
|
|
|
391
391
|
bookends:
|
|
392
392
|
# Object keyed by cluster name with value setup/teardown bookend.
|
package/config/default.yaml
CHANGED
|
@@ -277,42 +277,40 @@ scms: {}
|
|
|
277
277
|
# accessToken: headlesstoken
|
|
278
278
|
# # SCM clone type (https or ssh)
|
|
279
279
|
# cloneType: https
|
|
280
|
-
webhooks:
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
#
|
|
313
|
-
|
|
314
|
-
# }
|
|
315
|
-
# }
|
|
280
|
+
webhooks:
|
|
281
|
+
scms:
|
|
282
|
+
github:
|
|
283
|
+
# Obtains the SCM token for a given user. If a user does not have a valid SCM token registered with Screwdriver, it will use this user's token instead.
|
|
284
|
+
username: sd-buildbot
|
|
285
|
+
# Ignore commits made by these users
|
|
286
|
+
ignoreCommitsBy: []
|
|
287
|
+
# Restrict PR: all, none, branch, or fork
|
|
288
|
+
restrictPR: none
|
|
289
|
+
# Chain PR: true or false
|
|
290
|
+
chainPR: false
|
|
291
|
+
# Object keyed by scm name with value webhook settings.
|
|
292
|
+
# Value of webhook settings is an object with the following properties:
|
|
293
|
+
# Example:
|
|
294
|
+
# {
|
|
295
|
+
# "github:github.com": {
|
|
296
|
+
# # Obtains the SCM token for a given user. If a user does not have a valid SCM token registered with Screwdriver, it will use this user's token instead.
|
|
297
|
+
# "username": "sd-buildbot",
|
|
298
|
+
# # Ignore commits made by these users
|
|
299
|
+
# "ignoreCommitsBy": [],
|
|
300
|
+
# # Restrict PR: all, none, branch, or fork
|
|
301
|
+
# "restrictPR": "none",
|
|
302
|
+
# # Chain PR: true or false
|
|
303
|
+
# "chainPR": false
|
|
304
|
+
# },
|
|
305
|
+
# "github.example.com": {
|
|
306
|
+
# "username": "someuser",
|
|
307
|
+
# "ignoreCommitsBy": ["someuser", "anotheruser"],
|
|
308
|
+
# "restrictPR": "branch",
|
|
309
|
+
# "chainPR": true
|
|
310
|
+
# }
|
|
311
|
+
# }
|
|
312
|
+
# Upper limit on incoming uploads to builds
|
|
313
|
+
maxBytes: 1048576 # 1MB
|
|
316
314
|
coverage:
|
|
317
315
|
default: "false"
|
|
318
316
|
plugin: sonar
|
package/package.json
CHANGED
|
@@ -6,8 +6,7 @@ const boom = require('@hapi/boom');
|
|
|
6
6
|
const { ValidationError } = require('joi');
|
|
7
7
|
const { startHookEvent } = require('./helper');
|
|
8
8
|
|
|
9
|
-
const DEFAULT_MAX_BYTES = 1048576;
|
|
10
|
-
const MAX_BYTES_UPPER_BOUND = 5242880; // 5MB
|
|
9
|
+
const DEFAULT_MAX_BYTES = 1048576; // 1MB
|
|
11
10
|
const providerSchema = joi
|
|
12
11
|
.object({
|
|
13
12
|
username: joi.string().required(),
|
|
@@ -41,7 +40,7 @@ const webhooksPlugin = {
|
|
|
41
40
|
name: 'webhooks',
|
|
42
41
|
async register(server, options) {
|
|
43
42
|
const pluginOptions = joi.attempt(
|
|
44
|
-
options,
|
|
43
|
+
options.scms,
|
|
45
44
|
joi.object().pattern(joi.string(), providerSchema).min(1).required(),
|
|
46
45
|
'Invalid config for plugin-webhooks'
|
|
47
46
|
);
|
|
@@ -59,7 +58,7 @@ const webhooksPlugin = {
|
|
|
59
58
|
}
|
|
60
59
|
},
|
|
61
60
|
payload: {
|
|
62
|
-
maxBytes:
|
|
61
|
+
maxBytes: parseInt(pluginOptions.maxBytes, 10) || DEFAULT_MAX_BYTES,
|
|
63
62
|
parse: false,
|
|
64
63
|
output: 'stream'
|
|
65
64
|
},
|
|
@@ -71,17 +70,10 @@ const webhooksPlugin = {
|
|
|
71
70
|
let hookId;
|
|
72
71
|
|
|
73
72
|
try {
|
|
74
|
-
let size = 0;
|
|
75
73
|
const chunks = [];
|
|
76
74
|
|
|
77
75
|
for await (const chunk of request.payload) {
|
|
78
|
-
size += chunk.length;
|
|
79
76
|
chunks.push(chunk);
|
|
80
|
-
if (size > DEFAULT_MAX_BYTES) {
|
|
81
|
-
throw boom.entityTooLarge(
|
|
82
|
-
`Payload size exceeds the maximum limit of ${DEFAULT_MAX_BYTES} bytes`
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
77
|
}
|
|
86
78
|
|
|
87
79
|
const data = Buffer.concat(chunks).toString();
|