From 692679b1a8e32b3f994edf51c76a1a9eb7606c3e Mon Sep 17 00:00:00 2001 From: roi-codefresh <60569147+roi-codefresh@users.noreply.github.com> Date: Thu, 18 Feb 2021 11:24:06 +0200 Subject: [PATCH] runner init improvements (#633) --- lib/interface/cli/commands/hybrid/helper.js | 9 ++++++++- lib/interface/cli/commands/hybrid/init.cmd.js | 14 ++++++++++++-- package.json | 2 +- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/lib/interface/cli/commands/hybrid/helper.js b/lib/interface/cli/commands/hybrid/helper.js index d6d697b0f..385b69929 100644 --- a/lib/interface/cli/commands/hybrid/helper.js +++ b/lib/interface/cli/commands/hybrid/helper.js @@ -885,7 +885,11 @@ async function attachRuntime({ cmd.push(`--values=${valuesFile}`); } if (setValue) { - cmd.push(`--set-value=${setValue}`); + if (_.isArray(setValue)) { + setValue.forEach(sv => cmd.push(`--set-value=${sv}`)); + } else { + cmd.push(`--set-value=${setValue}`); + } } if (setFile) { cmd.push(`--set-file=${setFile}`); @@ -1051,6 +1055,9 @@ function mergeValuesFromValuesFile(argv, valuesFile, handleError) { if (!_.has(_argv, 'storage-class-name') && _.has(valuesObj, 'StorageClass')) { _.set(_argv, 'storage-class-name', valuesObj.StorageClass); } + if (!_.has(_argv, 'skip-cluster-integration') && _.has(valuesObj, 'SkipClusterIntegration')) { + _.set(_argv, 'skip-cluster-integration', valuesObj.SkipClusterIntegration); + } return _argv; } diff --git a/lib/interface/cli/commands/hybrid/init.cmd.js b/lib/interface/cli/commands/hybrid/init.cmd.js index eb028a541..ec09afd1d 100644 --- a/lib/interface/cli/commands/hybrid/init.cmd.js +++ b/lib/interface/cli/commands/hybrid/init.cmd.js @@ -121,6 +121,10 @@ const initCmd = new Command({ describe: 'Do not test given kubeconfig context to have all the required permission', type: 'boolean', }) + .option('skip-cluster-integration', { + describe: 'Do not create a cluster integration in Codefresh', + type: 'boolean', + }) .option('set-default-runtime', { describe: 'Set this as the default runtime environment for your Codefresh account', type: 'boolean', @@ -246,6 +250,7 @@ const initCmd = new Command({ 'env-vars': envVars, yes: noQuestions, 'skip-cluster-test': skipClusterTest, + 'skip-cluster-integration': skipClusterIntegration, 'docker-registry': dockerRegistry, token, name, @@ -648,6 +653,9 @@ const initCmd = new Command({ }, installationEvent: installationProgress.events.CLUSTER_INTEGRATION_ADDED, condition: async () => { + if (skipClusterIntegration) { + return false; + } if (isInCluster()) { console.log('Cluster integration was not added , please add it via codefresh "create clusters [name]"'); return false; @@ -661,7 +669,6 @@ const initCmd = new Command({ }); // install runtime on cluster - setValue.push('--RuntimeInCluster=true'); installationPlan.addStep({ name: 'install runtime', func: async () => { @@ -770,6 +777,9 @@ const initCmd = new Command({ verbose, // --verbose runtimeName: installationPlan.getContext('runtimeName'), // --runtimeName dryRun, + valuesFile, + setValue, + setFile, }); }, installationEvent: installationProgress.events.RUNNER_INSTALLED, @@ -804,7 +814,7 @@ const initCmd = new Command({ return false; } - if (isInCluster()) { + if (isInCluster() || skipClusterIntegration) { console.log('Monitor component cannot be installed without cluster integration, you can install it seperately using: "codefresh install monitor"'); return false; } diff --git a/package.json b/package.json index f867f73fd..98505ddfe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codefresh", - "version": "0.75.3", + "version": "0.75.4", "description": "Codefresh command line utility", "main": "index.js", "preferGlobal": true,