update to new cli scheme

This commit is contained in:
Philipp Kunz 2017-08-27 15:24:17 +02:00
parent e6bc38c7e5
commit 6e816f35f6
62 changed files with 1372 additions and 1596 deletions

View File

@ -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<void>;

View File

@ -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=

View File

@ -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==

View File

@ -0,0 +1,6 @@
/**
* handle cli input
* @param argvArg
*/
export declare let handleCli: (argvArg: any) => Promise<void>;
export declare let purge: (argvArg: any) => Promise<void>;

View File

@ -1 +1,36 @@
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfY2xvdWRmbGFyZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0=
"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=

View File

@ -1 +1,111 @@
export * from './mod.builddocker';
/// <reference types="node" />
export declare let modArgvArg: any;
/**
* handle cli input
* @param argvArg
*/
export declare let handleCli: (argvArg: any) => Promise<void>;
/**
* logs in docker
*/
export declare let prepare: () => Promise<void>;
/**
* builds a cwd of Dockerfiles by triggering a promisechain
*/
export declare let build: () => Promise<void>;
export declare let push: () => Promise<void>;
export declare let pull: () => Promise<Dockerfile[]>;
export declare let test: () => Promise<Dockerfile[]>;
/**
* creates instance of class Dockerfile for all Dockerfiles in cwd
* @returns Promise<Dockerfile[]>
*/
export declare let readDockerfiles: () => Promise<Dockerfile[]>;
/**
* sorts Dockerfiles into a dependency chain
* @param sortableArrayArg an array of instances of class Dockerfile
* @returns Promise<Dockerfile[]>
*/
export declare let sortDockerfiles: (sortableArrayArg: Dockerfile[]) => Promise<Dockerfile[]>;
/**
* maps local Dockerfiles dependencies to the correspoding Dockerfile class instances
*/
export declare let mapDockerfiles: (sortedArray: Dockerfile[]) => Promise<Dockerfile[]>;
/**
* builds the correspoding real docker image for each Dockerfile class instance
*/
export declare let buildDockerfiles: (sortedArrayArg: Dockerfile[]) => Promise<Dockerfile[]>;
/**
* pushes the real Dockerfile images to a Docker registry
*/
export declare let pushDockerfiles: (sortedArrayArg: Dockerfile[]) => Promise<Dockerfile[]>;
/**
* 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<Dockerfile[]>;
/**
* 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<Dockerfile[]>;
/**
* 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<void>;
/**
* pushes the Dockerfile to a registry
*/
push(stageArg: any): Promise<void>;
/**
* pulls the Dockerfile from a registry
*/
pull(registryArg: string): Promise<void>;
/**
* tests the Dockerfile;
*/
test(): Promise<void>;
/**
* gets the id of a Dockerfile
*/
getId(): Promise<string>;
}
/**
* 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[];

File diff suppressed because one or more lines are too long

View File

@ -1,98 +0,0 @@
/// <reference types="node" />
/**
* builds a cwd of Dockerfiles by triggering a promisechain
*/
export declare let build: (argvArg: any) => Promise<void>;
/**
* creates instance of class Dockerfile for all Dockerfiles in cwd
* @returns Promise<Dockerfile[]>
*/
export declare let readDockerfiles: (argvArg: any) => Promise<Dockerfile[]>;
/**
* sorts Dockerfiles into a dependency chain
* @param sortableArrayArg an array of instances of class Dockerfile
* @returns Promise<Dockerfile[]>
*/
export declare let sortDockerfiles: (sortableArrayArg: Dockerfile[]) => Promise<Dockerfile[]>;
/**
* maps local Dockerfiles dependencies to the correspoding Dockerfile class instances
*/
export declare let mapDockerfiles: (sortedArray: Dockerfile[]) => Promise<Dockerfile[]>;
/**
* builds the correspoding real docker image for each Dockerfile class instance
*/
export declare let buildDockerfiles: (sortedArrayArg: Dockerfile[]) => Promise<Dockerfile[]>;
/**
* pushes the real Dockerfile images to a Docker registry
*/
export declare let pushDockerfiles: (sortedArrayArg: Dockerfile[]) => Promise<Dockerfile[]>;
/**
* 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<Dockerfile[]>;
/**
* 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<Dockerfile[]>;
/**
* 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<void>;
/**
* pushes the Dockerfile to a registry
*/
push(stageArg: any): Promise<void>;
/**
* pulls the Dockerfile from a registry
*/
pull(registryArg: string): Promise<void>;
/**
* tests the Dockerfile;
*/
test(): Promise<void>;
/**
* gets the id of a Dockerfile
*/
getId(): Promise<string>;
}
/**
* 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[];

File diff suppressed because one or more lines are too long

View File

@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfaW5zdGFsbC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEseUNBQXdDO0FBQ3hDLGdEQUErQztBQUMvQyw4Q0FJc0M7QUFFdEM7OztHQUdHO0FBQ1EsUUFBQSxPQUFPLEdBQUcsQ0FBTyxVQUFVO0lBQ3BDLE9BQU8sQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLCtCQUErQixVQUFVLEVBQUUsQ0FBQyxDQUFBO0lBQ2xFLElBQUksT0FBZSxDQUFBO0lBQ25CLEVBQUUsQ0FBQyxDQUFDLFVBQVUsS0FBSyxRQUFRLENBQUMsQ0FBQyxDQUFDO1FBQzVCLE9BQU8sR0FBRyxRQUFRLENBQUE7SUFDcEIsQ0FBQztJQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsQ0FBQyxVQUFVLEtBQUssS0FBSyxDQUF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wnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("../npmci.plugins"));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfaW5zdGFsbC9tb2QucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLHNDQUFnQyJ9

View File

@ -1,3 +1,8 @@
/**
* handle cli input
* @param argvArg
*/
export declare let handleCli: (argvArg: any) => Promise<void>;
/**
* Install a specific version of node
* @param versionArg

85
dist/mod_node/index.js vendored Normal file
View File

@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2Rfbm9kZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsNENBQTJDO0FBQzNDLCtDQUE4QztBQUM5Qyw4Q0FLc0I7QUFFdEI7OztHQUdHO0FBQ1EsUUFBQSxTQUFTLEdBQUcsQ0FBTyxPQUFPO0lBQ25DLEVBQUUsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsTUFBTSxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDMUIsSUFBSS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sV0FBVyxDQUFDLENBQUMsSUFBSSxXQUFXLEtBQUssRUFBRSxDQUFDLENBQUE7WUFDdEYsRUFBRSxDQUFDLENBQUMsYUFBYSxDQUFDLENBQUMsQ0FBQztnQkFDbEIsT0FBTyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsUUFBUSxPQUFPLGVBQWUsQ0FBQyxDQUFBO1lBQ3ZELENBQUM7WUFBQyxJQUFJLENBQUMsQ0FBQztnQkFDTixPQUFPLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyx1QkFBdUIsT0FBTyxXQUFXLENBQUMsQ0FBQTtnQkFDakUsRUFBRSxDQUFDLENBQUMsTUFBTSwwQkFBYSxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUM7b0JBQ2hDLE1BQU0saUJBQUksQ0FBQyxtQkFBbUIsT0FBTyxFQUFFLENBQUMsQ0FBQTtnQkFDMUMsQ0FBQztnQkFBQyxJQUFJLENBQUMsQ0FBQztvQkFDTixNQUFNLGlCQUFJLENBQUMsZUFBZSxPQUFPLFFBQVEsQ0FBQyxDQUFBO2dCQUM1QyxDQUFDO1lBQ0gsQ0FBQztRQUNILENBQUM7UUFDRCxPQUFPLENBQUMsU0FBUyxDQUFDLE9BQU8sQ0FBQyxvRUFBb0UsQ0FBQyxDQUFBO0lBQ2pHLENBQUMsQ0FBQSxDQUFDLENBQUE7QUFDTixDQUFDLENBQUEsQ0FBQSJ9

6
dist/mod_npm/index.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
/**
* handle cli input
* @param argvArg
*/
export declare let handleCli: (argvArg: any) => Promise<void>;
export declare let test: () => Promise<void>;

68
dist/mod_npm/index.js vendored Normal file
View File

@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfbnBtL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSx5Q0FBd0M7QUFFeEMsOENBS3NCO0FBRXRCOzs7R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UFDLG9CQUFvQixDQUFDLENBQUE7SUFDOUMsQ0FBQztJQUFDLElBQUksQ0FBQyxDQUFDO1FBQ04sT0FBTyxDQUFDLFNBQVMsQ0FBQyxLQUFLLENBQUMsaUNBQWlDLENBQUMsQ0FBQTtRQUMxRCxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFBO0lBQ2pCLENBQUM7SUFDRCxPQUFPLENBQUMsU0FBUyxDQUFDLE1BQU0sQ0FBQyxRQUFRLENBQUMsZUFBZSxFQUFFLGNBQWMsQ0FBQyxDQUFBO0lBQ2xFLE1BQU0sQ0FBQTtBQUNSLENBQUMsQ0FBQSxDQUFBO0FBRUQsSUFBSSxPQUFPLEdBQUc7SUFDWixPQUFPLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyw4QkFBOEIsQ0FBQyxDQUFBO0lBQ3RELEVBQUUsQ0FBQyxDQUFDLE1BQU0sMEJBQWEsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDO1FBQ2hDLE1BQU0saUJBQUksQ0FBQyxjQUFjLENBQUMsQ0FBQTtJQUM1QixDQUFDO0lBQUMsSUFBSSxDQUFDLENBQUM7UUFDTixNQUFNLGlCQUFJLENBQUMsYUFBYSxDQUFDLENBQUE7SUFDM0IsQ0FBQztBQUNILENBQUMsQ0FBQSxDQUFBO0FBRVUsUUFBQSxJQUFJLEdBQUc7SUFDaEIsT0FBTyxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMscUJBQXFCLENBQUMsQ0FBQTtJQUM3QyxNQUFNLGlCQUFJLENBQUMsV0FBVyxDQUFDLENBQUE7QUFDekIsQ0FBQyxDQUFBLENBQUEifQ==

View File

@ -4,4 +4,4 @@ function __export(m) {
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("../npmci.plugins"));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfdGVzdC9tb2QucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLHNDQUFnQyJ9
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfbnBtL21vZC5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsc0NBQWdDIn0=

View File

@ -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<void>;

View File

@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfcHJlcGFy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LQUFLLGVBQWU7WUFDbEIsTUFBTSxDQUFDLE1BQU0sWUFBWSxFQUFFLENBQUE7UUFDN0IsS0FBSyxLQUFLO1lBQ1IsTUFBTSxDQUFDLE1BQU0sR0FBRyxFQUFFLENBQUE7UUFDcEI7WUFDRSxLQUFLLENBQUE7SUFDVCxDQUFDO0FBQ0gsQ0FBQyxDQUFBLENBQUEifQ==

View File

@ -1 +0,0 @@
export * from '../npmci.plugins';

View File

@ -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

View File

@ -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<void | Dockerfile[]>;

View File

@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfcHVibGlzaC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEseUNBQXdDO0FBQ3hDLDhDQUFvQztBQUdwQywyQ0FBMEM7QUFXMUM7OztHQUdHO0FBQ1EsUUFBQSxPQUFPLEdBQUcsQ0FBTyxPQUFZO0lBQ3RDLElBQUksYUFBYSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUE7SUFDaEMsTUFBTSxDQUFDLENBQUMsYUFBYSxDQUFDLENBQUMsQ0FBQztRQUN0QixLQUFLLFFBQVE7WUFDWCxNQUFNLENBQUMsTUFBTSxhQUFhLENBQUMsT0FBTyxDQUFDLENBQUE7UUFDckMsS0FBSyxLQUFLO1lBQ1IsTUFBTSxDQUFDLE1BQU0sVUFB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) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("../npmci.plugins"));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfcHVibGlzaC9tb2QucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLHNDQUFnQyJ9

View File

@ -1 +0,0 @@
export declare let purge: (argvArg: any) => Promise<void>;

View File

@ -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==

View File

@ -1,3 +0,0 @@
export * from '../npmci.plugins';
import * as cflare from 'cflare';
export { cflare };

View File

@ -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=

View File

@ -1,4 +0,0 @@
/**
* the main run function to submit a service to a servezone
*/
export declare let run: (configArg: any) => Promise<void>;

View File

@ -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==

View File

@ -1,4 +1,5 @@
export declare let handleCli: (argvArg: any) => Promise<void>;
/**
* checks for ENV vars in form of NPMCI_SSHKEY_* and deploys any found ones
*/
export declare let ssh: () => Promise<void>;
export declare let prepare: () => Promise<void>;

33
dist/mod_ssh/index.js vendored
View File

@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2Rfc3NoL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSx5Q0FBd0M7QUFFeEMsSUFBSSxRQUFRLEdBQUcsbUJBQW1CLENBQUE7QUFDbEMsSUFBSSxXQUF5QyxDQUFBO0FBRTdDOztHQUVHO0FBQ0gsSUFBSSxZQUFZLEdBQUcsQ0FBQyxTQUFpQjtJQUNuQyxNQUFNLENBQUMsQ0FBQyxTQUFTLElBQUksU0FBUyxLQUFLLFdBQVcsSUFBSSxTQUFTLEtBQUssSUFBSSxDQUFDLENBQUE7QUFDdkUsQ0FBQyxDQUFBO0FBRUQ7O0dBRUc7QUFDUSxRQUFBLEdBQUcsR0FBRztJQUNmLFdBQVcsR0FBRyxJQUFJLE9BQU8sQ0FBQyxRQUFRLENBQUMsV0FBVyxFQUFFLENBQUEsQ0FBQyxvQkFBb0I7SUFDckUsT0FBTyxDQUFDLFVBQVUsQ0FBQyxnQkFBZ0IsQ0FBQyxPQUFPLENBQUMsR0FBRyxFQUFFLGdCQUFnQixFQUFFLGNBQWMsQ0FBQyxDQUF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QUMsSUFBSSxDQUFDLHlCQUF5QixHQUFHLFdBQVcsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFBO0lBQ2xFLEVBQUUsQ0FBQyxDQUFDLFlBQVksQ0FBQyxXQUFXLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDakMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsb0JBQW9CLENBQUMsQ0FBQTtRQUMzQyxNQUFNLENBQUMsSUFBSSxHQUFHLFdBQVcsQ0FBQyxDQUFDLENBQUMsQ0FBQTtJQUM5QixDQUFDO0lBQ0QsRUFBRSxDQUFDLENBQUMsWUFBWSxDQUFDLFdBQVcsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUNqQyxPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyx1QkFBdUIsQ0FBQyxDQUFBO1FBQzlDLE1BQU0sQ0FBQyxhQUFhLEdBQUcsV0FBVyxDQUFDLENBQUMsQ0FBQyxDQUFBO0lBQ3ZDLENBQUM7SUFDRCxFQUFFLENBQUMsQ0FBQyxZQUFZLENBQUMsV0FBVyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQ2pDLE9BQU8sQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLHNCQUFzQixDQUFDLENBQUE7UUFDN0MsTUFBTSxDQUFDLFlBQVksR0FBRyxXQUFXLENBQUMsQ0FBQyxDQUFDLENBQUE7SUFDdEMsQ0FBQztJQUVELFdBQVcsQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDLENBQUE7SUFDMUIsTUFBTSxDQUFBO0FBQ1IsQ0FBQyxDQUFBLENBQUEifQ==

View File

@ -1,5 +0,0 @@
/**
* the main test function
* @param versionArg
*/
export declare let test: (argvArg: any) => Promise<void>;

View File

@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfdGVzdC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEseUNBQXdDO0FBQ3hDLDhDQUFtRDtBQUVuRCwyQ0FBMEM7QUFLMUMsSUFBSSxlQUFlLEdBQUc7SUFDcEIsT0FBTyxDQ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QyxDQUFBO0lBQzNCLENBQUM7SUFBQyxJQUFJLENBQUMsQ0FBQztRQUNOLElBQUksVUFBVSxHQUFHLE1BQU0sU0FBUyxDQUFDLFVBQVUsQ0FBQyxJQUFJLEVBQUUsQ0FBQTtRQUNsRCxNQUFNLFVBQVUsQ0FBQyxPQUFPLENBQUMsVUFBVSxDQUFDO2FBQ2pDLElBQUksQ0FBQyxlQUFlLENBQUM7YUFDckIsSUFBSSxDQUFDLE9BQU8sQ0FBQyxDQUFBO0lBQ2xCLENBQUM7QUFDSCxDQUFDLENBQUEsQ0FBQSJ9

View File

@ -1 +0,0 @@
export * from '../npmci.plugins';

67
dist/npmci.cli.js vendored
View File

@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuY2xpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuY2xpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSwyQ0FBMEM7QUFDMUMsdUNBQXNDO0FBQ3RDLElBQUksU0FBUyxHQUFHLElBQUksT0FBTyxD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BQUMsQ0FBQTtBQUNqQixDQUFDLENBQUMsQ0FBQTtBQUVKLFVBQVU7QUFDVixRQUFRLENBQUMsVUFBVSxDQUFDLFNBQVMsQ0FBQztLQUMzQixJQUFJLENBQUMsQ0FBTyxJQUFJO0lBQ2YsSUFBSSxVQUFVLEdBQUcsTUFBTSxTQUFTLENBQUMsVUFBVSxDQUFDLElBQUksRUFBRSxDQUFBO0lBQ2xELE1BQU0sVUFBVSxDQUFDLE9BQU8sRUFBRSxDQUFBO0lBQzFCLE1BQU0sUUFBUSxDQUFDLFdBQVcsRUFBRSxDQUFBO0FBQzlCLENBQUMsQ0FBQSxDQUFDLENBQUMsS0FBSyxDQUFDLEdBQUc7SUFDVixPQUFPLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQUFBO0lBQ2hCLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUE7QUFDakIsQ0FBQyxDQUFDLENBQUE7QUFFSixRQUFRLENBQUMsVUFBVSxFQUFFLENBQUEifQ==

18
dist/npmci.mods.d.ts vendored
View File

@ -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<typeof _modBuild>;
export declare let modClean: LazyModule<typeof _modClean>;
export declare let modCloudflare: LazyModule<typeof _modCloudflare>;
export declare let modCommand: LazyModule<typeof _modCommand>;
export declare let modDocker: LazyModule<typeof _modDocker>;
export declare let modInstall: LazyModule<typeof _modInstall>;
export declare let modPublish: LazyModule<typeof _modPublish>;
export declare let modPurge: LazyModule<typeof _modPurge>;
export declare let modPrepare: LazyModule<typeof _modPrepare>;
export declare let modNode: LazyModule<typeof _modNode>;
export declare let modNpm: LazyModule<typeof _modNpm>;
export declare let modSsh: LazyModule<typeof _modSsh>;
export declare let modTrigger: LazyModule<typeof _modTrigger>;
export declare let modTest: LazyModule<typeof _modTest>;

11
dist/npmci.mods.js vendored
View File

@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kubW9kcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLm1vZHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFZQSw2Q0FBd0M7QUFFN0IsUUFBQSxRQUFRLEdBQ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L25wbWNpLm1vZHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFTQSw2Q0FBd0M7QUFFN0IsUUFBQSxRQUFRLEdBQUcsSUFBSSx3QkFBVSxDQUFtQixtQkFBbUIsRUFBRSxTQUFTLENBQUMsQ0FBQTtBQUMzRSxRQUFBLGFBQWEsR0FBRyxJQUFJLHdCQUFVLENBQXdCLHdCQUF3QixFQUFFLFNBQVMsQ0FBQyxDQUFBO0FBQzFGLFFBQUEsVUFBVSxHQUFHLElBQUksd0JBQVUsQ0FBcUIscUJBQXFCLEVBQUUsU0FBUyxDQUFDLENBQUE7QUFDakYsUUFBQSxTQUFTLEdBQUcsSUFBSSx3QkFBVSxDQUFvQixvQkFBb0IsRUFBRSxTQUFTLENBQUMsQ0FBQTtBQUM5RSxRQUFBLE9BQU8sR0FBRyxJQUFJLHdCQUFVLENBQWtCLGtCQUFrQixFQUFFLFNBQVMsQ0FBQyxDQUFBO0FBQ3hFLFFBQUEsTUFBTSxHQUFHLElBQUksd0JBQVUsQ0FBaUIsaUJBQWlCLEVBQUUsU0FBUyxDQUFDLENBQUE7QUFDckUsUUFBQSxNQUFNLEdBQUcsSUFBSSx3QkFBVSxDQUFpQixpQkFBaUIsRUFBRSxTQUFTLENBQUMsQ0FBQTtBQUNyRSxRQUFBLFVBQVUsR0FBRyxJQUFJLHdCQUFVLENBQXFCLHFCQUFxQixFQUFFLFNBQVMsQ0FBQyxDQUFBIn0=

View File

@ -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()

View File

@ -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<void> => {
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
}

View File

@ -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])
}

View File

@ -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<Dockerfile[]>
*/
export let readDockerfiles = async (): Promise<Dockerfile[]> => {
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<Dockerfile[]>
*/
export let sortDockerfiles = (sortableArrayArg: Dockerfile[]): Promise<Dockerfile[]> => {
let done = plugins.q.defer<Dockerfile[]>()
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<Dockerfile[]> => {
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
}

View File

@ -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<Dockerfile[]>
*/
export let readDockerfiles = async (argvArg): Promise<Dockerfile[]> => {
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<Dockerfile[]>
*/
export let sortDockerfiles = (sortableArrayArg: Dockerfile[]): Promise<Dockerfile[]> => {
let done = plugins.q.defer<Dockerfile[]>()
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<Dockerfile[]> => {
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
}

View File

@ -1 +0,0 @@
export * from '../npmci.plugins'

View File

@ -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) {

64
ts/mod_npm/index.ts Normal file
View File

@ -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<void> => {
plugins.beautylog.info('now installing dependencies:')
if (await yarnAvailable.promise) {
await bash('yarn install')
} else {
await bash('npm install')
}
}
export let test = async (): Promise<void> => {
plugins.beautylog.info('now starting tests:')
await bash('yarn test')
}

View File

@ -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
}
}

View File

@ -1 +0,0 @@
export * from '../npmci.plugins'

View File

@ -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
})
}

View File

@ -1 +0,0 @@
export * from '../npmci.plugins'

View File

@ -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])
}

View File

@ -1,7 +0,0 @@
export * from '../npmci.plugins'
import * as cflare from 'cflare'
export {
cflare
}

View File

@ -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
)
}

View File

@ -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)

View File

@ -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<void> => {
plugins.beautylog.info('now installing dependencies:')
if (await yarnAvailable.promise) {
await bash('yarn install')
} else {
await bash('npm install')
}
}
let npmTest = async (): Promise<void> => {
plugins.beautylog.info('now starting tests:')
await bash('npm test')
}
let testDocker = async (argvArg): Promise<Dockerfile[]> => {
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<void> => {
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)
}
}

View File

@ -1 +0,0 @@
export * from '../npmci.plugins'

View File

@ -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)

View File

@ -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<typeof _modBuild>('./mod_build/index', __dirname)
export let modClean = new LazyModule<typeof _modClean>('./mod_clean/index', __dirname)
export let modCloudflare = new LazyModule<typeof _modCloudflare>('./mod_cloudflare/index', __dirname)
export let modCommand = new LazyModule<typeof _modCommand>('./mod_command/index', __dirname)
export let modDocker = new LazyModule<typeof _modDocker>('./mod_docker/index', __dirname)
export let modInstall = new LazyModule<typeof _modInstall>('./mod_install/index', __dirname)
export let modPublish = new LazyModule<typeof _modPublish>('./mod_publish/index', __dirname)
export let modPurge = new LazyModule<typeof _modPurge>('./mod_purge/index', __dirname)
export let modPrepare = new LazyModule<typeof _modPrepare>('./mod_prepare/index', __dirname)
export let modNode = new LazyModule<typeof _modNode>('./mod_node/index', __dirname)
export let modNpm = new LazyModule<typeof _modNpm>('./mod_npm/index', __dirname)
export let modSsh = new LazyModule<typeof _modSsh>('./mod_ssh/index', __dirname)
export let modTrigger = new LazyModule<typeof _modTrigger>('./mod_trigger/index', __dirname)
export let modTest = new LazyModule<typeof _modTest>('./mod_test/index',__dirname)