Skip to content

Commit

Permalink
#17 Support the build step's metadata annotations:
Browse files Browse the repository at this point in the history
* Add the ability to specify "dangling" metadata annotations
* Change the tevale eval field to "evaluation"
  • Loading branch information
noamt committed Dec 14, 2016
1 parent 5c247b8 commit d5b70ac
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
28 changes: 14 additions & 14 deletions schema/1.0/steps/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@ class Build extends BaseSchema {

getSchema() {
let buildProperties = {
type: Joi.string().valid(Build.getType()),
type: Joi.string().valid(Build.getType()),
working_directory: Joi.string(),
dockerfile: Joi.alternatives()
.try(Joi.string(), Joi.object({ content: Joi.string() })),
dockerfile: Joi.alternatives()
.try(Joi.string(), Joi.object({ content: Joi.string() })),
image_name: Joi.string().required(),
build_arguments: Joi.array().items(Joi.string()),
tag: Joi.string(),
metadata: Joi.object({
tag: Joi.string(),
metadata: Joi.object({
set: Joi.array().items(
Joi.object().pattern(/^[A-Za-z09_]+$/, Joi.alternatives().try(
[
Joi.string(),
Joi.boolean(),
Joi.number(),
Joi.object({ eval: Joi.string().required() })
]
)).required()
)
Joi.alternatives().try(
Joi.object().pattern(/^[A-Za-z09_]+$/, Joi.alternatives().try(
[
Joi.string(),
Joi.boolean(),
Joi.number(),
Joi.object({ evaluate: Joi.string().required() })
]
)), Joi.string()))
})

};
Expand Down
19 changes: 10 additions & 9 deletions tests/unit/validator.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ describe('Validate Codefresh YAML', () => {
}
}
}
}, '"eval" is required', done);
}, '"evaluate" is required', done);
});
});

Expand Down Expand Up @@ -591,14 +591,14 @@ describe('Validate Codefresh YAML', () => {
version: '1.0',
steps: {
jim: {
'type': 'push',
'provider': 'ecr',
'candidate': 'wowwww',
'registry': 'reg',
'tag': 'tg',
'accessKeyId': 'kid',
'type': 'push',
'provider': 'ecr',
'candidate': 'wowwww',
'registry': 'reg',
'tag': 'tg',
'accessKeyId': 'kid',
'secretAccessKey': 'sac',
'region': 'rg'
'region': 'rg'
}
}
});
Expand Down Expand Up @@ -839,7 +839,8 @@ describe('Validate Codefresh YAML', () => {
{ 'qa': 'pending' },
{ 'healthy': true },
{ 'quality': 67 },
{ 'is_tested': { eval: '${{unit_test_step.status}} === success' } }
{ 'is_tested': { evaluate: '${{unit_test_step.status}} === success' } },
'dangling'
]
}
},
Expand Down

0 comments on commit d5b70ac

Please sign in to comment.