From 6e816f35f6c09c207bc60d70dacb287f6a01de2a Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sun, 27 Aug 2017 15:24:17 +0200 Subject: [PATCH] update to new cli scheme --- dist/mod_build/index.d.ts | 8 - dist/mod_build/index.js | 28 -- dist/mod_build/mod.plugins.js | 7 - dist/mod_cloudflare/index.d.ts | 6 + dist/mod_cloudflare/index.js | 37 +- dist/mod_docker/index.d.ts | 112 +++++- dist/mod_docker/index.js | 361 +++++++++++++++++- dist/mod_docker/mod.builddocker.d.ts | 98 ----- dist/mod_docker/mod.builddocker.js | 288 -------------- dist/mod_install/index.js | 68 ---- dist/mod_install/mod.plugins.d.ts | 1 - dist/mod_install/mod.plugins.js | 7 - dist/{mod_install => mod_node}/index.d.ts | 5 + dist/mod_node/index.js | 85 +++++ dist/mod_npm/index.d.ts | 6 + dist/mod_npm/index.js | 68 ++++ dist/{mod_build => mod_npm}/mod.plugins.d.ts | 0 dist/{mod_test => mod_npm}/mod.plugins.js | 2 +- dist/mod_prepare/index.d.ts | 9 - dist/mod_prepare/index.js | 98 ----- dist/mod_prepare/mod.plugins.d.ts | 1 - dist/mod_prepare/mod.plugins.js | 7 - dist/mod_publish/index.d.ts | 10 - dist/mod_publish/index.js | 51 --- dist/mod_publish/mod.plugins.d.ts | 1 - dist/mod_publish/mod.plugins.js | 7 - dist/mod_purge/index.d.ts | 1 - dist/mod_purge/index.js | 20 - dist/mod_purge/mod.plugins.d.ts | 3 - dist/mod_purge/mod.plugins.js | 9 - dist/mod_servezone/index.d.ts | 4 - dist/mod_servezone/index.js | 37 -- dist/mod_ssh/index.d.ts | 3 +- dist/mod_ssh/index.js | 33 +- dist/mod_test/index.d.ts | 5 - dist/mod_test/index.js | 49 --- dist/mod_test/mod.plugins.d.ts | 1 - dist/npmci.cli.js | 67 ++-- dist/npmci.mods.d.ts | 18 +- dist/npmci.mods.js | 11 +- test/test.ts | 121 +++--- ts/mod_build/index.ts | 25 -- ts/mod_cloudflare/index.ts | 27 ++ ts/mod_cloudflare/mod.plugins.ts | 2 +- ts/mod_docker/index.ts | 377 ++++++++++++++++++- ts/mod_docker/mod.builddocker.ts | 299 --------------- ts/mod_install/mod.plugins.ts | 1 - ts/{mod_install => mod_node}/index.ts | 33 +- ts/mod_npm/index.ts | 64 ++++ ts/{mod_build => mod_npm}/mod.plugins.ts | 0 ts/mod_prepare/index.ts | 99 ----- ts/mod_prepare/mod.plugins.ts | 1 - ts/mod_publish/index.ts | 54 --- ts/mod_publish/mod.plugins.ts | 1 - ts/mod_purge/index.ts | 11 - ts/mod_purge/mod.plugins.ts | 7 - ts/mod_servezone/index.ts | 32 -- ts/mod_ssh/index.ts | 35 +- ts/mod_test/index.ts | 45 --- ts/mod_test/mod.plugins.ts | 1 - ts/npmci.cli.ts | 83 ++-- ts/npmci.mods.ts | 18 +- 62 files changed, 1372 insertions(+), 1596 deletions(-) delete mode 100644 dist/mod_build/index.d.ts delete mode 100644 dist/mod_build/index.js delete mode 100644 dist/mod_build/mod.plugins.js delete mode 100644 dist/mod_docker/mod.builddocker.d.ts delete mode 100644 dist/mod_docker/mod.builddocker.js delete mode 100644 dist/mod_install/index.js delete mode 100644 dist/mod_install/mod.plugins.d.ts delete mode 100644 dist/mod_install/mod.plugins.js rename dist/{mod_install => mod_node}/index.d.ts (54%) create mode 100644 dist/mod_node/index.js create mode 100644 dist/mod_npm/index.d.ts create mode 100644 dist/mod_npm/index.js rename dist/{mod_build => mod_npm}/mod.plugins.d.ts (100%) rename dist/{mod_test => mod_npm}/mod.plugins.js (75%) delete mode 100644 dist/mod_prepare/index.d.ts delete mode 100644 dist/mod_prepare/index.js delete mode 100644 dist/mod_prepare/mod.plugins.d.ts delete mode 100644 dist/mod_prepare/mod.plugins.js delete mode 100644 dist/mod_publish/index.d.ts delete mode 100644 dist/mod_publish/index.js delete mode 100644 dist/mod_publish/mod.plugins.d.ts delete mode 100644 dist/mod_publish/mod.plugins.js delete mode 100644 dist/mod_purge/index.d.ts delete mode 100644 dist/mod_purge/index.js delete mode 100644 dist/mod_purge/mod.plugins.d.ts delete mode 100644 dist/mod_purge/mod.plugins.js delete mode 100644 dist/mod_servezone/index.d.ts delete mode 100644 dist/mod_servezone/index.js delete mode 100644 dist/mod_test/index.d.ts delete mode 100644 dist/mod_test/index.js delete mode 100644 dist/mod_test/mod.plugins.d.ts delete mode 100644 ts/mod_build/index.ts delete mode 100644 ts/mod_docker/mod.builddocker.ts delete mode 100644 ts/mod_install/mod.plugins.ts rename ts/{mod_install => mod_node}/index.ts (72%) create mode 100644 ts/mod_npm/index.ts rename ts/{mod_build => mod_npm}/mod.plugins.ts (100%) delete mode 100644 ts/mod_prepare/index.ts delete mode 100644 ts/mod_prepare/mod.plugins.ts delete mode 100644 ts/mod_publish/index.ts delete mode 100644 ts/mod_publish/mod.plugins.ts delete mode 100644 ts/mod_purge/index.ts delete mode 100644 ts/mod_purge/mod.plugins.ts delete mode 100644 ts/mod_servezone/index.ts delete mode 100644 ts/mod_test/index.ts delete mode 100644 ts/mod_test/mod.plugins.ts diff --git a/dist/mod_build/index.d.ts b/dist/mod_build/index.d.ts deleted file mode 100644 index a8e85c4..0000000 --- a/dist/mod_build/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * defines possible build services - */ -export declare type TBuildService = 'docker'; -/** - * builds for a specific service - */ -export declare let build: (argvArg: any) => Promise; diff --git a/dist/mod_build/index.js b/dist/mod_build/index.js deleted file mode 100644 index 3e35102..0000000 --- a/dist/mod_build/index.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const plugins = require("./mod.plugins"); -const npmciMods = require("../npmci.mods"); -/** - * builds for a specific service - */ -exports.build = (argvArg) => __awaiter(this, void 0, void 0, function* () { - let whatToPublish = argvArg._[1]; - switch (whatToPublish) { - case 'docker': - let modDocker = yield npmciMods.modDocker.load(); - yield modDocker.build(argvArg); - break; - default: - plugins.beautylog.log('build target ' + whatToPublish + ' not recognised!'); - } - return; -}); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfYnVpbGQvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBLHlDQUF3QztBQUd4QywyQ0FBMEM7QUFPMUM7O0dBRUc7QUFDUSxRQUFBLEtBQUssR0FBRyxDQUFPLE9BQU87SUFDL0IsSUFBSSxhQUFhLEdBQVcsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQTtJQUN4QyxNQUFNLENBQUMsQ0FBQyxhQUFhLENBQUMsQ0FBQyxDQUFDO1FBQ3RCLEtBQUssUUFBUTtZQUNYLElBQUksU0FBUyxHQUFHLE1BQU0sU0FBUyxDQUFDLFNBQVMsQ0FBQyxJQUFJLEVBQUUsQ0FBQTtZQUNoRCxNQUFNLFNBQVMsQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLENBQUE7WUFDOUIsS0FBSyxDQUFBO1FBQ1A7WUFDRSxPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyxlQUFlLEdBQUcsYUFBYSxHQUFHLGtCQUFrQixDQUFDLENBQUE7SUFDL0UsQ0FBQztJQUNELE1BQU0sQ0FBQTtBQUNSLENBQUMsQ0FBQSxDQUFBIn0= \ No newline at end of file diff --git a/dist/mod_build/mod.plugins.js b/dist/mod_build/mod.plugins.js deleted file mode 100644 index 1fd45bf..0000000 --- a/dist/mod_build/mod.plugins.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("../npmci.plugins")); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfYnVpbGQvbW9kLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxzQ0FBZ0MifQ== \ No newline at end of file diff --git a/dist/mod_cloudflare/index.d.ts b/dist/mod_cloudflare/index.d.ts index e69de29..c49e6c6 100644 --- a/dist/mod_cloudflare/index.d.ts +++ b/dist/mod_cloudflare/index.d.ts @@ -0,0 +1,6 @@ +/** + * handle cli input + * @param argvArg + */ +export declare let handleCli: (argvArg: any) => Promise; +export declare let purge: (argvArg: any) => Promise; diff --git a/dist/mod_cloudflare/index.js b/dist/mod_cloudflare/index.js index fbeb637..7df533a 100644 --- a/dist/mod_cloudflare/index.js +++ b/dist/mod_cloudflare/index.js @@ -1 +1,36 @@ -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfY2xvdWRmbGFyZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= \ No newline at end of file +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const plugins = require("./mod.plugins"); +let npmciCflare = new plugins.cflare.CflareAccount(); +/** + * handle cli input + * @param argvArg + */ +exports.handleCli = (argvArg) => __awaiter(this, void 0, void 0, function* () { + if (argvArg._.length >= 2) { + let action = argvArg._[1]; + switch (action) { + default: + plugins.beautylog.error(`>>npmci node ...<< action >>${action}<< not supported`); + } + } + else { + plugins.beautylog.log(`>>npmci node ...<< cli arguments invalid... Please read the documentation.`); + } +}); +exports.purge = (argvArg) => __awaiter(this, void 0, void 0, function* () { + npmciCflare.auth({ + email: '', + key: '' + }); + npmciCflare.purgeZone(argvArg._[1]); +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfY2xvdWRmbGFyZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEseUNBQXdDO0FBRXhDLElBQUksV0FBVyxHQUFHLElBQUksT0FBTyxDQUFDLE1BQU0sQ0FBQyxhQUFhLEVBQUUsQ0FBQTtBQUVwRDs7O0dBR0c7QUFDUSxRQUFBLFNBQVMsR0FBRyxDQUFPLE9BQU87SUFDbkMsRUFBRSxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxNQUFNLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUMxQixJQUFJLE1BQU0sR0FBVyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFBO1FBQ2pDLE1BQU0sQ0FBQyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUM7WUFDZjtnQkFDRSxPQUFPLENBQUMsU0FBUyxDQUFDLEtBQUssQ0FBQywrQkFBK0IsTUFBTSxrQkFBa0IsQ0FBQyxDQUFBO1FBQ3BGLENBQUM7SUFDSCxDQUFDO0lBQUMsSUFBSSxDQUFDLENBQUM7UUFDTixPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyw0RUFBNEUsQ0FBQyxDQUFBO0lBQ3JHLENBQUM7QUFDSCxDQUFDLENBQUEsQ0FBQTtBQUVVLFFBQUEsS0FBSyxHQUFHLENBQU8sT0FBTztJQUMvQixXQUFXLENBQUMsSUFBSSxDQUFDO1FBQ2YsS0FBSyxFQUFFLEVBQUU7UUFDVCxHQUFHLEVBQUUsRUFBRTtLQUNSLENBQUMsQ0FBQTtJQUNGLFdBQVcsQ0FBQyxTQUFTLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFBO0FBQ3JDLENBQUMsQ0FBQSxDQUFBIn0= \ No newline at end of file diff --git a/dist/mod_docker/index.d.ts b/dist/mod_docker/index.d.ts index 0ae94f9..d7417f4 100644 --- a/dist/mod_docker/index.d.ts +++ b/dist/mod_docker/index.d.ts @@ -1 +1,111 @@ -export * from './mod.builddocker'; +/// +export declare let modArgvArg: any; +/** + * handle cli input + * @param argvArg + */ +export declare let handleCli: (argvArg: any) => Promise; +/** + * logs in docker + */ +export declare let prepare: () => Promise; +/** + * builds a cwd of Dockerfiles by triggering a promisechain + */ +export declare let build: () => Promise; +export declare let push: () => Promise; +export declare let pull: () => Promise; +export declare let test: () => Promise; +/** + * creates instance of class Dockerfile for all Dockerfiles in cwd + * @returns Promise + */ +export declare let readDockerfiles: () => Promise; +/** + * sorts Dockerfiles into a dependency chain + * @param sortableArrayArg an array of instances of class Dockerfile + * @returns Promise + */ +export declare let sortDockerfiles: (sortableArrayArg: Dockerfile[]) => Promise; +/** + * maps local Dockerfiles dependencies to the correspoding Dockerfile class instances + */ +export declare let mapDockerfiles: (sortedArray: Dockerfile[]) => Promise; +/** + * builds the correspoding real docker image for each Dockerfile class instance + */ +export declare let buildDockerfiles: (sortedArrayArg: Dockerfile[]) => Promise; +/** + * pushes the real Dockerfile images to a Docker registry + */ +export declare let pushDockerfiles: (sortedArrayArg: Dockerfile[]) => Promise; +/** + * pulls corresponding real Docker images for instances of Dockerfile from a registry. + * This is needed if building, testing, and publishing of Docker images is carried out in seperate CI stages. + */ +export declare let pullDockerfileImages: (sortableArrayArg: Dockerfile[], registryArg?: string) => Promise; +/** + * tests all Dockerfiles in by calling class Dockerfile.test(); + * @param sortedArrayArg Dockerfile[] that contains all Dockerfiles in cwd + */ +export declare let testDockerfiles: (sortedArrayArg: Dockerfile[]) => Promise; +/** + * class Dockerfile represents a Dockerfile on disk in npmci + */ +export declare class Dockerfile { + filePath: string; + repo: string; + version: string; + cleanTag: string; + buildTag: string; + gitlabTestTag: string; + gitlabReleaseTag: string; + releaseTag: string; + containerName: string; + content: string; + baseImage: string; + localBaseImageDependent: boolean; + localBaseDockerfile: Dockerfile; + constructor(options: { + filePath?: string; + fileContents?: string | Buffer; + read?: boolean; + }); + /** + * builds the Dockerfile + */ + build(): Promise; + /** + * pushes the Dockerfile to a registry + */ + push(stageArg: any): Promise; + /** + * pulls the Dockerfile from a registry + */ + pull(registryArg: string): Promise; + /** + * tests the Dockerfile; + */ + test(): Promise; + /** + * gets the id of a Dockerfile + */ + getId(): Promise; +} +/** + * returns a version for a docker file + * @execution SYNC + */ +export declare let dockerFileVersion: (dockerfileNameArg: string) => string; +/** + * returns the docker base image for a Dockerfile + */ +export declare let dockerBaseImage: (dockerfileContentArg: string) => string; +/** + * returns the docker tag + */ +export declare let getDockerTagString: (registryArg: string, repoArg: string, versionArg: string, suffixArg?: string) => string; +/** + * + */ +export declare let cleanTagsArrayFunction: (dockerfileArrayArg: Dockerfile[], trackingArrayArg: Dockerfile[]) => string[]; diff --git a/dist/mod_docker/index.js b/dist/mod_docker/index.js index 2f69d53..9dde4e1 100644 --- a/dist/mod_docker/index.js +++ b/dist/mod_docker/index.js @@ -1,7 +1,358 @@ "use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("./mod.builddocker")); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfZG9ja2VyL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsdUNBQWlDIn0= \ No newline at end of file +const plugins = require("./mod.plugins"); +const paths = require("../npmci.paths"); +const NpmciEnv = require("../npmci.env"); +const npmci_bash_1 = require("../npmci.bash"); +/** + * handle cli input + * @param argvArg + */ +exports.handleCli = (argvArg) => __awaiter(this, void 0, void 0, function* () { + exports.modArgvArg = argvArg; + if (argvArg._.length >= 2) { + let action = argvArg._[1]; + switch (action) { + case 'build': + yield exports.build(); + break; + case 'prepare': + yield exports.prepare(); + break; + case 'test': + yield exports.test(); + break; + default: + plugins.beautylog.error(`>>npmci node ...<< action >>${action}<< not supported`); + } + } + else { + plugins.beautylog.log(`>>npmci node ...<< cli arguments invalid... Please read the documentation.`); + } +}); +/** + * logs in docker + */ +exports.prepare = () => __awaiter(this, void 0, void 0, function* () { + NpmciEnv.setDockerRegistry('docker.io'); // TODO: checkup why we set this here + // handle registries + plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_LOGIN_DOCKER*', (envString) => __awaiter(this, void 0, void 0, function* () { + let dockerRegexResultArray = envString.split('|'); + if (dockerRegexResultArray.length !== 3) { + plugins.beautylog.error('malformed docker env var...'); + process.exit(1); + return; + } + let registry = dockerRegexResultArray[0]; + let username = dockerRegexResultArray[1]; + let password = dockerRegexResultArray[2]; + if (registry === 'docker.io') { + yield npmci_bash_1.bash(`docker login -u ${username} -p ${password}`); + plugins.beautylog.info('Logged in to standard docker hub'); + } + else { + yield npmci_bash_1.bash(`docker login -u ${username} -p ${password} ${registry}`); + } + plugins.beautylog.success(`docker authenticated for ${registry}!`); + })); + // Always login to GitLab Registry + if (!process.env.CI_BUILD_TOKEN || process.env.CI_BUILD_TOKEN === '') { + plugins.beautylog.error('No registry token specified by gitlab!'); + return; + } + yield npmci_bash_1.bash(`docker login -u gitlab-ci-token -p ${process.env.CI_BUILD_TOKEN} registry.gitlab.com`); + plugins.beautylog.success(`docker authenticated for registry.gitlab.com!`); + return; +}); +/** + * builds a cwd of Dockerfiles by triggering a promisechain + */ +exports.build = () => __awaiter(this, void 0, void 0, function* () { + plugins.beautylog.log('now building Dockerfiles...'); + yield exports.readDockerfiles() + .then(exports.sortDockerfiles) + .then(exports.mapDockerfiles) + .then(exports.buildDockerfiles); +}); +exports.push = () => __awaiter(this, void 0, void 0, function* () { + yield exports.readDockerfiles() + .then(exports.sortDockerfiles) + .then(exports.mapDockerfiles) + .then(exports.pushDockerfiles); +}); +exports.pull = () => __awaiter(this, void 0, void 0, function* () { + return yield exports.readDockerfiles() + .then(exports.pullDockerfileImages); +}); +exports.test = () => __awaiter(this, void 0, void 0, function* () { + return yield exports.readDockerfiles() + .then(exports.testDockerfiles); +}); +/** + * creates instance of class Dockerfile for all Dockerfiles in cwd + * @returns Promise + */ +exports.readDockerfiles = () => __awaiter(this, void 0, void 0, function* () { + let fileTree = yield plugins.smartfile.fs.listFileTree(paths.cwd, 'Dockerfile*'); + // create the Dockerfile array + let readDockerfilesArray = []; + plugins.beautylog.info(`found ${fileTree.length} Dockerfiles:`); + console.log(fileTree); + for (let dockerfilePath of fileTree) { + let myDockerfile = new Dockerfile({ + filePath: dockerfilePath, + read: true + }); + readDockerfilesArray.push(myDockerfile); + } + return readDockerfilesArray; +}); +/** + * sorts Dockerfiles into a dependency chain + * @param sortableArrayArg an array of instances of class Dockerfile + * @returns Promise + */ +exports.sortDockerfiles = (sortableArrayArg) => { + let done = plugins.q.defer(); + plugins.beautylog.info('sorting Dockerfiles:'); + let sortedArray = []; + let cleanTagsOriginal = exports.cleanTagsArrayFunction(sortableArrayArg, sortedArray); + let sorterFunctionCounter = 0; + let sorterFunction = function () { + sortableArrayArg.forEach((dockerfileArg) => { + let cleanTags = exports.cleanTagsArrayFunction(sortableArrayArg, sortedArray); + if (cleanTags.indexOf(dockerfileArg.baseImage) === -1 && sortedArray.indexOf(dockerfileArg) === -1) { + sortedArray.push(dockerfileArg); + } + if (cleanTagsOriginal.indexOf(dockerfileArg.baseImage) !== -1) { + dockerfileArg.localBaseImageDependent = true; + } + }); + if (sortableArrayArg.length === sortedArray.length) { + let counter = 1; + for (let dockerfile of sortedArray) { + plugins.beautylog.log(`tag ${counter}: -> ${dockerfile.cleanTag}`); + counter++; + } + done.resolve(sortedArray); + } + else if (sorterFunctionCounter < 10) { + sorterFunctionCounter++; + sorterFunction(); + } + }; + sorterFunction(); + return done.promise; +}; +/** + * maps local Dockerfiles dependencies to the correspoding Dockerfile class instances + */ +exports.mapDockerfiles = (sortedArray) => __awaiter(this, void 0, void 0, function* () { + sortedArray.forEach((dockerfileArg) => { + if (dockerfileArg.localBaseImageDependent) { + sortedArray.forEach((dockfile2) => { + if (dockfile2.cleanTag === dockerfileArg.baseImage) { + dockerfileArg.localBaseDockerfile = dockfile2; + } + }); + } + }); + return sortedArray; +}); +/** + * builds the correspoding real docker image for each Dockerfile class instance + */ +exports.buildDockerfiles = (sortedArrayArg) => __awaiter(this, void 0, void 0, function* () { + for (let dockerfileArg of sortedArrayArg) { + yield dockerfileArg.build(); + } + return sortedArrayArg; +}); +/** + * pushes the real Dockerfile images to a Docker registry + */ +exports.pushDockerfiles = (sortedArrayArg) => __awaiter(this, void 0, void 0, function* () { + let stageArg = (function () { + if (exports.modArgvArg._ && exports.modArgvArg._.length >= 3) { + return exports.modArgvArg._[2]; + } + else { + return NpmciEnv.buildStage; + } + })(); + for (let dockerfileArg of sortedArrayArg) { + yield dockerfileArg.push(stageArg); + } + return sortedArrayArg; +}); +/** + * pulls corresponding real Docker images for instances of Dockerfile from a registry. + * This is needed if building, testing, and publishing of Docker images is carried out in seperate CI stages. + */ +exports.pullDockerfileImages = (sortableArrayArg, registryArg = 'registry.gitlab.com') => __awaiter(this, void 0, void 0, function* () { + for (let dockerfileArg of sortableArrayArg) { + yield dockerfileArg.pull(registryArg); + } + return sortableArrayArg; +}); +/** + * tests all Dockerfiles in by calling class Dockerfile.test(); + * @param sortedArrayArg Dockerfile[] that contains all Dockerfiles in cwd + */ +exports.testDockerfiles = (sortedArrayArg) => __awaiter(this, void 0, void 0, function* () { + for (let dockerfileArg of sortedArrayArg) { + yield dockerfileArg.test(); + } + return sortedArrayArg; +}); +/** + * class Dockerfile represents a Dockerfile on disk in npmci + */ +class Dockerfile { + constructor(options) { + this.filePath = options.filePath; + this.repo = NpmciEnv.repo.user + '/' + NpmciEnv.repo.repo; + this.version = exports.dockerFileVersion(plugins.path.parse(options.filePath).base); + this.cleanTag = this.repo + ':' + this.version; + this.buildTag = this.cleanTag; + this.gitlabTestTag = exports.getDockerTagString('docker.io', this.repo, this.version, 'test'); // TODO: using docker.io until gitlab is fixed + this.gitlabReleaseTag = exports.getDockerTagString('docker.io', this.repo, this.version); // TODO: using docker.io until gitlab is fixed + // the releaseTag determines where the image gets released + this.releaseTag = exports.getDockerTagString('docker.io', this.repo, this.version); + this.containerName = 'dockerfile-' + this.version; + if (options.filePath && options.read) { + this.content = plugins.smartfile.fs.toStringSync(plugins.path.resolve(options.filePath)); + } + this.baseImage = exports.dockerBaseImage(this.content); + this.localBaseImageDependent = false; + } + /** + * builds the Dockerfile + */ + build() { + return __awaiter(this, void 0, void 0, function* () { + plugins.beautylog.info('now building Dockerfile for ' + this.cleanTag); + let buildCommand = `docker build -t ${this.buildTag} -f ${this.filePath} .`; + yield npmci_bash_1.bash(buildCommand); + NpmciEnv.dockerFilesBuilt.push(this); + return; + }); + } + /** + * pushes the Dockerfile to a registry + */ + push(stageArg) { + return __awaiter(this, void 0, void 0, function* () { + yield npmci_bash_1.bash(`docker tag ${this.buildTag} ${this.releaseTag}`); + yield npmci_bash_1.bash(`docker tag ${this.buildTag} ${this.gitlabReleaseTag}`); + yield npmci_bash_1.bash(`docker tag ${this.buildTag} ${this.gitlabTestTag}`); + switch (stageArg) { + case 'release': + yield npmci_bash_1.bash(`docker push ${this.gitlabReleaseTag}`); + yield npmci_bash_1.bash(`docker push ${this.releaseTag}`); + break; + case 'test': + default: + yield npmci_bash_1.bash(`docker push ${this.gitlabTestTag}`); + break; + } + }); + } + /** + * pulls the Dockerfile from a registry + */ + pull(registryArg) { + return __awaiter(this, void 0, void 0, function* () { + yield npmci_bash_1.bash(`docker pull ${this.gitlabTestTag}`); + yield npmci_bash_1.bash(`docker tag ${this.gitlabTestTag} ${this.buildTag}`); + }); + } + /** + * tests the Dockerfile; + */ + test() { + return __awaiter(this, void 0, void 0, function* () { + let testFile = plugins.path.join(paths.NpmciTestDir, 'test_' + this.version + '.sh'); + let testFileExists = plugins.smartfile.fs.fileExistsSync(testFile); + if (testFileExists) { + // run tests + yield npmci_bash_1.bash('docker run --name npmci_test_container ' + this.buildTag + ' mkdir /npmci_test'); + yield npmci_bash_1.bash('docker cp ' + testFile + ' npmci_test_container:/npmci_test/test.sh'); + yield npmci_bash_1.bash('docker commit npmci_test_container npmci_test_image'); + yield npmci_bash_1.bash('docker run npmci_test_image sh /npmci_test/test.sh'); + yield npmci_bash_1.bash('docker rm npmci_test_container'); + yield npmci_bash_1.bash('docker rmi --force npmci_test_image'); + } + else { + plugins.beautylog.warn('skipping tests for ' + this.cleanTag + ' because no testfile was found!'); + } + }); + } + /** + * gets the id of a Dockerfile + */ + getId() { + return __awaiter(this, void 0, void 0, function* () { + let containerId = yield npmci_bash_1.bash('docker inspect --type=image --format=\"{{.Id}}\" ' + this.buildTag); + return containerId; + }); + } +} +exports.Dockerfile = Dockerfile; +/** + * returns a version for a docker file + * @execution SYNC + */ +exports.dockerFileVersion = (dockerfileNameArg) => { + let versionString; + let versionRegex = /Dockerfile_([a-zA-Z0-9\.]*)$/; + let regexResultArray = versionRegex.exec(dockerfileNameArg); + if (regexResultArray && regexResultArray.length === 2) { + versionString = regexResultArray[1]; + } + else { + versionString = 'latest'; + } + return versionString; +}; +/** + * returns the docker base image for a Dockerfile + */ +exports.dockerBaseImage = function (dockerfileContentArg) { + let baseImageRegex = /FROM\s([a-zA-z0-9\/\-\:]*)\n?/; + let regexResultArray = baseImageRegex.exec(dockerfileContentArg); + return regexResultArray[1]; +}; +/** + * returns the docker tag + */ +exports.getDockerTagString = function (registryArg, repoArg, versionArg, suffixArg) { + // determine wether the suffix is needed + let version = versionArg; + if (suffixArg) { + version = versionArg + '_' + suffixArg; + } + let tagString = `${registryArg}/${repoArg}:${version}`; + return tagString; +}; +/** + * + */ +exports.cleanTagsArrayFunction = function (dockerfileArrayArg, trackingArrayArg) { + let cleanTagsArray = []; + dockerfileArrayArg.forEach(function (dockerfileArg) { + if (trackingArrayArg.indexOf(dockerfileArg) === -1) { + cleanTagsArray.push(dockerfileArg.cleanTag); + } + }); + return cleanTagsArray; +}; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfZG9ja2VyL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSx5Q0FBd0M7QUFDeEMsd0NBQXVDO0FBQ3ZDLHlDQUF3QztBQUN4Qyw4Q0FBb0M7QUFJcEM7OztHQUdHO0FBQ1EsUUFBQSxTQUFTLEdBQUcsQ0FBTyxPQU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LEVBQUUsT0FBZSxFQUFFLFVBQWtCLEVBQUUsU0FBa0I7SUFDcEgsd0NBQXdDO0lBQ3hDLElBQUksT0FBTyxHQUFHLFVBQVUsQ0FBQTtJQUN4QixFQUFFLENBQUMsQ0FBQyxTQUFTLENBQUMsQ0FBQyxDQUFDO1FBQ2QsT0FBTyxHQUFHLFVBQVUsR0FBRyxHQUFHLEdBQUcsU0FBUyxDQUFBO0lBQ3hDLENBQUM7SUFDRCxJQUFJLFNBQVMsR0FBRyxHQUFHLFdBQVcsSUFBSSxPQUFPLElBQUksT0FBTyxFQUFFLENBQUE7SUFDdEQsTUFBTSxDQUFDLFNBQVMsQ0FBQTtBQUNsQixDQUFDLENBQUE7QUFFRDs7R0FFRztBQUNRLFFBQUEsc0JBQXNCLEdBQUcsVUFBVSxrQkFBZ0MsRUFBRSxnQkFBOEI7SUFDNUcsSUFBSSxjQUFjLEdBQWEsRUFBRSxDQUFBO0lBQ2pDLGtCQUFrQixDQUFDLE9BQU8sQ0FBQyxVQUFVLGFBQWE7UUFDaEQsRUFBRSxDQUFDLENBQUMsZ0JBQWdCLENBQUMsT0FBTyxDQUFDLGFBQWEsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztZQUNuRCxjQUFjLENBQUMsSUFBSSxDQUFDLGFBQWEsQ0FBQyxRQUFRLENBQUMsQ0FBQTtRQUM3QyxDQUFDO0lBQ0gsQ0FBQyxDQUFDLENBQUE7SUFDRixNQUFNLENBQUMsY0FBYyxDQUFBO0FBQ3ZCLENBQUMsQ0FBQSJ9 \ No newline at end of file diff --git a/dist/mod_docker/mod.builddocker.d.ts b/dist/mod_docker/mod.builddocker.d.ts deleted file mode 100644 index ed2e730..0000000 --- a/dist/mod_docker/mod.builddocker.d.ts +++ /dev/null @@ -1,98 +0,0 @@ -/// -/** - * builds a cwd of Dockerfiles by triggering a promisechain - */ -export declare let build: (argvArg: any) => Promise; -/** - * creates instance of class Dockerfile for all Dockerfiles in cwd - * @returns Promise - */ -export declare let readDockerfiles: (argvArg: any) => Promise; -/** - * sorts Dockerfiles into a dependency chain - * @param sortableArrayArg an array of instances of class Dockerfile - * @returns Promise - */ -export declare let sortDockerfiles: (sortableArrayArg: Dockerfile[]) => Promise; -/** - * maps local Dockerfiles dependencies to the correspoding Dockerfile class instances - */ -export declare let mapDockerfiles: (sortedArray: Dockerfile[]) => Promise; -/** - * builds the correspoding real docker image for each Dockerfile class instance - */ -export declare let buildDockerfiles: (sortedArrayArg: Dockerfile[]) => Promise; -/** - * pushes the real Dockerfile images to a Docker registry - */ -export declare let pushDockerfiles: (sortedArrayArg: Dockerfile[]) => Promise; -/** - * pulls corresponding real Docker images for instances of Dockerfile from a registry. - * This is needed if building, testing, and publishing of Docker images is carried out in seperate CI stages. - */ -export declare let pullDockerfileImages: (sortableArrayArg: Dockerfile[], registryArg?: string) => Promise; -/** - * tests all Dockerfiles in by calling class Dockerfile.test(); - * @param sortedArrayArg Dockerfile[] that contains all Dockerfiles in cwd - */ -export declare let testDockerfiles: (sortedArrayArg: Dockerfile[]) => Promise; -/** - * class Dockerfile represents a Dockerfile on disk in npmci - */ -export declare class Dockerfile { - filePath: string; - repo: string; - version: string; - cleanTag: string; - buildTag: string; - gitlabTestTag: string; - gitlabReleaseTag: string; - releaseTag: string; - containerName: string; - content: string; - baseImage: string; - localBaseImageDependent: boolean; - localBaseDockerfile: Dockerfile; - constructor(options: { - filePath?: string; - fileContents?: string | Buffer; - read?: boolean; - }); - /** - * builds the Dockerfile - */ - build(): Promise; - /** - * pushes the Dockerfile to a registry - */ - push(stageArg: any): Promise; - /** - * pulls the Dockerfile from a registry - */ - pull(registryArg: string): Promise; - /** - * tests the Dockerfile; - */ - test(): Promise; - /** - * gets the id of a Dockerfile - */ - getId(): Promise; -} -/** - * returns a version for a docker file - * @execution SYNC - */ -export declare let dockerFileVersion: (dockerfileNameArg: string) => string; -/** - * returns the docker base image for a Dockerfile - */ -export declare let dockerBaseImage: (dockerfileContentArg: string) => string; -/** - * returns the docker tag - */ -export declare let getDockerTagString: (registryArg: string, repoArg: string, versionArg: string, suffixArg?: string) => string; -/** - * - */ -export declare let cleanTagsArrayFunction: (dockerfileArrayArg: Dockerfile[], trackingArrayArg: Dockerfile[]) => string[]; diff --git a/dist/mod_docker/mod.builddocker.js b/dist/mod_docker/mod.builddocker.js deleted file mode 100644 index dc430f6..0000000 --- a/dist/mod_docker/mod.builddocker.js +++ /dev/null @@ -1,288 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const plugins = require("./mod.plugins"); -const paths = require("../npmci.paths"); -const NpmciEnv = require("../npmci.env"); -const npmci_bash_1 = require("../npmci.bash"); -let modArgvArg; // will be set through the build command -/** - * builds a cwd of Dockerfiles by triggering a promisechain - */ -exports.build = (argvArg) => __awaiter(this, void 0, void 0, function* () { - modArgvArg = argvArg; - plugins.beautylog.log('now building Dockerfiles...'); - yield exports.readDockerfiles(argvArg) - .then(exports.sortDockerfiles) - .then(exports.mapDockerfiles) - .then(exports.buildDockerfiles) - .then(exports.pushDockerfiles); -}); -/** - * creates instance of class Dockerfile for all Dockerfiles in cwd - * @returns Promise - */ -exports.readDockerfiles = (argvArg) => __awaiter(this, void 0, void 0, function* () { - modArgvArg = argvArg; - let fileTree = yield plugins.smartfile.fs.listFileTree(paths.cwd, 'Dockerfile*'); - // create the Dockerfile array - let readDockerfilesArray = []; - plugins.beautylog.info(`found ${fileTree.length} Dockerfiles:`); - console.log(fileTree); - for (let dockerfilePath of fileTree) { - let myDockerfile = new Dockerfile({ - filePath: dockerfilePath, - read: true - }); - readDockerfilesArray.push(myDockerfile); - } - return readDockerfilesArray; -}); -/** - * sorts Dockerfiles into a dependency chain - * @param sortableArrayArg an array of instances of class Dockerfile - * @returns Promise - */ -exports.sortDockerfiles = (sortableArrayArg) => { - let done = plugins.q.defer(); - plugins.beautylog.info('sorting Dockerfiles:'); - let sortedArray = []; - let cleanTagsOriginal = exports.cleanTagsArrayFunction(sortableArrayArg, sortedArray); - let sorterFunctionCounter = 0; - let sorterFunction = function () { - sortableArrayArg.forEach((dockerfileArg) => { - let cleanTags = exports.cleanTagsArrayFunction(sortableArrayArg, sortedArray); - if (cleanTags.indexOf(dockerfileArg.baseImage) === -1 && sortedArray.indexOf(dockerfileArg) === -1) { - sortedArray.push(dockerfileArg); - } - if (cleanTagsOriginal.indexOf(dockerfileArg.baseImage) !== -1) { - dockerfileArg.localBaseImageDependent = true; - } - }); - if (sortableArrayArg.length === sortedArray.length) { - let counter = 1; - for (let dockerfile of sortedArray) { - plugins.beautylog.log(`tag ${counter}: -> ${dockerfile.cleanTag}`); - counter++; - } - done.resolve(sortedArray); - } - else if (sorterFunctionCounter < 10) { - sorterFunctionCounter++; - sorterFunction(); - } - }; - sorterFunction(); - return done.promise; -}; -/** - * maps local Dockerfiles dependencies to the correspoding Dockerfile class instances - */ -exports.mapDockerfiles = (sortedArray) => __awaiter(this, void 0, void 0, function* () { - sortedArray.forEach((dockerfileArg) => { - if (dockerfileArg.localBaseImageDependent) { - sortedArray.forEach((dockfile2) => { - if (dockfile2.cleanTag === dockerfileArg.baseImage) { - dockerfileArg.localBaseDockerfile = dockfile2; - } - }); - } - }); - return sortedArray; -}); -/** - * builds the correspoding real docker image for each Dockerfile class instance - */ -exports.buildDockerfiles = (sortedArrayArg) => __awaiter(this, void 0, void 0, function* () { - for (let dockerfileArg of sortedArrayArg) { - yield dockerfileArg.build(); - } - return sortedArrayArg; -}); -/** - * pushes the real Dockerfile images to a Docker registry - */ -exports.pushDockerfiles = (sortedArrayArg) => __awaiter(this, void 0, void 0, function* () { - let stageArg = (function () { - if (modArgvArg._ && modArgvArg._.length >= 3) { - return modArgvArg._[2]; - } - else { - return NpmciEnv.buildStage; - } - })(); - for (let dockerfileArg of sortedArrayArg) { - yield dockerfileArg.push(stageArg); - } - return sortedArrayArg; -}); -/** - * pulls corresponding real Docker images for instances of Dockerfile from a registry. - * This is needed if building, testing, and publishing of Docker images is carried out in seperate CI stages. - */ -exports.pullDockerfileImages = (sortableArrayArg, registryArg = 'registry.gitlab.com') => __awaiter(this, void 0, void 0, function* () { - for (let dockerfileArg of sortableArrayArg) { - yield dockerfileArg.pull(registryArg); - } - return sortableArrayArg; -}); -/** - * tests all Dockerfiles in by calling class Dockerfile.test(); - * @param sortedArrayArg Dockerfile[] that contains all Dockerfiles in cwd - */ -exports.testDockerfiles = (sortedArrayArg) => __awaiter(this, void 0, void 0, function* () { - for (let dockerfileArg of sortedArrayArg) { - yield dockerfileArg.test(); - } - return sortedArrayArg; -}); -/** - * class Dockerfile represents a Dockerfile on disk in npmci - */ -class Dockerfile { - constructor(options) { - this.filePath = options.filePath; - this.repo = NpmciEnv.repo.user + '/' + NpmciEnv.repo.repo; - this.version = exports.dockerFileVersion(plugins.path.parse(options.filePath).base); - this.cleanTag = this.repo + ':' + this.version; - this.buildTag = this.cleanTag; - this.gitlabTestTag = exports.getDockerTagString('docker.io', this.repo, this.version, 'test'); // TODO: using docker.io until gitlab is fixed - this.gitlabReleaseTag = exports.getDockerTagString('docker.io', this.repo, this.version); // TODO: using docker.io until gitlab is fixed - // the releaseTag determines where the image gets released - this.releaseTag = exports.getDockerTagString('docker.io', this.repo, this.version); - this.containerName = 'dockerfile-' + this.version; - if (options.filePath && options.read) { - this.content = plugins.smartfile.fs.toStringSync(plugins.path.resolve(options.filePath)); - } - this.baseImage = exports.dockerBaseImage(this.content); - this.localBaseImageDependent = false; - } - /** - * builds the Dockerfile - */ - build() { - return __awaiter(this, void 0, void 0, function* () { - plugins.beautylog.info('now building Dockerfile for ' + this.cleanTag); - let buildCommand = `docker build -t ${this.buildTag} -f ${this.filePath} .`; - yield npmci_bash_1.bash(buildCommand); - NpmciEnv.dockerFilesBuilt.push(this); - return; - }); - } - /** - * pushes the Dockerfile to a registry - */ - push(stageArg) { - return __awaiter(this, void 0, void 0, function* () { - yield npmci_bash_1.bash(`docker tag ${this.buildTag} ${this.releaseTag}`); - yield npmci_bash_1.bash(`docker tag ${this.buildTag} ${this.gitlabReleaseTag}`); - yield npmci_bash_1.bash(`docker tag ${this.buildTag} ${this.gitlabTestTag}`); - switch (stageArg) { - case 'release': - yield npmci_bash_1.bash(`docker push ${this.gitlabReleaseTag}`); - yield npmci_bash_1.bash(`docker push ${this.releaseTag}`); - break; - case 'test': - default: - yield npmci_bash_1.bash(`docker push ${this.gitlabTestTag}`); - break; - } - }); - } - /** - * pulls the Dockerfile from a registry - */ - pull(registryArg) { - return __awaiter(this, void 0, void 0, function* () { - yield npmci_bash_1.bash(`docker pull ${this.gitlabTestTag}`); - yield npmci_bash_1.bash(`docker tag ${this.gitlabTestTag} ${this.buildTag}`); - }); - } - /** - * tests the Dockerfile; - */ - test() { - return __awaiter(this, void 0, void 0, function* () { - let testFile = plugins.path.join(paths.NpmciTestDir, 'test_' + this.version + '.sh'); - let testFileExists = plugins.smartfile.fs.fileExistsSync(testFile); - if (testFileExists) { - // run tests - yield npmci_bash_1.bash('docker run --name npmci_test_container ' + this.buildTag + ' mkdir /npmci_test'); - yield npmci_bash_1.bash('docker cp ' + testFile + ' npmci_test_container:/npmci_test/test.sh'); - yield npmci_bash_1.bash('docker commit npmci_test_container npmci_test_image'); - yield npmci_bash_1.bash('docker run npmci_test_image sh /npmci_test/test.sh'); - yield npmci_bash_1.bash('docker rm npmci_test_container'); - yield npmci_bash_1.bash('docker rmi --force npmci_test_image'); - } - else { - plugins.beautylog.warn('skipping tests for ' + this.cleanTag + ' because no testfile was found!'); - } - }); - } - /** - * gets the id of a Dockerfile - */ - getId() { - return __awaiter(this, void 0, void 0, function* () { - let containerId = yield npmci_bash_1.bash('docker inspect --type=image --format=\"{{.Id}}\" ' + this.buildTag); - return containerId; - }); - } -} -exports.Dockerfile = Dockerfile; -/** - * returns a version for a docker file - * @execution SYNC - */ -exports.dockerFileVersion = (dockerfileNameArg) => { - let versionString; - let versionRegex = /Dockerfile_([a-zA-Z0-9\.]*)$/; - let regexResultArray = versionRegex.exec(dockerfileNameArg); - if (regexResultArray && regexResultArray.length === 2) { - versionString = regexResultArray[1]; - } - else { - versionString = 'latest'; - } - return versionString; -}; -/** - * returns the docker base image for a Dockerfile - */ -exports.dockerBaseImage = function (dockerfileContentArg) { - let baseImageRegex = /FROM\s([a-zA-z0-9\/\-\:]*)\n?/; - let regexResultArray = baseImageRegex.exec(dockerfileContentArg); - return regexResultArray[1]; -}; -/** - * returns the docker tag - */ -exports.getDockerTagString = function (registryArg, repoArg, versionArg, suffixArg) { - // determine wether the suffix is needed - let version = versionArg; - if (suffixArg) { - version = versionArg + '_' + suffixArg; - } - let tagString = `${registryArg}/${repoArg}:${version}`; - return tagString; -}; -/** - * - */ -exports.cleanTagsArrayFunction = function (dockerfileArrayArg, trackingArrayArg) { - let cleanTagsArray = []; - dockerfileArrayArg.forEach(function (dockerfileArg) { - if (trackingArrayArg.indexOf(dockerfileArg) === -1) { - cleanTagsArray.push(dockerfileArg.cleanTag); - } - }); - return cleanTagsArray; -}; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLmJ1aWxkZG9ja2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vdHMvbW9kX2RvY2tlci9tb2QuYnVpbGRkb2NrZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBLHlDQUF3QztBQUN4Qyx3Q0FBdUM7QUFDdkMseUNBQXdDO0FBQ3hDLDhDQUFvQztBQUVwQyxJQUFJLFVBQVUsQ0FBQSxDQU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3QyxDQUFDO0lBQ0gsQ0FBQyxDQUFDLENBQUE7SUFDRixNQUFNLENBQUMsY0FBYyxDQUFBO0FBQ3ZCLENBQUMsQ0FBQSJ9 \ No newline at end of file diff --git a/dist/mod_install/index.js b/dist/mod_install/index.js deleted file mode 100644 index 8fa36c7..0000000 --- a/dist/mod_install/index.js +++ /dev/null @@ -1,68 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const plugins = require("./mod.plugins"); -const configModule = require("../npmci.config"); -const npmci_bash_1 = require("../npmci.bash"); -/** - * Install a specific version of node - * @param versionArg - */ -exports.install = (versionArg) => __awaiter(this, void 0, void 0, function* () { - plugins.beautylog.log(`now installing node version ${versionArg}`); - let version; - if (versionArg === 'stable') { - version = 'stable'; - } - else if (versionArg === 'lts') { - version = '6'; - } - else if (versionArg === 'legacy') { - version = '6'; - } - else { - version = versionArg; - } - ; - if (yield npmci_bash_1.nvmAvailable.promise) { - yield npmci_bash_1.bash(`nvm install ${version} && nvm alias default ${version}`); - plugins.beautylog.success(`Node version ${version} successfully installed!`); - } - else { - plugins.beautylog.warn('Nvm not in path so staying at installed node version!'); - } - ; - yield npmci_bash_1.bash('node -v'); - yield npmci_bash_1.bash('npm -v'); - // lets look for further config - yield configModule.getConfig() - .then((configArg) => __awaiter(this, void 0, void 0, function* () { - plugins.beautylog.log('Now checking for needed global npm tools...'); - for (let npmTool of configArg.globalNpmTools) { - plugins.beautylog.info(`Checking for global "${npmTool}"`); - let whichOutput = yield npmci_bash_1.bashNoError(`which ${npmTool}`); - let toolAvailable = !((/not\sfound/.test(whichOutput)) || whichOutput === ''); - if (toolAvailable) { - plugins.beautylog.log(`Tool ${npmTool} is available`); - } - else { - plugins.beautylog.info(`globally installing ${npmTool} from npm`); - if (yield npmci_bash_1.yarnAvailable.promise) { - yield npmci_bash_1.bash(`yarn global add ${npmTool}`); - } - else { - yield npmci_bash_1.bash(`npm install ${npmTool} -q -g`); - } - } - } - plugins.beautylog.success('all global npm tools specified in npmextra.json are now available!'); - })); -}); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfaW5zdGFsbC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEseUNBQXdDO0FBQ3hDLGdEQUErQztBQUMvQyw4Q0FJc0M7QUFFdEM7OztHQUdHO0FBQ1EsUUFBQSxPQUFPLEdBQUcsQ0FBTyxVQUFVO0lBQ3BDLE9BQU8sQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLCtCQUErQixVQUFVLEVBQUUsQ0FBQyxDQUFBO0lBQ2xFLElBQUksT0FBZSxDQUFBO0lBQ25CLEVBQUUsQ0FBQyxDQUFDLFVBQVUsS0FBSyxRQUFRLENBQUMsQ0FBQyxDQUFDO1FBQzVCLE9BQU8sR0FBRyxRQUFRLENBQUE7SUFDcEIsQ0FBQztJQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsQ0FBQyxVQUFVLEtBQUssS0FBSyxDQUFDLENBQUMsQ0FBQztRQUNoQyxPQUFPLEdBQUcsR0FBRyxDQUFBO0lBQ2YsQ0FBQztJQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsQ0FBQyxVQUFVLEtBQUssUUFBUSxDQUFDLENBQUMsQ0FBQztRQUNuQyxPQUFPLEdBQUcsR0FBRyxDQUFBO0lBQ2YsQ0FBQztJQUFDLElBQUks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JLENBQUMsV0FBVyxDQUFDLENBQUMsSUFBSSxXQUFXLEtBQUssRUFBRSxDQUFDLENBQUE7WUFDdEYsRUFBRSxDQUFDLENBQUMsYUFBYSxDQUFDLENBQUMsQ0FBQztnQkFDbEIsT0FBTyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsUUFBUSxPQUFPLGVBQWUsQ0FBQyxDQUFBO1lBQ3ZELENBQUM7WUFBQyxJQUFJLENBQUMsQ0FBQztnQkFDTixPQUFPLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyx1QkFBdUIsT0FBTyxXQUFXLENBQUMsQ0FBQTtnQkFDakUsRUFBRSxDQUFDLENBQUMsTUFBTSwwQkFBYSxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUM7b0JBQ2hDLE1BQU0saUJBQUksQ0FBQyxtQkFBbUIsT0FBTyxFQUFFLENBQUMsQ0FBQTtnQkFDMUMsQ0FBQztnQkFBQyxJQUFJLENBQUMsQ0FBQztvQkFDTixNQUFNLGlCQUFJLENBQUMsZUFBZSxPQUFPLFFBQVEsQ0FBQyxDQUFBO2dCQUM1QyxDQUFDO1lBQ0gsQ0FBQztRQUNILENBQUM7UUFDRCxPQUFPLENBQUMsU0FBUyxDQUFDLE9BQU8sQ0FBQyxvRUFBb0UsQ0FBQyxDQUFBO0lBQ2pHLENBQUMsQ0FBQSxDQUFDLENBQUE7QUFDTixDQUFDLENBQUEsQ0FBQSJ9 \ No newline at end of file diff --git a/dist/mod_install/mod.plugins.d.ts b/dist/mod_install/mod.plugins.d.ts deleted file mode 100644 index 27d1e74..0000000 --- a/dist/mod_install/mod.plugins.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../npmci.plugins'; diff --git a/dist/mod_install/mod.plugins.js b/dist/mod_install/mod.plugins.js deleted file mode 100644 index ea8f0f4..0000000 --- a/dist/mod_install/mod.plugins.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("../npmci.plugins")); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfaW5zdGFsbC9tb2QucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLHNDQUFnQyJ9 \ No newline at end of file diff --git a/dist/mod_install/index.d.ts b/dist/mod_node/index.d.ts similarity index 54% rename from dist/mod_install/index.d.ts rename to dist/mod_node/index.d.ts index e6d67e2..5b91325 100644 --- a/dist/mod_install/index.d.ts +++ b/dist/mod_node/index.d.ts @@ -1,3 +1,8 @@ +/** + * handle cli input + * @param argvArg + */ +export declare let handleCli: (argvArg: any) => Promise; /** * Install a specific version of node * @param versionArg diff --git a/dist/mod_node/index.js b/dist/mod_node/index.js new file mode 100644 index 0000000..1077eac --- /dev/null +++ b/dist/mod_node/index.js @@ -0,0 +1,85 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const plugins = require("../npmci.plugins"); +const npmciConfig = require("../npmci.config"); +const npmci_bash_1 = require("../npmci.bash"); +/** + * handle cli input + * @param argvArg + */ +exports.handleCli = (argvArg) => __awaiter(this, void 0, void 0, function* () { + if (argvArg._.length >= 3) { + let action = argvArg._[1]; + switch (action) { + case 'install': + yield exports.install(argvArg._[2]); + break; + default: + plugins.beautylog.error(`>>npmci node ...<< action >>${action}<< not supported`); + } + } + else { + plugins.beautylog.error(`>>npmci node ...<< cli arguments invalid... Please read the documentation.`); + } +}); +/** + * Install a specific version of node + * @param versionArg + */ +exports.install = (versionArg) => __awaiter(this, void 0, void 0, function* () { + plugins.beautylog.log(`now installing node version ${versionArg}`); + let version; + if (versionArg === 'stable') { + version = 'stable'; + } + else if (versionArg === 'lts') { + version = '6'; + } + else if (versionArg === 'legacy') { + version = '6'; + } + else { + version = versionArg; + } + if (yield npmci_bash_1.nvmAvailable.promise) { + yield npmci_bash_1.bash(`nvm install ${version} && nvm alias default ${version}`); + plugins.beautylog.success(`Node version ${version} successfully installed!`); + } + else { + plugins.beautylog.warn('Nvm not in path so staying at installed node version!'); + } + yield npmci_bash_1.bash('node -v'); + yield npmci_bash_1.bash('npm -v'); + // lets look for further config + yield npmciConfig.getConfig() + .then((configArg) => __awaiter(this, void 0, void 0, function* () { + plugins.beautylog.log('Now checking for needed global npm tools...'); + for (let npmTool of configArg.globalNpmTools) { + plugins.beautylog.info(`Checking for global "${npmTool}"`); + let whichOutput = yield npmci_bash_1.bashNoError(`which ${npmTool}`); + let toolAvailable = !((/not\sfound/.test(whichOutput)) || whichOutput === ''); + if (toolAvailable) { + plugins.beautylog.log(`Tool ${npmTool} is available`); + } + else { + plugins.beautylog.info(`globally installing ${npmTool} from npm`); + if (yield npmci_bash_1.yarnAvailable.promise) { + yield npmci_bash_1.bash(`yarn global add ${npmTool}`); + } + else { + yield npmci_bash_1.bash(`npm install ${npmTool} -q -g`); + } + } + } + plugins.beautylog.success('all global npm tools specified in npmextra.json are now available!'); + })); +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2Rfbm9kZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsNENBQTJDO0FBQ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.d.ts @@ -0,0 +1,6 @@ +/** + * handle cli input + * @param argvArg + */ +export declare let handleCli: (argvArg: any) => Promise; +export declare let test: () => Promise; diff --git a/dist/mod_npm/index.js b/dist/mod_npm/index.js new file mode 100644 index 0000000..11e5b0c --- /dev/null +++ b/dist/mod_npm/index.js @@ -0,0 +1,68 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const plugins = require("./mod.plugins"); +const npmci_bash_1 = require("../npmci.bash"); +/** + * handle cli input + * @param argvArg + */ +exports.handleCli = (argvArg) => __awaiter(this, void 0, void 0, function* () { + if (argvArg._.length >= 2) { + let action = argvArg._[1]; + switch (action) { + case 'install': + yield install(); + break; + case 'prepare': + yield prepare(); + break; + case 'test': + yield exports.test(); + break; + default: + plugins.beautylog.error(`>>npmci node ...<< action >>${action}<< not supported`); + } + } + else { + plugins.beautylog.log(`>>npmci node ...<< cli arguments invalid... Please read the documentation.`); + } +}); +/** + * authenticates npm with token from env var + */ +let prepare = () => __awaiter(this, void 0, void 0, function* () { + let npmrcPrefix = '//registry.npmjs.org/:_authToken='; + let npmToken = process.env.NPMCI_TOKEN_NPM; + let npmrcFileString = npmrcPrefix + npmToken; + if (npmToken) { + plugins.beautylog.info('found access token'); + } + else { + plugins.beautylog.error('no access token found! Exiting!'); + process.exit(1); + } + plugins.smartfile.memory.toFsSync(npmrcFileString, '/root/.npmrc'); + return; +}); +let install = () => __awaiter(this, void 0, void 0, function* () { + plugins.beautylog.info('now installing dependencies:'); + if (yield npmci_bash_1.yarnAvailable.promise) { + yield npmci_bash_1.bash('yarn install'); + } + else { + yield npmci_bash_1.bash('npm install'); + } +}); +exports.test = () => __awaiter(this, void 0, void 0, function* () { + plugins.beautylog.info('now starting tests:'); + yield npmci_bash_1.bash('yarn test'); +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfbnBtL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSx5Q0FBd0M7QUFFeEMsOENBS3NCO0FBRXRCOzs7R0FHRztBQUNRLFFBQUEsU0FBUyxHQUFHLENBQU8sT0FBTztJQUNuQyxFQUFFLENBQUMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLE1BQU0sSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQzFCLElBQUksTUFBTSxHQUFXLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUE7UUFDakMsTUFBTSxDQUFDLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQztZQUNmLEtBQUssU0FBUztnQkFDWixNQUFNLE9BQU8sRUFBRSxDQUFBO2dCQUNmLEtBQUssQ0FBQTtZQUNQLEtBQUssU0FBUztnQkFDWixNQUFNLE9BQU8sRUFBRSxDQUFBO2dCQUNmLEtBQUssQ0FBQTtZQUNQLEtBQUssTUFBTTtnQkFDVCxNQUFNLFlBQUksRUFBRSxDQUFBO2dCQUNaLEtBQUssQ0FBQTtZQUNQO2dCQUNFLE9BQU8sQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLCtCQUErQixNQUFNLGtCQUFrQixDQUFDLENBQUE7UUFDcEYsQ0FBQztJQUNILENBQUM7SUFBQyxJQUFJLENBQUMsQ0FBQztRQUNOLE9BQU8sQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLDRFQUE0RSxDQUFDLENBQUE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BO0FBRVUsUUFBQSxJQUFJLEdBQUc7SUFDaEIsT0FBTyxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMscUJBQXFCLENBQUMsQ0FBQTtJQUM3QyxNQUFNLGlCQUFJLENBQUMsV0FBVyxDQUFDLENBQUE7QUFDekIsQ0FBQyxDQUFBLENBQUEifQ== \ No newline at end of file diff --git a/dist/mod_build/mod.plugins.d.ts b/dist/mod_npm/mod.plugins.d.ts similarity index 100% rename from dist/mod_build/mod.plugins.d.ts rename to dist/mod_npm/mod.plugins.d.ts diff --git a/dist/mod_test/mod.plugins.js b/dist/mod_npm/mod.plugins.js similarity index 75% rename from dist/mod_test/mod.plugins.js rename to dist/mod_npm/mod.plugins.js index 3002522..e2a2e5b 100644 --- a/dist/mod_test/mod.plugins.js +++ b/dist/mod_npm/mod.plugins.js @@ -4,4 +4,4 @@ function __export(m) { } Object.defineProperty(exports, "__esModule", { value: true }); __export(require("../npmci.plugins")); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfdGVzdC9tb2QucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLHNDQUFnQyJ9 \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfbnBtL21vZC5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsc0NBQWdDIn0= \ No newline at end of file diff --git a/dist/mod_prepare/index.d.ts b/dist/mod_prepare/index.d.ts deleted file mode 100644 index 053f181..0000000 --- a/dist/mod_prepare/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * defines possible prepare services - */ -export declare type TPrepService = 'npm' | 'docker' | 'docker-gitlab' | 'ssh'; -/** - * the main exported prepare function - * @param servieArg describes the service to prepare - */ -export declare let prepare: (serviceArg: TPrepService) => Promise; diff --git a/dist/mod_prepare/index.js b/dist/mod_prepare/index.js deleted file mode 100644 index 07397a8..0000000 --- a/dist/mod_prepare/index.js +++ /dev/null @@ -1,98 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const plugins = require("./mod.plugins"); -const npmci_bash_1 = require("../npmci.bash"); -const env = require("../npmci.env"); -const npmciMods = require("../npmci.mods"); -/** - * authenticates npm with token from env var - */ -let npm = () => __awaiter(this, void 0, void 0, function* () { - let npmrcPrefix = '//registry.npmjs.org/:_authToken='; - let npmToken = process.env.NPMCI_TOKEN_NPM; - let npmrcFileString = npmrcPrefix + npmToken; - if (npmToken) { - plugins.beautylog.info('found access token'); - } - else { - plugins.beautylog.error('no access token found! Exiting!'); - process.exit(1); - } - plugins.smartfile.memory.toFsSync(npmrcFileString, '/root/.npmrc'); - return; -}); -/** - * logs in docker - */ -let docker = () => __awaiter(this, void 0, void 0, function* () { - env.setDockerRegistry('docker.io'); // TODO: checkup why we set this here - // handle registries - plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_LOGIN_DOCKER*', (envString) => __awaiter(this, void 0, void 0, function* () { - let dockerRegexResultArray = envString.split('|'); - if (dockerRegexResultArray.length !== 3) { - plugins.beautylog.error('malformed docker env var...'); - process.exit(1); - return; - } - let registry = dockerRegexResultArray[0]; - let username = dockerRegexResultArray[1]; - let password = dockerRegexResultArray[2]; - if (registry === 'docker.io') { - yield npmci_bash_1.bash(`docker login -u ${username} -p ${password}`); - plugins.beautylog.info('Logged in to standard docker hub'); - } - else { - yield npmci_bash_1.bash(`docker login -u ${username} -p ${password} ${registry}`); - } - plugins.beautylog.success(`docker authenticated for ${registry}!`); - })); - // Always login to GitLab Registry - yield dockerGitlab(); - return; -}); -/** - * prepare docker for gitlab registry - */ -let dockerGitlab = () => __awaiter(this, void 0, void 0, function* () { - if (!process.env.CI_BUILD_TOKEN || process.env.CI_BUILD_TOKEN === '') { - plugins.beautylog.error('No registry token specified by gitlab!'); - process.exit(1); - } - yield npmci_bash_1.bash(`docker login -u gitlab-ci-token -p ${process.env.CI_BUILD_TOKEN} registry.gitlab.com`); - plugins.beautylog.success(`docker authenticated for registry.gitlab.com!`); - return; -}); -/** - * prepare ssh - */ -let ssh = () => __awaiter(this, void 0, void 0, function* () { - let sshModule = yield npmciMods.modSsh.load(); - yield sshModule.ssh(); -}); -/** - * the main exported prepare function - * @param servieArg describes the service to prepare - */ -exports.prepare = (serviceArg) => __awaiter(this, void 0, void 0, function* () { - switch (serviceArg) { - case 'npm': - return yield npm(); - case 'docker': - return yield docker(); - case 'docker-gitlab': - return yield dockerGitlab(); - case 'ssh': - return yield ssh(); - default: - break; - } -}); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfcHJlcGFyZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEseUNBQXdDO0FBQ3hDLDhDQUFvQztBQUNwQyxvQ0FBbUM7QUFDbkMsMkNBQTBDO0FBUzFDOztHQUVHO0FBQ0gsSUFBSSxHQUFHLEdBQUc7SUFDUixJQUFJLFdBQVcsR0FBVyxtQ0FBbUMsQ0FBQTtJQUM3RCxJQUFJL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ins.d.ts b/dist/mod_prepare/mod.plugins.d.ts deleted file mode 100644 index 27d1e74..0000000 --- a/dist/mod_prepare/mod.plugins.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../npmci.plugins'; diff --git a/dist/mod_prepare/mod.plugins.js b/dist/mod_prepare/mod.plugins.js deleted file mode 100644 index dd93cd9..0000000 --- a/dist/mod_prepare/mod.plugins.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("../npmci.plugins")); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfcHJlcGFyZS9tb2QucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLHNDQUFnQyJ9 \ No newline at end of file diff --git a/dist/mod_publish/index.d.ts b/dist/mod_publish/index.d.ts deleted file mode 100644 index 35a0cd6..0000000 --- a/dist/mod_publish/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Dockerfile } from '../mod_docker/index'; -/** - * type of supported services - */ -export declare type TPubService = 'npm' | 'docker'; -/** - * the main exported publish function. - * @param pubServiceArg references targeted service to publish to - */ -export declare let publish: (argvArg: any) => Promise; diff --git a/dist/mod_publish/index.js b/dist/mod_publish/index.js deleted file mode 100644 index fbf67e6..0000000 --- a/dist/mod_publish/index.js +++ /dev/null @@ -1,51 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const plugins = require("./mod.plugins"); -const npmci_bash_1 = require("../npmci.bash"); -const npmciMods = require("../npmci.mods"); -/** - * the main exported publish function. - * @param pubServiceArg references targeted service to publish to - */ -exports.publish = (argvArg) => __awaiter(this, void 0, void 0, function* () { - let whatToPublish = argvArg._[1]; - switch (whatToPublish) { - case 'docker': - return yield publishDocker(argvArg); - case 'npm': - return yield publishNpm(argvArg); - default: - plugins.beautylog.info('no publish target specified, thus defaulting to npm...'); - return yield publishNpm(argvArg); - } -}); -/** - * tries to publish current cwd to NPM registry - */ -let publishNpm = (argvArg) => __awaiter(this, void 0, void 0, function* () { - let modPrepare = yield npmciMods.modPrepare.load(); - yield modPrepare.prepare('npm'); - yield npmci_bash_1.bash('npm publish'); - plugins.beautylog.ok('Done!'); -}); -/** - * tries to publish current cwd to Docker registry - */ -let publishDocker = (argvArg) => __awaiter(this, void 0, void 0, function* () { - let modDocker = yield npmciMods.modDocker.load(); - return yield modDocker.readDockerfiles(argvArg) - .then(modDocker.pullDockerfileImages) - .then(modDocker.pushDockerfiles) - .then(dockerfileArray => { - return dockerfileArray; - }); -}); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfcHVibGlzaC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEseUNBQXdDO0FBQ3hDLDhDQUFvQztBQUdwQywyQ0FBMEM7QUFXMUM7OztHQUdHO0FBQ1EsUUFBQSxPQUFPLEdBQUcsQ0FBTyxPQUFZO0lBQ3RDLElBQUksYUFBYSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUE7SUFDaEMsTUFBTSxDQUFD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TtRQUNuQixNQUFNLENBQUMsZUFBZSxDQUFBO0lBQ3hCLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFBLENBQUEifQ== \ No newline at end of file diff --git a/dist/mod_publish/mod.plugins.d.ts b/dist/mod_publish/mod.plugins.d.ts deleted file mode 100644 index 27d1e74..0000000 --- a/dist/mod_publish/mod.plugins.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../npmci.plugins'; diff --git a/dist/mod_publish/mod.plugins.js b/dist/mod_publish/mod.plugins.js deleted file mode 100644 index 0e9c462..0000000 --- a/dist/mod_publish/mod.plugins.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("../npmci.plugins")); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfcHVibGlzaC9tb2QucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLHNDQUFnQyJ9 \ No newline at end of file diff --git a/dist/mod_purge/index.d.ts b/dist/mod_purge/index.d.ts deleted file mode 100644 index 98ceadf..0000000 --- a/dist/mod_purge/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare let purge: (argvArg: any) => Promise; diff --git a/dist/mod_purge/index.js b/dist/mod_purge/index.js deleted file mode 100644 index 6c994ac..0000000 --- a/dist/mod_purge/index.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const plugins = require("./mod.plugins"); -let npmciCflare = new plugins.cflare.CflareAccount(); -exports.purge = (argvArg) => __awaiter(this, void 0, void 0, function* () { - npmciCflare.auth({ - email: '', - key: '' - }); - npmciCflare.purgeZone(argvArg._[1]); -}); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfcHVyZ2UvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBLHlDQUF3QztBQUV4QyxJQUFJLFdBQVcsR0FBRyxJQUFJLE9BQU8sQ0FBQyxNQUFNLENBQUMsYUFBYSxFQUFFLENBQUE7QUFFekMsUUFBQSxLQUFLLEdBQUcsQ0FBTyxPQUFPO0lBQy9CLFdBQVcsQ0FBQyxJQUFJLENBQUM7UUFDZixLQUFLLEVBQUUsRUFBRTtRQUNULEdBQUcsRUFBRSxFQUFFO0tBQ1IsQ0FBQyxDQUFBO0lBQ0YsV0FBVyxDQUFDLFNBQVMsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUE7QUFDckMsQ0FBQyxDQUFBLENBQUEifQ== \ No newline at end of file diff --git a/dist/mod_purge/mod.plugins.d.ts b/dist/mod_purge/mod.plugins.d.ts deleted file mode 100644 index e7ec967..0000000 --- a/dist/mod_purge/mod.plugins.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from '../npmci.plugins'; -import * as cflare from 'cflare'; -export { cflare }; diff --git a/dist/mod_purge/mod.plugins.js b/dist/mod_purge/mod.plugins.js deleted file mode 100644 index b99384a..0000000 --- a/dist/mod_purge/mod.plugins.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(require("../npmci.plugins")); -const cflare = require("cflare"); -exports.cflare = cflare; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfcHVyZ2UvbW9kLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxzQ0FBZ0M7QUFFaEMsaUNBQWdDO0FBRzlCLHdCQUFNIn0= \ No newline at end of file diff --git a/dist/mod_servezone/index.d.ts b/dist/mod_servezone/index.d.ts deleted file mode 100644 index be2a524..0000000 --- a/dist/mod_servezone/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * the main run function to submit a service to a servezone - */ -export declare let run: (configArg: any) => Promise; diff --git a/dist/mod_servezone/index.js b/dist/mod_servezone/index.js deleted file mode 100644 index 1355601..0000000 --- a/dist/mod_servezone/index.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -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) => __awaiter(this, void 0, void 0, function* () { - new plugins.smartsocket.SmartsocketClient(smartsocketClientConstructorOptions); -}); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2Rfc2VydmV6b25lL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSw0Q0FBMkM7QUFFM0M7OztHQUdHO0FBQ0gsSUFBSSxjQUFjLEdBQUcsbUJBQW1CLENBQUE7QUFFeEM7O0dBRUc7QUFDSCxJQUFJLHlCQUF5QixHQUFHLGNBQWMsQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxlQUFlLENBQUMsQ0FBQTtBQUVoRjs7R0FFRztBQUNILElBQUksbUNBQW1DLEdBQUc7SUFDeEMsS0FBSyxFQUFFLE9BQU87SUFDZCxRQUFRLEVBQUUseUJBQXlCLENBQUMsQ0FBQyxDQUFDO0lBQ3RDLElBQUksRUFBRSxRQUFRLENBQUMseUJBQXlCLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFDNUMsSUFBSSxFQUFFLElBQUk7SUFDVixHQUFHLEVBQUUseUJBQXlCLENBQUMsQ0FBQyxDQUFDO0NBQ2xDLENBQUE7QUFFRDs7R0FFRztBQUNRLFFBQUEsR0FBRyxHQUFHLENBQU8sU0FBUztJQUMvQixJQUFJLE9BQU8sQ0FBQyxXQUFXLENBQUMsaUJBQWlCLENBQ3ZDLG1DQUFtQyxDQUNwQyxDQUFBO0FBQ0gsQ0FBQyxDQUFBLENBQUEifQ== \ No newline at end of file diff --git a/dist/mod_ssh/index.d.ts b/dist/mod_ssh/index.d.ts index 09ddb02..65e653a 100644 --- a/dist/mod_ssh/index.d.ts +++ b/dist/mod_ssh/index.d.ts @@ -1,4 +1,5 @@ +export declare let handleCli: (argvArg: any) => Promise; /** * checks for ENV vars in form of NPMCI_SSHKEY_* and deploys any found ones */ -export declare let ssh: () => Promise; +export declare let prepare: () => Promise; diff --git a/dist/mod_ssh/index.js b/dist/mod_ssh/index.js index 3f6a2a8..3aae211 100644 --- a/dist/mod_ssh/index.js +++ b/dist/mod_ssh/index.js @@ -9,8 +9,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", { value: true }); const plugins = require("./mod.plugins"); -let sshRegex = /^(.*)\|(.*)\|(.*)/; let sshInstance; +exports.handleCli = (argvArg) => __awaiter(this, void 0, void 0, function* () { + if (argvArg._.length >= 2) { + let action = argvArg._[1]; + switch (action) { + case 'prepare': + yield exports.prepare(); + break; + default: + plugins.beautylog.error(`action >>${action}<< not supported`); + } + } +}); /** * checks if not undefined */ @@ -20,7 +31,7 @@ let notUndefined = (stringArg) => { /** * checks for ENV vars in form of NPMCI_SSHKEY_* and deploys any found ones */ -exports.ssh = () => __awaiter(this, void 0, void 0, function* () { +exports.prepare = () => __awaiter(this, void 0, void 0, function* () { sshInstance = new plugins.smartssh.SshInstance(); // init ssh instance plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_SSHKEY_*', evaluateSshEnv); if (!process.env.NPMTS_TEST) { @@ -34,22 +45,22 @@ exports.ssh = () => __awaiter(this, void 0, void 0, function* () { * gets called for each found SSH ENV Var and deploys it */ let evaluateSshEnv = (sshkeyEnvVarArg) => __awaiter(this, void 0, void 0, function* () { - let resultArray = sshRegex.exec(sshkeyEnvVarArg); + let sshEnvArray = sshkeyEnvVarArg.split('|'); let sshKey = new plugins.smartssh.SshKey(); - plugins.beautylog.info('Found SSH identity for ' + resultArray[1]); - if (notUndefined(resultArray[1])) { + plugins.beautylog.info('Found SSH identity for ' + sshEnvArray[1]); + if (notUndefined(sshEnvArray[0])) { plugins.beautylog.log('---> host defined!'); - sshKey.host = resultArray[1]; + sshKey.host = sshEnvArray[0]; } - if (notUndefined(resultArray[2])) { + if (notUndefined(sshEnvArray[1])) { plugins.beautylog.log('---> privKey defined!'); - sshKey.privKeyBase64 = resultArray[2]; + sshKey.privKeyBase64 = sshEnvArray[1]; } - if (notUndefined(resultArray[3])) { + if (notUndefined(sshEnvArray[2])) { plugins.beautylog.log('---> pubKey defined!'); - sshKey.pubKeyBase64 = resultArray[3]; + sshKey.pubKeyBase64 = sshEnvArray[2]; } sshInstance.addKey(sshKey); return; }); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2Rfc3NoL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSx5Q0FBd0M7QUFFeEMsSUFBSSxRQUFRLEdBQUcsbUJBQW1CLENBQUE7QUFDbEMsSUFBSSxXQUF5QyxDQUFBO0FBRTdDOztHQUVHO0FBQ0gsSUFBSSxZQUFZLEdBQUcsQ0FBQyxTQUFpQjtJQUNuQyxNQUFNLENBQUMsQ0FBQyxTQUFTLElBQUksU0FBUyxLQUFLLFdBQVcsSUFBSSxTQUFTLEtBQUssSUFBSSxDQUFDLENBQUE7QUFDdkUsQ0FBQyxDQUFBO0FBRUQ7O0dBRUc7QUFDUSxRQUFBLEdBQUcsR0FBRztJQUNmLFdBQVcsR0FBRyxJQUFJLE9BQU8sQ0FBQyxRQUFRLENBQUMsV0FBVyxFQUFFLENBQUEsQ0FBQyxvQkFBb0I7SUFDckUsT0FBTyxDQUFDLFVBQVUsQ0FBQyxnQkFBZ0IsQ0FBQyxPQUFPLENBQ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mode 100644 index 9a6a81f..0000000 --- a/dist/mod_test/index.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * the main test function - * @param versionArg - */ -export declare let test: (argvArg: any) => Promise; diff --git a/dist/mod_test/index.js b/dist/mod_test/index.js deleted file mode 100644 index ea3e68b..0000000 --- a/dist/mod_test/index.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const plugins = require("./mod.plugins"); -const npmci_bash_1 = require("../npmci.bash"); -const npmciMods = require("../npmci.mods"); -let npmDependencies = () => __awaiter(this, void 0, void 0, function* () { - plugins.beautylog.info('now installing dependencies:'); - if (yield npmci_bash_1.yarnAvailable.promise) { - yield npmci_bash_1.bash('yarn install'); - } - else { - yield npmci_bash_1.bash('npm install'); - } -}); -let npmTest = () => __awaiter(this, void 0, void 0, function* () { - plugins.beautylog.info('now starting tests:'); - yield npmci_bash_1.bash('npm test'); -}); -let testDocker = (argvArg) => __awaiter(this, void 0, void 0, function* () { - let modDocker = yield npmciMods.modDocker.load(); - return yield modDocker.readDockerfiles(argvArg) - .then(modDocker.pullDockerfileImages) - .then(modDocker.testDockerfiles); -}); -/** - * the main test function - * @param versionArg - */ -exports.test = (argvArg) => __awaiter(this, void 0, void 0, function* () { - let whatToTest = argvArg._[1]; - if (whatToTest === 'docker') { - yield testDocker(argvArg); - } - else { - let modInstall = yield npmciMods.modInstall.load(); - yield modInstall.install(whatToTest) - .then(npmDependencies) - .then(npmTest); - } -}); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJ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0FBQTtBQUVEOzs7R0FHRztBQUNRLFFBQUEsSUFBSSxHQUFHLENBQU8sT0FBTztJQUM5QixJQUFJLFVBQVUsR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFBO0lBQzdCLEVBQUUsQ0FBQyxDQUFDLFVBQVUsS0FBSyxRQUFRLENBQUMsQ0FBQyxDQUFDO1FBQzVCLE1BQU0sVUFBVSxDQUFDLE9BQU8sQ0FBQyxDQUFBO0lBQzNCLENBQUM7SUFBQyxJQUFJLENBQUMsQ0FBQztRQUNOLElBQUksVUFBVSxHQUFHLE1BQU0sU0FBUyxDQUFDLFVBQVUsQ0FBQyxJQUFJLEVBQUUsQ0FBQTtRQUNsRCxNQUFNLFVBQVUsQ0FBQyxPQUFPLENBQUMsVUFBVSxDQUFDO2FBQ2pDLElBQUksQ0FBQyxlQUFlLENBQUM7YUFDckIsSUFBSSxDQUFDLE9BQU8sQ0FBQyxDQUFBO0lBQ2xCLENBQUM7QUFDSCxDQUFDLENBQUEsQ0FBQSJ9 \ No newline at end of file diff --git a/dist/mod_test/mod.plugins.d.ts b/dist/mod_test/mod.plugins.d.ts deleted file mode 100644 index 27d1e74..0000000 --- a/dist/mod_test/mod.plugins.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../npmci.plugins'; diff --git a/dist/npmci.cli.js b/dist/npmci.cli.js index 1bfbe4f..6cdbe4f 100644 --- a/dist/npmci.cli.js +++ b/dist/npmci.cli.js @@ -16,16 +16,6 @@ const NpmciEnv = require("./npmci.env"); const npmciMods = require("./npmci.mods"); let smartcli = new plugins.smartcli.Smartcli(); smartcli.addVersion(npmciInfo.version); -// build -smartcli.addCommand('build') - .then((argvArg) => __awaiter(this, void 0, void 0, function* () { - let modBuild = yield npmciMods.modBuild.load(); - yield modBuild.build(argvArg); - NpmciEnv.configStore(); -})).catch(err => { - console.log(err); - process.exit(1); -}); // clean smartcli.addCommand('clean') .then((argv) => __awaiter(this, void 0, void 0, function* () { @@ -36,6 +26,15 @@ smartcli.addCommand('clean') console.log(err); process.exit(1); }); +// cloudflare +smartcli.addCommand('cloudflare') + .then((argvArg) => __awaiter(this, void 0, void 0, function* () { + let modPurge = yield npmciMods.modCloudflare.load(); + yield modPurge.handleCli(argvArg); + yield NpmciEnv.configStore(); +})).catch(err => { + console.log(err); +}); // command smartcli.addCommand('command') .then((argv) => __awaiter(this, void 0, void 0, function* () { @@ -46,49 +45,39 @@ smartcli.addCommand('command') console.log(err); process.exit(1); }); -// purge -smartcli.addCommand('purge') +// build +smartcli.addCommand('docker') .then((argvArg) => __awaiter(this, void 0, void 0, function* () { - let modPurge = yield npmciMods.modPurge.load(); - yield modPurge.purge(argvArg); -})).catch(err => { - console.log(err); -}); -// install -smartcli.addCommand('install') - .then((argv) => __awaiter(this, void 0, void 0, function* () { - let modInstall = yield npmciMods.modInstall.load(); - yield modInstall.install(argv._[1]); - yield NpmciEnv.configStore(); + let modDocker = yield npmciMods.modDocker.load(); + yield modDocker.handleCli(argvArg); + NpmciEnv.configStore(); })).catch(err => { console.log(err); process.exit(1); }); -// prepare -smartcli.addCommand('prepare') +// node +smartcli.addCommand('node') .then((argvArg) => __awaiter(this, void 0, void 0, function* () { - let modPrepare = yield npmciMods.modPrepare.load(); - yield modPrepare.prepare(argvArg._[1]); + let modNode = yield npmciMods.modNode.load(); + yield modNode.handleCli(argvArg); yield NpmciEnv.configStore(); })).catch(err => { console.log(err); - process.exit(1); }); -// publish -smartcli.addCommand('publish') +// npm +smartcli.addCommand('npm') .then((argvArg) => __awaiter(this, void 0, void 0, function* () { - let modPublish = yield npmciMods.modPublish.load(); - yield modPublish.publish(argvArg); + let modNpm = yield npmciMods.modNpm.load(); + yield modNpm.handleCli(argvArg); yield NpmciEnv.configStore(); })).catch(err => { console.log(err); - process.exit(1); }); -// test -smartcli.addCommand('test') - .then((argv) => __awaiter(this, void 0, void 0, function* () { - let modTest = yield npmciMods.modTest.load(); - yield modTest.test(argv); +// trigger +smartcli.addCommand('ssh') + .then((argvArg) => __awaiter(this, void 0, void 0, function* () { + let modSsh = yield npmciMods.modSsh.load(); + yield modSsh.handleCli(argvArg); yield NpmciEnv.configStore(); })).catch(err => { console.log(err); @@ -105,4 +94,4 @@ smartcli.addCommand('trigger') process.exit(1); }); smartcli.startParse(); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuY2xpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuY2xpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSwyQ0FBMEM7QUFDMUMsdUNBQXNDO0FBQ3RDLElBQUksU0FBUyxHQUFHLElBQUksT0FBTyxDQUFDLFdBQVcsQ0FBQyxjQUFjLENBQUMsS0FBSyxDQUFDLGdCQUFnQixDQUFDLENBQUE7QUFDOUUsT0FBTyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsaUJBQWlCLEdBQUcsU0FBUyxDQUFDLE9BQU8sQ0FBQyxDQUFBO0FBRTVELHdDQUF1QztBQUV2QywwQ0FBeUM7QUFFekMsSUFBSSxRQUFRLEdBQUcsSUFBSSxPQUFPLENBQUMsUUFBUSxDQUFDLFFBQVEsRUFBRSxDQUFBO0FBQzlDLFFBQVEsQ0FBQyxVQUFVLENBQUMsU0FBUyxDQUFDLE9BQU8sQ0FBQyxDQUFBO0FBRXRDLFFBQVE7QUFDUixRQUFRLENBQUMsVUFBVSxDQUFDLE9BQU8sQ0FBQztLQUN6QixJQUFJLENBQUMsQ0FBTSxPQUFPO0lBQ2pCLElBQUksUUFBUSxHQUFHLE1BQU0sU0FBUyxDQUFDLFFBQVEsQ0FBQyxJQUFJLEVBQUUsQ0FBQTtJQUM5QyxNQUFNLFFBQVEsQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLENBQUE7SUFDN0IsUUFBUSxDQUFDLFdBQVcsRUFBRSxDQ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mods.d.ts +++ b/dist/npmci.mods.d.ts @@ -1,23 +1,17 @@ -import * as _modBuild from './mod_build/index'; import * as _modClean from './mod_clean/index'; +import * as _modCloudflare from './mod_cloudflare/index'; import * as _modCommand from './mod_command/index'; import * as _modDocker from './mod_docker/index'; -import * as _modInstall from './mod_install/index'; -import * as _modPublish from './mod_publish/index'; -import * as _modPurge from './mod_purge/index'; -import * as _modPrepare from './mod_prepare/index'; +import * as _modNpm from './mod_npm/index'; +import * as _modNode from './mod_node/index'; import * as _modSsh from './mod_ssh/index'; import * as _modTrigger from './mod_trigger/index'; -import * as _modTest from './mod_test/index'; import { LazyModule } from 'smartsystem'; -export declare let modBuild: LazyModule; export declare let modClean: LazyModule; +export declare let modCloudflare: LazyModule; export declare let modCommand: LazyModule; export declare let modDocker: LazyModule; -export declare let modInstall: LazyModule; -export declare let modPublish: LazyModule; -export declare let modPurge: LazyModule; -export declare let modPrepare: LazyModule; +export declare let modNode: LazyModule; +export declare let modNpm: LazyModule; export declare let modSsh: LazyModule; export declare let modTrigger: LazyModule; -export declare let modTest: LazyModule; diff --git a/dist/npmci.mods.js b/dist/npmci.mods.js index b01eba8..de534f2 100644 --- a/dist/npmci.mods.js +++ b/dist/npmci.mods.js @@ -1,15 +1,12 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const smartsystem_1 = require("smartsystem"); -exports.modBuild = new smartsystem_1.LazyModule('./mod_build/index', __dirname); exports.modClean = new smartsystem_1.LazyModule('./mod_clean/index', __dirname); +exports.modCloudflare = new smartsystem_1.LazyModule('./mod_cloudflare/index', __dirname); exports.modCommand = new smartsystem_1.LazyModule('./mod_command/index', __dirname); exports.modDocker = new smartsystem_1.LazyModule('./mod_docker/index', __dirname); -exports.modInstall = new smartsystem_1.LazyModule('./mod_install/index', __dirname); -exports.modPublish = new smartsystem_1.LazyModule('./mod_publish/index', __dirname); -exports.modPurge = new smartsystem_1.LazyModule('./mod_purge/index', __dirname); -exports.modPrepare = new smartsystem_1.LazyModule('./mod_prepare/index', __dirname); +exports.modNode = new smartsystem_1.LazyModule('./mod_node/index', __dirname); +exports.modNpm = new smartsystem_1.LazyModule('./mod_npm/index', __dirname); exports.modSsh = new smartsystem_1.LazyModule('./mod_ssh/index', __dirname); exports.modTrigger = new smartsystem_1.LazyModule('./mod_trigger/index', __dirname); -exports.modTest = new smartsystem_1.LazyModule('./mod_test/index', __dirname); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kubW9kcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLm1vZHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFZQSw2Q0FBd0M7QUFFN0IsUUFBQSxRQUFRLEdBQUcsSUFBSSx3QkFBVSxDQUFtQixtQkFBbUIsRUFBRSxTQUFTLENBQUMsQ0FBQTtBQUMzRSxRQUFBLFFBQVEsR0FBRyxJQUFJLHdCQUFVLENBQW1CLG1CQUFtQixFQUFFLFNBQVMsQ0FBQyxDQUFBO0FBQzNFLFFBQUEsVUFBVSxHQUFHLElBQUksd0JBQVUsQ0FBcUIscUJBQXFCLEVBQUUsU0FBUyxDQUFDLENBQUE7QUFDakYsUUFBQSxTQUFTLEdBQUcsSUFBSSx3QkFBVSxDQUFvQixvQkFBb0IsRUFBRSxTQUFTLENBQUMsQ0FBQTtBQUM5RSxRQUFBLFVBQVUsR0FBRyxJQUFJLHdCQUFVLENBQXFCLHFCQUFxQixFQUFFLFNBQVMsQ0FBQyxDQUFBO0FBQ2pGLFFBQUEsVUFBVSxHQUFHLElBQUksd0JBQVUsQ0FBcUIscUJBQXFCLEVBQUUsU0FBUyxDQUFDLENBQUE7QUFDakYsUUFBQSxRQUFRLEdBQUcsSUFBSSx3QkFBVSxDQUFtQixtQkFBbUIsRUFBRSxTQUFTLENBQUMsQ0FBQTtBQUMzRSxRQUFBLFVBQVUsR0FBRyxJQUFJLHdCQUFVLENBQ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csSUFBSSx3QkFBVSxDQUFpQixpQkFBaUIsRUFBRSxTQUFTLENBQUMsQ0FBQTtBQUNyRSxRQUFBLFVBQVUsR0FBRyxJQUFJLHdCQUFVLENBQXFCLHFCQUFxQixFQUFFLFNBQVMsQ0FBQyxDQUFBIn0= \ No newline at end of file diff --git a/test/test.ts b/test/test.ts index 7887d29..602173c 100644 --- a/test/test.ts +++ b/test/test.ts @@ -11,85 +11,118 @@ process.cwd = () => { // require NPMCI files import '../ts/index' -import NpmciBuildDocker = require('../ts/mod_docker/index') -import NpmciPublish = require('../ts/mod_publish/index') -import NpmciTest = require('../ts/mod_test/index') -import NpmciSsh = require('../ts/mod_ssh/index') -import NpmciEnv = require('../ts/npmci.env') +import npmciModDocker = require('../ts/mod_docker/index') +import npmciModNpm = require('../ts/mod_npm/index') +import npmciModNode = require('../ts/mod_node/index') +import npmciModSsh = require('../ts/mod_ssh/index') +import npmciEnv = require('../ts/npmci.env') -let dockerfile1: NpmciBuildDocker.Dockerfile -let dockerfile2: NpmciBuildDocker.Dockerfile -let sortableArray: NpmciBuildDocker.Dockerfile[] +// ====== +// Docker +// ====== + +let dockerfile1: npmciModDocker.Dockerfile +let dockerfile2: npmciModDocker.Dockerfile +let sortableArray: npmciModDocker.Dockerfile[] tap.test('should return valid Dockerfiles', async () => { - dockerfile1 = new NpmciBuildDocker.Dockerfile({ filePath: './Dockerfile', read: true }) - dockerfile2 = new NpmciBuildDocker.Dockerfile({ filePath: './Dockerfile_sometag1', read: true }) + dockerfile1 = new npmciModDocker.Dockerfile({ filePath: './Dockerfile', read: true }) + dockerfile2 = new npmciModDocker.Dockerfile({ filePath: './Dockerfile_sometag1', read: true }) expect(dockerfile1.version).to.equal('latest') return expect(dockerfile2.version).to.equal('sometag1') }) tap.test('should read a directory of Dockerfiles', async () => { - return NpmciBuildDocker.readDockerfiles({}) - .then(async (readDockerfilesArrayArg: NpmciBuildDocker.Dockerfile[]) => { + return npmciModDocker.readDockerfiles() + .then(async (readDockerfilesArrayArg: npmciModDocker.Dockerfile[]) => { sortableArray = readDockerfilesArrayArg return expect(readDockerfilesArrayArg[1].version).to.equal('sometag1') }) }) tap.test('should sort an array of Dockerfiles', async () => { - return NpmciBuildDocker.sortDockerfiles(sortableArray) - .then(async (sortedArrayArg: NpmciBuildDocker.Dockerfile[]) => { + return npmciModDocker.sortDockerfiles(sortableArray) + .then(async (sortedArrayArg: npmciModDocker.Dockerfile[]) => { console.log(sortedArrayArg) }) }) -tap.test('should correctly chain Dockerfile handling', async () => { - return NpmciBuildDocker.build({}) -}) - -tap.test('should publish all built Dockerfiles', async () => { - return NpmciPublish.publish({ +tap.test('should build all Dockerfiles', async () => { + return npmciModDocker.handleCli({ _: [ - 'test', - 'docker' + 'docker', + 'build' ] }) }) -tap.test('should source nvm using bash and install a specific node version, then test it', async () => { - await NpmciTest.test({ +tap.test('should test all Dockerfiles', async () => { + return await npmciModDocker.handleCli({ _: [ - 'test', - 'legacy' - ] - }) - await NpmciTest.test({ - _: [ - 'test', - 'lts' - ] - }) - await NpmciTest.test({ - _: [ - 'test', - 'stable' + 'docker', + 'test' ] }) }) tap.test('should test dockerfiles', async () => { - return NpmciTest.test({ + return await npmciModDocker.handleCli({ _: [ - 'test', - 'docker' + 'docker', + 'test' ] }) }) -tap.test('should pick up SSH keys', async () => { - return NpmciSsh.ssh() +tap.test('should prepare docker daemon', async () => { + return await npmciModDocker.handleCli({ + _: [ + 'docker', + 'prepare' + ] + }) }) +// === +// SSH +// === +tap.test('should prepare SSH keys', async () => { + return await npmciModSsh.handleCli({ + _: [ + 'ssh', + 'prepare' + ] + }) +}) + +// ==== +// node +// ==== +tap.test('should install a certain version of node', async () => { + await npmciModNode.handleCli({ + _: [ + 'node', + 'install', + 'stable' + ] + }) + await npmciModNode.handleCli({ + _: [ + 'node', + 'install', + 'lts' + ] + }) + await npmciModNode.handleCli({ + _: [ + 'node', + 'install', + 'legacy' + ] + }) +}) + +// make sure test ends all right tap.test('reset paths', async () => { process.cwd = () => { return path.join(__dirname, '../') @@ -97,7 +130,7 @@ tap.test('reset paths', async () => { }) tap.test('', async () => { - await NpmciEnv.configStore() + await npmciEnv.configStore() }) tap.start() diff --git a/ts/mod_build/index.ts b/ts/mod_build/index.ts deleted file mode 100644 index ededf13..0000000 --- a/ts/mod_build/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -import * as plugins from './mod.plugins' -import { bash } from '../npmci.bash' -import * as env from '../npmci.env' -import * as npmciMods from '../npmci.mods' - -/** - * defines possible build services - */ -export type TBuildService = 'docker' - -/** - * builds for a specific service - */ -export let build = async (argvArg): Promise => { - let whatToPublish: string = argvArg._[1] - switch (whatToPublish) { - case 'docker': - let modDocker = await npmciMods.modDocker.load() - await modDocker.build(argvArg) - break - default: - plugins.beautylog.log('build target ' + whatToPublish + ' not recognised!') - } - return -} diff --git a/ts/mod_cloudflare/index.ts b/ts/mod_cloudflare/index.ts index e69de29..3cfd855 100644 --- a/ts/mod_cloudflare/index.ts +++ b/ts/mod_cloudflare/index.ts @@ -0,0 +1,27 @@ +import * as plugins from './mod.plugins' + +let npmciCflare = new plugins.cflare.CflareAccount() + +/** + * handle cli input + * @param argvArg + */ +export let handleCli = async (argvArg) => { + if (argvArg._.length >= 2) { + let action: string = argvArg._[1] + switch (action) { + default: + plugins.beautylog.error(`>>npmci node ...<< action >>${action}<< not supported`) + } + } else { + plugins.beautylog.log(`>>npmci node ...<< cli arguments invalid... Please read the documentation.`) + } +} + +export let purge = async (argvArg) => { + npmciCflare.auth({ + email: '', + key: '' + }) + npmciCflare.purgeZone(argvArg._[1]) +} diff --git a/ts/mod_cloudflare/mod.plugins.ts b/ts/mod_cloudflare/mod.plugins.ts index 63e7fec..7ddc332 100644 --- a/ts/mod_cloudflare/mod.plugins.ts +++ b/ts/mod_cloudflare/mod.plugins.ts @@ -4,4 +4,4 @@ import * as cflare from 'cflare' export { cflare -} \ No newline at end of file +} diff --git a/ts/mod_docker/index.ts b/ts/mod_docker/index.ts index 60a64c2..e824714 100644 --- a/ts/mod_docker/index.ts +++ b/ts/mod_docker/index.ts @@ -1 +1,376 @@ -export * from './mod.builddocker' +import * as plugins from './mod.plugins' +import * as paths from '../npmci.paths' +import * as NpmciEnv from '../npmci.env' +import { bash } from '../npmci.bash' + +export let modArgvArg // will be set through the build command + +/** + * handle cli input + * @param argvArg + */ +export let handleCli = async (argvArg) => { + modArgvArg = argvArg + if (argvArg._.length >= 2) { + let action: string = argvArg._[1] + switch (action) { + case 'build': + await build() + break + case 'prepare': + await prepare() + break + case 'test': + await test() + break + default: + plugins.beautylog.error(`>>npmci node ...<< action >>${action}<< not supported`) + } + } else { + plugins.beautylog.log(`>>npmci node ...<< cli arguments invalid... Please read the documentation.`) + } +} + + +/** + * logs in docker + */ +export let prepare = async () => { + NpmciEnv.setDockerRegistry('docker.io') // TODO: checkup why we set this here + + // handle registries + plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_LOGIN_DOCKER*', async (envString) => { + let dockerRegexResultArray = envString.split('|') + if (dockerRegexResultArray.length !== 3) { + plugins.beautylog.error('malformed docker env var...') + process.exit(1) + return + } + let registry = dockerRegexResultArray[0] + let username = dockerRegexResultArray[1] + let password = dockerRegexResultArray[2] + if (registry === 'docker.io') { + await bash(`docker login -u ${username} -p ${password}`) + plugins.beautylog.info('Logged in to standard docker hub') + } else { + await bash(`docker login -u ${username} -p ${password} ${registry}`) + } + plugins.beautylog.success(`docker authenticated for ${registry}!`) + }) + + // Always login to GitLab Registry + if (!process.env.CI_BUILD_TOKEN || process.env.CI_BUILD_TOKEN === '') { + plugins.beautylog.error('No registry token specified by gitlab!') + return + } + await bash(`docker login -u gitlab-ci-token -p ${process.env.CI_BUILD_TOKEN} registry.gitlab.com`) + plugins.beautylog.success(`docker authenticated for registry.gitlab.com!`) + return +} + +/** + * builds a cwd of Dockerfiles by triggering a promisechain + */ +export let build = async () => { + plugins.beautylog.log('now building Dockerfiles...') + await readDockerfiles() + .then(sortDockerfiles) + .then(mapDockerfiles) + .then(buildDockerfiles) +} + +export let push = async () => { + await readDockerfiles() + .then(sortDockerfiles) + .then(mapDockerfiles) + .then(pushDockerfiles) +} + +export let pull = async () => { + return await readDockerfiles() + .then(pullDockerfileImages) +} + +export let test = async () => { + return await readDockerfiles() + .then(testDockerfiles) +} + +/** + * creates instance of class Dockerfile for all Dockerfiles in cwd + * @returns Promise + */ +export let readDockerfiles = async (): Promise => { + let fileTree = await plugins.smartfile.fs.listFileTree(paths.cwd, 'Dockerfile*') + + // create the Dockerfile array + let readDockerfilesArray: Dockerfile[] = [] + plugins.beautylog.info(`found ${fileTree.length} Dockerfiles:`) + console.log(fileTree) + for (let dockerfilePath of fileTree) { + let myDockerfile = new Dockerfile({ + filePath: dockerfilePath, + read: true + }) + readDockerfilesArray.push(myDockerfile) + } + + return readDockerfilesArray + +} + +/** + * sorts Dockerfiles into a dependency chain + * @param sortableArrayArg an array of instances of class Dockerfile + * @returns Promise + */ +export let sortDockerfiles = (sortableArrayArg: Dockerfile[]): Promise => { + let done = plugins.q.defer() + plugins.beautylog.info('sorting Dockerfiles:') + let sortedArray: Dockerfile[] = [] + let cleanTagsOriginal = cleanTagsArrayFunction(sortableArrayArg, sortedArray) + let sorterFunctionCounter: number = 0 + let sorterFunction = function () { + sortableArrayArg.forEach((dockerfileArg) => { + let cleanTags = cleanTagsArrayFunction(sortableArrayArg, sortedArray) + if (cleanTags.indexOf(dockerfileArg.baseImage) === -1 && sortedArray.indexOf(dockerfileArg) === -1) { + sortedArray.push(dockerfileArg) + } + if (cleanTagsOriginal.indexOf(dockerfileArg.baseImage) !== -1) { + dockerfileArg.localBaseImageDependent = true + } + }) + if (sortableArrayArg.length === sortedArray.length) { + let counter = 1 + for (let dockerfile of sortedArray) { + plugins.beautylog.log(`tag ${counter}: -> ${dockerfile.cleanTag}`) + counter++ + } + done.resolve(sortedArray) + } else if (sorterFunctionCounter < 10) { + sorterFunctionCounter++ + sorterFunction() + } + } + sorterFunction() + return done.promise +} + +/** + * maps local Dockerfiles dependencies to the correspoding Dockerfile class instances + */ +export let mapDockerfiles = async (sortedArray: Dockerfile[]): Promise => { + sortedArray.forEach((dockerfileArg) => { + if (dockerfileArg.localBaseImageDependent) { + sortedArray.forEach((dockfile2: Dockerfile) => { + if (dockfile2.cleanTag === dockerfileArg.baseImage) { + dockerfileArg.localBaseDockerfile = dockfile2 + } + }) + } + }) + return sortedArray +} + +/** + * builds the correspoding real docker image for each Dockerfile class instance + */ +export let buildDockerfiles = async (sortedArrayArg: Dockerfile[]) => { + for (let dockerfileArg of sortedArrayArg) { + await dockerfileArg.build() + } + return sortedArrayArg +} + +/** + * pushes the real Dockerfile images to a Docker registry + */ +export let pushDockerfiles = async (sortedArrayArg: Dockerfile[]) => { + let stageArg = (function () { + if (modArgvArg._ && modArgvArg._.length >= 3) { + return modArgvArg._[ 2 ] + } else { + return NpmciEnv.buildStage + } + })() + for (let dockerfileArg of sortedArrayArg) { + await dockerfileArg.push(stageArg) + } + return sortedArrayArg +} + +/** + * pulls corresponding real Docker images for instances of Dockerfile from a registry. + * This is needed if building, testing, and publishing of Docker images is carried out in seperate CI stages. + */ +export let pullDockerfileImages = async (sortableArrayArg: Dockerfile[], registryArg = 'registry.gitlab.com') => { + for (let dockerfileArg of sortableArrayArg) { + await dockerfileArg.pull(registryArg) + } + return sortableArrayArg +} + +/** + * tests all Dockerfiles in by calling class Dockerfile.test(); + * @param sortedArrayArg Dockerfile[] that contains all Dockerfiles in cwd + */ +export let testDockerfiles = async (sortedArrayArg: Dockerfile[]) => { + for (let dockerfileArg of sortedArrayArg) { + await dockerfileArg.test() + } + return sortedArrayArg +} + +/** + * class Dockerfile represents a Dockerfile on disk in npmci + */ +export class Dockerfile { + filePath: string + repo: string + version: string + cleanTag: string + buildTag: string + gitlabTestTag: string + gitlabReleaseTag: string + releaseTag: string + containerName: string + content: string + baseImage: string + localBaseImageDependent: boolean + localBaseDockerfile: Dockerfile + constructor(options: { filePath?: string, fileContents?: string | Buffer, read?: boolean }) { + this.filePath = options.filePath + this.repo = NpmciEnv.repo.user + '/' + NpmciEnv.repo.repo + this.version = dockerFileVersion(plugins.path.parse(options.filePath).base) + this.cleanTag = this.repo + ':' + this.version + this.buildTag = this.cleanTag + this.gitlabTestTag = getDockerTagString('docker.io', this.repo, this.version, 'test') // TODO: using docker.io until gitlab is fixed + this.gitlabReleaseTag = getDockerTagString('docker.io', this.repo, this.version) // TODO: using docker.io until gitlab is fixed + + // the releaseTag determines where the image gets released + this.releaseTag = getDockerTagString('docker.io', this.repo, this.version) + + this.containerName = 'dockerfile-' + this.version + if (options.filePath && options.read) { + this.content = plugins.smartfile.fs.toStringSync(plugins.path.resolve(options.filePath)) + } + this.baseImage = dockerBaseImage(this.content) + this.localBaseImageDependent = false + } + + /** + * builds the Dockerfile + */ + async build () { + plugins.beautylog.info('now building Dockerfile for ' + this.cleanTag) + let buildCommand = `docker build -t ${this.buildTag} -f ${this.filePath} .` + await bash(buildCommand) + NpmciEnv.dockerFilesBuilt.push(this) + return + } + + /** + * pushes the Dockerfile to a registry + */ + async push (stageArg) { + await bash(`docker tag ${this.buildTag} ${this.releaseTag}`) + await bash(`docker tag ${this.buildTag} ${this.gitlabReleaseTag}`) + await bash(`docker tag ${this.buildTag} ${this.gitlabTestTag}`) + switch (stageArg) { + case 'release': + await bash(`docker push ${this.gitlabReleaseTag}`) + await bash(`docker push ${this.releaseTag}`) + break + case 'test': + default: + await bash(`docker push ${this.gitlabTestTag}`) + break + } + } + + /** + * pulls the Dockerfile from a registry + */ + async pull (registryArg: string) { + await bash(`docker pull ${this.gitlabTestTag}`) + await bash(`docker tag ${this.gitlabTestTag} ${this.buildTag}`) + } + + /** + * tests the Dockerfile; + */ + async test () { + let testFile: string = plugins.path.join(paths.NpmciTestDir, 'test_' + this.version + '.sh') + let testFileExists: boolean = plugins.smartfile.fs.fileExistsSync(testFile) + if (testFileExists) { + // run tests + await bash('docker run --name npmci_test_container ' + this.buildTag + ' mkdir /npmci_test') + await bash('docker cp ' + testFile + ' npmci_test_container:/npmci_test/test.sh') + await bash('docker commit npmci_test_container npmci_test_image') + await bash('docker run npmci_test_image sh /npmci_test/test.sh') + await bash('docker rm npmci_test_container') + await bash('docker rmi --force npmci_test_image') + } else { + plugins.beautylog.warn('skipping tests for ' + this.cleanTag + ' because no testfile was found!') + } + } + + /** + * gets the id of a Dockerfile + */ + async getId () { + let containerId = await bash('docker inspect --type=image --format=\"{{.Id}}\" ' + this.buildTag) + return containerId + } +} + +/** + * returns a version for a docker file + * @execution SYNC + */ +export let dockerFileVersion = (dockerfileNameArg: string): string => { + let versionString: string + let versionRegex = /Dockerfile_([a-zA-Z0-9\.]*)$/ + let regexResultArray = versionRegex.exec(dockerfileNameArg) + if (regexResultArray && regexResultArray.length === 2) { + versionString = regexResultArray[ 1 ] + } else { + versionString = 'latest' + } + return versionString +} + +/** + * returns the docker base image for a Dockerfile + */ +export let dockerBaseImage = function (dockerfileContentArg: string) { + let baseImageRegex = /FROM\s([a-zA-z0-9\/\-\:]*)\n?/ + let regexResultArray = baseImageRegex.exec(dockerfileContentArg) + return regexResultArray[ 1 ] +} + +/** + * returns the docker tag + */ +export let getDockerTagString = function (registryArg: string, repoArg: string, versionArg: string, suffixArg?: string): string { + // determine wether the suffix is needed + let version = versionArg + if (suffixArg) { + version = versionArg + '_' + suffixArg + } + let tagString = `${registryArg}/${repoArg}:${version}` + return tagString +} + +/** + * + */ +export let cleanTagsArrayFunction = function (dockerfileArrayArg: Dockerfile[], trackingArrayArg: Dockerfile[]): string[] { + let cleanTagsArray: string[] = [] + dockerfileArrayArg.forEach(function (dockerfileArg) { + if (trackingArrayArg.indexOf(dockerfileArg) === -1) { + cleanTagsArray.push(dockerfileArg.cleanTag) + } + }) + return cleanTagsArray +} diff --git a/ts/mod_docker/mod.builddocker.ts b/ts/mod_docker/mod.builddocker.ts deleted file mode 100644 index 9447e57..0000000 --- a/ts/mod_docker/mod.builddocker.ts +++ /dev/null @@ -1,299 +0,0 @@ -import * as plugins from './mod.plugins' -import * as paths from '../npmci.paths' -import * as NpmciEnv from '../npmci.env' -import { bash } from '../npmci.bash' - -let modArgvArg // will be set through the build command - -/** - * builds a cwd of Dockerfiles by triggering a promisechain - */ -export let build = async (argvArg: any) => { - modArgvArg = argvArg - plugins.beautylog.log('now building Dockerfiles...') - await readDockerfiles(argvArg) - .then(sortDockerfiles) - .then(mapDockerfiles) - .then(buildDockerfiles) - .then(pushDockerfiles) -} - -/** - * creates instance of class Dockerfile for all Dockerfiles in cwd - * @returns Promise - */ -export let readDockerfiles = async (argvArg): Promise => { - modArgvArg = argvArg - let fileTree = await plugins.smartfile.fs.listFileTree(paths.cwd, 'Dockerfile*') - - // create the Dockerfile array - let readDockerfilesArray: Dockerfile[] = [] - plugins.beautylog.info(`found ${fileTree.length} Dockerfiles:`) - console.log(fileTree) - for (let dockerfilePath of fileTree) { - let myDockerfile = new Dockerfile({ - filePath: dockerfilePath, - read: true - }) - readDockerfilesArray.push(myDockerfile) - } - - return readDockerfilesArray - -} - -/** - * sorts Dockerfiles into a dependency chain - * @param sortableArrayArg an array of instances of class Dockerfile - * @returns Promise - */ -export let sortDockerfiles = (sortableArrayArg: Dockerfile[]): Promise => { - let done = plugins.q.defer() - plugins.beautylog.info('sorting Dockerfiles:') - let sortedArray: Dockerfile[] = [] - let cleanTagsOriginal = cleanTagsArrayFunction(sortableArrayArg, sortedArray) - let sorterFunctionCounter: number = 0 - let sorterFunction = function () { - sortableArrayArg.forEach((dockerfileArg) => { - let cleanTags = cleanTagsArrayFunction(sortableArrayArg, sortedArray) - if (cleanTags.indexOf(dockerfileArg.baseImage) === -1 && sortedArray.indexOf(dockerfileArg) === -1) { - sortedArray.push(dockerfileArg) - } - if (cleanTagsOriginal.indexOf(dockerfileArg.baseImage) !== -1) { - dockerfileArg.localBaseImageDependent = true - } - }) - if (sortableArrayArg.length === sortedArray.length) { - let counter = 1 - for (let dockerfile of sortedArray) { - plugins.beautylog.log(`tag ${counter}: -> ${dockerfile.cleanTag}`) - counter++ - } - done.resolve(sortedArray) - } else if (sorterFunctionCounter < 10) { - sorterFunctionCounter++ - sorterFunction() - } - } - sorterFunction() - return done.promise -} - -/** - * maps local Dockerfiles dependencies to the correspoding Dockerfile class instances - */ -export let mapDockerfiles = async (sortedArray: Dockerfile[]): Promise => { - sortedArray.forEach((dockerfileArg) => { - if (dockerfileArg.localBaseImageDependent) { - sortedArray.forEach((dockfile2: Dockerfile) => { - if (dockfile2.cleanTag === dockerfileArg.baseImage) { - dockerfileArg.localBaseDockerfile = dockfile2 - } - }) - } - }) - return sortedArray -} - -/** - * builds the correspoding real docker image for each Dockerfile class instance - */ -export let buildDockerfiles = async (sortedArrayArg: Dockerfile[]) => { - for (let dockerfileArg of sortedArrayArg) { - await dockerfileArg.build() - } - return sortedArrayArg -} - -/** - * pushes the real Dockerfile images to a Docker registry - */ -export let pushDockerfiles = async (sortedArrayArg: Dockerfile[]) => { - let stageArg = (function () { - if (modArgvArg._ && modArgvArg._.length >= 3) { - return modArgvArg._[ 2 ] - } else { - return NpmciEnv.buildStage - } - })() - for (let dockerfileArg of sortedArrayArg) { - await dockerfileArg.push(stageArg) - } - return sortedArrayArg -} - -/** - * pulls corresponding real Docker images for instances of Dockerfile from a registry. - * This is needed if building, testing, and publishing of Docker images is carried out in seperate CI stages. - */ -export let pullDockerfileImages = async (sortableArrayArg: Dockerfile[], registryArg = 'registry.gitlab.com') => { - for (let dockerfileArg of sortableArrayArg) { - await dockerfileArg.pull(registryArg) - } - return sortableArrayArg -} - -/** - * tests all Dockerfiles in by calling class Dockerfile.test(); - * @param sortedArrayArg Dockerfile[] that contains all Dockerfiles in cwd - */ -export let testDockerfiles = async (sortedArrayArg: Dockerfile[]) => { - for (let dockerfileArg of sortedArrayArg) { - await dockerfileArg.test() - } - return sortedArrayArg -} - -/** - * class Dockerfile represents a Dockerfile on disk in npmci - */ -export class Dockerfile { - filePath: string - repo: string - version: string - cleanTag: string - buildTag: string - gitlabTestTag: string - gitlabReleaseTag: string - releaseTag: string - containerName: string - content: string - baseImage: string - localBaseImageDependent: boolean - localBaseDockerfile: Dockerfile - constructor (options: { filePath?: string, fileContents?: string | Buffer, read?: boolean }) { - this.filePath = options.filePath - this.repo = NpmciEnv.repo.user + '/' + NpmciEnv.repo.repo - this.version = dockerFileVersion(plugins.path.parse(options.filePath).base) - this.cleanTag = this.repo + ':' + this.version - this.buildTag = this.cleanTag - this.gitlabTestTag = getDockerTagString('docker.io', this.repo, this.version, 'test') // TODO: using docker.io until gitlab is fixed - this.gitlabReleaseTag = getDockerTagString('docker.io', this.repo, this.version) // TODO: using docker.io until gitlab is fixed - - // the releaseTag determines where the image gets released - this.releaseTag = getDockerTagString('docker.io', this.repo, this.version) - - this.containerName = 'dockerfile-' + this.version - if (options.filePath && options.read) { - this.content = plugins.smartfile.fs.toStringSync(plugins.path.resolve(options.filePath)) - } - this.baseImage = dockerBaseImage(this.content) - this.localBaseImageDependent = false - } - - /** - * builds the Dockerfile - */ - async build () { - plugins.beautylog.info('now building Dockerfile for ' + this.cleanTag) - let buildCommand = `docker build -t ${this.buildTag} -f ${this.filePath} .` - await bash(buildCommand) - NpmciEnv.dockerFilesBuilt.push(this) - return - } - - /** - * pushes the Dockerfile to a registry - */ - async push (stageArg) { - await bash(`docker tag ${this.buildTag} ${this.releaseTag}`) - await bash(`docker tag ${this.buildTag} ${this.gitlabReleaseTag}`) - await bash(`docker tag ${this.buildTag} ${this.gitlabTestTag}`) - switch (stageArg) { - case 'release': - await bash(`docker push ${this.gitlabReleaseTag}`) - await bash(`docker push ${this.releaseTag}`) - break - case 'test': - default: - await bash(`docker push ${this.gitlabTestTag}`) - break - } - } - - /** - * pulls the Dockerfile from a registry - */ - async pull (registryArg: string) { - await bash(`docker pull ${this.gitlabTestTag}`) - await bash(`docker tag ${this.gitlabTestTag} ${this.buildTag}`) - } - - /** - * tests the Dockerfile; - */ - async test () { - let testFile: string = plugins.path.join(paths.NpmciTestDir, 'test_' + this.version + '.sh') - let testFileExists: boolean = plugins.smartfile.fs.fileExistsSync(testFile) - if (testFileExists) { - // run tests - await bash('docker run --name npmci_test_container ' + this.buildTag + ' mkdir /npmci_test') - await bash('docker cp ' + testFile + ' npmci_test_container:/npmci_test/test.sh') - await bash('docker commit npmci_test_container npmci_test_image') - await bash('docker run npmci_test_image sh /npmci_test/test.sh') - await bash('docker rm npmci_test_container') - await bash('docker rmi --force npmci_test_image') - } else { - plugins.beautylog.warn('skipping tests for ' + this.cleanTag + ' because no testfile was found!') - } - } - - /** - * gets the id of a Dockerfile - */ - async getId () { - let containerId = await bash('docker inspect --type=image --format=\"{{.Id}}\" ' + this.buildTag) - return containerId - } -} - -/** - * returns a version for a docker file - * @execution SYNC - */ -export let dockerFileVersion = (dockerfileNameArg: string): string => { - let versionString: string - let versionRegex = /Dockerfile_([a-zA-Z0-9\.]*)$/ - let regexResultArray = versionRegex.exec(dockerfileNameArg) - if (regexResultArray && regexResultArray.length === 2) { - versionString = regexResultArray[ 1 ] - } else { - versionString = 'latest' - } - return versionString -} - -/** - * returns the docker base image for a Dockerfile - */ -export let dockerBaseImage = function (dockerfileContentArg: string) { - let baseImageRegex = /FROM\s([a-zA-z0-9\/\-\:]*)\n?/ - let regexResultArray = baseImageRegex.exec(dockerfileContentArg) - return regexResultArray[ 1 ] -} - -/** - * returns the docker tag - */ -export let getDockerTagString = function (registryArg: string, repoArg: string, versionArg: string, suffixArg?: string): string { - // determine wether the suffix is needed - let version = versionArg - if (suffixArg) { - version = versionArg + '_' + suffixArg - } - let tagString = `${registryArg}/${repoArg}:${version}` - return tagString -} - -/** - * - */ -export let cleanTagsArrayFunction = function (dockerfileArrayArg: Dockerfile[], trackingArrayArg: Dockerfile[]): string[] { - let cleanTagsArray: string[] = [] - dockerfileArrayArg.forEach(function (dockerfileArg) { - if (trackingArrayArg.indexOf(dockerfileArg) === -1) { - cleanTagsArray.push(dockerfileArg.cleanTag) - } - }) - return cleanTagsArray -} diff --git a/ts/mod_install/mod.plugins.ts b/ts/mod_install/mod.plugins.ts deleted file mode 100644 index f9883a8..0000000 --- a/ts/mod_install/mod.plugins.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../npmci.plugins' diff --git a/ts/mod_install/index.ts b/ts/mod_node/index.ts similarity index 72% rename from ts/mod_install/index.ts rename to ts/mod_node/index.ts index 98fd6a2..bee6cda 100644 --- a/ts/mod_install/index.ts +++ b/ts/mod_node/index.ts @@ -1,10 +1,31 @@ -import * as plugins from './mod.plugins' -import * as configModule from '../npmci.config' +import * as plugins from '../npmci.plugins' +import * as npmciConfig from '../npmci.config' import { bash, bashNoError, nvmAvailable, - yarnAvailable } from '../npmci.bash' + yarnAvailable +} from '../npmci.bash' + +/** + * handle cli input + * @param argvArg + */ +export let handleCli = async (argvArg) => { + if (argvArg._.length >= 3) { + let action: string = argvArg._[1] + switch (action) { + case 'install': + await install(argvArg._[2]) + break + default: + plugins.beautylog.error(`>>npmci node ...<< action >>${action}<< not supported`) + } + } else { + plugins.beautylog.error(`>>npmci node ...<< cli arguments invalid... Please read the documentation.`) + } + +} /** * Install a specific version of node @@ -21,17 +42,17 @@ export let install = async (versionArg) => { version = '6' } else { version = versionArg - }; + } if (await nvmAvailable.promise) { await bash(`nvm install ${version} && nvm alias default ${version}`) plugins.beautylog.success(`Node version ${version} successfully installed!`) } else { plugins.beautylog.warn('Nvm not in path so staying at installed node version!') - }; + } await bash('node -v') await bash('npm -v') // lets look for further config - await configModule.getConfig() + await npmciConfig.getConfig() .then(async configArg => { plugins.beautylog.log('Now checking for needed global npm tools...') for (let npmTool of configArg.globalNpmTools) { diff --git a/ts/mod_npm/index.ts b/ts/mod_npm/index.ts new file mode 100644 index 0000000..1d78bdb --- /dev/null +++ b/ts/mod_npm/index.ts @@ -0,0 +1,64 @@ +import * as plugins from './mod.plugins' +import * as configModule from '../npmci.config' +import { + bash, + bashNoError, + nvmAvailable, + yarnAvailable +} from '../npmci.bash' + +/** + * handle cli input + * @param argvArg + */ +export let handleCli = async (argvArg) => { + if (argvArg._.length >= 2) { + let action: string = argvArg._[1] + switch (action) { + case 'install': + await install() + break + case 'prepare': + await prepare() + break + case 'test': + await test() + break + default: + plugins.beautylog.error(`>>npmci node ...<< action >>${action}<< not supported`) + } + } else { + plugins.beautylog.log(`>>npmci node ...<< cli arguments invalid... Please read the documentation.`) + } +} + +/** + * authenticates npm with token from env var + */ +let prepare = async () => { + let npmrcPrefix: string = '//registry.npmjs.org/:_authToken=' + let npmToken: string = process.env.NPMCI_TOKEN_NPM + let npmrcFileString: string = npmrcPrefix + npmToken + if (npmToken) { + plugins.beautylog.info('found access token') + } else { + plugins.beautylog.error('no access token found! Exiting!') + process.exit(1) + } + plugins.smartfile.memory.toFsSync(npmrcFileString, '/root/.npmrc') + return +} + +let install = async (): Promise => { + plugins.beautylog.info('now installing dependencies:') + if (await yarnAvailable.promise) { + await bash('yarn install') + } else { + await bash('npm install') + } +} + +export let test = async (): Promise => { + plugins.beautylog.info('now starting tests:') + await bash('yarn test') +} diff --git a/ts/mod_build/mod.plugins.ts b/ts/mod_npm/mod.plugins.ts similarity index 100% rename from ts/mod_build/mod.plugins.ts rename to ts/mod_npm/mod.plugins.ts diff --git a/ts/mod_prepare/index.ts b/ts/mod_prepare/index.ts deleted file mode 100644 index 45a2aea..0000000 --- a/ts/mod_prepare/index.ts +++ /dev/null @@ -1,99 +0,0 @@ -import * as plugins from './mod.plugins' -import { bash } from '../npmci.bash' -import * as env from '../npmci.env' -import * as npmciMods from '../npmci.mods' - -// types - -/** - * defines possible prepare services - */ -export type TPrepService = 'npm' | 'docker' | 'docker-gitlab' | 'ssh' - -/** - * authenticates npm with token from env var - */ -let npm = async () => { - let npmrcPrefix: string = '//registry.npmjs.org/:_authToken=' - let npmToken: string = process.env.NPMCI_TOKEN_NPM - let npmrcFileString: string = npmrcPrefix + npmToken - if (npmToken) { - plugins.beautylog.info('found access token') - } else { - plugins.beautylog.error('no access token found! Exiting!') - process.exit(1) - } - plugins.smartfile.memory.toFsSync(npmrcFileString, '/root/.npmrc') - return -} - -/** - * logs in docker - */ -let docker = async () => { - env.setDockerRegistry('docker.io') // TODO: checkup why we set this here - - // handle registries - plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_LOGIN_DOCKER*', async (envString) => { - let dockerRegexResultArray = envString.split('|') - if (dockerRegexResultArray.length !== 3) { - plugins.beautylog.error('malformed docker env var...') - process.exit(1) - return - } - let registry = dockerRegexResultArray[0] - let username = dockerRegexResultArray[1] - let password = dockerRegexResultArray[2] - if (registry === 'docker.io') { - await bash(`docker login -u ${username} -p ${password}`) - plugins.beautylog.info('Logged in to standard docker hub') - } else { - await bash(`docker login -u ${username} -p ${password} ${registry}`) - } - plugins.beautylog.success(`docker authenticated for ${registry}!`) - }) - - // Always login to GitLab Registry - await dockerGitlab() - return -} - -/** - * prepare docker for gitlab registry - */ -let dockerGitlab = async () => { - if (!process.env.CI_BUILD_TOKEN || process.env.CI_BUILD_TOKEN === '') { - plugins.beautylog.error('No registry token specified by gitlab!') - process.exit(1) - } - await bash(`docker login -u gitlab-ci-token -p ${process.env.CI_BUILD_TOKEN} registry.gitlab.com`) - plugins.beautylog.success(`docker authenticated for registry.gitlab.com!`) - return -} - -/** - * prepare ssh - */ -let ssh = async () => { - let sshModule = await npmciMods.modSsh.load() - await sshModule.ssh() -} - -/** - * the main exported prepare function - * @param servieArg describes the service to prepare - */ -export let prepare = async (serviceArg: TPrepService) => { - switch (serviceArg) { - case 'npm': - return await npm() - case 'docker': - return await docker() - case 'docker-gitlab': - return await dockerGitlab() - case 'ssh': - return await ssh() - default: - break - } -} diff --git a/ts/mod_prepare/mod.plugins.ts b/ts/mod_prepare/mod.plugins.ts deleted file mode 100644 index f9883a8..0000000 --- a/ts/mod_prepare/mod.plugins.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../npmci.plugins' diff --git a/ts/mod_publish/index.ts b/ts/mod_publish/index.ts deleted file mode 100644 index 0db0846..0000000 --- a/ts/mod_publish/index.ts +++ /dev/null @@ -1,54 +0,0 @@ -import * as plugins from './mod.plugins' -import { bash } from '../npmci.bash' -import * as NpmciEnv from '../npmci.env' - -import * as npmciMods from '../npmci.mods' - -// import interfaces -import { Dockerfile } from '../mod_docker/index' - - -/** - * type of supported services - */ -export type TPubService = 'npm' | 'docker' - -/** - * the main exported publish function. - * @param pubServiceArg references targeted service to publish to - */ -export let publish = async (argvArg: any) => { - let whatToPublish = argvArg._[1] - switch (whatToPublish) { - case 'docker': - return await publishDocker(argvArg) - case 'npm': - return await publishNpm(argvArg) - default: - plugins.beautylog.info('no publish target specified, thus defaulting to npm...') - return await publishNpm(argvArg) - } -} - -/** - * tries to publish current cwd to NPM registry - */ -let publishNpm = async (argvArg) => { - let modPrepare = await npmciMods.modPrepare.load() - await modPrepare.prepare('npm') - await bash('npm publish') - plugins.beautylog.ok('Done!') -} - -/** - * tries to publish current cwd to Docker registry - */ -let publishDocker = async (argvArg) => { - let modDocker = await npmciMods.modDocker.load() - return await modDocker.readDockerfiles(argvArg) - .then(modDocker.pullDockerfileImages) - .then(modDocker.pushDockerfiles) - .then(dockerfileArray => { - return dockerfileArray - }) -} diff --git a/ts/mod_publish/mod.plugins.ts b/ts/mod_publish/mod.plugins.ts deleted file mode 100644 index f9883a8..0000000 --- a/ts/mod_publish/mod.plugins.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../npmci.plugins' diff --git a/ts/mod_purge/index.ts b/ts/mod_purge/index.ts deleted file mode 100644 index ab6c173..0000000 --- a/ts/mod_purge/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -import * as plugins from './mod.plugins' - -let npmciCflare = new plugins.cflare.CflareAccount() - -export let purge = async (argvArg) => { - npmciCflare.auth({ - email: '', - key: '' - }) - npmciCflare.purgeZone(argvArg._[1]) -} diff --git a/ts/mod_purge/mod.plugins.ts b/ts/mod_purge/mod.plugins.ts deleted file mode 100644 index c18a0de..0000000 --- a/ts/mod_purge/mod.plugins.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from '../npmci.plugins' - -import * as cflare from 'cflare' - -export { - cflare -} diff --git a/ts/mod_servezone/index.ts b/ts/mod_servezone/index.ts deleted file mode 100644 index a8d18b5..0000000 --- a/ts/mod_servezone/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -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 = async (configArg) => { - new plugins.smartsocket.SmartsocketClient( - smartsocketClientConstructorOptions - ) -} diff --git a/ts/mod_ssh/index.ts b/ts/mod_ssh/index.ts index ebad308..f1581b8 100644 --- a/ts/mod_ssh/index.ts +++ b/ts/mod_ssh/index.ts @@ -1,8 +1,19 @@ import * as plugins from './mod.plugins' - -let sshRegex = /^(.*)\|(.*)\|(.*)/ let sshInstance: plugins.smartssh.SshInstance +export let handleCli = async (argvArg) => { + if (argvArg._.length >= 2) { + let action: string = argvArg._[1] + switch (action) { + case 'prepare': + await prepare() + break + default: + plugins.beautylog.error(`action >>${action}<< not supported`) + } + } +} + /** * checks if not undefined */ @@ -13,7 +24,7 @@ let notUndefined = (stringArg: string) => { /** * checks for ENV vars in form of NPMCI_SSHKEY_* and deploys any found ones */ -export let ssh = async () => { +export let prepare = async () => { sshInstance = new plugins.smartssh.SshInstance() // init ssh instance plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_SSHKEY_*', evaluateSshEnv) if (!process.env.NPMTS_TEST) { @@ -26,21 +37,21 @@ export let ssh = async () => { /** * gets called for each found SSH ENV Var and deploys it */ -let evaluateSshEnv = async (sshkeyEnvVarArg) => { - let resultArray = sshRegex.exec(sshkeyEnvVarArg) +let evaluateSshEnv = async (sshkeyEnvVarArg: string) => { + let sshEnvArray = sshkeyEnvVarArg.split('|') let sshKey = new plugins.smartssh.SshKey() - plugins.beautylog.info('Found SSH identity for ' + resultArray[1]) - if (notUndefined(resultArray[1])) { + plugins.beautylog.info('Found SSH identity for ' + sshEnvArray[1]) + if (notUndefined(sshEnvArray[0])) { plugins.beautylog.log('---> host defined!') - sshKey.host = resultArray[1] + sshKey.host = sshEnvArray[0] } - if (notUndefined(resultArray[2])) { + if (notUndefined(sshEnvArray[1])) { plugins.beautylog.log('---> privKey defined!') - sshKey.privKeyBase64 = resultArray[2] + sshKey.privKeyBase64 = sshEnvArray[1] } - if (notUndefined(resultArray[3])) { + if (notUndefined(sshEnvArray[2])) { plugins.beautylog.log('---> pubKey defined!') - sshKey.pubKeyBase64 = resultArray[3] + sshKey.pubKeyBase64 = sshEnvArray[2] } sshInstance.addKey(sshKey) diff --git a/ts/mod_test/index.ts b/ts/mod_test/index.ts deleted file mode 100644 index e4efaa5..0000000 --- a/ts/mod_test/index.ts +++ /dev/null @@ -1,45 +0,0 @@ -import * as plugins from './mod.plugins' -import { bash, yarnAvailable } from '../npmci.bash' -import * as env from '../npmci.env' -import * as npmciMods from '../npmci.mods' - -// interfaces -import { Dockerfile } from '../mod_docker/index' - -let npmDependencies = async (): Promise => { - plugins.beautylog.info('now installing dependencies:') - if (await yarnAvailable.promise) { - await bash('yarn install') - } else { - await bash('npm install') - } -} - -let npmTest = async (): Promise => { - plugins.beautylog.info('now starting tests:') - await bash('npm test') -} - -let testDocker = async (argvArg): Promise => { - let modDocker = await npmciMods.modDocker.load() - return await modDocker.readDockerfiles(argvArg) - .then(modDocker.pullDockerfileImages) - .then(modDocker.testDockerfiles) -} - -/** - * the main test function - * @param versionArg - */ -export let test = async (argvArg): Promise => { - let whatToTest = argvArg._[1] - if (whatToTest === 'docker') { - await testDocker(argvArg) - } else { - let modInstall = await npmciMods.modInstall.load() - await modInstall.install(whatToTest) - .then(npmDependencies) - .then(npmTest) - } -} - diff --git a/ts/mod_test/mod.plugins.ts b/ts/mod_test/mod.plugins.ts deleted file mode 100644 index f9883a8..0000000 --- a/ts/mod_test/mod.plugins.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../npmci.plugins' diff --git a/ts/npmci.cli.ts b/ts/npmci.cli.ts index b5bf875..7769d2d 100644 --- a/ts/npmci.cli.ts +++ b/ts/npmci.cli.ts @@ -10,17 +10,6 @@ import * as npmciMods from './npmci.mods' let smartcli = new plugins.smartcli.Smartcli() smartcli.addVersion(npmciInfo.version) -// build -smartcli.addCommand('build') - .then(async argvArg => { - let modBuild = await npmciMods.modBuild.load() - await modBuild.build(argvArg) - NpmciEnv.configStore() - }).catch(err => { - console.log(err) - process.exit(1) - }) - // clean smartcli.addCommand('clean') .then(async (argv) => { @@ -32,6 +21,16 @@ smartcli.addCommand('clean') process.exit(1) }) +// cloudflare +smartcli.addCommand('cloudflare') +.then(async (argvArg) => { + let modPurge = await npmciMods.modCloudflare.load() + await modPurge.handleCli(argvArg) + await NpmciEnv.configStore() +}).catch(err => { + console.log(err) +}) + // command smartcli.addCommand('command') .then(async (argv) => { @@ -43,54 +42,42 @@ smartcli.addCommand('command') process.exit(1) }) -// purge -smartcli.addCommand('purge') +// build +smartcli.addCommand('docker') + .then(async argvArg => { + let modDocker = await npmciMods.modDocker.load() + await modDocker.handleCli(argvArg) + NpmciEnv.configStore() + }).catch(err => { + console.log(err) + process.exit(1) + }) + +// node +smartcli.addCommand('node') .then(async (argvArg) => { - let modPurge = await npmciMods.modPurge.load() - await modPurge.purge(argvArg) - }).catch(err => { - console.log(err) - }) - -// install -smartcli.addCommand('install') - .then(async (argv) => { - let modInstall = await npmciMods.modInstall.load() - await modInstall.install(argv._[1]) + let modNode = await npmciMods.modNode.load() + await modNode.handleCli(argvArg) await NpmciEnv.configStore() }).catch(err => { console.log(err) - process.exit(1) }) -// prepare -smartcli.addCommand('prepare') - .then(async argvArg => { - let modPrepare = await npmciMods.modPrepare.load() - await modPrepare.prepare(argvArg._[1]) +// npm +smartcli.addCommand('npm') + .then(async (argvArg) => { + let modNpm = await npmciMods.modNpm.load() + await modNpm.handleCli(argvArg) await NpmciEnv.configStore() }).catch(err => { console.log(err) - process.exit(1) }) -// publish -smartcli.addCommand('publish') - .then(async argvArg => { - let modPublish = await npmciMods.modPublish.load() - await modPublish.publish(argvArg) - await NpmciEnv.configStore() - - }).catch(err => { - console.log(err) - process.exit(1) - }) - -// test -smartcli.addCommand('test') - .then(async (argv) => { - let modTest = await npmciMods.modTest.load() - await modTest.test(argv) +// trigger +smartcli.addCommand('ssh') + .then(async (argvArg) => { + let modSsh = await npmciMods.modSsh.load() + await modSsh.handleCli(argvArg) await NpmciEnv.configStore() }).catch(err => { console.log(err) diff --git a/ts/npmci.mods.ts b/ts/npmci.mods.ts index ee1a3be..1ebbeb9 100644 --- a/ts/npmci.mods.ts +++ b/ts/npmci.mods.ts @@ -1,25 +1,19 @@ -import * as _modBuild from './mod_build/index' import * as _modClean from './mod_clean/index' +import * as _modCloudflare from './mod_cloudflare/index' import * as _modCommand from './mod_command/index' import * as _modDocker from './mod_docker/index' -import * as _modInstall from './mod_install/index' -import * as _modPublish from './mod_publish/index' -import * as _modPurge from './mod_purge/index' -import * as _modPrepare from './mod_prepare/index' +import * as _modNpm from './mod_npm/index' +import * as _modNode from './mod_node/index' import * as _modSsh from './mod_ssh/index' import * as _modTrigger from './mod_trigger/index' -import * as _modTest from './mod_test/index' import { LazyModule } from 'smartsystem' -export let modBuild = new LazyModule('./mod_build/index', __dirname) export let modClean = new LazyModule('./mod_clean/index', __dirname) +export let modCloudflare = new LazyModule('./mod_cloudflare/index', __dirname) export let modCommand = new LazyModule('./mod_command/index', __dirname) export let modDocker = new LazyModule('./mod_docker/index', __dirname) -export let modInstall = new LazyModule('./mod_install/index', __dirname) -export let modPublish = new LazyModule('./mod_publish/index', __dirname) -export let modPurge = new LazyModule('./mod_purge/index', __dirname) -export let modPrepare = new LazyModule('./mod_prepare/index', __dirname) +export let modNode = new LazyModule('./mod_node/index', __dirname) +export let modNpm = new LazyModule('./mod_npm/index', __dirname) export let modSsh = new LazyModule('./mod_ssh/index', __dirname) export let modTrigger = new LazyModule('./mod_trigger/index', __dirname) -export let modTest = new LazyModule('./mod_test/index',__dirname)