screwdriver-api 8.0.16 → 8.0.18
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 +3 -0
- package/config/default.yaml +3 -0
- package/lib/server.js +12 -3
- package/package.json +1 -1
- package/plugins/builds/create.js +4 -0
- package/plugins/events/index.js +4 -0
- package/plugins/pipelines/sync.js +4 -0
- package/plugins/pipelines/update.js +9 -0
- package/plugins/webhooks/helper.js +4 -0
package/config/default.yaml
CHANGED
|
@@ -385,6 +385,9 @@ log:
|
|
|
385
385
|
enabled: false
|
|
386
386
|
# add target scope tokens(pipeline, build, temporal, admin, guest, user)
|
|
387
387
|
scope: []
|
|
388
|
+
payload:
|
|
389
|
+
# set true to enable payload logs for all API calls over 5s
|
|
390
|
+
enabled: true
|
|
388
391
|
|
|
389
392
|
# default cluster environment variables to inject into builds
|
|
390
393
|
build:
|
package/lib/server.js
CHANGED
|
@@ -15,7 +15,7 @@ process.on('unhandledRejection', (reason, p) => {
|
|
|
15
15
|
*/
|
|
16
16
|
function handlePreResponseLogs(request, h) {
|
|
17
17
|
const { response } = request;
|
|
18
|
-
const { release } = request.server.app;
|
|
18
|
+
const { release, log } = request.server.app;
|
|
19
19
|
|
|
20
20
|
if (release && release.cookieName && request.state && !request.state[release.cookieName]) {
|
|
21
21
|
h.state(release.cookieName, release.cookieValue);
|
|
@@ -49,7 +49,15 @@ function handlePreResponseLogs(request, h) {
|
|
|
49
49
|
|
|
50
50
|
// Log request payload when it takes longer than 5 seconds to respond
|
|
51
51
|
// This is to prevent logging payloads for every request
|
|
52
|
-
if (
|
|
52
|
+
if (
|
|
53
|
+
log &&
|
|
54
|
+
log.payload &&
|
|
55
|
+
log.payload.enabled &&
|
|
56
|
+
request.info &&
|
|
57
|
+
request.info.received &&
|
|
58
|
+
Date.now() - request.info.received > 5000 &&
|
|
59
|
+
request.payload
|
|
60
|
+
) {
|
|
53
61
|
request.log(['payload'], {
|
|
54
62
|
method: request.method,
|
|
55
63
|
path: request.path,
|
|
@@ -161,7 +169,8 @@ module.exports = async config => {
|
|
|
161
169
|
ecosystem: config.ecosystem,
|
|
162
170
|
release: config.release,
|
|
163
171
|
queueWebhook: config.queueWebhook,
|
|
164
|
-
unzipArtifacts: config.unzipArtifactsEnabled
|
|
172
|
+
unzipArtifacts: config.unzipArtifactsEnabled,
|
|
173
|
+
log: config.log
|
|
165
174
|
};
|
|
166
175
|
|
|
167
176
|
const bellConfigs = await config.auth.scm.getBellConfiguration();
|
package/package.json
CHANGED
package/plugins/builds/create.js
CHANGED
|
@@ -52,6 +52,10 @@ module.exports = () => ({
|
|
|
52
52
|
if (!isValidToken(pipeline.id, request.auth.credentials)) {
|
|
53
53
|
throw boom.unauthorized('Token does not have permission to this pipeline');
|
|
54
54
|
}
|
|
55
|
+
// for mysql backward compatibility
|
|
56
|
+
if (!pipeline.adminUserIds) {
|
|
57
|
+
pipeline.adminUserIds = [];
|
|
58
|
+
}
|
|
55
59
|
|
|
56
60
|
return (
|
|
57
61
|
user
|
package/plugins/events/index.js
CHANGED
|
@@ -29,6 +29,10 @@ const eventsPlugin = {
|
|
|
29
29
|
server.expose('updateAdmins', ({ permissions, pipeline, user }) => {
|
|
30
30
|
const { username, id: userId } = user;
|
|
31
31
|
|
|
32
|
+
// for mysql backward compatibility
|
|
33
|
+
if (!pipeline.adminUserIds) {
|
|
34
|
+
pipeline.adminUserIds = [];
|
|
35
|
+
}
|
|
32
36
|
// Delete user from admin list if bad permissions
|
|
33
37
|
if (!permissions.push) {
|
|
34
38
|
const newAdmins = pipeline.admins;
|
|
@@ -41,6 +41,10 @@ module.exports = () => ({
|
|
|
41
41
|
if (!user) {
|
|
42
42
|
throw boom.notFound(`User ${username} does not exist`);
|
|
43
43
|
}
|
|
44
|
+
// for mysql backward compatibility
|
|
45
|
+
if (!pipeline.adminUserIds) {
|
|
46
|
+
pipeline.adminUserIds = [];
|
|
47
|
+
}
|
|
44
48
|
|
|
45
49
|
// Use parent's scmUri if pipeline is child pipeline and using read-only SCM
|
|
46
50
|
const scmUri = await getScmUri({ pipeline, pipelineFactory });
|
|
@@ -21,6 +21,10 @@ function getPermissionsForOldPipeline({ scmContexts, pipeline, user }) {
|
|
|
21
21
|
const isPipelineSCMContextObsolete = !scmContexts.includes(pipeline.scmContext);
|
|
22
22
|
const isUserFromAnotherSCMContext = user.scmContext !== pipeline.scmContext;
|
|
23
23
|
|
|
24
|
+
// for mysql backward compatibility
|
|
25
|
+
if (!pipeline.adminUserIds) {
|
|
26
|
+
pipeline.adminUserIds = [];
|
|
27
|
+
}
|
|
24
28
|
// this pipeline's scmContext has been removed, allow current admin to change it
|
|
25
29
|
// also allow pipeline admins from other scmContexts to change it
|
|
26
30
|
if (isPipelineSCMContextObsolete || isUserFromAnotherSCMContext) {
|
|
@@ -70,6 +74,11 @@ module.exports = () => ({
|
|
|
70
74
|
throw boom.notFound(`Pipeline ${id} does not exist`);
|
|
71
75
|
}
|
|
72
76
|
|
|
77
|
+
// for mysql backward compatibility
|
|
78
|
+
if (!oldPipeline.adminUserIds) {
|
|
79
|
+
oldPipeline.adminUserIds = [];
|
|
80
|
+
}
|
|
81
|
+
|
|
73
82
|
if (oldPipeline.configPipelineId) {
|
|
74
83
|
throw boom.forbidden(
|
|
75
84
|
`Child pipeline can only be modified by config pipeline ${oldPipeline.configPipelineId}`
|
|
@@ -90,6 +90,10 @@ async function updateAdmins(userFactory, username, scmContext, pipeline, pipelin
|
|
|
90
90
|
const user = await userFactory.get({ username, scmContext });
|
|
91
91
|
const userPermissions = await user.getPermissions(pipeline.scmUri, user.scmContext, pipeline.scmRepo);
|
|
92
92
|
|
|
93
|
+
// for mysql backward compatibility
|
|
94
|
+
if (!pipeline.adminUserIds) {
|
|
95
|
+
pipeline.adminUserIds = [];
|
|
96
|
+
}
|
|
93
97
|
// Delete user from admin list if bad permissions
|
|
94
98
|
if (!userPermissions.push) {
|
|
95
99
|
const newAdmins = pipeline.admins;
|