From 435613f6dcdec3978e46cc69fd28d6cfa5e9d0c8 Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Sun, 19 Feb 2017 14:51:43 -0600 Subject: [PATCH] WIP: continued server work. Schema for config files. --- api.rst | 1 + src/main/json/project.config.schema.json | 41 +++++++++++++++++ src/main/json/service.config.schema.json | 50 +++++++++++++++++++++ strawboss.nim => src/main/nim/strawboss.nim | 0 strawboss.config.json | 2 + 5 files changed, 94 insertions(+) create mode 100644 src/main/json/project.config.schema.json create mode 100644 src/main/json/service.config.schema.json rename strawboss.nim => src/main/nim/strawboss.nim (100%) diff --git a/api.rst b/api.rst index 4dd82a4..06a1488 100644 --- a/api.rst +++ b/api.rst @@ -6,3 +6,4 @@ GET /api/project/ -- return detailed project rec GET /api/project// -- return detailed step information (include runs) POST /api/project///run/ -- kick off a run GET /api/project///run/ -- return detailed run information + diff --git a/src/main/json/project.config.schema.json b/src/main/json/project.config.schema.json new file mode 100644 index 0000000..ca54222 --- /dev/null +++ b/src/main/json/project.config.schema.json @@ -0,0 +1,41 @@ +{ + "title": "Strawboss project configuration schema", + "type": "object", + "properties": { + "name": "string", + "versionCmd": "string", + "steps": { + "title": "StepsCollection", + "type": "object", + "minProperties": 1, + "properties": { + "patternProperties": { + "^[\w-]+$": { + "type": "object", + "title": "StepDefinition", + "properties": { + "workingDir": "string", + "stepCmd": "string", + "artifacts": { + "type": "array", + "items": "string" }, + "cmdInput": { + "type": "array", + "items": "string" }, + "depends": { + "type": "array", + "items": "string" }, + "expectedEnv": { + "type": "array", + "items": "string" }, + "dontCache": "bool", + "additionalProperties": false + } + } + } + } + }, + "required": ["name", "steps"], + "additionalProperties": false + } +} diff --git a/src/main/json/service.config.schema.json b/src/main/json/service.config.schema.json new file mode 100644 index 0000000..0e75c43 --- /dev/null +++ b/src/main/json/service.config.schema.json @@ -0,0 +1,50 @@ +{ + "title": "StrawBoss service configuration schema.", + "type": "object", + "properties": { + "artifactsRepo": "string", + "projects": { + "title": "ProjectsList", + "type": "array", + "items": { + "title": "ProjectDefinition", + "type": "object", + "properties": { + "name": "string", + "repo": "string", + "defaultBranch": "string", + "cfgFilePath": "string", + "envVars": { + "type": "object", + "patternProperties": { + "^[\w-]+$": "string" + } + }, + "required": ["name", "repo"], + "additionalProperties": false + } + } + }, + "users": { + "title": "UsersList", + "type": "array", + "items": { + "title": "UserDefinition", + "type": "object", + "properties": { + "username": "string", + "hashedPwd": "string" + }, + "required": ["username", "hashedPwd"], + "additionalProperties": false + } + }, + "tokens": { + "title": "TokensList", + "type": "array", + "items": "string" + }, + "required": ["artifactsRepo", "projects", "users", "tokens"], + "additionalProperties": false + } +} diff --git a/strawboss.nim b/src/main/nim/strawboss.nim similarity index 100% rename from strawboss.nim rename to src/main/nim/strawboss.nim diff --git a/strawboss.config.json b/strawboss.config.json index c20fbdd..563b967 100644 --- a/strawboss.config.json +++ b/strawboss.config.json @@ -1,5 +1,7 @@ { "artifactsRepo": "artifacts", + "users": [], + "tokens": [], "projects": [ { "name": "new-life-intro-band", "repo": "/home/jdb/projects/new-life-introductory-band" } ]