Skip to content
Open
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
9291dc1
backend updates for EE definition generation
NilashishC Nov 6, 2025
a8e2339
fix CI
NilashishC Nov 6, 2025
6fb928a
fix tests
NilashishC Nov 6, 2025
ce7dfc5
fix README typo
NilashishC Nov 6, 2025
01987ae
add back tsconfig.json
NilashishC Nov 7, 2025
11a61b5
drop fs-extra as dep
NilashishC Nov 7, 2025
099733b
remove remaining trace of fs-extra
NilashishC Nov 7, 2025
7f6c35a
schema validation for parsed file
NilashishC Nov 7, 2025
0474745
move mcpbuilder logic to a new function
NilashishC Nov 7, 2025
d6c6aff
add zod
NilashishC Nov 7, 2025
749f8d3
use correct var
NilashishC Nov 7, 2025
7b1bac2
Add EE definition schema validation
NilashishC Nov 7, 2025
a35fbca
additional entries in collection schema
NilashishC Nov 10, 2025
c1de0ae
add unit tests for createEEDefinitionAction
NilashishC Nov 10, 2025
ba1d724
Add unit tests for createEETemplateAction
NilashishC Nov 11, 2025
67eef4b
Add tests for createEECatalogInfoAction
NilashishC Nov 11, 2025
9eaf830
Add unit tests for prepareForPublishAction
NilashishC Nov 11, 2025
f28f7e8
Add support view details in catalog link
NilashishC Nov 11, 2025
836c54d
updates
NilashishC Nov 11, 2025
e7bd8b4
address review comments
NilashishC Nov 12, 2025
0b909f8
refactor actions and related tests
NilashishC Nov 13, 2025
f952837
fix generated template
NilashishC Nov 14, 2025
e228ce0
Add tests for new methods in UseCaseMaker
NilashishC Nov 14, 2025
2cf364b
Add new entity provider tests
NilashishC Nov 14, 2025
363bf54
remove stray file
NilashishC Nov 14, 2025
b4d3b66
add tests for the new API endpoint in router.ts
NilashishC Nov 14, 2025
617f27e
update README
NilashishC Nov 14, 2025
23a2a88
remove unused import
NilashishC Nov 14, 2025
0442c89
readme updates
NilashishC Nov 17, 2025
72c7a09
add support for view in catalog button
NilashishC Nov 17, 2025
b9a8349
fix CI
NilashishC Nov 17, 2025
b2ed2ae
update the generated template output as per recent changes
NilashishC Nov 17, 2025
4c115dc
fix README generation
NilashishC Nov 17, 2025
ebc08aa
fix catalog-info path and README
NilashishC Nov 18, 2025
6ad8ef7
support for README retrieval
NilashishC Nov 18, 2025
3071263
fix token passing
NilashishC Nov 18, 2025
e1fcfc4
remove toLower()
NilashishC Nov 18, 2025
043d9cb
add Gitlab support for README pulls and ansible.cfg and mcp_vars scaf…
NilashishC Nov 19, 2025
7582083
improve get_ee_readme implementation and add unit tests
NilashishC Nov 19, 2025
cc32cf8
Fix lint
NilashishC Nov 20, 2025
2cb2751
Add template in catalog descriptor for download experience
NilashishC Nov 20, 2025
06e762f
fixes to generated EE
NilashishC Nov 20, 2025
a155180
update README as per final version
NilashishC Nov 21, 2025
6ea1168
update outputs
NilashishC Nov 21, 2025
ab545f9
add unit tests for fetchReadmeContent
NilashishC Nov 21, 2025
397943a
refactor README fetching code
NilashishC Nov 21, 2025
a2b1f82
support mcp server vars in air-gapped environments
NilashishC Nov 21, 2025
dca7f73
Merge branch 'main' into ee_builder
abhikdps Nov 24, 2025
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
3 changes: 2 additions & 1 deletion plugins/catalog-backend-module-rhaap/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export const catalogModuleRhaap = createBackendModule({
scheduler: coreServices.scheduler,
ansibleService: ansibleServiceRef,
httpRouter: coreServices.httpRouter,
discovery: coreServices.discovery,
auth: coreServices.auth,
},
async init({
logger,
Expand Down Expand Up @@ -56,7 +58,6 @@ export const catalogModuleRhaap = createBackendModule({
scheduler,
},
);

const jobTemplateProvider = AAPJobTemplateProvider.fromConfig(
config,
ansibleService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,160 @@ describe('AAPEntityProvider', () => {
});
});

describe('registerExecutionEnvironment', () => {
let provider: AAPEntityProvider;
let mockConnection: EntityProviderConnection;
let logger: ReturnType<typeof mockServices.logger.mock>;
let executionEnvironmentEntity: any;

beforeEach(() => {
const config = new ConfigReader(MOCK_CONFIG.data);
logger = mockServices.logger.mock();
const schedule = new PersistingTaskRunner();
executionEnvironmentEntity = {
apiVersion: 'backstage.io/v1alpha1',
kind: 'Component',
metadata: {
name: 'test-ee',
title: 'test-ee',
description: 'test-ee',
tags: ['test-ee'],
annotations: {
'backstage.io/managed-by-location': `url:127.0.0.1`,
'backstage.io/managed-by-origin-location': `url:127.0.0.1`,
'ansible.io/download-experience': 'true',
},
},
spec: {
type: 'execution-environment',
lifecycle: 'production',
owner: 'team-a',
definition: 'sample \ntest-ee \ndefinition',
readme: 'sample \ntest-ee \nreadme',
},
};

provider = AAPEntityProvider.fromConfig(config, mockAnsibleService, {
schedule,
logger,
})[0];

mockConnection = {
applyMutation: jest.fn().mockResolvedValue(undefined),
refresh: jest.fn(),
};

provider.connect(mockConnection);
});

it('should successfully register an execution environment entity', async () => {
await provider.registerExecutionEnvironment(executionEnvironmentEntity);

expect(mockConnection.applyMutation).toHaveBeenCalledWith({
type: 'delta',
added: [
{
entity: executionEnvironmentEntity,
locationKey: 'AapEntityProvider:development',
},
],
removed: [],
});
});

it('should raise error if entity has missing metadata name', async () => {
// remove metadata.name from executionEnvironmentEntity
delete executionEnvironmentEntity.metadata.name;
await expect(
provider.registerExecutionEnvironment(executionEnvironmentEntity),
).rejects.toThrow(
'Name [metadata.name] is required for Execution Environment registration',
);
});

it('should raise error if EEentity has no type', async () => {
// remove metadata.name from executionEnvironmentEntity
delete executionEnvironmentEntity.spec.type;
await expect(
provider.registerExecutionEnvironment(executionEnvironmentEntity),
).rejects.toThrow(
'Type [spec.type] must be "execution-environment" for Execution Environment registration',
);
});

it('should raise error if EEentity has incorrect type', async () => {
// remove metadata.name from executionEnvironmentEntity
executionEnvironmentEntity.spec.type = 'not-an-execution-environment';
await expect(
provider.registerExecutionEnvironment(executionEnvironmentEntity),
).rejects.toThrow(
'Type [spec.type] must be "execution-environment" for Execution Environment registration',
);
});

it('should throw error when connection is not initialized', async () => {
const uninitializedProvider = AAPEntityProvider.fromConfig(
new ConfigReader(MOCK_CONFIG.data),
mockAnsibleService,
{
schedule: new PersistingTaskRunner(),
logger: mockServices.logger.mock(),
},
)[0];
await expect(
uninitializedProvider.registerExecutionEnvironment(
executionEnvironmentEntity,
),
).rejects.toThrow('AAPEntityProvider is not connected yet');
});

it('should register entity with correct locationKey', async () => {
await provider.registerExecutionEnvironment(executionEnvironmentEntity);

expect(mockConnection.applyMutation).toHaveBeenCalledWith(
expect.objectContaining({
added: expect.arrayContaining([
expect.objectContaining({
locationKey: 'AapEntityProvider:development',
}),
]),
}),
);
});

it('should register multiple entities independently', async () => {
const entity1 = JSON.parse(JSON.stringify(executionEnvironmentEntity));
const entity2 = JSON.parse(JSON.stringify(executionEnvironmentEntity));
entity1.metadata.name = 'entity1';
entity2.metadata.name = 'entity2';

await provider.registerExecutionEnvironment(entity1);
await provider.registerExecutionEnvironment(entity2);

expect(mockConnection.applyMutation).toHaveBeenCalledTimes(2);
expect(mockConnection.applyMutation).toHaveBeenNthCalledWith(1, {
type: 'delta',
added: [
{
entity: entity1,
locationKey: 'AapEntityProvider:development',
},
],
removed: [],
});
expect(mockConnection.applyMutation).toHaveBeenNthCalledWith(2, {
type: 'delta',
added: [
{
entity: entity2,
locationKey: 'AapEntityProvider:development',
},
],
removed: [],
});
});
});

it('handles errors gracefully', async () => {
const config = new ConfigReader(MOCK_CONFIG.data);
const logger = mockServices.logger.mock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,4 +627,35 @@ export class AAPEntityProvider implements EntityProvider {

// Note: Admin access is now handled via dynamic aap-admins group membership
// No separate API-based assignment needed

async registerExecutionEnvironment(entity: any): Promise<void> {
if (!this.connection) {
throw new Error('AAPEntityProvider is not connected yet');
}

if (!entity.metadata?.name) {
throw new Error(
'Name [metadata.name] is required for Execution Environment registration',
);
}

if (!entity.spec?.type || entity.spec.type !== 'execution-environment') {
throw new Error(
'Type [spec.type] must be "execution-environment" for Execution Environment registration',
);
}

this.logger.info(`Registering entity ${entity.metadata?.name}`);

await this.connection.applyMutation({
type: 'delta',
added: [
{
entity,
locationKey: this.getProviderName(),
},
],
removed: [],
});
}
}
Loading
Loading