techdocs: Add JSON Schema config
Show better error if techdocs.builder is set to 'ci' and if no docs are found. Return 404 from googleStorage client when a file is not found.
This commit is contained in:
@@ -68,11 +68,56 @@
|
||||
"visibility": "frontend"
|
||||
},
|
||||
"storageUrl": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"visibility": "backend"
|
||||
},
|
||||
"generators": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"techdocs": {
|
||||
"type": "string",
|
||||
"visibility": "backend"
|
||||
}
|
||||
}
|
||||
},
|
||||
"builder": {
|
||||
"type": "string",
|
||||
"visibility": "frontend"
|
||||
},
|
||||
"publisher": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"visibility": "backend"
|
||||
},
|
||||
"google": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"pathToKey": {
|
||||
"type": "string",
|
||||
"visibility": "secret"
|
||||
},
|
||||
"projectId": {
|
||||
"type": "string",
|
||||
"visibility": "secret"
|
||||
},
|
||||
"bucketName": {
|
||||
"type": "string",
|
||||
"visibility": "secret"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"requestUrl"
|
||||
"requestUrl",
|
||||
"storageUrl",
|
||||
"builder"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,18 +15,30 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { ErrorPage } from '@backstage/core';
|
||||
import { ErrorPage, useApi, configApiRef } from '@backstage/core';
|
||||
|
||||
type Props = {
|
||||
errorMessage?: string;
|
||||
};
|
||||
|
||||
export const TechDocsNotFound = ({ errorMessage }: Props) => {
|
||||
const techdocsBuilder = useApi(configApiRef).getOptionalString(
|
||||
'techdocs.builder',
|
||||
);
|
||||
|
||||
let additionalInfo = '';
|
||||
if (techdocsBuilder === 'ci') {
|
||||
additionalInfo =
|
||||
"Note that you have set techdocs.builder to 'ci' in your config, which means this Backstage app will not " +
|
||||
"build docs if they are not found. Make sure the project's CI/CD pipeline builds and publishes docs. Or " +
|
||||
"change techdocs.builder to 'local' to build docs from this Backstage instance.";
|
||||
}
|
||||
|
||||
return (
|
||||
<ErrorPage
|
||||
status="404"
|
||||
statusMessage={errorMessage || 'Documentation not found'}
|
||||
additionalInfo={window.location.pathname}
|
||||
additionalInfo={additionalInfo}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user