Skip to content

Commit

Permalink
Merge branch 'main' into CHE-23219
Browse files Browse the repository at this point in the history
  • Loading branch information
olexii4 authored Jan 15, 2025
2 parents 04e5313 + 59a63fc commit ed0f66a
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 247 deletions.
8 changes: 4 additions & 4 deletions .deps/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | #16176 |
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | #13991 |
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | clearlydefined |
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | clearlydefined |
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | #18409 |
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | clearlydefined |
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | clearlydefined |
| [`@types/[email protected]`](https://github.com/DefinitelyTyped/DefinitelyTyped.git) | MIT | clearlydefined |
Expand Down Expand Up @@ -315,7 +315,7 @@
| `[email protected]` | MIT | clearlydefined |
| [`[email protected]`](http://github.com/eslint/eslint-scope) | BSD-2-Clause | clearlydefined |
| [`[email protected]`](http://github.com/eslint/eslint-scope) | BSD-2-Clause | #9916 |
| [`[email protected]`](https://github.com/eslint/eslint-visitor-keys#readme) | Apache-2.0 | #15274 |
| [`[email protected]`](https://github.com/eslint/eslint-visitor-keys#readme) | Apache-2.0 | #18264 |
| [`[email protected]`](https://github.com/webpack-contrib/eslint-webpack-plugin) | MIT | clearlydefined |
| [`[email protected]`](https://eslint.org) | MIT | #11437 |
| [`[email protected]`](https://github.com/eslint/espree) | BSD-2-Clause | #15293 |
Expand Down Expand Up @@ -435,7 +435,7 @@
| [`[email protected]`](git://github.com/inspect-js/is-typed-array.git) | MIT | #4853 |
| [`[email protected]`](git+https://github.com/inspect-js/is-weakmap.git) | MIT | clearlydefined |
| [`[email protected]`](git+https://github.com/inspect-js/is-weakref.git) | MIT | clearlydefined |
| [`[email protected]`](git+https://github.com/inspect-js/is-weakset.git) | MIT | clearlydefined |
| [`[email protected]`](git+https://github.com/inspect-js/is-weakset.git) | MIT | #18388 |
| `[email protected]` | MIT | clearlydefined |
| [`[email protected]`](git://github.com/juliangruber/isarray.git) | MIT | clearlydefined |
| [`[email protected]`](https://github.com/jonschlinkert/isobject) | MIT | clearlydefined |
Expand All @@ -445,7 +445,7 @@
| [`[email protected]`](git+ssh://[email protected]/istanbuljs/istanbuljs.git) | BSD-3-Clause | clearlydefined |
| [`[email protected]`](git+ssh://[email protected]/istanbuljs/istanbuljs.git) | BSD-3-Clause | clearlydefined |
| [`[email protected]`](git+ssh://[email protected]/istanbuljs/istanbuljs.git) | BSD-3-Clause | #1710 |
| [`[email protected]`](git+https://github.com/ljharb/Iterator.prototype.git) | MIT | clearlydefined |
| [`[email protected]`](git+https://github.com/ljharb/Iterator.prototype.git) | MIT | #18395 |
| [`[email protected]`](https://github.com/jestjs/jest.git) | MIT | clearlydefined |
| [`[email protected]`](https://github.com/jestjs/jest.git) | MIT | clearlydefined |
| [`[email protected]`](https://github.com/jestjs/jest.git) | MIT | clearlydefined |
Expand Down
2 changes: 1 addition & 1 deletion .deps/prod.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@
| [`[email protected]`](https://github.com/tapjs/signal-exit.git) | ISC | clearlydefined |
| [`[email protected]`](https://github.com/lelylan/simple-oauth2) | Apache-2.0 | clearlydefined |
| [`[email protected]`](https://github.com/JoshGlazebrook/smart-buffer.git) | MIT | clearlydefined |
| [`[email protected]`](https://github.com/TooTallNate/proxy-agents.git) | MIT | clearlydefined |
| [`[email protected]`](https://github.com/TooTallNate/proxy-agents.git) | MIT | #18498 |
| [`[email protected]`](https://github.com/JoshGlazebrook/socks.git) | MIT | #13459 |
| [`[email protected]`](git+https://github.com/pinojs/sonic-boom.git) | MIT | clearlydefined |
| [`[email protected]`](git+https://github.com/pinojs/sonic-boom.git) | MIT | clearlydefined |
Expand Down
4 changes: 2 additions & 2 deletions build/dockerfiles/brew.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Red Hat, Inc. - initial API and implementation

# https://registry.access.redhat.com/ubi8/nodejs-18
FROM ubi8/nodejs-18:1-133.1732637110 as builder
FROM ubi8/nodejs-18:1-135 as builder
# hadolint ignore=DL3002
USER 0
RUN dnf -y -q update --exclude=unbound-libs
Expand Down Expand Up @@ -40,7 +40,7 @@ RUN yarn build
# RUN rm -rf $REMOTE_SOURCES_DIR

# https://registry.access.redhat.com/ubi8/nodejs-18
FROM ubi8/nodejs-18:1-133.1732637110
FROM ubi8/nodejs-18:1-135
# hadolint ignore=DL3002
USER 0
# hadolint ignore=DL4006
Expand Down
4 changes: 2 additions & 2 deletions build/dockerfiles/rhel.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Red Hat, Inc. - initial API and implementation

# https://registry.access.redhat.com/ubi8/nodejs-18
FROM registry.access.redhat.com/ubi8/nodejs-18:1-135 as builder
FROM registry.access.redhat.com/ubi8/nodejs-18:1-135.1735831624 as builder
# hadolint ignore=DL3002
USER 0
RUN dnf -y -q update --exclude=unbound-libs
Expand All @@ -20,7 +20,7 @@ RUN npm i -g yarn; yarn install
RUN yarn build

# https://registry.access.redhat.com/ubi8/nodejs-18
FROM registry.access.redhat.com/ubi8/nodejs-18:1-135
FROM registry.access.redhat.com/ubi8/nodejs-18:1-135.1735831624
# hadolint ignore=DL3002
USER 0
# hadolint ignore=DL4006
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eclipse-che/dashboard",
"version": "7.97.0-next",
"version": "7.98.0-next",
"description": "Dashboard for Eclipse Che",
"private": true,
"workspaces": {
Expand Down
3 changes: 2 additions & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "@eclipse-che/common",
"version": "7.97.0-next",
"version": "7.98.0-next",
"repository": "https://github.com/eclipse-che/che-dashboard",
"license": "EPL-2.0",
"private": true,
"main": "lib/index.js",
"scripts": {
"build": "yarn clean && tsc -b",
"build:dev": "yarn build",
"watch": "yarn build && tsc -w",
"clean": "rimraf lib tsconfig.tsbuildinfo",
"format:check": "yarn prettier --config .prettierrc --check src/",
Expand Down
2 changes: 1 addition & 1 deletion packages/dashboard-backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eclipse-che/dashboard-backend",
"version": "7.97.0-next",
"version": "7.98.0-next",
"description": "Dashboard backend for Eclipse Che",
"scripts": {
"build": "webpack --color --config webpack.config.prod.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/dashboard-frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eclipse-che/dashboard-frontend",
"version": "7.97.0-next",
"version": "7.98.0-next",
"description": "Dashboard frontend for Eclipse Che",
"private": true,
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ describe('Creating steps, applying a devfile', () => {
expect(prepareDevfile).toHaveBeenCalledWith(
expect.objectContaining({
attributes: {
'controller.devfile.io/bootstrap-devworkspace': true,
defaultDevfile: true,
},
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { ProgressStepTitle } from '@/components/WorkspaceProgress/StepTitle';
import { TimeLimit } from '@/components/WorkspaceProgress/TimeLimit';
import { lazyInject } from '@/inversify.config';
import devfileApi from '@/services/devfileApi';
import { FactoryLocationAdapter } from '@/services/factory-location-adapter';
import {
buildFactoryParams,
FactoryParams,
Expand Down Expand Up @@ -181,14 +180,12 @@ class CreatingStepApplyDevfile extends ProgressStep<Props, State> {

// when using the default devfile instead of a user devfile
if (factoryResolver === undefined && isEqual(devfile, defaultDevfile)) {
if (FactoryLocationAdapter.isSshLocation(factoryParams.sourceUrl)) {
if (!devfile.attributes) {
devfile.attributes = {};
}

devfile.attributes['controller.devfile.io/bootstrap-devworkspace'] = true;
if (!devfile.attributes) {
devfile.attributes = {};
}

devfile.attributes['controller.devfile.io/bootstrap-devworkspace'] = true;

if (devfile.projects === undefined) {
devfile.projects = [];
}
Expand All @@ -203,13 +200,11 @@ class CreatingStepApplyDevfile extends ProgressStep<Props, State> {
}
}
} else if (factoryResolver?.source === 'repo') {
if (FactoryLocationAdapter.isSshLocation(factoryParams.sourceUrl)) {
if (!devfile.attributes) {
devfile.attributes = {};
}

devfile.attributes['controller.devfile.io/bootstrap-devworkspace'] = true;
if (!devfile.attributes) {
devfile.attributes = {};
}

devfile.attributes['controller.devfile.io/bootstrap-devworkspace'] = true;
}

if (remotes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */

import { FACTORY_LINK_ATTR } from '@eclipse-che/common';
import { AlertVariant } from '@patternfly/react-core';
import { cleanup, screen, waitFor } from '@testing-library/react';
import userEvent, { UserEvent } from '@testing-library/user-event';
import React from 'react';
Expand Down Expand Up @@ -346,7 +345,7 @@ describe('Creating steps, fetching a devfile', () => {
});
});

describe('unsupported git provider error', () => {
describe('unsupported git provider', () => {
let emptyStore: Store;
const rejectReason = 'Failed to fetch devfile';

Expand All @@ -355,110 +354,13 @@ describe('Creating steps, fetching a devfile', () => {
mockRequestFactoryResolver.mockRejectedValueOnce(rejectReason);
});

test('alert title', async () => {
test('should continue with the default devfile', async () => {
renderComponent(emptyStore, searchParams);

await jest.advanceTimersByTimeAsync(MIN_STEP_DURATION_MS);

const expectAlertItem = expect.objectContaining({
title: 'Warning',
actionCallbacks: [
expect.objectContaining({
title: 'Continue with default devfile',
callback: expect.any(Function),
}),
expect.objectContaining({
title: 'Reload',
callback: expect.any(Function),
}),
],
});
await waitFor(() => expect(mockOnError).toHaveBeenCalledWith(expectAlertItem));

expect(mockOnNextStep).not.toHaveBeenCalled();
});

test('action "Continue with default devfile"', async () => {
// this deferred object will help run the callback at the right time
const deferred = getDefer();

const actionTitle = 'Continue with default devfile';
mockOnError.mockImplementationOnce((alertItem: AlertItem) => {
const action = alertItem.actionCallbacks?.find(_action =>
_action.title.startsWith(actionTitle),
);
expect(action).toBeDefined();

if (action) {
deferred.promise.then(action.callback);
} else {
throw new Error('Action not found');
}
});

renderComponent(emptyStore, searchParams);
await jest.runAllTimersAsync();

await waitFor(() => expect(mockOnError).toHaveBeenCalled());
expect(mockOnRestart).not.toHaveBeenCalled();
expect(mockOnNextStep).not.toHaveBeenCalled();

mockOnError.mockClear();

/* test the action */
await jest.runOnlyPendingTimersAsync();

// resolve deferred to trigger the callback
deferred.resolve();

await waitFor(() => expect(mockOnNextStep).toHaveBeenCalled());
expect(mockOnRestart).not.toHaveBeenCalled();
expect(mockOnError).not.toHaveBeenCalled();
});

test('action "Reload"', async () => {
// this deferred object will help run the callback at the right time
const deferred = getDefer();

const actionTitle = 'Reload';
mockOnError.mockImplementationOnce(async (alertItem: AlertItem) => {
const action = alertItem.actionCallbacks?.find(_action =>
_action.title.startsWith(actionTitle),
);
expect(action).toBeDefined();

if (action) {
deferred.promise.then(action.callback);
} else {
throw new Error('Action not found');
}
});

renderComponent(emptyStore, searchParams);
await jest.runAllTimersAsync();

await waitFor(() => expect(mockOnError).toHaveBeenCalled());
expect(mockOnRestart).not.toHaveBeenCalled();
expect(mockOnNextStep).not.toHaveBeenCalled();

// first call resolves with error
expect(mockRequestFactoryResolver).toHaveBeenCalledTimes(1);

mockOnError.mockClear();

/* test the action */

await jest.runAllTimersAsync();

// resolve deferred to trigger the callback
deferred.resolve();

await waitFor(() => expect(mockOnRestart).toHaveBeenCalled());
expect(mockOnNextStep).not.toHaveBeenCalled();
expect(mockOnError).not.toHaveBeenCalled();

// should request the factory resolver for the second time
await waitFor(() => expect(mockRequestFactoryResolver).toHaveBeenCalledTimes(2));
await waitFor(() => expect(mockOnError).not.toHaveBeenCalled());
expect(mockOnNextStep).toHaveBeenCalled();
});
});

Expand Down Expand Up @@ -695,31 +597,6 @@ describe('Creating steps, fetching a devfile', () => {
const protocol = 'http://';
const factoryUrl = '[email protected]:user/repository-name.git';
const emptyStore = new MockStoreBuilder().build();
const sshPrivateRepoAllertItem = expect.objectContaining({
title: 'Warning',
variant: AlertVariant.warning,
children: (
<ExpandableWarning
textBefore="Devfile resolve from a privatre repositry via an SSH url is not supported."
errorMessage="Could not reach devfile"
textAfter="Apply a Personal Access Token to fetch the devfile.yaml content."
/>
),
actionCallbacks: [
expect.objectContaining({
title: 'Continue with default devfile',
callback: expect.any(Function),
}),
expect.objectContaining({
title: 'Reload',
callback: expect.any(Function),
}),
expect.objectContaining({
title: 'Open Documentation page',
callback: expect.any(Function),
}),
],
});

let spyWindowLocation: jest.SpyInstance;
let location: Location;
Expand Down Expand Up @@ -771,32 +648,32 @@ describe('Creating steps, fetching a devfile', () => {
expect(mockOnError).not.toHaveBeenCalled();
});

it('should show warning on SSH url', async () => {
it('should use default devfile on private SSH url', async () => {
searchParams = new URLSearchParams({
[FACTORY_URL_ATTR]: '[email protected]:user/repository.git',
});

renderComponent(emptyStore, searchParams, location);

await jest.advanceTimersByTimeAsync(MIN_STEP_DURATION_MS);
await waitFor(() => expect(mockOnNextStep).not.toHaveBeenCalled);
await waitFor(() => expect(mockOnNextStep).toHaveBeenCalled());

expect(mockOpenOAuthPage).not.toHaveBeenCalled();
expect(mockOnError).toHaveBeenCalledWith(sshPrivateRepoAllertItem);
expect(mockOnError).not.toHaveBeenCalled();
});

it('should show warning on bitbucket-server SSH url', async () => {
it('should use default devfile on bitbucket-server SSH url', async () => {
searchParams = new URLSearchParams({
[FACTORY_URL_ATTR]: 'ssh://[email protected]/~user/repository.git',
});

renderComponent(emptyStore, searchParams, location);

await jest.advanceTimersByTimeAsync(MIN_STEP_DURATION_MS);
await waitFor(() => expect(mockOnNextStep).not.toHaveBeenCalled);
await waitFor(() => expect(mockOnNextStep).toHaveBeenCalled);

expect(mockOpenOAuthPage).not.toHaveBeenCalled();
expect(mockOnError).toHaveBeenCalledWith(sshPrivateRepoAllertItem);
expect(mockOnError).not.toHaveBeenCalled();
});
});
});
Expand Down
Loading

0 comments on commit ed0f66a

Please sign in to comment.