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

chore: Get rid of pluginRegistryURL #1158

Merged
merged 1 commit into from
Aug 7, 2024
Merged
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
2 changes: 0 additions & 2 deletions packages/common/src/dto/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,6 @@ export interface IServerConfig {
cheNamespace: string;
pluginRegistryURL: string;
pluginRegistryInternalURL: string;
devfileRegistryURL: string;
devfileRegistryInternalURL: string;
dashboardLogo?: { base64data: string; mediatype: string };
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,6 @@ describe('Server Config API Service', () => {
expect(res).toEqual('http://plugin-registry.eclipse-che.svc/v3');
});

test('getting default devfile registry URL', () => {
const res = serverConfigService.getDefaultDevfileRegistryUrl(buildCustomResource());
expect(res).toEqual('http://devfile-registry.eclipse-che.svc/devfile-registry/');
});

test('getting autoProvision value', () => {
const res = serverConfigService.getAutoProvision(buildCustomResource());
expect(res).toBeTruthy();
Expand Down Expand Up @@ -228,7 +223,6 @@ function buildCustomResource(options?: { openVSXURL?: string }): CheClusterCusto
},
},
status: {
devfileRegistryURL: 'http://devfile-registry.eclipse-che.svc/devfile-registry',
pluginRegistryURL: 'http://plugin-registry.eclipse-che.svc/v3',
},
} as CheClusterCustomResource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,6 @@ export class ServerConfigApiService implements IServerConfigApi {
return cheCustomResource.spec.devEnvironments?.defaultPlugins || [];
}

getDefaultDevfileRegistryUrl(cheCustomResource: CheClusterCustomResource): string {
let devfileRegistryURL = cheCustomResource.status?.devfileRegistryURL || '';
if (devfileRegistryURL && !devfileRegistryURL.endsWith('/')) {
devfileRegistryURL += '/';
}

return devfileRegistryURL;
}

getDefaultPluginRegistryUrl(cheCustomResource: CheClusterCustomResource): string {
return cheCustomResource.status?.pluginRegistryURL || '';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ export type CheClusterCustomResource = k8s.V1CustomResourceDefinition & {
};
};
status: {
devfileRegistryURL: string;
pluginRegistryURL: string;
};
};
Expand Down Expand Up @@ -264,10 +263,6 @@ export interface IServerConfigApi {
* Returns default plugins
*/
getDefaultPlugins(cheCustomResource: CheClusterCustomResource): api.IWorkspacesDefaultPlugins[];
/**
* Returns the default devfile registry URL.
*/
getDefaultDevfileRegistryUrl(cheCustomResource: CheClusterCustomResource): string;
/**
* Returns the plugin registry URL.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ jest.mock('../helpers/getServiceAccountToken.ts');
describe('Server Config Route', () => {
let app: FastifyInstance;
const pluginRegistryInternalURL = 'http://plugin-registry.internal';
const devfileRegistryInternalURL = 'http://devfile-registry.internal';

beforeAll(async () => {
const env = {
CHE_WORKSPACE_PLUGIN__REGISTRY__INTERNAL__URL: pluginRegistryInternalURL,
CHE_WORKSPACE_DEVFILE__REGISTRY__INTERNAL__URL: devfileRegistryInternalURL,
};
app = await setup({ env });
});
Expand All @@ -47,8 +45,6 @@ describe('Server Config Route', () => {
defaults: { components: [], plugins: [], pvcStrategy: '' },
pluginRegistry: { openVSXURL: 'openvsx-url' },
timeouts: { inactivityTimeout: 0, runTimeout: 0, startTimeout: 0 },
devfileRegistryInternalURL: 'http://devfile-registry.internal',
devfileRegistryURL: 'http://devfile-registry.eclipse-che.svc',
networking: {
auth: {
advancedAuthorization: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export const stubAllWorkspacesLimit = 1;
export const stubWorkspaceInactivityTimeout = 0;
export const stubWorkspaceRunTimeout = 0;
export const stubWorkspaceStartupTimeout = 0;
export const defaultDevfileRegistryUrl = 'http://devfile-registry.eclipse-che.svc';
export const defaultPluginRegistryUrl = 'http://plugin-registry.eclipse-che.svc/v3';
export const internalRegistryDisableStatus = true;
export const externalDevfileRegistries = [{ url: 'https://devfile.registry.test.org/' }];
Expand Down Expand Up @@ -171,7 +170,6 @@ export const getDevWorkspaceClient = jest.fn(
getWorkspaceInactivityTimeout: _cheCustomResource => stubWorkspaceInactivityTimeout,
getWorkspaceRunTimeout: _cheCustomResource => stubWorkspaceRunTimeout,
getWorkspaceStartTimeout: _cheCustomResource => stubWorkspaceStartupTimeout,
getDefaultDevfileRegistryUrl: _cheCustomResource => defaultDevfileRegistryUrl,
getDefaultPluginRegistryUrl: _cheCustomResource => defaultPluginRegistryUrl,
getExternalDevfileRegistries: _cheCustomResource => externalDevfileRegistries,
getInternalRegistryDisableStatus: _cheCustomResource => internalRegistryDisableStatus,
Expand Down
5 changes: 0 additions & 5 deletions packages/dashboard-backend/src/routes/api/serverConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ const tags = ['Server Config'];
export function registerServerConfigRoute(instance: FastifyInstance) {
const cheNamespace = process.env.CHECLUSTER_CR_NAMESPACE as string;
const pluginRegistryInternalURL = process.env.CHE_WORKSPACE_PLUGIN__REGISTRY__INTERNAL__URL || '';
const devfileRegistryInternalURL =
process.env.CHE_WORKSPACE_DEVFILE__REGISTRY__INTERNAL__URL || '';

instance.register(async server => {
server.get(`${baseApiPath}/server-config`, getSchema({ tags }), async function () {
Expand All @@ -42,7 +40,6 @@ export function registerServerConfigRoute(instance: FastifyInstance) {
const pluginRegistry = serverConfigApi.getPluginRegistry(cheCustomResource);
const pvcStrategy = serverConfigApi.getPvcStrategy(cheCustomResource);
const pluginRegistryURL = serverConfigApi.getDefaultPluginRegistryUrl(cheCustomResource);
const devfileRegistryURL = serverConfigApi.getDefaultDevfileRegistryUrl(cheCustomResource);
const externalDevfileRegistries =
serverConfigApi.getExternalDevfileRegistries(cheCustomResource);
const disableInternalRegistry =
Expand Down Expand Up @@ -75,8 +72,6 @@ export function registerServerConfigRoute(instance: FastifyInstance) {
cheNamespace,
pluginRegistryURL,
pluginRegistryInternalURL,
devfileRegistryURL,
devfileRegistryInternalURL,
};

if (dashboardLogo !== undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ const serverConfig: api.IServerConfig = {
disableInternalRegistry: false,
externalDevfileRegistries: [],
},
devfileRegistryURL: '',
devfileRegistryInternalURL: '',
pluginRegistryURL: '',
pluginRegistryInternalURL: '',
};
Expand Down
9 changes: 0 additions & 9 deletions packages/dashboard-frontend/src/services/bootstrap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,19 +333,10 @@ export default class Bootstrap {

const serverConfig = this.store.getState().dwServerConfig.config;
const devfileRegistry = serverConfig.devfileRegistry;
const internalDevfileRegistryUrl = serverConfig.devfileRegistryURL;
if (
devfileRegistry?.disableInternalRegistry !== undefined &&
devfileRegistry?.disableInternalRegistry !== true
) {
if (internalDevfileRegistryUrl) {
await requestRegistriesMetadata(internalDevfileRegistryUrl, false)(
this.store.dispatch,
this.store.getState,
undefined,
);
}

const airGapedSampleURL = new URL('/dashboard/api/airgap-sample', window.location.origin)
.href;
await requestRegistriesMetadata(airGapedSampleURL, false)(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ import { DEFAULT_REGISTRY } from '@/store/DevfileRegistries';
import { isDevfileRegistryLocation } from '@/store/FactoryResolver/helpers';

describe('isDevfileRegistryLocation', () => {
const devfileRegistryURL = 'https://devfile-registry.dev';
const externalDevfileRegistryURL = 'https://external-devfile-registry.dev';
const config = {
devfileRegistryURL,
devfileRegistry: {
externalDevfileRegistries: [
{
Expand All @@ -34,11 +32,6 @@ describe('isDevfileRegistryLocation', () => {
expect(isDevfileRegistryLocation(location, config)).toBe(true);
});

test('devfile registry', () => {
const location = `${devfileRegistryURL}/devfiles/devfile.yaml`;
expect(isDevfileRegistryLocation(location, config)).toBe(true);
});

test('external registry', () => {
const location = `${externalDevfileRegistryURL}/devfiles/devfile.yaml`;
expect(isDevfileRegistryLocation(location, config)).toBe(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ export async function grabLink(
export function isDevfileRegistryLocation(location: string, config: api.IServerConfig): boolean {
const devfileRegistries = [`${window.location.origin}${DEFAULT_REGISTRY}`];

if (config.devfileRegistryURL) {
devfileRegistries.push(config.devfileRegistryURL);
}

const externalDevfileRegistries = config.devfileRegistry.externalDevfileRegistries.map(
externalDevfileRegistry => externalDevfileRegistry.url,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,8 +654,6 @@ describe('dwPlugins store', () => {
disableInternalRegistry: false,
externalDevfileRegistries: [],
},
devfileRegistryURL: '',
devfileRegistryInternalURL: '',
pluginRegistryURL: '',
pluginRegistryInternalURL: '',
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ export const serverConfig: api.IServerConfig = {
disableInternalRegistry: false,
externalDevfileRegistries: [{ url: 'https://devfile.io/' }],
},
devfileRegistryURL: '',
devfileRegistryInternalURL: '',
pluginRegistryURL: 'https://test/plugin-registry/v3',
pluginRegistryInternalURL: 'http://plugin-registry.eclipse-che.svc:8080/v3',
dashboardLogo: {
Expand Down
2 changes: 0 additions & 2 deletions packages/dashboard-frontend/src/store/ServerConfig/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ const unloadedState: State = {
autoProvision: true,
},
cheNamespace: '',
devfileRegistryURL: '',
devfileRegistryInternalURL: '',
pluginRegistryURL: '',
pluginRegistryInternalURL: '',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ export class FakeStoreBuilder {
disableInternalRegistry: false,
externalDevfileRegistries: [],
},
devfileRegistryURL: '',
devfileRegistryInternalURL: '',
pluginRegistryURL: '',
pluginRegistryInternalURL: '',
} as api.IServerConfig,
Expand Down
Loading