fix(core): update

This commit is contained in:
Philipp Kunz 2019-06-19 11:35:19 +02:00
parent a1d52af813
commit 19831037ec

View File

@ -24,7 +24,7 @@ export let modArgvArg; // will be set through the build command
* handle cli input * handle cli input
* @param argvArg * @param argvArg
*/ */
export let handleCli = async argvArg => { export const handleCli = async argvArg => {
modArgvArg = argvArg; modArgvArg = argvArg;
if (argvArg._.length >= 2) { if (argvArg._.length >= 2) {
const action: string = argvArg._[1]; const action: string = argvArg._[1];
@ -59,7 +59,7 @@ export let handleCli = async argvArg => {
/** /**
* builds a cwd of Dockerfiles by triggering a promisechain * builds a cwd of Dockerfiles by triggering a promisechain
*/ */
export let build = async () => { export const build = async () => {
await prepare(); await prepare();
logger.log('info', 'now building Dockerfiles...'); logger.log('info', 'now building Dockerfiles...');
await helpers await helpers
@ -72,7 +72,7 @@ export let build = async () => {
/** /**
* login to the DockerRegistries * login to the DockerRegistries
*/ */
export let login = async () => { export const login = async () => {
await prepare(); await prepare();
await npmciRegistryStorage.loginAll(); await npmciRegistryStorage.loginAll();
}; };
@ -80,7 +80,7 @@ export let login = async () => {
/** /**
* logs in docker * logs in docker
*/ */
export let prepare = async () => { export const prepare = async () => {
// Always login to GitLab Registry // Always login to GitLab Registry
if (!process.env.CI_BUILD_TOKEN || process.env.CI_BUILD_TOKEN === '') { if (!process.env.CI_BUILD_TOKEN || process.env.CI_BUILD_TOKEN === '') {
logger.log('error', 'No registry token specified by gitlab!'); logger.log('error', 'No registry token specified by gitlab!');
@ -112,7 +112,10 @@ export const push = async argvArg => {
// lets parse the input of cli and npmextra // lets parse the input of cli and npmextra
if (argvArg._.length >= 3 && argvArg._[2] !== 'npmextra') { if (argvArg._.length >= 3 && argvArg._[2] !== 'npmextra') {
dockerRegistryUrls.push(argvArg._[2]); dockerRegistryUrls.push(argvArg._[2]);
} else if (configObject.dockerRegistries) { } else {
if (configObject.dockerRegistries.length === 0) {
logger.log('warn', `There are no docker registries listed in npmextra.json!`);
}
dockerRegistryUrls = dockerRegistryUrls.concat(configObject.dockerRegistries); dockerRegistryUrls = dockerRegistryUrls.concat(configObject.dockerRegistries);
} }
@ -142,7 +145,7 @@ export const push = async argvArg => {
} }
}; };
export let pull = async argvArg => { export const pull = async argvArg => {
await prepare(); await prepare();
const registryUrlArg = argvArg._[2]; const registryUrlArg = argvArg._[2];
let suffix = null; let suffix = null;
@ -159,7 +162,10 @@ export let pull = async argvArg => {
} }
}; };
export let test = async () => { /**
* tests docker files
*/
export const test = async () => {
await prepare(); await prepare();
return await helpers.readDockerfiles().then(helpers.testDockerfiles); return await helpers.readDockerfiles().then(helpers.testDockerfiles);
}; };