diff --git a/lib/interface/cli/commands/hybrid/delete.cmd.js b/lib/interface/cli/commands/hybrid/delete.cmd.js index e3bb50b96..d6876a0fe 100644 --- a/lib/interface/cli/commands/hybrid/delete.cmd.js +++ b/lib/interface/cli/commands/hybrid/delete.cmd.js @@ -87,6 +87,10 @@ const deleteCmd = new Command({ }) .option('verbose', { describe: 'Print logs', + }) + .option('insecure', { + describe: 'disable certificate validation for TLS connections (e.g. to g.codefresh.io)', + type: 'boolean', }), handler: async (argv) => { let { @@ -96,6 +100,7 @@ const deleteCmd = new Command({ 'kube-namespace': kubeNamespace, name: agentName, values: valuesFile, + insecure, } = argv; const [listReErr, runtimes] = await to(sdk.runtimeEnvs.list({ })); @@ -129,10 +134,16 @@ const deleteCmd = new Command({ if (!agentName && valuesObj.AgentId) { agentName = valuesObj.AgentId; } + if (_.isUndefined(insecure)) { + insecure = _.get(valuesObj, 'Insecure'); + } } if (!url) { url = DEFAULTS.URL; } + if (insecure) { + process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; + } if (!kubeContextName) { const contexts = getAllKubeContexts(kubeConfigPath); diff --git a/lib/interface/cli/commands/hybrid/init.cmd.js b/lib/interface/cli/commands/hybrid/init.cmd.js index 06573bbcf..420db985f 100644 --- a/lib/interface/cli/commands/hybrid/init.cmd.js +++ b/lib/interface/cli/commands/hybrid/init.cmd.js @@ -184,6 +184,10 @@ const initCmd = new Command({ describe: 'docker daemon access (default true)', default: true, type: 'boolean', + }) + .option('insecure', { + describe: 'disable certificate validation for TLS connections (e.g. to g.codefresh.io)', + type: 'boolean', }), handler: async (argv) => { let resumedInstallation = false; @@ -233,6 +237,7 @@ const initCmd = new Command({ url, token, name, + insecure, 'app-proxy': appProxy, 'app-proxy-host': appProxyHost, 'install-monitor': installMonitor, @@ -275,10 +280,16 @@ const initCmd = new Command({ if (_.has(valuesObj, 'dockerDaemonScheduler.userAccess')) { dockerDaemonAccess = _.get(valuesObj, 'dockerDaemonScheduler.userAccess') } + if (_.isUndefined(insecure)) { + insecure = _.get(valuesObj, 'Insecure'); + } } if (!url) { url = DEFAULTS.URL; } + if (insecure) { + process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; + } if (_.get(sdk, 'config.context.isNoAuth') && !token) { console.log('Not authenticated as a Codefresh account: '); diff --git a/lib/interface/cli/commands/hybrid/upgrade.cmd.js b/lib/interface/cli/commands/hybrid/upgrade.cmd.js index 064a40816..c588f14e0 100644 --- a/lib/interface/cli/commands/hybrid/upgrade.cmd.js +++ b/lib/interface/cli/commands/hybrid/upgrade.cmd.js @@ -69,6 +69,10 @@ const upgradeCmd = new Command({ }) .option('verbose', { describe: 'Print logs', + }) + .option('insecure', { + describe: 'disable certificate validation for TLS connections (e.g. to g.codefresh.io)', + type: 'boolean', }), handler: async (argv) => { const { @@ -76,6 +80,7 @@ const upgradeCmd = new Command({ 'agent-name': agentName, 'install-monitor': installMonitor, verbose, + insecure, } = argv; let { 'kube-context-name': kubeContextName, @@ -83,6 +88,10 @@ const upgradeCmd = new Command({ 'runtime-name': runtimeName, } = argv; + if (insecure) { + process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; + } + const [listReErr, runtimes] = await to(sdk.runtimeEnvs.list({ })); await handleError(listReErr, 'Failed to get runtime environments'); const runtimesByName = runtimes.reduce((acc, cur) => ({ ...acc, [cur.metadata.name]: cur }), {}); diff --git a/package.json b/package.json index fe4f3beeb..2c8896759 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codefresh", - "version": "0.73.7", + "version": "0.73.8", "description": "Codefresh command line utility", "main": "index.js", "preferGlobal": true,