warn in backend when scaffolding old templates
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -20,6 +20,7 @@ import {
|
||||
UrlReader,
|
||||
} from '@backstage/backend-common';
|
||||
import { CatalogApi } from '@backstage/catalog-client';
|
||||
import { stringifyEntityRef } from '@backstage/catalog-model';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { Config } from '@backstage/config';
|
||||
import { InputError, NotFoundError } from '@backstage/errors';
|
||||
@@ -193,9 +194,18 @@ export async function createRouter(
|
||||
let taskSpec: TaskSpec;
|
||||
|
||||
if (isSupportedTemplate(template)) {
|
||||
if (template.apiVersion === 'backstage.io/v1beta2') {
|
||||
logger.warn(
|
||||
`Scaffolding ${stringifyEntityRef(
|
||||
template,
|
||||
)} with deprecated apiVersion ${
|
||||
template.apiVersion
|
||||
}. Please migrate the template to backstage.io/v1beta3. https://backstage.io/docs/features/software-templates/migrating-from-v1beta2-to-v1beta3`,
|
||||
);
|
||||
}
|
||||
|
||||
for (const parameters of [template.spec.parameters ?? []].flat()) {
|
||||
const result = validate(values, parameters);
|
||||
|
||||
if (!result.valid) {
|
||||
res.status(400).json({ errors: result.errors });
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user