Skip to content
Draft

TEST #582

Show file tree
Hide file tree
Changes from all commits
Commits
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
55 changes: 0 additions & 55 deletions build/dockerfiles/linux-libc-ubi8.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -111,61 +111,6 @@ RUN chmod a+x /checode/out/server-main.js \
### Beginning of tests
# Do not change line above! It is used to cut this section to skip tests

# 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

# Compile test suites
# https://github.com/microsoft/vscode/blob/cdde5bedbf3ed88f93b5090bb3ed9ef2deb7a1b4/test/integration/browser/README.md#compile
RUN if [ "$(uname -m)" = "x86_64" ]; then npm --prefix test/smoke run compile && npm --prefix test/integration/browser run compile; fi

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

RUN if [ "$(uname -m)" = "x86_64" ]; then \
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* \
&& yum install -y chromium \
&& PLAYWRIGHT_CHROMIUM_PATH=$(echo /opt/app-root/src/.cache/ms-playwright/chromium-*/chrome-linux64) \
&& PLAYWRIGHT_HEADLESS_PATH=$(echo /opt/app-root/src/.cache/ms-playwright/chromium_headless_shell-*/chrome-headless-shell-linux64) \
&& rm -f "${PLAYWRIGHT_CHROMIUM_PATH}/chrome" \
&& ln -sf /usr/bin/chromium-browser "${PLAYWRIGHT_CHROMIUM_PATH}/chrome" \
&& rm -f "${PLAYWRIGHT_HEADLESS_PATH}/chrome-headless-shell" \
&& ln -sf /usr/bin/chromium-browser "${PLAYWRIGHT_HEADLESS_PATH}/chrome-headless-shell"; \
fi

# 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

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

# Run smoke tests (Browser)
RUN if [ "$(uname -m)" = "x86_64" ]; then \
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 npm run smoketest-no-compile -- --web --headless --electronArgs="--disable-dev-shm-usage --use-gl=swiftshader"; \
fi

# Do not change line below! It is used to cut this section to skip tests
### Ending of tests
Expand Down
54 changes: 0 additions & 54 deletions build/dockerfiles/linux-libc-ubi9.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -117,60 +117,6 @@ RUN chmod a+x /checode/out/server-main.js \
### Beginning of tests
# Do not change line above! It is used to cut this section to skip tests

# 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

# # Compile test suites
# https://github.com/microsoft/vscode/blob/cdde5bedbf3ed88f93b5090bb3ed9ef2deb7a1b4/test/integration/browser/README.md#compile
RUN if [ "$(uname -m)" = "x86_64" ]; then npm --prefix test/smoke run compile && npm --prefix test/integration/browser run compile; fi

# install test dependencies
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=0
RUN if [ "$(uname -m)" = "x86_64" ]; then npm run playwright-install; fi
# Install procps to manage to kill processes and centos stream repository
RUN if [ "$(uname -m)" = "x86_64" ]; then \
ARCH=$(uname -m) && \
yum install --nobest -y procps \
https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/Packages/e/epel-release-9-11.el9.noarch.rpm \
https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/centos-gpg-keys-9.0-32.el9.noarch.rpm \
https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/centos-stream-repos-9.0-32.el9.noarch.rpm; \
fi

RUN if [ "$(uname -m)" = "x86_64" ]; then \
yum install -y chromium && \
PLAYWRIGHT_CHROMIUM_PATH=$(echo /opt/app-root/src/.cache/ms-playwright/chromium-*/chrome-linux64) && \
PLAYWRIGHT_HEADLESS_PATH=$(echo /opt/app-root/src/.cache/ms-playwright/chromium_headless_shell-*/chrome-headless-shell-linux64) && \
rm -f "${PLAYWRIGHT_CHROMIUM_PATH}/chrome" && \
ln -sf /usr/bin/chromium-browser "${PLAYWRIGHT_CHROMIUM_PATH}/chrome" && \
rm -f "${PLAYWRIGHT_HEADLESS_PATH}/chrome-headless-shell" && \
ln -sf /usr/bin/chromium-browser "${PLAYWRIGHT_HEADLESS_PATH}/chrome-headless-shell"; \
fi

# 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

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

# Run smoke tests (Browser)
RUN if [ "$(uname -m)" = "x86_64" ]; then \
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 npm run smoketest-no-compile -- --web --headless --electronArgs="--disable-dev-shm-usage --use-gl=swiftshader"; \
fi

# Do not change line below! It is used to cut this section to skip tests
### Ending of tests
Expand Down
52 changes: 0 additions & 52 deletions build/dockerfiles/linux-musl.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,58 +82,6 @@ RUN find /checode/out -type f \( -name "*.js" -o -name "*.css" -o -name "*.html"
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

# Compile test suites
# https://github.com/microsoft/vscode/blob/cdde5bedbf3ed88f93b5090bb3ed9ef2deb7a1b4/test/integration/browser/README.md#compile
RUN if [ "$(uname -m)" = "x86_64" ]; then \
npm --prefix test/smoke run compile && npm --prefix test/integration/browser run compile; \
fi
# use of retry and timeout
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 if [ "$(uname -m)" = "x86_64" ]; then \
apk add --update --no-cache chromium procps; \
fi
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=0
RUN if [ "$(uname -m)" = "x86_64" ]; then \
npm run playwright-install; \
fi
RUN if [ "$(uname -m)" = "x86_64" ]; then \
PLAYWRIGHT_CHROMIUM_PATH=$(echo /root/.cache/ms-playwright/chromium-*/chrome-linux64) && \
PLAYWRIGHT_HEADLESS_PATH=$(echo /root/.cache/ms-playwright/chromium_headless_shell-*/chrome-headless-shell-linux64) && \
echo "Found chromium path: $PLAYWRIGHT_CHROMIUM_PATH" && \
echo "Found headless_shell path: $PLAYWRIGHT_HEADLESS_PATH" && \
rm -f "${PLAYWRIGHT_CHROMIUM_PATH}/chrome" && \
ln -sf /usr/bin/chromium-browser "${PLAYWRIGHT_CHROMIUM_PATH}/chrome" && \
rm -f "${PLAYWRIGHT_HEADLESS_PATH}/chrome-headless-shell" && \
ln -sf /usr/bin/chromium-browser "${PLAYWRIGHT_HEADLESS_PATH}/chrome-headless-shell" && \
ls -la "${PLAYWRIGHT_CHROMIUM_PATH}" "${PLAYWRIGHT_HEADLESS_PATH}"; \
fi

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

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

#########################################################
#
Expand Down
42 changes: 39 additions & 3 deletions code/extensions/che-api/src/impl/github-service-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,46 @@ export class GithubServiceImpl implements GithubService {
throw new Error('device-authentication secret not found');
}

await this.deleteDeviceAuthSecrets(deviceAuthSecrets);
const rawToken = deviceAuthSecrets[0].data?.token
? base64Decode(deviceAuthSecrets[0].data.token)
: '';
if (rawToken) {
await this.revokeGitHubToken(rawToken);
}

// TEMPORARY: skip secret deletion and session clearing to test if token still works after revoke
this.logger.info('Github Service: skipping secret deletion (revocation test mode)');
}

// another token should be used by the Github Service after removing the Device Authentication token
this.initializeToken();
private async revokeGitHubToken(token: string): Promise<void> {
try {
this.logger.info('Github Service: attempting to revoke GitHub token...');
const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), 30_000);
try {
const response = await fetch('https://api.github.com/credentials/revoke', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-GitHub-Api-Version': '2022-11-28',
Authorization: `Bearer ${token}`,
},
body: JSON.stringify({ credentials: [token] }),
signal: controller.signal,
});
this.logger.info(`Github Service: GitHub token revocation response: HTTP ${response.status}`);
if (response.ok || response.status === 202) {
this.logger.info('Github Service: GitHub token revoked successfully');
} else {
const body = await response.text().catch(() => '');
this.logger.warn(`Github Service: GitHub token revocation failed (HTTP ${response.status}): ${body}`);
}
} finally {
clearTimeout(timer);
}
} catch (error: any) {
this.logger.warn(`Github Service: GitHub token revocation error: ${error.message}`);
}
}

private async deleteDeviceAuthSecrets(secrets?: k8s.V1Secret[]): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ export class DeviceAuthentication {

async removeDeviceAuthToken(): Promise<void> {
try {
await this.gitHubAuthProvider.clearDeviceAuthSessions();
// TEMPORARY: skip session clearing to test revocation only
await this.githubService.removeDeviceAuthToken();
const message = 'The token was deleted successfully. Some operations may require Github Sign Out => Sign In to use another token.'
const message = 'Revocation request sent. Token and sessions are NOT removed (test mode).'
vscode.window.showInformationMessage(message);
} catch (error) {
const message = `Can not remove Device Authentication token: ${error.message}`;
Expand Down
28 changes: 26 additions & 2 deletions code/src/vs/code/browser/workbench/workbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ class WorkspaceProvider implements IWorkspaceProvider {
}
}

console.log('[che-startup-debug] WorkspaceProvider.create():', { foundWorkspace, workspace, locationHref: document.location.href });
return new WorkspaceProvider(workspace, payload, config);
}

Expand All @@ -494,12 +495,15 @@ class WorkspaceProvider implements IWorkspaceProvider {

async open(workspace: IWorkspace, options?: { reuse?: boolean; payload?: object }): Promise<boolean> {
if (options?.reuse && !options.payload && this.isSame(this.workspace, workspace)) {
console.log('[che-startup-debug] WorkspaceProvider.open() called but isSame=true, no navigation needed');
return true; // return early if workspace and environment is not changing and we are reusing window
}

const targetHref = this.createTargetUrl(workspace, options);
if (targetHref) {
if (options?.reuse) {
console.log('[che-startup-debug] WorkspaceProvider.open() NAVIGATING via location.href', { targetHref, currentHref: mainWindow.location.href, workspace, options });
console.trace('[che-startup-debug] WorkspaceProvider.open() call stack');
mainWindow.location.href = targetHref;
return true;
} else {
Expand Down Expand Up @@ -567,13 +571,22 @@ class WorkspaceProvider implements IWorkspaceProvider {
}

if (isFolderToOpen(workspaceA) && isFolderToOpen(workspaceB)) {
return isEqual(workspaceA.folderUri, workspaceB.folderUri); // same workspace
const result = isEqual(workspaceA.folderUri, workspaceB.folderUri);
if (!result) {
console.log('[che-startup-debug] WorkspaceProvider.isSame() folder URIs differ:', workspaceA.folderUri.toString(), '!==', workspaceB.folderUri.toString());
}
return result; // same workspace
}

if (isWorkspaceToOpen(workspaceA) && isWorkspaceToOpen(workspaceB)) {
return isEqual(workspaceA.workspaceUri, workspaceB.workspaceUri); // same workspace
const result = isEqual(workspaceA.workspaceUri, workspaceB.workspaceUri);
if (!result) {
console.log('[che-startup-debug] WorkspaceProvider.isSame() workspace URIs differ:', workspaceA.workspaceUri.toString(), '!==', workspaceB.workspaceUri.toString());
}
return result; // same workspace
}

console.log('[che-startup-debug] WorkspaceProvider.isSame() workspace types differ:', workspaceA, workspaceB);
return false;
}

Expand Down Expand Up @@ -605,6 +618,14 @@ function readCookie(name: string): string | undefined {

(function () {

console.log('[che-startup-debug] Workbench IIFE starting, location:', mainWindow.location.href);

// Early global listener to catch any navigation/unload before VS Code registers its own
mainWindow.addEventListener('beforeunload', () => {
console.log('[che-startup-debug] GLOBAL beforeunload fired (early listener)');
console.trace('[che-startup-debug] GLOBAL beforeunload call stack');
});

// Find config by checking for DOM
// eslint-disable-next-line no-restricted-syntax
const configElement = mainWindow.document.getElementById('vscode-workbench-web-configuration');
Expand All @@ -615,9 +636,12 @@ function readCookie(name: string): string | undefined {

const cheConfig = getCheConfig();
const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents; workspaceUri?: UriComponents; callbackRoute: string } = JSON.parse(configElementAttribute);
console.log('[che-startup-debug] Workbench config parsed:', { folderUri: config.folderUri, workspaceUri: config.workspaceUri, remoteAuthority: config.remoteAuthority });

const secretStorageKeyPath = readCookie('vscode-secret-key-path') || '/';
const secretStorageCrypto = secretStorageKeyPath && ServerKeyedAESCrypto.supported()
? new ServerKeyedAESCrypto(secretStorageKeyPath) : new TransparentCrypto();
console.log('[che-startup-debug] SecretStorage: keyPath=', secretStorageKeyPath, 'usingAES=', secretStorageKeyPath && ServerKeyedAESCrypto.supported());

// Create workbench
create(mainWindow.document.body, {
Expand Down
6 changes: 5 additions & 1 deletion code/src/vs/workbench/browser/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -856,15 +856,19 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
// - always when `window.restoreWindows: preserve`

if (isTemporaryWorkspace(contextService.getWorkspace())) {
console.log('[che-startup-debug] shouldRestoreEditors: false (temporary workspace)');
return false;
}

if (this.configurationService.getValue<boolean>(WorkbenchLayoutSettings.EDITOR_RESTORE_EDITORS) === false) {
console.log('[che-startup-debug] shouldRestoreEditors: false (disabled by config)');
return false;
}

const forceRestoreEditors = this.configurationService.getValue<string>('window.restoreWindows') === 'preserve';
return !!forceRestoreEditors || initialEditorsState === undefined;
const result = !!forceRestoreEditors || initialEditorsState === undefined;
console.log('[che-startup-debug] shouldRestoreEditors:', result, { forceRestoreEditors, hasInitialEditorsState: initialEditorsState !== undefined });
return result;
}

protected willRestoreEditors(): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ export class ErrorPlaceholderEditor extends EditorPlaceholder {
const error = options.error;
const isFileNotFound = (<FileOperationError | undefined>error)?.fileOperationResult === FileOperationResult.FILE_NOT_FOUND;

console.log('[che-startup-debug] ErrorPlaceholderEditor.getContents():', { resource: resource?.toString(), error: error?.message || error, isFileNotFound });

// Error Label
let label: string;
if (isFileNotFound) {
Expand Down
10 changes: 10 additions & 0 deletions code/src/vs/workbench/browser/web.main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,13 @@ export class BrowserMain extends Disposable {

async open(): Promise<IWorkbench> {

console.log('[che-startup-debug] BrowserMain.open() started, location:', mainWindow.location.href);

// Init services and wait for DOM to be ready in parallel
const [services] = await Promise.all([this.initServices(), domContentLoaded(getWindow(this.domElement))]);

console.log('[che-startup-debug] BrowserMain.open() services initialized');

// Create Workbench
const workbench = this.createWorkbench(this.domElement, services.serviceCollection, services.logService);

Expand All @@ -140,6 +144,8 @@ export class BrowserMain extends Disposable {
// Startup
const instantiationService = workbench.startup();

console.log('[che-startup-debug] BrowserMain.open() workbench.startup() completed');

// Window
this._register(instantiationService.createInstance(BrowserWindow));

Expand Down Expand Up @@ -284,6 +290,7 @@ export class BrowserMain extends Disposable {


const workspace = this.resolveWorkspace();
console.log('[che-startup-debug] resolveWorkspace result:', JSON.stringify(workspace));

// Product
const productService: IProductService = mixin({ _serviceBrand: undefined, ...product }, this.configuration.productConfiguration);
Expand Down Expand Up @@ -632,10 +639,13 @@ export class BrowserMain extends Disposable {
const workspaceService = new WorkspaceService({ remoteAuthority: this.configuration.remoteAuthority, configurationCache }, environmentService, userDataProfileService, userDataProfilesService, fileService, remoteAgentService, uriIdentityService, logService, getPolicyService(remoteAgentService,logService, this.configuration.remoteAuthority));

try {
console.log('[che-startup-debug] Initializing WorkspaceService with workspace:', JSON.stringify(workspace));
await workspaceService.initialize(workspace);
console.log('[che-startup-debug] WorkspaceService.initialize() completed successfully');

return workspaceService;
} catch (error) {
console.log('[che-startup-debug] WorkspaceService.initialize() FAILED:', error);
onUnexpectedError(error);
logService.error(error);

Expand Down
Loading