From 563414882e6038372713816c1af792c77ee0a40c Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Mon, 28 Aug 2017 01:35:21 +0200 Subject: [PATCH] now working correctly and async --- dist/mod_docker/index.js | 6 +++--- dist/mod_docker/mod.classes.dockerregistry.js | 5 +++-- .../mod_docker/mod.classes.registrystorage.js | 4 +++- package.json | 4 ++-- test/test.ts | 20 ++++++++++++++++++- ts/mod_docker/index.ts | 4 ++-- ts/mod_docker/mod.classes.dockerregistry.ts | 3 ++- ts/mod_docker/mod.classes.registrystorage.ts | 1 + yarn.lock | 12 +++++------ 9 files changed, 41 insertions(+), 18 deletions(-) diff --git a/dist/mod_docker/index.js b/dist/mod_docker/index.js index 9894c80..24aecb3 100644 --- a/dist/mod_docker/index.js +++ b/dist/mod_docker/index.js @@ -69,7 +69,7 @@ exports.prepare = () => __awaiter(this, void 0, void 0, function* () { // 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; + process.exit(1); } npmciRegistryStorage.addRegistry(new mod_classes_dockerregistry_1.DockerRegistry({ registryUrl: 'registry.gitlab.com', @@ -77,7 +77,7 @@ exports.prepare = () => __awaiter(this, void 0, void 0, function* () { password: process.env.CI_BUILD_TOKEN })); // handle registries - plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_LOGIN_DOCKER*', (envString) => __awaiter(this, void 0, void 0, function* () { + yield plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_LOGIN_DOCKER*', (envString) => __awaiter(this, void 0, void 0, function* () { npmciRegistryStorage.addRegistry(mod_classes_dockerregistry_1.DockerRegistry.fromEnvString(envString)); yield npmciRegistryStorage.loginAll(); })); @@ -115,4 +115,4 @@ exports.test = () => __awaiter(this, void 0, void 0, function* () { return yield helpers.readDockerfiles() .then(helpers.testDockerfiles); }); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLC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BQztTQUM3QixJQUFJLENBQUMsT0FBTyxDQUFDLGNBQWMsQ0FBQyxDQUFBO0lBQy9CLEdBQUcsQ0FBQyxDQUFDLElBQUksVUFBVSxJQUFJLGVBQWUsQ0FBQyxDQUFDLENBQUM7UUFDdkMsVUFBVSxDQUFDLElBQUksQ0FBQyxtQkFBbUIsRUFBRSxNQUFNLENBQUMsQ0FBQTtJQUM5QyxDQUFDO0FBQ0gsQ0FBQyxDQUFBLENBQUE7QUFFVSxRQUFBLElBQUksR0FBRztJQUNoQixNQUFNLENBQUMsTUFBTSxPQUFPLENBQUMsZUFBZSxFQUFFO1NBQ25DLElBQUksQ0FBQyxPQUFPLENBQUMsZUFBZSxDQUFDLENBQUE7QUFDbEMsQ0FBQyxDQUFBLENBQUEifQ== \ No newline at end of file diff --git a/dist/mod_docker/mod.classes.dockerregistry.js b/dist/mod_docker/mod.classes.dockerregistry.js index 24cfc21..0167f90 100644 --- a/dist/mod_docker/mod.classes.dockerregistry.js +++ b/dist/mod_docker/mod.classes.dockerregistry.js @@ -15,6 +15,7 @@ class DockerRegistry { this.registryUrl = optionsArg.registryUrl; this.username = optionsArg.username; this.password = optionsArg.password; + plugins.beautylog.info(`created DockerRegistry for ${this.registryUrl}`); } static fromEnvString(envString) { let dockerRegexResultArray = envString.split('|'); @@ -41,9 +42,9 @@ class DockerRegistry { else { yield npmci_bash_1.bash(`docker login -u ${this.username} -p ${this.password} ${this.registryUrl}`); } - plugins.beautylog.success(`docker authenticated for ${this.registryUrl}!`); + plugins.beautylog.ok(`docker authenticated for ${this.registryUrl}!`); }); } } exports.DockerRegistry = DockerRegistry; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLmNsYXNzZXMuZG9ja2VycmVnaXN0cnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfZG9ja2VyL21vZC5jbGFzc2VzLmRvY2tlcnJlZ2lzdHJ5LnRzIl0s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DLFFBQVEsRUFBRSxDQUFDLENBQUE7Z0JBQ2xFLE9BQU8sQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLGtDQUFrQyxDQUFDLENBQUE7WUFDNUQsQ0FBQztZQUFDLElBQUksQ0FBQyxDQUFDO2dCQUNOLE1BQU0saUJBQUksQ0FBQyxtQkFBbUIsSUFBSSxDQUFDLFFBQVEsT0FBTyxJQUFJLENBQUMsUUFBUSxJQUFJLElBQUksQ0FBQyxXQUFXLEVBQUUsQ0FBQyxDQUFBO1lBQ3hGLENBQUM7WUFDRCxPQUFPLENBQUMsU0FBUyxDQUFDLEVBQUUsQ0FBQyw0QkFBNEIsSUFBSSxDQUFDLFdBQVcsR0FBRyxDQUFDLENBQUE7UUFDdkUsQ0FBQztLQUFBO0NBQ0Y7QUFyQ0Qsd0NBcUNDIn0= \ No newline at end of file diff --git a/dist/mod_docker/mod.classes.registrystorage.js b/dist/mod_docker/mod.classes.registrystorage.js index 0647df8..633980f 100644 --- a/dist/mod_docker/mod.classes.registrystorage.js +++ b/dist/mod_docker/mod.classes.registrystorage.js @@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", { value: true }); +const plugins = require("./mod.plugins"); const lik_1 = require("lik"); class RegistryStorage { constructor() { @@ -27,8 +28,9 @@ class RegistryStorage { yield this.objectMap.forEach((registryArg) => __awaiter(this, void 0, void 0, function* () { yield registryArg.login(); })); + plugins.beautylog.success('logged in successfully into all available DockerRegistries!'); }); } } exports.RegistryStorage = RegistryStorage; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLmNsYXNzZXMucmVnaXN0cnlzdG9yYWdlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vdHMvbW9kX2RvY2tlci9tb2QuY2xhc3Nlcy5yZWdpc3RyeXN0b3JhZ2UudHMiXSwibmFtZXMiOltdLCJt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M7SUFFRCxXQUFXLENBQUUsV0FBMkI7UUFDdEMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsV0FBVyxDQUFDLENBQUE7SUFDakMsQ0FBQztJQUVELGdCQUFnQixDQUFFLGNBQXNCO1FBQ3RDLE1BQU0sQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyxXQUFXO1lBQ3BDLE1BQU0sQ0FBQyxXQUFXLENBQUMsV0FBVyxLQUFLLGNBQWMsQ0FBQTtRQUNuRCxDQUFDLENBQUMsQ0FBQTtJQUNKLENBQUM7SUFFSyxRQUFROztZQUNaLE1BQU0sSUFBSSxDQUFDLFNBQVMsQ0FBQyxPQUFPLENBQUMsQ0FBTSxXQUFXO2dCQUM1QyxNQUFNLFdBQVcsQ0FBQyxLQUFLLEVBQUUsQ0FBQTtZQUMzQixDQUFDLENBQUEsQ0FBQyxDQUFBO1lBQ0YsT0FBTyxDQUFDLFNBQVMsQ0FBQyxPQUFPLENBQUMsNkRBQTZELENBQUMsQ0FBQTtRQUMxRixDQUFDO0tBQUE7Q0FDRjtBQXRCRCwwQ0FzQkMifQ== \ No newline at end of file diff --git a/package.json b/package.json index 28196cd..ab40883 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "cflare": "^1.0.5", "gulp": "^3.9.1", "gulp-function": "^2.2.9", - "lik": "^1.0.39", + "lik": "^1.0.40", "lodash": "^4.17.4", "npmextra": "^2.0.9", "projectinfo": "^3.0.2", @@ -43,7 +43,7 @@ "smartdelay": "^1.0.3", "smartfile": "^4.2.20", "smartmonitor": "^1.0.3", - "smartparam": "^1.0.1", + "smartparam": "^1.0.2", "smartq": "^1.1.6", "smartshell": "^1.0.13", "smartsocket": "^1.1.10", diff --git a/test/test.ts b/test/test.ts index 2d318cd..3a502f8 100644 --- a/test/test.ts +++ b/test/test.ts @@ -1,10 +1,19 @@ import { tap, expect } from 'tapbundle' import * as path from 'path' +// Setup test +process.env.NPMTS_TEST = 'true' + // set up environment process.env.CI_REPOSITORY_URL = 'https://yyyyyy:xxxxxxxx@gitlab.com/mygroup/myrepo.git' +process.env.CI_BUILD_TOKEN = 'kjlkjfiudofiufs' + +// Docker +process.env.NPMCI_LOGIN_DOCKER = 'docker.io|someuser|somepass' + +// SSH env process.env.NPMCI_SSHKEY_1 = 'hostString|somePrivKey|##' -process.env.NPMTS_TEST = 'true' + process.cwd = () => { return path.join(__dirname, 'assets/') } @@ -25,6 +34,15 @@ let dockerfile1: npmciModDocker.Dockerfile let dockerfile2: npmciModDocker.Dockerfile let sortableArray: npmciModDocker.Dockerfile[] +tap.test('should prepare a Docker file', async () => { + await npmciModDocker.handleCli({ + _: [ + 'docker', + 'prepare' + ] + }) +}) + tap.test('should return valid Dockerfiles', async () => { dockerfile1 = new npmciModDocker.Dockerfile({ filePath: './Dockerfile', read: true }) dockerfile2 = new npmciModDocker.Dockerfile({ filePath: './Dockerfile_sometag1', read: true }) diff --git a/ts/mod_docker/index.ts b/ts/mod_docker/index.ts index 1dbfedd..bd80df8 100644 --- a/ts/mod_docker/index.ts +++ b/ts/mod_docker/index.ts @@ -72,7 +72,7 @@ export let prepare = async () => { // 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 + process.exit(1) } npmciRegistryStorage.addRegistry(new DockerRegistry({ registryUrl: 'registry.gitlab.com', @@ -81,7 +81,7 @@ export let prepare = async () => { })) // handle registries - plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_LOGIN_DOCKER*', async (envString) => { + await plugins.smartparam.forEachMinimatch(process.env, 'NPMCI_LOGIN_DOCKER*', async (envString) => { npmciRegistryStorage.addRegistry( DockerRegistry.fromEnvString(envString) ) diff --git a/ts/mod_docker/mod.classes.dockerregistry.ts b/ts/mod_docker/mod.classes.dockerregistry.ts index e55be99..eb953a9 100644 --- a/ts/mod_docker/mod.classes.dockerregistry.ts +++ b/ts/mod_docker/mod.classes.dockerregistry.ts @@ -15,6 +15,7 @@ export class DockerRegistry { this.registryUrl = optionsArg.registryUrl this.username = optionsArg.username this.password = optionsArg.password + plugins.beautylog.info(`created DockerRegistry for ${this.registryUrl}`) } static fromEnvString (envString: string): DockerRegistry { @@ -41,6 +42,6 @@ export class DockerRegistry { } else { await bash(`docker login -u ${this.username} -p ${this.password} ${this.registryUrl}`) } - plugins.beautylog.success(`docker authenticated for ${this.registryUrl}!`) + plugins.beautylog.ok(`docker authenticated for ${this.registryUrl}!`) } } diff --git a/ts/mod_docker/mod.classes.registrystorage.ts b/ts/mod_docker/mod.classes.registrystorage.ts index 4badb01..523d85f 100644 --- a/ts/mod_docker/mod.classes.registrystorage.ts +++ b/ts/mod_docker/mod.classes.registrystorage.ts @@ -23,5 +23,6 @@ export class RegistryStorage { await this.objectMap.forEach(async registryArg => { await registryArg.login() }) + plugins.beautylog.success('logged in successfully into all available DockerRegistries!') } } diff --git a/yarn.lock b/yarn.lock index 9d84a9a..d7e3ca4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1501,9 +1501,9 @@ liftoff@^2.1.0: rechoir "^0.6.2" resolve "^1.1.7" -lik@^1.0.30, lik@^1.0.38, lik@^1.0.39: - version "1.0.39" - resolved "https://registry.yarnpkg.com/lik/-/lik-1.0.39.tgz#20eeaa93167a19f03ba2c9650939145326051ee6" +lik@^1.0.30, lik@^1.0.38, lik@^1.0.40: + version "1.0.40" + resolved "https://registry.yarnpkg.com/lik/-/lik-1.0.40.tgz#2893563950263289899b79eb3a4d3c42609711bd" dependencies: "@types/lodash" "^4.14.67" "@types/minimatch" "2.x.x" @@ -2434,9 +2434,9 @@ smartparam@0.1.1: q "^1.4.1" typings-global "^1.0.3" -smartparam@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/smartparam/-/smartparam-1.0.1.tgz#4e383f96abdc46ffdd200e2f6b415522b5086ff3" +smartparam@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/smartparam/-/smartparam-1.0.2.tgz#6b6a50353b81dbe3353c0d353fbccd02e8963f2c" dependencies: beautylog "6.1.10" is-promise "^2.1.0"