Use the new catalogInfoUrl in TemplatePage

This commit is contained in:
Mattias Frinnström
2020-11-19 13:52:21 +01:00
parent 67b6320e83
commit a13a090de9
2 changed files with 4 additions and 11 deletions
@@ -106,18 +106,10 @@ export const TemplatePage = () => {
);
const handleCreateComplete = async (job: Job) => {
const target = job.metadata.remoteUrl?.replace(
/\.git$/,
// TODO(Rugvip): This is not the location we want. As part of scaffolder v2 we
// want this to be more flexible, but before that we might want
// to update all templates to use catalog-info.yaml instead.
'/blob/master/component-info.yaml',
);
if (!target) {
if (!job.metadata.catalogInfoUrl) {
errorApi.post(
new Error(
`Failed to find component-info.yaml file in ${job.metadata.remoteUrl}.`,
`Failed to find catalog-info.yaml file in ${job.metadata.remoteUrl}.`,
),
);
return;
@@ -125,7 +117,7 @@ export const TemplatePage = () => {
const {
entities: [createdEntity],
} = await catalogApi.addLocation({ target });
} = await catalogApi.addLocation({ target: job.metadata.catalogInfoUrl });
setEntity((createdEntity as any) as TemplateEntityV1alpha1);
};
+1
View File
@@ -19,6 +19,7 @@ export type Job = {
entity: any;
values: any;
remoteUrl?: string;
catalogInfoUrl?: string;
};
status: 'PENDING' | 'STARTED' | 'COMPLETED' | 'FAILED';
stages: Stage[];