• 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

26.09
/plugins/secrets/update.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 logger = require('screwdriver-logger');
1✔
7
const idSchema = schema.models.secret.base.extract('id');
1✔
8

9
module.exports = () => ({
66✔
10
    method: 'PUT',
11
    path: '/secrets/{id}',
12
    options: {
13
        description: 'Update a secret',
14
        notes: 'Update a specific secret',
15
        tags: ['api', 'secrets'],
16
        auth: {
17
            strategies: ['token'],
18
            scope: ['user', '!guest', 'pipeline']
19
        },
20

21
        handler: async (request, h) => {
UNCOV
22
            const factory = request.server.app.secretFactory;
×
UNCOV
23
            const { credentials } = request.auth;
×
UNCOV
24
            const { canAccess } = request.server.plugins.secrets;
×
25

UNCOV
26
            return factory
×
27
                .get(request.params.id)
28
                .then(secret => {
UNCOV
29
                    if (!secret) {
×
UNCOV
30
                        throw boom.notFound('Secret does not exist');
×
31
                    }
32

33
                    // Make sure that user has permission before updating
UNCOV
34
                    return canAccess(credentials, secret, 'admin', request.server.app)
×
35
                        .then(() => {
UNCOV
36
                            Object.keys(request.payload).forEach(key => {
×
UNCOV
37
                                secret[key] = request.payload[key];
×
38
                            });
39

UNCOV
40
                            logger.info(
×
41
                                `[Audit] user ${credentials.username}:${credentials.scmContext} updates the secret key:${secret.name} for pipelineId:${secret.pipelineId}.`
42
                            );
43

UNCOV
44
                            return secret.update();
×
45
                        })
46
                        .then(() => {
UNCOV
47
                            const output = secret.toJson();
×
48

UNCOV
49
                            delete output.value;
×
50

UNCOV
51
                            return h.response(output).code(200);
×
52
                        });
53
                })
54
                .catch(err => {
UNCOV
55
                    throw err;
×
56
                });
57
        },
58
        validate: {
59
            params: joi.object({
60
                id: idSchema
61
            }),
62
            payload: schema.models.secret.update
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