This repository has been archived by the owner on Apr 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin' into vscode-diff
- Loading branch information
Showing
7 changed files
with
80 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
dockerfiles/theia-dev/docker/ubi8/install-dependencies.dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
USER root | ||
RUN yum install -y curl make cmake gcc gcc-c++ python2 git openssh less bash tar gzip \ | ||
RUN yum install -y curl make cmake gcc gcc-c++ python2 git git-core-doc openssh less bash tar gzip \ | ||
&& yum -y clean all && rm -rf /var/cache/yum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/********************************************************************* | ||
* Copyright (c) 2019 Red Hat, Inc. | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
**********************************************************************/ | ||
|
||
const fs = require('fs'); | ||
const workspaceClient = require('@eclipse-che/workspace-client'); | ||
|
||
// Assume that self-signed certificate is located by the following path | ||
const SS_CRT_PATH = '/tmp/che/secret/ca.crt'; | ||
|
||
// Configure workspace API client | ||
const restAPIConfig = { | ||
baseUrl: process.env.CHE_API | ||
}; | ||
|
||
const token = process.env.CHE_MACHINE_TOKEN; | ||
if (token) { | ||
restAPIConfig.headers = {}; | ||
restAPIConfig.headers['Authorization'] = 'Bearer ' + token; | ||
} | ||
|
||
if (fs.existsSync(SS_CRT_PATH)) { | ||
restAPIConfig.ssCrtPath = SS_CRT_PATH; | ||
} | ||
|
||
// Create rest API workspace client | ||
const restApiClient = workspaceClient.default.getRestApi(restAPIConfig); | ||
|
||
// Search for IDE route | ||
function getIdeRoute() { | ||
return new Promise((resolve, reject) => { | ||
restApiClient.getById(process.env.CHE_WORKSPACE_ID).then(workspace => { | ||
const containers = workspace.runtime.machines; | ||
Object.keys(containers).forEach(containerName => { | ||
const container = containers[containerName]; | ||
const servers = container['servers']; | ||
if (servers) { | ||
const ideServerName = Object.keys(servers).find(serverName => servers[serverName].attributes && servers[serverName].attributes['type'] === 'ide'); | ||
if (ideServerName) { | ||
resolve(servers[ideServerName].url); | ||
} | ||
} | ||
}); | ||
reject('Server with type "ide" not found.'); | ||
}).catch(error => { | ||
reject(error); | ||
}); | ||
}); | ||
} | ||
|
||
getIdeRoute().then(ideRoute => { | ||
if (!ideRoute) { | ||
throw new Error('Failed to get ide route.'); | ||
} | ||
|
||
// Remove trailing slash if any | ||
if (ideRoute.endsWith('/')) { | ||
ideRoute = ideRoute.substring(0, ideRoute.length - 1); | ||
} | ||
// Remove protocol | ||
const webviewDomain = ideRoute.replace(/^https?:\/\//, ''); | ||
// Return result to shell by writing into stdout | ||
process.stdout.write(webviewDomain); | ||
}).catch(error => { | ||
console.error('Unable to get IDE route. Webviews might not work. Cause:', error); | ||
// Just exit this script without returning a value to the shell. | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters