screwdriver-api 4.1.281 → 4.1.284

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/lib/server.js CHANGED
@@ -141,9 +141,7 @@ module.exports = async config => {
141
141
  ecosystem: config.ecosystem,
142
142
  release: config.release,
143
143
  queueWebhook: config.queueWebhook,
144
- feature: {
145
- unzipArtifacts: config.unzipArtifactsEnabled
146
- }
144
+ unzipArtifacts: config.unzipArtifactsEnabled
147
145
  };
148
146
 
149
147
  const bellConfigs = await config.auth.scm.getBellConfiguration();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-api",
3
- "version": "4.1.281",
3
+ "version": "4.1.284",
4
4
  "description": "API server for the Screwdriver.cd service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -18,7 +18,7 @@ module.exports = config => ({
18
18
  },
19
19
 
20
20
  handler: async (req, h) => {
21
- if (!req.server.app.feature.unzipArtifacts) {
21
+ if (!req.server.app.unzipArtifacts) {
22
22
  const data = {
23
23
  statusCode: 200,
24
24
  message: "This function is not enabled and will do nothing."
@@ -41,7 +41,7 @@ module.exports = () => ({
41
41
  }
42
42
  });
43
43
 
44
- await Promise.all(
44
+ const createEvents = await Promise.allSettled(
45
45
  pipelines.map(async p => {
46
46
  const pipelineToken = await p.token;
47
47
  const pipelineScmContext = p.scmContext;
@@ -51,6 +51,8 @@ module.exports = () => ({
51
51
  token: pipelineToken
52
52
  });
53
53
 
54
+ await getUserPermissions({ user, scmUri: p.scmUri, level: 'push' });
55
+
54
56
  await eventFactory.create({
55
57
  pipelineId: p.id,
56
58
  sha,
@@ -62,6 +64,12 @@ module.exports = () => ({
62
64
  })
63
65
  );
64
66
 
67
+ const rejected = createEvents.filter(createEvent => createEvent.status === 'rejected');
68
+
69
+ if (rejected.length) {
70
+ throw boom.forbidden('Failed to start some child pipelines due to lack of permissions.');
71
+ }
72
+
65
73
  return h.response().code(201);
66
74
  },
67
75
  validate: {