diff --git a/lib/interface/cli/commands/hybrid/init.cmd.js b/lib/interface/cli/commands/hybrid/init.cmd.js index 4bd0d6ec2..0fe9fee26 100644 --- a/lib/interface/cli/commands/hybrid/init.cmd.js +++ b/lib/interface/cli/commands/hybrid/init.cmd.js @@ -115,6 +115,15 @@ async function getRecommendedKubeNamespace(kubeconfigPath, kubeContextName) { return name; } +async function isNewAccount() { + const pipelines = await sdk.pipelines.list({ }); + if (_.isArray(_.get(pipelines, 'docs'))) { + return !pipelines.docs.length; + } + + return false; +} + const initCmd = new Command({ root: false, parent: runnerRoot, @@ -248,12 +257,16 @@ const initCmd = new Command({ } if (_.isUndefined(shouldMakeDefaultRe) && !noQuestions) { - questions.push({ - type: 'confirm', - name: 'shouldMakeDefaultRe', - default: INSTALLATION_DEFAULTS.MAKE_DEFAULT_RE, - message: 'Set this as the default runtime environment for your Codefresh account? (Y/N)', - }); + if (!_.get(sdk, 'config.context.isNoAuth') && await isNewAccount()) { + shouldMakeDefaultRe = true; + } else { + questions.push({ + type: 'confirm', + name: 'shouldMakeDefaultRe', + default: INSTALLATION_DEFAULTS.MAKE_DEFAULT_RE, + message: 'Set this as the default runtime environment for your Codefresh account? (Y/N)', + }); + } } if (_.isUndefined(shouldExecutePipeline) && !noQuestions) { diff --git a/package.json b/package.json index 8a2a09cb1..5985218cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codefresh", - "version": "0.62.3", + "version": "0.62.4", "description": "Codefresh command line utility", "main": "index.js", "preferGlobal": true,