screwdriver-api 7.0.107 → 7.0.108

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.107",
3
+ "version": "7.0.108",
4
4
  "description": "API server for the Screwdriver.cd service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -115,7 +115,13 @@ When `latest=true` and `groupEventId` is set, only latest builds in a pipeline b
115
115
  #### Get all jobs (including pull requests jobs)
116
116
  `archived` is optional and has a default value of `false`, which makes the endpoint not return archived jobs (e.g. closed pull requests)
117
117
 
118
- `GET /pipelines/{id}/jobs?archived={boolean}`
118
+ Arguments:
119
+
120
+ * `archived` - Optional and has a default value of `false`, which makes the endpoint not return archived jobs (e.g. closed pull requests)
121
+ * `type` - Optional and can be set to `pr` or `pipeline` to only return PR jobs or non-PR jobs
122
+ * `jobName` - Optional and can be set to only return only a single job
123
+
124
+ `GET /pipelines/{id}/jobs?archived={boolean}&type={type}&jobName={jobName}`
119
125
 
120
126
  #### Get Pipeline Admin
121
127
  `GET /pipelines/{id}/admin`
@@ -6,6 +6,7 @@ const schema = require('screwdriver-data-schema');
6
6
  const jobListSchema = joi.array().items(schema.models.job.get).label('List of jobs');
7
7
  const jobNameSchema = schema.models.job.base.extract('name');
8
8
  const pipelineIdSchema = schema.models.pipeline.base.extract('id');
9
+ const JOB_PR_PATTERN = `PR-%:%`;
9
10
 
10
11
  module.exports = () => ({
11
12
  method: 'GET',
@@ -21,7 +22,7 @@ module.exports = () => ({
21
22
 
22
23
  handler: async (request, h) => {
23
24
  const { pipelineFactory } = request.server.app;
24
- const { page, count, jobName } = request.query;
25
+ const { page, count, jobName, type } = request.query;
25
26
 
26
27
  return pipelineFactory
27
28
  .get(request.params.id)
@@ -36,6 +37,20 @@ module.exports = () => ({
36
37
  }
37
38
  };
38
39
 
40
+ if (type) {
41
+ config.search = {
42
+ field: 'name',
43
+ // Do a search for PR-%:% in job name
44
+ // See https://www.w3schools.com/sql/sql_like.asp for syntax
45
+ keyword: JOB_PR_PATTERN
46
+ };
47
+
48
+ if (type === 'pipeline') {
49
+ // Do a search for job name without PR-%:% pattern
50
+ // See https://www.w3schools.com/sql/sql_not.asp for syntax
51
+ config.search.inverse = true;
52
+ }
53
+ }
39
54
  if (jobName) {
40
55
  config.params.name = jobName;
41
56
  }
@@ -59,6 +74,7 @@ module.exports = () => ({
59
74
  }),
60
75
  query: schema.api.pagination.concat(
61
76
  joi.object({
77
+ type: joi.string().valid('', 'pr', 'pipeline').label('Job type filter (pr or pipeline)').optional(),
62
78
  archived: joi.boolean().truthy('true').falsy('false').default(false),
63
79
  jobName: jobNameSchema,
64
80
  search: joi.forbidden(), // we don't support search for Pipeline list jobs