catalog,register-component: always register locations using a 'url' type

This commit is contained in:
Patrik Oldsberg
2020-10-28 14:37:21 +01:00
parent b89c676dbc
commit 8b9c8196f1
9 changed files with 39 additions and 55 deletions
@@ -108,12 +108,15 @@ export const TemplatePage = () => {
);
const handleCreateComplete = async (job: Job) => {
const componentYaml = job.metadata.remoteUrl?.replace(
const target = job.metadata.remoteUrl?.replace(
/\.git$/,
// TODO(Rugvip): This is not the location we want. As part of scaffodler 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 (!componentYaml) {
if (!target) {
errorApi.post(
new Error(
`Failed to find component-info.yaml file in ${job.metadata.remoteUrl}.`,
@@ -124,7 +127,7 @@ export const TemplatePage = () => {
const {
entities: [createdEntity],
} = await catalogApi.addLocation('github', componentYaml);
} = await catalogApi.addLocation({ target });
setEntity((createdEntity as any) as TemplateEntityV1alpha1);
};