Skip to content

Commit 43893b6

Browse files
Saas-7101 - allow "cold" runner installation (#452)
1 parent 8413f02 commit 43893b6

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

lib/interface/cli/Command.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ class Command {
6868
_.forEach(this.subCommands, (subCommand) => {
6969
if (!subCommand.hasOwnProperty('requiresAuthentication') && this.hasOwnProperty('requiresAuthentication')) {
7070
subCommand.requiresAuthentication = this.requiresAuthentication;
71-
} else {
72-
subCommand.requiresAuthentication = true;
7371
}
7472

7573
if (subCommand.isBetaCommand()) {

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@ const { getConfigForSdk } = require('../../commad-line-interface');
1010
const colors = require('colors');
1111
const DEFAULTS = require('../../defaults');
1212
const sdk = require('../../../../logic/sdk');
13+
const Output = require('../../../../output/Output');
14+
const _ = require('lodash');
1315

1416
const defaultNamespace = 'codefresh';
1517

1618
const initCmd = new Command({
1719
root: false,
1820
parent: runnerRoot,
1921
command: 'init',
22+
requiresAuthentication: false,
2023
description: 'Install codefresh runner solution\'s components on kubernetes cluster',
2124
webDocs: {
2225
category: 'Runner',
@@ -86,6 +89,15 @@ const initCmd = new Command({
8689
'kube-context-name': kubeContextName,
8790
'kube-namespace': kubeNamespace,
8891
} = argv;
92+
93+
if (_.get(sdk, 'config.context.isNoAuth') && !token) {
94+
console.log('Not authenticated as a Codefresh account: ');
95+
console.log('In order to install a Codefresh Runner you need to provide ' +
96+
`an authentication token which can be generated here: ${colors.blue(`${argv.url}/user/settings`)}.` +
97+
'\nAfter getting the token you may run this command again with the [--token] option or use the codefresh auth command to create an authenticated context.');
98+
process.exit(1);
99+
}
100+
89101
const questions = [];
90102
if (!kubeContextName) {
91103
const contexts = getAllKubeContexts(kubeConfigPath);
@@ -141,6 +153,7 @@ const initCmd = new Command({
141153
await sdk.configure(config);
142154
console.log('A codefresh context named hybrid was added in your $HOME folder');
143155
}
156+
144157
await installAgent.handler({
145158
name,
146159
'kube-context-name': kubeContextName,

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

0 commit comments

Comments
 (0)