• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

screwdriver-cd / screwdriver / #3202

25 Jul 2025 04:52PM UTC coverage: 67.669% (-27.3%) from 94.935%
#3202

push

screwdriver

web-flow
feat(3363): Update the existing endpoint to get admin for a pipeline from the specified SCM context (#3370)

1284 of 2114 branches covered (60.74%)

Branch coverage included in aggregate %.

1 of 11 new or added lines in 1 file covered. (9.09%)

1235 existing lines in 49 files now uncovered.

3417 of 4833 relevant lines covered (70.7%)

50.53 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

22.58
/plugins/pipelines/startAll.js
1
'use strict';
2

3
const boom = require('@hapi/boom');
1✔
4
const joi = require('joi');
1✔
5
const schema = require('screwdriver-data-schema');
1✔
6
const { getUserPermissions } = require('../helper');
1✔
7
const { createEvent } = require('../events/helper/createEvent');
1✔
8
const idSchema = schema.models.pipeline.base.extract('id');
1✔
9

10
module.exports = () => ({
434✔
11
    method: 'POST',
12
    path: '/pipelines/{id}/startall',
13
    options: {
14
        description: 'Start all child pipelines given a specific pipeline',
15
        notes: 'Start all child pipelines given a specific pipeline',
16
        tags: ['api', 'pipelines'],
17
        auth: {
18
            strategies: ['token'],
19
            scope: ['user', '!guest']
20
        },
21

22
        handler: async (request, h) => {
UNCOV
23
            const { pipelineFactory, userFactory } = request.server.app;
×
UNCOV
24
            const { username, scmContext } = request.auth.credentials;
×
UNCOV
25
            const { id } = request.params;
×
UNCOV
26
            const { scm } = pipelineFactory;
×
27

UNCOV
28
            const pipeline = await pipelineFactory.get(id);
×
29

UNCOV
30
            if (!pipeline) {
×
UNCOV
31
                throw boom.notFound('Pipeline does not exist');
×
32
            }
33

UNCOV
34
            const user = await userFactory.get({ username, scmContext });
×
35

UNCOV
36
            await getUserPermissions({ user, scmUri: pipeline.scmUri, level: 'push' });
×
37

UNCOV
38
            const pipelines = await pipelineFactory.list({
×
39
                params: {
40
                    configPipelineId: id,
41
                    state: 'ACTIVE'
42
                }
43
            });
44

UNCOV
45
            const createdEvents = await Promise.allSettled(
×
46
                pipelines.map(async p => {
UNCOV
47
                    const pipelineToken = await p.token;
×
UNCOV
48
                    const pipelineScmContext = p.scmContext;
×
UNCOV
49
                    const sha = await scm.getCommitSha({
×
50
                        scmContext: pipelineScmContext,
51
                        scmUri: p.scmUri,
52
                        token: pipelineToken
53
                    });
54

UNCOV
55
                    await getUserPermissions({ user, scmUri: p.scmUri, level: 'push' });
×
56

UNCOV
57
                    await createEvent(
×
58
                        {
59
                            pipelineId: p.id,
60
                            sha,
61
                            username,
62
                            scmContext: pipelineScmContext,
63
                            startFrom: '~commit',
64
                            causeMessage: `Started by ${username}`
65
                        },
66
                        request.server
67
                    );
68
                })
69
            );
70

UNCOV
71
            const rejected = createdEvents.filter(createdEvent => createdEvent.status === 'rejected');
×
72

UNCOV
73
            if (rejected.length) {
×
UNCOV
74
                throw boom.forbidden('Failed to start some child pipelines due to lack of permissions.');
×
75
            }
76

UNCOV
77
            return h.response().code(201);
×
78
        },
79
        validate: {
80
            params: joi.object({
81
                id: idSchema
82
            })
83
        }
84
    }
85
});
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc