From 17fa0c0daeb398a43303faf4c90bc4c4e689cc83 Mon Sep 17 00:00:00 2001 From: Mykola Morhun Date: Wed, 18 Mar 2020 14:27:58 +0200 Subject: [PATCH 1/4] Fix import of zip project in case the archive is hosted on the same cluster which uses self-signed certificate Signed-off-by: Mykola Morhun --- plugins/workspace-plugin/src/theia-commands.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/workspace-plugin/src/theia-commands.ts b/plugins/workspace-plugin/src/theia-commands.ts index f676ff197..a739bde41 100644 --- a/plugins/workspace-plugin/src/theia-commands.ts +++ b/plugins/workspace-plugin/src/theia-commands.ts @@ -17,6 +17,7 @@ import * as fileuri from './file-uri'; import { execute } from './exec'; import * as git from './git'; +const SS_CRT_PATH = '/tmp/che/secret/ca.crt'; const CHE_TASK_TYPE = 'che'; /** @@ -204,6 +205,9 @@ export class TheiaImportZipCommand implements TheiaImportCommand { try { // download const wgetArgs = [this.locationURI!, '-O', this.zipfilePath]; + if (fs.existsSync(SS_CRT_PATH)) { + wgetArgs.push('--no-check-certificate'); + } await execute('wget', wgetArgs); // expand From c79ce3c1be2586cbfb8e2f43b6b010f7128e950f Mon Sep 17 00:00:00 2001 From: Mykola Morhun Date: Thu, 19 Mar 2020 10:49:10 +0200 Subject: [PATCH 2/4] Use curl instead of wget Signed-off-by: Mykola Morhun --- plugins/workspace-plugin/src/theia-commands.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/workspace-plugin/src/theia-commands.ts b/plugins/workspace-plugin/src/theia-commands.ts index a739bde41..2088a2b51 100644 --- a/plugins/workspace-plugin/src/theia-commands.ts +++ b/plugins/workspace-plugin/src/theia-commands.ts @@ -204,11 +204,12 @@ export class TheiaImportZipCommand implements TheiaImportCommand { const importZip = async (progress: theia.Progress<{ message?: string; increment?: number }>, token: theia.CancellationToken): Promise => { try { // download - const wgetArgs = [this.locationURI!, '-O', this.zipfilePath]; + const curlArgs = ['-L', '--output', this.zipfilePath]; if (fs.existsSync(SS_CRT_PATH)) { - wgetArgs.push('--no-check-certificate'); + curlArgs.push('-k'); } - await execute('wget', wgetArgs); + curlArgs.push(this.locationURI!); + await execute('curl', curlArgs); // expand fs.mkdirSync(this.projectDir); From 6315e5a8b2d3c708bad97ebb4758e785b5442836 Mon Sep 17 00:00:00 2001 From: Mykola Morhun Date: Thu, 19 Mar 2020 10:49:10 +0200 Subject: [PATCH 3/4] Use curl instead of wget Signed-off-by: Mykola Morhun --- plugins/workspace-plugin/src/theia-commands.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/workspace-plugin/src/theia-commands.ts b/plugins/workspace-plugin/src/theia-commands.ts index 2088a2b51..27aa9e678 100644 --- a/plugins/workspace-plugin/src/theia-commands.ts +++ b/plugins/workspace-plugin/src/theia-commands.ts @@ -204,7 +204,7 @@ export class TheiaImportZipCommand implements TheiaImportCommand { const importZip = async (progress: theia.Progress<{ message?: string; increment?: number }>, token: theia.CancellationToken): Promise => { try { // download - const curlArgs = ['-L', '--output', this.zipfilePath]; + const curlArgs = ['-sL', '--output', this.zipfilePath]; if (fs.existsSync(SS_CRT_PATH)) { curlArgs.push('-k'); } From dd774878b784c2073fb92c09c80ed85e05f33ada Mon Sep 17 00:00:00 2001 From: Nick Boldt Date: Thu, 19 Mar 2020 11:59:52 -0400 Subject: [PATCH 4/4] Update theia-commands.ts ``` -S/--show-error When used with -s it makes curl show an error message if it fails. ``` --- plugins/workspace-plugin/src/theia-commands.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/workspace-plugin/src/theia-commands.ts b/plugins/workspace-plugin/src/theia-commands.ts index 27aa9e678..8382a822b 100644 --- a/plugins/workspace-plugin/src/theia-commands.ts +++ b/plugins/workspace-plugin/src/theia-commands.ts @@ -204,7 +204,7 @@ export class TheiaImportZipCommand implements TheiaImportCommand { const importZip = async (progress: theia.Progress<{ message?: string; increment?: number }>, token: theia.CancellationToken): Promise => { try { // download - const curlArgs = ['-sL', '--output', this.zipfilePath]; + const curlArgs = ['-sSL', '--output', this.zipfilePath]; if (fs.existsSync(SS_CRT_PATH)) { curlArgs.push('-k'); }