Skip to content

Commit

Permalink
Do not skip SSH urls from resolving devfile (#1252)
Browse files Browse the repository at this point in the history
Revert the condition that does not allow to resolve devfile for SSH factory urls.
  • Loading branch information
vinokurig authored Nov 13, 2024
1 parent 561fad8 commit b3201ef
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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]: '[email protected]: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);

Expand Down Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -75,9 +74,7 @@ class CreatingStepFetchDevfile extends ProgressStep<Props, State> {
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,
Expand Down Expand Up @@ -209,12 +206,6 @@ class CreatingStepFetchDevfile extends ProgressStep<Props, State> {
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
Expand Down

0 comments on commit b3201ef

Please sign in to comment.