From 1159a9ab5ce6e3d31627e6154ac9e0c91942e328 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Thu, 2 Jun 2016 19:35:01 +0200 Subject: [PATCH] update trigger regex --- .gitlab-ci.yml | 10 ++++++++++ dist/index.js | 11 +++++++---- dist/npmci.trigger.js | 15 +++++++++++---- ts/index.ts | 9 ++++++--- ts/npmci.trigger.ts | 12 +++++++++--- 5 files changed, 43 insertions(+), 14 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ae01655..58f7fd4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,7 @@ image: hosttoday/ht-docker-node:latest stages: - test - release +- release2 testLTS: stage: test @@ -38,3 +39,12 @@ release: - tags tags: - docker + +release2: + stage: release2 + script: + - npmci trigger + only: + - tags + tags: + - docker \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index ad35a6b..c967b20 100644 --- a/dist/index.js +++ b/dist/index.js @@ -26,9 +26,6 @@ switch (command) { case "install": npmci_install_1.install(commandOption); break; - case "test": - npmci_test_1.test(commandOption); - break; case "prepare": npmci_prepare_1.prepare(commandOption); break; @@ -36,8 +33,14 @@ switch (command) { npmci_publish_1.publish(commandOption) .then(npmci_trigger_1.trigger); break; + case "test": + npmci_test_1.test(commandOption); + break; + case "trigger": + npmci_trigger_1.trigger(); + break; default: break; } -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQ0EsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ3hCLElBQVksT0FBTyxXQUFNLGlCQUFpQixDQUFDLENBQUE7QUFFM0MsSUFBSSxRQUFRLEdBQUcsT0FBTyxDQUFDLGlCQUFpQixDQUFDLENBQUM7QUFFMUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsaUJBQWlCLEdBQUcsUUF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IFwidHJpZ2dlclwiOlxyXG4gICAgICAgIHRyaWdnZXIoKTtcclxuICAgICAgICBicmVhaztcclxuICAgIGRlZmF1bHQ6XHJcbiAgICAgICAgYnJlYWs7XHJcbn1cclxuXHJcbiJdfQ== diff --git a/dist/npmci.trigger.js b/dist/npmci.trigger.js index fb7474c..0e5cd2b 100644 --- a/dist/npmci.trigger.js +++ b/dist/npmci.trigger.js @@ -6,7 +6,7 @@ var triggerEnvPrefix = "NPMCI_TRIGGER_"; exports.trigger = function () { var done = plugins.q.defer(); plugins.beautylog.info("now running triggers"); - var triggerRegex = /^([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)/; + var triggerRegex = /^([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|?([a-zA-Z0-9\.]*)/; for (var i = 0; i < 100; i++) { var iteratorString = i.toString(); var triggerName = triggerEnvPrefix + iteratorString; @@ -16,8 +16,15 @@ exports.trigger = function () { var regexProjectId = triggerRegexResultArray[2]; var regexProjectTriggerToken = triggerRegexResultArray[3]; var regexRefName = triggerRegexResultArray[4]; - plugins.beautylog.log("triggering build for ref " + regexRefName); - plugins.beautylog.log("Found TRIGGER" + iteratorString); + var regexTriggerName = void 0; + if (triggerRegexResultArray.length = 5) { + regexTriggerName = triggerRegexResultArray[5]; + } + else { + regexTriggerName = "Unnamed Trigger"; + } + plugins.beautylog.log("Found" + triggerName); + plugins.beautylog.log("triggering build for ref " + regexRefName + " of " + regexTriggerName); plugins.request.post("https://gitlab.com/api/v3/projects/" + regexProjectId + "/trigger/builds", { form: { token: regexProjectTriggerToken, ref: regexRefName } }); } } @@ -25,4 +32,4 @@ exports.trigger = function () { return done.promise; }; -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLnRyaWdnZXIudHMiXSw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V4VHJpZ2dlck5hbWUpO1xyXG4gICAgICAgICAgICBwbHVnaW5zLnJlcXVlc3QucG9zdChcImh0dHBzOi8vZ2l0bGFiLmNvbS9hcGkvdjMvcHJvamVjdHMvXCIgKyByZWdleFByb2plY3RJZCArIFwiL3RyaWdnZXIvYnVpbGRzXCIsIHtmb3JtOnt0b2tlbjpyZWdleFByb2plY3RUcmlnZ2VyVG9rZW4scmVmOnJlZ2V4UmVmTmFtZX19KTtcclxuICAgICAgICB9XHJcbiAgICB9XHJcbiAgICBkb25lLnJlc29sdmUoKTtcclxuICAgIHJldHVybiBkb25lLnByb21pc2U7XHJcbn0iXX0= diff --git a/ts/index.ts b/ts/index.ts index 924f30e..8e6a6f1 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -34,9 +34,6 @@ switch (command){ case "install": install(commandOption); break; - case "test": - test(commandOption); - break; case "prepare": prepare(commandOption); break; @@ -44,6 +41,12 @@ switch (command){ publish(commandOption) .then(trigger); break; + case "test": + test(commandOption); + break; + case "trigger": + trigger(); + break; default: break; } diff --git a/ts/npmci.trigger.ts b/ts/npmci.trigger.ts index 38f052e..603ed05 100644 --- a/ts/npmci.trigger.ts +++ b/ts/npmci.trigger.ts @@ -9,7 +9,7 @@ let triggerEnvPrefix = "NPMCI_TRIGGER_"; export let trigger = function(){ let done = plugins.q.defer(); plugins.beautylog.info("now running triggers"); - let triggerRegex = /^([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)/; + let triggerRegex = /^([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|?([a-zA-Z0-9\.]*)/; for(let i = 0; i < 100; i++){ let iteratorString = i.toString(); let triggerName = triggerEnvPrefix + iteratorString @@ -19,8 +19,14 @@ export let trigger = function(){ let regexProjectId = triggerRegexResultArray[2]; let regexProjectTriggerToken = triggerRegexResultArray[3]; let regexRefName = triggerRegexResultArray[4]; - plugins.beautylog.log("triggering build for ref " + regexRefName); - plugins.beautylog.log("Found TRIGGER" + iteratorString); + let regexTriggerName; + if(triggerRegexResultArray.length = 5){ + regexTriggerName = triggerRegexResultArray[5]; + } else { + regexTriggerName = "Unnamed Trigger"; + } + plugins.beautylog.log("Found" + triggerName); + plugins.beautylog.log("triggering build for ref " + regexRefName + " of " + regexTriggerName); plugins.request.post("https://gitlab.com/api/v3/projects/" + regexProjectId + "/trigger/builds", {form:{token:regexProjectTriggerToken,ref:regexRefName}}); } }