Skip to content

Commit efe98d6

Browse files
Introduce non interactive mode (#535)
1 parent 7277ec1 commit efe98d6

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

lib/interface/cli/commands/hybrid/init.cmd.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,16 @@ function printInstallationOptionsSummary({
5353
kubeNamespace,
5454
shouldMakeDefaultRe,
5555
shouldExecutePipeline,
56+
httpProxy,
57+
httpsProxy,
5658
}) {
5759
console.log(`\n${colors.green('Installation options summary:')}
5860
1. Kubernetes Context: ${colors.cyan(kubeContextName)}
5961
2. Kubernetes Namespace: ${colors.cyan(kubeNamespace)}
6062
3. Set this as default account runtime-environment: ${colors.cyan(!!shouldMakeDefaultRe)}
6163
4. Execute demo pipeline after install: ${colors.cyan(!!shouldExecutePipeline)}
64+
5. HTTP proxy: ${httpProxy ? colors.cyan(httpProxy) : 'none'}
65+
6. HTTPS proxy: ${httpsProxy ? colors.cyan(httpsProxy) : 'none'}
6266
`);
6367
}
6468

@@ -145,6 +149,9 @@ const initCmd = new Command({
145149
.option('https-proxy', {
146150
describe: 'https proxy to be used in the runner',
147151
})
152+
.option('non-interactive', {
153+
describe: 'setting this flag will make the installation non interactive',
154+
})
148155
.option('verbose', {
149156
describe: 'Print logs',
150157
})
@@ -216,10 +223,10 @@ const initCmd = new Command({
216223
httpsProxy = httpsProxy || detectedProxyVars.httpsProxy;
217224
if (noQuestions) {
218225
// use defaults
219-
kubeContextName = getKubeContext(kubeConfigPath);
220-
kubeNamespace = await getRecommendedKubeNamespace(kubeConfigPath, kubeContextName);
221-
shouldMakeDefaultRe = INSTALLATION_DEFAULTS.MAKE_DEFAULT_RE;
222-
shouldExecutePipeline = INSTALLATION_DEFAULTS.RUN_DEMO_PIPELINE;
226+
kubeContextName = kubeContextName || getKubeContext(kubeConfigPath);
227+
kubeNamespace = kubeNamespace || await getRecommendedKubeNamespace(kubeConfigPath, kubeContextName);
228+
shouldMakeDefaultRe = _.isUndefined(shouldMakeDefaultRe) ? INSTALLATION_DEFAULTS.MAKE_DEFAULT_RE : shouldMakeDefaultRe;
229+
shouldExecutePipeline = _.isUndefined(shouldExecutePipeline) ? INSTALLATION_DEFAULTS.RUN_DEMO_PIPELINE : shouldExecutePipeline;
223230
} else if (!resumedInstallation) {
224231
console.log(colors.green('This installer will guide you through the Codefresh Runner installation process'));
225232
if (!kubeContextName) {
@@ -306,6 +313,8 @@ const initCmd = new Command({
306313
kubeNamespace,
307314
shouldMakeDefaultRe,
308315
shouldExecutePipeline,
316+
httpProxy,
317+
httpsProxy,
309318
});
310319

311320
if (token) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.70.7",
3+
"version": "0.70.8",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)