Skip to content

Commit

Permalink
runner init improvements (#633)
Browse files Browse the repository at this point in the history
  • Loading branch information
roi-codefresh committed Feb 18, 2021
1 parent f88da10 commit 692679b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
9 changes: 8 additions & 1 deletion lib/interface/cli/commands/hybrid/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down Expand Up @@ -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;
}
Expand Down
14 changes: 12 additions & 2 deletions lib/interface/cli/commands/hybrid/init.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand All @@ -661,7 +669,6 @@ const initCmd = new Command({
});

// install runtime on cluster
setValue.push('--RuntimeInCluster=true');
installationPlan.addStep({
name: 'install runtime',
func: async () => {
Expand Down Expand Up @@ -770,6 +777,9 @@ const initCmd = new Command({
verbose, // --verbose
runtimeName: installationPlan.getContext('runtimeName'), // --runtimeName
dryRun,
valuesFile,
setValue,
setFile,
});
},
installationEvent: installationProgress.events.RUNNER_INSTALLED,
Expand Down Expand Up @@ -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;
}
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.75.3",
"version": "0.75.4",
"description": "Codefresh command line utility",
"main": "index.js",
"preferGlobal": true,
Expand Down

0 comments on commit 692679b

Please sign in to comment.