• 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

14.29
/plugins/pipelines/listBuilds.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 groupEventIdSchema = schema.models.event.base.extract('groupEventId');
1✔
7
const pipelineIdSchema = schema.models.pipeline.base.extract('id');
1✔
8

9
module.exports = () => ({
434✔
10
    method: 'GET',
11
    path: '/pipelines/{id}/builds',
12
    options: {
13
        description: 'Get builds for this pipeline',
14
        notes: 'Returns builds for the given pipeline',
15
        tags: ['api', 'pipelines', 'builds'],
16
        auth: {
17
            strategies: ['token'],
18
            scope: ['user', 'build', 'pipeline']
19
        },
20

21
        handler: async (request, h) => {
UNCOV
22
            const factory = request.server.app.pipelineFactory;
×
UNCOV
23
            const { sort, sortBy, page, count, fetchSteps, readOnly, groupEventId, latest } = request.query;
×
24

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

UNCOV
32
                    const config = readOnly
×
33
                        ? { sort, sortBy: 'createTime', readOnly: true }
34
                        : { sort, sortBy: 'createTime' };
35

UNCOV
36
                    if (sortBy) {
×
UNCOV
37
                        config.sortBy = sortBy;
×
38
                    }
39

UNCOV
40
                    if (page || count) {
×
UNCOV
41
                        config.paginate = { page, count };
×
42
                    }
43

UNCOV
44
                    if (groupEventId) {
×
UNCOV
45
                        config.params = {
×
46
                            ...config.params,
47
                            groupEventId
48
                        };
49

50
                        // Latest flag only works in conjunction with groupEventId
UNCOV
51
                        if (latest) {
×
UNCOV
52
                            config.params.latest = latest;
×
53
                        }
54
                    }
55

UNCOV
56
                    return pipeline.getBuilds(config);
×
57
                })
58
                .then(async builds => {
59
                    let data;
60

UNCOV
61
                    if (fetchSteps) {
×
UNCOV
62
                        data = await Promise.all(builds.map(b => b.toJsonWithSteps()));
×
63
                    } else {
UNCOV
64
                        data = await Promise.all(builds.map(b => b.toJson()));
×
65
                    }
66

UNCOV
67
                    return h.response(data);
×
68
                })
69
                .catch(err => {
UNCOV
70
                    throw err;
×
71
                });
72
        },
73
        response: {
74
            schema: joi.array()
75
        },
76
        validate: {
77
            params: joi.object({
78
                id: pipelineIdSchema
79
            }),
80
            query: schema.api.pagination.concat(
81
                joi.object({
82
                    readOnly: joi.boolean().truthy('true').falsy('false').default(true),
83
                    fetchSteps: joi.boolean().truthy('true').falsy('false').default(true),
84
                    groupEventId: groupEventIdSchema,
85
                    latest: joi.boolean().truthy('true').falsy('false').default(false),
86
                    search: joi.forbidden(), // we don't support search for Pipeline list builds
87
                    getCount: joi.forbidden() // we don't support getCount for Pipeline list builds
88
                })
89
            )
90
        }
91
    }
92
});
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