Skip to content

Commit

Permalink
Merge pull request #174 from screwdriver-cd/annotation
Browse files Browse the repository at this point in the history
fix(580): add annotations to pipeline model during sync
  • Loading branch information
minzcmu authored Jun 16, 2017
2 parents 05ae949 + 43cdf48 commit 174f985
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ class PipelineModel extends BaseModel {
// get list of jobs to create
.then((parsedConfig) => {
this.workflow = parsedConfig.workflow;
this.annotations = parsedConfig.annotations;

return this.update()
.then(() => this.jobs)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"compare-versions": "^3.0.0",
"hoek": "^4.0.1",
"iron": "^4.0.1",
"screwdriver-config-parser": "^3.0.1",
"screwdriver-data-schema": "^16.8.2"
"screwdriver-config-parser": "^3.6.0",
"screwdriver-data-schema": "^16.10.1"
}
}
5 changes: 4 additions & 1 deletion test/data/parser.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,8 @@
"workflow": [
"main",
"publish"
]
],
"annotations": {
"beta.screwdriver.cd/executor" : "screwdriver-executor-vm"
}
}
15 changes: 14 additions & 1 deletion test/lib/pipeline.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ describe('Pipeline Model', () => {
};
});

it('store workflow to pipeline', () => {
it('stores workflow to pipeline', () => {
jobs = [];
jobFactoryMock.list.resolves(jobs);
jobFactoryMock.create.withArgs(publishMock).resolves(publishMock);
Expand All @@ -268,6 +268,19 @@ describe('Pipeline Model', () => {
});
});

it('stores annotations to pipeline', () => {
jobs = [];
jobFactoryMock.list.resolves(jobs);
jobFactoryMock.create.withArgs(publishMock).resolves(publishMock);
jobFactoryMock.create.withArgs(mainMock).resolves(mainMock);

return pipeline.sync().then(() => {
assert.deepEqual(pipeline.annotations, {
'beta.screwdriver.cd/executor': 'screwdriver-executor-vm'
});
});
});

it('creates new jobs', () => {
jobs = [];
jobFactoryMock.list.resolves(jobs);
Expand Down

0 comments on commit 174f985

Please sign in to comment.