From 5866fa801784dc389c2466a395087fe545fb5231 Mon Sep 17 00:00:00 2001 From: xudafeng Date: Sat, 12 Jan 2019 16:04:33 +0800 Subject: [PATCH] feat: clean up --- app/controller/gw.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/controller/gw.js b/app/controller/gw.js index 5159a59..b5b9c5b 100644 --- a/app/controller/gw.js +++ b/app/controller/gw.js @@ -14,11 +14,10 @@ class GwController extends Controller { async index() { const ctx = this.ctx; const { state = BUILD_STATE_SUCCESS, ...data } = ctx.request.body; - // TODO remove - const jobName = ctx.safeGet(data, 'environment.ci.JOB_NAME') - || ctx.safeGet(data, 'environment.gitlab_ci.JOB_NAME'); - const buildNumber = ctx.safeGet(data, 'environment.ci.BUILD_NUMBER') - || ctx.safeGet(data, 'environment.gitlab_ci.BUILD_NUMBER'); + + const jobName = ctx.safeGet(data, 'environment.ci.JOB_NAME'); + const buildNumber = ctx.safeGet(data, 'environment.ci.BUILD_NUMBER'); + if (!jobName || !buildNumber) { ctx.fail('ERR_RELIABLE_INVALID_PARAM_ERROR', 'environment.ci.JOB_NAME and environment.ci.BUILD_NUMBER are required.'); return;