Skip to content

Commit 1b1f172

Browse files
Allow skip cluster (#691)
* allow to install runtime without adding cluster integration * wip
1 parent 222083f commit 1b1f172

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

lib/interface/cli/commands/runtimeEnvironments/install.cmd.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ const installRuntimeCmd = new Command({
112112
.option('make-default-runtime', {
113113
describe: 'should all pipelines run on the this runtime (default is false)',
114114
})
115+
.option('skip-cluster-creation', {
116+
description: 'If set to true, will skip cluster integration creation for this runtime',
117+
})
115118
.option('verbose', {
116119
describe: 'Print logs',
117120
}),
@@ -121,6 +124,7 @@ const installRuntimeCmd = new Command({
121124
'agent-name': agentName,
122125
'runtime-name': reName,
123126
'skip-re-creation': skipRuntimeCreation,
127+
'skip-cluster-creation': skipClusterCreation,
124128
'dry-run': dryRun,
125129
'in-cluster': inCluster,
126130
'kube-node-selector': kubeNodeSelector,
@@ -200,18 +204,19 @@ const installRuntimeCmd = new Command({
200204
}
201205

202206
// check if cluster already exists
203-
let clusterExists = false;
204-
try {
205-
const clusters = await sdk.clusters.list() || [];
206-
if (clusters.find(cluster => cluster.selector === kubeContextName)) {
207-
clusterExists = true;
207+
let createCluster = false;
208+
if (!skipClusterCreation) {
209+
try {
210+
const clusters = await sdk.clusters.list() || [];
211+
// should create cluster if it does not exist already
212+
createCluster = !clusters.find(cluster => cluster.selector === kubeContextName);
213+
} catch (error) {
214+
console.log(`Failed to fetch account clusters, cause: ${error.message}`);
208215
}
209-
} catch (error) {
210-
console.log(`Failed to fetch account clusters, cause: ${error.message}`);
211216
}
212217

213218
// create the cluster in codefresh if does not exists
214-
if (!clusterExists) {
219+
if (createCluster) {
215220
console.log(`Adding cluster "${colors.cyan(kubeContextName)}" integration to your Codefresh account`);
216221
try {
217222
await createClusterCmd.handler({

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

0 commit comments

Comments
 (0)