Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] The PowerShell extension-related fixes #102

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c68b7a4
Test running the remote terminal sessions through the extension API
azatsarynnyy Sep 9, 2022
59eb5c6
Test running the remote terminal sessions through the extension API
azatsarynnyy Sep 9, 2022
7158f94
Test running the remote terminal sessions through the extension API
azatsarynnyy Sep 11, 2022
0a9a046
Test running the remote terminal sessions through the extension API
azatsarynnyy Sep 13, 2022
d5bb1b6
Test running the remote terminal sessions through the extension API
azatsarynnyy Sep 14, 2022
41cbd5f
Test running the remote terminal sessions through the extension API
azatsarynnyy Sep 15, 2022
5d04538
Merge branch 'main' into term-ext
azatsarynnyy Sep 19, 2022
751bca0
Fix port binding (possibly, upstream bug)
azatsarynnyy Sep 19, 2022
7bd8d49
Run the Devfile commands via che-terminal extension's API
azatsarynnyy Sep 20, 2022
91287c2
Merge branch 'main' into term-ext
azatsarynnyy Sep 20, 2022
3eae55c
Run the Devfile commands via che-terminal extension's API
azatsarynnyy Sep 20, 2022
0a1a4f9
Run the Devfile commands via che-terminal extension's API
azatsarynnyy Sep 21, 2022
093f8db
Run the Devfile commands via che-terminal extension's API
azatsarynnyy Sep 21, 2022
b3e5c5c
Get the containers list
azatsarynnyy Sep 22, 2022
91451c6
Get the containers list
azatsarynnyy Sep 22, 2022
9005845
Get the containers list
azatsarynnyy Sep 23, 2022
2bc5696
Filter out the containers list
azatsarynnyy Sep 24, 2022
e02c9e0
Filter out the containers list
azatsarynnyy Sep 25, 2022
27d89d4
Code cleanup
azatsarynnyy Sep 29, 2022
7133883
Merge branch 'main' into term-ext
azatsarynnyy Sep 29, 2022
633f4b4
Better logging
azatsarynnyy Sep 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions .github/workflows/pr-check-image-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,20 @@ jobs:
docker tag assembly-pr ${IMAGE_NAME}
docker push ${IMAGE_NAME}
echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_ENV
- name: Download dev image
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: dev-image
- name: Load dev Docker image
run: |
docker load -i dev-pr.tgz
- name: Docker Push
run: |
export DEV_IMAGE_NAME=quay.io/che-incubator-pull-requests/che-code-dev:pr-${{env.PR_NUMBER}}-dev-amd64
docker tag dev-pr ${DEV_IMAGE_NAME}
docker push ${DEV_IMAGE_NAME}
echo "DEV_IMAGE_NAME=${DEV_IMAGE_NAME}" >> $GITHUB_ENV
# - name: Download dev image
# uses: dawidd6/action-download-artifact@v2
# with:
# workflow: ${{ github.event.workflow_run.workflow_id }}
# name: dev-image
# - name: Load dev Docker image
# run: |
# docker load -i dev-pr.tgz
# - name: Docker Push
# run: |
# export DEV_IMAGE_NAME=quay.io/che-incubator-pull-requests/che-code-dev:pr-${{env.PR_NUMBER}}-dev-amd64
# docker tag dev-pr ${DEV_IMAGE_NAME}
# docker push ${DEV_IMAGE_NAME}
# echo "DEV_IMAGE_NAME=${DEV_IMAGE_NAME}" >> $GITHUB_ENV
- name: 'Comment PR'
uses: actions/github-script@v5
with:
Expand All @@ -87,5 +87,5 @@ jobs:
issue_number: process.env.PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Pull Request images published ✨\nimage: ${process.env.IMAGE_NAME}\n Dev image: ${process.env.DEV_IMAGE_NAME}`
body: `Pull Request images published ✨\nimage: ${process.env.IMAGE_NAME}`
})
38 changes: 19 additions & 19 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
dist: [ 'musl', 'libc' ]
dist: [ 'libc' ]
arch: ['amd64']
runs-on: ubuntu-20.04
steps:
Expand Down Expand Up @@ -47,10 +47,10 @@ jobs:
uses: ishworkh/docker-image-artifact-download@v1
with:
image: "linux-libc-amd64"
- name: Download linux-musl image
uses: ishworkh/docker-image-artifact-download@v1
with:
image: "linux-musl-amd64"
# - name: Download linux-musl image
# uses: ishworkh/docker-image-artifact-download@v1
# with:
# image: "linux-musl-amd64"
- name: Display docker images
run: |
docker images
Expand All @@ -73,17 +73,17 @@ jobs:
with:
name: pull-request-sha
path: PR_SHA
dev:
name: dev
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Docker Build
run: |
docker buildx build --platform linux/amd64 -f build/dockerfiles/dev.Dockerfile --load -t dev-pr .
docker save dev-pr | gzip > dev-pr.tgz
- uses: actions/upload-artifact@v2
with:
name: dev-image
path: dev-pr.tgz
# dev:
# name: dev
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Docker Build
# run: |
# docker buildx build --platform linux/amd64 -f build/dockerfiles/dev.Dockerfile --load -t dev-pr .
# docker save dev-pr | gzip > dev-pr.tgz
# - uses: actions/upload-artifact@v2
# with:
# name: dev-image
# path: dev-pr.tgz
10 changes: 0 additions & 10 deletions .rebase/replace/code/src/vs/server/node/serverServices.ts.json

This file was deleted.

4 changes: 2 additions & 2 deletions build/dockerfiles/assembly.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# Grab content from previously build images
FROM linux-libc-amd64 as linux-libc-content
FROM linux-musl-amd64 as linux-musl-content
# FROM linux-musl-amd64 as linux-musl-content

# https://quay.io/eclipse/che-machine-exec#^7\.
FROM quay.io/eclipse/che-machine-exec:7.53.0 as machine-exec
Expand All @@ -21,7 +21,7 @@ RUN rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/

WORKDIR /mnt/rootfs

COPY --from=linux-musl-content --chown=0:0 /checode-linux-musl /mnt/rootfs/checode-linux-musl
# COPY --from=linux-musl-content --chown=0:0 /checode-linux-musl /mnt/rootfs/checode-linux-musl
COPY --from=linux-libc-content --chown=0:0 /checode-linux-libc /mnt/rootfs/checode-linux-libc

RUN mkdir -p /mnt/rootfs/projects && mkdir -p /mnt/rootfs/home/che && mkdir -p /mnt/rootfs/bin/
Expand Down
60 changes: 30 additions & 30 deletions build/dockerfiles/linux-libc.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,48 +77,48 @@ RUN chmod a+x /checode/out/server-main.js \

### Testing
# Compile tests
RUN ./node_modules/.bin/gulp compile-extension:vscode-api-tests \
compile-extension:markdown-language-features \
compile-extension:typescript-language-features \
compile-extension:emmet \
compile-extension:git \
compile-extension:ipynb \
compile-extension-media \
compile-extension:configuration-editing
# RUN ./node_modules/.bin/gulp compile-extension:vscode-api-tests \
# compile-extension:markdown-language-features \
# compile-extension:typescript-language-features \
# compile-extension:emmet \
# compile-extension:git \
# compile-extension:ipynb \
# compile-extension-media \
# compile-extension:configuration-editing

# Compile test suites
# https://github.com/microsoft/vscode/blob/cdde5bedbf3ed88f93b5090bb3ed9ef2deb7a1b4/test/integration/browser/README.md#compile
RUN [[ $(uname -m) == "x86_64" ]] && yarn --cwd test/smoke compile && yarn --cwd test/integration/browser compile
# RUN [[ $(uname -m) == "x86_64" ]] && yarn --cwd test/smoke compile && yarn --cwd test/integration/browser compile

# install test dependencies
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=0
RUN [[ $(uname -m) == "x86_64" ]] && yarn playwright-install
# ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=0
# RUN [[ $(uname -m) == "x86_64" ]] && yarn playwright-install
# Install procps to manage to kill processes and centos stream repository
RUN [[ $(uname -m) == "x86_64" ]] && \
ARCH=$(uname -m) && \
yum install --nobest -y procps \
http://mirror.centos.org/centos/8/extras/${ARCH}/os/Packages/epel-release-8-11.el8.noarch.rpm \
http://mirror.centos.org/centos/8-stream/BaseOS/${ARCH}/os/Packages/centos-gpg-keys-8-3.el8.noarch.rpm \
http://mirror.centos.org/centos/8-stream/BaseOS/${ARCH}/os/Packages/centos-stream-repos-8-3.el8.noarch.rpm

RUN [[ $(uname -m) == "x86_64" ]] && yum install -y chromium && \
PLAYWRIGHT_CHROMIUM_PATH=$(echo /opt/app-root/src/.cache/ms-playwright/chromium-*/) && \
rm "${PLAYWRIGHT_CHROMIUM_PATH}/chrome-linux/chrome" && \
ln -s /usr/bin/chromium-browser "${PLAYWRIGHT_CHROMIUM_PATH}/chrome-linux/chrome"
# RUN [[ $(uname -m) == "x86_64" ]] && \
# ARCH=$(uname -m) && \
# yum install --nobest -y procps \
# http://mirror.centos.org/centos/8/extras/${ARCH}/os/Packages/epel-release-8-11.el8.noarch.rpm \
# http://mirror.centos.org/centos/8-stream/BaseOS/${ARCH}/os/Packages/centos-gpg-keys-8-3.el8.noarch.rpm \
# http://mirror.centos.org/centos/8-stream/BaseOS/${ARCH}/os/Packages/centos-stream-repos-8-3.el8.noarch.rpm

# RUN [[ $(uname -m) == "x86_64" ]] && yum install -y chromium && \
# PLAYWRIGHT_CHROMIUM_PATH=$(echo /opt/app-root/src/.cache/ms-playwright/chromium-*/) && \
# rm "${PLAYWRIGHT_CHROMIUM_PATH}/chrome-linux/chrome" && \
# ln -s /usr/bin/chromium-browser "${PLAYWRIGHT_CHROMIUM_PATH}/chrome-linux/chrome"

# use of retry and timeout
COPY /build/scripts/helper/retry.sh /opt/app-root/src/retry.sh
RUN chmod u+x /opt/app-root/src/retry.sh
# COPY /build/scripts/helper/retry.sh /opt/app-root/src/retry.sh
# RUN chmod u+x /opt/app-root/src/retry.sh

# Run integration tests (Browser)
RUN [[ $(uname -m) == "x86_64" ]] && NODE_ARCH=$(echo "console.log(process.arch)" | node) \
VSCODE_REMOTE_SERVER_PATH="$(pwd)/../vscode-reh-web-linux-${NODE_ARCH}" \
/opt/app-root/src/retry.sh -v -t 3 -s 2 -- timeout -v 5m ./scripts/test-web-integration.sh --browser chromium
# RUN [[ $(uname -m) == "x86_64" ]] && NODE_ARCH=$(echo "console.log(process.arch)" | node) \
# VSCODE_REMOTE_SERVER_PATH="$(pwd)/../vscode-reh-web-linux-${NODE_ARCH}" \
# /opt/app-root/src/retry.sh -v -t 3 -s 2 -- timeout -v 5m ./scripts/test-web-integration.sh --browser chromium

# Run smoke tests (Browser)
RUN [[ $(uname -m) == "x86_64" ]] && NODE_ARCH=$(echo "console.log(process.arch)" | node) \
VSCODE_REMOTE_SERVER_PATH="$(pwd)/../vscode-reh-web-linux-${NODE_ARCH}" \
/opt/app-root/src/retry.sh -v -t 3 -s 2 -- timeout -v 5m yarn smoketest-no-compile --web --headless --electronArgs="--disable-dev-shm-usage --use-gl=swiftshader"
# RUN [[ $(uname -m) == "x86_64" ]] && NODE_ARCH=$(echo "console.log(process.arch)" | node) \
# VSCODE_REMOTE_SERVER_PATH="$(pwd)/../vscode-reh-web-linux-${NODE_ARCH}" \
# /opt/app-root/src/retry.sh -v -t 3 -s 2 -- timeout -v 5m yarn smoketest-no-compile --web --headless --electronArgs="--disable-dev-shm-usage --use-gl=swiftshader"

# Store the content of the result
FROM scratch as linux-libc-content
Expand Down
52 changes: 26 additions & 26 deletions build/dockerfiles/linux-musl.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,44 +50,44 @@ RUN chmod a+x /checode/out/server-main.js \
&& chgrp -R 0 /checode && chmod -R g+rwX /checode

# Compile tests
RUN ./node_modules/.bin/gulp compile-extension:vscode-api-tests \
compile-extension:markdown-language-features \
compile-extension:typescript-language-features \
compile-extension:emmet \
compile-extension:git \
compile-extension:ipynb \
compile-extension-media \
compile-extension:configuration-editing
# RUN ./node_modules/.bin/gulp compile-extension:vscode-api-tests \
# compile-extension:markdown-language-features \
# compile-extension:typescript-language-features \
# compile-extension:emmet \
# compile-extension:git \
# compile-extension:ipynb \
# compile-extension-media \
# compile-extension:configuration-editing

# Compile test suites
# https://github.com/microsoft/vscode/blob/cdde5bedbf3ed88f93b5090bb3ed9ef2deb7a1b4/test/integration/browser/README.md#compile
RUN [[ $(uname -m) == "x86_64" ]] && yarn --cwd test/smoke compile && yarn --cwd test/integration/browser compile
# # Compile test suites
# # https://github.com/microsoft/vscode/blob/cdde5bedbf3ed88f93b5090bb3ed9ef2deb7a1b4/test/integration/browser/README.md#compile
# RUN [[ $(uname -m) == "x86_64" ]] && yarn --cwd test/smoke compile && yarn --cwd test/integration/browser compile

# use of retry and timeout
COPY /build/scripts/helper/retry.sh /usr/bin/retry
RUN chmod u+x /usr/bin/retry
# COPY /build/scripts/helper/retry.sh /usr/bin/retry
# RUN chmod u+x /usr/bin/retry

# install test dependencies
# chromium for tests and procps as tests are using kill commands and it does not work with busybox implementation
RUN [[ $(uname -m) == "x86_64" ]] && apk add --update --no-cache chromium procps
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=0
RUN [[ $(uname -m) == "x86_64" ]] && yarn playwright-install
RUN [[ $(uname -m) == "x86_64" ]] && \
PLAYWRIGHT_CHROMIUM_PATH=$(echo /root/.cache/ms-playwright/chromium-*/) && \
rm "${PLAYWRIGHT_CHROMIUM_PATH}/chrome-linux/chrome" && \
ln -s /usr/bin/chromium-browser "${PLAYWRIGHT_CHROMIUM_PATH}/chrome-linux/chrome" && \
ls -la /checode-compilation/extensions/vscode-api-tests/ && \
ls -la /checode-compilation/extensions/vscode-api-tests/out/
# RUN [[ $(uname -m) == "x86_64" ]] && apk add --update --no-cache chromium procps
# ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=0
# RUN [[ $(uname -m) == "x86_64" ]] && yarn playwright-install
# RUN [[ $(uname -m) == "x86_64" ]] && \
# PLAYWRIGHT_CHROMIUM_PATH=$(echo /root/.cache/ms-playwright/chromium-*/) && \
# rm "${PLAYWRIGHT_CHROMIUM_PATH}/chrome-linux/chrome" && \
# ln -s /usr/bin/chromium-browser "${PLAYWRIGHT_CHROMIUM_PATH}/chrome-linux/chrome" && \
# ls -la /checode-compilation/extensions/vscode-api-tests/ && \
# ls -la /checode-compilation/extensions/vscode-api-tests/out/



# Run integration tests (Browser)
RUN [[ $(uname -m) == "x86_64" ]] && VSCODE_REMOTE_SERVER_PATH="/vscode-reh-web-linux-alpine" \
retry -v -t 3 -s 2 -- timeout 5m ./scripts/test-web-integration.sh --browser chromium
# RUN [[ $(uname -m) == "x86_64" ]] && VSCODE_REMOTE_SERVER_PATH="/vscode-reh-web-linux-alpine" \
# retry -v -t 3 -s 2 -- timeout 5m ./scripts/test-web-integration.sh --browser chromium

# Run smoke tests (Browser)
RUN [[ $(uname -m) == "x86_64" ]] && VSCODE_REMOTE_SERVER_PATH="/vscode-reh-web-linux-alpine" \
retry -v -t 3 -s 2 -- timeout 5m yarn smoketest-no-compile --web --headless --electronArgs="--disable-dev-shm-usage --use-gl=swiftshader"
# RUN [[ $(uname -m) == "x86_64" ]] && VSCODE_REMOTE_SERVER_PATH="/vscode-reh-web-linux-alpine" \
# retry -v -t 3 -s 2 -- timeout 5m yarn smoketest-no-compile --web --headless --electronArgs="--disable-dev-shm-usage --use-gl=swiftshader"

FROM scratch as linux-musl-content
COPY --from=linux-musl-builder /checode /checode-linux-musl
1 change: 1 addition & 0 deletions code/build/gulpfile.extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const compilations = [
'che-on-start/tsconfig.json',
'che-remote/tsconfig.json',
'che-resource-monitor/tsconfig.json',
'che-terminal/tsconfig.json',
'che-github-authentication/tsconfig.json',
'configuration-editing/build/tsconfig.json',
'configuration-editing/tsconfig.json',
Expand Down
1 change: 1 addition & 0 deletions code/build/npm/dirs.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ exports.dirs = [
'extensions/che-on-start',
'extensions/che-remote',
'extensions/che-resource-monitor',
'extensions/che-terminal',
'extensions/che-github-authentication',
'extensions/configuration-editing',
'extensions/css-language-features',
Expand Down
2 changes: 1 addition & 1 deletion code/extensions/che-commands/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"url": "https://github.com/che-incubator/che-code.git"
},
"extensionDependencies": [
"eclipse-che.api"
"eclipse-che.terminal"
],
"jest": {
"collectCoverage": true,
Expand Down
2 changes: 2 additions & 0 deletions code/extensions/che-commands/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* SPDX-License-Identifier: EPL-2.0
***********************************************************************/

/* eslint-disable header/header */

import * as vscode from 'vscode';
import { CheTaskProvider } from './taskProvider';

Expand Down
24 changes: 19 additions & 5 deletions code/extensions/che-commands/src/taskProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* SPDX-License-Identifier: EPL-2.0
***********************************************************************/

/* eslint-disable header/header */

import { V1alpha2DevWorkspaceSpecTemplate, V1alpha2DevWorkspaceSpecTemplateCommands } from '@devfile/api';
import * as vscode from 'vscode';

Expand All @@ -17,9 +19,21 @@ interface CheTaskDefinition extends vscode.TaskDefinition {
component?: string;
}

let che_api: vscode.Extension<any> | undefined, che_terminal: vscode.Extension<any> | undefined;

export class CheTaskProvider implements vscode.TaskProvider {

constructor(private channel: vscode.OutputChannel) { }
constructor(private channel: vscode.OutputChannel) {
che_api = vscode.extensions.getExtension('eclipse-che.api');
if (!che_api) {
this.channel.appendLine('eclipse-che.api extension is not found.');
}

che_terminal = vscode.extensions.getExtension('eclipse-che.terminal');
if (!che_terminal) {
this.channel.appendLine('eclipse-che.terminal extension is not found.');
}
}

provideTasks(): vscode.ProviderResult<vscode.Task[]> {
return this.computeTasks();
Expand All @@ -39,9 +53,7 @@ export class CheTaskProvider implements vscode.TaskProvider {
}

private async fetchDevfileCommands(): Promise<V1alpha2DevWorkspaceSpecTemplateCommands[]> {
const che_api = vscode.extensions.getExtension('eclipse-che.api');
if (!che_api) {
this.channel.appendLine('eclipse-che.api extension is not found.');
return [];
}

Expand Down Expand Up @@ -76,8 +88,10 @@ export class CheTaskProvider implements vscode.TaskProvider {
component
};

command = command + ` --component ${component}`;
const execution = new vscode.ShellExecution(command, { cwd: expandEnvVariables(workdir) });
const execution = new vscode.CustomExecution(async (): Promise<vscode.Pseudoterminal> => {
return che_terminal?.exports.getMachineExecPTY(component, command, expandEnvVariables(workdir));
});

const task = new vscode.Task(kind, vscode.TaskScope.Workspace, name, 'che', execution);
return task;
}
Expand Down
8 changes: 8 additions & 0 deletions code/extensions/che-terminal/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
build/**
src/**
tests/**
coverage/**
out/**
tsconfig.json
extension.webpack.config.js
yarn.lock
7 changes: 7 additions & 0 deletions code/extensions/che-terminal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Che Terminals for Visual Studio Code

**Notice:** This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled.

## Features

This extension provides support for opening a termianl to a DevWorksapce component
Loading