Skip to content

Commit

Permalink
added --insecure option to runner init, delete and upgrade (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
roi-codefresh authored Oct 20, 2020
1 parent 0d5e07e commit 383b5fc
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
11 changes: 11 additions & 0 deletions lib/interface/cli/commands/hybrid/delete.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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({ }));
Expand Down Expand Up @@ -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);
Expand Down
11 changes: 11 additions & 0 deletions lib/interface/cli/commands/hybrid/init.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -233,6 +237,7 @@ const initCmd = new Command({
url,
token,
name,
insecure,
'app-proxy': appProxy,
'app-proxy-host': appProxyHost,
'install-monitor': installMonitor,
Expand Down Expand Up @@ -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: ');
Expand Down
9 changes: 9 additions & 0 deletions lib/interface/cli/commands/hybrid/upgrade.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,29 @@ 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 {
'kube-config-path': kubeConfigPath,
'agent-name': agentName,
'install-monitor': installMonitor,
verbose,
insecure,
} = argv;
let {
'kube-context-name': kubeContextName,
'kube-namespace': kubeNamespace,
'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 }), {});
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.73.7",
"version": "0.73.8",
"description": "Codefresh command line utility",
"main": "index.js",
"preferGlobal": true,
Expand Down

0 comments on commit 383b5fc

Please sign in to comment.