Skip to content

Commit

Permalink
fix: require [email protected] (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
wahapo authored Nov 10, 2020
1 parent 59f1830 commit af2535a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
26 changes: 5 additions & 21 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
const Joi = require('joi');
const slacker = require('./slack');
const NotificationBase = require('screwdriver-notifications-base');
const schema = require('screwdriver-data-schema');
const hoek = require('@hapi/hoek');

// This should match what is in https://github.com/screwdriver-cd/data-schema/blob/master/models/build.js#L98
// This should match what is in https://github.com/screwdriver-cd/data-schema/blob/master/models/build.js#L14
// https://github.com/screwdriver-cd/ui/blob/master/app/styles/screwdriver-colors.scss
const COLOR_MAP = {
ABORTED: 'danger',
Expand Down Expand Up @@ -34,9 +35,8 @@ const STATUSES_MAP = {
FROZEN: ':snowman:'
};
const DEFAULT_STATUSES = ['FAILURE'];
const SCHEMA_STATUS = Joi.string().valid(...Object.keys(COLOR_MAP));
const SCHEMA_STATUSES = Joi.array()
.items(SCHEMA_STATUS)
.items(schema.plugins.notifications.schemaStatus)
.min(0);
const SCHEMA_SLACK_CHANNEL = Joi.string().required();
const SCHEMA_SLACK_CHANNELS = Joi.array()
Expand All @@ -52,26 +52,10 @@ const SCHEMA_SLACK_SETTINGS = Joi.object().keys({
SCHEMA_SLACK_CHANNELS, SCHEMA_SLACK_CHANNEL
).required()
}).unknown(true);
const SCHEMA_SCM_REPO = Joi.object()
.keys({
name: Joi.string().required()
}).unknown(true);
const SCHEMA_PIPELINE_DATA = Joi.object()
.keys({
scmRepo: SCHEMA_SCM_REPO.required()
}).unknown(true);
const SCHEMA_BUILD_DATA = Joi.object()
.keys({
settings: SCHEMA_SLACK_SETTINGS.required(),
status: SCHEMA_STATUS.required(),
pipeline: SCHEMA_PIPELINE_DATA.required(),
jobName: Joi.string(),
build: Joi.object().keys({
id: Joi.number().integer().required()
}).unknown(true),
event: Joi.object(),
buildLink: Joi.string(),
isFixed: Joi.boolean()
...schema.plugins.notifications.schemaBuildData,
settings: SCHEMA_SLACK_SETTINGS.required()
});
const SCHEMA_SLACK_CONFIG = Joi.object()
.keys({
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"mockery": "^2.1.0",
"request": "^2.87.0",
"samsam": "^1.3.0",
"screwdriver-data-schema": "^20.6.0",
"screwdriver-notifications-base": "^3.0.0"
},
"release": {
Expand Down

0 comments on commit af2535a

Please sign in to comment.