screwdriver-api 8.0.88 → 8.0.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugins/pipelines/badge.js +1 -19
package/package.json
CHANGED
|
@@ -5,7 +5,6 @@ const schema = require('screwdriver-data-schema');
|
|
|
5
5
|
const idSchema = schema.models.pipeline.base.extract('id');
|
|
6
6
|
const logger = require('screwdriver-logger');
|
|
7
7
|
const { getPipelineBadge } = require('./helper');
|
|
8
|
-
const BUILD_META_KEYWORD = '%"build":%';
|
|
9
8
|
|
|
10
9
|
module.exports = config => ({
|
|
11
10
|
method: 'GET',
|
|
@@ -37,24 +36,7 @@ module.exports = config => ({
|
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
// Get latest pipeline events
|
|
40
|
-
const latestEvents = await eventFactory.
|
|
41
|
-
params: {
|
|
42
|
-
pipelineId,
|
|
43
|
-
type: 'pipeline'
|
|
44
|
-
},
|
|
45
|
-
// Make sure build exists for event, meta will be {} for skipped builds
|
|
46
|
-
search: {
|
|
47
|
-
field: 'meta',
|
|
48
|
-
keyword: BUILD_META_KEYWORD
|
|
49
|
-
},
|
|
50
|
-
// removing these fields trims most of the bytes
|
|
51
|
-
exclude: ['workflowGraph', 'meta', 'commit'],
|
|
52
|
-
paginate: {
|
|
53
|
-
count: 1
|
|
54
|
-
},
|
|
55
|
-
sort: 'descending',
|
|
56
|
-
sortBy: 'createTime'
|
|
57
|
-
});
|
|
39
|
+
const latestEvents = await eventFactory.getPipelineTypeBuildEvents(pipelineId);
|
|
58
40
|
|
|
59
41
|
if (!latestEvents || Object.keys(latestEvents).length === 0) {
|
|
60
42
|
return h.response(getPipelineBadge(badgeConfig)).header('Content-Type', contentType);
|