Skip to content

Commit

Permalink
feat(collections): Revert "fix: Revert "feat(collections): Add lastBu…
Browse files Browse the repository at this point in the history
…ilds to pipeline" (#175)" (#176)

BREAKING CHANGE: This reverts commit 2595480.
  • Loading branch information
joelseq authored and r3rastogi committed Aug 22, 2017
1 parent 2595480 commit a061a52
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
7 changes: 6 additions & 1 deletion models/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
const Joi = require('joi');
const mutate = require('../lib/mutate');

const BUILD_MODEL = require('./build').get;
const PIPELINE_MODEL = require('./pipeline').get;
const PIPELINES_MODEL = Joi.array().items(PIPELINE_MODEL);
const PIPELINE_OBJECT = PIPELINE_MODEL.keys({
lastBuilds: Joi.array().items(BUILD_MODEL).optional()
});
const PIPELINES_MODEL = Joi.array().items(PIPELINE_OBJECT);
const MODEL = {
id: Joi
.number()
Expand Down Expand Up @@ -53,6 +57,7 @@ module.exports = {
get: Joi.object(mutate(GET_MODEL, [
'id',
'name',
'pipelineIds',
'pipelines'
], [
'description'
Expand Down
8 changes: 6 additions & 2 deletions models/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ const MODEL = {
.description('Current workflow of the pipeline'),

annotations: Annotations.annotations
.description('Pipeline-level annotations')
.description('Pipeline-level annotations'),

lastEventId: Joi.number().integer().positive()
.description('Identifier of last event')
.example(123345)
};

module.exports = {
Expand All @@ -69,7 +73,7 @@ module.exports = {
get: Joi.object(mutate(MODEL, [
'id', 'scmUri', 'scmContext', 'createTime', 'admins'
], [
'workflow', 'scmRepo', 'annotations'
'workflow', 'scmRepo', 'annotations', 'lastEventId'
])).label('Get Pipeline'),

/**
Expand Down
16 changes: 16 additions & 0 deletions test/data/collection.get.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
id: 123
name: 'Screwdriver'
description: 'Collection of screwdriver related pipelines'
pipelineIds: [12742, 12576]
pipelines:
- id: 12742
scmUri: github.com:12345678:master
Expand All @@ -22,6 +23,21 @@ pipelines:
- OSX-SIERRA
screwdriver.cd/notify.email: foo@example.com
beta.screwdriver.cd/auto_pr_builds: fork-only
lastBuilds:
- id: 123345
eventId: 12351523
jobId: 123415
number: 1473900790309
cause: Commit ccc493 was pushed to master
status: SUCCESS
createTime: "2017-08-21"
- id: 123346
eventId: 12351523
jobId: 123416
number: 1473900790309
cause: Commit ccc493 was pushed to master
status: SUCCESS
createTime: "2017-08-21"
- id: 12576
scmUri: github.com:87654321:master
scmContext: github:github.com
Expand Down
1 change: 1 addition & 0 deletions test/data/pipeline.get.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ annotations:
- OSX-SIERRA
screwdriver.cd/notify.email: foo@example.com
beta.screwdriver.cd/auto_pr_builds: fork-only
lastEventId: 31135214

0 comments on commit a061a52

Please sign in to comment.