Skip to content

Commit ab94108

Browse files
NoeSamailleGitHub Enterprise
authored andcommitted
Merge pull request #21 from gsi-labs/patch/solution-builder
Terraform build more flexible
2 parents b592a75 + 8af43a4 commit ab94108

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

src/helpers/services.helper.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ export class ServicesHelper {
285285
delete yamlBom.spec.modules;
286286
const arch: Architectures = new Architectures({
287287
arch_id: bom.metadata.name,
288-
name: bom.metadata.annotations?.displayName ?? bom.metadata.name,
288+
name: `${bom.metadata.labels?.code ? `${bom.metadata.labels?.code} - `: ''}${bom.metadata.annotations?.displayName ?? bom.metadata.name}`,
289289
short_desc: bom.metadata.annotations?.description ?? `${bom.metadata.name} Bill of Materials.`,
290290
long_desc: bom.metadata.annotations?.description ?? `${bom.metadata.name} Bill of Materials.`,
291291
public: publicArch,
@@ -295,21 +295,22 @@ export class ServicesHelper {
295295
const bomYaml = yaml.load(yamlString);
296296
const boms: Bom[] = [];
297297
const bomModules: BomModule[] = bomYaml.spec.modules;
298-
const catalog = await this.getCatalog();
298+
// const catalog = await this.getCatalog();
299299
for (const m of bom.spec.modules) {
300300
if (typeof m === 'string') throw new Error('BOM modules must not be of type string.');
301-
const bomModule = bomModules.find(m2 => m2.name === m.name);
302-
try {
303-
await this.moduleSelector.validateBillOfMaterialModuleConfigYaml(catalog, m.name ?? '', yaml.dump(bomModule));
304-
} catch (error) {
305-
console.log(error);
306-
throw { message: `Module ${m.name} yaml config validation failed.`, details: error };
307-
}
301+
const bomModule = bomModules.find(m2 => m.alias ? m2.alias === m.alias : !m2.alias && (m2.name === m.name));
302+
// Skip yaml var validation for now
303+
// try {
304+
// await this.moduleSelector.validateBillOfMaterialModuleConfigYaml(catalog, m.name ?? '', yaml.dump(bomModule));
305+
// } catch (error) {
306+
// console.log(error);
307+
// throw { message: `Module ${m.name} yaml config validation failed.`, details: error };
308+
// }
308309
boms.push(new Bom({
309310
arch_id: arch.arch_id,
310311
service_id: m.name,
311312
desc: m.alias ?? m.name,
312-
yaml: yaml.dump(bomModules.find(m2 => m2.name === m.name))
313+
yaml: yaml.dump(bomModule)
313314
}));
314315
}
315316
return { arch: arch, boms: boms };
@@ -442,6 +443,7 @@ export class ServicesHelper {
442443
}
443444
} else {
444445
if (file.type === 'terraform') {
446+
if (file.name?.endsWith('.tfvars')) file.name = file.name.replace('terraform', `${bom.metadata.name}.auto`);
445447
file.name = `terraform/${file.name}`;
446448
}
447449
try {

0 commit comments

Comments
 (0)