This commit is contained in:
Philipp Kunz 2016-11-24 23:21:40 +01:00
parent 09c7dae079
commit 299d2567f8
44 changed files with 664 additions and 608 deletions

8
dist/index.d.ts vendored
View File

@ -1,4 +1,4 @@
import "typings-global";
export { build } from "./npmci.build";
export { install } from "./npmci.install";
export { publish } from "./npmci.publish";
import 'typings-global';
export { build } from './npmci.build';
export { install } from './npmci.install';
export { publish } from './npmci.publish';

20
dist/index.js vendored
View File

@ -4,7 +4,7 @@ require("typings-global");
const plugins = require("./npmci.plugins");
const paths = require("./npmci.paths");
let npmciInfo = new plugins.projectinfo.ProjectinfoNpm(paths.NpmciPackageRoot);
plugins.beautylog.log("npmci version: " + npmciInfo.version);
plugins.beautylog.log('npmci version: ' + npmciInfo.version);
const npmci_build_1 = require("./npmci.build");
const npmci_clean_1 = require("./npmci.clean");
const npmci_command_1 = require("./npmci.command");
@ -24,58 +24,58 @@ let smartcli = new plugins.smartcli.Smartcli();
smartcli.addVersion(npmciInfo.version);
// build
smartcli.addCommand({
commandName: "build"
commandName: 'build'
}).then((argv) => {
npmci_build_1.build(argv._[1])
.then(NpmciEnv.configStore);
});
// clean
smartcli.addCommand({
commandName: "clean"
commandName: 'clean'
}).then((argv) => {
npmci_clean_1.clean()
.then(NpmciEnv.configStore);
});
// command
smartcli.addCommand({
commandName: "command"
commandName: 'command'
}).then((argv) => {
npmci_command_1.command()
.then(NpmciEnv.configStore);
});
// install
smartcli.addCommand({
commandName: "install"
commandName: 'install'
}).then((argv) => {
npmci_install_1.install(argv._[1])
.then(NpmciEnv.configStore);
});
// prepare
smartcli.addCommand({
commandName: "prepare"
commandName: 'prepare'
}).then((argv) => {
npmci_prepare_1.prepare(argv._[1])
.then(NpmciEnv.configStore);
});
// publish
smartcli.addCommand({
commandName: "publish"
commandName: 'publish'
}).then((argv) => {
npmci_publish_1.publish(argv._[1])
.then(NpmciEnv.configStore);
});
// test
smartcli.addCommand({
commandName: "test"
commandName: 'test'
}).then((argv) => {
npmci_test_1.test(argv._[1])
.then(NpmciEnv.configStore);
});
// trigger
smartcli.addCommand({
commandName: "trigger"
commandName: 'trigger'
}).then((argv) => {
npmci_trigger_1.trigger();
});
smartcli.startParse();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUNBLDBCQUF3QjtBQUN4QiwyQ0FBMkM7QUFDM0MsdUNBQXVDO0FBQ3ZDLElBQUksU0FBUyxHQUFHLElBQUksT0FBTyxDQUFDLFdBQVcsQ0FBQyxjQUFjLENBQUMsS0FBSyxDQUFDLGdCQUFnQixDQUFDLENBQUM7QUFDL0UsT0FBTyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsaUJBQWlCLEdBQUcsU0FBUyxDQUFDLE9BQU8sQ0FBQyxDQUFDO0FBRTdELCtDQUFtQztBQUNuQywrQ0FBb0M7QUFDcEMsbURBQXdDO0FBQ3hDLG1EQUF3QztBQUN4QyxtREFBd0M7QUFDeEMsbURBQXdDO0FBQ3hDLDZDQUFrQztBQUNsQyxtREFBd0M7QUFDeEMsd0NBQXdDO0FBRXhDLDZDQUFtQztBQUEzQiw4QkFBQSxLQUFLLENBQUE7QUFDYixpREFBd0M7QUFBaEMsa0NBQUEsT0FBTyxDQUFBO0FBQ2YsaURBQXdDO0FBQWhDLGtDQUFBLE9BQU8sQ0FBQTtBQUdmLElBQUksUUFBUSxHQUFHLElBQUksT0FBTyxDQUFDLFFBQVEsQ0FBQyxRQUFRLEVBQUUsQ0FBQztBQUMvQyxRQUFRLENBQUMsVUFBVSxDQUFDLFNBQVMsQ0FBQyxPQUFPLENBQUMsQ0FBQztBQUV2QyxRQUFRO0FBQ1IsUUFBUSxDQUFDLFVBQVUsQ0FBQztJQUNoQixXQUFXLEVBQUMsT0FBTztDQUN0QixDQUFDLENBQUMsSUFBSSxDQ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0FBQyxJQUFJLENBQUMsQ0FBQyxJQUFJO0lBQ1QsdUJBQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO1NBQ2IsSUFBSSxDQUFDLFFBQVEsQ0FBQyxXQUFXLENBQUMsQ0FBQTtBQUNuQyxDQUFDLENBQUMsQ0FBQTtBQUVGLE9BQU87QUFDUCxRQUFRLENBQUMsVUFBVSxDQUFDO0lBQ2hCLFdBQVcsRUFBRSxNQUFNO0NBQ3RCLENBQUMsQ0FBQyxJQUFJLENBQUMsQ0FBQyxJQUFJO0lBQ1QsaUJBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO1NBQ1YsSUFBSSxDQUFDLFFBQVEsQ0FBQyxXQUFXLENBQUMsQ0FBQTtBQUNuQyxDQUFDLENBQUMsQ0FBQTtBQUVGLFVBQVU7QUFDVixRQUFRLENBQUMsVUFBVSxDQUFDO0lBQ2hCLFdBQVcsRUFBRSxTQUFTO0NBQ3pCLENBQUMsQ0FBQyxJQUFJLENBQUMsQ0FBQyxJQUFJO0lBQ1QsdUJBQU8sRUFBRSxDQUFBO0FBQ2IsQ0FBQyxDQUFDLENBQUE7QUFFRixRQUFRLENBQUMsVUFBVSxFQUFFLENBQUEifQ==

View File

@ -1,4 +1,4 @@
import "typings-global";
import 'typings-global';
export declare let nvmAvailable: boolean;
export declare let bash: (commandArg: string, retryArg?: number, bareArg?: boolean) => string;
export declare let bashBare: (commandArg: any, retryArg?: number) => string;

14
dist/npmci.bash.js vendored
View File

@ -1,7 +1,7 @@
"use strict";
require("typings-global");
const plugins = require("./npmci.plugins");
let nvmSourceString = "";
let nvmSourceString = '';
exports.nvmAvailable = false;
let checkNvm = () => {
if (plugins.shelljs.exec(`bash -c "source /usr/local/nvm/nvm.sh"`, { silent: true }).code === 0) {
@ -29,24 +29,24 @@ exports.bash = (commandArg, retryArg = 2, bareArg = false) => {
}
exitCode = execResult.code;
stdOut = execResult.stdout;
if (exitCode !== 0 && i == retryArg) {
if (exitCode !== 0 && i === retryArg) {
process.exit(1);
}
else if (exitCode == 0) {
else if (exitCode === 0) {
i = retryArg + 1; // if everything works out ok retrials are not wanted
}
else {
plugins.beautylog.warn("Something went wrong! Exit Code: " + exitCode.toString());
plugins.beautylog.info("Retry " + (i + 1).toString() + " of " + retryArg.toString());
plugins.beautylog.warn('Something went wrong! Exit Code: ' + exitCode.toString());
plugins.beautylog.info('Retry ' + (i + 1).toString() + ' of ' + retryArg.toString());
}
}
}
else {
plugins.beautylog.log("ShellExec would be: " + commandArg);
plugins.beautylog.log('ShellExec would be: ' + commandArg);
}
return stdOut;
};
exports.bashBare = (commandArg, retryArg = 2) => {
return exports.bash(commandArg, retryArg, true);
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuYmFzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLmJhc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF3QjtBQUN4QiwyQ0FBMkM7QUFHM0MsSUFBSSxlQUFlLEdBQVcsRUFBRSxDQUFDO0FBQ3RCLFFBQUEsWUFBWSxHQUFZLEtBQUssQ0FBQztBQUN6QyxJQUFJLFFBQVEsR0FBRztJQUNYLEVBQUUsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLHdDQUF3QyxFQUFDLEVBQUMsTUFBTSxFQUFDLElBQUksRUFBQyxDQUFDLENBQUMsSUFBSSxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDMUYsZUFBZSxHQUFHLGtDQUFrQyxDQUFBO1FBQ3BELG9CQUFZLEdBQUcsSUFBSSxDQUFDO0lBQ3hCLENBQUM7SUFBQyxJQUFJLENBQUMsRUFBRSxDQUFDLENBQUMsT0FBTyxDQUFDLE9BQU8sQ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UFRLENBQUMsUUFBUSxFQUFFLENBQUMsQ0FBQTtnQkFDakYsT0FBTyxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsUUFBUSxHQUFHLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLFFBQVEsRUFBRSxHQUFHLE1BQU0sR0FBRyxRQUFRLENBQUMsUUFBUSxFQUFFLENBQUMsQ0FBQTtZQUN4RixDQUFDO1FBQ0wsQ0FBQztJQUNMLENBQUM7SUFBQyxJQUFJLENBQUMsQ0FBQztRQUNKLE9BQU8sQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLHNCQUFzQixHQUFHLFVBQVUsQ0FBQyxDQUFBO0lBQzlELENBQUM7SUFDRCxNQUFNLENBQUMsTUFBTSxDQUFBO0FBQ2pCLENBQUMsQ0FBQTtBQUVVLFFBQUEsUUFBUSxHQUFHLENBQUMsVUFBVSxFQUFFLFFBQVEsR0FBRyxDQUFDO0lBQzNDLE1BQU0sQ0FBQyxZQUFJLENBQUMsVUFBVSxFQUFFLFFBQVEsRUFBRSxJQUFJLENBQUMsQ0FBQTtBQUMzQyxDQUFDLENBQUEifQ==

View File

@ -1,10 +1,10 @@
/// <reference types="q" />
import "typings-global";
import * as plugins from "./npmci.plugins";
import 'typings-global';
import * as plugins from './npmci.plugins';
/**
* defines possible build services
*/
export declare type TBuildService = "docker";
export declare type TBuildService = 'docker';
/**
* builds for a specific service
*/

View File

@ -1,6 +1,6 @@
/// <reference types="q" />
/// <reference types="node" />
import * as plugins from "./npmci.plugins";
import * as plugins from './npmci.plugins';
/**
* builds a cwd of Dockerfiles by triggering a promisechain
*/

File diff suppressed because one or more lines are too long

6
dist/npmci.build.js vendored
View File

@ -7,12 +7,12 @@ const buildDocker = require("./npmci.build.docker");
*/
exports.build = function (commandArg) {
switch (commandArg) {
case "docker":
case 'docker':
return buildDocker.build();
default:
plugins.beautylog.log("build target " + commandArg + " not recognised!");
plugins.beautylog.log('build target ' + commandArg + ' not recognised!');
}
;
return;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuYnVpbGQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9ucG1jaS5idWlsZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXdCO0FBQ3hCLDJDQUEyQztBQUczQyxvREFBbUQ7QUFPbkQ7O0dBRUc7QUFDUSxRQUFBLEtBQUssR0FBRyxVQUFTLFVBQVU7SUFDbEMsTUFBTSxDQUFBLENBQUMsVUFBVSxDQUFDLENBQUEsQ0FBQztRQUNmLEtBQUssUUFBUTtZQUNULE1BQU0sQ0FBQyxXQUFXLENBQUMsS0FBSyxFQUFFLENBQUM7UUFDL0I7WUFDSSxPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyxlQUFlLEdBQUcsVUFBVSxHQUFHLGtCQUFrQixDQUFDLENBQUM7SUFDakYsQ0FBQztJQUFBLENBQUM7SUFDRixNQUFNLENBQUM7QUFDWCxDQUFDLENBQUEifQ==
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuYnVpbGQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9ucG1jaS5idWlsZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBQ3ZCLDJDQUEwQztBQUcxQyxvREFBbUQ7QUFPbkQ7O0dBRUc7QUFDUSxRQUFBLEtBQUssR0FBRyxVQUFTLFVBQVU7SUFDbEMsTUFBTSxDQUFDLENBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQztRQUNqQixLQUFLLFFBQVE7WUFDVCxNQUFNLENBQUMsV0FBVyxDQUFDLEtBQUssRUFBRSxDQUFBO1FBQzlCO1lBQ0ksT0FBTyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsZUFBZSxHQUFHLFVBQVUsR0FBRyxrQkFBa0IsQ0FBQyxDQUFBO0lBQ2hGLENBQUM7SUFBQSxDQUFDO0lBQ0YsTUFBTSxDQUFBO0FBQ1YsQ0FBQyxDQUFBIn0=

6
dist/npmci.config.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
/// <reference types="q" />
import * as q from 'q';
export interface INpmciOptions {
globalNpmTools: string[];
}
export declare let getConfig: () => q.Promise<INpmciOptions>;

16
dist/npmci.config.js vendored Normal file
View File

@ -0,0 +1,16 @@
"use strict";
const q = require("q");
const plugins = require("./npmci.plugins");
const paths = require("./npmci.paths");
exports.getConfig = () => {
console.log('getting config');
let done = q.defer();
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd);
let defaultConfig = {
globalNpmTools: []
};
let npmciConfig = npmciNpmextra.dataFor('npmci', defaultConfig);
done.resolve(npmciConfig);
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSx1QkFBc0I7QUFFdEIsMkNBQTBDO0FBQzFDLHVDQUFzQztBQU0zQixRQUFBLFNBQVMsR0FBRztJQUNuQixPQUFPLENBQUMsR0FBRyxDQUFDLGdCQUFnQixDQUFDLENBQUE7SUFDN0IsSUFBSSxJQUFJLEdBQUcsQ0FBQyxDQUFDLEtBQUssRUFBaUIsQ0FBQTtJQUNuQyxJQUFJLGFBQWEsR0FBRyxJQUFJLE9BQU8sQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQTtJQUM1RCxJQUFJLGFBQWEsR0FBa0I7UUFDL0IsY0FBYyxFQUFFLEVBQUU7S0FDckIsQ0FBQTtJQUNELElBQUksV0FBVyxHQUFHLGFBQWEsQ0FBQyxPQUFPLENBQWdCLE9BQU8sRUFBRSxhQUFhLENBQUMsQ0FBQTtJQUM5RSxJQUFJLENBQUMsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFBO0lBQ3pCLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFBO0FBQ3ZCLENBQUMsQ0FBQSJ9

13
dist/npmci.install.js vendored
View File

@ -1,6 +1,7 @@
"use strict";
require("typings-global");
const plugins = require("./npmci.plugins");
const configModule = require("./npmci.config");
const npmci_bash_1 = require("./npmci.bash");
const npmci_bash_2 = require("./npmci.bash");
exports.install = (versionArg) => {
@ -30,7 +31,15 @@ exports.install = (versionArg) => {
;
npmci_bash_1.bash('node -v');
npmci_bash_1.bash('npm -v');
done.resolve();
// lets look for further config
configModule.getConfig()
.then(config => {
for (let npmTool of config.globalNpmTools) {
plugins.beautylog.info(`globally installing ${npmTool} from npm`);
npmci_bash_1.bash(`npm install --loglevel=silent -g ${npmTool}`);
}
done.resolve();
});
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuaW5zdGFsbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLmluc3RhbGwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF3QjtBQUN4QiwyQ0FBMkM7QUFDM0MsNkNBQW9DO0FBQ3BDLDZDQUEyQztBQUVoQyxRQUFBLE9BQU8sR0FBRyxDQUFDLFVBQVU7SUFDNUIsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQTtJQUM1QixPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQywrQkFBK0IsVUFBVSxFQUFFLENBQUMsQ0FBQTtJQUNsRSxJQUFJLE9BQWUsQ0FBQTtJQUNuQixFQUFFLENBQUMsQ0FBQyxVQ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UMsT0FBTyxDQUFDLGdCQUFnQixPQUFPLDBCQUEwQixDQUFDLENBQUE7SUFDaEYsQ0FBQztJQUFDLElBQUksQ0FBQyxDQUFDO1FBQ0osT0FBTyxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsdURBQXVELENBQUMsQ0FBQTtJQUNuRixDQUFDO0lBQUEsQ0FBQztJQUNGLGlCQUFJLENBQUMsU0FBUyxDQUFDLENBQUE7SUFDZixpQkFBSSxDQUFDLFFBQVEsQ0FBQyxDQUFBO0lBRWQsK0JBQStCO0lBQy9CLFlBQVksQ0FBQyxTQUFTLEVBQUU7U0FDbkIsSUFBSSxDQUFDLE1BQU07UUFDUixHQUFHLENBQUMsQ0FBQyxJQUFJLE9BQU8sSUFBSSxNQUFNLENBQUMsY0FBYyxDQUFDLENBQUMsQ0FBQztZQUN4QyxPQUFPLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyx1QkFBdUIsT0FBTyxXQUFXLENBQUMsQ0FBQTtZQUNqRSxpQkFBSSxDQUFDLHFDQUFxQyxPQUFPLEVBQUUsQ0FBQyxDQUFBO1FBQ3hELENBQUM7UUFDRCxJQUFJLENBQUMsT0FBTyxFQUFFLENBQUE7SUFDbEIsQ0FBQyxDQUFDLENBQUE7SUFDTixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQTtBQUN2QixDQUFDLENBQUEifQ==

View File

@ -1,4 +1,4 @@
import "typings-global";
import 'typings-global';
export declare let cwd: string;
export declare let NpmciPackageRoot: string;
export declare let NpmciPackageConfig: string;

8
dist/npmci.paths.js vendored
View File

@ -2,8 +2,8 @@
require("typings-global");
const plugins = require("./npmci.plugins");
exports.cwd = process.cwd();
exports.NpmciPackageRoot = plugins.path.join(__dirname, "../");
exports.NpmciPackageConfig = plugins.path.join(exports.NpmciPackageRoot, "./config.json");
exports.NpmciPackageRoot = plugins.path.join(__dirname, '../');
exports.NpmciPackageConfig = plugins.path.join(exports.NpmciPackageRoot, './config.json');
exports.NpmciProjectDir = exports.cwd;
exports.NpmciTestDir = plugins.path.join(exports.cwd, "./test");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kucGF0aHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9ucG1jaS5wYXRocy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXdCO0FBQ3hCLDJDQUEyQztBQUVoQyxRQUFBLEdBQUcsR0FBRyxPQUFPLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFcEIsUUFBQSxnQkFBZ0IsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUMsS0FBSyxDQUFDLENBQUM7QUFDdEQsUUFBQSxrQkFBa0IsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyx3QkFBZ0IsRUFBQyxlQUFlLENBQUMsQ0FBQztBQUN6RSxRQUFBLGVBQWUsR0FBRyxXQUFHLENBQUM7QUFDdEIsUUFBQSxZQUFZLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsV0FBRyxFQUFDLFFBQVEsQ0FBQyxDQUFDIn0=
exports.NpmciTestDir = plugins.path.join(exports.cwd, './test');
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kucGF0aHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9ucG1jaS5wYXRocy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXVCO0FBQ3ZCLDJDQUEwQztBQUUvQixRQUFBLEdBQUcsR0FBRyxPQUFPLENBQUMsR0FBRyxFQUFFLENBQUE7QUFFbkIsUUFBQSxnQkFBZ0IsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUMsS0FBSyxDQUFDLENBQUE7QUFDckQsUUFBQSxrQkFBa0IsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyx3QkFBZ0IsRUFBQyxlQUFlLENBQUMsQ0FBQTtBQUN4RSxRQUFBLGVBQWUsR0FBRyxXQUFHLENBQUE7QUFDckIsUUFBQSxZQUFZLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsV0FBRyxFQUFDLFFBQVEsQ0FBQyxDQUFBIn0=

View File

@ -1,17 +1,18 @@
import "typings-global";
export import beautylog = require("beautylog");
import 'typings-global';
export import beautylog = require('beautylog');
export declare let gulp: any;
export declare let gulpFunction: any;
export declare let lodash: any;
export import path = require("path");
export import projectinfo = require("projectinfo");
export import q = require("q");
export import gulpFunction = require('gulp-function');
export import lodash = require('lodash');
export import npmextra = require('npmextra');
export import path = require('path');
export import projectinfo = require('projectinfo');
export import q = require('q');
export declare let request: any;
export import shelljs = require("shelljs");
export import smartcli = require("smartcli");
export import smartfile = require("smartfile");
export import smartparam = require("smartparam");
export import smartsocket = require("smartsocket");
export import smartssh = require("smartssh");
export import smartstring = require("smartstring");
export declare let through2: any;
export import shelljs = require('shelljs');
export import smartcli = require('smartcli');
export import smartfile = require('smartfile');
export import smartparam = require('smartparam');
export import smartsocket = require('smartsocket');
export import smartssh = require('smartssh');
export import smartstring = require('smartstring');
export import through2 = require('through2');

View File

@ -1,13 +1,14 @@
"use strict";
require("typings-global");
exports.beautylog = require("beautylog");
exports.gulp = require("gulp");
exports.gulp = require('gulp');
exports.gulpFunction = require("gulp-function");
exports.lodash = require("lodash");
exports.npmextra = require("npmextra");
exports.path = require("path");
exports.projectinfo = require("projectinfo");
exports.q = require("q");
exports.request = require("request");
exports.request = require('request');
exports.shelljs = require("shelljs");
exports.smartcli = require("smartcli");
exports.smartfile = require("smartfile");
@ -16,4 +17,4 @@ exports.smartsocket = require("smartsocket");
exports.smartssh = require("smartssh");
exports.smartstring = require("smartstring");
exports.through2 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tCQUFvQztBQUNwQyw2Q0FBa0Q7QUFDbEQseUJBQThCO0FBQ25CLFFBQUEsT0FBTyxHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUMsQ0FBQTtBQUN2QyxxQ0FBMEM7QUFDMUMsdUNBQTRDO0FBQzVDLHlDQUE4QztBQUM5QywyQ0FBZ0Q7QUFDaEQsNkNBQWtEO0FBQ2xELHVDQUE0QztBQUM1Qyw2Q0FBa0Q7QUFDbEQsdUNBQTRDIn0=

View File

@ -1,10 +1,10 @@
/// <reference types="q" />
import "typings-global";
import * as plugins from "./npmci.plugins";
import 'typings-global';
import * as plugins from './npmci.plugins';
/**
* defines possible prepare services
*/
export declare type TPrepService = "npm" | "docker" | "docker-gitlab" | "ssh";
export declare type TPrepService = 'npm' | 'docker' | 'docker-gitlab' | 'ssh';
/**
* the main exported prepare function
* @param servieArg describes the service to prepare

30
dist/npmci.prepare.js vendored
View File

@ -8,17 +8,17 @@ const sshModule = require("./npmci.ssh");
*/
let npm = function () {
let done = plugins.q.defer();
let npmrcPrefix = "//registry.npmjs.org/:_authToken=";
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");
plugins.beautylog.info('found access token');
}
else {
plugins.beautylog.error("no access token found! Exiting!");
plugins.beautylog.error('no access token found! Exiting!');
process.exit(1);
}
plugins.smartfile.memory.toFsSync(npmrcFileString, "/root/.npmrc");
plugins.smartfile.memory.toFsSync(npmrcFileString, '/root/.npmrc');
done.resolve();
return done.promise;
};
@ -27,17 +27,17 @@ let npm = function () {
*/
let docker = function () {
let done = plugins.q.defer();
env.setDockerRegistry("docker.io");
env.setDockerRegistry('docker.io');
let dockerRegex = /^([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)/;
if (!process.env.NPMCI_LOGIN_DOCKER) {
plugins.beautylog.error("You have to specify Login Data to the Docker Registry");
plugins.beautylog.error('You have to specify Login Data to the Docker Registry');
process.exit(1);
}
plugins.shelljs.exec("docker login -u gitlab-ci-token -p " + process.env.CI_BUILD_TOKEN + " " + "registry.gitlab.com"); // Always also login to GitLab Registry
plugins.shelljs.exec('docker login -u gitlab-ci-token -p ' + process.env.CI_BUILD_TOKEN + ' ' + 'registry.gitlab.com'); // Always also login to GitLab Registry
let dockerRegexResultArray = dockerRegex.exec(process.env.NPMCI_LOGIN_DOCKER);
let username = dockerRegexResultArray[1];
let password = dockerRegexResultArray[2];
plugins.shelljs.exec("docker login -u " + username + " -p " + password);
plugins.shelljs.exec('docker login -u ' + username + ' -p ' + password);
done.resolve();
return done.promise;
};
@ -46,8 +46,8 @@ let docker = function () {
*/
let dockerGitlab = function () {
let done = plugins.q.defer();
env.setDockerRegistry("registry.gitlab.com");
plugins.shelljs.exec("docker login -u gitlab-ci-token -p " + process.env.CI_BUILD_TOKEN + " " + "registry.gitlab.com");
env.setDockerRegistry('registry.gitlab.com');
plugins.shelljs.exec('docker login -u gitlab-ci-token -p ' + process.env.CI_BUILD_TOKEN + ' ' + 'registry.gitlab.com');
done.resolve();
return done.promise;
};
@ -66,16 +66,16 @@ let ssh = function () {
*/
exports.prepare = function (serviceArg) {
switch (serviceArg) {
case "npm":
case 'npm':
return npm();
case "docker":
case 'docker':
return docker();
case "docker-gitlab":
case 'docker-gitlab':
return dockerGitlab();
case "ssh":
case 'ssh':
return ssh();
default:
break;
}
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kucHJlcGFyZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLnByZXBhcmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF3QjtBQUN4QiwyQ0FBMkM7QUFFM0MsbUNBQWtDO0FBQ2xDLHlDQUF3QztBQVV4Qzs7R0FFRztBQUNILElBQUksR0FBRyxHQUFHO0l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BRyxPQUFPLENBQUMsR0FBRyxDQUFDLGNBQWMsR0FBRyxHQUFHLEdBQUcscUJBQXFCLENBQUMsQ0FBQTtJQUN0SCxJQUFJLENBQUMsT0FBTyxFQUFFLENBQUE7SUFDZCxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQTtBQUN2QixDQUFDLENBQUE7QUFFRDs7R0FFRztBQUNILElBQUksR0FBRyxHQUFHO0lBQ04sSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQTtJQUM1QixTQUFTLENBQUMsR0FBRyxFQUFFO1NBQ1YsSUFBSSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQTtJQUN2QixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQTtBQUN2QixDQUFDLENBQUE7QUFFRDs7O0dBR0c7QUFDUSxRQUFBLE9BQU8sR0FBRyxVQUFTLFVBQXdCO0lBQ2xELE1BQU0sQ0FBQyxDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUM7UUFDakIsS0FBSyxLQUFLO1lBQ04sTUFBTSxDQUFDLEdBQUcsRUFBRSxDQUFBO1FBQ2hCLEtBQUssUUFBUTtZQUNULE1BQU0sQ0FBQyxNQUFNLEVBQUUsQ0FBQTtRQUNuQixLQUFLLGVBQWU7WUFDaEIsTUFBTSxDQUFDLFlBQVksRUFBRSxDQUFBO1FBQ3pCLEtBQUssS0FBSztZQUNOLE1BQU0sQ0FBQyxHQUFHLEVBQUUsQ0FBQTtRQUNoQjtZQUNJLEtBQUssQ0FBQTtJQUNiLENBQUM7QUFDTCxDQUFDLENBQUEifQ==

View File

@ -1,10 +1,10 @@
/// <reference types="q" />
import "typings-global";
import * as plugins from "./npmci.plugins";
import 'typings-global';
import * as plugins from './npmci.plugins';
/**
* type of supported services
*/
export declare type TPubService = "npm" | "docker";
export declare type TPubService = 'npm' | 'docker';
/**
* the main exported publish function.
* @param pubServiceArg references targeted service to publish to

14
dist/npmci.publish.js vendored
View File

@ -8,11 +8,11 @@ const NpmciBuildDocker = require("./npmci.build.docker");
* the main exported publish function.
* @param pubServiceArg references targeted service to publish to
*/
exports.publish = (pubServiceArg = "npm") => {
exports.publish = (pubServiceArg = 'npm') => {
switch (pubServiceArg) {
case "npm":
case 'npm':
return publishNpm();
case "docker":
case 'docker':
return publishDocker();
}
};
@ -21,10 +21,10 @@ exports.publish = (pubServiceArg = "npm") => {
*/
let publishNpm = function () {
let done = plugins.q.defer();
npmci_prepare_1.prepare("npm")
npmci_prepare_1.prepare('npm')
.then(function () {
npmci_bash_1.bash("npm publish");
plugins.beautylog.ok("Done!");
npmci_bash_1.bash('npm publish');
plugins.beautylog.ok('Done!');
done.resolve();
});
return done.promise;
@ -40,4 +40,4 @@ let publishDocker = function () {
.then(done.resolve);
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kucHVibGlzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLnB1Ymxpc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF3QjtBQUN4QiwyQ0FBMkM7QUFDM0MsbURBQXdDO0FBQ3hDLDZDQUFrQztBQUVsQyx5REFBd0Q7QUFPeEQ7OztHQUdHO0FBQ1EsUUFBQSxPQUFPLEdBQUcsQ0FBQyxnQkFBNEIsS0FBSztJQUNuRCxNQUFNLENBQUMsQ0FBQyxhQUFhLENBQUMsQ0FBQSxDQUFDO1FBQ25CLEtBQUssS0FBSztZQUNOLE1BQU0sQ0FBQyxVQUFVLEVBQUUsQ0FBQztRQUN4QixLQUFLLFFBQVE7WUFDVCxNQUFNLENBQUMsYUFBYSxFQUFFLENBQUM7SUFDL0IsQ0FBQztBQUNMLENBQUMsQ0FBQztBQUVGOztHQUVHO0FBQ0gsSUFBSSxVQUFVLEdBQUk7SUFDZCx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In0=

View File

@ -13,10 +13,10 @@ let servezoneRegexResultArray = servezoneRegex.exec(process.env.NPMCI_SERVEZONE)
* the data object that is used for the smartsocket client object
*/
let smartsocketClientConstructorOptions = {
alias: "npmci",
alias: 'npmci',
password: servezoneRegexResultArray[3],
port: parseInt(servezoneRegexResultArray[2]),
role: "ci",
role: 'ci',
url: servezoneRegexResultArray[1]
};
/**
@ -25,4 +25,4 @@ let smartsocketClientConstructorOptions = {
exports.run = (configArg) => {
new plugins.smartsocket.SmartsocketClient(smartsocketClientConstructorOptions);
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuc2VydmV6b25lLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuc2VydmV6b25lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSwyQ0FBMkM7QUFFM0M7OztHQUdHO0FBQ0gsSUFBSSxjQUFjLEdBQUcsbUJBQW1CLENBQUM7QUFFekM7O0dBRUc7QUFDSCxJQUFJLHlCQUF5QixHQUFHLGNBQWMsQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxlQUFlLENBQUMsQ0FBQztBQUVqRjs7R0FFRztBQUNILElBQUksbUNBQW1DLEdBQUc7SUFDdEMsS0FBSyxFQUFFLE9BQU87SUFDZCxRQUFRLEVBQUUseUJBQXlCLENBQUMsQ0FBQyxDQUFDO0lBQ3RDLElBQUksRUFBRSxRQUFRLENBQUMseUJBQXlCLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFDNUMsSUFBSSxFQUFFLElBQUk7SUFDVixHQUFHLEVBQUUseUJBQXlCLENBQUMsQ0FBQyxDQUFDO0NBQ3BDLENBQUM7QUFFRjs7R0FFRztBQUNRLFFBQUEsR0FBRyxHQUFHLENBQUMsU0FBUztJQUN2QixJQUFJLE9BQU8sQ0FBQyxXQUFXLENBQUMsaUJBQWlCLENBQ3JDLG1DQUFtQyxDQUN0QyxDQUFDO0FBQ04sQ0FBQyxDQUFDIn0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuc2VydmV6b25lLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuc2VydmV6b25lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSwyQ0FBMEM7QUFFMUM7OztHQUdHO0FBQ0gsSUFBSSxjQUFjLEdBQUcsbUJBQW1CLENBQUE7QUFFeEM7O0dBRUc7QUFDSCxJQUFJLHlCQUF5QixHQUFHLGNBQWMsQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxlQUFlLENBQUMsQ0FBQTtBQUVoRjs7R0FFRztBQUNILElBQUksbUNBQW1DLEdBQUc7SUFDdEMsS0FBSyxFQUFFLE9BQU87SUFDZCxRQUFRLEVBQUUseUJBQXlCLENBQUMsQ0FBQyxDQUFDO0lBQ3RDLElBQUksRUFBRSxRQUFRLENBQUMseUJBQXlCLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFDNUMsSUFBSSxFQUFFLElBQUk7SUFDVixHQUFHLEVBQUUseUJBQXlCLENBQUMsQ0FBQyxDQUFDO0NBQ3BDLENBQUE7QUFFRDs7R0FFRztBQUNRLFFBQUEsR0FBRyxHQUFHLENBQUMsU0FBUztJQUN2QixJQUFJLE9BQU8sQ0FBQyxXQUFXLENBQUMsaUJBQWlCLENBQ3JDLG1DQUFtQyxDQUN0QyxDQUFBO0FBQ0wsQ0FBQyxDQUFBIn0=

4
dist/npmci.ssh.d.ts vendored
View File

@ -1,6 +1,6 @@
/// <reference types="q" />
import "typings-global";
import * as plugins from "./npmci.plugins";
import 'typings-global';
import * as plugins from './npmci.plugins';
/**
* checks for ENV vars in form of NPMCI_SSHKEY_* and deploys any found ones
*/

16
dist/npmci.ssh.js vendored
View File

@ -9,12 +9,12 @@ let sshInstance;
exports.ssh = () => {
let done = plugins.q.defer();
sshInstance = new plugins.smartssh.SshInstance(); // init ssh instance
plugins.smartparam.forEachMinimatch(process.env, "NPMCI_SSHKEY_*", evaluateSshEnv);
plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_SSHKEY_*', evaluateSshEnv);
if (!process.env.NPMTS_TEST) {
sshInstance.writeToDisk();
}
else {
plugins.beautylog.log("In test mode, so not storing SSH keys to disk!");
plugins.beautylog.log('In test mode, so not storing SSH keys to disk!');
}
;
done.resolve();
@ -26,18 +26,18 @@ exports.ssh = () => {
let evaluateSshEnv = (sshkeyEnvVarArg) => {
let resultArray = sshRegex.exec(sshkeyEnvVarArg);
let sshKey = new plugins.smartssh.SshKey();
plugins.beautylog.info("Found SSH identity for " + resultArray[1]);
plugins.beautylog.info('Found SSH identity for ' + resultArray[1]);
if (notUndefined(resultArray[1])) {
plugins.beautylog.log("---> host defined!");
plugins.beautylog.log('---> host defined!');
sshKey.host = resultArray[1];
}
if (notUndefined(resultArray[2])) {
plugins.beautylog.log("---> privKey defined!");
plugins.beautylog.log('---> privKey defined!');
sshKey.privKeyBase64 = resultArray[2];
}
;
if (notUndefined(resultArray[3])) {
"---> pubKey defined!";
'---> pubKey defined!';
sshKey.pubKeyBase64 = resultArray[3];
}
;
@ -47,6 +47,6 @@ let evaluateSshEnv = (sshkeyEnvVarArg) => {
* checks if not undefined
*/
let notUndefined = (stringArg) => {
return (stringArg && stringArg != "undefined" && stringArg != "##");
return (stringArg && stringArg !== 'undefined' && stringArg !== '##');
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuc3NoLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuc3NoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSwwQkFBd0I7QUFDeEIsMkNBQTJDO0FBRTNDLElBQUksUUFBUSxHQUFHLG1C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DSCxJQUFJLFlBQVksR0FBRyxDQUFDLFNBQWlCO0lBQ2pDLE1BQU0sQ0FBQyxDQUFDLFNBQVMsSUFBSSxTQUFTLEtBQUssV0FBVyxJQUFJLFNBQVMsS0FBSyxJQUFJLENBQUMsQ0FBQTtBQUN6RSxDQUFDLENBQUEifQ==

View File

@ -1,4 +1,4 @@
/// <reference types="q" />
import "typings-global";
import * as plugins from "./npmci.plugins";
import 'typings-global';
import * as plugins from './npmci.plugins';
export declare let test: (versionArg: any) => plugins.q.Promise<{}>;

12
dist/npmci.test.js vendored
View File

@ -6,7 +6,7 @@ const npmci_install_1 = require("./npmci.install");
const NpmciBuildDocker = require("./npmci.build.docker");
exports.test = (versionArg) => {
let done = plugins.q.defer();
if (versionArg == "docker") {
if (versionArg === 'docker') {
testDocker()
.then(() => {
done.resolve();
@ -24,15 +24,15 @@ exports.test = (versionArg) => {
};
let npmDependencies = function () {
let done = plugins.q.defer();
plugins.beautylog.info("now installing dependencies:");
npmci_bash_1.bash("npm install");
plugins.beautylog.info('now installing dependencies:');
npmci_bash_1.bash('npm install');
done.resolve();
return done.promise;
};
let npmTest = () => {
let done = plugins.q.defer();
plugins.beautylog.info("now starting tests:");
npmci_bash_1.bash("npm test");
plugins.beautylog.info('now starting tests:');
npmci_bash_1.bash('npm test');
done.resolve();
return done.promise;
};
@ -44,4 +44,4 @@ let testDocker = function () {
.then(done.resolve);
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kudGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLnRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF3QjtBQUN4QiwyQ0FBMkM7QUFDM0MsNkNBQWtDO0FBQ2xDLG1EQUF3QztBQUV4Qyx5REFBeUQ7QUFFOUMsUUFBQSxJQUFJLEdBQUcsQ0FBQyxVQUFVO0lB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HLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUE7SUFDNUIsZ0JBQWdCLENBQUMsZUFBZSxFQUFFO1NBQzdCLElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxvQkFBb0IsQ0FBQztTQUMzQyxJQUFJLENBQUMsZ0JBQWdCLENBQUMsZUFBZSxDQUFDO1NBQ3RDLElBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLENBQUE7SUFDdkIsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7QUFDdkIsQ0FBQyxDQUFBIn0=

View File

@ -1,4 +1,4 @@
/// <reference types="q" />
import "typings-global";
import * as plugins from "./npmci.plugins";
import 'typings-global';
import * as plugins from './npmci.plugins';
export declare let trigger: () => plugins.q.Promise<{}>;

16
dist/npmci.trigger.js vendored
View File

@ -4,8 +4,8 @@ const plugins = require("./npmci.plugins");
let triggerValueRegex = /^([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|?([a-zA-Z0-9\.\-\/]*)/;
exports.trigger = function () {
let done = plugins.q.defer();
plugins.beautylog.info("now running triggers");
plugins.smartparam.forEachMinimatch(process.env, "NPMCI_TRIGGER_*", evaluateTrigger);
plugins.beautylog.info('now running triggers');
plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_TRIGGER_*', evaluateTrigger);
done.resolve();
return done.promise;
};
@ -16,14 +16,14 @@ let evaluateTrigger = (triggerEnvVarArg) => {
let regexProjectTriggerToken = triggerRegexResultArray[3];
let regexRefName = triggerRegexResultArray[4];
let regexTriggerName;
if (triggerRegexResultArray.length == 6) {
if (triggerRegexResultArray.length === 6) {
regexTriggerName = triggerRegexResultArray[5];
}
else {
regexTriggerName = "Unnamed Trigger";
regexTriggerName = 'Unnamed Trigger';
}
plugins.beautylog.info("Found Trigger!");
plugins.beautylog.log("triggering build for ref " + regexRefName + " of " + regexTriggerName);
plugins.request.post("https://gitlab.com/api/v3/projects/" + regexProjectId + "/trigger/builds", { form: { token: regexProjectTriggerToken, ref: regexRefName } });
plugins.beautylog.info('Found Trigger!');
plugins.beautylog.log('triggering build for ref ' + regexRefName + ' of ' + regexTriggerName);
plugins.request.post('https://gitlab.com/api/v3/projects/' + regexProjectId + '/trigger/builds', { form: { token: regexProjectTriggerToken, ref: regexRefName } });
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kudHJpZ2dlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLnRyaWdnZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF3QjtBQUN4QiwyQ0FBMkM7QUFLM0MsSUFBSSxpQkFBaUIsR0FBRyxnR0FBZ0csQ0FBQztBQUU5RyxRQUFBLE9BQU8sR0FBRztJQUNqQixJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFDO0lBQzdCLE9BQU8sQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLHNCQUFzQixDQUFDLENBQUM7SUFDL0MsT0FBTyxDQUFDLFVBQVUsQ0FBQyxnQkFBZ0IsQ0FBQyxPQUFPLENBQUMsR0FBRyxFQUFFLGlCQUFpQixFQUFFLGVBQWUsQ0FBQyxDQUFDO0lBQ3JGLElBQUksQ0FBQyxPQUFPLEVBQUUsQ0FBQztJQUNmLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0FBQ3hCLENBQUMsQ0FBQTtBQUVELElBQUksZUFBZSxHQUFHLENBQUMsZ0JBQWdCO0lBQ25DLElBQUksdUJBQXVCLEdBQUcsaUJBQWlCLENBQUMsSUFBSSxDQUFDLGdCQUFnQixDQUFDLENBQUM7SUFDdkUsSUFBSSxXQUFXLEdBQUcsdUJBQXVCLENBQUMsQ0FBQyxDQUFDLENBQ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UFBO0lBQ2pELENBQUM7SUFBQyxJQUFJLENBQUMsQ0FBQztRQUNKLGdCQUFnQixHQUFHLGlCQUFpQixDQUFBO0lBQ3hDLENBQUM7SUFDRCxPQUFPLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFBO0lBQ3hDLE9BQU8sQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDLDJCQUEyQixHQUFHLFlBQVksR0FBRyxNQUFNLEdBQUcsZ0JBQWdCLENBQUMsQ0FBQTtJQUM3RixPQUFPLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxxQ0FBcUMsR0FBRyxjQUFjLEdBQUcsaUJBQWlCLEVBQUUsRUFBRSxJQUFJLEVBQUUsRUFBRSxLQUFLLEVBQUUsd0JBQXdCLEVBQUUsR0FBRyxFQUFFLFlBQVksRUFBRSxFQUFFLENBQUMsQ0FBQTtBQUN0SyxDQUFDLENBQUEifQ==

View File

@ -27,24 +27,26 @@
"typings-test": "^1.0.3"
},
"dependencies": {
"@types/lodash": "^4.14.39",
"@types/node": "^6.0.47",
"@types/lodash": "^4.14.40",
"@types/node": "^6.0.51",
"@types/q": "0.x.x",
"@types/request": "0.x.x",
"@types/shelljs": "^0.3.32",
"@types/shelljs": "^0.3.33",
"@types/through2": "^2.0.32",
"beautylog": "^6.0.0",
"gulp": "^3.9.1",
"gulp-function": "^2.2.0",
"lodash": "^4.17.0",
"lodash": "^4.17.2",
"npmextra": "^2.0.3",
"projectinfo": "^1.0.4",
"q": "^1.4.1",
"request": "^2.78.0",
"request": "^2.79.0",
"shelljs": "^0.7.5",
"smartcli": "^1.0.10",
"smartcli": "^1.0.15",
"smartfile": "^4.1.0",
"smartparam": "^0.1.1",
"smartsocket": "^1.1.7",
"smartssh": "^1.1.5",
"smartssh": "^1.2.1",
"smartstring": "^2.0.22",
"through2": "^2.0.1",
"typings-global": "^1.0.14"

View File

@ -0,0 +1 @@
{}

View File

@ -2,7 +2,6 @@
require("typings-test");
const should = require("should");
const path = require("path");
const beautylog = require("beautylog");
// set up environment
process.env.CI_BUILD_REPO = 'https://yyyyyy:xxxxxxxx@gitlab.com/mygroup/myrepo.git';
process.env.NPMCI_SSHKEY_1 = 'hostString|somePrivKey|##';
@ -10,6 +9,7 @@ process.env.NPMTS_TEST = 'true';
process.cwd = () => {
return path.join(__dirname, 'assets/');
};
// require NPMCI files
const NpmciBuildDocker = require("../dist/npmci.build.docker");
const NpmciPublish = require("../dist/npmci.publish");
const NpmciTest = require("../dist/npmci.test");
@ -36,7 +36,6 @@ describe('NPMCI', function () {
it('should sort an array of Dockerfiles', function (done) {
NpmciBuildDocker.sortDockerfiles(sortableArray)
.then(function (sortedArrayArg) {
beautylog.success('final result');
console.log(sortedArrayArg);
done();
});
@ -87,4 +86,4 @@ describe('NPMCI', function () {
});
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQixpQ0FBZ0M7QUFDaEMsNkJBQTZCO0FBQzdCLHVDQUFzQztBQUV0QyxxQkFBcUI7QUFDckIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxhQUFhLEdBQUcsdURBQXVELENBQUE7QUFDbkYsT0FBTyxDQUFDLEdBQUcsQ0FBQyxjQUFjLEdBQUcsMkJBQTJCLENBQUE7QUFDeEQsT0FBTyxDQUFDLEdBQUcsQ0FBQyxVQUFVLEdBQUcsTUFBTSxDQUFBO0FBQy9CLE9BQU8sQ0FBQyxHQUFHLEdBQUc7SUFDVixNQUFNLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUMsU0FBUyxDQUFDLENBQUE7QUFDekMsQ0FBQyxDQUFBO0FBSUQsK0RBQStEO0FBQy9ELHNEQUFzRDtBQUN0RCxnREFB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sQ0FBQyxDQUFDLENBQUE7UUFDVixDQUFDLENBQUMsQ0FBQTtJQUNOLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUEifQ==

View File

@ -1,7 +1,6 @@
import 'typings-test'
import * as should from 'should'
import path = require('path')
import * as beautylog from 'beautylog'
import * as path from 'path'
// set up environment
process.env.CI_BUILD_REPO = 'https://yyyyyy:xxxxxxxx@gitlab.com/mygroup/myrepo.git'
@ -12,7 +11,6 @@ process.cwd = () => {
}
// require NPMCI files
import npmci = require('../dist/index')
import NpmciBuildDocker = require('../dist/npmci.build.docker')
import NpmciPublish = require('../dist/npmci.publish')
import NpmciTest = require('../dist/npmci.test')
@ -44,7 +42,6 @@ describe('NPMCI',function(){
it('should sort an array of Dockerfiles',function(done){
NpmciBuildDocker.sortDockerfiles(sortableArray)
.then(function(sortedArrayArg: NpmciBuildDocker.Dockerfile[]){
beautylog.success('final result')
console.log(sortedArrayArg)
done()
})

View File

@ -1,89 +1,88 @@
#!/usr/bin/env node
import "typings-global";
import * as plugins from "./npmci.plugins";
import * as paths from "./npmci.paths";
let npmciInfo = new plugins.projectinfo.ProjectinfoNpm(paths.NpmciPackageRoot);
plugins.beautylog.log("npmci version: " + npmciInfo.version);
import 'typings-global'
import * as plugins from './npmci.plugins'
import * as paths from './npmci.paths'
let npmciInfo = new plugins.projectinfo.ProjectinfoNpm(paths.NpmciPackageRoot)
plugins.beautylog.log('npmci version: ' + npmciInfo.version)
import {build} from "./npmci.build"
import {clean} from "./npmci.clean";
import {command} from "./npmci.command";
import {install} from "./npmci.install";
import {publish} from "./npmci.publish";
import {prepare} from "./npmci.prepare";
import {test} from "./npmci.test";
import {trigger} from "./npmci.trigger";
import * as NpmciEnv from "./npmci.env";
import {build} from './npmci.build'
import {clean} from './npmci.clean'
import {command} from './npmci.command'
import {install} from './npmci.install'
import {publish} from './npmci.publish'
import {prepare} from './npmci.prepare'
import {test} from './npmci.test'
import {trigger} from './npmci.trigger'
import * as NpmciEnv from './npmci.env'
export {build} from "./npmci.build"
export {install} from "./npmci.install";
export {publish} from "./npmci.publish";
export {build} from './npmci.build'
export {install} from './npmci.install';
export {publish} from './npmci.publish';
let smartcli = new plugins.smartcli.Smartcli();
smartcli.addVersion(npmciInfo.version);
let smartcli = new plugins.smartcli.Smartcli()
smartcli.addVersion(npmciInfo.version)
// build
smartcli.addCommand({
commandName:"build"
commandName: 'build'
}).then((argv) => {
build(argv._[1])
.then(NpmciEnv.configStore);
});
.then(NpmciEnv.configStore)
})
// clean
smartcli.addCommand({
commandName:"clean"
commandName: 'clean'
}).then((argv) => {
clean()
.then(NpmciEnv.configStore);
});
.then(NpmciEnv.configStore)
})
// command
smartcli.addCommand({
commandName:"command"
commandName: 'command'
}).then((argv) => {
command()
.then(NpmciEnv.configStore);
});
.then(NpmciEnv.configStore)
})
// install
smartcli.addCommand({
commandName:"install"
commandName: 'install'
}).then((argv) => {
install(argv._[1])
.then(NpmciEnv.configStore);
});
.then(NpmciEnv.configStore)
})
// prepare
smartcli.addCommand({
commandName:"prepare"
commandName: 'prepare'
}).then((argv) => {
prepare(argv._[1])
.then(NpmciEnv.configStore);
});
.then(NpmciEnv.configStore)
})
// publish
smartcli.addCommand({
commandName:"publish"
commandName: 'publish'
}).then((argv) => {
publish(argv._[1])
.then(NpmciEnv.configStore);
});
.then(NpmciEnv.configStore)
})
// test
smartcli.addCommand({
commandName:"test"
commandName: 'test'
}).then((argv) => {
test(argv._[1])
.then(NpmciEnv.configStore);
});
.then(NpmciEnv.configStore)
})
// trigger
smartcli.addCommand({
commandName:"trigger"
commandName: 'trigger'
}).then((argv) => {
trigger();
});
trigger()
})
smartcli.startParse();
smartcli.startParse()

View File

@ -1,50 +1,49 @@
import "typings-global";
import * as plugins from "./npmci.plugins";
import 'typings-global'
import * as plugins from './npmci.plugins'
let nvmSourceString: string = "";
export let nvmAvailable: boolean = false;
let nvmSourceString: string = ''
export let nvmAvailable: boolean = false
let checkNvm = () => {
if (plugins.shelljs.exec(`bash -c "source /usr/local/nvm/nvm.sh"`,{silent:true}).code === 0) {
if (plugins.shelljs.exec(`bash -c "source /usr/local/nvm/nvm.sh"`,{silent: true}).code === 0) {
nvmSourceString = `source /usr/local/nvm/nvm.sh && `
nvmAvailable = true;
} else if (plugins.shelljs.exec(`bash -c "source ~/.nvm/nvm.sh"`,{silent:true}).code === 0) {
nvmAvailable = true
} else if (plugins.shelljs.exec(`bash -c "source ~/.nvm/nvm.sh"`,{silent: true}).code === 0) {
nvmSourceString = `source ~/.nvm/nvm.sh && `
nvmAvailable = true;
nvmAvailable = true
};
};
checkNvm();
}
checkNvm()
export let bash = (commandArg: string, retryArg = 2, bareArg = false) => {
let exitCode: number;
let stdOut: string;
let execResult;
let exitCode: number
let stdOut: string
let execResult
if (!process.env.NPMTS_TEST) { // NPMTS_TEST is used during testing
for (let i = 0; i <= retryArg; i++) {
if (!bareArg) {
execResult = plugins.shelljs.exec(
`bash -c "${nvmSourceString} ${commandArg}"`
);
)
} else {
execResult = plugins.shelljs.exec(commandArg);
execResult = plugins.shelljs.exec(commandArg)
}
exitCode = execResult.code;
stdOut = execResult.stdout;
if (exitCode !== 0 && i == retryArg) {
process.exit(1);
} else if (exitCode == 0) {
i = retryArg + 1; // if everything works out ok retrials are not wanted
exitCode = execResult.code
stdOut = execResult.stdout
if (exitCode !== 0 && i === retryArg) {
process.exit(1)
} else if (exitCode === 0) {
i = retryArg + 1 // if everything works out ok retrials are not wanted
} else {
plugins.beautylog.warn("Something went wrong! Exit Code: " + exitCode.toString());
plugins.beautylog.info("Retry " + (i + 1).toString() + " of " + retryArg.toString());
plugins.beautylog.warn('Something went wrong! Exit Code: ' + exitCode.toString())
plugins.beautylog.info('Retry ' + (i + 1).toString() + ' of ' + retryArg.toString())
}
}
} else {
plugins.beautylog.log("ShellExec would be: " + commandArg)
plugins.beautylog.log('ShellExec would be: ' + commandArg)
}
return stdOut;
return stdOut
}
export let bashBare = (commandArg, retryArg = 2) => {
return bash(commandArg, retryArg, true);
return bash(commandArg, retryArg, true)
}

View File

@ -1,43 +1,43 @@
import * as plugins from "./npmci.plugins";
import * as paths from "./npmci.paths";
import * as NpmciEnv from "./npmci.env";
import {bashBare} from "./npmci.bash";
import * as plugins from './npmci.plugins'
import * as paths from './npmci.paths'
import * as NpmciEnv from './npmci.env'
import {bashBare} from './npmci.bash'
/**
* builds a cwd of Dockerfiles by triggering a promisechain
*/
export let build = function(){
let done = plugins.q.defer();
let done = plugins.q.defer()
readDockerfiles()
.then(sortDockerfiles)
.then(mapDockerfiles)
.then(buildDockerfiles)
.then(pushDockerfiles)
.then(() => {
done.resolve();
});
return done.promise;
done.resolve()
})
return done.promise
}
/**
* creates instance of class Dockerfile for all Dockerfiles in cwd
* @returns Promise<Dockerfile[]>
*/
export let readDockerfiles = function():plugins.q.Promise<Dockerfile[]>{
let done = plugins.q.defer<Dockerfile[]>();
let readDockerfilesArray:Dockerfile[] = []
plugins.gulp.src("./Dockerfile*")
export let readDockerfiles = function(): plugins.q.Promise<Dockerfile[]>{
let done = plugins.q.defer<Dockerfile[]>()
let readDockerfilesArray: Dockerfile[] = []
plugins.gulp.src('./Dockerfile*')
.pipe(plugins.through2.obj(function(file,enc,cb){
let myDockerfile = new Dockerfile({
filePath:file.path,
read:true
});
readDockerfilesArray.push(myDockerfile);
cb(null,file);
filePath: file.path,
read: true
})
readDockerfilesArray.push(myDockerfile)
cb(null,file)
},function(){
done.resolve(readDockerfilesArray);
}));
return done.promise;
done.resolve(readDockerfilesArray)
}))
return done.promise
}
/**
@ -45,249 +45,249 @@ export let readDockerfiles = function():plugins.q.Promise<Dockerfile[]>{
* @param sortableArrayArg an array of instances of class Dockerfile
* @returns Promise<Dockerfile[]>
*/
export let sortDockerfiles = function(sortableArrayArg:Dockerfile[]):plugins.q.Promise<Dockerfile[]>{
let done = plugins.q.defer<Dockerfile[]>();
let sortedArray:Dockerfile[] = [];
let cleanTagsOriginal = cleanTagsArrayFunction(sortableArrayArg,sortedArray);
let sorterFunctionCounter:number = 0;
export let sortDockerfiles = function(sortableArrayArg: Dockerfile[]): plugins.q.Promise<Dockerfile[]>{
let done = plugins.q.defer<Dockerfile[]>()
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);
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 (cleanTagsOriginal.indexOf(dockerfileArg.baseImage) !== -1) {
dockerfileArg.localBaseImageDependent = true
};
});
if(sortableArrayArg.length == sortedArray.length){
done.resolve(sortedArray);
})
if (sortableArrayArg.length === sortedArray.length) {
done.resolve(sortedArray)
} else if (sorterFunctionCounter < 10) {
sorterFunctionCounter++;
sorterFunction();
sorterFunctionCounter++
sorterFunction()
};
}
sorterFunction();
return done.promise;
};
sorterFunction()
return done.promise
}
/**
* maps local Dockerfiles dependencies to the correspoding Dockerfile class instances
*/
export let mapDockerfiles = function(sortedArray:Dockerfile[]):plugins.q.Promise<Dockerfile[]>{
let done = plugins.q.defer<Dockerfile[]>();
export let mapDockerfiles = function(sortedArray: Dockerfile[]): plugins.q.Promise<Dockerfile[]>{
let done = plugins.q.defer<Dockerfile[]>()
sortedArray.forEach((dockerfileArg) => {
if(dockerfileArg.localBaseImageDependent){
sortedArray.forEach((dockfile2:Dockerfile) => {
if(dockfile2.cleanTag == dockerfileArg.baseImage){
dockerfileArg.localBaseDockerfile = dockfile2;
if (dockerfileArg.localBaseImageDependent) {
sortedArray.forEach((dockfile2: Dockerfile) => {
if (dockfile2.cleanTag === dockerfileArg.baseImage) {
dockerfileArg.localBaseDockerfile = dockfile2
}
})
};
});
done.resolve(sortedArray);
return done.promise;
})
done.resolve(sortedArray)
return done.promise
}
/**
* builds the correspoding real docker image for each Dockerfile class instance
*/
export let buildDockerfiles = (sortedArrayArg:Dockerfile[]) => {
let done = plugins.q.defer();
export let buildDockerfiles = (sortedArrayArg: Dockerfile[]) => {
let done = plugins.q.defer()
sortedArrayArg.forEach(function(dockerfileArg){
dockerfileArg.build();
dockerfileArg.build()
})
done.resolve(sortedArrayArg);
return done.promise;
done.resolve(sortedArrayArg)
return done.promise
}
/**
* pushes the real Dockerfile images to a Docker registry
*/
export let pushDockerfiles = function(sortedArrayArg:Dockerfile[]){
let done = plugins.q.defer();
export let pushDockerfiles = function(sortedArrayArg: Dockerfile[]){
let done = plugins.q.defer()
sortedArrayArg.forEach(function(dockerfileArg){
dockerfileArg.push(NpmciEnv.buildStage);
});
done.resolve(sortedArrayArg);
return done.promise;
dockerfileArg.push(NpmciEnv.buildStage)
})
done.resolve(sortedArrayArg)
return done.promise
}
/**
* pulls corresponding real Docker images for instances of Dockerfile from a registry.
* This is needed if building, testing, and publishing of Docker images is carried out in seperate CI stages.
*/
export let pullDockerfileImages = (sortableArrayArg:Dockerfile[],registryArg = "registry.gitlab.com") => {
let done = plugins.q.defer();
export let pullDockerfileImages = (sortableArrayArg: Dockerfile[],registryArg = 'registry.gitlab.com') => {
let done = plugins.q.defer()
sortableArrayArg.forEach((dockerfileArg) => {
dockerfileArg.pull(registryArg);
});
done.resolve(sortableArrayArg);
return done.promise;
dockerfileArg.pull(registryArg)
})
done.resolve(sortableArrayArg)
return done.promise
}
/**
* tests all Dockerfiles in by calling class Dockerfile.test();
* @param sortedArrayArg Dockerfile[] that contains all Dockerfiles in cwd
*/
export let testDockerfiles = (sortedArrayArg:Dockerfile[]) => {
let done = plugins.q.defer();
export let testDockerfiles = (sortedArrayArg: Dockerfile[]) => {
let done = plugins.q.defer()
sortedArrayArg.forEach(function(dockerfileArg){
dockerfileArg.test();
});
done.resolve(sortedArrayArg);
return done.promise;
};
dockerfileArg.test()
})
done.resolve(sortedArrayArg)
return done.promise
}
/**
* class Dockerfile represents a Dockerfile on disk in npmci
*/
export class Dockerfile {
filePath:string;
repo:string;
version:string;
cleanTag:string;
buildTag:string;
testTag: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.testTag = dockerTag("registry.gitlab.com",this.repo,this.version,"test");
this.releaseTag = dockerTag(NpmciEnv.dockerRegistry,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));
filePath: string
repo: string
version: string
cleanTag: string
buildTag: string
testTag: 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.testTag = dockerTag('registry.gitlab.com',this.repo,this.version,'test')
this.releaseTag = dockerTag(NpmciEnv.dockerRegistry,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;
this.baseImage = dockerBaseImage(this.content)
this.localBaseImageDependent = false
};
/**
* builds the Dockerfile
*/
build(){
let done = plugins.q.defer();
plugins.beautylog.info("now building Dockerfile for " + this.cleanTag);
bashBare("docker build -t " + this.buildTag + " -f " + this.filePath + " .");
NpmciEnv.dockerFilesBuilt.push(this);
done.resolve();
return done.promise;
build() {
let done = plugins.q.defer()
plugins.beautylog.info('now building Dockerfile for ' + this.cleanTag)
bashBare('docker build -t ' + this.buildTag + ' -f ' + this.filePath + ' .')
NpmciEnv.dockerFilesBuilt.push(this)
done.resolve()
return done.promise
};
/**
* pushes the Dockerfile to a registry
*/
push(stageArg){
let done = plugins.q.defer();
let pushTag;
switch (stageArg){
case "release":
pushTag = this.releaseTag;
break;
case "test":
push(stageArg) {
let done = plugins.q.defer()
let pushTag
switch (stageArg) {
case 'release':
pushTag = this.releaseTag
break
case 'test':
default:
pushTag = this.testTag;
break;
pushTag = this.testTag
break
}
bashBare("docker tag " + this.buildTag + " " + pushTag);
bashBare("docker push " + pushTag);
done.resolve();
return done.promise;
bashBare('docker tag ' + this.buildTag + ' ' + pushTag)
bashBare('docker push ' + pushTag)
done.resolve()
return done.promise
};
/**
* pulls the Dockerfile from a registry
*/
pull(registryArg:string){
let pullTag = this.testTag;
bashBare("docker pull " + pullTag);
bashBare("docker tag " + pullTag + " " + this.buildTag);
pull(registryArg: string) {
let pullTag = this.testTag
bashBare('docker pull ' + pullTag)
bashBare('docker tag ' + pullTag + ' ' + this.buildTag)
};
/**
* tests the Dockerfile;
*/
test(){
let testFile:string = plugins.path.join(paths.NpmciTestDir,"test_" + this.version + ".sh");
let testFileExists:boolean = plugins.smartfile.fs.fileExistsSync(testFile);
if(testFileExists){
bashBare("docker run --name npmci_test_container " + this.buildTag + " mkdir /npmci_test");
bashBare("docker cp " + testFile + " npmci_test_container:/npmci_test/test.sh");
bashBare("docker commit npmci_test_container npmci_test_image");
bashBare("docker run npmci_test_image sh /npmci_test/test.sh");
bashBare("docker rm npmci_test_container");
bashBare("docker rmi --force npmci_test_image");
test() {
let testFile: string = plugins.path.join(paths.NpmciTestDir,'test_' + this.version + '.sh')
let testFileExists: boolean = plugins.smartfile.fs.fileExistsSync(testFile)
if (testFileExists) {
bashBare('docker run --name npmci_test_container ' + this.buildTag + ' mkdir /npmci_test')
bashBare('docker cp ' + testFile + ' npmci_test_container:/npmci_test/test.sh')
bashBare('docker commit npmci_test_container npmci_test_image')
bashBare('docker run npmci_test_image sh /npmci_test/test.sh')
bashBare('docker rm npmci_test_container')
bashBare('docker rmi --force npmci_test_image')
} else {
plugins.beautylog.warn("skipping tests for " + this.cleanTag + " because no testfile was found!");
plugins.beautylog.warn('skipping tests for ' + this.cleanTag + ' because no testfile was found!')
}
};
/**
* gets the id of a Dockerfile
*/
getId(){
let containerId = bashBare("docker inspect --type=image --format=\"{{.Id}}\" " + this.buildTag);
return containerId;
getId() {
let containerId = bashBare('docker inspect --type=image --format=\"{{.Id}}\" ' + this.buildTag)
return containerId
};
}
/**
*
*/
export let dockerFileVersion = function(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];
export let dockerFileVersion = function(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";
versionString = 'latest'
}
return versionString;
return versionString
}
/**
*
*/
export let dockerBaseImage = function(dockerfileContentArg:string){
export let dockerBaseImage = function(dockerfileContentArg: string){
let baseImageRegex = /FROM\s([a-zA-z0-9\/\-\:]*)\n?/
let regexResultArray = baseImageRegex.exec(dockerfileContentArg)
return regexResultArray[1];
return regexResultArray[1]
}
/**
*
*/
export let dockerTag = function(registryArg:string,repoArg:string,versionArg:string,suffixArg?:string):string{
let tagString:string;
let registry = registryArg;
let repo = repoArg;
let version = versionArg;
if(suffixArg){
version = versionArg + "_" + suffixArg;
export let dockerTag = function(registryArg: string,repoArg: string,versionArg: string,suffixArg?: string): string{
let tagString: string
let registry = registryArg
let repo = repoArg
let version = versionArg
if (suffixArg) {
version = versionArg + '_' + suffixArg
};
tagString = registry + "/" + repo + ":" + version;
return tagString;
};
tagString = registry + '/' + repo + ':' + version
return tagString
}
/**
*
*/
export let cleanTagsArrayFunction = function(dockerfileArrayArg:Dockerfile[],trackingArrayArg:Dockerfile[]):string[]{
let cleanTagsArray:string[] = [];
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);
if (trackingArrayArg.indexOf(dockerfileArg) === -1) {
cleanTagsArray.push(dockerfileArg.cleanTag)
}
});
return cleanTagsArray;
})
return cleanTagsArray
}

View File

@ -1,26 +1,23 @@
import "typings-global";
import * as plugins from "./npmci.plugins";
import {bash} from "./npmci.bash";
import * as env from "./npmci.env";
import * as buildDocker from "./npmci.build.docker"
import 'typings-global'
import * as plugins from './npmci.plugins'
import {bash} from './npmci.bash'
import * as env from './npmci.env'
import * as buildDocker from './npmci.build.docker'
/**
* defines possible build services
*/
export type TBuildService = "docker";
export type TBuildService = 'docker';
/**
* builds for a specific service
*/
export let build = function(commandArg):plugins.q.Promise<any> {
switch(commandArg){
case "docker":
return buildDocker.build();
export let build = function(commandArg): plugins.q.Promise<any> {
switch (commandArg) {
case 'docker':
return buildDocker.build()
default:
plugins.beautylog.log("build target " + commandArg + " not recognised!");
plugins.beautylog.log('build target ' + commandArg + ' not recognised!')
};
return;
return
}

20
ts/npmci.config.ts Normal file
View File

@ -0,0 +1,20 @@
import * as q from 'q'
import * as plugins from './npmci.plugins'
import * as paths from './npmci.paths'
export interface INpmciOptions {
globalNpmTools: string[]
}
export let getConfig = () => {
console.log('getting config')
let done = q.defer<INpmciOptions>()
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd)
let defaultConfig: INpmciOptions = {
globalNpmTools: []
}
let npmciConfig = npmciNpmextra.dataFor<INpmciOptions>('npmci', defaultConfig)
done.resolve(npmciConfig)
return done.promise
}

View File

@ -1,8 +1,8 @@
import 'typings-global';
import * as plugins from './npmci.plugins';
import { bash } from './npmci.bash';
import 'typings-global'
import * as plugins from './npmci.plugins'
import * as configModule from './npmci.config'
import { bash } from './npmci.bash'
import { nvmAvailable } from './npmci.bash'
export let install = (versionArg) => {
let done = plugins.q.defer()
plugins.beautylog.log(`now installing node version ${versionArg}`)
@ -24,6 +24,15 @@ export let install = (versionArg) => {
};
bash('node -v')
bash('npm -v')
done.resolve()
// lets look for further config
configModule.getConfig()
.then(config => {
for (let npmTool of config.globalNpmTools) {
plugins.beautylog.info(`globally installing ${npmTool} from npm`)
bash(`npm install --loglevel=silent -g ${npmTool}`)
}
done.resolve()
})
return done.promise
}

View File

@ -1,9 +1,9 @@
import "typings-global";
import * as plugins from "./npmci.plugins";
import 'typings-global'
import * as plugins from './npmci.plugins'
export let cwd = process.cwd();
export let cwd = process.cwd()
export let NpmciPackageRoot = plugins.path.join(__dirname,"../");
export let NpmciPackageConfig = plugins.path.join(NpmciPackageRoot,"./config.json");
export let NpmciProjectDir = cwd;
export let NpmciTestDir = plugins.path.join(cwd,"./test");
export let NpmciPackageRoot = plugins.path.join(__dirname,'../')
export let NpmciPackageConfig = plugins.path.join(NpmciPackageRoot,'./config.json')
export let NpmciProjectDir = cwd
export let NpmciTestDir = plugins.path.join(cwd,'./test')

View File

@ -1,17 +1,18 @@
import "typings-global";
export import beautylog = require("beautylog");
export let gulp = require("gulp");
export let gulpFunction = require("gulp-function");
export let lodash = require("lodash");
export import path = require("path");
export import projectinfo = require("projectinfo");
export import q = require("q");
export let request = require("request");
export import shelljs = require("shelljs");
export import smartcli = require("smartcli");
export import smartfile = require("smartfile");
export import smartparam = require("smartparam");
export import smartsocket = require("smartsocket");
export import smartssh = require("smartssh");
export import smartstring = require("smartstring");
export let through2 = require("through2");
import 'typings-global'
export import beautylog = require('beautylog')
export let gulp = require('gulp')
export import gulpFunction = require('gulp-function')
export import lodash = require('lodash')
export import npmextra = require('npmextra')
export import path = require('path')
export import projectinfo = require('projectinfo')
export import q = require('q')
export let request = require('request')
export import shelljs = require('shelljs')
export import smartcli = require('smartcli')
export import smartfile = require('smartfile')
export import smartparam = require('smartparam')
export import smartsocket = require('smartsocket')
export import smartssh = require('smartssh')
export import smartstring = require('smartstring')
export import through2 = require('through2')

View File

@ -1,94 +1,94 @@
import "typings-global";
import * as plugins from "./npmci.plugins";
import {bash} from "./npmci.bash";
import * as env from "./npmci.env"
import * as sshModule from "./npmci.ssh"
import 'typings-global'
import * as plugins from './npmci.plugins'
import {bash} from './npmci.bash'
import * as env from './npmci.env'
import * as sshModule from './npmci.ssh'
//types
// types
/**
* defines possible prepare services
*/
export type TPrepService = "npm" | "docker" | "docker-gitlab" | "ssh";
export type TPrepService = 'npm' | 'docker' | 'docker-gitlab' | 'ssh';
/**
* authenticates npm with token from env var
*/
let npm = function(){
let done = plugins.q.defer();
let done = plugins.q.defer()
let npmrcPrefix:string = "//registry.npmjs.org/:_authToken=";
let npmToken:string = process.env.NPMCI_TOKEN_NPM;
let npmrcFileString = npmrcPrefix + npmToken;
let npmrcPrefix: string = '//registry.npmjs.org/:_authToken='
let npmToken: string = process.env.NPMCI_TOKEN_NPM
let npmrcFileString = npmrcPrefix + npmToken
if(npmToken){
plugins.beautylog.info("found access token");
if (npmToken) {
plugins.beautylog.info('found access token')
} else {
plugins.beautylog.error("no access token found! Exiting!");
process.exit(1);
plugins.beautylog.error('no access token found! Exiting!')
process.exit(1)
}
plugins.smartfile.memory.toFsSync(npmrcFileString,"/root/.npmrc");
done.resolve();
return done.promise;
};
plugins.smartfile.memory.toFsSync(npmrcFileString,'/root/.npmrc')
done.resolve()
return done.promise
}
/**
* logs in docker
*/
let docker = function(){
let done = plugins.q.defer();
env.setDockerRegistry("docker.io");
let done = plugins.q.defer()
env.setDockerRegistry('docker.io')
let dockerRegex = /^([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)/
if(!process.env.NPMCI_LOGIN_DOCKER){
plugins.beautylog.error("You have to specify Login Data to the Docker Registry");
process.exit(1);
if (!process.env.NPMCI_LOGIN_DOCKER) {
plugins.beautylog.error('You have to specify Login Data to the Docker Registry')
process.exit(1)
}
plugins.shelljs.exec("docker login -u gitlab-ci-token -p " + process.env.CI_BUILD_TOKEN + " " + "registry.gitlab.com"); // Always also login to GitLab Registry
let dockerRegexResultArray = dockerRegex.exec(process.env.NPMCI_LOGIN_DOCKER);
let username = dockerRegexResultArray[1];
let password = dockerRegexResultArray[2];
plugins.shelljs.exec("docker login -u " + username + " -p " + password);
done.resolve();
return done.promise;
plugins.shelljs.exec('docker login -u gitlab-ci-token -p ' + process.env.CI_BUILD_TOKEN + ' ' + 'registry.gitlab.com') // Always also login to GitLab Registry
let dockerRegexResultArray = dockerRegex.exec(process.env.NPMCI_LOGIN_DOCKER)
let username = dockerRegexResultArray[1]
let password = dockerRegexResultArray[2]
plugins.shelljs.exec('docker login -u ' + username + ' -p ' + password)
done.resolve()
return done.promise
}
/**
* prepare docker for gitlab registry
*/
let dockerGitlab = function(){
let done = plugins.q.defer();
env.setDockerRegistry("registry.gitlab.com");
plugins.shelljs.exec("docker login -u gitlab-ci-token -p " + process.env.CI_BUILD_TOKEN + " " + "registry.gitlab.com");
done.resolve();
return done.promise;
let done = plugins.q.defer()
env.setDockerRegistry('registry.gitlab.com')
plugins.shelljs.exec('docker login -u gitlab-ci-token -p ' + process.env.CI_BUILD_TOKEN + ' ' + 'registry.gitlab.com')
done.resolve()
return done.promise
}
/**
* prepare ssh
*/
let ssh = function(){
let done = plugins.q.defer();
let done = plugins.q.defer()
sshModule.ssh()
.then(done.resolve);
return done.promise;
};
.then(done.resolve)
return done.promise
}
/**
* the main exported prepare function
* @param servieArg describes the service to prepare
*/
export let prepare = function(serviceArg:TPrepService){
export let prepare = function(serviceArg: TPrepService){
switch (serviceArg) {
case "npm":
return npm();
case "docker":
return docker();
case "docker-gitlab":
return dockerGitlab();
case "ssh":
return ssh();
case 'npm':
return npm()
case 'docker':
return docker()
case 'docker-gitlab':
return dockerGitlab()
case 'ssh':
return ssh()
default:
break;
break
}
}

View File

@ -1,50 +1,50 @@
import "typings-global";
import * as plugins from "./npmci.plugins";
import {prepare} from "./npmci.prepare";
import {bash} from "./npmci.bash";
import * as NpmciEnv from "./npmci.env";
import * as NpmciBuildDocker from "./npmci.build.docker"
import 'typings-global'
import * as plugins from './npmci.plugins'
import {prepare} from './npmci.prepare'
import {bash} from './npmci.bash'
import * as NpmciEnv from './npmci.env'
import * as NpmciBuildDocker from './npmci.build.docker'
/**
* type of supported services
*/
export type TPubService = "npm" | "docker";
export type TPubService = 'npm' | 'docker';
/**
* the main exported publish function.
* @param pubServiceArg references targeted service to publish to
*/
export let publish = (pubServiceArg:TPubService = "npm") => {
switch (pubServiceArg){
case "npm":
return publishNpm();
case "docker":
return publishDocker();
export let publish = (pubServiceArg: TPubService = 'npm') => {
switch (pubServiceArg) {
case 'npm':
return publishNpm()
case 'docker':
return publishDocker()
}
};
}
/**
* tries to publish current cwd to NPM registry
*/
let publishNpm = function(){
let done = plugins.q.defer();
prepare("npm")
let done = plugins.q.defer()
prepare('npm')
.then(function(){
bash("npm publish");
plugins.beautylog.ok("Done!") ;
done.resolve();
});
return done.promise;
bash('npm publish')
plugins.beautylog.ok('Done!')
done.resolve()
})
return done.promise
}
/**
* tries to pubish current cwd to Docker registry
*/
let publishDocker = function(){
let done = plugins.q.defer();
let done = plugins.q.defer()
NpmciBuildDocker.readDockerfiles()
.then(NpmciBuildDocker.pullDockerfileImages)
.then(NpmciBuildDocker.pushDockerfiles)
.then(done.resolve);
return done.promise;
};
.then(done.resolve)
return done.promise
}

View File

@ -1,26 +1,26 @@
import * as plugins from "./npmci.plugins";
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 = /^(.*)\|(.*)\|(.*)/;
let servezoneRegex = /^(.*)\|(.*)\|(.*)/
/**
* holds the results of the parsed servezone env string
*/
let servezoneRegexResultArray = servezoneRegex.exec(process.env.NPMCI_SERVEZONE);
let servezoneRegexResultArray = servezoneRegex.exec(process.env.NPMCI_SERVEZONE)
/**
* the data object that is used for the smartsocket client object
*/
let smartsocketClientConstructorOptions = {
alias: "npmci",
alias: 'npmci',
password: servezoneRegexResultArray[3],
port: parseInt(servezoneRegexResultArray[2]),
role: "ci",
role: 'ci',
url: servezoneRegexResultArray[1]
};
}
/**
* the main run function to submit a service to a servezone
@ -28,5 +28,5 @@ let smartsocketClientConstructorOptions = {
export let run = (configArg) => {
new plugins.smartsocket.SmartsocketClient(
smartsocketClientConstructorOptions
);
};
)
}

View File

@ -1,51 +1,51 @@
import "typings-global";
import * as plugins from "./npmci.plugins";
import 'typings-global'
import * as plugins from './npmci.plugins'
let sshRegex = /^(.*)\|(.*)\|(.*)/
let sshInstance:plugins.smartssh.SshInstance;
let sshInstance: plugins.smartssh.SshInstance
/**
* checks for ENV vars in form of NPMCI_SSHKEY_* and deploys any found ones
*/
export let ssh = () => {
let done = plugins.q.defer();
sshInstance = new plugins.smartssh.SshInstance(); // init ssh instance
plugins.smartparam.forEachMinimatch(process.env,"NPMCI_SSHKEY_*",evaluateSshEnv);
if(!process.env.NPMTS_TEST){
sshInstance.writeToDisk();
let done = plugins.q.defer()
sshInstance = new plugins.smartssh.SshInstance() // init ssh instance
plugins.smartparam.forEachMinimatch(process.env,'NPMCI_SSHKEY_*',evaluateSshEnv)
if (!process.env.NPMTS_TEST) {
sshInstance.writeToDisk()
} else {
plugins.beautylog.log("In test mode, so not storing SSH keys to disk!");
plugins.beautylog.log('In test mode, so not storing SSH keys to disk!')
};
done.resolve();
return done.promise;
};
done.resolve()
return done.promise
}
/**
* gets called for each found SSH ENV Var and deploys it
*/
let evaluateSshEnv = (sshkeyEnvVarArg) => {
let resultArray = sshRegex.exec(sshkeyEnvVarArg);
let sshKey = new plugins.smartssh.SshKey();
plugins.beautylog.info("Found SSH identity for " + resultArray[1]);
if(notUndefined(resultArray[1])){
plugins.beautylog.log("---> host defined!")
sshKey.host = resultArray[1];
let resultArray = sshRegex.exec(sshkeyEnvVarArg)
let sshKey = new plugins.smartssh.SshKey()
plugins.beautylog.info('Found SSH identity for ' + resultArray[1])
if (notUndefined(resultArray[1])) {
plugins.beautylog.log('---> host defined!')
sshKey.host = resultArray[1]
}
if(notUndefined(resultArray[2])){
plugins.beautylog.log("---> privKey defined!")
sshKey.privKeyBase64 = resultArray[2];
if (notUndefined(resultArray[2])) {
plugins.beautylog.log('---> privKey defined!')
sshKey.privKeyBase64 = resultArray[2]
};
if(notUndefined(resultArray[3])){
"---> pubKey defined!"
sshKey.pubKeyBase64 = resultArray[3];
if (notUndefined(resultArray[3])) {
'---> pubKey defined!'
sshKey.pubKeyBase64 = resultArray[3]
};
sshInstance.addKey(sshKey);
};
sshInstance.addKey(sshKey)
}
/**
* checks if not undefined
*/
let notUndefined = (stringArg:string) => {
return (stringArg && stringArg != "undefined" && stringArg != "##");
let notUndefined = (stringArg: string) => {
return (stringArg && stringArg !== 'undefined' && stringArg !== '##')
}

View File

@ -1,50 +1,50 @@
import "typings-global";
import * as plugins from "./npmci.plugins";
import {bash} from "./npmci.bash";
import {install} from "./npmci.install";
import * as env from "./npmci.env";
import * as NpmciBuildDocker from "./npmci.build.docker";
import 'typings-global'
import * as plugins from './npmci.plugins'
import {bash} from './npmci.bash'
import {install} from './npmci.install'
import * as env from './npmci.env'
import * as NpmciBuildDocker from './npmci.build.docker'
export let test = (versionArg) => {
let done = plugins.q.defer();
if(versionArg == "docker"){
let done = plugins.q.defer()
if (versionArg === 'docker') {
testDocker()
.then(()=>{
done.resolve();
});
.then(() => {
done.resolve()
})
} else {
install(versionArg)
.then(npmDependencies)
.then(npmTest)
.then(()=>{
done.resolve();
});
.then(() => {
done.resolve()
})
}
return done.promise;
return done.promise
}
let npmDependencies = function(){
let done = plugins.q.defer();
plugins.beautylog.info("now installing dependencies:");
bash("npm install");
done.resolve();
return done.promise;
let done = plugins.q.defer()
plugins.beautylog.info('now installing dependencies:')
bash('npm install')
done.resolve()
return done.promise
}
let npmTest = () => {
let done = plugins.q.defer();
plugins.beautylog.info("now starting tests:");
bash("npm test");
done.resolve();
return done.promise;
let done = plugins.q.defer()
plugins.beautylog.info('now starting tests:')
bash('npm test')
done.resolve()
return done.promise
}
let testDocker = function(){
let done = plugins.q.defer();
let done = plugins.q.defer()
NpmciBuildDocker.readDockerfiles()
.then(NpmciBuildDocker.pullDockerfileImages)
.then(NpmciBuildDocker.testDockerfiles)
.then(done.resolve)
return done.promise;
return done.promise
}

View File

@ -1,32 +1,31 @@
import "typings-global";
import * as plugins from "./npmci.plugins";
import {prepare} from "./npmci.prepare";
import {bash} from "./npmci.bash";
import 'typings-global'
import * as plugins from './npmci.plugins'
import { prepare } from './npmci.prepare'
import { bash } from './npmci.bash'
let triggerValueRegex = /^([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|?([a-zA-Z0-9\.\-\/]*)/;
let triggerValueRegex = /^([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|([a-zA-Z0-9\.]*)\|?([a-zA-Z0-9\.\-\/]*)/
export let trigger = function () {
let done = plugins.q.defer();
plugins.beautylog.info("now running triggers");
plugins.smartparam.forEachMinimatch(process.env, "NPMCI_TRIGGER_*", evaluateTrigger);
done.resolve();
return done.promise;
let done = plugins.q.defer()
plugins.beautylog.info('now running triggers')
plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_TRIGGER_*', evaluateTrigger)
done.resolve()
return done.promise
}
let evaluateTrigger = (triggerEnvVarArg) => {
let triggerRegexResultArray = triggerValueRegex.exec(triggerEnvVarArg);
let regexDomain = triggerRegexResultArray[1];
let regexProjectId = triggerRegexResultArray[2];
let regexProjectTriggerToken = triggerRegexResultArray[3];
let regexRefName = triggerRegexResultArray[4];
let regexTriggerName;
if (triggerRegexResultArray.length == 6) {
regexTriggerName = triggerRegexResultArray[5];
let triggerRegexResultArray = triggerValueRegex.exec(triggerEnvVarArg)
let regexDomain = triggerRegexResultArray[1]
let regexProjectId = triggerRegexResultArray[2]
let regexProjectTriggerToken = triggerRegexResultArray[3]
let regexRefName = triggerRegexResultArray[4]
let regexTriggerName
if (triggerRegexResultArray.length === 6) {
regexTriggerName = triggerRegexResultArray[5]
} else {
regexTriggerName = "Unnamed Trigger";
regexTriggerName = 'Unnamed Trigger'
}
plugins.beautylog.info("Found Trigger!");
plugins.beautylog.log("triggering build for ref " + regexRefName + " of " + regexTriggerName);
plugins.request.post("https://gitlab.com/api/v3/projects/" + regexProjectId + "/trigger/builds", { form: { token: regexProjectTriggerToken, ref: regexRefName } });
plugins.beautylog.info('Found Trigger!')
plugins.beautylog.log('triggering build for ref ' + regexRefName + ' of ' + regexTriggerName)
plugins.request.post('https://gitlab.com/api/v3/projects/' + regexProjectId + '/trigger/builds', { form: { token: regexProjectTriggerToken, ref: regexRefName } })
}