screwdriver-api 7.0.109 → 7.0.110

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-api",
3
- "version": "7.0.109",
3
+ "version": "7.0.110",
4
4
  "description": "API server for the Screwdriver.cd service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -101,10 +101,17 @@ Example payload:
101
101
  `POST /pipelines/{id}/sync/pullrequests`
102
102
 
103
103
  #### Get all pipeline events
104
- `page`, `count`, `sort`, and `prNum` are optional
105
- Only PR events of specified PR number will be searched when `prNum` is set
106
104
 
107
- `GET /pipelines/{id}/events?page={pageNumber}&count={countNumber}&sort={sort}&prNum={prNumber}`
105
+ Query Params:
106
+
107
+ * `page` - *Optional* Specific page of the set to return
108
+ * `count` - *Optional* Number of items per page
109
+ * `sort` - *Optional* Sort rangekey by `ascending` or `descending` (default `descending`)
110
+ * `type` - *Optional* Get pipeline or pr events (default `pipeline`)
111
+ * `prNum` - *Optional* Return only PR events of specified PR number
112
+ * `sha` - *Optional* Search `sha` and `configPipelineSha` for events
113
+
114
+ `GET /pipelines/{id}/events?page={pageNumber}&count={countNumber}&sort={sort}&type={type}&prNum={prNumber}&sha={sha}`
108
115
 
109
116
  #### Get all pipeline builds
110
117
  `page`, `count`, `sort`, `latest`, `sortBy`, `fetchSteps`, `readOnly`, and `groupEventId` are optional
@@ -5,6 +5,8 @@ const joi = require('joi');
5
5
  const schema = require('screwdriver-data-schema');
6
6
  const eventListSchema = joi.array().items(schema.models.event.get).label('List of events');
7
7
  const prNumSchema = schema.models.event.base.extract('prNum');
8
+ const shaSchema = schema.models.event.base.extract('sha');
9
+ const typeSchema = schema.models.event.base.extract('type');
8
10
  const pipelineIdSchema = schema.models.pipeline.base.extract('id');
9
11
 
10
12
  module.exports = () => ({
@@ -21,6 +23,7 @@ module.exports = () => ({
21
23
 
22
24
  handler: async (request, h) => {
23
25
  const factory = request.server.app.pipelineFactory;
26
+ const { page, count, sha, prNum } = request.query;
24
27
 
25
28
  return factory
26
29
  .get(request.params.id)
@@ -32,16 +35,25 @@ module.exports = () => ({
32
35
  const eventType = request.query.type || 'pipeline';
33
36
  const config = { params: { type: eventType } };
34
37
 
35
- if (request.query.page || request.query.count) {
38
+ if (page || count) {
36
39
  config.paginate = {
37
- page: request.query.page,
38
- count: request.query.count
40
+ page,
41
+ count
39
42
  };
40
43
  }
41
44
 
42
- if (request.query.prNum) {
45
+ if (prNum) {
43
46
  config.params.type = 'pr';
44
- config.params.prNum = request.query.prNum;
47
+ config.params.prNum = prNum;
48
+ }
49
+
50
+ if (sha) {
51
+ config.search = {
52
+ field: ['sha', 'configPipelineSha'],
53
+ // Do a search for sha
54
+ // See https://www.w3schools.com/sql/sql_like.asp for syntax
55
+ keyword: `${sha}%`
56
+ };
45
57
  }
46
58
 
47
59
  return pipeline.getEvents(config);
@@ -60,8 +72,9 @@ module.exports = () => ({
60
72
  }),
61
73
  query: schema.api.pagination.concat(
62
74
  joi.object({
63
- type: joi.string(),
75
+ type: typeSchema,
64
76
  prNum: prNumSchema,
77
+ sha: shaSchema,
65
78
  search: joi.forbidden(), // we don't support search for Pipeline list events
66
79
  getCount: joi.forbidden() // we don't support getCount for Pipeline list events
67
80
  })