From b3201ef61c8464fd61b751a75b231cba7345a342 Mon Sep 17 00:00:00 2001 From: Igor Vinokur Date: Wed, 13 Nov 2024 11:49:04 +0200 Subject: [PATCH] Do not skip SSH urls from resolving devfile (#1252) Revert the condition that does not allow to resolve devfile for SSH factory urls. --- .../Fetch/Devfile/__tests__/index.spec.tsx | 33 +++++++++---------- .../CreatingSteps/Fetch/Devfile/index.tsx | 11 +------ 2 files changed, 16 insertions(+), 28 deletions(-) diff --git a/packages/dashboard-frontend/src/components/WorkspaceProgress/CreatingSteps/Fetch/Devfile/__tests__/index.spec.tsx b/packages/dashboard-frontend/src/components/WorkspaceProgress/CreatingSteps/Fetch/Devfile/__tests__/index.spec.tsx index 9dc15969f..80322531a 100644 --- a/packages/dashboard-frontend/src/components/WorkspaceProgress/CreatingSteps/Fetch/Devfile/__tests__/index.spec.tsx +++ b/packages/dashboard-frontend/src/components/WorkspaceProgress/CreatingSteps/Fetch/Devfile/__tests__/index.spec.tsx @@ -114,21 +114,6 @@ describe('Creating steps, fetching a devfile', () => { jest.useRealTimers(); }); - test('factory should not resolve the SSH location', async () => { - const searchParams = new URLSearchParams({ - [FACTORY_URL_ATTR]: 'git@github.com:eclipse-che/che-dashboard.git', - }); - - renderComponent(store, searchParams); - - await jest.advanceTimersByTimeAsync(MIN_STEP_DURATION_MS); - - await waitFor(() => expect(mockOnNextStep).toHaveBeenCalled()); - expect(mockOnError).not.toHaveBeenCalled(); - expect(mockOnRestart).not.toHaveBeenCalled(); - expect(mockRequestFactoryResolver).not.toHaveBeenCalled(); - }); - test('devfile is already resolved', async () => { renderComponent(store, searchParams); @@ -734,9 +719,21 @@ describe('Creating steps, fetching a devfile', () => { }); it('should go to next step', async () => { - const emptyStore = new FakeStoreBuilder().build(); - - renderComponent(emptyStore, searchParams, location); + const nextStore = new FakeStoreBuilder() + .withFactoryResolver({ + resolver: { + location: factoryUrl, + devfile: { + schemaVersion: '2.3.0', + metadata: { + name: 'my-project', + namespace: 'user-che', + }, + }, + }, + }) + .build(); + renderComponent(nextStore, searchParams, location); await jest.advanceTimersByTimeAsync(MIN_STEP_DURATION_MS); diff --git a/packages/dashboard-frontend/src/components/WorkspaceProgress/CreatingSteps/Fetch/Devfile/index.tsx b/packages/dashboard-frontend/src/components/WorkspaceProgress/CreatingSteps/Fetch/Devfile/index.tsx index bb5427b88..ba7daa719 100644 --- a/packages/dashboard-frontend/src/components/WorkspaceProgress/CreatingSteps/Fetch/Devfile/index.tsx +++ b/packages/dashboard-frontend/src/components/WorkspaceProgress/CreatingSteps/Fetch/Devfile/index.tsx @@ -26,7 +26,6 @@ import { } from '@/components/WorkspaceProgress/ProgressStep'; import { ProgressStepTitle } from '@/components/WorkspaceProgress/StepTitle'; import { TimeLimit } from '@/components/WorkspaceProgress/TimeLimit'; -import { FactoryLocationAdapter } from '@/services/factory-location-adapter'; import { buildFactoryParams, FactoryParams, @@ -75,9 +74,7 @@ class CreatingStepFetchDevfile extends ProgressStep { super(props); const factoryParams = buildFactoryParams(props.searchParams); - const name = FactoryLocationAdapter.isHttpLocation(factoryParams.sourceUrl) - ? `Inspecting repo ${factoryParams.sourceUrl} for a devfile` - : 'Applying default devfile'; + const name = `Inspecting repo ${factoryParams.sourceUrl} for a devfile`; this.state = { factoryParams, @@ -209,12 +206,6 @@ class CreatingStepFetchDevfile extends ProgressStep { return true; } - // do not resolve a devfile if git+SSH URL is provided - if (FactoryLocationAdapter.isSshLocation(sourceUrl)) { - this.handleDefaultDevfile(''); - return true; - } - let resolveDone = false; try { // start resolving the devfile