Skip to content

Commit

Permalink
Saas-7101 - allow "cold" runner installation (#452)
Browse files Browse the repository at this point in the history
  • Loading branch information
roi-codefresh authored May 12, 2020
1 parent 8413f02 commit 43893b6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 0 additions & 2 deletions lib/interface/cli/Command.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ class Command {
_.forEach(this.subCommands, (subCommand) => {
if (!subCommand.hasOwnProperty('requiresAuthentication') && this.hasOwnProperty('requiresAuthentication')) {
subCommand.requiresAuthentication = this.requiresAuthentication;
} else {
subCommand.requiresAuthentication = true;
}

if (subCommand.isBetaCommand()) {
Expand Down
13 changes: 13 additions & 0 deletions lib/interface/cli/commands/hybrid/init.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ const { getConfigForSdk } = require('../../commad-line-interface');
const colors = require('colors');
const DEFAULTS = require('../../defaults');
const sdk = require('../../../../logic/sdk');
const Output = require('../../../../output/Output');
const _ = require('lodash');

const defaultNamespace = 'codefresh';

const initCmd = new Command({
root: false,
parent: runnerRoot,
command: 'init',
requiresAuthentication: false,
description: 'Install codefresh runner solution\'s components on kubernetes cluster',
webDocs: {
category: 'Runner',
Expand Down Expand Up @@ -86,6 +89,15 @@ const initCmd = new Command({
'kube-context-name': kubeContextName,
'kube-namespace': kubeNamespace,
} = argv;

if (_.get(sdk, 'config.context.isNoAuth') && !token) {
console.log('Not authenticated as a Codefresh account: ');
console.log('In order to install a Codefresh Runner you need to provide ' +
`an authentication token which can be generated here: ${colors.blue(`${argv.url}/user/settings`)}.` +
'\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.');
process.exit(1);
}

const questions = [];
if (!kubeContextName) {
const contexts = getAllKubeContexts(kubeConfigPath);
Expand Down Expand Up @@ -141,6 +153,7 @@ const initCmd = new Command({
await sdk.configure(config);
console.log('A codefresh context named hybrid was added in your $HOME folder');
}

await installAgent.handler({
name,
'kube-context-name': kubeContextName,
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.59.0",
"version": "0.59.1",
"description": "Codefresh command line utility",
"main": "index.js",
"preferGlobal": true,
Expand Down

0 comments on commit 43893b6

Please sign in to comment.