From b8ed4905d2891c0fdf51d3b47200f92dc92f3f26 Mon Sep 17 00:00:00 2001 From: Brian Wang Date: Fri, 4 May 2018 13:48:43 -0700 Subject: [PATCH 1/8] decorate pr --- index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/index.js b/index.js index 2705d19..8b2a8de 100644 --- a/index.js +++ b/index.js @@ -224,6 +224,25 @@ class ScmBase { return Promise.reject(new Error('Not implemented')); } + /** + * Decorate the author for the specific source control + * @method decorateAuthor + * @param {Object} config + * @param {String} config.username Author to decorate + * @param {String} config.token The token used to authenticate to the SCM + * @param {String} [config.scmContext] The scm context name + * @return {Promise} + */ + decoratePR(config) { + return validate(config, dataSchema.plugins.scm.decoratePR) + .then(validPR => this._decoratePR(validPR)) + .then(decoratePR => validate(decoratePR, dataSchema.core.scm.pr)); + } + + _decoratePR() { + return Promise.reject(new Error('Not implemented')); + } + /** * Get a users permissions on a repository * @method getPermissions From 1dca771cf3f36cd1473bc57a3027392730e7ff8c Mon Sep 17 00:00:00 2001 From: Brian Wang Date: Fri, 4 May 2018 14:18:42 -0700 Subject: [PATCH 2/8] remove space --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 8b2a8de..ab5dc93 100644 --- a/index.js +++ b/index.js @@ -224,7 +224,7 @@ class ScmBase { return Promise.reject(new Error('Not implemented')); } - /** + /** * Decorate the author for the specific source control * @method decorateAuthor * @param {Object} config From f1c60faf9c1278ea0ca9c6e3f672c98e8091a329 Mon Sep 17 00:00:00 2001 From: Brian Wang Date: Fri, 4 May 2018 16:28:22 -0700 Subject: [PATCH 3/8] change comments --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index ab5dc93..ff261dc 100644 --- a/index.js +++ b/index.js @@ -226,7 +226,7 @@ class ScmBase { /** * Decorate the author for the specific source control - * @method decorateAuthor + * @method decoratePR * @param {Object} config * @param {String} config.username Author to decorate * @param {String} config.token The token used to authenticate to the SCM From 5aa2ae4ba19064978765c2a38354f0e72e5fca68 Mon Sep 17 00:00:00 2001 From: Brian Wang Date: Mon, 7 May 2018 11:56:30 -0700 Subject: [PATCH 4/8] update get PRinfo --- index.js | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/index.js b/index.js index ff261dc..8b1e741 100644 --- a/index.js +++ b/index.js @@ -224,25 +224,6 @@ class ScmBase { return Promise.reject(new Error('Not implemented')); } - /** - * Decorate the author for the specific source control - * @method decoratePR - * @param {Object} config - * @param {String} config.username Author to decorate - * @param {String} config.token The token used to authenticate to the SCM - * @param {String} [config.scmContext] The scm context name - * @return {Promise} - */ - decoratePR(config) { - return validate(config, dataSchema.plugins.scm.decoratePR) - .then(validPR => this._decoratePR(validPR)) - .then(decoratePR => validate(decoratePR, dataSchema.core.scm.pr)); - } - - _decoratePR() { - return Promise.reject(new Error('Not implemented')); - } - /** * Get a users permissions on a repository * @method getPermissions @@ -377,7 +358,8 @@ class ScmBase { .then(pr => validate(pr, Joi.object().keys({ name: Joi.reach(dataSchema.models.job.base, 'name').required(), sha: Joi.reach(dataSchema.models.build.base, 'sha').required(), - ref: Joi.string().required() + ref: Joi.string().required(), + url: Joi.string().url() }))); } From 092a10c063ffe482a612666b6d7211e97959e6e8 Mon Sep 17 00:00:00 2001 From: Brian Wang Date: Mon, 7 May 2018 16:18:36 -0700 Subject: [PATCH 5/8] fix: fix tests for getprinfo --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 8b1e741..6acad64 100644 --- a/index.js +++ b/index.js @@ -359,7 +359,7 @@ class ScmBase { name: Joi.reach(dataSchema.models.job.base, 'name').required(), sha: Joi.reach(dataSchema.models.build.base, 'sha').required(), ref: Joi.string().required(), - url: Joi.string().url() + url: Joi.string().uri() }))); } From 44f9ef0e7cd8605c7e383b24ee6a83d780563d08 Mon Sep 17 00:00:00 2001 From: Brian Wang Date: Mon, 7 May 2018 16:46:46 -0700 Subject: [PATCH 6/8] use data schema --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 6acad64..b6c5fc1 100644 --- a/index.js +++ b/index.js @@ -359,7 +359,7 @@ class ScmBase { name: Joi.reach(dataSchema.models.job.base, 'name').required(), sha: Joi.reach(dataSchema.models.build.base, 'sha').required(), ref: Joi.string().required(), - url: Joi.string().uri() + url: Joi.reach(dataSchema.core.scm.pr, 'url') }))); } From e69d74c6be3217ed31a49d70ef102eb0d73825a9 Mon Sep 17 00:00:00 2001 From: Brian Wang Date: Mon, 7 May 2018 17:03:06 -0700 Subject: [PATCH 7/8] fix: edit readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index adbb6f1..a43a7e3 100644 --- a/README.md +++ b/README.md @@ -347,10 +347,10 @@ The parameters required are: | config.scmContext | String | No | The name of scm context | #### Expected Outcome -The object consists of PR name, sha and ref for the pipeline. +The object consists of PR name, sha, ref, and url for the pipeline. #### Expected Promise Response -1. Resolve with the object consists of PR name, sha and ref +1. Resolve with the object consists of PR name, sha, and ref 2. Reject if the input or output is not valid ### getScmContexts From d52945eab06ba7780a7ffc41a5e3f08f7c543e22 Mon Sep 17 00:00:00 2001 From: Brian Wang Date: Mon, 7 May 2018 17:35:35 -0700 Subject: [PATCH 8/8] read me --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a43a7e3..6dfb8c3 100644 --- a/README.md +++ b/README.md @@ -350,7 +350,7 @@ The parameters required are: The object consists of PR name, sha, ref, and url for the pipeline. #### Expected Promise Response -1. Resolve with the object consists of PR name, sha, and ref +1. Resolve with the object consists of PR name, sha, ref, and url 2. Reject if the input or output is not valid ### getScmContexts