Skip to content

Commit 779b013

Browse files
Saas 7189 - skip "should use as default re" question for new accounts (#461)
1 parent 071237f commit 779b013

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,15 @@ async function getRecommendedKubeNamespace(kubeconfigPath, kubeContextName) {
115115
return name;
116116
}
117117

118+
async function isNewAccount() {
119+
const pipelines = await sdk.pipelines.list({ });
120+
if (_.isArray(_.get(pipelines, 'docs'))) {
121+
return !pipelines.docs.length;
122+
}
123+
124+
return false;
125+
}
126+
118127
const initCmd = new Command({
119128
root: false,
120129
parent: runnerRoot,
@@ -248,12 +257,16 @@ const initCmd = new Command({
248257
}
249258

250259
if (_.isUndefined(shouldMakeDefaultRe) && !noQuestions) {
251-
questions.push({
252-
type: 'confirm',
253-
name: 'shouldMakeDefaultRe',
254-
default: INSTALLATION_DEFAULTS.MAKE_DEFAULT_RE,
255-
message: 'Set this as the default runtime environment for your Codefresh account? (Y/N)',
256-
});
260+
if (!_.get(sdk, 'config.context.isNoAuth') && await isNewAccount()) {
261+
shouldMakeDefaultRe = true;
262+
} else {
263+
questions.push({
264+
type: 'confirm',
265+
name: 'shouldMakeDefaultRe',
266+
default: INSTALLATION_DEFAULTS.MAKE_DEFAULT_RE,
267+
message: 'Set this as the default runtime environment for your Codefresh account? (Y/N)',
268+
});
269+
}
257270
}
258271

259272
if (_.isUndefined(shouldExecutePipeline) && !noQuestions) {

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.62.3",
3+
"version": "0.62.4",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)