Skip to content

Commit

Permalink
Introduce non interactive mode (#535)
Browse files Browse the repository at this point in the history
  • Loading branch information
oren-codefresh authored Jul 21, 2020
1 parent 7277ec1 commit efe98d6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
17 changes: 13 additions & 4 deletions lib/interface/cli/commands/hybrid/init.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'}
`);
}

Expand Down Expand Up @@ -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',
})
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -306,6 +313,8 @@ const initCmd = new Command({
kubeNamespace,
shouldMakeDefaultRe,
shouldExecutePipeline,
httpProxy,
httpsProxy,
});

if (token) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codefresh",
"version": "0.70.7",
"version": "0.70.8",
"description": "Codefresh command line utility",
"main": "index.js",
"preferGlobal": true,
Expand Down

0 comments on commit efe98d6

Please sign in to comment.