Updated the documentation

Signed-off-by: bnechyporenko <bnechyporenko@bol.com>
This commit is contained in:
bnechyporenko
2022-10-10 09:11:15 +02:00
parent 57787f3617
commit 9bf1946668
3 changed files with 44 additions and 27 deletions
-14
View File
@@ -1,14 +0,0 @@
---
'@backstage/plugin-scaffolder': patch
---
Make it possible to enable useLongPollingLogs in scaffolder plugin.
For that you have to add to your app-config.yaml file this snippet:
```yaml
scaffolder:
useLongPollingLogs: true
```
By default, the value is `false`.
+42
View File
@@ -79,6 +79,48 @@ export const Root = ({ children }: PropsWithChildren<{}>) => (
</Sidebar>
```
### Troubleshooting
In case if you encountered with the [issue of closing EventStream](https://github.com/backstage/backstage/issues/5535)
which auto-updates logs during the task execution, you can enable long polling. In order to you it, you have to create
in your codebase file in this location `packages/app/src/apis.ts` where you register `ScaffolderClient` with an extra
parameter `useLongPollingLogs: true`. By default, it is `false`.
```typescript
import {
createApiFactory,
discoveryApiRef,
fetchApiRef,
identityApiRef,
} from '@backstage/core-plugin-api';
import {
scaffolderApiRef,
ScaffolderClient,
} from '@backstage/plugin-scaffolder';
createApiFactory({
api: scaffolderApiRef,
deps: {
discoveryApi: discoveryApiRef,
identityApi: identityApiRef,
scmIntegrationsApi: scmIntegrationsApiRef,
fetchApi: fetchApiRef,
},
factory: ({ scmIntegrationsApi, discoveryApi, identityApi, fetchApi }) =>
new ScaffolderClient({
discoveryApi,
identityApi,
scmIntegrationsApi,
fetchApi,
useLongPollingLogs: true,
}),
});
```
Api factory creates the API and adds it to a registry. Because this file is processed before the default scaffolder
api registry, it is added to the registry prior and overrides the default behavior.
## Links
- [scaffolder-backend](https://github.com/backstage/backstage/tree/master/plugins/scaffolder-backend)
+2 -13
View File
@@ -20,7 +20,7 @@ import { EntityPicker } from './components/fields/EntityPicker/EntityPicker';
import { entityNamePickerValidation } from './components/fields/EntityNamePicker';
import { EntityNamePicker } from './components/fields/EntityNamePicker/EntityNamePicker';
import { OwnerPicker } from './components/fields/OwnerPicker/OwnerPicker';
import { repoPickerValidation } from './components';
import { repoPickerValidation } from './components/fields/RepoUrlPicker';
import { RepoUrlPicker } from './components/fields/RepoUrlPicker/RepoUrlPicker';
import { createScaffolderFieldExtension } from './extensions';
import {
@@ -30,7 +30,6 @@ import {
viewTechDocRouteRef,
} from './routes';
import {
configApiRef,
createApiFactory,
createPlugin,
createRoutableExtension,
@@ -51,27 +50,17 @@ export const scaffolderPlugin = createPlugin({
createApiFactory({
api: scaffolderApiRef,
deps: {
configApi: configApiRef,
discoveryApi: discoveryApiRef,
scmIntegrationsApi: scmIntegrationsApiRef,
fetchApi: fetchApiRef,
identityApi: identityApiRef,
},
factory: ({
configApi,
discoveryApi,
scmIntegrationsApi,
fetchApi,
identityApi,
}) =>
factory: ({ discoveryApi, scmIntegrationsApi, fetchApi, identityApi }) =>
new ScaffolderClient({
discoveryApi,
scmIntegrationsApi,
fetchApi,
identityApi,
useLongPollingLogs:
configApi.getOptionalBoolean('scaffolder.useLongPollingLogs') ??
false,
}),
}),
],