From efe98d6606b72a841af795f654747554801eb861 Mon Sep 17 00:00:00 2001 From: oren-codefresh Date: Tue, 21 Jul 2020 17:54:29 +0300 Subject: [PATCH] Introduce non interactive mode (#535) --- lib/interface/cli/commands/hybrid/init.cmd.js | 17 +++++++++++++---- package.json | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/interface/cli/commands/hybrid/init.cmd.js b/lib/interface/cli/commands/hybrid/init.cmd.js index 55910e1e9..d1b1d2828 100644 --- a/lib/interface/cli/commands/hybrid/init.cmd.js +++ b/lib/interface/cli/commands/hybrid/init.cmd.js @@ -53,12 +53,16 @@ function printInstallationOptionsSummary({ kubeNamespace, shouldMakeDefaultRe, shouldExecutePipeline, + httpProxy, + httpsProxy, }) { console.log(`\n${colors.green('Installation options summary:')} 1. Kubernetes Context: ${colors.cyan(kubeContextName)} 2. Kubernetes Namespace: ${colors.cyan(kubeNamespace)} 3. Set this as default account runtime-environment: ${colors.cyan(!!shouldMakeDefaultRe)} 4. Execute demo pipeline after install: ${colors.cyan(!!shouldExecutePipeline)} + 5. HTTP proxy: ${httpProxy ? colors.cyan(httpProxy) : 'none'} + 6. HTTPS proxy: ${httpsProxy ? colors.cyan(httpsProxy) : 'none'} `); } @@ -145,6 +149,9 @@ const initCmd = new Command({ .option('https-proxy', { describe: 'https proxy to be used in the runner', }) + .option('non-interactive', { + describe: 'setting this flag will make the installation non interactive', + }) .option('verbose', { describe: 'Print logs', }) @@ -216,10 +223,10 @@ const initCmd = new Command({ httpsProxy = httpsProxy || detectedProxyVars.httpsProxy; if (noQuestions) { // use defaults - kubeContextName = getKubeContext(kubeConfigPath); - kubeNamespace = await getRecommendedKubeNamespace(kubeConfigPath, kubeContextName); - shouldMakeDefaultRe = INSTALLATION_DEFAULTS.MAKE_DEFAULT_RE; - shouldExecutePipeline = INSTALLATION_DEFAULTS.RUN_DEMO_PIPELINE; + kubeContextName = kubeContextName || getKubeContext(kubeConfigPath); + kubeNamespace = kubeNamespace || await getRecommendedKubeNamespace(kubeConfigPath, kubeContextName); + shouldMakeDefaultRe = _.isUndefined(shouldMakeDefaultRe) ? INSTALLATION_DEFAULTS.MAKE_DEFAULT_RE : shouldMakeDefaultRe; + shouldExecutePipeline = _.isUndefined(shouldExecutePipeline) ? INSTALLATION_DEFAULTS.RUN_DEMO_PIPELINE : shouldExecutePipeline; } else if (!resumedInstallation) { console.log(colors.green('This installer will guide you through the Codefresh Runner installation process')); if (!kubeContextName) { @@ -306,6 +313,8 @@ const initCmd = new Command({ kubeNamespace, shouldMakeDefaultRe, shouldExecutePipeline, + httpProxy, + httpsProxy, }); if (token) { diff --git a/package.json b/package.json index 7aee81f98..4fc12ddc1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codefresh", - "version": "0.70.7", + "version": "0.70.8", "description": "Codefresh command line utility", "main": "index.js", "preferGlobal": true,