• 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

30.43
/plugins/pipelines/latestBuild.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 idSchema = schema.models.pipeline.base.extract('id');
1✔
7
const nameSchema = schema.models.job.base.extract('name');
1✔
8
const statusSchema = schema.models.build.base.extract('status');
1✔
9

10
module.exports = () => ({
434✔
11
    method: 'GET',
12
    path: '/pipelines/{id}/jobs/{jobName}/latestBuild',
13
    options: {
14
        description: 'Get latest build for a given job',
15
        notes: 'Return latest build of status specified',
16
        tags: ['api', 'job', 'build'],
17
        auth: {
18
            strategies: ['token'],
19
            scope: ['user', 'build', 'pipeline']
20
        },
21

22
        handler: async (request, h) => {
UNCOV
23
            const { jobFactory } = request.server.app;
×
UNCOV
24
            const { status } = request.query || {};
×
25

UNCOV
26
            return jobFactory
×
27
                .get({
28
                    pipelineId: request.params.id,
29
                    name: request.params.jobName
30
                })
31
                .then(job => {
UNCOV
32
                    if (!job) {
×
UNCOV
33
                        throw boom.notFound('Job does not exist');
×
34
                    }
35

UNCOV
36
                    return job.getLatestBuild({ status });
×
37
                })
38
                .then(async build => {
UNCOV
39
                    if (Object.keys(build).length === 0) {
×
40
                        throw boom.notFound('There is no such latest build');
×
41
                    }
42

UNCOV
43
                    return h.response(await build.toJsonWithSteps());
×
44
                })
45
                .catch(err => {
UNCOV
46
                    throw err;
×
47
                });
48
        },
49
        response: {
50
            schema: joi.object()
51
        },
52
        validate: {
53
            params: joi.object({
54
                id: idSchema,
55
                jobName: nameSchema
56
            }),
57
            query: joi.object({
58
                status: statusSchema
59
            })
60
        }
61
    }
62
});
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