Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into quick_pick_items_ext
Browse files Browse the repository at this point in the history
  • Loading branch information
vzhukovs committed Nov 11, 2019
2 parents 7002397 + dd0f1b6 commit 96dc7e7
Show file tree
Hide file tree
Showing 16 changed files with 416 additions and 38 deletions.
4 changes: 4 additions & 0 deletions build.include
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ DOCKER_FILES_LOCATIONS=(
dockerfiles/remote-plugin-openshift-connector-0.0.17
dockerfiles/remote-plugin-openshift-connector-0.0.21
dockerfiles/remote-plugin-openshift-connector-0.1.0
dockerfiles/remote-plugin-openshift-connector-0.1.1
dockerfiles/remote-plugin-camelk-0.0.9
dockerfiles/remote-plugin-camelk-0.0.10
dockerfiles/remote-plugin-dependency-analytics-0.0.12
dockerfiles/remote-plugin-dependency-analytics-0.0.13
)
Expand All @@ -104,7 +106,9 @@ PUBLISH_IMAGES_LIST=(
eclipse/che-remote-plugin-openshift-connector-0.0.17
eclipse/che-remote-plugin-openshift-connector-0.0.21
eclipse/che-remote-plugin-openshift-connector-0.1.0
eclipse/che-remote-plugin-openshift-connector-0.1.1
eclipse/che-remote-plugin-camelk-0.0.9
eclipse/che-remote-plugin-camelk-0.0.10
eclipse/che-remote-plugin-dependency-analytics-0.0.12
eclipse/che-remote-plugin-dependency-analytics-0.0.13
)
Expand Down
15 changes: 15 additions & 0 deletions dockerfiles/remote-plugin-camelk-0.0.10/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 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
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
FROM ${BUILD_ORGANIZATION}/che-remote-plugin-kubernetes-tooling-1.0.0:${BUILD_TAG}

ENV KAMEL_VERSION 1.0.0-M3

RUN curl -L https://github.com/apache/camel-k/releases/download/${KAMEL_VERSION}/camel-k-client-${KAMEL_VERSION}-linux-64bit.tar.gz | tar -C /usr/local/bin -xz \
&& chmod +x /usr/local/bin/kamel
15 changes: 15 additions & 0 deletions dockerfiles/remote-plugin-camelk-0.0.10/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
#
# 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
#

base_dir=$(cd "$(dirname "$0")"; pwd)
. "${base_dir}"/../build.include

init --name:remote-plugin-camelk-0.0.10 "$@"
build
47 changes: 47 additions & 0 deletions dockerfiles/remote-plugin-openshift-connector-0.1.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# 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
#
# Contributors:
# Red Hat, Inc. - initial API and implementation

FROM alpine:3.10.2

ENV HOME=/home/theia

RUN mkdir /projects ${HOME} && \
# Change permissions to let any arbitrary user
for f in "${HOME}" "/etc/passwd" "/projects"; do \
echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \
chmod -R g+rwX ${f}; \
done

ENV GLIBC_VERSION=2.30-r0 \
ODO_VERSION=v1.0.0 \
OC_VERSION=v3.11.0 \
OC_TAG=0cbc58b \
KUBECTL_VERSION=v1.16.2

# plugin executes the commands relying on Bash
RUN apk add --update --no-cache bash && \
# install glibc compatibility layer package for Alpine Linux
# see https://github.com/openshift/origin/issues/18942 for the details
wget -O glibc-${GLIBC_VERSION}.apk https://github.com/andyshinn/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk && \
apk --update --allow-untrusted add glibc-${GLIBC_VERSION}.apk && \
rm -f glibc-${GLIBC_VERSION}.apk && \
# install oc
wget -O- https://github.com/openshift/origin/releases/download/${OC_VERSION}/openshift-origin-client-tools-${OC_VERSION}-${OC_TAG}-linux-64bit.tar.gz | tar xvz -C /usr/local/bin --strip 1 && \
# install odo
wget -O /usr/local/bin/odo https://mirror.openshift.com/pub/openshift-v4/clients/odo/${ODO_VERSION}/odo-linux-amd64 && \
chmod +x /usr/local/bin/odo && \
# install kubectl
wget -O /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl && \
chmod +x /usr/local/bin/kubectl

ADD etc/entrypoint.sh /entrypoint.sh

ENTRYPOINT [ "/entrypoint.sh" ]
CMD ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
15 changes: 15 additions & 0 deletions dockerfiles/remote-plugin-openshift-connector-0.1.1/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
#
# 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
#

base_dir=$(cd "$(dirname "$0")"; pwd)
. "${base_dir}"/../build.include

init --name:remote-plugin-openshift-connector-0.1.1 "$@"
build
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh
#
# Copyright (c) 2018-2018 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
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
#

set -e

export USER_ID=$(id -u)
export GROUP_ID=$(id -g)

if ! whoami >/dev/null 2>&1; then
echo "${USER_NAME:-user}:x:${USER_ID}:0:${USER_NAME:-user} user:${HOME}:/bin/sh" >> /etc/passwd
fi

# Grant access to projects volume in case of non root user with sudo rights
if [ "${USER_ID}" -ne 0 ] && command -v sudo >/dev/null 2>&1 && sudo -n true > /dev/null 2>&1; then
sudo chown "${USER_ID}:${GROUP_ID}" /projects
fi

exec "$@"
1 change: 1 addition & 0 deletions extensions/eclipse-che-theia-plugin-ext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@eclipse-che/plugin": "0.0.1",
"@eclipse-che/workspace-client": "latest",
"@theia/core": "next",
"@theia/mini-browser": "next",
"@theia/plugin-ext": "next",
"axios": "0.18.1",
"js-yaml": "3.13.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ import { ChePluginMenu } from './plugin/che-plugin-menu';
import { ChePluginCommandContribution } from './plugin/che-plugin-command-contribution';
import { bindChePluginPreferences } from './plugin/che-plugin-preferences';
import { CheSideCarContentReaderRegistryImpl, CheSideCarResourceResolver } from './che-sidecar-resource';
import { CheMiniBrowserOpenHandler } from './che-mini-browser-open-handler';
import { MiniBrowserOpenHandler } from '@theia/mini-browser/lib/browser/mini-browser-open-handler';

export default new ContainerModule(bind => {
export default new ContainerModule((bind, unbind, isBound, rebind) => {
bind(CheApiProvider).toSelf().inSingletonScope();
bind(MainPluginApiProvider).toService(CheApiProvider);

Expand Down Expand Up @@ -84,4 +86,7 @@ export default new ContainerModule(bind => {
bind(CheSideCarContentReaderRegistry).to(CheSideCarContentReaderRegistryImpl).inSingletonScope();
bind(CheSideCarResourceResolver).toSelf().inSingletonScope();
bind(ResourceResolver).toService(CheSideCarResourceResolver);

bind(CheMiniBrowserOpenHandler).toSelf().inSingletonScope();
rebind(MiniBrowserOpenHandler).to(CheMiniBrowserOpenHandler).inSingletonScope();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*********************************************************************
* 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
**********************************************************************/

import { MiniBrowserOpenerOptions, MiniBrowserOpenHandler } from '@theia/mini-browser/lib/browser/mini-browser-open-handler';

export class CheMiniBrowserOpenHandler extends MiniBrowserOpenHandler {

protected async getOpenPreviewProps(startPage: string): Promise<MiniBrowserOpenerOptions> {
const miniBrowserOpenerOptions = await super.getOpenPreviewProps(startPage);
return { ...miniBrowserOpenerOptions, toolbar: 'show' };
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,14 @@ export class ChePluginWidget extends ReactWidget {
const notificationStyle = this.hidingRestartWorkspaceNotification ? 'notification hiding' : 'notification';
return <div className='che-plugins-notification' >
<div className={notificationStyle}>
<div className='notification-message' onClick={this.restartWorkspace}>
<i className='fa fa-check-circle'></i>&nbsp;
Click here to apply changes and restart your workspace
<div className='notification-message' onClick={this.restartWorkspace}
title='Click to restart your workspace with applying changes'>
<div className='notification-message-icon'><i className='fa fa-check-circle'></i></div>
<div className='notification-message-text'>Click here to apply changes and restart your workspace</div>
</div>

<div className='notification-control'>
<div className='notification-hide' onClick={this.hideNotification}>
<div className='notification-hide' onClick={this.hideNotification} title='Hide'>
<i className='fa fa-close alert-close' ></i>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,31 @@
top: 9px;
right: 28px;
height: 28px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
line-height: 28px;
padding-left: 9px;
overflow: hidden;
cursor: pointer;
}

.notification-message-icon {
position: absolute;
left: 0px;
top: 0px;
width: 28px;
height: 28px;
text-align: center;
}

.notification-message-text {
position: absolute;
left: 28px;
right: 0px;
top: 0px;
bottom: 0px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}

.che-plugins-notification .notification:hover {
background-color: var(--theia-success-color1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,14 @@ export class RemoteTerminalWidget extends TerminalWidgetImpl {
await this.connectSocket(this.terminalId);
}

get cwd(): Promise<URI> {
// It is not possible to retrieve current working directory of a terminal process which is run via exec mechanism.
// But we have to override this method to avoid requesting wrong terminal backend.
// Returning empty cwd will result in some features not working in some cases (for example opening files in editor by
// relative link from terminal with exec backend), however it will prevent some errors.
return Promise.resolve(new URI());
}

get processId(): Promise<number> {
return (async () => {
if (!IBaseTerminalServer.validateId(this.terminalId)) {
Expand Down Expand Up @@ -186,8 +194,8 @@ export class RemoteTerminalWidget extends TerminalWidgetImpl {
socket.onmessage = ev => this.write(ev.data);

this.toDispose.push(Disposable.create(() => {
socket.close();
this.term.off('data', sendListener);
socket.close();
}));

this.isOpen = true;
Expand Down Expand Up @@ -261,7 +269,7 @@ export class RemoteTerminalWidget extends TerminalWidgetImpl {
const cols = this.term.cols;
const rows = this.term.rows;

if (this.termServer) {
if (this.termServer && this.termServer.resize) {
this.termServer.resize({ id: this.terminalId, cols, rows });
}
}
Expand Down
13 changes: 12 additions & 1 deletion generator/src/init-sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ export class InitSources {
*/
private globalDevDependencies = new Map<string, string>();

/**
* Will clone sources keeping or omiting the history
*/
private keepHistory: boolean = true;

/**
* Constructor
*/
Expand All @@ -62,7 +67,13 @@ export class InitSources {
readonly cheTheiaFolder: string,
readonly assemblyFolder: string,
readonly theiaVersion: string) {
}

/**
* Keep or omit git history when cloning sources
*/
set keepGitHistory(value: boolean) {
this.keepHistory = value;
}

/**
Expand Down Expand Up @@ -272,7 +283,7 @@ export class InitSources {
} else {
Logger.info(`Cloning ${extension.source}...`);
const repository = new Repository(extension.source);
extension.clonedDir = await repository.clone(this.cheTheiaFolder, repository.getRepositoryName(), extension.checkoutTo);
extension.clonedDir = await repository.clone(this.cheTheiaFolder, repository.getRepositoryName(), extension.checkoutTo, this.keepHistory);
}
}

Expand Down
19 changes: 11 additions & 8 deletions generator/src/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,21 @@ export class Repository {
* @param checkoutFolder the CWD / directory where to launch the clone operation
* @param dest the destination folder of the clone
* @param checkoutTo the optional branch/tag to use when cloning
* @param keepHistory the optional flag to keep / omit git history
*/
public async clone(checkoutFolder: string, dest: string, checkoutTo?: string): Promise<string> {
public async clone(checkoutFolder: string, dest: string, checkoutTo?: string, keepHistory: boolean = true): Promise<string> {
const commandTheiaFolder = new Command(checkoutFolder);
await commandTheiaFolder.exec(`git clone ${this.uri} ${dest}`);

const clonedDir = path.resolve(checkoutFolder, dest);
if (checkoutTo) {
// need to change checkout
const commandClonedDir = new Command(clonedDir);
await commandClonedDir.exec(`git checkout -f ${checkoutTo}`);
}
// Use -b to clone the specific branch
let opts = checkoutTo ? `-b ${checkoutTo}` : '';

// Use --single-branch and --depth to omit git history
opts += keepHistory ? '' : ' --single-branch --depth 1';

await commandTheiaFolder.exec(`git clone ${opts} ${this.uri} ${dest}`);

const clonedDir = path.resolve(checkoutFolder, dest);
return clonedDir;
}

}
Loading

0 comments on commit 96dc7e7

Please sign in to comment.