• 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

40.0
/plugins/pipelines/batchUpdateAdmins.js
1
'use strict';
2

3
const boom = require('@hapi/boom');
1✔
4
const schema = require('screwdriver-data-schema');
1✔
5
const joi = require('joi');
1✔
6
const idSchema = schema.models.pipeline.base.extract('id');
1✔
7
const scmContextSchema = schema.models.pipeline.base.extract('scmContext');
1✔
8
const usernameSchema = schema.models.user.base.extract('username');
1✔
9
const { updatePipelineAdmins } = require('./helper/updateAdmins');
1✔
10

11
module.exports = () => ({
434✔
12
    method: 'PUT',
13
    path: '/pipelines/updateAdmins',
14
    options: {
15
        description: 'Update admins for a collection of pipelines',
16
        notes: 'Update the admins for a collection of pipelines',
17
        tags: ['api', 'pipelines'],
18
        auth: {
19
            strategies: ['token'],
20
            scope: ['user', '!guest']
21
        },
22
        handler: async (request, h) => {
UNCOV
23
            const { scmContext, username, scmUserId } = request.auth.credentials;
×
UNCOV
24
            const { payload } = request;
×
25

UNCOV
26
            const { bannerFactory } = request.server.app;
×
27

28
            // Check token permissions
29
            // Only SD cluster admins can update the admins
UNCOV
30
            const scmDisplayName = bannerFactory.scm.getDisplayName({ scmContext });
×
31

UNCOV
32
            const adminDetails = request.server.plugins.banners.screwdriverAdminDetails(
×
33
                username,
34
                scmDisplayName,
35
                scmUserId
36
            );
37

UNCOV
38
            if (!adminDetails.isAdmin) {
×
UNCOV
39
                throw boom.forbidden(
×
40
                    `User ${username} does not have Screwdriver administrative privileges to update the admins for pipelines`
41
                );
42
            }
43

UNCOV
44
            await Promise.all(
×
45
                payload.map(e => {
UNCOV
46
                    return updatePipelineAdmins(e, request.server);
×
47
                })
48
            );
49

UNCOV
50
            return h.response().code(204);
×
51
        },
52
        validate: {
53
            payload: joi
54
                .array()
55
                .items(
56
                    joi.object({
57
                        id: idSchema.required(),
58
                        scmContext: scmContextSchema.required(),
59
                        usernames: joi.array().items(usernameSchema).min(1).max(50).required()
60
                    })
61
                )
62
                .min(1)
63
        }
64
    }
65
});
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