diff --git a/.gitignore b/.gitignore index 42f8ebb..f867f13 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ node_modules/ coverage/ -docs/ +pages/ config.json \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 024a8f6..78d3133 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,7 @@ stages: - test - release - trigger +- page before_script: @@ -54,4 +55,16 @@ trigger: only: - tags tags: - - docker \ No newline at end of file + - docker + +pages: + image: hosttoday/ht-docker-node:npmpage + stage: page + script: + - npmci command npmpage --host gitlab + only: + - tags + artifacts: + expire_in: 1 week + paths: + - public diff --git a/.npmignore b/.npmignore index 5fea928..d813d71 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,4 @@ -docs/ +pages/ coverage/ test/ node_modules/ diff --git a/README.md b/README.md index 5c66837..83adf0d 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,20 @@ # NPMCI npmci is your friend when it comes to handling npm packages during CI builds. It is optimized for GitLab CI -## Status +## Availabililty +[![npm](https://push.rocks/assets/repo-button-npm.svg)](https://www.npmjs.com/package/npmci) +[![git](https://push.rocks/assets/repo-button-git.svg)](https://gitlab.com/pushrocks/npmci) +[![git](https://push.rocks/assets/repo-button-mirror.svg)](https://github.com/pushrocks/npmci) +[![docs](https://push.rocks/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/npmci/docs) + +## Status for master [![build status](https://gitlab.com/pushrocks/npmci/badges/master/build.svg)](https://gitlab.com/pushrocks/npmci/commits/master) +[![coverage report](https://gitlab.com/pushrocks/npmci/badges/master/coverage.svg)](https://gitlab.com/pushrocks/npmci/commits/master) +[![Dependency Status](https://david-dm.org/pushrocks/npmci.svg)](https://david-dm.org/pushrocks/npmci) +[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/npmci/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/npmci/master/dependencies/npm) +[![bitHound Code](https://www.bithound.io/github/pushrocks/npmci/badges/code.svg)](https://www.bithound.io/github/pushrocks/npmci) +[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) +[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) ## Usage npmci is designed to work in docker CI environments. The following docker images come with npmci presinstalled: diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 1e790ba..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,10 +0,0 @@ -environment: - nodejs_version: "4" -install: - - ps: Install-Product node $env:nodejs_version - - npm install -test_script: - - node --version - - npm --version - - npm test -build: off \ No newline at end of file diff --git a/dist/npmci.bash.js b/dist/npmci.bash.js index c273c40..0e52441 100644 --- a/dist/npmci.bash.js +++ b/dist/npmci.bash.js @@ -42,11 +42,11 @@ exports.bash = (commandArg, retryArg = 2, bareArg = false) => { } } else { - plugins.beautylog.log("ShellExec would be: " + commandArg.blue); + plugins.beautylog.log("ShellExec would be: " + commandArg); } return stdOut; }; exports.bashBare = (commandArg, retryArg = 2) => { return exports.bash(commandArg, retryArg, true); }; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuYmFzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLmJhc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixNQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBRzNDLElBQUksZUFBZSxHQUFXLEVBQUUsQ0FBQztBQUN0QixvQkFBWSxHQUFZLEtBQUssQ0FBQztBQUN6QyxJQUFJLFFBQVEsR0FBRztJQUNYLEVBQUUsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLHdDQUF3QyxFQUFDLEVBQU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ENBQUMsQ0FBQztZQUNwQixDQUFDO1lBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQyxDQUFDLFFBQVEsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO2dCQUN2QixDQUFDLEdBQUcsUUFBUSxHQUFHLENBQUMsQ0FBQyxDQUFDLHFEQUFxRDtZQUMzRSxDQUFDO1lBQUMsSUFBSSxDQUFDLENBQUM7Z0JBQ0osT0FBTyxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsbUNBQW1DLEdBQUcsUUFBUSxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUM7Z0JBQ2xGLE9BQU8sQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLFFBQVEsR0FBRyxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxRQUFRLEVBQUUsR0FBRyxNQUFNLEdBQUcsUUFBUSxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUM7WUFDekYsQ0FBQztRQUNMLENBQUM7SUFDTCxDQUFDO0lBQUMsSUFBSSxDQUFDLENBQUM7UUFDSixPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyxzQkFBc0IsR0FBRyxVQUFVLENBQUMsQ0FBQTtJQUM5RCxDQUFDO0lBQ0QsTUFBTSxDQUFDLE1BQU0sQ0FBQztBQUNsQixDQUFDLENBQUE7QUFFVSxnQkFBUSxHQUFHLENBQUMsVUFBVSxFQUFFLFFBQVEsR0FBRyxDQUFDO0lBQzNDLE1BQU0sQ0FBQyxZQUFJLENBQUMsVUFBVSxFQUFFLFFBQVEsRUFBRSxJQUFJLENBQUMsQ0FBQztBQUM1QyxDQUFDLENBQUEifQ== \ No newline at end of file diff --git a/dist/npmci.install.js b/dist/npmci.install.js index 1a4b067..5359039 100644 --- a/dist/npmci.install.js +++ b/dist/npmci.install.js @@ -5,7 +5,7 @@ const npmci_bash_1 = require("./npmci.bash"); const npmci_bash_2 = require("./npmci.bash"); exports.install = (versionArg) => { let done = plugins.q.defer(); - plugins.beautylog.log("now installing " + "node ".green + ("version " + versionArg).yellow); + plugins.beautylog.log(`now installing node version ${versionArg}`); let version; if (versionArg == "stable") { version = "6.3.0"; @@ -33,4 +33,4 @@ exports.install = (versionArg) => { done.resolve(); return done.promise; }; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuaW5zdGFsbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLmluc3RhbGwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixNQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBQzNDLDZCQUFxQixjQUFjLENBQUMsQ0FBQTtBQUNwQyw2QkFBNkIsY0FFN0IsQ0FBQyxDQUYwQztBQUVoQyxlQUFPLEdBQUcsQ0FBQyxVQUFVO0lBQzVCLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsT0FBTyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsaUJBQWlCLEdBQUcsT0FBTyxDQUFDLEtBQUssR0FBRyxDQUFDLFVBQVUsR0FBRyxVQUFVLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUM1RixJQUFJLE9BQWUsQ0FBQztJQUNwQixFQUFFLENBQUMsQ0FBQyxVQUFVLElBQUksUUFBUSxDQUFDLENBQUMsQ0FBQztRQUN6QixPQUFPLEdBQUcsT0FBTyxDQUFDO0lBQ3RCLENBQUM7SUFBQyxJQUFJLENBQUMsRUFBRSxDQUFDLENBQUMsVUFBVSxJQUFJLEtBQUssQ0FBQyxDQUFDLENBQUM7UUFDN0IsT0FBTyxHQUFHLE9BQU8sQ0FBQztJQUN0QixDQUFDO0lBQUMsSUFBSSxDQUFDLEVB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MsQ0FBQztJQUNwRixDQUFDO0lBQUEsQ0FBQztJQUNGLGlCQUFJLENBQUMsU0FBUyxDQUFDLENBQUM7SUFDaEIsaUJBQUksQ0FBQyxRQUFRLENBQUMsQ0FBQztJQUNmLElBQUksQ0FBQyxPQUFPLEVBQUUsQ0FBQztJQUNmLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0FBQ3hCLENBQUMsQ0FBQSJ9 \ No newline at end of file diff --git a/dist/npmci.plugins.d.ts b/dist/npmci.plugins.d.ts index b3070b2..dd3899f 100644 --- a/dist/npmci.plugins.d.ts +++ b/dist/npmci.plugins.d.ts @@ -11,6 +11,7 @@ export import shelljs = require("shelljs"); export import smartcli = require("smartcli"); export import smartfile = require("smartfile"); export import smartparam = require("smartparam"); +export import smartsocket = require("smartsocket"); export import smartssh = require("smartssh"); export import smartstring = require("smartstring"); export declare let through2: any; diff --git a/dist/npmci.plugins.js b/dist/npmci.plugins.js index 61b6311..3120a0d 100644 --- a/dist/npmci.plugins.js +++ b/dist/npmci.plugins.js @@ -12,7 +12,8 @@ exports.shelljs = require("shelljs"); exports.smartcli = require("smartcli"); exports.smartfile = require("smartfile"); exports.smartparam = require("smartparam"); +exports.smartsocket = require("smartsocket"); exports.smartssh = require("smartssh"); exports.smartstring = require("smartstring"); exports.through2 = require("through2"); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUNWLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUM7QUFDcEMsWUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQztBQUN2QixvQkFBWSxHQUFHLE9BQU8sQ0FBQ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QztBQUN2QixtQkFBVyxXQUFXLGFBQWEsQ0FBQyxDQUFDO0FBQ3JDLFNBQUMsV0FBVyxHQUFHLENBQUMsQ0FBQztBQUNwQixlQUFPLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0FBQzFCLGVBQU8sV0FBVyxTQUFTLENBQUMsQ0FBQztBQUM3QixnQkFBUSxXQUFXLFVBQVUsQ0FBQyxDQUFDO0FBQy9CLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUM7QUFDakMsa0JBQVUsV0FBVyxZQUFZLENBQUMsQ0FBQztBQUNuQyxtQkFBVyxXQUFXLGFBQWEsQ0FBQyxDQUFDO0FBQ3JDLGdCQUFRLFdBQVcsVUFBVSxDQUFDLENBQUM7QUFDL0IsbUJBQVcsV0FBVyxhQUFhLENBQUMsQ0FBQztBQUN4QyxnQkFBUSxHQUFHLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FBQyJ9 \ No newline at end of file diff --git a/dist/npmci.publish.d.ts b/dist/npmci.publish.d.ts index e85ed35..ace065b 100644 --- a/dist/npmci.publish.d.ts +++ b/dist/npmci.publish.d.ts @@ -1,4 +1,12 @@ /// import "typings-global"; import * as plugins from "./npmci.plugins"; -export declare let publish: (serviceArg?: string) => plugins.q.Promise<{}>; +/** + * type of supported services + */ +export declare type registryService = "npm" | "docker"; +/** + * the main exported publish function. + * @param registryServiceArg the serviceArg + */ +export declare let publish: (registryServiceArg?: registryService) => plugins.q.Promise<{}>; diff --git a/dist/npmci.publish.js b/dist/npmci.publish.js index 3d56af7..5d51386 100644 --- a/dist/npmci.publish.js +++ b/dist/npmci.publish.js @@ -4,14 +4,21 @@ const plugins = require("./npmci.plugins"); const npmci_prepare_1 = require("./npmci.prepare"); const npmci_bash_1 = require("./npmci.bash"); const NpmciBuildDocker = require("./npmci.build.docker"); -exports.publish = (serviceArg = "npm") => { - switch (serviceArg) { +/** + * the main exported publish function. + * @param registryServiceArg the serviceArg + */ +exports.publish = (registryServiceArg = "npm") => { + switch (registryServiceArg) { case "npm": return publishNpm(); case "docker": return publishDocker(); } }; +/** + * tries to publish project at cwd to npm + */ let publishNpm = function () { let done = plugins.q.defer(); npmci_prepare_1.prepare("npm") @@ -22,6 +29,9 @@ let publishNpm = function () { }); return done.promise; }; +/** + * tries to pubish current cwd to Docker registry + */ let publishDocker = function () { let done = plugins.q.defer(); NpmciBuildDocker.readDockerfiles() @@ -30,4 +40,4 @@ let publishDocker = function () { .then(done.resolve); return done.promise; }; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kucHVibGlzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLnB1Ymxpc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUN4QixNQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBQzNDLGdDQUFzQixpQkFBaUIsQ0FBQyxDQUFBO0FBQ3hDLDZCQUFtQixjQUFjLENBQUMsQ0FBQTtBQUVsQyxNQUFZLGdCQUFnQixXQUFNLHNCQUVsQyxDQUFDLENBRnVEO0FBRTdDLGVBQU8sR0FBRyxDQUFDLFVBQVUsR0FBVSxLQUFLO0lBQzNDLE1BQU0sQ0FBQyxDQUFDLFVBQVUsQ0FBQyxDQUFBLENBQUM7UUFDaEIsS0FBSyxLQUFLO1lBQ04sTUFBTSxDQUFDLFVBQVUsRUFBRSxDQUFDO1FBQ3hCLEtBQUssUUFBUTtZQUNULE1BQU0sQ0FBQyxhQUFhLEVBQUUsQ0FBQztJQUMvQixDQUFDO0FBQ0wsQ0FBQyxDQUFDO0FBRUYsSUFBSSxVQUFVLEdBQUk7SUFDZCxJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFDO0lBQzdCLHVCQUFPLEN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QUFJLENBQUMsT0FBTyxDQUFDO0FBQ3hCLENBQUMsQ0FBQyJ9 \ No newline at end of file diff --git a/dist/npmci.servezone.d.ts b/dist/npmci.servezone.d.ts new file mode 100644 index 0000000..b6ef35a --- /dev/null +++ b/dist/npmci.servezone.d.ts @@ -0,0 +1,4 @@ +/** + * the main run function to submit a service to a servezone + */ +export declare let run: (configArg: any) => void; diff --git a/dist/npmci.servezone.js b/dist/npmci.servezone.js new file mode 100644 index 0000000..55afc61 --- /dev/null +++ b/dist/npmci.servezone.js @@ -0,0 +1,28 @@ +"use strict"; +const plugins = require("./npmci.plugins"); +/** + * servezoneRegex is the regex that parses the servezone connection data + * parses strings in the form of "servezone.example.com|3000|somepassword" + */ +let servezoneRegex = /^(.*)\|(.*)\|(.*)/; +/** + * holds the results of the parsed servezone env string + */ +let servezoneRegexResultArray = servezoneRegex.exec(process.env.NPMCI_SERVEZONE); +/** + * the data object that is used for the smartsocket client object + */ +let smartsocketClientConstructorOptions = { + alias: "npmci", + password: servezoneRegexResultArray[3], + port: parseInt(servezoneRegexResultArray[2]), + role: "ci", + url: servezoneRegexResultArray[1] +}; +/** + * the main run function to submit a service to a servezone + */ +exports.run = (configArg) => { + new plugins.smartsocket.SmartsocketClient(smartsocketClientConstructorOptions); +}; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuc2VydmV6b25lLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuc2VydmV6b25lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxNQUFZLE9BQU8sV0FBTSxpQkFBaUIsQ0FBQyxDQUFBO0FBRTNDOzs7R0FHRztBQUNILElBQUksY0FBYyxHQUFHLG1CQUFtQixDQUFDO0FBRXpDOztHQUVHO0FBQ0gsSUFBSSx5QkFBeUIsR0FBRyxjQUFjLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsZUFBZSxDQUFDLENBQUM7QUFFakY7O0dBRUc7QUFDSCxJQUFJLG1DQUFtQyxHQUFHO0lBQ3RDLEtBQUssRUFBRSxPQUFPO0lBQ2QsUUFBUSxFQUFFLHlCQUF5QixDQUFDLENBQUMsQ0FBQztJQUN0QyxJQUFJLEVBQUUsUUFBUSxDQUFDLHlCQUF5QixDQUFDLENBQUMsQ0FBQyxDQUFDO0lBQzVDLElBQUksRUFBRSxJQUFJO0lBQ1YsR0FBRyxFQUFFLHlCQUF5QixDQUFDLENBQUMsQ0FBQztDQUNwQyxDQUFDO0FBRUY7O0dBRUc7QUFDUSxXQUFHLEdBQUcsQ0FBQyxTQUFTO0lBQ3ZCLElBQUksT0FBTyxDQUFDLFdBQVcsQ0FBQyxpQkFBaUIsQ0FDckMsbUNBQW1DLENBQ3RDLENBQUM7QUFDTixDQUFDLENBQUMifQ== \ No newline at end of file diff --git a/dist/npmci.ssh.d.ts b/dist/npmci.ssh.d.ts index 1a3dc86..f47163a 100644 --- a/dist/npmci.ssh.d.ts +++ b/dist/npmci.ssh.d.ts @@ -1,4 +1,7 @@ /// import "typings-global"; import * as plugins from "./npmci.plugins"; +/** + * checks for ENV vars in form of NPMCI_SSHKEY_* and deploys any found ones + */ export declare let ssh: () => plugins.q.Promise<{}>; diff --git a/dist/npmci.ssh.js b/dist/npmci.ssh.js index 72543a7..95edf78 100644 --- a/dist/npmci.ssh.js +++ b/dist/npmci.ssh.js @@ -3,9 +3,12 @@ require("typings-global"); const plugins = require("./npmci.plugins"); let sshRegex = /^(.*)\|(.*)\|(.*)/; let sshInstance; +/** + * checks for ENV vars in form of NPMCI_SSHKEY_* and deploys any found ones + */ exports.ssh = () => { let done = plugins.q.defer(); - sshInstance = new plugins.smartssh.SshInstance(); + sshInstance = new plugins.smartssh.SshInstance(); // init ssh instance plugins.smartparam.forEachMinimatch(process.env, "NPMCI_SSHKEY_*", evaluateSshEnv); if (!process.env.NPMTS_TEST) { sshInstance.writeToDisk(); @@ -17,6 +20,9 @@ exports.ssh = () => { done.resolve(); return done.promise; }; +/** + * gets called for each found SSH ENV Var and deploys it + */ let evaluateSshEnv = (sshkeyEnvVarArg) => { let resultArray = sshRegex.exec(sshkeyEnvVarArg); let sshKey = new plugins.smartssh.SshKey(); @@ -37,7 +43,10 @@ let evaluateSshEnv = (sshkeyEnvVarArg) => { ; sshInstance.addKey(sshKey); }; +/** + * checks if not undefined + */ let notUndefined = (stringArg) => { return (stringArg && stringArg != "undefined" && stringArg != "##"); }; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuc3NoLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuc3NoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDeEIsTUFBWSxPQUFPLFdBQU0saUJBQWlCLENBQUMsQ0FBQTtBQUUzQyxJQUFJLFFBQVEsR0FBRyxtQkFBbUIsQ0FBQTtBQUNsQyxJQUFJLFdBQXdDLENBQUM7QUFFbEMsV0FBRyxHQUFHO0lBQ2IsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUM3QixXQUFXLEdBQUcsSUFBSSxPQUFPLENBQUMsUUFBUSxDQUFDLFdBQVcsRUFBRSxDQUFDO0lBQ2pELE9BQU8sQ0FBQyxVQUFVLENBQUMsZ0JBQWdCLENBQUMsT0FBTyxDQUFDLEdBQUcsRUFBQyxnQkFBZ0IsRUFBQyxjQUFjLENBQUMsQ0FBQztJQUNqRixFQUFFLENBQUEsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsVUFBVSxDQUFDLENBQUEsQ0FBQztRQUN4QixXQUFXLENBQUMsV0FBVyxFQUFFLENBQUE7SUFDN0IsQ0FBQztJQUFDLElBQUksQ0FBQyx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sQ0FBQyxDQUFDLENBQUMsQ0FBQSxDQUFDO1FBQzdCLE9BQU8sQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLHVCQUF1QixDQUFDLENBQUE7UUFDOUMsTUFBTSxDQUFDLGFBQWEsR0FBRyxXQUFXLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFDMUMsQ0FBQztJQUFBLENBQUM7SUFDRixFQUFFLENBQUEsQ0FBQyxZQUFZLENBQUMsV0FBVyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQSxDQUFDO1FBQzdCLHNCQUFzQixDQUFBO1FBQ3RCLE1BQU0sQ0FBQyxZQUFZLEdBQUcsV0FBVyxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBQ3pDLENBQUM7SUFBQSxDQUFDO0lBRUYsV0FBVyxDQUFDLE1BQU0sQ0FBQyxNQUFNLENBQUMsQ0FBQztBQUMvQixDQUFDLENBQUM7QUFFRjs7R0FFRztBQUNILElBQUksWUFBWSxHQUFHLENBQUMsU0FBZ0I7SUFDaEMsTUFBTSxDQUFDLENBQUMsU0FBUyxJQUFJLFNBQVMsSUFBSSxXQUFXLElBQUksU0FBUyxJQUFJLElBQUksQ0FBQyxDQUFDO0FBQ3hFLENBQUMsQ0FBQSJ9 \ No newline at end of file diff --git a/docs/book.json b/docs/book.json new file mode 100644 index 0000000..2bd173f --- /dev/null +++ b/docs/book.json @@ -0,0 +1,15 @@ +{ + "structure": { + "readme": "index.md" + }, + "plugins": [ + "tonic", + "edit-link" + ], + "pluginsConfig": { + "edit-link": { + "base": "https://gitlab.com/pushrocks/npmts/edit/master/docs/", + "label": "Edit on GitLab" + } + } +} \ No newline at end of file diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..83adf0d --- /dev/null +++ b/docs/index.md @@ -0,0 +1,65 @@ +# NPMCI +npmci is your friend when it comes to handling npm packages during CI builds. It is optimized for GitLab CI + +## Availabililty +[![npm](https://push.rocks/assets/repo-button-npm.svg)](https://www.npmjs.com/package/npmci) +[![git](https://push.rocks/assets/repo-button-git.svg)](https://gitlab.com/pushrocks/npmci) +[![git](https://push.rocks/assets/repo-button-mirror.svg)](https://github.com/pushrocks/npmci) +[![docs](https://push.rocks/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/npmci/docs) + +## Status for master +[![build status](https://gitlab.com/pushrocks/npmci/badges/master/build.svg)](https://gitlab.com/pushrocks/npmci/commits/master) +[![coverage report](https://gitlab.com/pushrocks/npmci/badges/master/coverage.svg)](https://gitlab.com/pushrocks/npmci/commits/master) +[![Dependency Status](https://david-dm.org/pushrocks/npmci.svg)](https://david-dm.org/pushrocks/npmci) +[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/npmci/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/npmci/master/dependencies/npm) +[![bitHound Code](https://www.bithound.io/github/pushrocks/npmci/badges/code.svg)](https://www.bithound.io/github/pushrocks/npmci) +[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) +[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) + +## Usage +npmci is designed to work in docker CI environments. The following docker images come with npmci presinstalled: + +Docker Hub: + +* [hosttoday/ht-docker-node:npmci](https://hub.docker.com/r/hosttoday/ht-docker-node/) +has LTS node version and npmci preinstalled. +* [hosttoday/ht-docker-dbase](https://hub.docker.com/r/hosttoday/ht-docker-dbase/) +based on docker:git, can be used to build docker images in conjunction with docker:dind + +npmci can be called from commandline: +```shell +# Install any node version: +npmci install lts # will install latest LTS node version and update PATH for node and npm versions +npmci install stable # will install latest stable node version and update PATH for node and npm +npmci install legacy # will install latest legacy node version and update PATH for node and npm +npmci install x.x.x # will install any specific node version. + +# Install any node version, install dependencies and run test in cwd: +npmci test lts # will install latest lts node version and run "npm install" and "npm test". +npmci test stable # will install latest stable node version and run "npm install" and "npm test". +npmci test legacy # will install latest legacy node version and run "npm install" and "npm test". +npmci test x.x.x # will install any specific node version and run "npm install" and "npm test". +npmci test docker # will test any build image with tests defined in ./npmci/dockertest_1.sh to ./npmci/dockertest_100.sh +## npmci test docker will look at all Dockerfiles and look for according tags on GitLab container registry + + +# prepare tools +npmci prepare npm # will look for $NPMCI_TOKEN_NPM env var and create .npmrc, so npm is authenticated +npmci prepare docker # will look for $NPMCI_LOGIN_DOCKER in form username|password and authenticate docker +npmci prepare docker-gitlab # will authenticate docker for gitlab container registry + +# build containers +npmci build docker # will build containers +## all Dockerfiles named DOckerfile* are picked up. +## specify tags lake this Dockerfile_[tag] +## uploads all built images as [username]/[reponame]:[tag]_test to GitLab +## then test in next step with "npmci test docker" + +# publish npm module +npmci publish npm # will look vor $NPMCI_TOKEN_NPM env var and push any module in cwd to npm +npmci publish docker + +# trigger webhooks +npmci trigger # will look for NPMCI_TRIGGER_1 to NPMCI_TRIGGER_100 in form domain|id|token|ref|name +``` + diff --git a/package.json b/package.json index ca355f5..7cb7e19 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "smartcli": "^1.0.4", "smartfile": "^4.0.12", "smartparam": "^0.1.1", + "smartsocket": "^1.1.4", "smartssh": "^1.1.5", "smartstring": "^2.0.15", "through2": "^2.0.1", diff --git a/ts/npmci.bash.ts b/ts/npmci.bash.ts index 354996b..a19f8d2 100644 --- a/ts/npmci.bash.ts +++ b/ts/npmci.bash.ts @@ -40,7 +40,7 @@ export let bash = (commandArg: string, retryArg = 2, bareArg = false) => { } } } else { - plugins.beautylog.log("ShellExec would be: " + commandArg.blue) + plugins.beautylog.log("ShellExec would be: " + commandArg) } return stdOut; } diff --git a/ts/npmci.install.ts b/ts/npmci.install.ts index 218cf48..fe4fc0a 100644 --- a/ts/npmci.install.ts +++ b/ts/npmci.install.ts @@ -5,7 +5,7 @@ import { nvmAvailable } from "./npmci.bash" export let install = (versionArg) => { let done = plugins.q.defer(); - plugins.beautylog.log("now installing " + "node ".green + ("version " + versionArg).yellow); + plugins.beautylog.log(`now installing node version ${versionArg}`); let version: string; if (versionArg == "stable") { version = "6.3.0"; diff --git a/ts/npmci.plugins.ts b/ts/npmci.plugins.ts index 2411429..f32d00d 100644 --- a/ts/npmci.plugins.ts +++ b/ts/npmci.plugins.ts @@ -11,6 +11,7 @@ export import shelljs = require("shelljs"); export import smartcli = require("smartcli"); export import smartfile = require("smartfile"); export import smartparam = require("smartparam"); +export import smartsocket = require("smartsocket"); export import smartssh = require("smartssh"); export import smartstring = require("smartstring"); export let through2 = require("through2"); \ No newline at end of file diff --git a/ts/npmci.publish.ts b/ts/npmci.publish.ts index 815107a..819816f 100644 --- a/ts/npmci.publish.ts +++ b/ts/npmci.publish.ts @@ -5,8 +5,17 @@ import {bash} from "./npmci.bash"; import * as NpmciEnv from "./npmci.env"; import * as NpmciBuildDocker from "./npmci.build.docker" -export let publish = (serviceArg:string = "npm") => { - switch (serviceArg){ +/** + * type of supported services + */ +export type registryService = "npm" | "docker"; + +/** + * the main exported publish function. + * @param registryServiceArg the serviceArg + */ +export let publish = (registryServiceArg:registryService = "npm") => { + switch (registryServiceArg){ case "npm": return publishNpm(); case "docker": @@ -14,6 +23,9 @@ export let publish = (serviceArg:string = "npm") => { } }; +/** + * tries to publish project at cwd to npm + */ let publishNpm = function(){ let done = plugins.q.defer(); prepare("npm") @@ -25,6 +37,9 @@ let publishNpm = function(){ return done.promise; } +/** + * tries to pubish current cwd to Docker registry + */ let publishDocker = function(){ let done = plugins.q.defer(); NpmciBuildDocker.readDockerfiles() diff --git a/ts/npmci.servezone.ts b/ts/npmci.servezone.ts new file mode 100644 index 0000000..d681a81 --- /dev/null +++ b/ts/npmci.servezone.ts @@ -0,0 +1,32 @@ +import * as plugins from "./npmci.plugins"; + +/** + * servezoneRegex is the regex that parses the servezone connection data + * parses strings in the form of "servezone.example.com|3000|somepassword" + */ +let servezoneRegex = /^(.*)\|(.*)\|(.*)/; + +/** + * holds the results of the parsed servezone env string + */ +let servezoneRegexResultArray = servezoneRegex.exec(process.env.NPMCI_SERVEZONE); + +/** + * the data object that is used for the smartsocket client object + */ +let smartsocketClientConstructorOptions = { + alias: "npmci", + password: servezoneRegexResultArray[3], + port: parseInt(servezoneRegexResultArray[2]), + role: "ci", + url: servezoneRegexResultArray[1] +}; + +/** + * the main run function to submit a service to a servezone + */ +export let run = (configArg) => { + new plugins.smartsocket.SmartsocketClient( + smartsocketClientConstructorOptions + ); +}; \ No newline at end of file diff --git a/ts/npmci.ssh.ts b/ts/npmci.ssh.ts index b8edcbe..ad9f210 100644 --- a/ts/npmci.ssh.ts +++ b/ts/npmci.ssh.ts @@ -4,12 +4,15 @@ import * as plugins from "./npmci.plugins"; let sshRegex = /^(.*)\|(.*)\|(.*)/ let sshInstance:plugins.smartssh.SshInstance; +/** + * checks for ENV vars in form of NPMCI_SSHKEY_* and deploys any found ones + */ export let ssh = () => { let done = plugins.q.defer(); - sshInstance = new plugins.smartssh.SshInstance(); + sshInstance = new plugins.smartssh.SshInstance(); // init ssh instance plugins.smartparam.forEachMinimatch(process.env,"NPMCI_SSHKEY_*",evaluateSshEnv); if(!process.env.NPMTS_TEST){ - sshInstance.writeToDisk() + sshInstance.writeToDisk(); } else { plugins.beautylog.log("In test mode, so not storing SSH keys to disk!"); }; @@ -17,6 +20,9 @@ export let ssh = () => { return done.promise; }; +/** + * gets called for each found SSH ENV Var and deploys it + */ let evaluateSshEnv = (sshkeyEnvVarArg) => { let resultArray = sshRegex.exec(sshkeyEnvVarArg); let sshKey = new plugins.smartssh.SshKey(); @@ -37,6 +43,9 @@ let evaluateSshEnv = (sshkeyEnvVarArg) => { sshInstance.addKey(sshKey); }; +/** + * checks if not undefined + */ let notUndefined = (stringArg:string) => { return (stringArg && stringArg != "undefined" && stringArg != "##"); } \ No newline at end of file