From fbe180aa874f36b4f8c24d47c06c2b5aba435879 Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Fri, 4 Jun 2021 18:16:05 +0100 Subject: [PATCH 001/168] Add support for only filtering available options in the UserListPicker Signed-off-by: Mike Lewis Co-authored-by: Tim Hansen Co-authored-by: Himanshu Mishra --- .../UserListPicker/UserListPicker.tsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/plugins/catalog-react/src/components/UserListPicker/UserListPicker.tsx b/plugins/catalog-react/src/components/UserListPicker/UserListPicker.tsx index 52127a63bc..65ccb423da 100644 --- a/plugins/catalog-react/src/components/UserListPicker/UserListPicker.tsx +++ b/plugins/catalog-react/src/components/UserListPicker/UserListPicker.tsx @@ -106,13 +106,27 @@ function getFilterGroups(orgName: string | undefined): ButtonGroup[] { type UserListPickerProps = { initialFilter?: UserListFilterKind; + availableFilters?: UserListFilterKind[]; }; -export const UserListPicker = ({ initialFilter }: UserListPickerProps) => { +export const UserListPicker = ({ + initialFilter, + availableFilters, +}: UserListPickerProps) => { const classes = useStyles(); const configApi = useApi(configApiRef); const orgName = configApi.getOptionalString('organization.name') ?? 'Company'; - const filterGroups = getFilterGroups(orgName); + + // Remove group items that aren't in availableFilters and exclude + // any now-empty groups. + const filterGroups = getFilterGroups(orgName) + .map(filterGroup => ({ + ...filterGroup, + items: filterGroup.items.filter( + ({ id }) => !availableFilters || availableFilters.includes(id), + ), + })) + .filter(({ items }) => !!items.length); const { value: user } = useOwnUser(); const { isStarredEntity } = useStarredEntities(); From f3a53bf04631c654028daaf4afa712d70a7d8fbb Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Fri, 4 Jun 2021 18:18:21 +0100 Subject: [PATCH 002/168] Start working on refactoring the ScaffolderPage to use the useEntityListProvider hook Signed-off-by: Mike Lewis Co-authored-by: Tim Hansen Co-authored-by: Himanshu Mishra --- .../src/hooks/useEntityListProvider.tsx | 3 + .../ScaffolderPage/ScaffolderPage.tsx | 103 +++++++----------- 2 files changed, 42 insertions(+), 64 deletions(-) diff --git a/plugins/catalog-react/src/hooks/useEntityListProvider.tsx b/plugins/catalog-react/src/hooks/useEntityListProvider.tsx index a6802a6d87..13948b4331 100644 --- a/plugins/catalog-react/src/hooks/useEntityListProvider.tsx +++ b/plugins/catalog-react/src/hooks/useEntityListProvider.tsx @@ -113,6 +113,9 @@ export const EntityListProvider = ({ compact(Object.values(outputState.appliedFilters)), ); + // TODO(mtlewis): currently entities will never be requested unless + // there's at least one filter, we should allow an initial request + // to happen with no filters. if (!isEqual(previousBackendFilter, backendFilter)) { // TODO(timbonicus): should limit fields here, but would need filter // fields + table columns diff --git a/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx b/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx index 1d16e50568..f1e47a1879 100644 --- a/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx +++ b/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx @@ -14,22 +14,11 @@ * limitations under the License. */ -import { EntityMeta, TemplateEntityV1alpha1 } from '@backstage/catalog-model'; -import { useStarredEntities } from '@backstage/plugin-catalog-react'; -import { Button, Link, makeStyles, Typography } from '@material-ui/core'; -import StarIcon from '@material-ui/icons/Star'; -import React, { useEffect, useMemo, useState } from 'react'; -import { Link as RouterLink } from 'react-router-dom'; -import { EntityFilterGroupsProvider, useFilteredEntities } from '../../filter'; -import { registerComponentRouteRef } from '../../routes'; -import { ResultsFilter } from '../ResultsFilter/ResultsFilter'; -import { ScaffolderFilter } from '../ScaffolderFilter'; -import { ButtonGroup } from '../ScaffolderFilter/ScaffolderFilter'; -import SearchToolbar from '../SearchToolbar/SearchToolbar'; -import { TemplateCard } from '../TemplateCard'; - -import { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api'; - +import { + Entity, + EntityMeta, + TemplateEntityV1alpha1, +} from '@backstage/catalog-model'; import { Content, ContentHeader, @@ -41,6 +30,20 @@ import { SupportButton, WarningPanel, } from '@backstage/core-components'; +import { useRouteRef } from '@backstage/core-plugin-api'; +import { + EntityKindPicker, + EntityListProvider, + EntityTypePicker, + useEntityListProvider, + UserListPicker, +} from '@backstage/plugin-catalog-react'; +import { Button, Link, makeStyles, Typography } from '@material-ui/core'; +import React, { useEffect, useState } from 'react'; +import { Link as RouterLink } from 'react-router-dom'; +import { registerComponentRouteRef } from '../../routes'; +import SearchToolbar from '../SearchToolbar/SearchToolbar'; +import { TemplateCard } from '../TemplateCard'; const useStyles = makeStyles(theme => ({ contentWrapper: { @@ -53,45 +56,10 @@ const useStyles = makeStyles(theme => ({ export const ScaffolderPageContents = () => { const styles = useStyles(); - const { - loading, - error, - filteredEntities, - availableCategories, - } = useFilteredEntities(); - const configApi = useApi(configApiRef); - const orgName = configApi.getOptionalString('organization.name') ?? 'Company'; - const { isStarredEntity } = useStarredEntities(); - const filterGroups = useMemo( - () => [ - { - name: orgName, - items: [ - { - id: 'all', - label: 'All', - filterFn: () => true, - }, - ], - }, - { - name: 'Personal', - items: [ - { - id: 'starred', - label: 'Starred', - icon: StarIcon, - filterFn: isStarredEntity, - }, - ], - }, - ], - [isStarredEntity, orgName], - ); + const { loading, error, entities } = useEntityListProvider(); + const [search, setSearch] = useState(''); - const [matchingEntities, setMatchingEntities] = useState( - [] as TemplateEntityV1alpha1[], - ); + const [matchingEntities, setMatchingEntities] = useState([] as Entity[]); const matchesQuery = (metadata: EntityMeta, query: string) => `${metadata.title}`.toLocaleUpperCase('en-US').includes(query) || @@ -101,14 +69,14 @@ export const ScaffolderPageContents = () => { useEffect(() => { if (search.length === 0) { - return setMatchingEntities(filteredEntities); + return setMatchingEntities(entities); } return setMatchingEntities( - filteredEntities.filter(template => + entities.filter(template => matchesQuery(template.metadata, search.toLocaleUpperCase('en-US')), ), ); - }, [search, filteredEntities]); + }, [search, entities]); return ( @@ -142,14 +110,21 @@ export const ScaffolderPageContents = () => {
+ {/* TODO(mtlewis) extract SearchToolbar as a frontend filter */} -
+ {/* TODO(mtlewis) figure out flash of error state when entities are loading */} + {/* TODO(mtlewis) move loading, error handling etc. inside card list */} {loading && } {error && ( @@ -177,7 +152,7 @@ export const ScaffolderPageContents = () => { matchingEntities.map((template, i) => ( ))} @@ -190,7 +165,7 @@ export const ScaffolderPageContents = () => { }; export const ScaffolderPage = () => ( - + - + ); From bc2c35b2e13223e4799e3ef745f50838a5500980 Mon Sep 17 00:00:00 2001 From: Chase Rutherford-Jenkins Date: Fri, 11 Jun 2021 14:39:14 -0700 Subject: [PATCH 003/168] move search logic into SearchToolbar Co-authored-by: Tim Signed-off-by: Chase Rutherford-Jenkins --- .../src/hooks/useEntityListProvider.tsx | 2 + plugins/catalog-react/src/types.ts | 19 +++++++ .../ScaffolderPage/ScaffolderPage.tsx | 56 +++++-------------- .../SearchToolbar/SearchToolbar.test.tsx | 48 +++++++++++++++- .../SearchToolbar/SearchToolbar.tsx | 30 ++++++---- 5 files changed, 101 insertions(+), 54 deletions(-) diff --git a/plugins/catalog-react/src/hooks/useEntityListProvider.tsx b/plugins/catalog-react/src/hooks/useEntityListProvider.tsx index 13948b4331..525ce0a146 100644 --- a/plugins/catalog-react/src/hooks/useEntityListProvider.tsx +++ b/plugins/catalog-react/src/hooks/useEntityListProvider.tsx @@ -31,6 +31,7 @@ import { EntityLifecycleFilter, EntityOwnerFilter, EntityTagFilter, + EntityTextFilter, EntityTypeFilter, UserListFilter, } from '../types'; @@ -44,6 +45,7 @@ export type DefaultEntityFilters = { owners?: EntityOwnerFilter; lifecycles?: EntityLifecycleFilter; tags?: EntityTagFilter; + text?: EntityTextFilter; }; export type EntityListContextProps< diff --git a/plugins/catalog-react/src/types.ts b/plugins/catalog-react/src/types.ts index 7932e4b735..a41e08024a 100644 --- a/plugins/catalog-react/src/types.ts +++ b/plugins/catalog-react/src/types.ts @@ -66,6 +66,25 @@ export class EntityTagFilter implements EntityFilter { } } +// TODO(chaseajen): add unit test for logic +export class EntityTextFilter implements EntityFilter { + constructor(readonly value: string) {} + + filterEntity(entity: Entity): boolean { + const upperCaseValue = this.value.toLocaleUpperCase('en-US'); + + return ( + `${entity.metadata.title}` + .toLocaleUpperCase('en-US') + .includes(upperCaseValue) || + entity.metadata.tags + ?.join('') + .toLocaleUpperCase('en-US') + .indexOf(upperCaseValue) !== -1 + ); + } +} + export class EntityOwnerFilter implements EntityFilter { constructor(readonly values: string[]) {} diff --git a/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx b/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx index f1e47a1879..f8043791ee 100644 --- a/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx +++ b/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx @@ -14,11 +14,7 @@ * limitations under the License. */ -import { - Entity, - EntityMeta, - TemplateEntityV1alpha1, -} from '@backstage/catalog-model'; +import { TemplateEntityV1alpha1 } from '@backstage/catalog-model'; import { Content, ContentHeader, @@ -39,7 +35,7 @@ import { UserListPicker, } from '@backstage/plugin-catalog-react'; import { Button, Link, makeStyles, Typography } from '@material-ui/core'; -import React, { useEffect, useState } from 'react'; +import React from 'react'; import { Link as RouterLink } from 'react-router-dom'; import { registerComponentRouteRef } from '../../routes'; import SearchToolbar from '../SearchToolbar/SearchToolbar'; @@ -58,26 +54,8 @@ export const ScaffolderPageContents = () => { const styles = useStyles(); const { loading, error, entities } = useEntityListProvider(); - const [search, setSearch] = useState(''); - const [matchingEntities, setMatchingEntities] = useState([] as Entity[]); - - const matchesQuery = (metadata: EntityMeta, query: string) => - `${metadata.title}`.toLocaleUpperCase('en-US').includes(query) || - metadata.tags?.join('').toLocaleUpperCase('en-US').indexOf(query) !== -1; - const registerComponentLink = useRouteRef(registerComponentRouteRef); - useEffect(() => { - if (search.length === 0) { - return setMatchingEntities(entities); - } - return setMatchingEntities( - entities.filter(template => - matchesQuery(template.metadata, search.toLocaleUpperCase('en-US')), - ), - ); - }, [search, entities]); - return (
{
- {/* TODO(mtlewis) extract SearchToolbar as a frontend filter */} - +
diff --git a/plugins/scaffolder/src/components/TemplateList/TemplateList.tsx b/plugins/scaffolder/src/components/TemplateList/TemplateList.tsx new file mode 100644 index 0000000000..4b9a7030d9 --- /dev/null +++ b/plugins/scaffolder/src/components/TemplateList/TemplateList.tsx @@ -0,0 +1,64 @@ +/* + * Copyright 2021 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import React from 'react'; +import { TemplateEntityV1alpha1 } from '@backstage/catalog-model'; +import { + ItemCardGrid, + Progress, + WarningPanel, +} from '@backstage/core-components'; +import { useEntityListProvider } from '@backstage/plugin-catalog-react'; +import { Link, Typography } from '@material-ui/core'; +import { TemplateCard } from '../TemplateCard'; + +export const TemplateList = () => { + const { loading, error, entities } = useEntityListProvider(); + return ( + <> + {/* TODO(mtlewis) figure out flash of error state when entities are loading */} + {loading && } + + {error && ( + + {error.message} + + )} + + {!error && !loading && entities && !entities.length && ( + + No templates found that match your filter. Learn more about{' '} + + adding templates + + . + + )} + + + {entities && + entities?.length > 0 && + entities.map((template, i) => ( + + ))} + + + ); +}; diff --git a/plugins/scaffolder/src/components/TemplateList/index.ts b/plugins/scaffolder/src/components/TemplateList/index.ts new file mode 100644 index 0000000000..b9ec700d74 --- /dev/null +++ b/plugins/scaffolder/src/components/TemplateList/index.ts @@ -0,0 +1,16 @@ +/* + * Copyright 2020 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export { TemplateList } from './TemplateList'; From d5b3c9c7ecbb63d59b0bb14a3ebdd5e2c02659d9 Mon Sep 17 00:00:00 2001 From: Tim Hansen Date: Thu, 24 Jun 2021 20:43:10 -0600 Subject: [PATCH 008/168] Set useEntityListProvider initial loading state Signed-off-by: Tim Hansen --- .../src/hooks/useEntityListProvider.tsx | 60 ++++++++++--------- .../components/TemplateList/TemplateList.tsx | 3 +- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/plugins/catalog-react/src/hooks/useEntityListProvider.tsx b/plugins/catalog-react/src/hooks/useEntityListProvider.tsx index 1b96b1f759..0aa52d2227 100644 --- a/plugins/catalog-react/src/hooks/useEntityListProvider.tsx +++ b/plugins/catalog-react/src/hooks/useEntityListProvider.tsx @@ -107,34 +107,40 @@ export const EntityListProvider = ({ // The main async filter worker. Note that while it has a lot of dependencies // in terms of its implementation, the triggering only happens (debounced) // based on the requested filters changing. - const [{ loading, error }, refresh] = useAsyncFn(async () => { - const compacted = compact(Object.values(requestedFilters)); - const entityFilter = reduceEntityFilters(compacted); - const backendFilter = reduceCatalogFilters(compacted); - const previousBackendFilter = reduceCatalogFilters( - compact(Object.values(outputState.appliedFilters)), - ); + const [{ loading, error }, refresh] = useAsyncFn( + async () => { + const compacted = compact(Object.values(requestedFilters)); + const entityFilter = reduceEntityFilters(compacted); + const backendFilter = reduceCatalogFilters(compacted); + const previousBackendFilter = reduceCatalogFilters( + compact(Object.values(outputState.appliedFilters)), + ); - // TODO(mtlewis): currently entities will never be requested unless - // there's at least one filter, we should allow an initial request - // to happen with no filters. - if (!isEqual(previousBackendFilter, backendFilter)) { - // TODO(timbonicus): should limit fields here, but would need filter - // fields + table columns - const response = await catalogApi.getEntities({ filter: backendFilter }); - setOutputState({ - appliedFilters: requestedFilters, - backendEntities: response.items, - entities: response.items.filter(entityFilter), - }); - } else { - setOutputState({ - appliedFilters: requestedFilters, - backendEntities: outputState.backendEntities, - entities: outputState.backendEntities.filter(entityFilter), - }); - } - }, [catalogApi, requestedFilters, outputState]); + // TODO(mtlewis): currently entities will never be requested unless + // there's at least one filter, we should allow an initial request + // to happen with no filters. + if (!isEqual(previousBackendFilter, backendFilter)) { + // TODO(timbonicus): should limit fields here, but would need filter + // fields + table columns + const response = await catalogApi.getEntities({ + filter: backendFilter, + }); + setOutputState({ + appliedFilters: requestedFilters, + backendEntities: response.items, + entities: response.items.filter(entityFilter), + }); + } else { + setOutputState({ + appliedFilters: requestedFilters, + backendEntities: outputState.backendEntities, + entities: outputState.backendEntities.filter(entityFilter), + }); + } + }, + [catalogApi, requestedFilters, outputState], + { loading: true }, + ); // Slight debounce on the refresh, since (especially on page load) several // filters will be calling this in rapid succession. diff --git a/plugins/scaffolder/src/components/TemplateList/TemplateList.tsx b/plugins/scaffolder/src/components/TemplateList/TemplateList.tsx index 4b9a7030d9..f012ab68d0 100644 --- a/plugins/scaffolder/src/components/TemplateList/TemplateList.tsx +++ b/plugins/scaffolder/src/components/TemplateList/TemplateList.tsx @@ -29,7 +29,6 @@ export const TemplateList = () => { const { loading, error, entities } = useEntityListProvider(); return ( <> - {/* TODO(mtlewis) figure out flash of error state when entities are loading */} {loading && } {error && ( @@ -38,7 +37,7 @@ export const TemplateList = () => { )} - {!error && !loading && entities && !entities.length && ( + {!error && !loading && !entities.length && ( No templates found that match your filter. Learn more about{' '} From 8631f422d4470b24ba315959afd9522c1b64adbc Mon Sep 17 00:00:00 2001 From: Tim Hansen Date: Thu, 24 Jun 2021 20:52:14 -0600 Subject: [PATCH 009/168] Add tag filter to ScaffolderPage Signed-off-by: Tim Hansen --- .../src/components/ScaffolderPage/ScaffolderPage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx b/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx index 56c371e825..89710a6e34 100644 --- a/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx +++ b/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx @@ -27,6 +27,7 @@ import { EntityKindPicker, EntityListProvider, EntitySearchBar, + EntityTagPicker, EntityTypePicker, UserListPicker, } from '@backstage/plugin-catalog-react'; @@ -90,7 +91,7 @@ export const ScaffolderPageContents = () => { /> {/* TODO(mtlewis) replace with custom checkbox list? maybe multiselect */} - {/* TODO(mtlewis) consider adding tag picker? */} +
From 7f3f5c9b91ae88b32b2f8339f6d916c630b01ce8 Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Mon, 28 Jun 2021 18:24:24 +0100 Subject: [PATCH 010/168] Add accessor method to retrieve array filter value from EntityTypeFilter Co-authored-by: Tim Hansen Co-authored-by: Chase Rutherford-Jenkins Co-authored-by: Himanshu Mishra Co-authored-by: Joe Porpeglia Signed-off-by: Mike Lewis --- plugins/catalog-react/src/filters.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/catalog-react/src/filters.ts b/plugins/catalog-react/src/filters.ts index 7a80eb6d31..418afeab92 100644 --- a/plugins/catalog-react/src/filters.ts +++ b/plugins/catalog-react/src/filters.ts @@ -32,10 +32,14 @@ export class EntityKindFilter implements EntityFilter { } export class EntityTypeFilter implements EntityFilter { - constructor(readonly value: string) {} + constructor(readonly value: string | string[]) {} + + getTypes() { + return Array.isArray(this.value) ? this.value : [this.value]; + } getCatalogFilters(): Record { - return { 'spec.type': this.value }; + return { 'spec.type': this.getTypes() }; } } From 77186cf6376379fd0a12c8ee500baf39125bd590 Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Mon, 28 Jun 2021 18:28:16 +0100 Subject: [PATCH 011/168] Add ability to include multiple types in useEntityTypeFilter Co-authored-by: Tim Hansen Co-authored-by: Chase Rutherford-Jenkins Co-authored-by: Himanshu Mishra Co-authored-by: Joe Porpeglia Signed-off-by: Mike Lewis --- .../src/hooks/useEntityTypeFilter.tsx | 40 +++++++++++++------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/plugins/catalog-react/src/hooks/useEntityTypeFilter.tsx b/plugins/catalog-react/src/hooks/useEntityTypeFilter.tsx index aeda12c6f8..e925103ebd 100644 --- a/plugins/catalog-react/src/hooks/useEntityTypeFilter.tsx +++ b/plugins/catalog-react/src/hooks/useEntityTypeFilter.tsx @@ -30,6 +30,7 @@ type EntityTypeReturn = { types: string[]; selectedType: string | undefined; setType: (type: string | undefined) => void; + setTypes: (types: string[]) => void; }; /** @@ -43,7 +44,7 @@ export function useEntityTypeFilter(): EntityTypeReturn { updateFilters, } = useEntityListProvider(); - const [types, setTypes] = useState([]); + const [allTypes, setAllTypes] = useState([]); const kind = useMemo(() => kindFilter?.value, [kindFilter]); // Load all valid spec.type values straight from the catalogApi, paying attention to only the @@ -69,29 +70,44 @@ export function useEntityTypeFilter(): EntityTypeReturn { (entities ?? []).map(e => e.spec?.type).filter(Boolean) as string[], ), ].sort(); - setTypes(newTypes); + setAllTypes(newTypes); - // Reset type filter if no longer applicable - updateFilters((oldFilters: DefaultEntityFilters) => - oldFilters.type && !newTypes.includes(oldFilters.type.value) - ? { type: undefined } - : {}, - ); + // Update type filter to only valid values when the list of available types has changed + updateFilters((oldFilters: DefaultEntityFilters) => { + // No filter previously set; no-op + if (!oldFilters.type) { + return {}; + } + const stillValidTypes = oldFilters.type + .getTypes() + .filter(value => newTypes.includes(value)); + if (!stillValidTypes.length) { + // None of the previously selected types are present any more; clear the filter + return { type: undefined }; + } + return { type: new EntityTypeFilter(stillValidTypes) }; + }); }, [updateFilters, entities]); - const setType = useCallback( - (type: string | undefined) => + const setTypes = useCallback( + (types: string[]) => updateFilters({ - type: type === undefined ? undefined : new EntityTypeFilter(type), + type: types.length ? undefined : new EntityTypeFilter(types), }), [updateFilters], ); + const setType = (type: string | undefined) => + setTypes(type === undefined ? [] : [type]); + + // TODO(timbonicus): selectedType should be selectedTypes + // TODO(timbonicus): remove setType, make this only array-based return { loading, error, - types, + types: allTypes, selectedType: typeFilter?.value, setType, + setTypes, }; } From 2669b41f2fb6c2a24aab2cb4a3490c26cb2c350c Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Mon, 28 Jun 2021 18:29:24 +0100 Subject: [PATCH 012/168] Introduce initial TemplateTypePicker component in scaffolder Co-authored-by: Tim Hansen Co-authored-by: Chase Rutherford-Jenkins Co-authored-by: Himanshu Mishra Co-authored-by: Joe Porpeglia Signed-off-by: Mike Lewis --- plugins/scaffolder/package.json | 1 + .../TemplateTypePicker.test.tsx | 134 ++++++++++++++++++ .../TemplateTypePicker/TemplateTypePicker.tsx | 97 +++++++++++++ .../components/TemplateTypePicker/index.ts | 17 +++ 4 files changed, 249 insertions(+) create mode 100644 plugins/scaffolder/src/components/TemplateTypePicker/TemplateTypePicker.test.tsx create mode 100644 plugins/scaffolder/src/components/TemplateTypePicker/TemplateTypePicker.tsx create mode 100644 plugins/scaffolder/src/components/TemplateTypePicker/index.ts diff --git a/plugins/scaffolder/package.json b/plugins/scaffolder/package.json index 88845b402b..c02b63f761 100644 --- a/plugins/scaffolder/package.json +++ b/plugins/scaffolder/package.json @@ -51,6 +51,7 @@ "humanize-duration": "^3.25.1", "immer": "^9.0.1", "json-schema": "^0.3.0", + "lodash": "^4.17.21", "luxon": "^1.25.0", "react": "^16.13.1", "react-dom": "^16.13.1", diff --git a/plugins/scaffolder/src/components/TemplateTypePicker/TemplateTypePicker.test.tsx b/plugins/scaffolder/src/components/TemplateTypePicker/TemplateTypePicker.test.tsx new file mode 100644 index 0000000000..fa74b34717 --- /dev/null +++ b/plugins/scaffolder/src/components/TemplateTypePicker/TemplateTypePicker.test.tsx @@ -0,0 +1,134 @@ +/* + * Copyright 2021 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import React from 'react'; +import { fireEvent, render, waitFor } from '@testing-library/react'; +import { capitalize } from 'lodash'; +import { CatalogApi } from '@backstage/catalog-client'; +import { Entity } from '@backstage/catalog-model'; +import { EntityTypePicker } from './EntityTypePicker'; +import { MockEntityListContextProvider } from '../../testUtils/providers'; +import { catalogApiRef } from '../../api'; +import { EntityKindFilter, EntityTypeFilter } from '../../filters'; + +import { AlertApi, alertApiRef } from '@backstage/core-plugin-api'; +import { ApiProvider, ApiRegistry } from '@backstage/core-app-api'; + +const entities: Entity[] = [ + { + apiVersion: '1', + kind: 'Component', + metadata: { + name: 'component-1', + }, + spec: { + type: 'service', + }, + }, + { + apiVersion: '1', + kind: 'Component', + metadata: { + name: 'component-2', + }, + spec: { + type: 'website', + }, + }, + { + apiVersion: '1', + kind: 'Component', + metadata: { + name: 'component-3', + }, + spec: { + type: 'library', + }, + }, +]; + +const apis = ApiRegistry.from([ + [ + catalogApiRef, + ({ + getEntities: jest + .fn() + .mockImplementation(() => Promise.resolve({ items: entities })), + } as unknown) as CatalogApi, + ], + [ + alertApiRef, + ({ + post: jest.fn(), + } as unknown) as AlertApi, + ], +]); + +describe('', () => { + it('renders available entity types', async () => { + const rendered = render( + + + + + , + ); + expect(rendered.getByText('Type')).toBeInTheDocument(); + + const input = rendered.getByTestId('select'); + fireEvent.click(input); + + await waitFor(() => rendered.getByText('Service')); + + entities.forEach(entity => { + expect( + rendered.getByText(capitalize(entity.spec!.type as string)), + ).toBeInTheDocument(); + }); + }); + + it('sets the selected type filter', async () => { + const updateFilters = jest.fn(); + const rendered = render( + + + + + , + ); + const input = rendered.getByTestId('select'); + fireEvent.click(input); + + await waitFor(() => rendered.getByText('Service')); + fireEvent.click(rendered.getByText('Service')); + + expect(updateFilters).toHaveBeenLastCalledWith({ + type: new EntityTypeFilter('service'), + }); + + fireEvent.click(input); + fireEvent.click(rendered.getByText('All')); + + expect(updateFilters).toHaveBeenLastCalledWith({ type: undefined }); + }); +}); diff --git a/plugins/scaffolder/src/components/TemplateTypePicker/TemplateTypePicker.tsx b/plugins/scaffolder/src/components/TemplateTypePicker/TemplateTypePicker.tsx new file mode 100644 index 0000000000..780f9d2d1e --- /dev/null +++ b/plugins/scaffolder/src/components/TemplateTypePicker/TemplateTypePicker.tsx @@ -0,0 +1,97 @@ +/* + * Copyright 2021 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import React from 'react'; +import { + Typography, + List, + ListItem, + makeStyles, + Theme, + Checkbox, + ListItemText, +} from '@material-ui/core'; +import { useEntityTypeFilter } from '@backstage/plugin-catalog-react'; +import { alertApiRef, useApi } from '@backstage/core-plugin-api'; + +const useStyles = makeStyles(theme => ({ + checkbox: { + padding: theme.spacing(0, 1, 0, 1), + }, +})); + +export const TemplateTypePicker = () => { + const classes = useStyles(); + const alertApi = useApi(alertApiRef); + // TODO(timbonicus): Use new setTypes returned from the hook + const { error, types, selectedType } = useEntityTypeFilter(); + + if (!types) return null; + + if (error) { + alertApi.post({ + message: `Failed to load entity types`, + severity: 'error', + }); + return null; + } + + return ( + <> + Categories + + {types.map(type => { + const labelId = `checkbox-list-label-${type}`; + return ( + {}} + // TODO(timbonicus): Update to use setTypes + // setSelectedCategories( + // selectedCategories.includes(type) + // ? selectedCategories.filter( + // selectedCategory => selectedCategory !== type, + // ) + // : [...selectedCategories, type], + // ) + // } + > + + + + ); + })} + + + ); +}; diff --git a/plugins/scaffolder/src/components/TemplateTypePicker/index.ts b/plugins/scaffolder/src/components/TemplateTypePicker/index.ts new file mode 100644 index 0000000000..2dcd091311 --- /dev/null +++ b/plugins/scaffolder/src/components/TemplateTypePicker/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2021 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { TemplateTypePicker } from './TemplateTypePicker'; From e5abca34f601ab11076c6aaf1b61b281799a5cc0 Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Mon, 28 Jun 2021 18:29:57 +0100 Subject: [PATCH 013/168] Use new TemplateTypePicker component in ScaffolderPage Co-authored-by: Tim Hansen Co-authored-by: Chase Rutherford-Jenkins Co-authored-by: Himanshu Mishra Co-authored-by: Joe Porpeglia Signed-off-by: Mike Lewis --- .../src/components/ScaffolderPage/ScaffolderPage.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx b/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx index 89710a6e34..3fed099500 100644 --- a/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx +++ b/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx @@ -28,7 +28,6 @@ import { EntityListProvider, EntitySearchBar, EntityTagPicker, - EntityTypePicker, UserListPicker, } from '@backstage/plugin-catalog-react'; import { Button, makeStyles } from '@material-ui/core'; @@ -36,6 +35,7 @@ import React from 'react'; import { Link as RouterLink } from 'react-router-dom'; import { registerComponentRouteRef } from '../../routes'; import { TemplateList } from '../TemplateList'; +import { TemplateTypePicker } from '../TemplateTypePicker'; const useStyles = makeStyles(theme => ({ contentWrapper: { @@ -89,8 +89,7 @@ export const ScaffolderPageContents = () => { initialFilter="all" availableFilters={['all', 'starred']} /> - {/* TODO(mtlewis) replace with custom checkbox list? maybe multiselect */} - +
From 315deb854401339111c01c4494254d5a05691531 Mon Sep 17 00:00:00 2001 From: Tim Hansen Date: Mon, 28 Jun 2021 16:04:43 -0600 Subject: [PATCH 014/168] entityTypeFilter improvements - Supports selecting multiple types - Switch TemplateTypePicker to FormGroup instead of List Co-authored-by: Joe Porpeglia Signed-off-by: Tim Hansen --- .../EntityTypePicker/EntityTypePicker.tsx | 19 ++-- plugins/catalog-react/src/filters.ts | 3 +- .../src/hooks/useEntityListProvider.tsx | 2 +- .../src/hooks/useEntityTypeFilter.tsx | 48 +++++----- .../components/CatalogTable/CatalogTable.tsx | 2 +- .../TemplateTypePicker/TemplateTypePicker.tsx | 89 +++++++++---------- 6 files changed, 84 insertions(+), 79 deletions(-) diff --git a/plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.tsx b/plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.tsx index 52b8ec8ff1..0a7e94d142 100644 --- a/plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.tsx +++ b/plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.tsx @@ -15,7 +15,7 @@ */ import React from 'react'; -import { capitalize } from 'lodash'; +import capitalize from 'lodash/capitalize'; import { Box } from '@material-ui/core'; import { useEntityTypeFilter } from '../../hooks/useEntityTypeFilter'; @@ -24,9 +24,14 @@ import { Select } from '@backstage/core-components'; export const EntityTypePicker = () => { const alertApi = useApi(alertApiRef); - const { error, types, selectedType, setType } = useEntityTypeFilter(); + const { + error, + availableTypes, + selectedTypes, + setSelectedTypes, + } = useEntityTypeFilter(); - if (!types) return null; + if (!availableTypes) return null; if (error) { alertApi.post({ @@ -38,7 +43,7 @@ export const EntityTypePicker = () => { const items = [ { value: 'all', label: 'All' }, - ...types.map((type: string) => ({ + ...availableTypes.map((type: string) => ({ value: type, label: capitalize(type), })), @@ -49,8 +54,10 @@ export const EntityTypePicker = () => { = { createTemporaryDirectory(): Promise; }; -// @public (undocumented) -export class AzurePreparer implements PreparerBase { - constructor(config: { - token?: string; - }); - // (undocumented) - static fromConfig(config: AzureIntegrationConfig): AzurePreparer; - // (undocumented) - prepare({ url, workspacePath, logger }: PreparerOptions): Promise; -} - -// @public (undocumented) -export class AzurePublisher implements PublisherBase { - constructor(config: { - token: string; - }); - // (undocumented) - static fromConfig(config: AzureIntegrationConfig): Promise; - // (undocumented) - publish({ values, workspacePath, logger, }: PublisherOptions): Promise; -} - -// @public (undocumented) -export class BitbucketPreparer implements PreparerBase { - constructor(config: { - username?: string; - token?: string; - appPassword?: string; - }); - // (undocumented) - static fromConfig(config: BitbucketIntegrationConfig): BitbucketPreparer; - // (undocumented) - prepare({ url, workspacePath, logger }: PreparerOptions): Promise; -} - -// @public (undocumented) -export class BitbucketPublisher implements PublisherBase { - constructor(config: { - host: string; - token?: string; - appPassword?: string; - username?: string; - apiBaseUrl?: string; - repoVisibility: RepoVisibilityOptions_2; - }); - // (undocumented) - static fromConfig(config: BitbucketIntegrationConfig, { repoVisibility }: { - repoVisibility: RepoVisibilityOptions_2; - }): Promise; - // (undocumented) - publish({ values, workspacePath, logger, }: PublisherOptions): Promise; -} - // @public export class CatalogEntityClient { constructor(catalogClient: CatalogApi); findTemplate(templateName: string, options?: { token?: string; - }): Promise; -} - -// @public (undocumented) -export class CookieCutter implements TemplaterBase { - constructor({ containerRunner }: { - containerRunner: ContainerRunner; - }); - // (undocumented) - run({ workspacePath, values, logStream, }: TemplaterRunOptions): Promise; + }): Promise; } // @public (undocumented) @@ -115,7 +45,7 @@ export const createBuiltinActions: (options: { reader: UrlReader; integrations: ScmIntegrations; catalogClient: CatalogApi; - templaters: TemplaterBuilder; + containerRunner: ContainerRunner; config: Config; }) => TemplateAction[]; @@ -135,7 +65,7 @@ export function createDebugLogAction(): TemplateAction; export function createFetchCookiecutterAction(options: { reader: UrlReader; integrations: ScmIntegrations; - templaters: TemplaterBuilder; + containerRunner: ContainerRunner; }): TemplateAction; // @public (undocumented) @@ -150,9 +80,6 @@ export const createFilesystemDeleteAction: () => TemplateAction; // @public (undocumented) export const createFilesystemRenameAction: () => TemplateAction; -// @public (undocumented) -export function createLegacyActions(options: Options): TemplateAction[]; - // @public (undocumented) export function createPublishAzureAction(options: { integrations: ScmIntegrationRegistry; @@ -183,15 +110,6 @@ export function createPublishGitlabAction(options: { config: Config; }): TemplateAction; -// @public (undocumented) -export class CreateReactAppTemplater implements TemplaterBase { - constructor({ containerRunner }: { - containerRunner: ContainerRunner; - }); - // (undocumented) - run({ workspacePath, values, logStream, }: TemplaterRunOptions): Promise; -} - // @public (undocumented) export function createRouter(options: RouterOptions): Promise; @@ -200,206 +118,6 @@ export const createTemplateAction: | undefined; }>>(templateAction: TemplateAction) => TemplateAction; -// @public (undocumented) -export class FilePreparer implements PreparerBase { - // (undocumented) - prepare({ url, workspacePath }: PreparerOptions): Promise; -} - -// @public -export const getTemplaterKey: (entity: TemplateEntityV1alpha1) => string; - -// @public (undocumented) -export class GithubPreparer implements PreparerBase { - constructor(config: { - credentialsProvider: GithubCredentialsProvider; - }); - // (undocumented) - static fromConfig(config: GitHubIntegrationConfig): GithubPreparer; - // (undocumented) - prepare({ url, workspacePath, logger }: PreparerOptions): Promise; -} - -// @public @deprecated (undocumented) -export class GithubPublisher implements PublisherBase { - constructor(config: { - credentialsProvider: GithubCredentialsProvider; - repoVisibility: RepoVisibilityOptions; - apiBaseUrl: string | undefined; - }); - // (undocumented) - static fromConfig(config: GitHubIntegrationConfig, { repoVisibility }: { - repoVisibility: RepoVisibilityOptions; - }): Promise; - // (undocumented) - publish({ values, workspacePath, logger, }: PublisherOptions): Promise; -} - -// @public (undocumented) -export class GitlabPreparer implements PreparerBase { - constructor(config: { - token?: string; - }); - // (undocumented) - static fromConfig(config: GitLabIntegrationConfig): GitlabPreparer; - // (undocumented) - prepare({ url, workspacePath, logger }: PreparerOptions): Promise; -} - -// @public (undocumented) -export class GitlabPublisher implements PublisherBase { - constructor(config: { - token: string; - client: Gitlab; - repoVisibility: RepoVisibilityOptions_3; - }); - // (undocumented) - static fromConfig(config: GitLabIntegrationConfig, { repoVisibility }: { - repoVisibility: RepoVisibilityOptions_3; - }): Promise; - // (undocumented) - publish({ values, workspacePath, logger, }: PublisherOptions): Promise; -} - -// @public (undocumented) -export type Job = { - id: string; - context: StageContext; - status: ProcessorStatus; - stages: StageResult[]; - error?: Error; -}; - -// @public (undocumented) -export type JobAndDirectoryTuple = { - job: Job; - directory: string; -}; - -// @public (undocumented) -export class JobProcessor implements Processor { - constructor(workingDirectory: string); - // (undocumented) - create({ entity, values, stages, }: { - entity: TemplateEntityV1alpha1; - values: TemplaterValues; - stages: StageInput[]; - }): Job; - // (undocumented) - static fromConfig({ config, logger, }: { - config: Config; - logger: Logger; - }): Promise; - // (undocumented) - get(id: string): Job | undefined; - // (undocumented) - run(job: Job): Promise; - } - -// @public (undocumented) -export function joinGitUrlPath(repoUrl: string, path?: string): string; - -// @public (undocumented) -export type ParsedLocationAnnotation = { - protocol: 'file' | 'url'; - location: string; -}; - -// @public (undocumented) -export const parseLocationAnnotation: (entity: TemplateEntityV1alpha1) => ParsedLocationAnnotation; - -// @public (undocumented) -export interface PreparerBase { - prepare(opts: PreparerOptions): Promise; -} - -// @public (undocumented) -export type PreparerBuilder = { - register(host: string, preparer: PreparerBase): void; - get(url: string): PreparerBase; -}; - -// @public (undocumented) -export type PreparerOptions = { - url: string; - workspacePath: string; - logger: Logger; -}; - -// @public (undocumented) -export class Preparers implements PreparerBuilder { - // (undocumented) - static fromConfig(config: Config, _: { - logger: Logger; - }): Promise; - // (undocumented) - get(url: string): PreparerBase; - // (undocumented) - register(host: string, preparer: PreparerBase): void; -} - -// @public (undocumented) -export type Processor = { - create({ entity, values, stages, }: { - entity: TemplateEntityV1alpha1; - values: TemplaterValues; - stages: StageInput[]; - }): Job; - get(id: string): Job | undefined; - run(job: Job): Promise; -}; - -// @public (undocumented) -export type ProcessorStatus = 'PENDING' | 'STARTED' | 'COMPLETED' | 'FAILED'; - -// @public -export type PublisherBase = { - publish(opts: PublisherOptions): Promise; -}; - -// @public (undocumented) -export type PublisherBuilder = { - register(host: string, publisher: PublisherBase): void; - get(storePath: string): PublisherBase; -}; - -// @public (undocumented) -export type PublisherOptions = { - values: TemplaterValues; - workspacePath: string; - logger: Logger; -}; - -// @public (undocumented) -export type PublisherResult = { - remoteUrl: string; - catalogInfoUrl?: string; -}; - -// @public (undocumented) -export class Publishers implements PublisherBuilder { - // (undocumented) - static fromConfig(config: Config, _options: { - logger: Logger; - }): Promise; - // (undocumented) - get(url: string): PublisherBase; - // (undocumented) - register(host: string, preparer: PublisherBase | undefined): void; -} - -// @public (undocumented) -export type RepoVisibilityOptions = 'private' | 'internal' | 'public'; - -// @public -export type RequiredTemplateValues = { - owner: string; - storePath: string; - destination?: { - git?: gitUrlParse.GitUrl; - }; -}; - // @public (undocumented) export interface RouterOptions { // (undocumented) @@ -409,63 +127,17 @@ export interface RouterOptions { // (undocumented) config: Config; // (undocumented) + containerRunner: ContainerRunner; + // (undocumented) database: PluginDatabaseManager; // (undocumented) logger: Logger; // (undocumented) - preparers: PreparerBuilder; - // (undocumented) - publishers: PublisherBuilder; - // (undocumented) reader: UrlReader; // (undocumented) taskWorkers?: number; - // (undocumented) - templaters: TemplaterBuilder; } -// @public (undocumented) -export const runCommand: ({ command, args, logStream, }: RunCommandOptions) => Promise; - -// @public (undocumented) -export type RunCommandOptions = { - command: string; - args: string[]; - logStream?: Writable; -}; - -// @public (undocumented) -export type StageContext = { - values: TemplaterValues; - entity: TemplateEntityV1alpha1; - logger: Logger; - logStream: Writable; - workspacePath: string; -} & T; - -// @public (undocumented) -export interface StageInput { - // (undocumented) - handler(ctx: StageContext): Promise; - // (undocumented) - name: string; -} - -// @public (undocumented) -export interface StageResult extends StageInput { - // (undocumented) - endedAt?: number; - // (undocumented) - log: string[]; - // (undocumented) - startedAt?: number; - // (undocumented) - status: ProcessorStatus; -} - -// @public -export type SupportedTemplatingKey = 'cookiecutter' | string; - // @public (undocumented) export type TemplateAction = { id: string; @@ -487,45 +159,6 @@ export class TemplateActionRegistry { register(action: TemplateAction): void; } -// @public (undocumented) -export type TemplaterBase = { - run(opts: TemplaterRunOptions): Promise; -}; - -// @public -export type TemplaterBuilder = { - register(protocol: SupportedTemplatingKey, templater: TemplaterBase): void; - get(templater: string): TemplaterBase; -}; - -// @public (undocumented) -export type TemplaterConfig = { - templater?: TemplaterBase; -}; - -// @public -export type TemplaterRunOptions = { - workspacePath: string; - values: TemplaterValues; - logStream?: Writable; -}; - -// @public -export type TemplaterRunResult = { - resultDir: string; -}; - -// @public (undocumented) -export class Templaters implements TemplaterBuilder { - // (undocumented) - get(templaterId: string): TemplaterBase; - // (undocumented) - register(templaterKey: SupportedTemplatingKey, templater: TemplaterBase): void; - } - -// @public (undocumented) -export type TemplaterValues = RequiredTemplateValues & Record; - // (No @packageDocumentation comment for this package) From 0adfae5c812655cf886dda0140e4a04d77aeaf80 Mon Sep 17 00:00:00 2001 From: Jos Craw Date: Wed, 7 Jul 2021 21:37:52 +1200 Subject: [PATCH 124/168] added changeset Signed-off-by: Jos Craw --- .changeset/red-ladybugs-promise.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/red-ladybugs-promise.md diff --git a/.changeset/red-ladybugs-promise.md b/.changeset/red-ladybugs-promise.md new file mode 100644 index 0000000000..dbfbf2bbd4 --- /dev/null +++ b/.changeset/red-ladybugs-promise.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder': patch +--- + +add support for uiSchema on dependent form fields From dfe4c491c919d7224d464c0141e3cd1c2c129614 Mon Sep 17 00:00:00 2001 From: Ben Lambert Date: Wed, 7 Jul 2021 11:50:05 +0200 Subject: [PATCH 125/168] Make minor change Signed-off-by: Ben Lambert --- .changeset/nice-bugs-beg.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/nice-bugs-beg.md b/.changeset/nice-bugs-beg.md index e026ddd250..c41b54b220 100644 --- a/.changeset/nice-bugs-beg.md +++ b/.changeset/nice-bugs-beg.md @@ -1,5 +1,5 @@ --- -'@backstage/plugin-user-settings': patch +'@backstage/plugin-user-settings': minor --- Exported and renamed components from the `@backstage/plugin-user-settings` plugin , to be able to use it in the consumer side and customize the `SettingPage` From 886844aa30eedbfc0ea13a6d89de80446008540e Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Wed, 7 Jul 2021 11:00:14 +0100 Subject: [PATCH 126/168] scaffolder: platform-agnostic path joining in fetch:template test suite Signed-off-by: Mike Lewis --- .../src/scaffolder/actions/builtin/fetch/template.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.test.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.test.ts index dbdb3feff1..98ac01edec 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.test.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.test.ts @@ -15,7 +15,7 @@ */ import os from 'os'; -import { resolve as resolvePath } from 'path'; +import { join as joinPath, resolve as resolvePath } from 'path'; import fs from 'fs-extra'; import mockFs from 'mock-fs'; import { getVoidLogger, UrlReader } from '@backstage/backend-common'; @@ -48,7 +48,9 @@ describe('fetch:template', () => { ActionContext['createTemporaryDirectory'] > = jest.fn(() => Promise.resolve( - `${workspacePath}/${createTemporaryDirectory.mock.calls.length}`, + joinPath( + `${workspacePath}/${createTemporaryDirectory.mock.calls.length}`, + ), ), ); From 51513c64208f39d699e488e5977d8ce36591399e Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Wed, 7 Jul 2021 11:20:10 +0100 Subject: [PATCH 127/168] scaffolder: fix use of path.join in fetch:template tests Signed-off-by: Mike Lewis --- .../src/scaffolder/actions/builtin/fetch/template.test.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.test.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.test.ts index 98ac01edec..56fffe0189 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.test.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.test.ts @@ -48,9 +48,7 @@ describe('fetch:template', () => { ActionContext['createTemporaryDirectory'] > = jest.fn(() => Promise.resolve( - joinPath( - `${workspacePath}/${createTemporaryDirectory.mock.calls.length}`, - ), + joinPath(workspacePath, `${createTemporaryDirectory.mock.calls.length}`), ), ); From 56b61c2bc05c7d1d932c85632737f7eba2bc2690 Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Wed, 7 Jul 2021 11:26:00 +0100 Subject: [PATCH 128/168] scaffolder: prefix input values in fetch:template templates Signed-off-by: Mike Lewis --- .../software-templates/builtin-actions.md | 6 +++--- .../actions/builtin/fetch/template.test.ts | 19 +++++++++++-------- .../actions/builtin/fetch/template.ts | 11 ++++++----- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/docs/features/software-templates/builtin-actions.md b/docs/features/software-templates/builtin-actions.md index a165a0a274..5cd6b005d9 100644 --- a/docs/features/software-templates/builtin-actions.md +++ b/docs/features/software-templates/builtin-actions.md @@ -41,10 +41,10 @@ verbose template variables expressions. `fetch:cookiecutter` to `fetch:template`. 2. Update variable syntax in file names and content. `fetch:cookiecutter` expects variables to be enclosed in `{{` `}}` and prefixed with - `cookiecutter.`, while `fetch:template` doesn't require prefixing and expects - variables to be enclosed in `${{` `}}`. For example, a reference to variable + `cookiecutter.`, while `fetch:template` expects variables to be enclosed in + `${{` `}}` and prefixed with `values.`. For example, a reference to variable `myInputVariable` would need to be migrated from - `{{ cookiecutter.myInputVariable }}` to `${{ myInputVariable }}`. + `{{ cookiecutter.myInputVariable }}` to `${{ values.myInputVariable }}`. 3. Replace uses of `jsonify` with `dump`. The `jsonify` filter is built in to `cookiecutter`, and is not available by default when using `fetch:template`. The `dump` filter is equivalent, so an expression like diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.test.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.test.ts index 56fffe0189..79cc5be524 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.test.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.test.ts @@ -120,13 +120,14 @@ describe('fetch:template', () => { mockFetchContents.mockImplementation(({ outputPath }) => { mockFs({ [outputPath]: { - 'empty-dir-${{ count }}': {}, + 'empty-dir-${{ values.count }}': {}, 'static.txt': 'static content', - '${{ name }}.txt': 'static content', + '${{ values.name }}.txt': 'static content', subdir: { - 'templated-content.txt': '${{ name }}: ${{ count }}', + 'templated-content.txt': + '${{ values.name }}: ${{ values.count }}', }, - '.${{ name }}': '${{ itemList | dump }}', + '.${{ values.name }}': '${{ values.itemList | dump }}', 'a-binary-file.png': aBinaryFile, }, }); @@ -202,10 +203,12 @@ describe('fetch:template', () => { mockFs({ [outputPath]: { processed: { - 'templated-content-${{ name }}.txt': '${{ count }}', + 'templated-content-${{ values.name }}.txt': + '${{ values.count }}', }, '.unprocessed': { - 'templated-content-${{ name }}.txt': '${{ count }}', + 'templated-content-${{ values.name }}.txt': + '${{ values.count }}', }, }, }); @@ -219,10 +222,10 @@ describe('fetch:template', () => { it('ignores template syntax in files matched in copyWithoutRender', async () => { await expect( fs.readFile( - `${workspacePath}/target/.unprocessed/templated-content-\${{ name }}.txt`, + `${workspacePath}/target/.unprocessed/templated-content-\${{ values.name }}.txt`, 'utf-8', ), - ).resolves.toEqual('${{ count }}'); + ).resolves.toEqual('${{ values.count }}'); }); it('processes files not matched in copyWithoutRender', async () => { diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts index ac7051fe69..4fd505f9b0 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts @@ -180,9 +180,10 @@ export function createFetchTemplateAction(options: { // `cookiecutter.`. To replicate this, we wrap our parameters // in an object with a `cookiecutter` property when compat // mode is enabled. - const parameters = ctx.input.cookiecutterCompat - ? { cookiecutter: ctx.input.values } - : ctx.input.values; + const { cookiecutterCompat, values } = ctx.input; + const context = { + [cookiecutterCompat ? 'cookiecutter' : 'values']: values, + }; ctx.logger.info( `Processing ${allEntriesInTemplate.length} template files/directories with input values`, @@ -196,7 +197,7 @@ export function createFetchTemplateAction(options: { outputDir, shouldCopyWithoutRender ? location - : templater.renderString(location, parameters), + : templater.renderString(location, context), ); if (shouldCopyWithoutRender) { @@ -227,7 +228,7 @@ export function createFetchTemplateAction(options: { outputPath, shouldCopyWithoutRender ? inputFileContents - : templater.renderString(inputFileContents, parameters), + : templater.renderString(inputFileContents, context), ); } } From 7a3ad92b525354993908d52af27c9f7984085070 Mon Sep 17 00:00:00 2001 From: Rogerio Angeliski Date: Fri, 11 Jun 2021 11:01:53 -0300 Subject: [PATCH 129/168] feat: added rails templater to scaffolder-backend Signed-off-by: Rogerio Angeliski --- .changeset/twelve-deers-explode.md | 5 + plugins/scaffolder-backend/package.json | 6 +- .../sample-templates/local-templates.yaml | 1 + .../sample-templates/rails-demo/template.yaml | 174 ++++++++++++ .../template/rails-template-file.rb | 14 + .../scripts/Rails.dockerfile | 9 + .../actions/builtin/createBuiltinActions.ts | 10 +- .../scaffolder/actions/builtin/fetch/index.ts | 1 + .../actions/builtin/fetch/rails.test.ts | 140 ++++++++++ .../scaffolder/actions/builtin/fetch/rails.ts | 182 +++++++++++++ .../src/scaffolder/stages/templater/index.ts | 21 ++ .../stages/templater/rails/index.test.ts | 257 ++++++++++++++++++ .../stages/templater/rails/index.ts | 96 +++++++ .../rails/railsArgumentResolver.test.ts | 50 ++++ .../templater/rails/railsArgumentResolver.ts | 106 ++++++++ 15 files changed, 1070 insertions(+), 2 deletions(-) create mode 100644 .changeset/twelve-deers-explode.md create mode 100644 plugins/scaffolder-backend/sample-templates/rails-demo/template.yaml create mode 100644 plugins/scaffolder-backend/sample-templates/rails-demo/template/rails-template-file.rb create mode 100644 plugins/scaffolder-backend/scripts/Rails.dockerfile create mode 100644 plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/rails.test.ts create mode 100644 plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/rails.ts create mode 100644 plugins/scaffolder-backend/src/scaffolder/stages/templater/index.ts create mode 100644 plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/index.test.ts create mode 100644 plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/index.ts create mode 100644 plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/railsArgumentResolver.test.ts create mode 100644 plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/railsArgumentResolver.ts diff --git a/.changeset/twelve-deers-explode.md b/.changeset/twelve-deers-explode.md new file mode 100644 index 0000000000..c5ce1318a6 --- /dev/null +++ b/.changeset/twelve-deers-explode.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder-backend': patch +--- + +Created a Rails templater to scaffold apps diff --git a/plugins/scaffolder-backend/package.json b/plugins/scaffolder-backend/package.json index 7173f865c5..0bc4c62ea6 100644 --- a/plugins/scaffolder-backend/package.json +++ b/plugins/scaffolder-backend/package.json @@ -40,6 +40,9 @@ "@octokit/rest": "^18.5.3", "@types/express": "^4.17.6", "azure-devops-node-api": "^10.2.2", + "@types/git-url-parse": "^9.0.0", + "@types/dockerode": "^3.2.1", + "azure-devops-node-api": "^10.1.1", "command-exists": "^1.2.9", "compression": "^1.7.4", "cors": "^2.8.5", @@ -60,7 +63,8 @@ "octokit-plugin-create-pull-request": "^3.9.3", "uuid": "^8.2.0", "winston": "^3.2.1", - "yaml": "^1.10.0" + "yaml": "^1.10.0", + "dockerode": "^3.2.1" }, "devDependencies": { "@backstage/cli": "^0.7.3", diff --git a/plugins/scaffolder-backend/sample-templates/local-templates.yaml b/plugins/scaffolder-backend/sample-templates/local-templates.yaml index 3b3acbae7e..59a55b3cd9 100644 --- a/plugins/scaffolder-backend/sample-templates/local-templates.yaml +++ b/plugins/scaffolder-backend/sample-templates/local-templates.yaml @@ -10,4 +10,5 @@ spec: - ./create-react-app/template.yaml - ./springboot-grpc-template/template.yaml - ./v1beta2-demo/template.yaml + - ./rails-demo/template.yaml - ./pull-request/template.yaml diff --git a/plugins/scaffolder-backend/sample-templates/rails-demo/template.yaml b/plugins/scaffolder-backend/sample-templates/rails-demo/template.yaml new file mode 100644 index 0000000000..174c58741b --- /dev/null +++ b/plugins/scaffolder-backend/sample-templates/rails-demo/template.yaml @@ -0,0 +1,174 @@ +apiVersion: backstage.io/v1beta2 +kind: Template +metadata: + name: rails-demo + title: Rails template + description: scaffolder Rails app +spec: + owner: backstage/techdocs-core + type: service + + parameters: + - title: Fill in some steps + required: + - name + - owner + properties: + name: + title: Name + type: string + description: Unique name of the component + ui:autofocus: true + ui:options: + rows: 5 + owner: + title: Owner + type: string + description: Owner of the component + ui:field: OwnerPicker + ui:options: + allowedKinds: + - Group + system: + title: System + type: string + description: System of the component + ui:field: EntityPicker + ui:options: + allowedKinds: + - System + defaultKind: System + + - title: Choose a location + required: + - repoUrl + - dryRun + properties: + repoUrl: + title: Repository Location + type: string + ui:field: RepoUrlPicker + ui:options: + allowedHosts: + - github.com + dryRun: + title: Only perform a dry run, don't publish anything + type: boolean + default: false + railsArguments: + title: arguments to run the rails new command + type: object + properties: + minimal: + title: minimal + description: Preconfigure a minimal rails app + type: boolean + skipBundle: + title: skipBundle + description: Don't run bundle install + type: boolean + skipWebpackInstall: + title: skipWebpackInstall + description: Don't run Webpack install + type: boolean + api: + title: api + description: Preconfigure smaller stack for API only apps + type: boolean + template: + title: template + description: Path to some application template (can be a filesystem path or URL) + type: string + default: './rails-template-file.rb' + webpacker: + title: webpacker + description: 'Preconfigure Webpack with a particular framework (options: react, + vue, angular, elm, stimulus)' + type: string + enum: + - react + - vue + - angular + - elm + - stimulus + database: + title: database + description: 'Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)' + type: string + enum: + - mysql + - postgresql + - sqlite3 + - oracle + - sqlserver + - jdbcmysql + - jdbcsqlite3 + - jdbcpostgresql + - jdbc + railsVersion: + title: Rails version in Gemfile + description: 'Set up the application with Gemfile pointing to a specific version + (options: dev, edge, master)' + type: string + enum: + - dev + - edge + - master + + steps: + - id: fetch-base + name: Fetch Base + action: fetch:rails + input: + url: ./template + values: + name: '{{ parameters.name }}' + owner: '{{ parameters.owner }}' + system: '{{ parameters.system }}' + railsArguments: '{{ json parameters.railsArguments }}' + + - name: Write Catalog information + action: catalog:write + input: + component: + apiVersion: 'backstage.io/v1alpha1' + kind: Component + metadata: + name: '{{ parameters.name }}' + annotations: + github.com/project-slug: '{{ projectSlug parameters.repoUrl }}' + spec: + type: service + lifecycle: production + owner: '{{ parameters.owner }}' + + - id: publish + if: '{{ not parameters.dryRun }}' + name: Publish + action: publish:github + input: + allowedHosts: ['github.com'] + description: 'This is {{ parameters.name }}' + repoUrl: '{{ parameters.repoUrl }}' + + - id: register + if: '{{ not parameters.dryRun }}' + name: Register + action: catalog:register + input: + repoContentsUrl: '{{ steps.publish.output.repoContentsUrl }}' + catalogInfoPath: '/catalog-info.yaml' + + - name: Results + if: '{{ parameters.dryRun }}' + action: debug:log + input: + listWorkspace: true + + output: + links: + - title: Repository + url: '{{ steps.publish.output.remoteUrl }}' + - title: Open in catalog + icon: 'catalog' + entityRef: '{{ steps.register.output.entityRef }}' diff --git a/plugins/scaffolder-backend/sample-templates/rails-demo/template/rails-template-file.rb b/plugins/scaffolder-backend/sample-templates/rails-demo/template/rails-template-file.rb new file mode 100644 index 0000000000..90c0d53ddc --- /dev/null +++ b/plugins/scaffolder-backend/sample-templates/rails-demo/template/rails-template-file.rb @@ -0,0 +1,14 @@ +gem_group :development, :test do + gem "rspec" + gem "rspec-rails" +end + +rakefile("example.rake") do + <<-TASK + namespace :example do + task :backstage do + puts "i like backstage!" + end + end + TASK +end diff --git a/plugins/scaffolder-backend/scripts/Rails.dockerfile b/plugins/scaffolder-backend/scripts/Rails.dockerfile new file mode 100644 index 0000000000..3cec0e7668 --- /dev/null +++ b/plugins/scaffolder-backend/scripts/Rails.dockerfile @@ -0,0 +1,9 @@ +FROM ruby:3.0 + +RUN apt-get update -qq && \ + apt-get install -y \ + nodejs \ + postgresql-client \ + git + +RUN gem install rails diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/createBuiltinActions.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/createBuiltinActions.ts index 08d7bbf824..fa2fcbfcee 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/createBuiltinActions.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/createBuiltinActions.ts @@ -24,7 +24,11 @@ import { } from './catalog'; import { createDebugLogAction } from './debug'; -import { createFetchCookiecutterAction, createFetchPlainAction } from './fetch'; +import { + createFetchCookiecutterAction, + createFetchPlainAction, + createFetchRailsAction, +} from './fetch'; import { createFilesystemDeleteAction, createFilesystemRenameAction, @@ -62,6 +66,10 @@ export const createBuiltinActions = (options: { integrations, containerRunner, }), + createFetchRailsAction({ + reader, + integrations, + }), createPublishGithubAction({ integrations, config, diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/index.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/index.ts index 8e0f93f3ab..9557a88a4c 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/index.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/index.ts @@ -16,3 +16,4 @@ export { createFetchPlainAction } from './plain'; export { createFetchCookiecutterAction } from './cookiecutter'; +export { createFetchRailsAction } from './rails'; diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/rails.test.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/rails.test.ts new file mode 100644 index 0000000000..ebc62e9277 --- /dev/null +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/rails.test.ts @@ -0,0 +1,140 @@ +/* + * Copyright 2021 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const mockRailsTemplater = { run: jest.fn() }; +jest.mock('./helpers'); +jest.mock('../../../stages/templater', () => { + return { + Rails: jest.fn().mockImplementation(() => { + return mockRailsTemplater; + }), + }; +}); + +import { getVoidLogger, UrlReader } from '@backstage/backend-common'; +import { ConfigReader } from '@backstage/config'; +import { ScmIntegrations } from '@backstage/integration'; +import mock from 'mock-fs'; +import os from 'os'; +import { resolve as resolvePath } from 'path'; +import { PassThrough } from 'stream'; +import { createFetchRailsAction } from './rails'; +import { fetchContents } from './helpers'; + +describe('fetch:rails', () => { + const integrations = ScmIntegrations.fromConfig( + new ConfigReader({ + integrations: { + azure: [ + { host: 'dev.azure.com', token: 'tokenlols' }, + { host: 'myazurehostnotoken.com' }, + ], + }, + }), + ); + + const mockTmpDir = os.tmpdir(); + const mockContext = { + input: { + url: 'https://rubyonrails.org/generator', + targetPath: 'something', + values: { + help: 'me', + }, + }, + baseUrl: 'somebase', + workspacePath: mockTmpDir, + logger: getVoidLogger(), + logStream: new PassThrough(), + output: jest.fn(), + createTemporaryDirectory: jest.fn().mockResolvedValue(mockTmpDir), + }; + + const mockReader: UrlReader = { + read: jest.fn(), + readTree: jest.fn(), + search: jest.fn(), + }; + + const action = createFetchRailsAction({ + integrations, + reader: mockReader, + }); + + beforeEach(() => { + mock({ [`${mockContext.workspacePath}/result`]: {} }); + jest.restoreAllMocks(); + }); + + afterEach(() => { + mock.restore(); + }); + + it('should call fetchContents with the correct values', async () => { + await action.handler(mockContext); + + expect(fetchContents).toHaveBeenCalledWith({ + reader: mockReader, + integrations, + baseUrl: mockContext.baseUrl, + fetchUrl: mockContext.input.url, + outputPath: resolvePath(mockContext.workspacePath), + }); + }); + + it('should execute the rails templater with the correct values', async () => { + await action.handler(mockContext); + + expect(mockRailsTemplater.run).toHaveBeenCalledWith({ + workspacePath: mockTmpDir, + logStream: mockContext.logStream, + values: mockContext.input.values, + }); + }); + + it('should execute the rails templater with optional inputs if they are present and valid', async () => { + await action.handler({ + ...mockContext, + input: { + ...mockContext.input, + imageName: 'foo/rails-custom-image', + }, + }); + + expect(mockRailsTemplater.run).toHaveBeenCalledWith({ + workspacePath: mockTmpDir, + logStream: mockContext.logStream, + values: { + ...mockContext.input.values, + imageName: 'foo/rails-custom-image', + }, + }); + }); + + it('should throw if the target directory is outside of the workspace path', async () => { + await expect( + action.handler({ + ...mockContext, + input: { + ...mockContext.input, + targetPath: '/foo', + }, + }), + ).rejects.toThrow( + /targetPath may not specify a path outside the working directory/, + ); + }); +}); diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/rails.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/rails.ts new file mode 100644 index 0000000000..203db5004e --- /dev/null +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/rails.ts @@ -0,0 +1,182 @@ +/* + * Copyright 2021 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { DockerContainerRunner, UrlReader } from '@backstage/backend-common'; +import { JsonObject } from '@backstage/config'; +import { InputError } from '@backstage/errors'; +import { ScmIntegrations } from '@backstage/integration'; +import fs from 'fs-extra'; +import { resolve as resolvePath } from 'path'; +import { Rails, TemplaterValues } from '../../../stages/templater'; +import { createTemplateAction } from '../../createTemplateAction'; +import { fetchContents } from './helpers'; +import Docker from 'dockerode'; + +export function createFetchRailsAction(options: { + reader: UrlReader; + integrations: ScmIntegrations; +}) { + const { reader, integrations } = options; + + return createTemplateAction<{ + url: string; + targetPath?: string; + values: JsonObject; + imageName?: string; + }>({ + id: 'fetch:rails', + description: + 'Downloads a template from the given URL into the workspace, and runs a rails generator on it.', + schema: { + input: { + type: 'object', + required: ['url'], + properties: { + url: { + title: 'Fetch URL', + description: + 'Relative path or absolute URL pointing to the directory tree to fetch', + type: 'string', + }, + targetPath: { + title: 'Target Path', + description: + 'Target path within the working directory to download the contents to.', + type: 'string', + }, + values: { + title: 'Template Values', + description: 'Values to pass on to rails for templating', + type: 'object', + properties: { + railsArguments: { + title: 'Arguments to pass to new command', + description: + 'You can provide some arguments to create a custom app', + type: 'object', + properties: { + minimal: { + title: 'minimal', + description: 'Preconfigure a minimal rails app', + type: 'boolean', + }, + skipBundle: { + title: 'skipBundle', + description: "Don't run bundle install", + type: 'boolean', + }, + skipWebpackInstall: { + title: 'skipWebpackInstall', + description: "Don't run Webpack install", + type: 'boolean', + }, + api: { + title: 'api', + description: 'Preconfigure smaller stack for API only apps', + type: 'boolean', + }, + template: { + title: 'template', + description: + 'Path to some application template (can be a filesystem path or URL)', + type: 'string', + }, + webpacker: { + title: 'webpacker', + description: + 'Preconfigure Webpack with a particular framework (options: react, vue, angular, elm, stimulus)', + type: 'string', + enum: ['react', 'vue', 'angular', 'elm', 'stimulus'], + }, + database: { + title: 'database', + description: + 'Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)', + type: 'string', + enum: [ + 'mysql', + 'postgresql', + 'sqlite3', + 'oracle', + 'sqlserver', + 'jdbcmysql', + 'jdbcsqlite3', + 'jdbcpostgresql', + 'jdbc', + ], + }, + railsVersion: { + title: 'Rails version in Gemfile', + description: + 'Set up the application with Gemfile pointing to a specific version (options: fromImage, dev, edge, master)', + type: 'string', + enum: ['dev', 'edge', 'master', 'fromImage'], + }, + }, + }, + }, + }, + imageName: { + title: 'Rails Docker image', + description: + 'Specify a Docker image to run rails new. Used only when a local rails is not found.', + type: 'string', + }, + }, + }, + }, + async handler(ctx) { + ctx.logger.info('Fetching and then templating using rails'); + + const workDir = await ctx.createTemporaryDirectory(); + const resultDir = resolvePath(workDir, 'result'); + + await fetchContents({ + reader, + integrations, + baseUrl: ctx.baseUrl, + fetchUrl: ctx.input.url, + outputPath: workDir, + }); + + const dockerClient = new Docker(); + const containerRunner = new DockerContainerRunner({ dockerClient }); + const templateRunner = new Rails({ containerRunner }); + + const values = { + ...(ctx.input.values as TemplaterValues), + imageName: ctx.input.imageName, + }; + + // Will execute the template in ./template and put the result in ./result + await templateRunner.run({ + workspacePath: workDir, + logStream: ctx.logStream, + values, + }); + + // Finally move the template result into the task workspace + const targetPath = ctx.input.targetPath ?? './'; + const outputPath = resolvePath(ctx.workspacePath, targetPath); + if (!outputPath.startsWith(ctx.workspacePath)) { + throw new InputError( + `Fetch action targetPath may not specify a path outside the working directory`, + ); + } + await fs.copy(resultDir, outputPath); + }, + }); +} diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/templater/index.ts b/plugins/scaffolder-backend/src/scaffolder/stages/templater/index.ts new file mode 100644 index 0000000000..139ff2207e --- /dev/null +++ b/plugins/scaffolder-backend/src/scaffolder/stages/templater/index.ts @@ -0,0 +1,21 @@ +/* + * Copyright 2020 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export * from './cookiecutter'; +export * from './types'; +export * from './helpers'; +export * from './templaters'; +export * from './cra'; +export * from './rails'; diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/index.test.ts b/plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/index.test.ts new file mode 100644 index 0000000000..534899eec1 --- /dev/null +++ b/plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/index.test.ts @@ -0,0 +1,257 @@ +/* + * Copyright 2021 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const runCommand = jest.fn(); +const commandExists = jest.fn(); + +jest.mock('../helpers', () => ({ runCommand })); +jest.mock('command-exists', () => commandExists); +jest.mock('fs-extra'); + +import { ContainerRunner } from '@backstage/backend-common'; +import fs from 'fs-extra'; + +import path from 'path'; +import { PassThrough } from 'stream'; + +import { Rails } from './index'; + +describe('Rails Templater', () => { + const containerRunner: jest.Mocked = { + runContainer: jest.fn(), + }; + + beforeEach(() => { + jest.clearAllMocks(); + }); + + describe('when running on docker', () => { + it('should run the correct bindings for the volumes', async () => { + const values = { + owner: 'angeliski', + storePath: 'https://github.com/angeliski/rails-project', + name: 'rails-project', + imageName: 'foo/rails-custom-image', + }; + + jest.spyOn(fs, 'readdir').mockResolvedValueOnce(['newthing'] as any); + jest + .spyOn(fs, 'realpath') + .mockImplementation(x => Promise.resolve(x.toString())); + + const templater = new Rails({ containerRunner }); + await templater.run({ + workspacePath: 'tempdir', + values, + }); + + expect(containerRunner.runContainer).toHaveBeenCalledWith({ + imageName: 'foo/rails-custom-image', + command: 'rails', + args: ['new', '/output/rails-project'], + envVars: { HOME: '/tmp' }, + mountDirs: { + ['tempdir']: '/input', + [path.join('tempdir', 'intermediate')]: '/output', + }, + workingDir: '/input', + logStream: undefined, + }); + }); + + it('should use the provided imageName', async () => { + const values = { + owner: 'angeliski', + storePath: 'https://github.com/angeliski/rails-project', + name: 'rails-project', + imageName: 'foo/rails-custom-image', + }; + + jest.spyOn(fs, 'readdir').mockResolvedValueOnce(['newthing'] as any); + + const templater = new Rails({ containerRunner }); + await templater.run({ + workspacePath: 'tempdir', + values, + }); + + expect(containerRunner.runContainer).toHaveBeenCalledWith( + expect.objectContaining({ + imageName: 'foo/rails-custom-image', + }), + ); + }); + + it('should pass through the streamer to the run docker helper', async () => { + const stream = new PassThrough(); + + const values = { + owner: 'angeliski', + storePath: 'https://github.com/angeliski/rails-project', + name: 'rails-project', + imageName: 'foo/rails-custom-image', + }; + + jest.spyOn(fs, 'readdir').mockResolvedValueOnce(['newthing'] as any); + + const templater = new Rails({ containerRunner }); + await templater.run({ + workspacePath: 'tempdir', + values, + logStream: stream, + }); + + expect(containerRunner.runContainer).toHaveBeenCalledWith({ + imageName: 'foo/rails-custom-image', + command: 'rails', + args: ['new', '/output/rails-project'], + envVars: { HOME: '/tmp' }, + mountDirs: { + ['tempdir']: '/input', + [path.join('tempdir', 'intermediate')]: '/output', + }, + workingDir: '/input', + logStream: stream, + }); + }); + + it('update the template path to correct location', async () => { + const values = { + owner: 'angeliski', + storePath: 'https://github.com/angeliski/rails-project', + name: 'rails-project', + railsArguments: { template: './something.rb' }, + imageName: 'foo/rails-custom-image', + }; + + jest.spyOn(fs, 'readdir').mockResolvedValueOnce(['newthing'] as any); + jest + .spyOn(fs, 'realpath') + .mockImplementation(x => Promise.resolve(x.toString())); + + const templater = new Rails({ containerRunner }); + await templater.run({ + workspacePath: 'tempdir', + values, + }); + + expect(containerRunner.runContainer).toHaveBeenCalledWith({ + imageName: 'foo/rails-custom-image', + command: 'rails', + args: [ + 'new', + '/output/rails-project', + '--template', + '/input/something.rb', + ], + envVars: { HOME: '/tmp' }, + mountDirs: { + ['tempdir']: '/input', + [path.join('tempdir', 'intermediate')]: '/output', + }, + workingDir: '/input', + logStream: undefined, + }); + }); + }); + + describe('when rails is available', () => { + it('use the binary', async () => { + const stream = new PassThrough(); + + const values = { + owner: 'angeliski', + storePath: 'https://github.com/angeliski/rails-project', + name: 'rails-project', + imageName: 'foo/rails-custom-image', + }; + + jest.spyOn(fs, 'readdir').mockResolvedValueOnce(['newthing'] as any); + commandExists.mockImplementationOnce(() => () => true); + + const templater = new Rails({ containerRunner }); + await templater.run({ + workspacePath: 'tempdir', + values, + logStream: stream, + }); + + expect(runCommand).toHaveBeenCalledWith({ + command: 'rails', + args: expect.arrayContaining([ + 'new', + path.join('tempdir', 'intermediate', 'rails-project'), + ]), + logStream: stream, + }); + }); + it('update the template path to correct location', async () => { + const stream = new PassThrough(); + + const values = { + owner: 'angeliski', + storePath: 'https://github.com/angeliski/rails-project', + name: 'rails-project', + railsArguments: { template: './something.rb' }, + imageName: 'foo/rails-custom-image', + }; + + jest.spyOn(fs, 'readdir').mockResolvedValueOnce(['newthing'] as any); + commandExists.mockImplementationOnce(() => () => true); + + const templater = new Rails({ containerRunner }); + await templater.run({ + workspacePath: 'tempdir', + values, + logStream: stream, + }); + + expect(runCommand).toHaveBeenCalledWith({ + command: 'rails', + args: expect.arrayContaining([ + 'new', + path.join('tempdir', 'intermediate', 'rails-project'), + '--template', + path.join('tempdir', './something.rb'), + ]), + logStream: stream, + }); + }); + }); + + describe('when nothing was generated', () => { + it('throws an error', async () => { + const stream = new PassThrough(); + + jest + .spyOn(fs, 'readdir') + .mockImplementationOnce(() => Promise.resolve([])); + + const templater = new Rails({ containerRunner }); + await expect( + templater.run({ + workspacePath: 'tempdir', + values: { + owner: 'angeliski', + storePath: 'https://github.com/angeliski/rails-project', + name: 'rails-project', + imageName: 'foo/rails-custom-image', + }, + logStream: stream, + }), + ).rejects.toThrow(/No data generated by rails/); + }); + }); +}); diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/index.ts b/plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/index.ts new file mode 100644 index 0000000000..57ee26e106 --- /dev/null +++ b/plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/index.ts @@ -0,0 +1,96 @@ +/* + * Copyright 2021 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { ContainerRunner } from '@backstage/backend-common'; +import fs from 'fs-extra'; +import path from 'path'; +import { runCommand } from '../helpers'; +import commandExists from 'command-exists'; +import { TemplaterBase, TemplaterRunOptions } from '../types'; +import { railsArgumentResolver } from './railsArgumentResolver'; + +export class Rails implements TemplaterBase { + private readonly containerRunner: ContainerRunner; + + constructor({ containerRunner }: { containerRunner: ContainerRunner }) { + this.containerRunner = containerRunner; + } + + public async run({ + workspacePath, + values, + logStream, + }: TemplaterRunOptions): Promise { + const intermediateDir = path.join(workspacePath, 'intermediate'); + await fs.ensureDir(intermediateDir); + const resultDir = path.join(workspacePath, 'result'); + + const { name, imageName, railsArguments } = values; + + // Directories to bind on container + const mountDirs = { + [workspacePath]: '/input', + [intermediateDir]: '/output', + }; + + const baseCommand = 'rails'; + const baseArguments = ['new']; + const commandExistsToRun = await commandExists(baseCommand); + + if (commandExistsToRun) { + const arrayExtraArguments = railsArgumentResolver( + workspacePath, + railsArguments, + ); + + await runCommand({ + command: baseCommand, + args: [ + ...baseArguments, + `${intermediateDir}/${name}`, + ...arrayExtraArguments, + ], + logStream, + }); + } else { + const arrayExtraArguments = railsArgumentResolver( + '/input', + railsArguments, + ); + await this.containerRunner.runContainer({ + imageName: imageName, + command: baseCommand, + args: [...baseArguments, `/output/${name}`, ...arrayExtraArguments], + mountDirs, + workingDir: '/input', + // Set the home directory inside the container as something that applications can + // write to, otherwise they will just fail trying to write to / + envVars: { HOME: '/tmp' }, + logStream, + }); + } + + // if command was successful, intermediateDir should contain + // exactly one directory. + const [generated] = await fs.readdir(intermediateDir); + + if (generated === undefined) { + throw new Error(`No data generated by ${baseCommand}`); + } + + await fs.move(path.join(intermediateDir, generated), resultDir); + } +} diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/railsArgumentResolver.test.ts b/plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/railsArgumentResolver.test.ts new file mode 100644 index 0000000000..370d9de380 --- /dev/null +++ b/plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/railsArgumentResolver.test.ts @@ -0,0 +1,50 @@ +/* + * Copyright 2021 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { railsArgumentResolver } from './railsArgumentResolver'; +import { TemplaterValues } from '../types'; + +describe('railsArgumentResolver', () => { + describe('when provide the parameter', () => { + test.each([ + [{}, []], + [{ minimal: true }, ['--minimal']], + [{ api: true }, ['--api']], + [{ skipBundle: true }, ['--skip-bundle']], + [{ skipWebpackInstall: true }, ['--skip-webpack-install']], + [{ webpacker: 'vue' }, ['--webpack', 'vue']], + [{ database: 'postgresql' }, ['--database', 'postgresql']], + [{ railsVersion: 'dev' }, ['--dev']], + [{ template: './rails.rb' }, ['--template', '/tmp/rails.rb']], + ])( + 'should include the argument to execution %p -> %p', + (passedArguments: object, expected: Array) => { + // that step is to ensure the validation between the TemplaterValues and the resolver + const values: TemplaterValues = { + owner: 'r', + storePath: '', + railsArguments: passedArguments, + }; + + const { railsArguments } = values; + + const argumentsToRun = railsArgumentResolver('/tmp', railsArguments); + + expect(argumentsToRun).toEqual(expected); + }, + ); + }); +}); diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/railsArgumentResolver.ts b/plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/railsArgumentResolver.ts new file mode 100644 index 0000000000..5ea2f70895 --- /dev/null +++ b/plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/railsArgumentResolver.ts @@ -0,0 +1,106 @@ +/* + * Copyright 2021 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +enum Webpacker { + react = 'react', + vue = 'vue', + angular = 'angular', + elm = 'elm', + stimulus = 'stimulus', +} + +enum Database { + mysql = 'mysql', + postgresql = 'postgresql', + sqlite3 = 'sqlite3', + oracle = 'oracle', + sqlserver = 'sqlserver', + jdbcmysql = 'jdbcmysql', + jdbcsqlite3 = 'jdbcsqlite3', + jdbcpostgresql = 'jdbcpostgresql', + jdbc = 'jdbc', +} + +enum RailsVersion { + dev = 'dev', + edge = 'edge', + master = 'master', + fromImage = 'fromImage', +} + +export type RailsRunOptions = { + minimal?: boolean; + api?: boolean; + template?: string; + webpacker?: Webpacker; + database?: Database; + railsVersion?: RailsVersion; + skipBundle?: boolean; + skipWebpackInstall?: boolean; +}; + +export const railsArgumentResolver = ( + projectRoot: string, + options: RailsRunOptions, +): string[] => { + const argumentsToRun: string[] = []; + + if (options?.minimal) { + argumentsToRun.push('--minimal'); + } + + if (options?.api) { + argumentsToRun.push('--api'); + } + + if (options?.skipBundle) { + argumentsToRun.push('--skip-bundle'); + } + + if (options?.skipWebpackInstall) { + argumentsToRun.push('--skip-webpack-install'); + } + + if ( + options?.webpacker && + Object.values(Webpacker).includes(options?.webpacker as Webpacker) + ) { + argumentsToRun.push('--webpack'); + argumentsToRun.push(options.webpacker); + } + + if ( + options?.database && + Object.values(Database).includes(options?.database as Database) + ) { + argumentsToRun.push('--database'); + argumentsToRun.push(options.database); + } + + if ( + options?.railsVersion !== RailsVersion.fromImage && + Object.values(RailsVersion).includes(options?.railsVersion as RailsVersion) + ) { + argumentsToRun.push(`--${options.railsVersion}`); + } + + if (options?.template) { + argumentsToRun.push('--template'); + argumentsToRun.push(options.template.replace('./', `${projectRoot}/`)); + } + + return argumentsToRun; +}; From aad73cf398fcc63ab4e182b3a38fd3b422da3cb9 Mon Sep 17 00:00:00 2001 From: Rogerio Angeliski Date: Fri, 18 Jun 2021 11:54:19 -0300 Subject: [PATCH 130/168] fix: move dep to correction location Signed-off-by: Rogerio Angeliski --- plugins/scaffolder-backend/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/scaffolder-backend/package.json b/plugins/scaffolder-backend/package.json index 0bc4c62ea6..a6db486594 100644 --- a/plugins/scaffolder-backend/package.json +++ b/plugins/scaffolder-backend/package.json @@ -41,7 +41,6 @@ "@types/express": "^4.17.6", "azure-devops-node-api": "^10.2.2", "@types/git-url-parse": "^9.0.0", - "@types/dockerode": "^3.2.1", "azure-devops-node-api": "^10.1.1", "command-exists": "^1.2.9", "compression": "^1.7.4", @@ -74,6 +73,7 @@ "@types/git-url-parse": "^9.0.0", "@types/mock-fs": "^4.13.0", "@types/supertest": "^2.0.8", + "@types/dockerode": "^3.2.1", "jest-when": "^3.1.0", "mock-fs": "^4.13.0", "msw": "^0.29.0", From c5e81eab43c5ecf5774d0780561867caff34f4bd Mon Sep 17 00:00:00 2001 From: Rogerio Angeliski Date: Thu, 24 Jun 2021 12:00:43 -0300 Subject: [PATCH 131/168] refactor to a isolated module Signed-off-by: Rogerio Angeliski --- .changeset/twelve-deers-explode.md | 2 +- .../scaffolder-backend-module-rails.yaml | 9 + microsite/static/img/rails-icon.png | Bin 0 -> 5439 bytes packages/backend/package.json | 2 + .../.eslintrc.js | 3 + .../scaffolder-backend-module-rails/README.md | 225 ++++++++++++++++++ .../Rails.dockerfile | 0 .../api-report.md | 22 ++ .../package.json | 44 ++++ .../src/actions/fetch/index.ts | 16 ++ .../src/actions/fetch/rails/index.test.ts} | 23 +- .../src/actions/fetch/rails/index.ts} | 23 +- .../rails/railsArgumentResolver.test.ts | 3 +- .../fetch}/rails/railsArgumentResolver.ts | 0 .../fetch/rails/railsNewRunner.test.ts} | 28 ++- .../actions/fetch/rails/railsNewRunner.ts} | 24 +- .../src/actions/index.ts | 16 ++ .../src/index.ts | 16 ++ plugins/scaffolder-backend/api-report.md | 6 +- plugins/scaffolder-backend/package.json | 4 +- .../actions/builtin/createBuiltinActions.ts | 10 +- .../scaffolder/actions/builtin/fetch/index.ts | 2 +- .../src/scaffolder/stages/templater/index.ts | 1 - 23 files changed, 423 insertions(+), 56 deletions(-) create mode 100644 microsite/data/plugins/scaffolder-backend-module-rails.yaml create mode 100644 microsite/static/img/rails-icon.png create mode 100644 plugins/scaffolder-backend-module-rails/.eslintrc.js create mode 100644 plugins/scaffolder-backend-module-rails/README.md rename plugins/{scaffolder-backend/scripts => scaffolder-backend-module-rails}/Rails.dockerfile (100%) create mode 100644 plugins/scaffolder-backend-module-rails/api-report.md create mode 100644 plugins/scaffolder-backend-module-rails/package.json create mode 100644 plugins/scaffolder-backend-module-rails/src/actions/fetch/index.ts rename plugins/{scaffolder-backend/src/scaffolder/actions/builtin/fetch/rails.test.ts => scaffolder-backend-module-rails/src/actions/fetch/rails/index.test.ts} (86%) rename plugins/{scaffolder-backend/src/scaffolder/actions/builtin/fetch/rails.ts => scaffolder-backend-module-rails/src/actions/fetch/rails/index.ts} (90%) rename plugins/{scaffolder-backend/src/scaffolder/stages/templater => scaffolder-backend-module-rails/src/actions/fetch}/rails/railsArgumentResolver.test.ts (95%) rename plugins/{scaffolder-backend/src/scaffolder/stages/templater => scaffolder-backend-module-rails/src/actions/fetch}/rails/railsArgumentResolver.ts (100%) rename plugins/{scaffolder-backend/src/scaffolder/stages/templater/rails/index.test.ts => scaffolder-backend-module-rails/src/actions/fetch/rails/railsNewRunner.test.ts} (89%) rename plugins/{scaffolder-backend/src/scaffolder/stages/templater/rails/index.ts => scaffolder-backend-module-rails/src/actions/fetch/rails/railsNewRunner.ts} (84%) create mode 100644 plugins/scaffolder-backend-module-rails/src/actions/index.ts create mode 100644 plugins/scaffolder-backend-module-rails/src/index.ts diff --git a/.changeset/twelve-deers-explode.md b/.changeset/twelve-deers-explode.md index c5ce1318a6..0d34392eab 100644 --- a/.changeset/twelve-deers-explode.md +++ b/.changeset/twelve-deers-explode.md @@ -2,4 +2,4 @@ '@backstage/plugin-scaffolder-backend': patch --- -Created a Rails templater to scaffold apps +Export the `fetchContents` from scaffolder-backend diff --git a/microsite/data/plugins/scaffolder-backend-module-rails.yaml b/microsite/data/plugins/scaffolder-backend-module-rails.yaml new file mode 100644 index 0000000000..5f5a29cf3c --- /dev/null +++ b/microsite/data/plugins/scaffolder-backend-module-rails.yaml @@ -0,0 +1,9 @@ +--- +title: Scaffolder Backend Module Rails +author: Rogerio Angeliski +authorUrl: https://angeliski.com.br/ +category: Scaffolder +description: Here you can find all Rails related features to improve your scaffolder. +documentation: https://github.com/backstage/backstage/blob/master/plugins/scaffolder-backend-module-rails/README.md +iconUrl: img/rails-icon.png +npmPackageName: '@backstage/plugin-scaffolder-backend-module-rails' diff --git a/microsite/static/img/rails-icon.png b/microsite/static/img/rails-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..f7b8b69bd9695a8dc98b7bb4b5f848e2ab6eccdf GIT binary patch literal 5439 zcmV-F6~O9=P){007Ad0{{R3(jK%j0002AP)t-s|NsBZ zASdwf@bB;M`T6g=R z(K9;PZ*tXRXV`Uk?A_h`^787kv+B{()naAu#m3JpGS4S2PzMoZgscI3Rh=cT68 zQ&!=bo8qdh+>ep?m_NS>E5&j@ji3TJ1-Z@WWFY|WHK25V6E9uRkfk9t`>9w@3whYWv#`# zkaZ#Nw)n@q+vX1^Q)}+2sRA_^Q1eNsMM#ujNK2*$ezE^z{~u$IJ|_;>M7gOXg(8Wp zmDs39vow-5ONiPp_WvjL!^(R|yaEy+AfW}{i^=<;8PaG2O%+0@YP|7oGw8P2BLK2) zYu|;CcUwWXy(f`CjXx2g1{pN~CZDU<*RvtmlK|-?q71<}Luvv;S_(CgyAs<$H@*@Z zNh`5{eOG;pyhI2&mW6tGi#gHRN@1w5eU}*O0Dj#NnF?*@6DJW>3;(!J`>r$W3cCDe z?9u1a)_mB7thDCAnWej~Yw$&%{`v^aT=Nlz3a@#t0NPwzczS_%JzdAU?V#J@-BzRv zb4jFA16#X$`}gl?umK4qc3ph2@;I%FA&?5|APu;K6uF|kWf-we*;cz&f()PI>4i|I@U^>BJ5(|S_1Jg#$pM;%&GZT%Q ziP*u-dh{@Rw5f?l7H#bR#%y*wI(wb8LktZa&k~w7&-)?e9pdTCG4=D78X`g8i1ugG zMUHLgrpaOL8vUnh*bXwTH&fY!nT8B-m z;UbfvJWRXb&0*~O2l9ZR?T&=1fvY=2VPpZ{zW~=l=e;q(1QM_~J4bz7uYFIJo0|N( zt~a^*%%cYJXU}omLcsl|8_1czs+dt5e~@wveTz@KRBV+U`JqNCA*fBgD_TxsAwd;>kcEs9{zbFvfGyz0p!doJk4b|0D81v@5? z=%e>fZ^6ExOzoBn-$r+1rua)Rq($NR*bnQ|lI@algg@V_A?N5_bbeKpp`-h>lX-RI zyy=d8u>h(pL*E#yd^3z%kh5mmc5i~=55a!fcjR?@7J35>CRnWl`vK%#I8-5^SJQG2 zp|^Sy8HUp2y?w|AR*!bAlfFl9ylGlx?u7RTg7>FI-(Mp#p~691YQ9|VA6;M;)ckiTAwPw#f~9@o6Eis1k%wN zPG%?(lfUMZFq$`E-)%-$PDG)B!B zTF!Qg)uh($h<+W1t|-ofHx!)AWX-x^(=Cb5?X~x1=TDTO#$>V`FE?2>J+b;`B0!|(!p_}Md;C9NDr0Lwn8B((t!s|!NLvJW6ERVgEyg#EohAS$T z(zC8RSK>ApA|8>Of5|dL$c5o)J=0lZwXnQrq%vgXFYs>P_CcUEZUe0^3Eeoq$6_`F zxVBMu3Nevq2xvVo_-``hQxH?gzN;ZynD5(=zuv?<&zQc-j-;AHw}gbGOIu!F#!f*p zPyPgkz-Px(dR7NSj;`XEYVc`Qy6Wk8_M8eCxU=)XhMI{!a743I%PEC;s_?gOJWj|_ zeA+28-FLzqSvhacL`#r-QdAaugKEtI-$UsJ)p)W#t?*o-HP5&mJIVyA_(RTzH_@N0 zT;ie`oKc4G<;>zP!YfW#^TF%$slmh))#8b=V0%gEa+8M+G^W(znY+AOHgi|=!lS0A ze6ulmZ=_P(hE2>?a?^^Y)H}uV;f`9-bn7Bc_Ue%-9_nZx+NbrFQL|VcMF9N*^Q~?t zyb|llDJ5_~XTn4`WKZpovC0=Y!|wF3ryQxiJH#C^{AJks7dS?o7LVjqywRZ~@Wx@` zrr}}k$1VOYjuNLOvU*OT`i!jkm)uU~$zM5!itk~o-dfYPl7}y7g(<;QMak zRgYQCq^BcD`5X48IwgT=u!JZiau+=I(^#XV%IdOL_s>!1H7X)u#J28gYUrzOLE1VPxzmy`5@`lP-!RsNX-ZEA$jI#8r8h#+Fjq$Hcp+$9+vX;)Nv6e)|k6tdE{K;S8%S!=?gWZo)q?5?dLWTDT-D!Jj zC*{{=VGm`!kqhZ**Iz(`oY{&o+nyx$5G8S-nh)fa88p|j2RDT8 z6y&8{LG*iLZWm2^qWZJ(-8L@Yw^8wf=f0W-QYLg6Egfm-`U`G=H@;l-K0X!SrU3T) zy&pr3H2w5Re%g&W1$@U}p)vSD*l}+koHtGrI54;S^+=L3R6E z0^>E@%sEcY2mHBlm-H)T3>^1pL)4n49YEeb5^-N!yy{TosA&PL2XIq&F-3hU1&D4CN#!Sw5rH~^DfA1xh3zp zv@zp+Qhr??cKo;GrS^XSyIRVhJ$>v2jP(20WMas zAxc7%CsDlS11W9cXhV#I|L)xP!ai*#Lr3&!%WmBR?B^bK7O##<;fecoC8Je7c6I~u z!6RVWiyw!*w1s2XS*&vIFC27vV%YP<3$7}NyBDYZ@UdIVQ<3+g^%2TjcZHq3Vo0w1 z6CGoKa}z2`7NN*b&nQ*%VP2)itTCc4&G5nD$2H zpzZC9wF};&-M6577VW;ByUx#V#{c2ID7*{RrYE zP&*NyHsi|K_uN{mmqZq(y6coSQUgvhXV5>S<^w1yg(rCa{)_$pi9Ofbl1g)ERB_mT zR?P=_8}}1^+Kk2g<9(Z7?Ehcv(dR;ULQ|cVxW|z)RIbNyvNa#t$MQ6f=lT}Vz7y6K zyhXacl}I)zg#GfZztzS2Zdids|5NW*HN1%-Sp1%vZFE&ONtD__TT{m2~9%y333x zrEZ|}WwZn`r*_pxw#$ALM`*5Lq5hf`V)n6ugr1C*K);1RTM8g zG&2ryOtjgZ%Sd34%lq&#{_NaT*%RUxP#V+O37Q=3$E!+)N;F`3(!PT%2 zbC{CGUVhEf!ESejD2r6@G@oF#HQ&n-t72XJn1^v)v3%0aEx-PK@ zMP7OJ6E;iMLa4`3O5&;9^AhH9_*0K?cdF+>z9 z+i0)(<}{3bs0QXVg1w4;4`V-A&4&c+d$|c+ppnI1#jg{wzlD+^pr97&^=Tv6=ih~0 zkQM#2hOFR9l5~tPOU5l(b?$RC&d)^QF*n{K5X}x#S^+-hIed5apYtu^D z!*N;_&ol3FnCP>afvI54hh{PC=*BDS&N*8W&n76@42n$avL7>D35WIiX|3X?0_`ccYGnU4{5-FykR4#|tNk z)SN%Zz;0USL+~BgJr{30zG3ZkJRXa>hSk3=h&@#{)KxYZ(?-ub?HiZ(bnHp;jwR$> zuup_Q$P?8yVQh*$SKgEDyI@W;=iNk)&qM4_0f^c6bnMK=sYPrYjNA9XQ4jA!pcp6h zO8r-?`H+R(oDCx@vEX&-s=iHfT231FxNp-aaH8N3xaQ4Sv_1Z%?kLN+W4rODhb+WR^_mZG6^dPeK>~PhC04g_ zai2Ec+&ebfb?)t4v{mc%X<5uFzJcQ4lYJXUNJtBvNfq>MN@J(~d|(Rei__l5VkS)C zC1SU}?pfOoS-U6^uPcq63eX{9)c7uz?|}x%*wL2oEFVrSw0}P|cC^(BV^5V0vWjAd zuoDO0OWecyLg&Y6L)Z^1@5a22nh%jUt;+Hj5;CbMcut}f((~vN?9)1;aT}`Vaa7N< z@y@eTDkyeJD+jx&tF_d8NQ_Z;lfZ*`%<7Yq;N~=Rjl8IRPr!alMG$H z%aV|l_;~j|_+>NlNBGP82i0|I=%dd28-MsVPFHO2BTa>Pko?E%(UhNz)m8Jsvj@UH zO1O@O!}};qg0BCmK!S+Rk^~Z3z(r((78;`+{hrumKYa9iKkoOA*e~{yKJ9PKhu@kH pzcn99O5q9K{r|=Oi~WCw{XY#6v!hb+MnC`n002ovPDHLkV1m;~1}Xpm literal 0 HcmV?d00001 diff --git a/packages/backend/package.json b/packages/backend/package.json index ed6fbd56b5..c3e693865f 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -31,6 +31,7 @@ "@backstage/catalog-client": "^0.3.15", "@backstage/catalog-model": "^0.8.2", "@backstage/config": "^0.1.5", + "@backstage/integration": "^0.5.6", "@backstage/plugin-app-backend": "^0.3.13", "@backstage/plugin-auth-backend": "^0.3.15", "@backstage/plugin-badges-backend": "^0.1.6", @@ -42,6 +43,7 @@ "@backstage/plugin-proxy-backend": "^0.2.9", "@backstage/plugin-rollbar-backend": "^0.1.11", "@backstage/plugin-scaffolder-backend": "^0.12.4", + "@backstage/plugin-scaffolder-backend-module-rails": "^0.1.1", "@backstage/plugin-search-backend": "^0.2.0", "@backstage/plugin-search-backend-node": "^0.2.0", "@backstage/plugin-techdocs-backend": "^0.8.5", diff --git a/plugins/scaffolder-backend-module-rails/.eslintrc.js b/plugins/scaffolder-backend-module-rails/.eslintrc.js new file mode 100644 index 0000000000..16a033dbc6 --- /dev/null +++ b/plugins/scaffolder-backend-module-rails/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + extends: [require.resolve('@backstage/cli/config/eslint.backend')], +}; diff --git a/plugins/scaffolder-backend-module-rails/README.md b/plugins/scaffolder-backend-module-rails/README.md new file mode 100644 index 0000000000..3c0c9da53e --- /dev/null +++ b/plugins/scaffolder-backend-module-rails/README.md @@ -0,0 +1,225 @@ +# scaffolder-backend-module-rails + +Welcome to the Rails Module for Scaffolder. + +Here you can find all Rails related features to improve your scaffolder: + +- Rails Action to use the `new` command +- More features are coming + +## Getting started + +You need to configure the action in your backend: + +``` +yarn add @backstage/plugin-scaffolder-backend-module-rails +``` + +Configure the action (you can check +the [docs](https://backstage.io/docs/features/software-templates/writing-custom-actions#registering-custom-actions) to +see all options): + +```typescript +const actions = [ + createFetchRailsAction({ + integrations, + reader, + containerRunner, + }), +]; + +return await createRouter({ + preparers, + templaters, + publishers, + logger, + config, + database, + catalogClient, + reader, + actions, +}); +``` + +After that you can use the action in your template: + +```yaml +apiVersion: backstage.io/v1beta2 +kind: Template +metadata: + name: rails-demo + title: Rails template + description: scaffolder Rails app +spec: + owner: backstage/techdocs-core + type: service + + parameters: + - title: Fill in some steps + required: + - name + - owner + properties: + name: + title: Name + type: string + description: Unique name of the component + ui:autofocus: true + ui:options: + rows: 5 + owner: + title: Owner + type: string + description: Owner of the component + ui:field: OwnerPicker + ui:options: + allowedKinds: + - Group + system: + title: System + type: string + description: System of the component + ui:field: EntityPicker + ui:options: + allowedKinds: + - System + defaultKind: System + + - title: Choose a location + required: + - repoUrl + - dryRun + properties: + repoUrl: + title: Repository Location + type: string + ui:field: RepoUrlPicker + ui:options: + allowedHosts: + - github.com + dryRun: + title: Only perform a dry run, don't publish anything + type: boolean + default: false + railsArguments: + title: arguments to run the rails new command + type: object + properties: + minimal: + title: minimal + description: Preconfigure a minimal rails app + type: boolean + skipBundle: + title: skipBundle + description: Don't run bundle install + type: boolean + skipWebpackInstall: + title: skipWebpackInstall + description: Don't run Webpack install + type: boolean + api: + title: api + description: Preconfigure smaller stack for API only apps + type: boolean + template: + title: template + description: Path to some application template (can be a filesystem path or URL) + type: string + default: './rails-template-file.rb' + webpacker: + title: webpacker + description: + 'Preconfigure Webpack with a particular framework (options: react, + vue, angular, elm, stimulus)' + type: string + enum: + - react + - vue + - angular + - elm + - stimulus + database: + title: database + description: 'Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)' + type: string + enum: + - mysql + - postgresql + - sqlite3 + - oracle + - sqlserver + - jdbcmysql + - jdbcsqlite3 + - jdbcpostgresql + - jdbc + railsVersion: + title: Rails version in Gemfile + description: + 'Set up the application with Gemfile pointing to a specific version + (options: dev, edge, master)' + type: string + enum: + - dev + - edge + - master + + steps: + - id: fetch-base + name: Fetch Base + action: fetch:rails + input: + url: ./template + values: + name: '{{ parameters.name }}' + owner: '{{ parameters.owner }}' + system: '{{ parameters.system }}' + railsArguments: '{{ json parameters.railsArguments }}' + + - name: Write Catalog information + action: catalog:write + input: + component: + apiVersion: 'backstage.io/v1alpha1' + kind: Component + metadata: + name: '{{ parameters.name }}' + annotations: + github.com/project-slug: '{{ projectSlug parameters.repoUrl }}' + spec: + type: service + lifecycle: production + owner: '{{ parameters.owner }}' + + - id: publish + if: '{{ not parameters.dryRun }}' + name: Publish + action: publish:github + input: + allowedHosts: ['github.com'] + description: 'This is {{ parameters.name }}' + repoUrl: '{{ parameters.repoUrl }}' + + - id: register + if: '{{ not parameters.dryRun }}' + name: Register + action: catalog:register + input: + repoContentsUrl: '{{ steps.publish.output.repoContentsUrl }}' + catalogInfoPath: '/catalog-info.yaml' + + - name: Results + if: '{{ parameters.dryRun }}' + action: debug:log + input: + listWorkspace: true + + output: + links: + - title: Repository + url: '{{ steps.publish.output.remoteUrl }}' + - title: Open in catalog + icon: 'catalog' + entityRef: '{{ steps.register.output.entityRef }}' +``` + +We have a [Docker image](https://github.com/backstage/backstage/blob/master/plugins/scaffolder-backend-module-rails/Rails.dockerfile) you can use to build your own. diff --git a/plugins/scaffolder-backend/scripts/Rails.dockerfile b/plugins/scaffolder-backend-module-rails/Rails.dockerfile similarity index 100% rename from plugins/scaffolder-backend/scripts/Rails.dockerfile rename to plugins/scaffolder-backend-module-rails/Rails.dockerfile diff --git a/plugins/scaffolder-backend-module-rails/api-report.md b/plugins/scaffolder-backend-module-rails/api-report.md new file mode 100644 index 0000000000..95d9c1bd9f --- /dev/null +++ b/plugins/scaffolder-backend-module-rails/api-report.md @@ -0,0 +1,22 @@ +## API Report File for "@backstage/plugin-scaffolder-backend-module-rails" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { ContainerRunner } from '@backstage/backend-common'; +import { ScmIntegrations } from '@backstage/integration'; +import { TemplateAction } from '@backstage/plugin-scaffolder-backend'; +import { UrlReader } from '@backstage/backend-common'; + +// @public (undocumented) +export function createFetchRailsAction(options: { + reader: UrlReader; + integrations: ScmIntegrations; + containerRunner: ContainerRunner; +}): TemplateAction; + + +// (No @packageDocumentation comment for this package) + +``` diff --git a/plugins/scaffolder-backend-module-rails/package.json b/plugins/scaffolder-backend-module-rails/package.json new file mode 100644 index 0000000000..79b123cdb6 --- /dev/null +++ b/plugins/scaffolder-backend-module-rails/package.json @@ -0,0 +1,44 @@ +{ + "name": "@backstage/plugin-scaffolder-backend-module-rails", + "version": "0.1.1", + "main": "src/index.ts", + "types": "src/index.ts", + "license": "Apache-2.0", + "publishConfig": { + "access": "public", + "main": "dist/index.esm.js", + "types": "dist/index.d.ts" + }, + "scripts": { + "build": "backstage-cli plugin:build", + "start": "backstage-cli plugin:serve", + "lint": "backstage-cli lint", + "test": "backstage-cli test", + "diff": "backstage-cli plugin:diff", + "prepack": "backstage-cli prepack", + "postpack": "backstage-cli postpack", + "clean": "backstage-cli clean" + }, + "dependencies": { + "@backstage/backend-common": "^0.8.3", + "@backstage/plugin-scaffolder-backend": "^0.12.2", + "@backstage/config": "^0.1.5", + "@backstage/errors": "^0.1.1", + "@backstage/integration": "^0.5.6", + "command-exists": "^1.2.9", + "fs-extra": "^9.0.0" + }, + "devDependencies": { + "@backstage/cli": "^0.7.1", + "@types/jest": "^26.0.7", + "@types/node": "^14.14.32", + "@types/command-exists": "^1.2.0", + "@types/fs-extra": "^9.0.1", + "@types/mock-fs": "^4.13.0", + "jest-when": "^3.1.0", + "mock-fs": "^4.13.0" + }, + "files": [ + "dist" + ] +} diff --git a/plugins/scaffolder-backend-module-rails/src/actions/fetch/index.ts b/plugins/scaffolder-backend-module-rails/src/actions/fetch/index.ts new file mode 100644 index 0000000000..7d590c9a1a --- /dev/null +++ b/plugins/scaffolder-backend-module-rails/src/actions/fetch/index.ts @@ -0,0 +1,16 @@ +/* + * Copyright 2021 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export * from './rails'; diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/rails.test.ts b/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/index.test.ts similarity index 86% rename from plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/rails.test.ts rename to plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/index.test.ts index ebc62e9277..cedc768f88 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/rails.test.ts +++ b/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/index.test.ts @@ -15,24 +15,31 @@ */ const mockRailsTemplater = { run: jest.fn() }; -jest.mock('./helpers'); -jest.mock('../../../stages/templater', () => { +jest.mock('@backstage/plugin-scaffolder-backend', () => ({ + ...jest.requireActual('@backstage/plugin-scaffolder-backend'), + fetchContents: jest.fn(), +})); +jest.mock('./railsNewRunner', () => { return { - Rails: jest.fn().mockImplementation(() => { + RailsNewRunner: jest.fn().mockImplementation(() => { return mockRailsTemplater; }), }; }); -import { getVoidLogger, UrlReader } from '@backstage/backend-common'; +import { + ContainerRunner, + getVoidLogger, + UrlReader, +} from '@backstage/backend-common'; import { ConfigReader } from '@backstage/config'; import { ScmIntegrations } from '@backstage/integration'; import mock from 'mock-fs'; import os from 'os'; import { resolve as resolvePath } from 'path'; import { PassThrough } from 'stream'; -import { createFetchRailsAction } from './rails'; -import { fetchContents } from './helpers'; +import { createFetchRailsAction } from './index'; +import { fetchContents } from '@backstage/plugin-scaffolder-backend'; describe('fetch:rails', () => { const integrations = ScmIntegrations.fromConfig( @@ -68,10 +75,14 @@ describe('fetch:rails', () => { readTree: jest.fn(), search: jest.fn(), }; + const containerRunner: ContainerRunner = { + runContainer: jest.fn(), + }; const action = createFetchRailsAction({ integrations, reader: mockReader, + containerRunner, }); beforeEach(() => { diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/rails.ts b/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/index.ts similarity index 90% rename from plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/rails.ts rename to plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/index.ts index 203db5004e..e2dc8fd95a 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/rails.ts +++ b/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/index.ts @@ -14,22 +14,25 @@ * limitations under the License. */ -import { DockerContainerRunner, UrlReader } from '@backstage/backend-common'; +import { ContainerRunner, UrlReader } from '@backstage/backend-common'; import { JsonObject } from '@backstage/config'; import { InputError } from '@backstage/errors'; import { ScmIntegrations } from '@backstage/integration'; import fs from 'fs-extra'; +import { + createTemplateAction, + fetchContents, +} from '@backstage/plugin-scaffolder-backend'; + import { resolve as resolvePath } from 'path'; -import { Rails, TemplaterValues } from '../../../stages/templater'; -import { createTemplateAction } from '../../createTemplateAction'; -import { fetchContents } from './helpers'; -import Docker from 'dockerode'; +import { RailsNewRunner } from './railsNewRunner'; export function createFetchRailsAction(options: { reader: UrlReader; integrations: ScmIntegrations; + containerRunner: ContainerRunner; }) { - const { reader, integrations } = options; + const { reader, integrations, containerRunner } = options; return createTemplateAction<{ url: string; @@ -39,7 +42,7 @@ export function createFetchRailsAction(options: { }>({ id: 'fetch:rails', description: - 'Downloads a template from the given URL into the workspace, and runs a rails generator on it.', + 'Downloads a template from the given URL into the workspace, and runs a rails new generator on it.', schema: { input: { type: 'object', @@ -152,12 +155,10 @@ export function createFetchRailsAction(options: { outputPath: workDir, }); - const dockerClient = new Docker(); - const containerRunner = new DockerContainerRunner({ dockerClient }); - const templateRunner = new Rails({ containerRunner }); + const templateRunner = new RailsNewRunner({ containerRunner }); const values = { - ...(ctx.input.values as TemplaterValues), + ...ctx.input.values, imageName: ctx.input.imageName, }; diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/railsArgumentResolver.test.ts b/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/railsArgumentResolver.test.ts similarity index 95% rename from plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/railsArgumentResolver.test.ts rename to plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/railsArgumentResolver.test.ts index 370d9de380..a8c10625c2 100644 --- a/plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/railsArgumentResolver.test.ts +++ b/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/railsArgumentResolver.test.ts @@ -15,7 +15,6 @@ */ import { railsArgumentResolver } from './railsArgumentResolver'; -import { TemplaterValues } from '../types'; describe('railsArgumentResolver', () => { describe('when provide the parameter', () => { @@ -33,7 +32,7 @@ describe('railsArgumentResolver', () => { 'should include the argument to execution %p -> %p', (passedArguments: object, expected: Array) => { // that step is to ensure the validation between the TemplaterValues and the resolver - const values: TemplaterValues = { + const values = { owner: 'r', storePath: '', railsArguments: passedArguments, diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/railsArgumentResolver.ts b/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/railsArgumentResolver.ts similarity index 100% rename from plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/railsArgumentResolver.ts rename to plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/railsArgumentResolver.ts diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/index.test.ts b/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/railsNewRunner.test.ts similarity index 89% rename from plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/index.test.ts rename to plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/railsNewRunner.test.ts index 534899eec1..dc3f824236 100644 --- a/plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/index.test.ts +++ b/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/railsNewRunner.test.ts @@ -16,7 +16,7 @@ const runCommand = jest.fn(); const commandExists = jest.fn(); -jest.mock('../helpers', () => ({ runCommand })); +jest.mock('@backstage/plugin-scaffolder-backend', () => ({ runCommand })); jest.mock('command-exists', () => commandExists); jest.mock('fs-extra'); @@ -26,7 +26,7 @@ import fs from 'fs-extra'; import path from 'path'; import { PassThrough } from 'stream'; -import { Rails } from './index'; +import { RailsNewRunner } from './railsNewRunner'; describe('Rails Templater', () => { const containerRunner: jest.Mocked = { @@ -39,6 +39,7 @@ describe('Rails Templater', () => { describe('when running on docker', () => { it('should run the correct bindings for the volumes', async () => { + const logStream = new PassThrough(); const values = { owner: 'angeliski', storePath: 'https://github.com/angeliski/rails-project', @@ -51,10 +52,11 @@ describe('Rails Templater', () => { .spyOn(fs, 'realpath') .mockImplementation(x => Promise.resolve(x.toString())); - const templater = new Rails({ containerRunner }); + const templater = new RailsNewRunner({ containerRunner }); await templater.run({ workspacePath: 'tempdir', values, + logStream, }); expect(containerRunner.runContainer).toHaveBeenCalledWith({ @@ -67,11 +69,12 @@ describe('Rails Templater', () => { [path.join('tempdir', 'intermediate')]: '/output', }, workingDir: '/input', - logStream: undefined, + logStream: logStream, }); }); it('should use the provided imageName', async () => { + const logStream = new PassThrough(); const values = { owner: 'angeliski', storePath: 'https://github.com/angeliski/rails-project', @@ -81,10 +84,11 @@ describe('Rails Templater', () => { jest.spyOn(fs, 'readdir').mockResolvedValueOnce(['newthing'] as any); - const templater = new Rails({ containerRunner }); + const templater = new RailsNewRunner({ containerRunner }); await templater.run({ workspacePath: 'tempdir', values, + logStream, }); expect(containerRunner.runContainer).toHaveBeenCalledWith( @@ -106,7 +110,7 @@ describe('Rails Templater', () => { jest.spyOn(fs, 'readdir').mockResolvedValueOnce(['newthing'] as any); - const templater = new Rails({ containerRunner }); + const templater = new RailsNewRunner({ containerRunner }); await templater.run({ workspacePath: 'tempdir', values, @@ -128,6 +132,7 @@ describe('Rails Templater', () => { }); it('update the template path to correct location', async () => { + const logStream = new PassThrough(); const values = { owner: 'angeliski', storePath: 'https://github.com/angeliski/rails-project', @@ -141,10 +146,11 @@ describe('Rails Templater', () => { .spyOn(fs, 'realpath') .mockImplementation(x => Promise.resolve(x.toString())); - const templater = new Rails({ containerRunner }); + const templater = new RailsNewRunner({ containerRunner }); await templater.run({ workspacePath: 'tempdir', values, + logStream, }); expect(containerRunner.runContainer).toHaveBeenCalledWith({ @@ -162,7 +168,7 @@ describe('Rails Templater', () => { [path.join('tempdir', 'intermediate')]: '/output', }, workingDir: '/input', - logStream: undefined, + logStream: logStream, }); }); }); @@ -181,7 +187,7 @@ describe('Rails Templater', () => { jest.spyOn(fs, 'readdir').mockResolvedValueOnce(['newthing'] as any); commandExists.mockImplementationOnce(() => () => true); - const templater = new Rails({ containerRunner }); + const templater = new RailsNewRunner({ containerRunner }); await templater.run({ workspacePath: 'tempdir', values, @@ -211,7 +217,7 @@ describe('Rails Templater', () => { jest.spyOn(fs, 'readdir').mockResolvedValueOnce(['newthing'] as any); commandExists.mockImplementationOnce(() => () => true); - const templater = new Rails({ containerRunner }); + const templater = new RailsNewRunner({ containerRunner }); await templater.run({ workspacePath: 'tempdir', values, @@ -239,7 +245,7 @@ describe('Rails Templater', () => { .spyOn(fs, 'readdir') .mockImplementationOnce(() => Promise.resolve([])); - const templater = new Rails({ containerRunner }); + const templater = new RailsNewRunner({ containerRunner }); await expect( templater.run({ workspacePath: 'tempdir', diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/index.ts b/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/railsNewRunner.ts similarity index 84% rename from plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/index.ts rename to plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/railsNewRunner.ts index 57ee26e106..3e18490587 100644 --- a/plugins/scaffolder-backend/src/scaffolder/stages/templater/rails/index.ts +++ b/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/railsNewRunner.ts @@ -17,12 +17,16 @@ import { ContainerRunner } from '@backstage/backend-common'; import fs from 'fs-extra'; import path from 'path'; -import { runCommand } from '../helpers'; +import { runCommand } from '@backstage/plugin-scaffolder-backend'; import commandExists from 'command-exists'; -import { TemplaterBase, TemplaterRunOptions } from '../types'; -import { railsArgumentResolver } from './railsArgumentResolver'; +import { + railsArgumentResolver, + RailsRunOptions, +} from './railsArgumentResolver'; +import { JsonObject } from '@backstage/config'; +import { Writable } from 'stream'; -export class Rails implements TemplaterBase { +export class RailsNewRunner { private readonly containerRunner: ContainerRunner; constructor({ containerRunner }: { containerRunner: ContainerRunner }) { @@ -33,7 +37,11 @@ export class Rails implements TemplaterBase { workspacePath, values, logStream, - }: TemplaterRunOptions): Promise { + }: { + workspacePath: string; + values: JsonObject; + logStream: Writable; + }): Promise { const intermediateDir = path.join(workspacePath, 'intermediate'); await fs.ensureDir(intermediateDir); const resultDir = path.join(workspacePath, 'result'); @@ -53,7 +61,7 @@ export class Rails implements TemplaterBase { if (commandExistsToRun) { const arrayExtraArguments = railsArgumentResolver( workspacePath, - railsArguments, + railsArguments as RailsRunOptions, ); await runCommand({ @@ -68,10 +76,10 @@ export class Rails implements TemplaterBase { } else { const arrayExtraArguments = railsArgumentResolver( '/input', - railsArguments, + railsArguments as RailsRunOptions, ); await this.containerRunner.runContainer({ - imageName: imageName, + imageName: imageName as string, command: baseCommand, args: [...baseArguments, `/output/${name}`, ...arrayExtraArguments], mountDirs, diff --git a/plugins/scaffolder-backend-module-rails/src/actions/index.ts b/plugins/scaffolder-backend-module-rails/src/actions/index.ts new file mode 100644 index 0000000000..1b47db9e03 --- /dev/null +++ b/plugins/scaffolder-backend-module-rails/src/actions/index.ts @@ -0,0 +1,16 @@ +/* + * Copyright 2021 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export * from './fetch'; diff --git a/plugins/scaffolder-backend-module-rails/src/index.ts b/plugins/scaffolder-backend-module-rails/src/index.ts new file mode 100644 index 0000000000..4f06b14a86 --- /dev/null +++ b/plugins/scaffolder-backend-module-rails/src/index.ts @@ -0,0 +1,16 @@ +/* + * Copyright 2021 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export * from './actions'; diff --git a/plugins/scaffolder-backend/api-report.md b/plugins/scaffolder-backend/api-report.md index ab3ea433c6..e30542aca7 100644 --- a/plugins/scaffolder-backend/api-report.md +++ b/plugins/scaffolder-backend/api-report.md @@ -11,7 +11,7 @@ import { createPullRequest } from 'octokit-plugin-create-pull-request'; import express from 'express'; import { JsonObject } from '@backstage/config'; import { JsonValue } from '@backstage/config'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import { PluginDatabaseManager } from '@backstage/backend-common'; import { Schema } from 'jsonschema'; import { ScmIntegrationRegistry } from '@backstage/integration'; @@ -23,7 +23,7 @@ import { Writable } from 'stream'; // @public (undocumented) export type ActionContext = { baseUrl?: string; - logger: Logger; + logger: Logger_2; logStream: Writable; token?: string | undefined; workspacePath: string; @@ -131,7 +131,7 @@ export interface RouterOptions { // (undocumented) database: PluginDatabaseManager; // (undocumented) - logger: Logger; + logger: Logger_2; // (undocumented) reader: UrlReader; // (undocumented) diff --git a/plugins/scaffolder-backend/package.json b/plugins/scaffolder-backend/package.json index a6db486594..a88413d611 100644 --- a/plugins/scaffolder-backend/package.json +++ b/plugins/scaffolder-backend/package.json @@ -62,8 +62,7 @@ "octokit-plugin-create-pull-request": "^3.9.3", "uuid": "^8.2.0", "winston": "^3.2.1", - "yaml": "^1.10.0", - "dockerode": "^3.2.1" + "yaml": "^1.10.0" }, "devDependencies": { "@backstage/cli": "^0.7.3", @@ -73,7 +72,6 @@ "@types/git-url-parse": "^9.0.0", "@types/mock-fs": "^4.13.0", "@types/supertest": "^2.0.8", - "@types/dockerode": "^3.2.1", "jest-when": "^3.1.0", "mock-fs": "^4.13.0", "msw": "^0.29.0", diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/createBuiltinActions.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/createBuiltinActions.ts index fa2fcbfcee..08d7bbf824 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/createBuiltinActions.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/createBuiltinActions.ts @@ -24,11 +24,7 @@ import { } from './catalog'; import { createDebugLogAction } from './debug'; -import { - createFetchCookiecutterAction, - createFetchPlainAction, - createFetchRailsAction, -} from './fetch'; +import { createFetchCookiecutterAction, createFetchPlainAction } from './fetch'; import { createFilesystemDeleteAction, createFilesystemRenameAction, @@ -66,10 +62,6 @@ export const createBuiltinActions = (options: { integrations, containerRunner, }), - createFetchRailsAction({ - reader, - integrations, - }), createPublishGithubAction({ integrations, config, diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/index.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/index.ts index 9557a88a4c..82bc387f26 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/index.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/index.ts @@ -16,4 +16,4 @@ export { createFetchPlainAction } from './plain'; export { createFetchCookiecutterAction } from './cookiecutter'; -export { createFetchRailsAction } from './rails'; +export * from './helpers'; diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/templater/index.ts b/plugins/scaffolder-backend/src/scaffolder/stages/templater/index.ts index 139ff2207e..4d80f86946 100644 --- a/plugins/scaffolder-backend/src/scaffolder/stages/templater/index.ts +++ b/plugins/scaffolder-backend/src/scaffolder/stages/templater/index.ts @@ -18,4 +18,3 @@ export * from './types'; export * from './helpers'; export * from './templaters'; export * from './cra'; -export * from './rails'; From 1cdc4ba0e2c36b1e1c0869cb6dbc9cfcb079d40f Mon Sep 17 00:00:00 2001 From: Rogerio Angeliski Date: Thu, 24 Jun 2021 12:49:32 -0300 Subject: [PATCH 132/168] docs: added generated files Signed-off-by: Rogerio Angeliski --- packages/backend-common/api-report.md | 10 +++++----- packages/techdocs-common/api-report.md | 20 +++++++++---------- plugins/app-backend/api-report.md | 4 ++-- plugins/auth-backend/api-report.md | 6 +++--- .../api-report.md | 6 +++--- plugins/catalog-graphql/api-report.md | 4 ++-- plugins/code-coverage-backend/api-report.md | 4 ++-- plugins/graphql/api-report.md | 4 ++-- plugins/kafka-backend/api-report.md | 2 +- plugins/kubernetes-backend/api-report.md | 6 +++--- plugins/proxy-backend/api-report.md | 2 +- plugins/rollbar-backend/api-report.md | 6 +++--- plugins/search-backend-node/api-report.md | 8 ++++---- plugins/search-backend/api-report.md | 2 +- plugins/techdocs-backend/api-report.md | 2 +- plugins/todo-backend/api-report.md | 2 +- 16 files changed, 44 insertions(+), 44 deletions(-) diff --git a/packages/backend-common/api-report.md b/packages/backend-common/api-report.md index a21aaef4a6..22eac06ed2 100644 --- a/packages/backend-common/api-report.md +++ b/packages/backend-common/api-report.md @@ -19,7 +19,7 @@ import * as http from 'http'; import { isChildPath } from '@backstage/cli-common'; import { JsonValue } from '@backstage/config'; import { Knex } from 'knex'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import { MergeResult } from 'isomorphic-git'; import { PushResult } from 'isomorphic-git'; import { Readable } from 'stream'; @@ -129,7 +129,7 @@ export function errorHandler(options?: ErrorHandlerOptions): ErrorRequestHandler // @public (undocumented) export type ErrorHandlerOptions = { showStackTraces?: boolean; - logger?: Logger; + logger?: Logger_2; logClientErrors?: boolean; }; @@ -185,7 +185,7 @@ export class Git { static fromAuth: ({ username, password, logger, }: { username?: string | undefined; password?: string | undefined; - logger?: Logger | undefined; + logger?: Logger_2 | undefined; }) => Git; // (undocumented) init({ dir, defaultBranch, }: { @@ -301,7 +301,7 @@ export type ReadTreeResponseFile = { }; // @public -export function requestLoggingHandler(logger?: Logger): RequestHandler; +export function requestLoggingHandler(logger?: Logger_2): RequestHandler; // @public export function resolvePackagePath(name: string, ...paths: string[]): string; @@ -337,7 +337,7 @@ export type ServiceBuilder = { loadConfig(config: ConfigReader): ServiceBuilder; setPort(port: number): ServiceBuilder; setHost(host: string): ServiceBuilder; - setLogger(logger: Logger): ServiceBuilder; + setLogger(logger: Logger_2): ServiceBuilder; enableCors(options: cors.CorsOptions): ServiceBuilder; setHttpsSettings(settings: HttpsSettings): ServiceBuilder; addRouter(root: string, router: Router | RequestHandler): ServiceBuilder; diff --git a/packages/techdocs-common/api-report.md b/packages/techdocs-common/api-report.md index 3fff030eee..d25f55bf3a 100644 --- a/packages/techdocs-common/api-report.md +++ b/packages/techdocs-common/api-report.md @@ -12,17 +12,17 @@ import { EntityName } from '@backstage/catalog-model'; import express from 'express'; import { GitHubIntegrationConfig } from '@backstage/integration'; import { GitLabIntegrationConfig } from '@backstage/integration'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; import { UrlReader } from '@backstage/backend-common'; import { Writable } from 'stream'; // @public (undocumented) -export const checkoutGitRepository: (repoUrl: string, config: Config, logger: Logger) => Promise; +export const checkoutGitRepository: (repoUrl: string, config: Config, logger: Logger_2) => Promise; // @public (undocumented) export class CommonGitPreparer implements PreparerBase { - constructor(config: Config, logger: Logger); + constructor(config: Config, logger: Logger_2); // (undocumented) prepare(entity: Entity, options?: { etag?: string; @@ -31,7 +31,7 @@ export class CommonGitPreparer implements PreparerBase { // @public (undocumented) export class DirectoryPreparer implements PreparerBase { - constructor(config: Config, logger: Logger, reader: UrlReader); + constructor(config: Config, logger: Logger_2, reader: UrlReader); // (undocumented) prepare(entity: Entity): Promise; } @@ -51,7 +51,7 @@ export type GeneratorBuilder = { export class Generators implements GeneratorBuilder { // (undocumented) static fromConfig(config: Config, { logger, containerRunner, }: { - logger: Logger; + logger: Logger_2; containerRunner: ContainerRunner; }): Promise; // (undocumented) @@ -69,7 +69,7 @@ export const getDefaultBranch: (repositoryUrl: string, config: Config) => Promis // @public (undocumented) export const getDocFilesFromRepository: (reader: UrlReader, entity: Entity, opts?: { etag?: string | undefined; - logger?: Logger | undefined; + logger?: Logger_2 | undefined; } | undefined) => Promise; // @public (undocumented) @@ -88,7 +88,7 @@ export const getGitRepositoryTempFolder: (repositoryUrl: string, config: Config) export function getGitRepoType(url: string): string; // @public (undocumented) -export const getLastCommitTimestamp: (repositoryLocation: string, logger: Logger) => Promise; +export const getLastCommitTimestamp: (repositoryLocation: string, logger: Logger_2) => Promise; // @public (undocumented) export const getLocationForEntity: (entity: Entity) => ParsedLocationAnnotation; @@ -108,7 +108,7 @@ export const parseReferenceAnnotation: (annotationName: string, entity: Entity) // @public (undocumented) export type PreparerBase = { prepare(entity: Entity, options?: { - logger?: Logger; + logger?: Logger_2; etag?: string; }): Promise; }; @@ -153,7 +153,7 @@ export type RemoteProtocol = 'url' | 'dir' | 'github' | 'gitlab' | 'file' | 'azu // @public (undocumented) export class TechdocsGenerator implements GeneratorBase { constructor({ logger, containerRunner, config, }: { - logger: Logger; + logger: Logger_2; containerRunner: ContainerRunner; config: Config; }); @@ -170,7 +170,7 @@ export type TechDocsMetadata = { // @public (undocumented) export class UrlPreparer implements PreparerBase { - constructor(reader: UrlReader, logger: Logger); + constructor(reader: UrlReader, logger: Logger_2); // (undocumented) prepare(entity: Entity, options?: { etag?: string; diff --git a/plugins/app-backend/api-report.md b/plugins/app-backend/api-report.md index 4f59102265..93aba5596f 100644 --- a/plugins/app-backend/api-report.md +++ b/plugins/app-backend/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import express from 'express'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; // @public (undocumented) export function createRouter(options: RouterOptions): Promise; @@ -18,7 +18,7 @@ export interface RouterOptions { config: Config; disableConfigInjection?: boolean; // (undocumented) - logger: Logger; + logger: Logger_2; staticFallbackHandler?: express.Handler; } diff --git a/plugins/auth-backend/api-report.md b/plugins/auth-backend/api-report.md index 6ae878accf..9f9a8d18ef 100644 --- a/plugins/auth-backend/api-report.md +++ b/plugins/auth-backend/api-report.md @@ -9,7 +9,7 @@ import { Config } from '@backstage/config'; import { Entity } from '@backstage/catalog-model'; import express from 'express'; import { JSONWebKey } from 'jose'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import { PluginDatabaseManager } from '@backstage/backend-common'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; import { Profile } from 'passport'; @@ -23,7 +23,7 @@ export type AuthProviderFactoryOptions = { providerId: string; globalConfig: AuthProviderConfig; config: Config; - logger: Logger; + logger: Logger_2; tokenIssuer: TokenIssuer; discovery: PluginEndpointDiscovery; catalogApi: CatalogApi; @@ -206,7 +206,7 @@ export interface RouterOptions { // (undocumented) discovery: PluginEndpointDiscovery; // (undocumented) - logger: Logger; + logger: Logger_2; // (undocumented) providerFactories?: ProviderFactories; } diff --git a/plugins/catalog-backend-module-msgraph/api-report.md b/plugins/catalog-backend-module-msgraph/api-report.md index f1e7e22c35..bac733ef53 100644 --- a/plugins/catalog-backend-module-msgraph/api-report.md +++ b/plugins/catalog-backend-module-msgraph/api-report.md @@ -9,7 +9,7 @@ import { CatalogProcessorEmit } from '@backstage/plugin-catalog-backend'; import { Config } from '@backstage/config'; import { GroupEntity } from '@backstage/catalog-model'; import { LocationSpec } from '@backstage/catalog-model'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import * as MicrosoftGraph from '@microsoft/microsoft-graph-types'; import * as msal from '@azure/msal-node'; import { UserEntity } from '@backstage/catalog-model'; @@ -70,12 +70,12 @@ export class MicrosoftGraphClient { export class MicrosoftGraphOrgReaderProcessor implements CatalogProcessor { constructor(options: { providers: MicrosoftGraphProviderConfig[]; - logger: Logger; + logger: Logger_2; groupTransformer?: GroupTransformer; }); // (undocumented) static fromConfig(config: Config, options: { - logger: Logger; + logger: Logger_2; groupTransformer?: GroupTransformer; }): MicrosoftGraphOrgReaderProcessor; // (undocumented) diff --git a/plugins/catalog-graphql/api-report.md b/plugins/catalog-graphql/api-report.md index cbe325f4c5..40e8a19b66 100644 --- a/plugins/catalog-graphql/api-report.md +++ b/plugins/catalog-graphql/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import { GraphQLModule } from '@graphql-modules/core'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; // @public (undocumented) export function createModule(options: ModuleOptions): Promise; @@ -16,7 +16,7 @@ export interface ModuleOptions { // (undocumented) config: Config; // (undocumented) - logger: Logger; + logger: Logger_2; } diff --git a/plugins/code-coverage-backend/api-report.md b/plugins/code-coverage-backend/api-report.md index f8f1575d0b..186b76fb39 100644 --- a/plugins/code-coverage-backend/api-report.md +++ b/plugins/code-coverage-backend/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import express from 'express'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import { PluginDatabaseManager } from '@backstage/backend-common'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; import { UrlReader } from '@backstage/backend-common'; @@ -32,7 +32,7 @@ export interface RouterOptions { // (undocumented) discovery: PluginEndpointDiscovery; // (undocumented) - logger: Logger; + logger: Logger_2; // (undocumented) urlReader: UrlReader; } diff --git a/plugins/graphql/api-report.md b/plugins/graphql/api-report.md index 8109c94122..ef172afbd7 100644 --- a/plugins/graphql/api-report.md +++ b/plugins/graphql/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import express from 'express'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; // @public (undocumented) export function createRouter(options: RouterOptions): Promise; @@ -16,7 +16,7 @@ export interface RouterOptions { // (undocumented) config: Config; // (undocumented) - logger: Logger; + logger: Logger_2; } diff --git a/plugins/kafka-backend/api-report.md b/plugins/kafka-backend/api-report.md index 47754ad572..6840bd7527 100644 --- a/plugins/kafka-backend/api-report.md +++ b/plugins/kafka-backend/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import express from 'express'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; // @public (undocumented) export function createRouter(options: RouterOptions): Promise; diff --git a/plugins/kubernetes-backend/api-report.md b/plugins/kubernetes-backend/api-report.md index fe43e8888a..a9389b7e62 100644 --- a/plugins/kubernetes-backend/api-report.md +++ b/plugins/kubernetes-backend/api-report.md @@ -9,7 +9,7 @@ import express from 'express'; import { FetchResponse } from '@backstage/plugin-kubernetes-common'; import { KubernetesFetchError } from '@backstage/plugin-kubernetes-common'; import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; // @public (undocumented) export interface ClusterDetails { @@ -68,7 +68,7 @@ export interface KubernetesServiceLocator { } // @public (undocumented) -export const makeRouter: (logger: Logger, kubernetesFanOutHandler: KubernetesFanOutHandler, clusterDetails: ClusterDetails[]) => express.Router; +export const makeRouter: (logger: Logger_2, kubernetesFanOutHandler: KubernetesFanOutHandler, clusterDetails: ClusterDetails[]) => express.Router; // @public (undocumented) export interface ObjectFetchParams { @@ -91,7 +91,7 @@ export interface RouterOptions { // (undocumented) config: Config; // (undocumented) - logger: Logger; + logger: Logger_2; } // @public (undocumented) diff --git a/plugins/proxy-backend/api-report.md b/plugins/proxy-backend/api-report.md index 1b1eba3b00..63469a2017 100644 --- a/plugins/proxy-backend/api-report.md +++ b/plugins/proxy-backend/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import express from 'express'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; // @public (undocumented) diff --git a/plugins/rollbar-backend/api-report.md b/plugins/rollbar-backend/api-report.md index fa8c67d4f0..9fa525cfc3 100644 --- a/plugins/rollbar-backend/api-report.md +++ b/plugins/rollbar-backend/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import express from 'express'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; // @public (undocumented) export function createRouter(options: RouterOptions): Promise; @@ -20,7 +20,7 @@ export function getRequestHeaders(token: string): { // @public (undocumented) export class RollbarApi { - constructor(accessToken: string, logger: Logger); + constructor(accessToken: string, logger: Logger_2); // (undocumented) getActivatedCounts(projectName: string, options?: { environment: string; @@ -49,7 +49,7 @@ export interface RouterOptions { // (undocumented) config: Config; // (undocumented) - logger: Logger; + logger: Logger_2; // (undocumented) rollbarApi?: RollbarApi; } diff --git a/plugins/search-backend-node/api-report.md b/plugins/search-backend-node/api-report.md index 03585b6b99..ccb7475573 100644 --- a/plugins/search-backend-node/api-report.md +++ b/plugins/search-backend-node/api-report.md @@ -7,7 +7,7 @@ import { DocumentCollator } from '@backstage/search-common'; import { DocumentDecorator } from '@backstage/search-common'; import { IndexableDocument } from '@backstage/search-common'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import { default as lunr_2 } from 'lunr'; import { SearchQuery } from '@backstage/search-common'; import { SearchResultSet } from '@backstage/search-common'; @@ -27,14 +27,14 @@ export class IndexBuilder { // @public (undocumented) export class LunrSearchEngine implements SearchEngine { constructor({ logger }: { - logger: Logger; + logger: Logger_2; }); // (undocumented) protected docStore: Record; // (undocumented) index(type: string, documents: IndexableDocument[]): void; // (undocumented) - protected logger: Logger; + protected logger: Logger_2; // (undocumented) protected lunrIndices: Record; // (undocumented) @@ -48,7 +48,7 @@ export class LunrSearchEngine implements SearchEngine { // @public export class Scheduler { constructor({ logger }: { - logger: Logger; + logger: Logger_2; }); addToSchedule(task: Function, interval: number): void; start(): void; diff --git a/plugins/search-backend/api-report.md b/plugins/search-backend/api-report.md index 9e617b73ed..7eba677439 100644 --- a/plugins/search-backend/api-report.md +++ b/plugins/search-backend/api-report.md @@ -5,7 +5,7 @@ ```ts import express from 'express'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import { SearchEngine } from '@backstage/plugin-search-backend-node'; // @public (undocumented) diff --git a/plugins/techdocs-backend/api-report.md b/plugins/techdocs-backend/api-report.md index d433d428e0..947439533a 100644 --- a/plugins/techdocs-backend/api-report.md +++ b/plugins/techdocs-backend/api-report.md @@ -8,7 +8,7 @@ import { Config } from '@backstage/config'; import express from 'express'; import { GeneratorBuilder } from '@backstage/techdocs-common'; import { Knex } from 'knex'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; import { PreparerBuilder } from '@backstage/techdocs-common'; import { PublisherBase } from '@backstage/techdocs-common'; diff --git a/plugins/todo-backend/api-report.md b/plugins/todo-backend/api-report.md index 8bcfe30aee..d203a52b36 100644 --- a/plugins/todo-backend/api-report.md +++ b/plugins/todo-backend/api-report.md @@ -8,7 +8,7 @@ import { CatalogApi } from '@backstage/catalog-client'; import { Config } from '@backstage/config'; import { EntityName } from '@backstage/catalog-model'; import express from 'express'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import { ScmIntegrations } from '@backstage/integration'; import { UrlReader } from '@backstage/backend-common'; From c1a86b800a929c6deda00640535a240d07c7363c Mon Sep 17 00:00:00 2001 From: Rogerio Angeliski Date: Thu, 24 Jun 2021 13:27:44 -0300 Subject: [PATCH 133/168] chore: remove frontend plugin command Signed-off-by: Rogerio Angeliski --- plugins/scaffolder-backend-module-rails/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/scaffolder-backend-module-rails/package.json b/plugins/scaffolder-backend-module-rails/package.json index 79b123cdb6..b2765b04f5 100644 --- a/plugins/scaffolder-backend-module-rails/package.json +++ b/plugins/scaffolder-backend-module-rails/package.json @@ -14,7 +14,6 @@ "start": "backstage-cli plugin:serve", "lint": "backstage-cli lint", "test": "backstage-cli test", - "diff": "backstage-cli plugin:diff", "prepack": "backstage-cli prepack", "postpack": "backstage-cli postpack", "clean": "backstage-cli clean" From 93f8e8b423c633b4f7a535c2f5a1899bc1ae544b Mon Sep 17 00:00:00 2001 From: Rogerio Angeliski Date: Tue, 29 Jun 2021 18:51:02 -0300 Subject: [PATCH 134/168] Revert "docs: added generated files" This reverts commit b2cefb34e0d4640cc5bb675d05d0ea906d74eec8. Signed-off-by: Rogerio Angeliski --- packages/backend-common/api-report.md | 10 +++++----- packages/techdocs-common/api-report.md | 20 +++++++++---------- plugins/app-backend/api-report.md | 4 ++-- plugins/auth-backend/api-report.md | 6 +++--- .../api-report.md | 6 +++--- plugins/catalog-graphql/api-report.md | 4 ++-- plugins/code-coverage-backend/api-report.md | 4 ++-- plugins/graphql/api-report.md | 4 ++-- plugins/kafka-backend/api-report.md | 2 +- plugins/kubernetes-backend/api-report.md | 6 +++--- plugins/proxy-backend/api-report.md | 2 +- plugins/rollbar-backend/api-report.md | 6 +++--- plugins/search-backend-node/api-report.md | 8 ++++---- plugins/search-backend/api-report.md | 2 +- plugins/techdocs-backend/api-report.md | 2 +- plugins/todo-backend/api-report.md | 2 +- 16 files changed, 44 insertions(+), 44 deletions(-) diff --git a/packages/backend-common/api-report.md b/packages/backend-common/api-report.md index 22eac06ed2..a21aaef4a6 100644 --- a/packages/backend-common/api-report.md +++ b/packages/backend-common/api-report.md @@ -19,7 +19,7 @@ import * as http from 'http'; import { isChildPath } from '@backstage/cli-common'; import { JsonValue } from '@backstage/config'; import { Knex } from 'knex'; -import { Logger as Logger_2 } from 'winston'; +import { Logger } from 'winston'; import { MergeResult } from 'isomorphic-git'; import { PushResult } from 'isomorphic-git'; import { Readable } from 'stream'; @@ -129,7 +129,7 @@ export function errorHandler(options?: ErrorHandlerOptions): ErrorRequestHandler // @public (undocumented) export type ErrorHandlerOptions = { showStackTraces?: boolean; - logger?: Logger_2; + logger?: Logger; logClientErrors?: boolean; }; @@ -185,7 +185,7 @@ export class Git { static fromAuth: ({ username, password, logger, }: { username?: string | undefined; password?: string | undefined; - logger?: Logger_2 | undefined; + logger?: Logger | undefined; }) => Git; // (undocumented) init({ dir, defaultBranch, }: { @@ -301,7 +301,7 @@ export type ReadTreeResponseFile = { }; // @public -export function requestLoggingHandler(logger?: Logger_2): RequestHandler; +export function requestLoggingHandler(logger?: Logger): RequestHandler; // @public export function resolvePackagePath(name: string, ...paths: string[]): string; @@ -337,7 +337,7 @@ export type ServiceBuilder = { loadConfig(config: ConfigReader): ServiceBuilder; setPort(port: number): ServiceBuilder; setHost(host: string): ServiceBuilder; - setLogger(logger: Logger_2): ServiceBuilder; + setLogger(logger: Logger): ServiceBuilder; enableCors(options: cors.CorsOptions): ServiceBuilder; setHttpsSettings(settings: HttpsSettings): ServiceBuilder; addRouter(root: string, router: Router | RequestHandler): ServiceBuilder; diff --git a/packages/techdocs-common/api-report.md b/packages/techdocs-common/api-report.md index d25f55bf3a..3fff030eee 100644 --- a/packages/techdocs-common/api-report.md +++ b/packages/techdocs-common/api-report.md @@ -12,17 +12,17 @@ import { EntityName } from '@backstage/catalog-model'; import express from 'express'; import { GitHubIntegrationConfig } from '@backstage/integration'; import { GitLabIntegrationConfig } from '@backstage/integration'; -import { Logger as Logger_2 } from 'winston'; +import { Logger } from 'winston'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; import { UrlReader } from '@backstage/backend-common'; import { Writable } from 'stream'; // @public (undocumented) -export const checkoutGitRepository: (repoUrl: string, config: Config, logger: Logger_2) => Promise; +export const checkoutGitRepository: (repoUrl: string, config: Config, logger: Logger) => Promise; // @public (undocumented) export class CommonGitPreparer implements PreparerBase { - constructor(config: Config, logger: Logger_2); + constructor(config: Config, logger: Logger); // (undocumented) prepare(entity: Entity, options?: { etag?: string; @@ -31,7 +31,7 @@ export class CommonGitPreparer implements PreparerBase { // @public (undocumented) export class DirectoryPreparer implements PreparerBase { - constructor(config: Config, logger: Logger_2, reader: UrlReader); + constructor(config: Config, logger: Logger, reader: UrlReader); // (undocumented) prepare(entity: Entity): Promise; } @@ -51,7 +51,7 @@ export type GeneratorBuilder = { export class Generators implements GeneratorBuilder { // (undocumented) static fromConfig(config: Config, { logger, containerRunner, }: { - logger: Logger_2; + logger: Logger; containerRunner: ContainerRunner; }): Promise; // (undocumented) @@ -69,7 +69,7 @@ export const getDefaultBranch: (repositoryUrl: string, config: Config) => Promis // @public (undocumented) export const getDocFilesFromRepository: (reader: UrlReader, entity: Entity, opts?: { etag?: string | undefined; - logger?: Logger_2 | undefined; + logger?: Logger | undefined; } | undefined) => Promise; // @public (undocumented) @@ -88,7 +88,7 @@ export const getGitRepositoryTempFolder: (repositoryUrl: string, config: Config) export function getGitRepoType(url: string): string; // @public (undocumented) -export const getLastCommitTimestamp: (repositoryLocation: string, logger: Logger_2) => Promise; +export const getLastCommitTimestamp: (repositoryLocation: string, logger: Logger) => Promise; // @public (undocumented) export const getLocationForEntity: (entity: Entity) => ParsedLocationAnnotation; @@ -108,7 +108,7 @@ export const parseReferenceAnnotation: (annotationName: string, entity: Entity) // @public (undocumented) export type PreparerBase = { prepare(entity: Entity, options?: { - logger?: Logger_2; + logger?: Logger; etag?: string; }): Promise; }; @@ -153,7 +153,7 @@ export type RemoteProtocol = 'url' | 'dir' | 'github' | 'gitlab' | 'file' | 'azu // @public (undocumented) export class TechdocsGenerator implements GeneratorBase { constructor({ logger, containerRunner, config, }: { - logger: Logger_2; + logger: Logger; containerRunner: ContainerRunner; config: Config; }); @@ -170,7 +170,7 @@ export type TechDocsMetadata = { // @public (undocumented) export class UrlPreparer implements PreparerBase { - constructor(reader: UrlReader, logger: Logger_2); + constructor(reader: UrlReader, logger: Logger); // (undocumented) prepare(entity: Entity, options?: { etag?: string; diff --git a/plugins/app-backend/api-report.md b/plugins/app-backend/api-report.md index 93aba5596f..4f59102265 100644 --- a/plugins/app-backend/api-report.md +++ b/plugins/app-backend/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import express from 'express'; -import { Logger as Logger_2 } from 'winston'; +import { Logger } from 'winston'; // @public (undocumented) export function createRouter(options: RouterOptions): Promise; @@ -18,7 +18,7 @@ export interface RouterOptions { config: Config; disableConfigInjection?: boolean; // (undocumented) - logger: Logger_2; + logger: Logger; staticFallbackHandler?: express.Handler; } diff --git a/plugins/auth-backend/api-report.md b/plugins/auth-backend/api-report.md index 9f9a8d18ef..6ae878accf 100644 --- a/plugins/auth-backend/api-report.md +++ b/plugins/auth-backend/api-report.md @@ -9,7 +9,7 @@ import { Config } from '@backstage/config'; import { Entity } from '@backstage/catalog-model'; import express from 'express'; import { JSONWebKey } from 'jose'; -import { Logger as Logger_2 } from 'winston'; +import { Logger } from 'winston'; import { PluginDatabaseManager } from '@backstage/backend-common'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; import { Profile } from 'passport'; @@ -23,7 +23,7 @@ export type AuthProviderFactoryOptions = { providerId: string; globalConfig: AuthProviderConfig; config: Config; - logger: Logger_2; + logger: Logger; tokenIssuer: TokenIssuer; discovery: PluginEndpointDiscovery; catalogApi: CatalogApi; @@ -206,7 +206,7 @@ export interface RouterOptions { // (undocumented) discovery: PluginEndpointDiscovery; // (undocumented) - logger: Logger_2; + logger: Logger; // (undocumented) providerFactories?: ProviderFactories; } diff --git a/plugins/catalog-backend-module-msgraph/api-report.md b/plugins/catalog-backend-module-msgraph/api-report.md index bac733ef53..f1e7e22c35 100644 --- a/plugins/catalog-backend-module-msgraph/api-report.md +++ b/plugins/catalog-backend-module-msgraph/api-report.md @@ -9,7 +9,7 @@ import { CatalogProcessorEmit } from '@backstage/plugin-catalog-backend'; import { Config } from '@backstage/config'; import { GroupEntity } from '@backstage/catalog-model'; import { LocationSpec } from '@backstage/catalog-model'; -import { Logger as Logger_2 } from 'winston'; +import { Logger } from 'winston'; import * as MicrosoftGraph from '@microsoft/microsoft-graph-types'; import * as msal from '@azure/msal-node'; import { UserEntity } from '@backstage/catalog-model'; @@ -70,12 +70,12 @@ export class MicrosoftGraphClient { export class MicrosoftGraphOrgReaderProcessor implements CatalogProcessor { constructor(options: { providers: MicrosoftGraphProviderConfig[]; - logger: Logger_2; + logger: Logger; groupTransformer?: GroupTransformer; }); // (undocumented) static fromConfig(config: Config, options: { - logger: Logger_2; + logger: Logger; groupTransformer?: GroupTransformer; }): MicrosoftGraphOrgReaderProcessor; // (undocumented) diff --git a/plugins/catalog-graphql/api-report.md b/plugins/catalog-graphql/api-report.md index 40e8a19b66..cbe325f4c5 100644 --- a/plugins/catalog-graphql/api-report.md +++ b/plugins/catalog-graphql/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import { GraphQLModule } from '@graphql-modules/core'; -import { Logger as Logger_2 } from 'winston'; +import { Logger } from 'winston'; // @public (undocumented) export function createModule(options: ModuleOptions): Promise; @@ -16,7 +16,7 @@ export interface ModuleOptions { // (undocumented) config: Config; // (undocumented) - logger: Logger_2; + logger: Logger; } diff --git a/plugins/code-coverage-backend/api-report.md b/plugins/code-coverage-backend/api-report.md index 186b76fb39..f8f1575d0b 100644 --- a/plugins/code-coverage-backend/api-report.md +++ b/plugins/code-coverage-backend/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import express from 'express'; -import { Logger as Logger_2 } from 'winston'; +import { Logger } from 'winston'; import { PluginDatabaseManager } from '@backstage/backend-common'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; import { UrlReader } from '@backstage/backend-common'; @@ -32,7 +32,7 @@ export interface RouterOptions { // (undocumented) discovery: PluginEndpointDiscovery; // (undocumented) - logger: Logger_2; + logger: Logger; // (undocumented) urlReader: UrlReader; } diff --git a/plugins/graphql/api-report.md b/plugins/graphql/api-report.md index ef172afbd7..8109c94122 100644 --- a/plugins/graphql/api-report.md +++ b/plugins/graphql/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import express from 'express'; -import { Logger as Logger_2 } from 'winston'; +import { Logger } from 'winston'; // @public (undocumented) export function createRouter(options: RouterOptions): Promise; @@ -16,7 +16,7 @@ export interface RouterOptions { // (undocumented) config: Config; // (undocumented) - logger: Logger_2; + logger: Logger; } diff --git a/plugins/kafka-backend/api-report.md b/plugins/kafka-backend/api-report.md index 6840bd7527..47754ad572 100644 --- a/plugins/kafka-backend/api-report.md +++ b/plugins/kafka-backend/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import express from 'express'; -import { Logger as Logger_2 } from 'winston'; +import { Logger } from 'winston'; // @public (undocumented) export function createRouter(options: RouterOptions): Promise; diff --git a/plugins/kubernetes-backend/api-report.md b/plugins/kubernetes-backend/api-report.md index a9389b7e62..fe43e8888a 100644 --- a/plugins/kubernetes-backend/api-report.md +++ b/plugins/kubernetes-backend/api-report.md @@ -9,7 +9,7 @@ import express from 'express'; import { FetchResponse } from '@backstage/plugin-kubernetes-common'; import { KubernetesFetchError } from '@backstage/plugin-kubernetes-common'; import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common'; -import { Logger as Logger_2 } from 'winston'; +import { Logger } from 'winston'; // @public (undocumented) export interface ClusterDetails { @@ -68,7 +68,7 @@ export interface KubernetesServiceLocator { } // @public (undocumented) -export const makeRouter: (logger: Logger_2, kubernetesFanOutHandler: KubernetesFanOutHandler, clusterDetails: ClusterDetails[]) => express.Router; +export const makeRouter: (logger: Logger, kubernetesFanOutHandler: KubernetesFanOutHandler, clusterDetails: ClusterDetails[]) => express.Router; // @public (undocumented) export interface ObjectFetchParams { @@ -91,7 +91,7 @@ export interface RouterOptions { // (undocumented) config: Config; // (undocumented) - logger: Logger_2; + logger: Logger; } // @public (undocumented) diff --git a/plugins/proxy-backend/api-report.md b/plugins/proxy-backend/api-report.md index 63469a2017..1b1eba3b00 100644 --- a/plugins/proxy-backend/api-report.md +++ b/plugins/proxy-backend/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import express from 'express'; -import { Logger as Logger_2 } from 'winston'; +import { Logger } from 'winston'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; // @public (undocumented) diff --git a/plugins/rollbar-backend/api-report.md b/plugins/rollbar-backend/api-report.md index 9fa525cfc3..fa8c67d4f0 100644 --- a/plugins/rollbar-backend/api-report.md +++ b/plugins/rollbar-backend/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import express from 'express'; -import { Logger as Logger_2 } from 'winston'; +import { Logger } from 'winston'; // @public (undocumented) export function createRouter(options: RouterOptions): Promise; @@ -20,7 +20,7 @@ export function getRequestHeaders(token: string): { // @public (undocumented) export class RollbarApi { - constructor(accessToken: string, logger: Logger_2); + constructor(accessToken: string, logger: Logger); // (undocumented) getActivatedCounts(projectName: string, options?: { environment: string; @@ -49,7 +49,7 @@ export interface RouterOptions { // (undocumented) config: Config; // (undocumented) - logger: Logger_2; + logger: Logger; // (undocumented) rollbarApi?: RollbarApi; } diff --git a/plugins/search-backend-node/api-report.md b/plugins/search-backend-node/api-report.md index ccb7475573..03585b6b99 100644 --- a/plugins/search-backend-node/api-report.md +++ b/plugins/search-backend-node/api-report.md @@ -7,7 +7,7 @@ import { DocumentCollator } from '@backstage/search-common'; import { DocumentDecorator } from '@backstage/search-common'; import { IndexableDocument } from '@backstage/search-common'; -import { Logger as Logger_2 } from 'winston'; +import { Logger } from 'winston'; import { default as lunr_2 } from 'lunr'; import { SearchQuery } from '@backstage/search-common'; import { SearchResultSet } from '@backstage/search-common'; @@ -27,14 +27,14 @@ export class IndexBuilder { // @public (undocumented) export class LunrSearchEngine implements SearchEngine { constructor({ logger }: { - logger: Logger_2; + logger: Logger; }); // (undocumented) protected docStore: Record; // (undocumented) index(type: string, documents: IndexableDocument[]): void; // (undocumented) - protected logger: Logger_2; + protected logger: Logger; // (undocumented) protected lunrIndices: Record; // (undocumented) @@ -48,7 +48,7 @@ export class LunrSearchEngine implements SearchEngine { // @public export class Scheduler { constructor({ logger }: { - logger: Logger_2; + logger: Logger; }); addToSchedule(task: Function, interval: number): void; start(): void; diff --git a/plugins/search-backend/api-report.md b/plugins/search-backend/api-report.md index 7eba677439..9e617b73ed 100644 --- a/plugins/search-backend/api-report.md +++ b/plugins/search-backend/api-report.md @@ -5,7 +5,7 @@ ```ts import express from 'express'; -import { Logger as Logger_2 } from 'winston'; +import { Logger } from 'winston'; import { SearchEngine } from '@backstage/plugin-search-backend-node'; // @public (undocumented) diff --git a/plugins/techdocs-backend/api-report.md b/plugins/techdocs-backend/api-report.md index 947439533a..d433d428e0 100644 --- a/plugins/techdocs-backend/api-report.md +++ b/plugins/techdocs-backend/api-report.md @@ -8,7 +8,7 @@ import { Config } from '@backstage/config'; import express from 'express'; import { GeneratorBuilder } from '@backstage/techdocs-common'; import { Knex } from 'knex'; -import { Logger as Logger_2 } from 'winston'; +import { Logger } from 'winston'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; import { PreparerBuilder } from '@backstage/techdocs-common'; import { PublisherBase } from '@backstage/techdocs-common'; diff --git a/plugins/todo-backend/api-report.md b/plugins/todo-backend/api-report.md index d203a52b36..8bcfe30aee 100644 --- a/plugins/todo-backend/api-report.md +++ b/plugins/todo-backend/api-report.md @@ -8,7 +8,7 @@ import { CatalogApi } from '@backstage/catalog-client'; import { Config } from '@backstage/config'; import { EntityName } from '@backstage/catalog-model'; import express from 'express'; -import { Logger as Logger_2 } from 'winston'; +import { Logger } from 'winston'; import { ScmIntegrations } from '@backstage/integration'; import { UrlReader } from '@backstage/backend-common'; From 944640535ac8d6fdf5d8d936b132c7aef571525b Mon Sep 17 00:00:00 2001 From: Rogerio Angeliski Date: Thu, 1 Jul 2021 21:47:54 -0300 Subject: [PATCH 135/168] update with PR comments Signed-off-by: Rogerio Angeliski --- .../scaffolder-backend-module-rails/README.md | 26 ++++++++++++++++++- .../Rails.dockerfile | 6 ++--- .../package.json | 1 + .../src/actions/fetch/rails/index.test.ts | 6 ++--- .../fetch/rails/railsArgumentResolver.test.ts | 10 +++++-- .../fetch/rails/railsArgumentResolver.ts | 8 +++++- .../sample-templates/local-templates.yaml | 1 - .../scaffolder/actions/builtin/fetch/index.ts | 2 +- 8 files changed, 47 insertions(+), 13 deletions(-) diff --git a/plugins/scaffolder-backend-module-rails/README.md b/plugins/scaffolder-backend-module-rails/README.md index 3c0c9da53e..3da594dd75 100644 --- a/plugins/scaffolder-backend-module-rails/README.md +++ b/plugins/scaffolder-backend-module-rails/README.md @@ -11,7 +11,10 @@ Here you can find all Rails related features to improve your scaffolder: You need to configure the action in your backend: +## From your Backstage root directory + ``` +cd packages/backend yarn add @backstage/plugin-scaffolder-backend-module-rails ``` @@ -222,4 +225,25 @@ spec: entityRef: '{{ steps.register.output.entityRef }}' ``` -We have a [Docker image](https://github.com/backstage/backstage/blob/master/plugins/scaffolder-backend-module-rails/Rails.dockerfile) you can use to build your own. +### What you need to run that action + +The environment need to have a [rails](https://github.com/rails/rails#getting-started) installation, or you can build and provide a docker image in your template. + +We have a [Dockerfile](https://github.com/backstage/backstage/blob/master/plugins/scaffolder-backend-module-rails/Rails.dockerfile) that you can use to build your image. + +If you choose to provide a docker image, you need to update your template with `imageName` parameter: + +```yaml +steps: + - id: fetch-base + name: Fetch Base + action: fetch:rails + input: + url: ./template + imageName: repository/rails:tag + values: + name: '{{ parameters.name }}' + owner: '{{ parameters.owner }}' + system: '{{ parameters.system }}' + railsArguments: '{{ json parameters.railsArguments }}' +``` diff --git a/plugins/scaffolder-backend-module-rails/Rails.dockerfile b/plugins/scaffolder-backend-module-rails/Rails.dockerfile index 3cec0e7668..0774fdc975 100644 --- a/plugins/scaffolder-backend-module-rails/Rails.dockerfile +++ b/plugins/scaffolder-backend-module-rails/Rails.dockerfile @@ -1,9 +1,7 @@ FROM ruby:3.0 RUN apt-get update -qq && \ - apt-get install -y \ - nodejs \ - postgresql-client \ - git + apt-get install -y nodejs postgresql-client git && \ + rm -rf /var/lib/apt/lists/ RUN gem install rails diff --git a/plugins/scaffolder-backend-module-rails/package.json b/plugins/scaffolder-backend-module-rails/package.json index b2765b04f5..b513100f16 100644 --- a/plugins/scaffolder-backend-module-rails/package.json +++ b/plugins/scaffolder-backend-module-rails/package.json @@ -4,6 +4,7 @@ "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", + "private": false, "publishConfig": { "access": "public", "main": "dist/index.esm.js", diff --git a/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/index.test.ts b/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/index.test.ts index cedc768f88..6b98dd86c6 100644 --- a/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/index.test.ts +++ b/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/index.test.ts @@ -34,7 +34,7 @@ import { } from '@backstage/backend-common'; import { ConfigReader } from '@backstage/config'; import { ScmIntegrations } from '@backstage/integration'; -import mock from 'mock-fs'; +import mockFs from 'mock-fs'; import os from 'os'; import { resolve as resolvePath } from 'path'; import { PassThrough } from 'stream'; @@ -86,12 +86,12 @@ describe('fetch:rails', () => { }); beforeEach(() => { - mock({ [`${mockContext.workspacePath}/result`]: {} }); + mockFs({ [`${mockContext.workspacePath}/result`]: {} }); jest.restoreAllMocks(); }); afterEach(() => { - mock.restore(); + mockFs.restore(); }); it('should call fetchContents with the correct values', async () => { diff --git a/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/railsArgumentResolver.test.ts b/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/railsArgumentResolver.test.ts index a8c10625c2..99a113f4f7 100644 --- a/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/railsArgumentResolver.test.ts +++ b/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/railsArgumentResolver.test.ts @@ -15,9 +15,12 @@ */ import { railsArgumentResolver } from './railsArgumentResolver'; +import { sep as separatorPath } from 'path'; +import os from 'os'; describe('railsArgumentResolver', () => { describe('when provide the parameter', () => { + const root = os.platform() === 'win32' ? 'C:\\' : '/'; test.each([ [{}, []], [{ minimal: true }, ['--minimal']], @@ -27,7 +30,10 @@ describe('railsArgumentResolver', () => { [{ webpacker: 'vue' }, ['--webpack', 'vue']], [{ database: 'postgresql' }, ['--database', 'postgresql']], [{ railsVersion: 'dev' }, ['--dev']], - [{ template: './rails.rb' }, ['--template', '/tmp/rails.rb']], + [ + { template: `.${separatorPath}rails.rb` }, + ['--template', `${root}${separatorPath}rails.rb`], + ], ])( 'should include the argument to execution %p -> %p', (passedArguments: object, expected: Array) => { @@ -40,7 +46,7 @@ describe('railsArgumentResolver', () => { const { railsArguments } = values; - const argumentsToRun = railsArgumentResolver('/tmp', railsArguments); + const argumentsToRun = railsArgumentResolver(root, railsArguments); expect(argumentsToRun).toEqual(expected); }, diff --git a/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/railsArgumentResolver.ts b/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/railsArgumentResolver.ts index 5ea2f70895..b1ddadc6d9 100644 --- a/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/railsArgumentResolver.ts +++ b/plugins/scaffolder-backend-module-rails/src/actions/fetch/rails/railsArgumentResolver.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { sep as separatorPath } from 'path'; enum Webpacker { react = 'react', @@ -99,7 +100,12 @@ export const railsArgumentResolver = ( if (options?.template) { argumentsToRun.push('--template'); - argumentsToRun.push(options.template.replace('./', `${projectRoot}/`)); + argumentsToRun.push( + options.template.replace( + `.${separatorPath}`, + `${projectRoot}${separatorPath}`, + ), + ); } return argumentsToRun; diff --git a/plugins/scaffolder-backend/sample-templates/local-templates.yaml b/plugins/scaffolder-backend/sample-templates/local-templates.yaml index 59a55b3cd9..3b3acbae7e 100644 --- a/plugins/scaffolder-backend/sample-templates/local-templates.yaml +++ b/plugins/scaffolder-backend/sample-templates/local-templates.yaml @@ -10,5 +10,4 @@ spec: - ./create-react-app/template.yaml - ./springboot-grpc-template/template.yaml - ./v1beta2-demo/template.yaml - - ./rails-demo/template.yaml - ./pull-request/template.yaml diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/index.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/index.ts index 82bc387f26..fa6d23c032 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/index.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/index.ts @@ -16,4 +16,4 @@ export { createFetchPlainAction } from './plain'; export { createFetchCookiecutterAction } from './cookiecutter'; -export * from './helpers'; +export { fetchContents } from './helpers'; From 7a74046f1673c626066516f60cd60d900820161c Mon Sep 17 00:00:00 2001 From: Rogerio Angeliski Date: Mon, 5 Jul 2021 21:21:00 -0300 Subject: [PATCH 136/168] docs: added generated files Signed-off-by: Rogerio Angeliski --- packages/backend-common/api-report.md | 10 +++++----- packages/techdocs-common/api-report.md | 20 +++++++++---------- plugins/app-backend/api-report.md | 4 ++-- plugins/auth-backend/api-report.md | 6 +++--- .../catalog-backend-module-ldap/api-report.md | 10 +++++----- .../api-report.md | 8 ++++---- plugins/catalog-graphql/api-report.md | 4 ++-- plugins/code-coverage-backend/api-report.md | 4 ++-- plugins/graphql/api-report.md | 4 ++-- plugins/kafka-backend/api-report.md | 2 +- plugins/kubernetes-backend/api-report.md | 6 +++--- plugins/proxy-backend/api-report.md | 2 +- plugins/rollbar-backend/api-report.md | 6 +++--- plugins/search-backend-node/api-report.md | 8 ++++---- plugins/search-backend/api-report.md | 2 +- plugins/techdocs-backend/api-report.md | 2 +- plugins/todo-backend/api-report.md | 2 +- 17 files changed, 50 insertions(+), 50 deletions(-) diff --git a/packages/backend-common/api-report.md b/packages/backend-common/api-report.md index a21aaef4a6..22eac06ed2 100644 --- a/packages/backend-common/api-report.md +++ b/packages/backend-common/api-report.md @@ -19,7 +19,7 @@ import * as http from 'http'; import { isChildPath } from '@backstage/cli-common'; import { JsonValue } from '@backstage/config'; import { Knex } from 'knex'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import { MergeResult } from 'isomorphic-git'; import { PushResult } from 'isomorphic-git'; import { Readable } from 'stream'; @@ -129,7 +129,7 @@ export function errorHandler(options?: ErrorHandlerOptions): ErrorRequestHandler // @public (undocumented) export type ErrorHandlerOptions = { showStackTraces?: boolean; - logger?: Logger; + logger?: Logger_2; logClientErrors?: boolean; }; @@ -185,7 +185,7 @@ export class Git { static fromAuth: ({ username, password, logger, }: { username?: string | undefined; password?: string | undefined; - logger?: Logger | undefined; + logger?: Logger_2 | undefined; }) => Git; // (undocumented) init({ dir, defaultBranch, }: { @@ -301,7 +301,7 @@ export type ReadTreeResponseFile = { }; // @public -export function requestLoggingHandler(logger?: Logger): RequestHandler; +export function requestLoggingHandler(logger?: Logger_2): RequestHandler; // @public export function resolvePackagePath(name: string, ...paths: string[]): string; @@ -337,7 +337,7 @@ export type ServiceBuilder = { loadConfig(config: ConfigReader): ServiceBuilder; setPort(port: number): ServiceBuilder; setHost(host: string): ServiceBuilder; - setLogger(logger: Logger): ServiceBuilder; + setLogger(logger: Logger_2): ServiceBuilder; enableCors(options: cors.CorsOptions): ServiceBuilder; setHttpsSettings(settings: HttpsSettings): ServiceBuilder; addRouter(root: string, router: Router | RequestHandler): ServiceBuilder; diff --git a/packages/techdocs-common/api-report.md b/packages/techdocs-common/api-report.md index 3fff030eee..d25f55bf3a 100644 --- a/packages/techdocs-common/api-report.md +++ b/packages/techdocs-common/api-report.md @@ -12,17 +12,17 @@ import { EntityName } from '@backstage/catalog-model'; import express from 'express'; import { GitHubIntegrationConfig } from '@backstage/integration'; import { GitLabIntegrationConfig } from '@backstage/integration'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; import { UrlReader } from '@backstage/backend-common'; import { Writable } from 'stream'; // @public (undocumented) -export const checkoutGitRepository: (repoUrl: string, config: Config, logger: Logger) => Promise; +export const checkoutGitRepository: (repoUrl: string, config: Config, logger: Logger_2) => Promise; // @public (undocumented) export class CommonGitPreparer implements PreparerBase { - constructor(config: Config, logger: Logger); + constructor(config: Config, logger: Logger_2); // (undocumented) prepare(entity: Entity, options?: { etag?: string; @@ -31,7 +31,7 @@ export class CommonGitPreparer implements PreparerBase { // @public (undocumented) export class DirectoryPreparer implements PreparerBase { - constructor(config: Config, logger: Logger, reader: UrlReader); + constructor(config: Config, logger: Logger_2, reader: UrlReader); // (undocumented) prepare(entity: Entity): Promise; } @@ -51,7 +51,7 @@ export type GeneratorBuilder = { export class Generators implements GeneratorBuilder { // (undocumented) static fromConfig(config: Config, { logger, containerRunner, }: { - logger: Logger; + logger: Logger_2; containerRunner: ContainerRunner; }): Promise; // (undocumented) @@ -69,7 +69,7 @@ export const getDefaultBranch: (repositoryUrl: string, config: Config) => Promis // @public (undocumented) export const getDocFilesFromRepository: (reader: UrlReader, entity: Entity, opts?: { etag?: string | undefined; - logger?: Logger | undefined; + logger?: Logger_2 | undefined; } | undefined) => Promise; // @public (undocumented) @@ -88,7 +88,7 @@ export const getGitRepositoryTempFolder: (repositoryUrl: string, config: Config) export function getGitRepoType(url: string): string; // @public (undocumented) -export const getLastCommitTimestamp: (repositoryLocation: string, logger: Logger) => Promise; +export const getLastCommitTimestamp: (repositoryLocation: string, logger: Logger_2) => Promise; // @public (undocumented) export const getLocationForEntity: (entity: Entity) => ParsedLocationAnnotation; @@ -108,7 +108,7 @@ export const parseReferenceAnnotation: (annotationName: string, entity: Entity) // @public (undocumented) export type PreparerBase = { prepare(entity: Entity, options?: { - logger?: Logger; + logger?: Logger_2; etag?: string; }): Promise; }; @@ -153,7 +153,7 @@ export type RemoteProtocol = 'url' | 'dir' | 'github' | 'gitlab' | 'file' | 'azu // @public (undocumented) export class TechdocsGenerator implements GeneratorBase { constructor({ logger, containerRunner, config, }: { - logger: Logger; + logger: Logger_2; containerRunner: ContainerRunner; config: Config; }); @@ -170,7 +170,7 @@ export type TechDocsMetadata = { // @public (undocumented) export class UrlPreparer implements PreparerBase { - constructor(reader: UrlReader, logger: Logger); + constructor(reader: UrlReader, logger: Logger_2); // (undocumented) prepare(entity: Entity, options?: { etag?: string; diff --git a/plugins/app-backend/api-report.md b/plugins/app-backend/api-report.md index 4f59102265..93aba5596f 100644 --- a/plugins/app-backend/api-report.md +++ b/plugins/app-backend/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import express from 'express'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; // @public (undocumented) export function createRouter(options: RouterOptions): Promise; @@ -18,7 +18,7 @@ export interface RouterOptions { config: Config; disableConfigInjection?: boolean; // (undocumented) - logger: Logger; + logger: Logger_2; staticFallbackHandler?: express.Handler; } diff --git a/plugins/auth-backend/api-report.md b/plugins/auth-backend/api-report.md index 6ae878accf..9f9a8d18ef 100644 --- a/plugins/auth-backend/api-report.md +++ b/plugins/auth-backend/api-report.md @@ -9,7 +9,7 @@ import { Config } from '@backstage/config'; import { Entity } from '@backstage/catalog-model'; import express from 'express'; import { JSONWebKey } from 'jose'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import { PluginDatabaseManager } from '@backstage/backend-common'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; import { Profile } from 'passport'; @@ -23,7 +23,7 @@ export type AuthProviderFactoryOptions = { providerId: string; globalConfig: AuthProviderConfig; config: Config; - logger: Logger; + logger: Logger_2; tokenIssuer: TokenIssuer; discovery: PluginEndpointDiscovery; catalogApi: CatalogApi; @@ -206,7 +206,7 @@ export interface RouterOptions { // (undocumented) discovery: PluginEndpointDiscovery; // (undocumented) - logger: Logger; + logger: Logger_2; // (undocumented) providerFactories?: ProviderFactories; } diff --git a/plugins/catalog-backend-module-ldap/api-report.md b/plugins/catalog-backend-module-ldap/api-report.md index 55405cab41..446dc2df52 100644 --- a/plugins/catalog-backend-module-ldap/api-report.md +++ b/plugins/catalog-backend-module-ldap/api-report.md @@ -11,7 +11,7 @@ import { Config } from '@backstage/config'; import { GroupEntity } from '@backstage/catalog-model'; import { JsonValue } from '@backstage/config'; import { LocationSpec } from '@backstage/catalog-model'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import { SearchEntry } from 'ldapjs'; import { SearchOptions } from 'ldapjs'; import { UserEntity } from '@backstage/catalog-model'; @@ -38,7 +38,7 @@ export const LDAP_UUID_ANNOTATION = "backstage.io/ldap-uuid"; export class LdapClient { constructor(client: Client); // (undocumented) - static create(logger: Logger, target: string, bind?: BindConfig): Promise; + static create(logger: Logger_2, target: string, bind?: BindConfig): Promise; getRootDSE(): Promise; getVendor(): Promise; search(dn: string, options: SearchOptions): Promise; @@ -48,13 +48,13 @@ export class LdapClient { export class LdapOrgReaderProcessor implements CatalogProcessor { constructor(options: { providers: LdapProviderConfig[]; - logger: Logger; + logger: Logger_2; groupTransformer?: GroupTransformer; userTransformer?: UserTransformer; }); // (undocumented) static fromConfig(config: Config, options: { - logger: Logger; + logger: Logger_2; groupTransformer?: GroupTransformer; userTransformer?: UserTransformer; }): LdapOrgReaderProcessor; @@ -80,7 +80,7 @@ export function readLdapConfig(config: Config): LdapProviderConfig[]; export function readLdapOrg(client: LdapClient, userConfig: UserConfig, groupConfig: GroupConfig, options: { groupTransformer?: GroupTransformer; userTransformer?: UserTransformer; - logger: Logger; + logger: Logger_2; }): Promise<{ users: UserEntity[]; groups: GroupEntity[]; diff --git a/plugins/catalog-backend-module-msgraph/api-report.md b/plugins/catalog-backend-module-msgraph/api-report.md index f1e7e22c35..c755514b48 100644 --- a/plugins/catalog-backend-module-msgraph/api-report.md +++ b/plugins/catalog-backend-module-msgraph/api-report.md @@ -9,7 +9,7 @@ import { CatalogProcessorEmit } from '@backstage/plugin-catalog-backend'; import { Config } from '@backstage/config'; import { GroupEntity } from '@backstage/catalog-model'; import { LocationSpec } from '@backstage/catalog-model'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import * as MicrosoftGraph from '@microsoft/microsoft-graph-types'; import * as msal from '@azure/msal-node'; import { UserEntity } from '@backstage/catalog-model'; @@ -70,12 +70,12 @@ export class MicrosoftGraphClient { export class MicrosoftGraphOrgReaderProcessor implements CatalogProcessor { constructor(options: { providers: MicrosoftGraphProviderConfig[]; - logger: Logger; + logger: Logger_2; groupTransformer?: GroupTransformer; }); // (undocumented) static fromConfig(config: Config, options: { - logger: Logger; + logger: Logger_2; groupTransformer?: GroupTransformer; }): MicrosoftGraphOrgReaderProcessor; // (undocumented) @@ -107,7 +107,7 @@ export function readMicrosoftGraphOrg(client: MicrosoftGraphClient, tenantId: st userFilter?: string; groupFilter?: string; groupTransformer?: GroupTransformer; - logger: Logger; + logger: Logger_2; }): Promise<{ users: UserEntity[]; groups: GroupEntity[]; diff --git a/plugins/catalog-graphql/api-report.md b/plugins/catalog-graphql/api-report.md index cbe325f4c5..40e8a19b66 100644 --- a/plugins/catalog-graphql/api-report.md +++ b/plugins/catalog-graphql/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import { GraphQLModule } from '@graphql-modules/core'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; // @public (undocumented) export function createModule(options: ModuleOptions): Promise; @@ -16,7 +16,7 @@ export interface ModuleOptions { // (undocumented) config: Config; // (undocumented) - logger: Logger; + logger: Logger_2; } diff --git a/plugins/code-coverage-backend/api-report.md b/plugins/code-coverage-backend/api-report.md index f8f1575d0b..186b76fb39 100644 --- a/plugins/code-coverage-backend/api-report.md +++ b/plugins/code-coverage-backend/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import express from 'express'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import { PluginDatabaseManager } from '@backstage/backend-common'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; import { UrlReader } from '@backstage/backend-common'; @@ -32,7 +32,7 @@ export interface RouterOptions { // (undocumented) discovery: PluginEndpointDiscovery; // (undocumented) - logger: Logger; + logger: Logger_2; // (undocumented) urlReader: UrlReader; } diff --git a/plugins/graphql/api-report.md b/plugins/graphql/api-report.md index 8109c94122..ef172afbd7 100644 --- a/plugins/graphql/api-report.md +++ b/plugins/graphql/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import express from 'express'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; // @public (undocumented) export function createRouter(options: RouterOptions): Promise; @@ -16,7 +16,7 @@ export interface RouterOptions { // (undocumented) config: Config; // (undocumented) - logger: Logger; + logger: Logger_2; } diff --git a/plugins/kafka-backend/api-report.md b/plugins/kafka-backend/api-report.md index 47754ad572..6840bd7527 100644 --- a/plugins/kafka-backend/api-report.md +++ b/plugins/kafka-backend/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import express from 'express'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; // @public (undocumented) export function createRouter(options: RouterOptions): Promise; diff --git a/plugins/kubernetes-backend/api-report.md b/plugins/kubernetes-backend/api-report.md index fe43e8888a..a9389b7e62 100644 --- a/plugins/kubernetes-backend/api-report.md +++ b/plugins/kubernetes-backend/api-report.md @@ -9,7 +9,7 @@ import express from 'express'; import { FetchResponse } from '@backstage/plugin-kubernetes-common'; import { KubernetesFetchError } from '@backstage/plugin-kubernetes-common'; import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; // @public (undocumented) export interface ClusterDetails { @@ -68,7 +68,7 @@ export interface KubernetesServiceLocator { } // @public (undocumented) -export const makeRouter: (logger: Logger, kubernetesFanOutHandler: KubernetesFanOutHandler, clusterDetails: ClusterDetails[]) => express.Router; +export const makeRouter: (logger: Logger_2, kubernetesFanOutHandler: KubernetesFanOutHandler, clusterDetails: ClusterDetails[]) => express.Router; // @public (undocumented) export interface ObjectFetchParams { @@ -91,7 +91,7 @@ export interface RouterOptions { // (undocumented) config: Config; // (undocumented) - logger: Logger; + logger: Logger_2; } // @public (undocumented) diff --git a/plugins/proxy-backend/api-report.md b/plugins/proxy-backend/api-report.md index 1b1eba3b00..63469a2017 100644 --- a/plugins/proxy-backend/api-report.md +++ b/plugins/proxy-backend/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import express from 'express'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; // @public (undocumented) diff --git a/plugins/rollbar-backend/api-report.md b/plugins/rollbar-backend/api-report.md index fa8c67d4f0..9fa525cfc3 100644 --- a/plugins/rollbar-backend/api-report.md +++ b/plugins/rollbar-backend/api-report.md @@ -6,7 +6,7 @@ import { Config } from '@backstage/config'; import express from 'express'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; // @public (undocumented) export function createRouter(options: RouterOptions): Promise; @@ -20,7 +20,7 @@ export function getRequestHeaders(token: string): { // @public (undocumented) export class RollbarApi { - constructor(accessToken: string, logger: Logger); + constructor(accessToken: string, logger: Logger_2); // (undocumented) getActivatedCounts(projectName: string, options?: { environment: string; @@ -49,7 +49,7 @@ export interface RouterOptions { // (undocumented) config: Config; // (undocumented) - logger: Logger; + logger: Logger_2; // (undocumented) rollbarApi?: RollbarApi; } diff --git a/plugins/search-backend-node/api-report.md b/plugins/search-backend-node/api-report.md index 03585b6b99..ccb7475573 100644 --- a/plugins/search-backend-node/api-report.md +++ b/plugins/search-backend-node/api-report.md @@ -7,7 +7,7 @@ import { DocumentCollator } from '@backstage/search-common'; import { DocumentDecorator } from '@backstage/search-common'; import { IndexableDocument } from '@backstage/search-common'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import { default as lunr_2 } from 'lunr'; import { SearchQuery } from '@backstage/search-common'; import { SearchResultSet } from '@backstage/search-common'; @@ -27,14 +27,14 @@ export class IndexBuilder { // @public (undocumented) export class LunrSearchEngine implements SearchEngine { constructor({ logger }: { - logger: Logger; + logger: Logger_2; }); // (undocumented) protected docStore: Record; // (undocumented) index(type: string, documents: IndexableDocument[]): void; // (undocumented) - protected logger: Logger; + protected logger: Logger_2; // (undocumented) protected lunrIndices: Record; // (undocumented) @@ -48,7 +48,7 @@ export class LunrSearchEngine implements SearchEngine { // @public export class Scheduler { constructor({ logger }: { - logger: Logger; + logger: Logger_2; }); addToSchedule(task: Function, interval: number): void; start(): void; diff --git a/plugins/search-backend/api-report.md b/plugins/search-backend/api-report.md index 9e617b73ed..7eba677439 100644 --- a/plugins/search-backend/api-report.md +++ b/plugins/search-backend/api-report.md @@ -5,7 +5,7 @@ ```ts import express from 'express'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import { SearchEngine } from '@backstage/plugin-search-backend-node'; // @public (undocumented) diff --git a/plugins/techdocs-backend/api-report.md b/plugins/techdocs-backend/api-report.md index d433d428e0..947439533a 100644 --- a/plugins/techdocs-backend/api-report.md +++ b/plugins/techdocs-backend/api-report.md @@ -8,7 +8,7 @@ import { Config } from '@backstage/config'; import express from 'express'; import { GeneratorBuilder } from '@backstage/techdocs-common'; import { Knex } from 'knex'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import { PluginEndpointDiscovery } from '@backstage/backend-common'; import { PreparerBuilder } from '@backstage/techdocs-common'; import { PublisherBase } from '@backstage/techdocs-common'; diff --git a/plugins/todo-backend/api-report.md b/plugins/todo-backend/api-report.md index 8bcfe30aee..d203a52b36 100644 --- a/plugins/todo-backend/api-report.md +++ b/plugins/todo-backend/api-report.md @@ -8,7 +8,7 @@ import { CatalogApi } from '@backstage/catalog-client'; import { Config } from '@backstage/config'; import { EntityName } from '@backstage/catalog-model'; import express from 'express'; -import { Logger } from 'winston'; +import { Logger as Logger_2 } from 'winston'; import { ScmIntegrations } from '@backstage/integration'; import { UrlReader } from '@backstage/backend-common'; From fdac00fb3fe6810e8ad603fd907cf164f3aa44b2 Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Wed, 7 Jul 2021 13:10:36 +0100 Subject: [PATCH 137/168] scaffolder: fix typo in fetch:template migration docs Signed-off-by: Mike Lewis --- docs/features/software-templates/builtin-actions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/features/software-templates/builtin-actions.md b/docs/features/software-templates/builtin-actions.md index 5cd6b005d9..8c80eaedae 100644 --- a/docs/features/software-templates/builtin-actions.md +++ b/docs/features/software-templates/builtin-actions.md @@ -28,7 +28,7 @@ allow most templates built for `fetch:cookiecutter` to work without any changes. 1. Update action name in `template.yaml`. The name should be changed from `fetch:cookiecutter` to `fetch:template`. -2. Set `cookieCutterCompat` to `true` in the `fetch:template` step input in +2. Set `cookiecutterCompat` to `true` in the `fetch:template` step input in `template.yaml`. #### Manual migration From 3ee0caf82e6a99052f7f01b93e5cd992f8a597aa Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Wed, 7 Jul 2021 13:13:25 +0100 Subject: [PATCH 138/168] scaffolder: add example diff in fetch:template migration docs Signed-off-by: Mike Lewis --- docs/features/software-templates/builtin-actions.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/features/software-templates/builtin-actions.md b/docs/features/software-templates/builtin-actions.md index 8c80eaedae..cdf5f5fb2d 100644 --- a/docs/features/software-templates/builtin-actions.md +++ b/docs/features/software-templates/builtin-actions.md @@ -31,6 +31,18 @@ allow most templates built for `fetch:cookiecutter` to work without any changes. 2. Set `cookiecutterCompat` to `true` in the `fetch:template` step input in `template.yaml`. +```diff + steps: + - id: fetch-base + name: Fetch Base +- action: fetch:cookiecutter ++ action: fetch:template + input: + url: ./skeleton ++ cookiecutterCompat: true + values: +``` + #### Manual migration If you prefer, you can manually migrate your templates to avoid the need for From b2db928644c0f467f68dc021e4a7dc066d75eabb Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Wed, 7 Jul 2021 13:17:39 +0100 Subject: [PATCH 139/168] scaffolder: improve fetch:template migration docs Signed-off-by: Mike Lewis --- docs/features/software-templates/builtin-actions.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/features/software-templates/builtin-actions.md b/docs/features/software-templates/builtin-actions.md index cdf5f5fb2d..af3ae97b21 100644 --- a/docs/features/software-templates/builtin-actions.md +++ b/docs/features/software-templates/builtin-actions.md @@ -57,8 +57,11 @@ verbose template variables expressions. `${{` `}}` and prefixed with `values.`. For example, a reference to variable `myInputVariable` would need to be migrated from `{{ cookiecutter.myInputVariable }}` to `${{ values.myInputVariable }}`. -3. Replace uses of `jsonify` with `dump`. The `jsonify` filter is built in to - `cookiecutter`, and is not available by default when using `fetch:template`. - The `dump` filter is equivalent, so an expression like - `{{ myAwesomeList | jsonify }}` should be migrated to - `${{ myAwesomeList | dump }}`. +3. Replace uses of `jsonify` with `dump`. The + [`jsonify` filter](https://cookiecutter.readthedocs.io/en/latest/advanced/template_extensions.html#jsonify-extension) + is built in to `cookiecutter`, and is not available by default when using + `fetch:template`. The + [`dump` filter](https://mozilla.github.io/nunjucks/templating.html#dump) is + the equivalent filter in nunjucks, so an expression like + `{{ cookiecutter.myAwesomeList | jsonify }}` should be migrated to + `${{ values.myAwesomeList | dump }}`. From b4035aa463366ba744928db9ff1873f913912af4 Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Wed, 7 Jul 2021 13:21:24 +0100 Subject: [PATCH 140/168] scaffolder: tweak test description in fetch:template suite Signed-off-by: Mike Lewis --- .../src/scaffolder/actions/builtin/fetch/template.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.test.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.test.ts index 79cc5be524..bd2beae47a 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.test.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.test.ts @@ -180,7 +180,7 @@ describe('fetch:template', () => { ).resolves.toEqual([]); }); - it('copies binary files as it-is without processing them', async () => { + it('copies binary files as-is without processing them', async () => { await expect( fs.readFile(`${workspacePath}/target/a-binary-file.png`), ).resolves.toEqual(aBinaryFile); From 13d9940cde373ba0e070ee15a8df84bc033197aa Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Wed, 7 Jul 2021 13:22:44 +0100 Subject: [PATCH 141/168] scaffolder: remove completed TODO in fetch:template Signed-off-by: Mike Lewis --- .../src/scaffolder/actions/builtin/fetch/template.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts index 4fd505f9b0..87e67f76be 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts @@ -89,7 +89,6 @@ export function createFetchTemplateAction(options: { }, cookiecutterCompat: { title: 'Cookiecutter compatibility mode', - // TODO(mtlewis): documentation for cookiecutter compat mode description: 'Enable features to maximise compatibility with templates built for fetch:cookiecutter', type: 'boolean', From 02b962394b19a73c829640c86f1e6cd54841b1e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 7 Jul 2021 13:27:39 +0200 Subject: [PATCH 142/168] Added a `context` parameter to validator functions, letting them have access to the API holder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .changeset/great-bears-work.md | 10 ++++++ plugins/scaffolder/api-report.md | 13 ++++++++ .../components/TemplatePage/TemplatePage.tsx | 33 ++++++++++++++----- .../fields/RepoUrlPicker/validation.test.ts | 3 +- .../fields/RepoUrlPicker/validation.ts | 1 + plugins/scaffolder/src/extensions/index.tsx | 4 +-- plugins/scaffolder/src/extensions/types.ts | 11 ++++++- plugins/scaffolder/src/index.ts | 6 ++-- 8 files changed, 66 insertions(+), 15 deletions(-) create mode 100644 .changeset/great-bears-work.md diff --git a/.changeset/great-bears-work.md b/.changeset/great-bears-work.md new file mode 100644 index 0000000000..572cf1538d --- /dev/null +++ b/.changeset/great-bears-work.md @@ -0,0 +1,10 @@ +--- +'@backstage/plugin-scaffolder': patch +--- + +Added a `context` parameter to validator functions, letting them have access to +the API holder. + +If you have implemented custom validators and use `createScaffolderFieldExtension`, +your `validation` function can now optionally accept a third parameter, +`context: { apiHolder: ApiHolder }`. diff --git a/plugins/scaffolder/api-report.md b/plugins/scaffolder/api-report.md index 5da1869fc2..7982ad997e 100644 --- a/plugins/scaffolder/api-report.md +++ b/plugins/scaffolder/api-report.md @@ -4,6 +4,7 @@ ```ts +import { ApiHolder } from '@backstage/core-plugin-api'; import { ApiRef } from '@backstage/core-plugin-api'; import { BackstagePlugin } from '@backstage/core-plugin-api'; import { DiscoveryApi } from '@backstage/core-plugin-api'; @@ -24,9 +25,21 @@ import { ScmIntegrationRegistry } from '@backstage/integration'; // @public (undocumented) export function createScaffolderFieldExtension(options: FieldExtensionOptions): Extension<() => null>; +// @public (undocumented) +export type CustomFieldValidator = ((data: T, field: FieldValidation) => void) | ((data: T, field: FieldValidation, context: { + apiHolder: ApiHolder; +}) => void); + // @public (undocumented) export const EntityPickerFieldExtension: () => null; +// @public (undocumented) +export type FieldExtensionOptions = { + name: string; + component: (props: FieldProps) => JSX.Element | null; + validation?: CustomFieldValidator; +}; + // @public (undocumented) export const OwnerPickerFieldExtension: () => null; diff --git a/plugins/scaffolder/src/components/TemplatePage/TemplatePage.tsx b/plugins/scaffolder/src/components/TemplatePage/TemplatePage.tsx index b6cab5b620..e72255f129 100644 --- a/plugins/scaffolder/src/components/TemplatePage/TemplatePage.tsx +++ b/plugins/scaffolder/src/components/TemplatePage/TemplatePage.tsx @@ -15,13 +15,13 @@ */ import { JsonObject, JsonValue } from '@backstage/config'; import { LinearProgress } from '@material-ui/core'; -import { FieldValidation, FormValidation, IChangeEvent } from '@rjsf/core'; +import { FormValidation, IChangeEvent } from '@rjsf/core'; import React, { useCallback, useState } from 'react'; import { generatePath, Navigate, useNavigate } from 'react-router'; import { useParams } from 'react-router-dom'; import { useAsync } from 'react-use'; import { scaffolderApiRef } from '../../api'; -import { FieldExtensionOptions } from '../../extensions'; +import { CustomFieldValidator, FieldExtensionOptions } from '../../extensions'; import { rootRouteRef } from '../../routes'; import { MultistepJsonForm } from '../MultistepJsonForm'; @@ -32,7 +32,13 @@ import { Lifecycle, Page, } from '@backstage/core-components'; -import { errorApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api'; +import { + ApiHolder, + errorApiRef, + useApi, + useApiHolder, + useRouteRef, +} from '@backstage/core-plugin-api'; const useTemplateParameterSchema = (templateName: string) => { const scaffolderApi = useApi(scaffolderApiRef); @@ -54,10 +60,10 @@ function isObject(obj: unknown): obj is JsonObject { export const createValidator = ( rootSchema: JsonObject, - validators: Record< - string, - undefined | ((value: JsonValue, validation: FieldValidation) => void) - >, + validators: Record>, + context: { + apiHolder: ApiHolder; + }, ) => { function validate( schema: JsonObject, @@ -86,7 +92,11 @@ export const createValidator = ( const fieldName = isObject(propSchema) && (propSchema['ui:field'] as string); if (fieldName && typeof validators[fieldName] === 'function') { - validators[fieldName]!(propData as JsonValue, propValidation); + validators[fieldName]!( + propData as JsonValue, + propValidation, + context, + ); } } } @@ -103,6 +113,7 @@ export const TemplatePage = ({ }: { customFieldExtensions?: FieldExtensionOptions[]; }) => { + const apiHolder = useApiHolder(); const errorApi = useApi(errorApiRef); const scaffolderApi = useApi(scaffolderApiRef); const { templateName } = useParams(); @@ -171,7 +182,11 @@ export const TemplatePage = ({ steps={schema.steps.map(step => { return { ...step, - validate: createValidator(step.schema, customFieldValidators), + validate: createValidator( + step.schema, + customFieldValidators, + { apiHolder }, + ), }; })} /> diff --git a/plugins/scaffolder/src/components/fields/RepoUrlPicker/validation.test.ts b/plugins/scaffolder/src/components/fields/RepoUrlPicker/validation.test.ts index f0df198507..1ea66e7df9 100644 --- a/plugins/scaffolder/src/components/fields/RepoUrlPicker/validation.test.ts +++ b/plugins/scaffolder/src/components/fields/RepoUrlPicker/validation.test.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { repoPickerValidation } from './validation'; import { FieldValidation } from '@rjsf/core'; @@ -22,7 +23,7 @@ describe('RepoPicker Validation', () => { addError: jest.fn(), } as unknown) as FieldValidation); - it('validaties when no repo', () => { + it('validates when no repo', () => { const mockFieldValidation = fieldValidator(); repoPickerValidation('github.com?owner=a', mockFieldValidation); diff --git a/plugins/scaffolder/src/components/fields/RepoUrlPicker/validation.ts b/plugins/scaffolder/src/components/fields/RepoUrlPicker/validation.ts index 827afa3cab..760b9f7890 100644 --- a/plugins/scaffolder/src/components/fields/RepoUrlPicker/validation.ts +++ b/plugins/scaffolder/src/components/fields/RepoUrlPicker/validation.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { FieldValidation } from '@rjsf/core'; export const repoPickerValidation = ( diff --git a/plugins/scaffolder/src/extensions/index.tsx b/plugins/scaffolder/src/extensions/index.tsx index f53052cb67..131cd105da 100644 --- a/plugins/scaffolder/src/extensions/index.tsx +++ b/plugins/scaffolder/src/extensions/index.tsx @@ -15,7 +15,7 @@ */ import React from 'react'; -import { FieldExtensionOptions } from './types'; +import { CustomFieldValidator, FieldExtensionOptions } from './types'; import { Extension, attachComponentData } from '@backstage/core-plugin-api'; export const FIELD_EXTENSION_WRAPPER_KEY = 'scaffolder.extensions.wrapper.v1'; @@ -46,6 +46,6 @@ attachComponentData( true, ); -export type { FieldExtensionOptions }; +export type { CustomFieldValidator, FieldExtensionOptions }; export { DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS } from './default'; diff --git a/plugins/scaffolder/src/extensions/types.ts b/plugins/scaffolder/src/extensions/types.ts index 8f1c155f28..644897f7f4 100644 --- a/plugins/scaffolder/src/extensions/types.ts +++ b/plugins/scaffolder/src/extensions/types.ts @@ -13,10 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { ApiHolder } from '@backstage/core-plugin-api'; import { FieldValidation, FieldProps } from '@rjsf/core'; +export type CustomFieldValidator = + | ((data: T, field: FieldValidation) => void) + | (( + data: T, + field: FieldValidation, + context: { apiHolder: ApiHolder }, + ) => void); + export type FieldExtensionOptions = { name: string; component: (props: FieldProps) => JSX.Element | null; - validation?: (data: T, field: FieldValidation) => void; + validation?: CustomFieldValidator; }; diff --git a/plugins/scaffolder/src/index.ts b/plugins/scaffolder/src/index.ts index 6025abc067..a034f5f574 100644 --- a/plugins/scaffolder/src/index.ts +++ b/plugins/scaffolder/src/index.ts @@ -16,9 +16,11 @@ export { scaffolderApiRef, ScaffolderClient } from './api'; export type { ScaffolderApi } from './api'; -export { - createScaffolderFieldExtension, +export { createScaffolderFieldExtension } from './extensions'; +export type { ScaffolderFieldExtensions, + CustomFieldValidator, + FieldExtensionOptions, } from './extensions'; export { EntityPickerFieldExtension, From 32a7c5d975fb62de5426135e9189885247ec6dd7 Mon Sep 17 00:00:00 2001 From: Rogerio Angeliski Date: Wed, 7 Jul 2021 09:33:39 -0300 Subject: [PATCH 143/168] update rails plugin docs Signed-off-by: Rogerio Angeliski --- plugins/scaffolder-backend-module-rails/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/scaffolder-backend-module-rails/README.md b/plugins/scaffolder-backend-module-rails/README.md index 3da594dd75..4ac52be941 100644 --- a/plugins/scaffolder-backend-module-rails/README.md +++ b/plugins/scaffolder-backend-module-rails/README.md @@ -32,9 +32,7 @@ const actions = [ ]; return await createRouter({ - preparers, - templaters, - publishers, + containerRunner, logger, config, database, From 75b3d3d9815a8068862c0c0dad89f7cfcd37da92 Mon Sep 17 00:00:00 2001 From: Rogerio Angeliski Date: Wed, 7 Jul 2021 09:34:04 -0300 Subject: [PATCH 144/168] fix runCommand export Signed-off-by: Rogerio Angeliski --- .../src/scaffolder/actions/builtin/index.ts | 1 + .../src/scaffolder/stages/templater/index.ts | 20 ------------------- 2 files changed, 1 insertion(+), 20 deletions(-) delete mode 100644 plugins/scaffolder-backend/src/scaffolder/stages/templater/index.ts diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/index.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/index.ts index a5d5092327..849b056ac9 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/index.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/index.ts @@ -20,3 +20,4 @@ export * from './debug'; export * from './fetch'; export * from './filesystem'; export * from './publish'; +export { runCommand } from './helpers'; diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/templater/index.ts b/plugins/scaffolder-backend/src/scaffolder/stages/templater/index.ts deleted file mode 100644 index 4d80f86946..0000000000 --- a/plugins/scaffolder-backend/src/scaffolder/stages/templater/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2020 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export * from './cookiecutter'; -export * from './types'; -export * from './helpers'; -export * from './templaters'; -export * from './cra'; From 265e0851f4a79685ff06dec2b7becc7ff89dad63 Mon Sep 17 00:00:00 2001 From: Rogerio Angeliski Date: Wed, 7 Jul 2021 09:41:25 -0300 Subject: [PATCH 145/168] docs: added generated files Signed-off-by: Rogerio Angeliski --- plugins/scaffolder-backend/api-report.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/scaffolder-backend/api-report.md b/plugins/scaffolder-backend/api-report.md index e30542aca7..e8e8697291 100644 --- a/plugins/scaffolder-backend/api-report.md +++ b/plugins/scaffolder-backend/api-report.md @@ -118,6 +118,15 @@ export const createTemplateAction: | undefined; }>>(templateAction: TemplateAction) => TemplateAction; +// @public (undocumented) +export function fetchContents({ reader, integrations, baseUrl, fetchUrl, outputPath, }: { + reader: UrlReader; + integrations: ScmIntegrations; + baseUrl?: string; + fetchUrl?: JsonValue; + outputPath: string; +}): Promise; + // @public (undocumented) export interface RouterOptions { // (undocumented) @@ -138,6 +147,9 @@ export interface RouterOptions { taskWorkers?: number; } +// @public (undocumented) +export const runCommand: ({ command, args, logStream, }: RunCommandOptions) => Promise; + // @public (undocumented) export type TemplateAction = { id: string; From 1bcf50971252f63f7de8c8f80248f2cea8b95b8c Mon Sep 17 00:00:00 2001 From: Rogerio Angeliski Date: Wed, 7 Jul 2021 09:45:58 -0300 Subject: [PATCH 146/168] remove wrong dependency Signed-off-by: Rogerio Angeliski --- plugins/scaffolder-backend/package.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/scaffolder-backend/package.json b/plugins/scaffolder-backend/package.json index a88413d611..7173f865c5 100644 --- a/plugins/scaffolder-backend/package.json +++ b/plugins/scaffolder-backend/package.json @@ -40,8 +40,6 @@ "@octokit/rest": "^18.5.3", "@types/express": "^4.17.6", "azure-devops-node-api": "^10.2.2", - "@types/git-url-parse": "^9.0.0", - "azure-devops-node-api": "^10.1.1", "command-exists": "^1.2.9", "compression": "^1.7.4", "cors": "^2.8.5", From f2f5da9d2d9b60a81c2da098c03f3282cd8031b5 Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Wed, 7 Jul 2021 16:07:07 +0100 Subject: [PATCH 147/168] update changeset Co-authored-by: Tim Co-authored-by: Himanshu Mishra Co-authored-by: Chase Rutherford-Jenkins Co-authored-by: Joe Porpeglia Signed-off-by: Mike Lewis --- .changeset/grumpy-dolls-call.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.changeset/grumpy-dolls-call.md b/.changeset/grumpy-dolls-call.md index a2ef97ecb7..13d96ecb1f 100644 --- a/.changeset/grumpy-dolls-call.md +++ b/.changeset/grumpy-dolls-call.md @@ -1,10 +1,10 @@ --- -'@backstage/plugin-catalog-react': patch +'@backstage/plugin-catalog-react': minor '@backstage/plugin-scaffolder': patch --- Updated the software templates list page (`ScaffolderPage`) to use the `useEntityListProvider` hook from #5643. This reduces the code footprint, making it easier to customize the display of this page, and consolidates duplicate approaches to querying the catalog with filters. +- The `useEntityTypeFilter` hook has been updated along with the underlying `EntityTypeFilter` to work with multiple values, to allow more flexibility for different user interfaces. It's unlikely that this change affects you; however, if you're using either of these directly, you'll need to update your usage. - `SearchToolbar` was renamed to `EntitySearchBar` and moved to `catalog-react` to be usable by other entity list pages -- The `useEntityTypeFilter` hook now allows multiple selected types - `UserListPicker` now has an `availableTypes` prop to restrict which user-related options to present From eece4003bf0ddd64e775df1ac64afc1f3ce943b2 Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Wed, 7 Jul 2021 17:29:01 +0100 Subject: [PATCH 148/168] add nunjucks to dictionary Signed-off-by: Mike Lewis --- .github/styles/vocab.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/styles/vocab.txt b/.github/styles/vocab.txt index f6826cbefe..6cc276428f 100644 --- a/.github/styles/vocab.txt +++ b/.github/styles/vocab.txt @@ -169,6 +169,7 @@ nohoist nonces noop npm +nunjucks nvarchar nvm OAuth From 9f3ecb555aa7b18295ccd30dc5b1ca7850232b2e Mon Sep 17 00:00:00 2001 From: Oliver Sand Date: Wed, 7 Jul 2021 15:30:36 +0200 Subject: [PATCH 149/168] Build search queries using the query build in `LunrSearchEngine` Signed-off-by: Oliver Sand --- .changeset/search-olive-cars-talk.md | 7 + .changeset/search-slimy-taxis-live.md | 10 + .github/styles/vocab.txt | 1 + .../src/engines/LunrSearchEngine.test.ts | 235 +++++++++++++++++- .../src/engines/LunrSearchEngine.ts | 135 +++++----- .../search-backend-node/src/engines/index.ts | 1 + 6 files changed, 310 insertions(+), 79 deletions(-) create mode 100644 .changeset/search-olive-cars-talk.md create mode 100644 .changeset/search-slimy-taxis-live.md diff --git a/.changeset/search-olive-cars-talk.md b/.changeset/search-olive-cars-talk.md new file mode 100644 index 0000000000..64328d89b1 --- /dev/null +++ b/.changeset/search-olive-cars-talk.md @@ -0,0 +1,7 @@ +--- +'@backstage/plugin-search-backend-node': patch +--- + +Enhance the search results of `LunrSearchEngine` to support a more natural +search experience. This is done by allowing typos (by using fuzzy search) and +supporting typeahead search (using wildcard queries to match incomplete words). diff --git a/.changeset/search-slimy-taxis-live.md b/.changeset/search-slimy-taxis-live.md new file mode 100644 index 0000000000..c4615ef84c --- /dev/null +++ b/.changeset/search-slimy-taxis-live.md @@ -0,0 +1,10 @@ +--- +'@backstage/plugin-search-backend-node': minor +--- + +Build search queries using the query builder in `LunrSearchEngine`. This removes +the support for specifying custom queries with the lunr query syntax, but makes +sure that inputs are properly escaped. Supporting the full lunr syntax is still +possible by setting a custom query translator. +The interface of `LunrSearchEngine.setTranslator()` is changed to support +building lunr queries. diff --git a/.github/styles/vocab.txt b/.github/styles/vocab.txt index f6826cbefe..c095717def 100644 --- a/.github/styles/vocab.txt +++ b/.github/styles/vocab.txt @@ -274,6 +274,7 @@ touchpoints transpilation transpiled truthy +typeahead ui unbreak unmanaged diff --git a/plugins/search-backend-node/src/engines/LunrSearchEngine.test.ts b/plugins/search-backend-node/src/engines/LunrSearchEngine.test.ts index 22c775da8e..3c7945cbc3 100644 --- a/plugins/search-backend-node/src/engines/LunrSearchEngine.test.ts +++ b/plugins/search-backend-node/src/engines/LunrSearchEngine.test.ts @@ -15,8 +15,9 @@ */ import { getVoidLogger } from '@backstage/backend-common'; -import { LunrSearchEngine } from './LunrSearchEngine'; +import { ConcreteLunrQuery, LunrSearchEngine } from './LunrSearchEngine'; import { SearchEngine } from '../types'; +import lunr from 'lunr'; /** * Just used to test the default translator shipped with LunrSearchEngine. @@ -68,11 +69,35 @@ describe('LunrSearchEngine', () => { term: 'testTerm', filters: {}, pageCursor: '', - }); + }) as ConcreteLunrQuery; expect(actualTranslatedQuery).toMatchObject({ - documentTypes: ['*'], - lunrQueryString: '+testTerm', + documentTypes: undefined, + lunrQueryBuilder: expect.any(Function), + }); + + const query: jest.Mocked = { + allFields: [], + clauses: [], + term: jest.fn(), + clause: jest.fn(), + }; + + actualTranslatedQuery.lunrQueryBuilder.bind(query)(query); + + expect(query.term).toBeCalledWith(lunr.tokenizer('testTerm'), { + boost: 100, + usePipeline: true, + }); + expect(query.term).toBeCalledWith(lunr.tokenizer('testTerm'), { + boost: 10, + usePipeline: false, + wildcard: lunr.Query.wildcard.TRAILING, + }); + expect(query.term).toBeCalledWith(lunr.tokenizer('testTerm'), { + boost: 1, + usePipeline: false, + editDistance: 2, }); }); @@ -86,11 +111,39 @@ describe('LunrSearchEngine', () => { term: 'testTerm', filters: { kind: 'testKind' }, pageCursor: '', - }); + }) as ConcreteLunrQuery; expect(actualTranslatedQuery).toMatchObject({ - documentTypes: ['*'], - lunrQueryString: '+testTerm +kind:testKind', + documentTypes: undefined, + lunrQueryBuilder: expect.any(Function), + }); + + const query: jest.Mocked = { + allFields: ['kind'], + clauses: [], + term: jest.fn(), + clause: jest.fn(), + }; + + actualTranslatedQuery.lunrQueryBuilder.bind(query)(query); + + expect(query.term).toBeCalledWith(lunr.tokenizer('testTerm'), { + boost: 100, + usePipeline: true, + }); + expect(query.term).toBeCalledWith(lunr.tokenizer('testTerm'), { + boost: 10, + usePipeline: false, + wildcard: lunr.Query.wildcard.TRAILING, + }); + expect(query.term).toBeCalledWith(lunr.tokenizer('testTerm'), { + boost: 1, + usePipeline: false, + editDistance: 2, + }); + expect(query.term).toBeCalledWith(lunr.tokenizer('testKind'), { + fields: ['kind'], + presence: lunr.Query.presence.REQUIRED, }); }); @@ -104,17 +157,78 @@ describe('LunrSearchEngine', () => { term: 'testTerm', filters: { kind: 'testKind', namespace: 'testNameSpace' }, pageCursor: '', - }); + }) as ConcreteLunrQuery; expect(actualTranslatedQuery).toMatchObject({ - documentTypes: ['*'], - lunrQueryString: '+testTerm +kind:testKind +namespace:testNameSpace', + documentTypes: undefined, + lunrQueryBuilder: expect.any(Function), }); + + const query: jest.Mocked = { + allFields: ['kind', 'namespace'], + clauses: [], + term: jest.fn(), + clause: jest.fn(), + }; + + actualTranslatedQuery.lunrQueryBuilder.bind(query)(query); + + expect(query.term).toBeCalledWith(lunr.tokenizer('testTerm'), { + boost: 100, + usePipeline: true, + }); + expect(query.term).toBeCalledWith(lunr.tokenizer('testTerm'), { + boost: 10, + usePipeline: false, + wildcard: lunr.Query.wildcard.TRAILING, + }); + expect(query.term).toBeCalledWith(lunr.tokenizer('testTerm'), { + boost: 1, + usePipeline: false, + editDistance: 2, + }); + expect(query.term).toBeCalledWith(lunr.tokenizer('testKind'), { + fields: ['kind'], + presence: lunr.Query.presence.REQUIRED, + }); + expect(query.term).toBeCalledWith(lunr.tokenizer('testNameSpace'), { + fields: ['namespace'], + presence: lunr.Query.presence.REQUIRED, + }); + }); + + it('should throw if translated query references missing field', async () => { + const inspectableSearchEngine = new LunrSearchEngineForTranslatorTests({ + logger: getVoidLogger(), + }); + const translatorUnderTest = inspectableSearchEngine.getTranslator(); + + const actualTranslatedQuery = translatorUnderTest({ + term: 'testTerm', + filters: { kind: 'testKind' }, + pageCursor: '', + }) as ConcreteLunrQuery; + + expect(actualTranslatedQuery).toMatchObject({ + documentTypes: undefined, + lunrQueryBuilder: expect.any(Function), + }); + + const query: jest.Mocked = { + allFields: [], + clauses: [], + term: jest.fn(), + clause: jest.fn(), + }; + + expect(() => + actualTranslatedQuery.lunrQueryBuilder.bind(query)(query), + ).toThrow(); }); }); describe('query', () => { - it('should perform search query', async () => { + it('should perform search query and return 0 results on empty index', async () => { const querySpy = jest.spyOn(testLunrSearchEngine, 'query'); // Perform search query and ensure the query func was invoked. @@ -149,7 +263,7 @@ describe('LunrSearchEngine', () => { // Perform search query const mockedSearchResult = await testLunrSearchEngine.query({ - term: 'testTerm', + term: 'unknown', filters: {}, pageCursor: '', }); @@ -158,6 +272,39 @@ describe('LunrSearchEngine', () => { expect(mockedSearchResult).toMatchObject({ results: [] }); }); + it('should perform search query and return all results on empty term', async () => { + const mockDocuments = [ + { + title: 'testTitle', + text: 'testText', + location: 'test/location', + }, + ]; + + // Mock indexing of 1 document + testLunrSearchEngine.index('test-index', mockDocuments); + + // Perform search query + const mockedSearchResult = await testLunrSearchEngine.query({ + term: '', + filters: {}, + pageCursor: '', + }); + + expect(mockedSearchResult).toMatchObject({ + results: [ + { + document: { + title: 'testTitle', + text: 'testText', + location: 'test/location', + }, + type: 'test-index', + }, + ], + }); + }); + it('should perform search query and return search results on match', async () => { const mockDocuments = [ { @@ -177,6 +324,70 @@ describe('LunrSearchEngine', () => { pageCursor: '', }); + expect(mockedSearchResult).toMatchObject({ + results: [ + { + document: { + title: 'testTitle', + text: 'testText', + location: 'test/location', + }, + }, + ], + }); + }); + + it('should perform search query and return search results on partial match', async () => { + const mockDocuments = [ + { + title: 'testTitle', + text: 'testText', + location: 'test/location', + }, + ]; + + // Mock indexing of 1 document + testLunrSearchEngine.index('test-index', mockDocuments); + + // Perform search query + const mockedSearchResult = await testLunrSearchEngine.query({ + term: 'testTitle', + filters: {}, + pageCursor: '', + }); + + expect(mockedSearchResult).toMatchObject({ + results: [ + { + document: { + title: 'testTitle', + text: 'testText', + location: 'test/location', + }, + }, + ], + }); + }); + + it('should perform search query and return search results on fuzzy match', async () => { + const mockDocuments = [ + { + title: 'testTitle', + text: 'testText', + location: 'test/location', + }, + ]; + + // Mock indexing of 1 document + testLunrSearchEngine.index('test-index', mockDocuments); + + // Perform search query + const mockedSearchResult = await testLunrSearchEngine.query({ + term: 'testTitel', // Intentional typo + filters: {}, + pageCursor: '', + }); + // Should return 1 result as we are mocking the indexing of 1 document with match on the title field expect(mockedSearchResult).toMatchObject({ results: [ diff --git a/plugins/search-backend-node/src/engines/LunrSearchEngine.ts b/plugins/search-backend-node/src/engines/LunrSearchEngine.ts index a1c12f019d..0979fa4c90 100644 --- a/plugins/search-backend-node/src/engines/LunrSearchEngine.ts +++ b/plugins/search-backend-node/src/engines/LunrSearchEngine.ts @@ -23,9 +23,9 @@ import lunr from 'lunr'; import { Logger } from 'winston'; import { SearchEngine, QueryTranslator } from '../types'; -type ConcreteLunrQuery = { - lunrQueryString: string; - documentTypes: string[]; +export type ConcreteLunrQuery = { + lunrQueryBuilder: lunr.Index.QueryBuilder; + documentTypes?: string[]; }; type LunrResultEnvelope = { @@ -50,40 +50,62 @@ export class LunrSearchEngine implements SearchEngine { filters, types, }: SearchQuery): ConcreteLunrQuery => { - let lunrQueryFilters; - const lunrTerm = term ? `+${term}` : ''; - if (filters) { - lunrQueryFilters = Object.entries(filters) - .map(([field, value]) => { - // Require that the given field has the given value (with +). - if (['string', 'number', 'boolean'].includes(typeof value)) { - if (typeof value === 'string') { - return ` +${field}:${value.replace(':', '\\:')}`; - } - return ` +${field}:${value}`; - } - - // Illustrate how multi-value filters could work. - if (Array.isArray(value)) { - // But warn that Lurn supports this poorly. - this.logger.warn( - `Non-scalar filter value used for field ${field}. Consider using a different Search Engine for better results.`, - ); - return ` ${value.map(v => { - return `${field}:${v}`; - })}`; - } - - // Log a warning or something about unknown filter value - this.logger.warn(`Unknown filter type used on field ${field}`); - return ''; - }) - .join(''); - } - return { - lunrQueryString: `${lunrTerm}${lunrQueryFilters || ''}`, - documentTypes: types || ['*'], + lunrQueryBuilder: q => { + const termToken = lunr.tokenizer(term); + + // Support for typeahead seach is based on https://github.com/olivernn/lunr.js/issues/256#issuecomment-295407852 + // look for an exact match and apply a large positive boost + q.term(termToken, { + usePipeline: true, + boost: 100, + }); + // look for terms that match the beginning of this term and apply a + // medium boost + q.term(termToken, { + usePipeline: false, + boost: 10, + wildcard: lunr.Query.wildcard.TRAILING, + }); + // look for terms that match with an edit distance of 2 and apply a + // small boost + q.term(termToken, { + usePipeline: false, + editDistance: 2, + boost: 1, + }); + + if (filters) { + Object.entries(filters).forEach(([field, value]) => { + if (!q.allFields.includes(field)) { + // Throw for unknown field, as this will be a non match + throw new Error(`unrecognised field ${field}`); + } + + // Require that the given field has the given value + if (['string', 'number', 'boolean'].includes(typeof value)) { + q.term(lunr.tokenizer(value?.toString()), { + presence: lunr.Query.presence.REQUIRED, + fields: [field], + }); + } else if (Array.isArray(value)) { + // Illustrate how multi-value filters could work. + // But warn that Lurn supports this poorly. + this.logger.warn( + `Non-scalar filter value used for field ${field}. Consider using a different Search Engine for better results.`, + ); + q.term(lunr.tokenizer(value), { + presence: lunr.Query.presence.OPTIONAL, + fields: [field], + }); + } else { + // Log a warning or something about unknown filter value + this.logger.warn(`Unknown filter type used on field ${field}`); + } + }); + } + }, + documentTypes: types, }; }; @@ -118,18 +140,19 @@ export class LunrSearchEngine implements SearchEngine { } query(query: SearchQuery): Promise { - const { lunrQueryString, documentTypes } = this.translator( + const { lunrQueryBuilder, documentTypes } = this.translator( query, ) as ConcreteLunrQuery; const results: LunrResultEnvelope[] = []; - if (documentTypes.length === 1 && documentTypes[0] === '*') { - // Iterate over all this.lunrIndex values. - Object.keys(this.lunrIndices).forEach(type => { + // Iterate over the filtered list of this.lunrIndex keys. + Object.keys(this.lunrIndices) + .filter(type => !documentTypes || documentTypes.includes(type)) + .forEach(type => { try { results.push( - ...this.lunrIndices[type].search(lunrQueryString).map(result => { + ...this.lunrIndices[type].query(lunrQueryBuilder).map(result => { return { result: result, type: type, @@ -139,36 +162,14 @@ export class LunrSearchEngine implements SearchEngine { } catch (err) { // if a field does not exist on a index, we can see that as a no-match if ( - err instanceof lunr.QueryParseError && + err instanceof Error && err.message.startsWith('unrecognised field') - ) + ) { return; + } + throw err; } }); - } else { - // Iterate over the filtered list of this.lunrIndex keys. - Object.keys(this.lunrIndices) - .filter(type => documentTypes.includes(type)) - .forEach(type => { - try { - results.push( - ...this.lunrIndices[type].search(lunrQueryString).map(result => { - return { - result: result, - type: type, - }; - }), - ); - } catch (err) { - // if a field does not exist on a index, we can see that as a no-match - if ( - err instanceof lunr.QueryParseError && - err.message.startsWith('unrecognised field') - ) - return; - } - }); - } // Sort results. results.sort((doc1, doc2) => { diff --git a/plugins/search-backend-node/src/engines/index.ts b/plugins/search-backend-node/src/engines/index.ts index 16516bf66e..7e6fb86bd4 100644 --- a/plugins/search-backend-node/src/engines/index.ts +++ b/plugins/search-backend-node/src/engines/index.ts @@ -15,3 +15,4 @@ */ export { LunrSearchEngine } from './LunrSearchEngine'; +export type { ConcreteLunrQuery } from './LunrSearchEngine'; From 549628aac79f181c87e5cebf90b4db4848918faf Mon Sep 17 00:00:00 2001 From: Oliver Sand Date: Wed, 7 Jul 2021 19:51:22 +0200 Subject: [PATCH 150/168] Fix export type of `ScaffolderFieldExtensions` Signed-off-by: Oliver Sand --- plugins/scaffolder/src/index.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/scaffolder/src/index.ts b/plugins/scaffolder/src/index.ts index a034f5f574..74091a1a85 100644 --- a/plugins/scaffolder/src/index.ts +++ b/plugins/scaffolder/src/index.ts @@ -16,12 +16,11 @@ export { scaffolderApiRef, ScaffolderClient } from './api'; export type { ScaffolderApi } from './api'; -export { createScaffolderFieldExtension } from './extensions'; -export type { +export { + createScaffolderFieldExtension, ScaffolderFieldExtensions, - CustomFieldValidator, - FieldExtensionOptions, } from './extensions'; +export type { CustomFieldValidator, FieldExtensionOptions } from './extensions'; export { EntityPickerFieldExtension, OwnerPickerFieldExtension, From 85abb56d8c035a5e354974a01bf0ff1d1abd3d39 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Jul 2021 04:07:25 +0000 Subject: [PATCH 151/168] chore(deps): bump @types/prop-types from 15.7.3 to 15.7.4 Bumps [@types/prop-types](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/prop-types) from 15.7.3 to 15.7.4. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/prop-types) --- updated-dependencies: - dependency-name: "@types/prop-types" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 4fc278e1a2..036027015d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6334,9 +6334,9 @@ integrity sha512-/rM+sWiuOZ5dvuVzV37sUuklsbg+JPOP8d+nNFlo2ZtfpzPiPvh1/gc8liWOLBqe+sR+ZM7guPaIcTt6UZTo7Q== "@types/prop-types@*", "@types/prop-types@^15.7.3": - version "15.7.3" - resolved "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.3.tgz#2ab0d5da2e5815f94b0b9d4b95d1e5f243ab2ca7" - integrity sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw== + version "15.7.4" + resolved "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.4.tgz#fcf7205c25dff795ee79af1e30da2c9790808f11" + integrity sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ== "@types/q@^1.5.1": version "1.5.2" From 6841e011329c44a7c1db32e806c53cf0c960ed46 Mon Sep 17 00:00:00 2001 From: Carlo Colombo Date: Wed, 7 Jul 2021 17:38:25 +0200 Subject: [PATCH 152/168] fix git-url-parse minor version, 11.5.x broke bitbucket server integration Signed-off-by: Carlo Colombo --- .changeset/large-melons-work.md | 12 ++++++++++++ packages/backend-common/package.json | 2 +- packages/integration/package.json | 2 +- packages/techdocs-common/package.json | 2 +- plugins/catalog-backend/package.json | 2 +- plugins/catalog-import/package.json | 2 +- plugins/catalog/package.json | 2 +- plugins/scaffolder-backend/package.json | 2 +- plugins/scaffolder/package.json | 2 +- yarn.lock | 2 +- 10 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 .changeset/large-melons-work.md diff --git a/.changeset/large-melons-work.md b/.changeset/large-melons-work.md new file mode 100644 index 0000000000..9048932ace --- /dev/null +++ b/.changeset/large-melons-work.md @@ -0,0 +1,12 @@ +--- +'@backstage/backend-common': patch +'@backstage/integration': patch +'@backstage/techdocs-common': patch +'@backstage/plugin-catalog': patch +'@backstage/plugin-catalog-backend': patch +'@backstage/plugin-catalog-import': patch +'@backstage/plugin-scaffolder': patch +'@backstage/plugin-scaffolder-backend': patch +--- + +fix minor version of git-url-parse as 11.5.x introduced a bug for Bitbucket Server diff --git a/packages/backend-common/package.json b/packages/backend-common/package.json index fdbea23bd8..1a0014cbc2 100644 --- a/packages/backend-common/package.json +++ b/packages/backend-common/package.json @@ -48,7 +48,7 @@ "express": "^4.17.1", "express-promise-router": "^4.1.0", "fs-extra": "^10.0.0", - "git-url-parse": "^11.4.4", + "git-url-parse": "~11.4.4", "helmet": "^4.0.0", "isomorphic-git": "^1.8.0", "keyv": "^4.0.3", diff --git a/packages/integration/package.json b/packages/integration/package.json index 9313906ce1..e648c3745f 100644 --- a/packages/integration/package.json +++ b/packages/integration/package.json @@ -31,7 +31,7 @@ "dependencies": { "@backstage/config": "^0.1.5", "cross-fetch": "^3.0.6", - "git-url-parse": "^11.4.4", + "git-url-parse": "~11.4.4", "@octokit/rest": "^18.5.3", "@octokit/auth-app": "^3.4.0", "luxon": "^1.25.0" diff --git a/packages/techdocs-common/package.json b/packages/techdocs-common/package.json index 7cb0e37174..d3adb60419 100644 --- a/packages/techdocs-common/package.json +++ b/packages/techdocs-common/package.json @@ -49,7 +49,7 @@ "cross-fetch": "^3.0.6", "express": "^4.17.1", "fs-extra": "^10.0.0", - "git-url-parse": "^11.4.4", + "git-url-parse": "~11.4.4", "js-yaml": "^4.0.0", "json5": "^2.1.3", "mime-types": "^2.1.27", diff --git a/plugins/catalog-backend/package.json b/plugins/catalog-backend/package.json index 13cd430d01..b3ed5c7983 100644 --- a/plugins/catalog-backend/package.json +++ b/plugins/catalog-backend/package.json @@ -47,7 +47,7 @@ "express-promise-router": "^4.1.0", "fast-json-stable-stringify": "^2.1.0", "fs-extra": "^10.0.0", - "git-url-parse": "^11.4.4", + "git-url-parse": "~11.4.4", "glob": "^7.1.6", "knex": "^0.95.1", "lodash": "^4.17.15", diff --git a/plugins/catalog-import/package.json b/plugins/catalog-import/package.json index 2b18c2e57a..cedba14424 100644 --- a/plugins/catalog-import/package.json +++ b/plugins/catalog-import/package.json @@ -43,7 +43,7 @@ "@material-ui/lab": "4.0.0-alpha.45", "@octokit/rest": "^18.5.3", "@types/react": "^16.9", - "git-url-parse": "^11.4.4", + "git-url-parse": "~11.4.4", "js-base64": "^3.6.0", "react": "^16.13.1", "react-dom": "^16.13.1", diff --git a/plugins/catalog/package.json b/plugins/catalog/package.json index 776bac97c8..882f6202b2 100644 --- a/plugins/catalog/package.json +++ b/plugins/catalog/package.json @@ -44,7 +44,7 @@ "@material-ui/lab": "4.0.0-alpha.45", "@types/react": "^16.9", "classnames": "^2.2.6", - "git-url-parse": "^11.4.4", + "git-url-parse": "~11.4.4", "lodash": "^4.17.21", "react": "^16.13.1", "react-dom": "^16.13.1", diff --git a/plugins/scaffolder-backend/package.json b/plugins/scaffolder-backend/package.json index 7173f865c5..e6709cdc80 100644 --- a/plugins/scaffolder-backend/package.json +++ b/plugins/scaffolder-backend/package.json @@ -47,7 +47,7 @@ "express": "^4.17.1", "express-promise-router": "^4.1.0", "fs-extra": "^10.0.0", - "git-url-parse": "^11.4.4", + "git-url-parse": "~11.4.4", "globby": "^11.0.0", "handlebars": "^4.7.6", "helmet": "^4.0.0", diff --git a/plugins/scaffolder/package.json b/plugins/scaffolder/package.json index 88d973377d..d4ccd08673 100644 --- a/plugins/scaffolder/package.json +++ b/plugins/scaffolder/package.json @@ -47,7 +47,7 @@ "@rjsf/material-ui": "^3.0.0", "@types/react": "^16.9", "classnames": "^2.2.6", - "git-url-parse": "^11.4.4", + "git-url-parse": "~11.4.4", "humanize-duration": "^3.25.1", "immer": "^9.0.1", "json-schema": "^0.3.0", diff --git a/yarn.lock b/yarn.lock index 4fc278e1a2..37f7e691a7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13853,7 +13853,7 @@ git-up@^4.0.0: is-ssh "^1.3.0" parse-url "^5.0.0" -git-url-parse@^11.4.4: +git-url-parse@^11.4.4, git-url-parse@~11.4.4: version "11.4.4" resolved "https://registry.npmjs.org/git-url-parse/-/git-url-parse-11.4.4.tgz#5d747debc2469c17bc385719f7d0427802d83d77" integrity sha512-Y4o9o7vQngQDIU9IjyCmRJBin5iYjI5u9ZITnddRZpD7dcCFQj2sL2XuMNbLRE4b4B/4ENPsp2Q8P44fjAZ0Pw== From b5ee8b0a5330d5ae641dc30349372dce508917ed Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Thu, 8 Jul 2021 12:14:38 +0200 Subject: [PATCH 153/168] Add styles for scrollbars in long code blocks. #5467 Co-authored-by: Camila Belo Co-authored-by: Raghunandan Balachandran Signed-off-by: Eric Peterson --- plugins/techdocs/src/reader/components/Reader.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/techdocs/src/reader/components/Reader.tsx b/plugins/techdocs/src/reader/components/Reader.tsx index f80cf6cc4c..294f81378f 100644 --- a/plugins/techdocs/src/reader/components/Reader.tsx +++ b/plugins/techdocs/src/reader/components/Reader.tsx @@ -184,6 +184,17 @@ export const Reader = ({ entityId, onReady }: Props) => { } `, }), + injectCss({ + // Properly style code blocks. + css: ` + .md-typeset pre > code::-webkit-scrollbar-thumb { + background-color: hsla(0, 0%, 0%, 0.32); + } + .md-typeset pre > code::-webkit-scrollbar-thumb:hover { + background-color: hsla(0, 0%, 0%, 0.87); + } + `, + }), injectCss({ // Admonitions and others are using SVG masks to define icons. These // masks are defined as CSS variables. From 0172d3424b1943e1f8ff6e65ffbc6b005aecdd03 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Thu, 8 Jul 2021 12:24:18 +0200 Subject: [PATCH 154/168] Changeset Signed-off-by: Eric Peterson --- .changeset/techdocs-lamp-lit-prose.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/techdocs-lamp-lit-prose.md diff --git a/.changeset/techdocs-lamp-lit-prose.md b/.changeset/techdocs-lamp-lit-prose.md new file mode 100644 index 0000000000..69c19c7188 --- /dev/null +++ b/.changeset/techdocs-lamp-lit-prose.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-techdocs': patch +--- + +Fixed bug preventing scroll bar from showing up on code blocks in a TechDocs site. From 8b048934bcaa9ac0d153471695eadfae7adb9998 Mon Sep 17 00:00:00 2001 From: Iain Billett Date: Thu, 8 Jul 2021 12:33:15 +0100 Subject: [PATCH 155/168] Codeowners processor should specify kind for user entities. The codeowners processor extracts the username of the primary owner and uses this as the owner field. Given the kind isn't specified this is assumed to be a group and so the link to owner in the about card doesn't work. This change specifies the a kind where the entity is a user. e.g: `@iain-b` -> `user:iain-b` Signed-off-by: Iain Billett --- .changeset/lemon-dancers-taste.md | 9 +++++++++ .../ingestion/processors/codeowners/resolve.test.ts | 2 +- .../src/ingestion/processors/codeowners/resolve.ts | 12 ++++++++---- 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 .changeset/lemon-dancers-taste.md diff --git a/.changeset/lemon-dancers-taste.md b/.changeset/lemon-dancers-taste.md new file mode 100644 index 0000000000..0542fe4a54 --- /dev/null +++ b/.changeset/lemon-dancers-taste.md @@ -0,0 +1,9 @@ +--- +'@backstage/plugin-catalog-backend': patch +--- + +The codeowners processor extracts the username of the primary owner and uses this as the owner field. +Given the kind isn't specified this is assumed to be a group and so the link to the owner in the about card +doesn't work. This change specifies the kind where the entity is a user. e.g: + +`@iain-b` -> `user:iain-b` diff --git a/plugins/catalog-backend/src/ingestion/processors/codeowners/resolve.test.ts b/plugins/catalog-backend/src/ingestion/processors/codeowners/resolve.test.ts index ccf4493dc6..9e1893e4b1 100644 --- a/plugins/catalog-backend/src/ingestion/processors/codeowners/resolve.test.ts +++ b/plugins/catalog-backend/src/ingestion/processors/codeowners/resolve.test.ts @@ -29,7 +29,7 @@ describe('resolveCodeOwner', () => { describe('normalizeCodeOwner', () => { it('should remove the @ symbol', () => { - expect(normalizeCodeOwner('@yoda')).toBe('yoda'); + expect(normalizeCodeOwner('@yoda')).toBe('user:yoda'); }); it('should remove org from org/team format', () => { diff --git a/plugins/catalog-backend/src/ingestion/processors/codeowners/resolve.ts b/plugins/catalog-backend/src/ingestion/processors/codeowners/resolve.ts index 886f3160b3..0fe69fab97 100644 --- a/plugins/catalog-backend/src/ingestion/processors/codeowners/resolve.ts +++ b/plugins/catalog-backend/src/ingestion/processors/codeowners/resolve.ts @@ -18,6 +18,10 @@ import * as codeowners from 'codeowners-utils'; import { CodeOwnersEntry } from 'codeowners-utils'; import { filter, get, head, pipe, reverse } from 'lodash/fp'; +const USER_PATTERN = /^@.*/; +const GROUP_PATTERN = /^@.*\/.*/; +const EMAIL_PATTERN = /^.*@.*\..*$/; + export function resolveCodeOwner( contents: string, pattern = '*', @@ -35,11 +39,11 @@ export function resolveCodeOwner( } export function normalizeCodeOwner(owner: string) { - if (owner.match(/^@.*\/.*/)) { + if (owner.match(GROUP_PATTERN)) { return owner.split('/')[1]; - } else if (owner.match(/^@.*/)) { - return owner.substring(1); - } else if (owner.match(/^.*@.*\..*$/)) { + } else if (owner.match(USER_PATTERN)) { + return `user:${owner.substring(1)}`; + } else if (owner.match(EMAIL_PATTERN)) { return owner.split('@')[0]; } From de67704be98fbe5fe267ffe0d1c40f4f93058fa6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 8 Jul 2021 11:37:02 +0000 Subject: [PATCH 156/168] Version Packages --- .changeset/angry-hounds-bow.md | 5 - .changeset/beige-ladybugs-sip.md | 5 - .changeset/breezy-kings-applaud.md | 5 - .changeset/brown-olives-hang.md | 5 - .changeset/eight-pots-remember.md | 5 - .changeset/eighty-deers-jam.md | 5 - .changeset/fair-falcons-scream.md | 7 -- .changeset/flat-donkeys-rhyme.md | 5 - .changeset/fresh-elephants-tease.md | 68 ------------ .changeset/gorgeous-timers-cover.md | 5 - .changeset/great-bears-work.md | 10 -- .changeset/happy-pugs-notice.md | 5 - .changeset/healthy-colts-watch.md | 7 -- .changeset/honest-cars-glow.md | 54 ---------- .changeset/large-melons-work.md | 12 --- .changeset/large-mice-sin.md | 6 -- .changeset/late-pants-itch.md | 5 - .changeset/moody-garlics-whisper.md | 24 ----- .changeset/red-ladybugs-promise.md | 5 - .changeset/rotten-cooks-try.md | 5 - .changeset/rotten-walls-cross.md | 5 - .changeset/search-olive-cars-talk.md | 7 -- .changeset/search-slimy-taxis-live.md | 10 -- .changeset/serious-falcons-greet.md | 5 - .changeset/shaggy-ties-carry.md | 5 - .changeset/shy-garlics-tap.md | 5 - .changeset/silent-horses-fry.md | 5 - .changeset/six-birds-approve.md | 6 -- .changeset/sweet-terms-approve.md | 5 - .changeset/tasty-chairs-flash.md | 5 - .changeset/tasty-ghosts-raise.md | 8 -- .changeset/techdocs-lamp-lit-prose.md | 5 - .changeset/twelve-deers-explode.md | 5 - .changeset/violet-maps-smell.md | 6 -- .changeset/wet-queens-deny.md | 5 - .changeset/young-pigs-beg.md | 5 - packages/app/CHANGELOG.md | 30 ++++++ packages/app/package.json | 50 ++++----- packages/backend-common/CHANGELOG.md | 60 +++++++++++ packages/backend-common/package.json | 4 +- packages/backend-test-utils/CHANGELOG.md | 8 ++ packages/backend-test-utils/package.json | 4 +- packages/backend/CHANGELOG.md | 23 ++++ packages/backend/package.json | 36 +++---- packages/catalog-client/CHANGELOG.md | 7 ++ packages/catalog-client/package.json | 4 +- packages/catalog-model/CHANGELOG.md | 66 ++++++++++++ packages/catalog-model/package.json | 2 +- packages/codemods/CHANGELOG.md | 7 ++ packages/codemods/package.json | 2 +- packages/core-components/CHANGELOG.md | 13 +++ packages/core-components/package.json | 2 +- packages/create-app/CHANGELOG.md | 68 ++++++++++++ packages/create-app/package.json | 2 +- packages/dev-utils/CHANGELOG.md | 9 ++ packages/dev-utils/package.json | 8 +- packages/integration/CHANGELOG.md | 8 ++ packages/integration/package.json | 2 +- packages/techdocs-common/CHANGELOG.md | 11 ++ packages/techdocs-common/package.json | 8 +- plugins/api-docs/CHANGELOG.md | 10 ++ plugins/api-docs/package.json | 12 +-- plugins/auth-backend/CHANGELOG.md | 9 ++ plugins/auth-backend/package.json | 8 +- plugins/badges-backend/CHANGELOG.md | 9 ++ plugins/badges-backend/package.json | 8 +- plugins/badges/CHANGELOG.md | 9 ++ plugins/badges/package.json | 10 +- plugins/bitrise/CHANGELOG.md | 9 ++ plugins/bitrise/package.json | 10 +- .../catalog-backend-module-ldap/CHANGELOG.md | 13 +++ .../catalog-backend-module-ldap/package.json | 6 +- .../CHANGELOG.md | 8 ++ .../package.json | 8 +- plugins/catalog-backend/CHANGELOG.md | 77 +++++++++++++ plugins/catalog-backend/package.json | 14 +-- plugins/catalog-graphql/CHANGELOG.md | 8 ++ plugins/catalog-graphql/package.json | 6 +- plugins/catalog-import/CHANGELOG.md | 13 +++ plugins/catalog-import/package.json | 14 +-- plugins/catalog-react/CHANGELOG.md | 10 ++ plugins/catalog-react/package.json | 12 +-- plugins/catalog/CHANGELOG.md | 13 +++ plugins/catalog/package.json | 14 +-- plugins/circleci/CHANGELOG.md | 9 ++ plugins/circleci/package.json | 10 +- plugins/cloudbuild/CHANGELOG.md | 9 ++ plugins/cloudbuild/package.json | 10 +- plugins/code-coverage-backend/CHANGELOG.md | 10 ++ plugins/code-coverage-backend/package.json | 10 +- plugins/code-coverage/CHANGELOG.md | 9 ++ plugins/code-coverage/package.json | 10 +- plugins/config-schema/package.json | 4 +- plugins/cost-insights/package.json | 4 +- plugins/explore/CHANGELOG.md | 11 ++ plugins/explore/package.json | 10 +- plugins/fossa/CHANGELOG.md | 9 ++ plugins/fossa/package.json | 10 +- plugins/gcp-projects/package.json | 4 +- plugins/git-release-manager/package.json | 4 +- plugins/github-actions/CHANGELOG.md | 10 ++ plugins/github-actions/package.json | 12 +-- plugins/github-deployments/CHANGELOG.md | 10 ++ plugins/github-deployments/package.json | 12 +-- plugins/gitops-profiles/package.json | 4 +- plugins/graphiql/package.json | 4 +- plugins/ilert/CHANGELOG.md | 10 ++ plugins/ilert/package.json | 10 +- plugins/jenkins/CHANGELOG.md | 9 ++ plugins/jenkins/package.json | 10 +- plugins/kafka-backend/CHANGELOG.md | 8 ++ plugins/kafka-backend/package.json | 6 +- plugins/kafka/CHANGELOG.md | 9 ++ plugins/kafka/package.json | 10 +- plugins/kubernetes-backend/CHANGELOG.md | 9 ++ plugins/kubernetes-backend/package.json | 8 +- plugins/kubernetes-common/CHANGELOG.md | 7 ++ plugins/kubernetes-common/package.json | 4 +- plugins/kubernetes/CHANGELOG.md | 10 ++ plugins/kubernetes/package.json | 12 +-- plugins/lighthouse/CHANGELOG.md | 9 ++ plugins/lighthouse/package.json | 10 +- plugins/newrelic/package.json | 4 +- plugins/org/CHANGELOG.md | 10 ++ plugins/org/package.json | 10 +- plugins/pagerduty/CHANGELOG.md | 10 ++ plugins/pagerduty/package.json | 10 +- plugins/register-component/CHANGELOG.md | 9 ++ plugins/register-component/package.json | 10 +- plugins/rollbar/CHANGELOG.md | 9 ++ plugins/rollbar/package.json | 10 +- .../CHANGELOG.md | 10 ++ .../package.json | 8 +- plugins/scaffolder-backend/CHANGELOG.md | 101 ++++++++++++++++++ plugins/scaffolder-backend/package.json | 10 +- plugins/scaffolder/CHANGELOG.md | 84 +++++++++++++++ plugins/scaffolder/package.json | 14 +-- plugins/search-backend-node/CHANGELOG.md | 21 ++++ plugins/search-backend-node/package.json | 4 +- plugins/search-backend/CHANGELOG.md | 8 ++ plugins/search-backend/package.json | 6 +- plugins/search/CHANGELOG.md | 9 ++ plugins/search/package.json | 10 +- plugins/sentry/CHANGELOG.md | 9 ++ plugins/sentry/package.json | 10 +- plugins/shortcuts/package.json | 4 +- plugins/sonarqube/CHANGELOG.md | 9 ++ plugins/sonarqube/package.json | 10 +- plugins/splunk-on-call/CHANGELOG.md | 9 ++ plugins/splunk-on-call/package.json | 10 +- plugins/tech-radar/package.json | 4 +- plugins/techdocs-backend/CHANGELOG.md | 9 ++ plugins/techdocs-backend/package.json | 8 +- plugins/techdocs/CHANGELOG.md | 11 ++ plugins/techdocs/package.json | 12 +-- plugins/todo-backend/CHANGELOG.md | 10 ++ plugins/todo-backend/package.json | 10 +- plugins/todo/CHANGELOG.md | 9 ++ plugins/todo/package.json | 10 +- plugins/user-settings/package.json | 4 +- plugins/welcome/package.json | 4 +- yarn.lock | 13 +++ 162 files changed, 1299 insertions(+), 643 deletions(-) delete mode 100644 .changeset/angry-hounds-bow.md delete mode 100644 .changeset/beige-ladybugs-sip.md delete mode 100644 .changeset/breezy-kings-applaud.md delete mode 100644 .changeset/brown-olives-hang.md delete mode 100644 .changeset/eight-pots-remember.md delete mode 100644 .changeset/eighty-deers-jam.md delete mode 100644 .changeset/fair-falcons-scream.md delete mode 100644 .changeset/flat-donkeys-rhyme.md delete mode 100644 .changeset/fresh-elephants-tease.md delete mode 100644 .changeset/gorgeous-timers-cover.md delete mode 100644 .changeset/great-bears-work.md delete mode 100644 .changeset/happy-pugs-notice.md delete mode 100644 .changeset/healthy-colts-watch.md delete mode 100644 .changeset/honest-cars-glow.md delete mode 100644 .changeset/large-melons-work.md delete mode 100644 .changeset/large-mice-sin.md delete mode 100644 .changeset/late-pants-itch.md delete mode 100644 .changeset/moody-garlics-whisper.md delete mode 100644 .changeset/red-ladybugs-promise.md delete mode 100644 .changeset/rotten-cooks-try.md delete mode 100644 .changeset/rotten-walls-cross.md delete mode 100644 .changeset/search-olive-cars-talk.md delete mode 100644 .changeset/search-slimy-taxis-live.md delete mode 100644 .changeset/serious-falcons-greet.md delete mode 100644 .changeset/shaggy-ties-carry.md delete mode 100644 .changeset/shy-garlics-tap.md delete mode 100644 .changeset/silent-horses-fry.md delete mode 100644 .changeset/six-birds-approve.md delete mode 100644 .changeset/sweet-terms-approve.md delete mode 100644 .changeset/tasty-chairs-flash.md delete mode 100644 .changeset/tasty-ghosts-raise.md delete mode 100644 .changeset/techdocs-lamp-lit-prose.md delete mode 100644 .changeset/twelve-deers-explode.md delete mode 100644 .changeset/violet-maps-smell.md delete mode 100644 .changeset/wet-queens-deny.md delete mode 100644 .changeset/young-pigs-beg.md create mode 100644 plugins/scaffolder-backend-module-rails/CHANGELOG.md diff --git a/.changeset/angry-hounds-bow.md b/.changeset/angry-hounds-bow.md deleted file mode 100644 index 4bbfffd4f1..0000000000 --- a/.changeset/angry-hounds-bow.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/integration': patch ---- - -Do not throw in `ScmIntegration` `byUrl` for invalid URLs diff --git a/.changeset/beige-ladybugs-sip.md b/.changeset/beige-ladybugs-sip.md deleted file mode 100644 index f1ef84e233..0000000000 --- a/.changeset/beige-ladybugs-sip.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/core-components': patch ---- - -Improve UX of the Sidebar by adding SidebarScrollWrapper component allowing the user to scroll through Plugins & Shortcuts on smaller screens. Prevent the Sidebar from opening on click on small devices diff --git a/.changeset/breezy-kings-applaud.md b/.changeset/breezy-kings-applaud.md deleted file mode 100644 index 867d135739..0000000000 --- a/.changeset/breezy-kings-applaud.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-pagerduty': patch ---- - -Update README diff --git a/.changeset/brown-olives-hang.md b/.changeset/brown-olives-hang.md deleted file mode 100644 index 64ce4e25d5..0000000000 --- a/.changeset/brown-olives-hang.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-scaffolder-backend': patch ---- - -add default branch property for publish GitLab, Bitbucket and Azure actions diff --git a/.changeset/eight-pots-remember.md b/.changeset/eight-pots-remember.md deleted file mode 100644 index 34c6d018b5..0000000000 --- a/.changeset/eight-pots-remember.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-scaffolder-backend': patch ---- - -Added filesystem remove/rename built-in actions diff --git a/.changeset/eighty-deers-jam.md b/.changeset/eighty-deers-jam.md deleted file mode 100644 index df8b84aff1..0000000000 --- a/.changeset/eighty-deers-jam.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-catalog-import': patch ---- - -More helpful error message when trying to import by folder from non-github diff --git a/.changeset/fair-falcons-scream.md b/.changeset/fair-falcons-scream.md deleted file mode 100644 index 1f2f095c81..0000000000 --- a/.changeset/fair-falcons-scream.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@backstage/core-components': patch -'@backstage/plugin-explore': patch ---- - -- Enhanced core `Button` component to open external links in new tab. -- Replaced the use of `Button` component from material by `core-components` in tools card. diff --git a/.changeset/flat-donkeys-rhyme.md b/.changeset/flat-donkeys-rhyme.md deleted file mode 100644 index c98f4aedc5..0000000000 --- a/.changeset/flat-donkeys-rhyme.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/catalog-model': minor ---- - -Changed the regex to validate names following the Kubernetes validation rule, this allow to be more permissive validating the name of the object in Backstage. diff --git a/.changeset/fresh-elephants-tease.md b/.changeset/fresh-elephants-tease.md deleted file mode 100644 index 5141f96be7..0000000000 --- a/.changeset/fresh-elephants-tease.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -'@backstage/catalog-model': minor -'@backstage/plugin-catalog-backend': minor -'@backstage/plugin-scaffolder': minor -'@backstage/plugin-scaffolder-backend': minor -'@backstage/create-app': patch ---- - -Support for `Template` kinds with version `backstage.io/v1alpha1` has now been removed. This means that the old method of running templates with `Preparers`, `Templaters` and `Publishers` has also been removed. If you had any logic in these abstractions, they should now be moved to `actions` instead, and you can find out more about those in the [documentation](https://backstage.io/docs/features/software-templates/writing-custom-actions) - -If you need any help migrating existing templates, there's a [migration guide](https://backstage.io/docs/features/software-templates/migrating-from-v1alpha1-to-v1beta2). Reach out to us on Discord in the #support channel if you're having problems. - -The `scaffolder-backend` now no longer requires these `Preparers`, `Templaters`, and `Publishers` to be passed in, now all it needs is the `containerRunner`. - -Please update your `packages/backend/src/plugins/scaffolder.ts` like the following - -```diff -- import { -- DockerContainerRunner, -- SingleHostDiscovery, -- } from '@backstage/backend-common'; -+ import { DockerContainerRunner } from '@backstage/backend-common'; - import { CatalogClient } from '@backstage/catalog-client'; -- import { -- CookieCutter, -- CreateReactAppTemplater, -- createRouter, -- Preparers, -- Publishers, -- Templaters, -- } from '@backstage/plugin-scaffolder-backend'; -+ import { createRouter } from '@backstage/plugin-scaffolder-backend'; - import Docker from 'dockerode'; - import { Router } from 'express'; - import type { PluginEnvironment } from '../types'; - - export default async function createPlugin({ - config, - database, - reader, -+ discovery, - }: PluginEnvironment): Promise { - const dockerClient = new Docker(); - const containerRunner = new DockerContainerRunner({ dockerClient }); - -- const cookiecutterTemplater = new CookieCutter({ containerRunner }); -- const craTemplater = new CreateReactAppTemplater({ containerRunner }); -- const templaters = new Templaters(); - -- templaters.register('cookiecutter', cookiecutterTemplater); -- templaters.register('cra', craTemplater); -- -- const preparers = await Preparers.fromConfig(config, { logger }); -- const publishers = await Publishers.fromConfig(config, { logger }); - -- const discovery = SingleHostDiscovery.fromConfig(config); - const catalogClient = new CatalogClient({ discoveryApi: discovery }); - - return await createRouter({ -- preparers, -- templaters, -- publishers, -+ containerRunner, - logger, - config, - database, - -``` diff --git a/.changeset/gorgeous-timers-cover.md b/.changeset/gorgeous-timers-cover.md deleted file mode 100644 index de71d740c0..0000000000 --- a/.changeset/gorgeous-timers-cover.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/techdocs-common': patch ---- - -Fix openStack swift publisher encoding issue. Remove utf8 forced encoding on binary files diff --git a/.changeset/great-bears-work.md b/.changeset/great-bears-work.md deleted file mode 100644 index 572cf1538d..0000000000 --- a/.changeset/great-bears-work.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -'@backstage/plugin-scaffolder': patch ---- - -Added a `context` parameter to validator functions, letting them have access to -the API holder. - -If you have implemented custom validators and use `createScaffolderFieldExtension`, -your `validation` function can now optionally accept a third parameter, -`context: { apiHolder: ApiHolder }`. diff --git a/.changeset/happy-pugs-notice.md b/.changeset/happy-pugs-notice.md deleted file mode 100644 index 4120018da9..0000000000 --- a/.changeset/happy-pugs-notice.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-catalog': patch ---- - -Change catalog page layout to use Grid components to improve responsiveness diff --git a/.changeset/healthy-colts-watch.md b/.changeset/healthy-colts-watch.md deleted file mode 100644 index 2b24621f20..0000000000 --- a/.changeset/healthy-colts-watch.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@backstage/backend-test-utils': patch -'@backstage/create-app': patch -'@backstage/plugin-catalog-backend': patch ---- - -bump sqlite3 to 5.0.1 diff --git a/.changeset/honest-cars-glow.md b/.changeset/honest-cars-glow.md deleted file mode 100644 index 3fdc6e335a..0000000000 --- a/.changeset/honest-cars-glow.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -'@backstage/backend-common': patch ---- - -Added a `readUrl` method to the `UrlReader` interface that allows for complex response objects and is intended to replace the `read` method. This new method is currently optional to implement which allows for a soft migration to `readUrl` instead of `read` in the future. - -The main use case for `readUrl` returning an object instead of solely a read buffer is to allow for additional metadata such as ETag, which is a requirement for more efficient catalog processing. - -The `GithubUrlReader` and `GitlabUrlReader` readers fully implement `readUrl`. The other existing readers implement the new method but do not propagate or return ETags. - -While the `readUrl` method is not yet required, it will be in the future, and we already log deprecation warnings when custom `UrlReader` implementations that do not implement `readUrl` are used. We therefore recommend that any existing custom implementations are migrated to implement `readUrl`. - -The old `read` and the new `readUrl` methods can easily be implemented using one another, but we recommend moving the chunk of the implementation to the new `readUrl` method as `read` is being removed, for example this: - -```ts -class CustomUrlReader implements UrlReader { - read(url: string): Promise { - const res = await fetch(url); - - if (!res.ok) { - // error handling ... - } - - return Buffer.from(await res.text()); - } -} -``` - -Can be migrated to something like this: - -```ts -class CustomUrlReader implements UrlReader { - read(url: string): Promise { - const res = await this.readUrl(url); - return res.buffer(); - } - - async readUrl( - url: string, - _options?: ReadUrlOptions, - ): Promise { - const res = await fetch(url); - - if (!res.ok) { - // error handling ... - } - - const buffer = Buffer.from(await res.text()); - return { buffer: async () => buffer }; - } -} -``` - -While there is no usage of the ETag capability yet in the main Backstage packages, you can already add it to your custom implementations. To do so, refer to the documentation of the `readUrl` method and surrounding types, and the existing implementation in `packages/backend-common/src/reading/GithubUrlReader.ts`. diff --git a/.changeset/large-melons-work.md b/.changeset/large-melons-work.md deleted file mode 100644 index 9048932ace..0000000000 --- a/.changeset/large-melons-work.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -'@backstage/backend-common': patch -'@backstage/integration': patch -'@backstage/techdocs-common': patch -'@backstage/plugin-catalog': patch -'@backstage/plugin-catalog-backend': patch -'@backstage/plugin-catalog-import': patch -'@backstage/plugin-scaffolder': patch -'@backstage/plugin-scaffolder-backend': patch ---- - -fix minor version of git-url-parse as 11.5.x introduced a bug for Bitbucket Server diff --git a/.changeset/large-mice-sin.md b/.changeset/large-mice-sin.md deleted file mode 100644 index 77aba8d3c5..0000000000 --- a/.changeset/large-mice-sin.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@backstage/plugin-catalog-backend-module-ldap': minor ---- - -Add extension points to the `LdapOrgReaderProcessor` to make it possible to do more advanced modifications -of the ingested users and groups. diff --git a/.changeset/late-pants-itch.md b/.changeset/late-pants-itch.md deleted file mode 100644 index 7bd3087316..0000000000 --- a/.changeset/late-pants-itch.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/core-components': patch ---- - -Show scroll bar of the sidebar wrapper only on hover diff --git a/.changeset/moody-garlics-whisper.md b/.changeset/moody-garlics-whisper.md deleted file mode 100644 index b9683e4637..0000000000 --- a/.changeset/moody-garlics-whisper.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -'@backstage/plugin-scaffolder-backend': minor ---- - -Adding `config: Config` as a required argument to `createBuiltinActions` and downstream methods in order to support configuration of the default git author used for Scaffolder commits. - -The affected methods are: - -- `createBuiltinActions` -- `createPublishGithubAction` -- `createPublishGitlabAction` -- `createPublishBitbucketAction` -- `createPublishAzureAction` - -Call sites to these methods will need to be migrated to include the new `config` argument. See `createRouter` in `plugins/scaffolder-backend/src/service/router.ts` for an example of adding this new argument. - -To configure the default git author, use the `defaultAuthor` key under `scaffolder` in `app-config.yaml`: - -```yaml -scaffolder: - defaultAuthor: - name: Example - email: example@example.com -``` diff --git a/.changeset/red-ladybugs-promise.md b/.changeset/red-ladybugs-promise.md deleted file mode 100644 index dbfbf2bbd4..0000000000 --- a/.changeset/red-ladybugs-promise.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-scaffolder': patch ---- - -add support for uiSchema on dependent form fields diff --git a/.changeset/rotten-cooks-try.md b/.changeset/rotten-cooks-try.md deleted file mode 100644 index ccbd315ebe..0000000000 --- a/.changeset/rotten-cooks-try.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-ilert': patch ---- - -chore: bump `@date-io/luxon` from 1.3.13 to 2.10.11 diff --git a/.changeset/rotten-walls-cross.md b/.changeset/rotten-walls-cross.md deleted file mode 100644 index 498c10b203..0000000000 --- a/.changeset/rotten-walls-cross.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-catalog-backend': patch ---- - -Make use of the new `readUrl` method on `UrlReader` from `@backstage/backend-common`. diff --git a/.changeset/search-olive-cars-talk.md b/.changeset/search-olive-cars-talk.md deleted file mode 100644 index 64328d89b1..0000000000 --- a/.changeset/search-olive-cars-talk.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@backstage/plugin-search-backend-node': patch ---- - -Enhance the search results of `LunrSearchEngine` to support a more natural -search experience. This is done by allowing typos (by using fuzzy search) and -supporting typeahead search (using wildcard queries to match incomplete words). diff --git a/.changeset/search-slimy-taxis-live.md b/.changeset/search-slimy-taxis-live.md deleted file mode 100644 index c4615ef84c..0000000000 --- a/.changeset/search-slimy-taxis-live.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -'@backstage/plugin-search-backend-node': minor ---- - -Build search queries using the query builder in `LunrSearchEngine`. This removes -the support for specifying custom queries with the lunr query syntax, but makes -sure that inputs are properly escaped. Supporting the full lunr syntax is still -possible by setting a custom query translator. -The interface of `LunrSearchEngine.setTranslator()` is changed to support -building lunr queries. diff --git a/.changeset/serious-falcons-greet.md b/.changeset/serious-falcons-greet.md deleted file mode 100644 index f793ed26d4..0000000000 --- a/.changeset/serious-falcons-greet.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/integration': patch ---- - -Fix downloads from repositories located at bitbucket.org diff --git a/.changeset/shaggy-ties-carry.md b/.changeset/shaggy-ties-carry.md deleted file mode 100644 index 83b7782cd0..0000000000 --- a/.changeset/shaggy-ties-carry.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/core-components': patch ---- - -Handle empty code blocks in markdown files so they don't fail rendering diff --git a/.changeset/shy-garlics-tap.md b/.changeset/shy-garlics-tap.md deleted file mode 100644 index 58c660e864..0000000000 --- a/.changeset/shy-garlics-tap.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/create-app': patch ---- - -Use SidebarScrollWrapper to improve responsiveness of the current sidebar. Change: Wrap a section of SidebarItems with this component to enable scroll for smaller screens. It can also be used in sidebar plugins (see shortcuts plugin for an example). diff --git a/.changeset/silent-horses-fry.md b/.changeset/silent-horses-fry.md deleted file mode 100644 index 2b7c562607..0000000000 --- a/.changeset/silent-horses-fry.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/core-components': patch ---- - -Fix error in error panel, and console warnings about DOM nesting pre inside p diff --git a/.changeset/six-birds-approve.md b/.changeset/six-birds-approve.md deleted file mode 100644 index ce666dd09c..0000000000 --- a/.changeset/six-birds-approve.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@backstage/core-components': patch -'@backstage/plugin-org': patch ---- - -Add edit button to Group Profile Card diff --git a/.changeset/sweet-terms-approve.md b/.changeset/sweet-terms-approve.md deleted file mode 100644 index e8daa06673..0000000000 --- a/.changeset/sweet-terms-approve.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-scaffolder-backend': patch ---- - -bump azure-devops-node to 10.2.2 diff --git a/.changeset/tasty-chairs-flash.md b/.changeset/tasty-chairs-flash.md deleted file mode 100644 index 8be48d92b3..0000000000 --- a/.changeset/tasty-chairs-flash.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-scaffolder': patch ---- - -Pass through the `idToken` in `Authorization` Header for `listActions` request diff --git a/.changeset/tasty-ghosts-raise.md b/.changeset/tasty-ghosts-raise.md deleted file mode 100644 index 4e9de7043a..0000000000 --- a/.changeset/tasty-ghosts-raise.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -'@backstage/plugin-search-backend-node': patch ---- - -Change search scheduler from starting indexing in a fixed interval (for example -every 60 seconds), to wait a fixed time between index runs. -This makes sure that no second index process for the same document type is -started when the previous one is still running. diff --git a/.changeset/techdocs-lamp-lit-prose.md b/.changeset/techdocs-lamp-lit-prose.md deleted file mode 100644 index 69c19c7188..0000000000 --- a/.changeset/techdocs-lamp-lit-prose.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-techdocs': patch ---- - -Fixed bug preventing scroll bar from showing up on code blocks in a TechDocs site. diff --git a/.changeset/twelve-deers-explode.md b/.changeset/twelve-deers-explode.md deleted file mode 100644 index 0d34392eab..0000000000 --- a/.changeset/twelve-deers-explode.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-scaffolder-backend': patch ---- - -Export the `fetchContents` from scaffolder-backend diff --git a/.changeset/violet-maps-smell.md b/.changeset/violet-maps-smell.md deleted file mode 100644 index fdb4c6b46d..0000000000 --- a/.changeset/violet-maps-smell.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@backstage/backend-common': patch -'@backstage/plugin-scaffolder-backend': patch ---- - -add defaultBranch property for publish GitHub action diff --git a/.changeset/wet-queens-deny.md b/.changeset/wet-queens-deny.md deleted file mode 100644 index 1e446c619c..0000000000 --- a/.changeset/wet-queens-deny.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-scaffolder-backend': patch ---- - -removing mandatory of protection for the default branch, that could be handled by the GitHub automation in async manner, thus throwing floating errors diff --git a/.changeset/young-pigs-beg.md b/.changeset/young-pigs-beg.md deleted file mode 100644 index bfdf726911..0000000000 --- a/.changeset/young-pigs-beg.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/core-components': patch ---- - -Add custom styles to scroll bar of the sidebar wrapper to fix flaky behaviour diff --git a/packages/app/CHANGELOG.md b/packages/app/CHANGELOG.md index ca623d0ba1..cc67b78f44 100644 --- a/packages/app/CHANGELOG.md +++ b/packages/app/CHANGELOG.md @@ -1,5 +1,35 @@ # example-app +## 0.2.36 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/plugin-pagerduty@0.3.7 + - @backstage/plugin-catalog-import@0.5.12 + - @backstage/plugin-explore@0.3.9 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-scaffolder@0.10.0 + - @backstage/plugin-catalog@0.6.6 + - @backstage/plugin-org@0.3.16 + - @backstage/plugin-techdocs@0.9.9 + - @backstage/plugin-api-docs@0.6.1 + - @backstage/plugin-badges@0.2.4 + - @backstage/plugin-catalog-react@0.2.6 + - @backstage/plugin-circleci@0.2.18 + - @backstage/plugin-cloudbuild@0.2.18 + - @backstage/plugin-code-coverage@0.1.6 + - @backstage/plugin-github-actions@0.4.12 + - @backstage/plugin-jenkins@0.4.7 + - @backstage/plugin-kafka@0.2.10 + - @backstage/plugin-kubernetes@0.4.7 + - @backstage/plugin-lighthouse@0.2.19 + - @backstage/plugin-rollbar@0.3.8 + - @backstage/plugin-search@0.4.2 + - @backstage/plugin-sentry@0.3.14 + - @backstage/plugin-todo@0.1.4 + ## 0.2.34 ### Patch Changes diff --git a/packages/app/package.json b/packages/app/package.json index 448dbb4e9a..b26e94fc26 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -1,43 +1,43 @@ { "name": "example-app", - "version": "0.2.34", + "version": "0.2.36", "private": true, "bundled": true, "dependencies": { - "@backstage/catalog-model": "^0.8.4", + "@backstage/catalog-model": "^0.9.0", "@backstage/cli": "^0.7.2", "@backstage/core-app-api": "^0.1.3", - "@backstage/core-components": "^0.1.3", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/integration-react": "^0.1.4", - "@backstage/plugin-api-docs": "^0.6.0", - "@backstage/plugin-badges": "^0.2.3", - "@backstage/plugin-catalog": "^0.6.4", - "@backstage/plugin-catalog-import": "^0.5.11", - "@backstage/plugin-catalog-react": "^0.2.4", - "@backstage/plugin-circleci": "^0.2.17", - "@backstage/plugin-cloudbuild": "^0.2.17", - "@backstage/plugin-code-coverage": "^0.1.5", + "@backstage/plugin-api-docs": "^0.6.1", + "@backstage/plugin-badges": "^0.2.4", + "@backstage/plugin-catalog": "^0.6.6", + "@backstage/plugin-catalog-import": "^0.5.12", + "@backstage/plugin-catalog-react": "^0.2.6", + "@backstage/plugin-circleci": "^0.2.18", + "@backstage/plugin-cloudbuild": "^0.2.18", + "@backstage/plugin-code-coverage": "^0.1.6", "@backstage/plugin-cost-insights": "^0.11.0", - "@backstage/plugin-explore": "^0.3.7", + "@backstage/plugin-explore": "^0.3.9", "@backstage/plugin-gcp-projects": "^0.3.0", - "@backstage/plugin-github-actions": "^0.4.10", + "@backstage/plugin-github-actions": "^0.4.12", "@backstage/plugin-graphiql": "^0.2.12", - "@backstage/plugin-jenkins": "^0.4.6", - "@backstage/plugin-kafka": "^0.2.9", - "@backstage/plugin-kubernetes": "^0.4.6", - "@backstage/plugin-lighthouse": "^0.2.18", + "@backstage/plugin-jenkins": "^0.4.7", + "@backstage/plugin-kafka": "^0.2.10", + "@backstage/plugin-kubernetes": "^0.4.7", + "@backstage/plugin-lighthouse": "^0.2.19", "@backstage/plugin-newrelic": "^0.3.0", - "@backstage/plugin-org": "^0.3.15", - "@backstage/plugin-pagerduty": "0.3.6", - "@backstage/plugin-rollbar": "^0.3.7", - "@backstage/plugin-scaffolder": "^0.9.9", - "@backstage/plugin-search": "^0.4.1", - "@backstage/plugin-sentry": "^0.3.13", + "@backstage/plugin-org": "^0.3.16", + "@backstage/plugin-pagerduty": "0.3.7", + "@backstage/plugin-rollbar": "^0.3.8", + "@backstage/plugin-scaffolder": "^0.10.0", + "@backstage/plugin-search": "^0.4.2", + "@backstage/plugin-sentry": "^0.3.14", "@backstage/plugin-shortcuts": "^0.1.4", "@backstage/plugin-tech-radar": "^0.4.1", - "@backstage/plugin-techdocs": "^0.9.7", - "@backstage/plugin-todo": "^0.1.3", + "@backstage/plugin-techdocs": "^0.9.9", + "@backstage/plugin-todo": "^0.1.4", "@backstage/plugin-user-settings": "^0.2.12", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", diff --git a/packages/backend-common/CHANGELOG.md b/packages/backend-common/CHANGELOG.md index 8010c14aec..93016bd13c 100644 --- a/packages/backend-common/CHANGELOG.md +++ b/packages/backend-common/CHANGELOG.md @@ -1,5 +1,65 @@ # @backstage/backend-common +## 0.8.5 + +### Patch Changes + +- 09d3eb684: Added a `readUrl` method to the `UrlReader` interface that allows for complex response objects and is intended to replace the `read` method. This new method is currently optional to implement which allows for a soft migration to `readUrl` instead of `read` in the future. + + The main use case for `readUrl` returning an object instead of solely a read buffer is to allow for additional metadata such as ETag, which is a requirement for more efficient catalog processing. + + The `GithubUrlReader` and `GitlabUrlReader` readers fully implement `readUrl`. The other existing readers implement the new method but do not propagate or return ETags. + + While the `readUrl` method is not yet required, it will be in the future, and we already log deprecation warnings when custom `UrlReader` implementations that do not implement `readUrl` are used. We therefore recommend that any existing custom implementations are migrated to implement `readUrl`. + + The old `read` and the new `readUrl` methods can easily be implemented using one another, but we recommend moving the chunk of the implementation to the new `readUrl` method as `read` is being removed, for example this: + + ```ts + class CustomUrlReader implements UrlReader { + read(url: string): Promise { + const res = await fetch(url); + + if (!res.ok) { + // error handling ... + } + + return Buffer.from(await res.text()); + } + } + ``` + + Can be migrated to something like this: + + ```ts + class CustomUrlReader implements UrlReader { + read(url: string): Promise { + const res = await this.readUrl(url); + return res.buffer(); + } + + async readUrl( + url: string, + _options?: ReadUrlOptions, + ): Promise { + const res = await fetch(url); + + if (!res.ok) { + // error handling ... + } + + const buffer = Buffer.from(await res.text()); + return { buffer: async () => buffer }; + } + } + ``` + + While there is no usage of the ETag capability yet in the main Backstage packages, you can already add it to your custom implementations. To do so, refer to the documentation of the `readUrl` method and surrounding types, and the existing implementation in `packages/backend-common/src/reading/GithubUrlReader.ts`. + +- 6841e0113: fix minor version of git-url-parse as 11.5.x introduced a bug for Bitbucket Server +- c2db794f5: add defaultBranch property for publish GitHub action +- Updated dependencies + - @backstage/integration@0.5.8 + ## 0.8.4 ### Patch Changes diff --git a/packages/backend-common/package.json b/packages/backend-common/package.json index 1a0014cbc2..e777e947c2 100644 --- a/packages/backend-common/package.json +++ b/packages/backend-common/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/backend-common", "description": "Common functionality library for Backstage backends", - "version": "0.8.4", + "version": "0.8.5", "main": "src/index.ts", "types": "src/index.ts", "private": false, @@ -33,7 +33,7 @@ "@backstage/config": "^0.1.5", "@backstage/config-loader": "^0.6.4", "@backstage/errors": "^0.1.1", - "@backstage/integration": "^0.5.7", + "@backstage/integration": "^0.5.8", "@google-cloud/storage": "^5.8.0", "@octokit/rest": "^18.5.3", "@types/cors": "^2.8.6", diff --git a/packages/backend-test-utils/CHANGELOG.md b/packages/backend-test-utils/CHANGELOG.md index e529fe464f..2faa5afbc3 100644 --- a/packages/backend-test-utils/CHANGELOG.md +++ b/packages/backend-test-utils/CHANGELOG.md @@ -1,5 +1,13 @@ # @backstage/backend-test-utils +## 0.1.4 + +### Patch Changes + +- f7134c368: bump sqlite3 to 5.0.1 +- Updated dependencies + - @backstage/backend-common@0.8.5 + ## 0.1.3 ### Patch Changes diff --git a/packages/backend-test-utils/package.json b/packages/backend-test-utils/package.json index 65852c3a4f..9ec11a58b7 100644 --- a/packages/backend-test-utils/package.json +++ b/packages/backend-test-utils/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/backend-test-utils", "description": "Test helpers library for Backstage backends", - "version": "0.1.3", + "version": "0.1.4", "main": "src/index.ts", "types": "src/index.ts", "private": false, @@ -30,7 +30,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.8.3", + "@backstage/backend-common": "^0.8.5", "@backstage/cli": "^0.7.1", "@backstage/config": "^0.1.5", "knex": "^0.95.1", diff --git a/packages/backend/CHANGELOG.md b/packages/backend/CHANGELOG.md index 9659932635..47edc5107f 100644 --- a/packages/backend/CHANGELOG.md +++ b/packages/backend/CHANGELOG.md @@ -1,5 +1,28 @@ # example-backend +## 0.2.36 + +### Patch Changes + +- Updated dependencies + - @backstage/integration@0.5.8 + - @backstage/plugin-scaffolder-backend@0.13.0 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-backend@0.12.0 + - @backstage/backend-common@0.8.5 + - @backstage/plugin-search-backend-node@0.3.0 + - example-app@0.2.36 + - @backstage/plugin-scaffolder-backend-module-rails@0.1.2 + - @backstage/catalog-client@0.3.16 + - @backstage/plugin-auth-backend@0.3.16 + - @backstage/plugin-badges-backend@0.1.8 + - @backstage/plugin-code-coverage-backend@0.1.8 + - @backstage/plugin-kafka-backend@0.2.8 + - @backstage/plugin-kubernetes-backend@0.3.9 + - @backstage/plugin-techdocs-backend@0.8.6 + - @backstage/plugin-todo-backend@0.1.8 + - @backstage/plugin-search-backend@0.2.2 + ## 0.2.35 ### Patch Changes diff --git a/packages/backend/package.json b/packages/backend/package.json index c3e693865f..4338f3e2b7 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -1,6 +1,6 @@ { "name": "example-backend", - "version": "0.2.35", + "version": "0.2.36", "main": "dist/index.cjs.js", "types": "src/index.ts", "license": "Apache-2.0", @@ -27,32 +27,32 @@ "migrate:create": "knex migrate:make -x ts" }, "dependencies": { - "@backstage/backend-common": "^0.8.4", - "@backstage/catalog-client": "^0.3.15", - "@backstage/catalog-model": "^0.8.2", + "@backstage/backend-common": "^0.8.5", + "@backstage/catalog-client": "^0.3.16", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.5", - "@backstage/integration": "^0.5.6", + "@backstage/integration": "^0.5.8", "@backstage/plugin-app-backend": "^0.3.13", - "@backstage/plugin-auth-backend": "^0.3.15", - "@backstage/plugin-badges-backend": "^0.1.6", - "@backstage/plugin-catalog-backend": "^0.11.0", - "@backstage/plugin-code-coverage-backend": "^0.1.6", + "@backstage/plugin-auth-backend": "^0.3.16", + "@backstage/plugin-badges-backend": "^0.1.8", + "@backstage/plugin-catalog-backend": "^0.12.0", + "@backstage/plugin-code-coverage-backend": "^0.1.8", "@backstage/plugin-graphql-backend": "^0.1.8", - "@backstage/plugin-kubernetes-backend": "^0.3.8", - "@backstage/plugin-kafka-backend": "^0.2.7", + "@backstage/plugin-kubernetes-backend": "^0.3.9", + "@backstage/plugin-kafka-backend": "^0.2.8", "@backstage/plugin-proxy-backend": "^0.2.9", "@backstage/plugin-rollbar-backend": "^0.1.11", - "@backstage/plugin-scaffolder-backend": "^0.12.4", - "@backstage/plugin-scaffolder-backend-module-rails": "^0.1.1", - "@backstage/plugin-search-backend": "^0.2.0", - "@backstage/plugin-search-backend-node": "^0.2.0", - "@backstage/plugin-techdocs-backend": "^0.8.5", - "@backstage/plugin-todo-backend": "^0.1.6", + "@backstage/plugin-scaffolder-backend": "^0.13.0", + "@backstage/plugin-scaffolder-backend-module-rails": "^0.1.2", + "@backstage/plugin-search-backend": "^0.2.2", + "@backstage/plugin-search-backend-node": "^0.3.0", + "@backstage/plugin-techdocs-backend": "^0.8.6", + "@backstage/plugin-todo-backend": "^0.1.8", "@gitbeaker/node": "^30.2.0", "@octokit/rest": "^18.5.3", "azure-devops-node-api": "^10.2.2", "dockerode": "^3.2.1", - "example-app": "^0.2.32", + "example-app": "^0.2.36", "express": "^4.17.1", "express-promise-router": "^4.1.0", "knex": "^0.95.1", diff --git a/packages/catalog-client/CHANGELOG.md b/packages/catalog-client/CHANGELOG.md index 2bae1fc11e..70b79b961f 100644 --- a/packages/catalog-client/CHANGELOG.md +++ b/packages/catalog-client/CHANGELOG.md @@ -1,5 +1,12 @@ # @backstage/catalog-client +## 0.3.16 + +### Patch Changes + +- Updated dependencies + - @backstage/catalog-model@0.9.0 + ## 0.3.15 ### Patch Changes diff --git a/packages/catalog-client/package.json b/packages/catalog-client/package.json index 425e70c20d..fbb37d2449 100644 --- a/packages/catalog-client/package.json +++ b/packages/catalog-client/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/catalog-client", - "version": "0.3.15", + "version": "0.3.16", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -29,7 +29,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.5", "@backstage/errors": "^0.1.1", "cross-fetch": "^3.0.6" diff --git a/packages/catalog-model/CHANGELOG.md b/packages/catalog-model/CHANGELOG.md index 7a6cce0a6b..5dbbfd241f 100644 --- a/packages/catalog-model/CHANGELOG.md +++ b/packages/catalog-model/CHANGELOG.md @@ -1,5 +1,71 @@ # @backstage/catalog-model +## 0.9.0 + +### Minor Changes + +- 77db0c454: Changed the regex to validate names following the Kubernetes validation rule, this allow to be more permissive validating the name of the object in Backstage. +- 60e830222: Support for `Template` kinds with version `backstage.io/v1alpha1` has now been removed. This means that the old method of running templates with `Preparers`, `Templaters` and `Publishers` has also been removed. If you had any logic in these abstractions, they should now be moved to `actions` instead, and you can find out more about those in the [documentation](https://backstage.io/docs/features/software-templates/writing-custom-actions) + + If you need any help migrating existing templates, there's a [migration guide](https://backstage.io/docs/features/software-templates/migrating-from-v1alpha1-to-v1beta2). Reach out to us on Discord in the #support channel if you're having problems. + + The `scaffolder-backend` now no longer requires these `Preparers`, `Templaters`, and `Publishers` to be passed in, now all it needs is the `containerRunner`. + + Please update your `packages/backend/src/plugins/scaffolder.ts` like the following + + ```diff + - import { + - DockerContainerRunner, + - SingleHostDiscovery, + - } from '@backstage/backend-common'; + + import { DockerContainerRunner } from '@backstage/backend-common'; + import { CatalogClient } from '@backstage/catalog-client'; + - import { + - CookieCutter, + - CreateReactAppTemplater, + - createRouter, + - Preparers, + - Publishers, + - Templaters, + - } from '@backstage/plugin-scaffolder-backend'; + + import { createRouter } from '@backstage/plugin-scaffolder-backend'; + import Docker from 'dockerode'; + import { Router } from 'express'; + import type { PluginEnvironment } from '../types'; + + export default async function createPlugin({ + config, + database, + reader, + + discovery, + }: PluginEnvironment): Promise { + const dockerClient = new Docker(); + const containerRunner = new DockerContainerRunner({ dockerClient }); + + - const cookiecutterTemplater = new CookieCutter({ containerRunner }); + - const craTemplater = new CreateReactAppTemplater({ containerRunner }); + - const templaters = new Templaters(); + + - templaters.register('cookiecutter', cookiecutterTemplater); + - templaters.register('cra', craTemplater); + - + - const preparers = await Preparers.fromConfig(config, { logger }); + - const publishers = await Publishers.fromConfig(config, { logger }); + + - const discovery = SingleHostDiscovery.fromConfig(config); + const catalogClient = new CatalogClient({ discoveryApi: discovery }); + + return await createRouter({ + - preparers, + - templaters, + - publishers, + + containerRunner, + logger, + config, + database, + + ``` + ## 0.8.4 ### Patch Changes diff --git a/packages/catalog-model/package.json b/packages/catalog-model/package.json index 1ddf1b89ae..13c3214252 100644 --- a/packages/catalog-model/package.json +++ b/packages/catalog-model/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/catalog-model", - "version": "0.8.4", + "version": "0.9.0", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", diff --git a/packages/codemods/CHANGELOG.md b/packages/codemods/CHANGELOG.md index d5291222d8..dc1f694dca 100644 --- a/packages/codemods/CHANGELOG.md +++ b/packages/codemods/CHANGELOG.md @@ -1,5 +1,12 @@ # @backstage/codemods +## 0.1.5 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + ## 0.1.4 ### Patch Changes diff --git a/packages/codemods/package.json b/packages/codemods/package.json index 2b557685bd..9cf5730126 100644 --- a/packages/codemods/package.json +++ b/packages/codemods/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/codemods", "description": "A collection of codemods for Backstage projects", - "version": "0.1.4", + "version": "0.1.5", "private": false, "publishConfig": { "access": "public", diff --git a/packages/core-components/CHANGELOG.md b/packages/core-components/CHANGELOG.md index 7f3bc09225..1536cf3fb2 100644 --- a/packages/core-components/CHANGELOG.md +++ b/packages/core-components/CHANGELOG.md @@ -1,5 +1,18 @@ # @backstage/core-components +## 0.1.5 + +### Patch Changes + +- a446bffdb: Improve UX of the Sidebar by adding SidebarScrollWrapper component allowing the user to scroll through Plugins & Shortcuts on smaller screens. Prevent the Sidebar from opening on click on small devices +- f11e50ea7: - Enhanced core `Button` component to open external links in new tab. + - Replaced the use of `Button` component from material by `core-components` in tools card. +- 76bb7aeda: Show scroll bar of the sidebar wrapper only on hover +- 2a13aa1b7: Handle empty code blocks in markdown files so they don't fail rendering +- 47748c7e6: Fix error in error panel, and console warnings about DOM nesting pre inside p +- 34352a79c: Add edit button to Group Profile Card +- 612e25fd7: Add custom styles to scroll bar of the sidebar wrapper to fix flaky behaviour + ## 0.1.4 ### Patch Changes diff --git a/packages/core-components/package.json b/packages/core-components/package.json index 1c2e160bd5..b9d514d074 100644 --- a/packages/core-components/package.json +++ b/packages/core-components/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/core-components", "description": "Core components used by Backstage plugins and apps", - "version": "0.1.4", + "version": "0.1.5", "private": false, "publishConfig": { "access": "public", diff --git a/packages/create-app/CHANGELOG.md b/packages/create-app/CHANGELOG.md index 5a5949b53a..91863f51d7 100644 --- a/packages/create-app/CHANGELOG.md +++ b/packages/create-app/CHANGELOG.md @@ -1,5 +1,73 @@ # @backstage/create-app +## 0.3.30 + +### Patch Changes + +- 60e830222: Support for `Template` kinds with version `backstage.io/v1alpha1` has now been removed. This means that the old method of running templates with `Preparers`, `Templaters` and `Publishers` has also been removed. If you had any logic in these abstractions, they should now be moved to `actions` instead, and you can find out more about those in the [documentation](https://backstage.io/docs/features/software-templates/writing-custom-actions) + + If you need any help migrating existing templates, there's a [migration guide](https://backstage.io/docs/features/software-templates/migrating-from-v1alpha1-to-v1beta2). Reach out to us on Discord in the #support channel if you're having problems. + + The `scaffolder-backend` now no longer requires these `Preparers`, `Templaters`, and `Publishers` to be passed in, now all it needs is the `containerRunner`. + + Please update your `packages/backend/src/plugins/scaffolder.ts` like the following + + ```diff + - import { + - DockerContainerRunner, + - SingleHostDiscovery, + - } from '@backstage/backend-common'; + + import { DockerContainerRunner } from '@backstage/backend-common'; + import { CatalogClient } from '@backstage/catalog-client'; + - import { + - CookieCutter, + - CreateReactAppTemplater, + - createRouter, + - Preparers, + - Publishers, + - Templaters, + - } from '@backstage/plugin-scaffolder-backend'; + + import { createRouter } from '@backstage/plugin-scaffolder-backend'; + import Docker from 'dockerode'; + import { Router } from 'express'; + import type { PluginEnvironment } from '../types'; + + export default async function createPlugin({ + config, + database, + reader, + + discovery, + }: PluginEnvironment): Promise { + const dockerClient = new Docker(); + const containerRunner = new DockerContainerRunner({ dockerClient }); + + - const cookiecutterTemplater = new CookieCutter({ containerRunner }); + - const craTemplater = new CreateReactAppTemplater({ containerRunner }); + - const templaters = new Templaters(); + + - templaters.register('cookiecutter', cookiecutterTemplater); + - templaters.register('cra', craTemplater); + - + - const preparers = await Preparers.fromConfig(config, { logger }); + - const publishers = await Publishers.fromConfig(config, { logger }); + + - const discovery = SingleHostDiscovery.fromConfig(config); + const catalogClient = new CatalogClient({ discoveryApi: discovery }); + + return await createRouter({ + - preparers, + - templaters, + - publishers, + + containerRunner, + logger, + config, + database, + + ``` + +- f7134c368: bump sqlite3 to 5.0.1 +- e4244f94b: Use SidebarScrollWrapper to improve responsiveness of the current sidebar. Change: Wrap a section of SidebarItems with this component to enable scroll for smaller screens. It can also be used in sidebar plugins (see shortcuts plugin for an example). + ## 0.3.29 ### Patch Changes diff --git a/packages/create-app/package.json b/packages/create-app/package.json index 73c41a79f0..b961f0ae39 100644 --- a/packages/create-app/package.json +++ b/packages/create-app/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/create-app", "description": "Create app package for Backstage", - "version": "0.3.29", + "version": "0.3.30", "private": false, "publishConfig": { "access": "public" diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md index 6f7c33e46c..9cd431fba8 100644 --- a/packages/dev-utils/CHANGELOG.md +++ b/packages/dev-utils/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/dev-utils +## 0.2.1 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.2.0 ### Minor Changes diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index f9af637830..1f6833e573 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/dev-utils", "description": "Utilities for developing Backstage plugins.", - "version": "0.2.0", + "version": "0.2.1", "private": false, "publishConfig": { "access": "public", @@ -30,11 +30,11 @@ }, "dependencies": { "@backstage/core-app-api": "^0.1.3", - "@backstage/core-components": "^0.1.3", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/catalog-model": "^0.8.4", + "@backstage/catalog-model": "^0.9.0", "@backstage/integration-react": "^0.1.4", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/test-utils": "^0.1.14", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", diff --git a/packages/integration/CHANGELOG.md b/packages/integration/CHANGELOG.md index 157446ad4c..a175c0c068 100644 --- a/packages/integration/CHANGELOG.md +++ b/packages/integration/CHANGELOG.md @@ -1,5 +1,13 @@ # @backstage/integration +## 0.5.8 + +### Patch Changes + +- 43a4ef644: Do not throw in `ScmIntegration` `byUrl` for invalid URLs +- 6841e0113: fix minor version of git-url-parse as 11.5.x introduced a bug for Bitbucket Server +- b691a938e: Fix downloads from repositories located at bitbucket.org + ## 0.5.7 ### Patch Changes diff --git a/packages/integration/package.json b/packages/integration/package.json index e648c3745f..496376ac61 100644 --- a/packages/integration/package.json +++ b/packages/integration/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/integration", - "version": "0.5.7", + "version": "0.5.8", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", diff --git a/packages/techdocs-common/CHANGELOG.md b/packages/techdocs-common/CHANGELOG.md index c39060a934..02edf9c95f 100644 --- a/packages/techdocs-common/CHANGELOG.md +++ b/packages/techdocs-common/CHANGELOG.md @@ -1,5 +1,16 @@ # @backstage/techdocs-common +## 0.6.7 + +### Patch Changes + +- 683308ecf: Fix openStack swift publisher encoding issue. Remove utf8 forced encoding on binary files +- 6841e0113: fix minor version of git-url-parse as 11.5.x introduced a bug for Bitbucket Server +- Updated dependencies + - @backstage/integration@0.5.8 + - @backstage/catalog-model@0.9.0 + - @backstage/backend-common@0.8.5 + ## 0.6.6 ### Patch Changes diff --git a/packages/techdocs-common/package.json b/packages/techdocs-common/package.json index d3adb60419..9b5b614177 100644 --- a/packages/techdocs-common/package.json +++ b/packages/techdocs-common/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/techdocs-common", "description": "Common functionalities for TechDocs, to be shared between techdocs-backend plugin and techdocs-cli", - "version": "0.6.6", + "version": "0.6.7", "main": "src/index.ts", "types": "src/index.ts", "private": false, @@ -38,11 +38,11 @@ "dependencies": { "@azure/identity": "^1.2.2", "@azure/storage-blob": "^12.4.0", - "@backstage/backend-common": "^0.8.4", - "@backstage/catalog-model": "^0.8.4", + "@backstage/backend-common": "^0.8.5", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.5", "@backstage/errors": "^0.1.1", - "@backstage/integration": "^0.5.7", + "@backstage/integration": "^0.5.8", "@google-cloud/storage": "^5.6.0", "@types/express": "^4.17.6", "aws-sdk": "^2.840.0", diff --git a/plugins/api-docs/CHANGELOG.md b/plugins/api-docs/CHANGELOG.md index 236517b105..9135443ac9 100644 --- a/plugins/api-docs/CHANGELOG.md +++ b/plugins/api-docs/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-api-docs +## 0.6.1 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog@0.6.6 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.6.0 ### Minor Changes diff --git a/plugins/api-docs/package.json b/plugins/api-docs/package.json index fbec69278e..3e667d6528 100644 --- a/plugins/api-docs/package.json +++ b/plugins/api-docs/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-api-docs", - "version": "0.6.0", + "version": "0.6.1", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,11 +30,11 @@ }, "dependencies": { "@asyncapi/react-component": "^0.23.0", - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/plugin-catalog": "^0.6.4", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog": "^0.6.6", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-icons/font": "^1.0.2", "@material-ui/core": "^4.11.0", @@ -53,7 +53,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/auth-backend/CHANGELOG.md b/plugins/auth-backend/CHANGELOG.md index 822ec104e0..dd96bee3cc 100644 --- a/plugins/auth-backend/CHANGELOG.md +++ b/plugins/auth-backend/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/plugin-auth-backend +## 0.3.16 + +### Patch Changes + +- Updated dependencies + - @backstage/catalog-model@0.9.0 + - @backstage/backend-common@0.8.5 + - @backstage/catalog-client@0.3.16 + ## 0.3.15 ### Patch Changes diff --git a/plugins/auth-backend/package.json b/plugins/auth-backend/package.json index 085590c8fa..719cec7a99 100644 --- a/plugins/auth-backend/package.json +++ b/plugins/auth-backend/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-auth-backend", - "version": "0.3.15", + "version": "0.3.16", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -29,9 +29,9 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.8.4", - "@backstage/catalog-client": "^0.3.15", - "@backstage/catalog-model": "^0.8.4", + "@backstage/backend-common": "^0.8.5", + "@backstage/catalog-client": "^0.3.16", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.5", "@backstage/errors": "^0.1.1", "@backstage/test-utils": "^0.1.14", diff --git a/plugins/badges-backend/CHANGELOG.md b/plugins/badges-backend/CHANGELOG.md index 6ba2512b86..9b6a9bf433 100644 --- a/plugins/badges-backend/CHANGELOG.md +++ b/plugins/badges-backend/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/plugin-badges-backend +## 0.1.8 + +### Patch Changes + +- Updated dependencies + - @backstage/catalog-model@0.9.0 + - @backstage/backend-common@0.8.5 + - @backstage/catalog-client@0.3.16 + ## 0.1.7 ### Patch Changes diff --git a/plugins/badges-backend/package.json b/plugins/badges-backend/package.json index 99bdb25a04..68b4cdc9fb 100644 --- a/plugins/badges-backend/package.json +++ b/plugins/badges-backend/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-badges-backend", - "version": "0.1.7", + "version": "0.1.8", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,9 +30,9 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.8.3", - "@backstage/catalog-client": "^0.3.13", - "@backstage/catalog-model": "^0.8.3", + "@backstage/backend-common": "^0.8.5", + "@backstage/catalog-client": "^0.3.16", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.5", "@backstage/errors": "^0.1.1", "@types/express": "^4.17.6", diff --git a/plugins/badges/CHANGELOG.md b/plugins/badges/CHANGELOG.md index 914c29deec..e855201853 100644 --- a/plugins/badges/CHANGELOG.md +++ b/plugins/badges/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/plugin-badges +## 0.2.4 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.2.3 ### Patch Changes diff --git a/plugins/badges/package.json b/plugins/badges/package.json index cebc5332e2..67e2ef90e3 100644 --- a/plugins/badges/package.json +++ b/plugins/badges/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-badges", - "version": "0.2.3", + "version": "0.2.4", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -20,11 +20,11 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/errors": "^0.1.1", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -37,7 +37,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/bitrise/CHANGELOG.md b/plugins/bitrise/CHANGELOG.md index aaf6e8658c..ab9d842f1f 100644 --- a/plugins/bitrise/CHANGELOG.md +++ b/plugins/bitrise/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/plugin-bitrise +## 0.1.6 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.1.5 ### Patch Changes diff --git a/plugins/bitrise/package.json b/plugins/bitrise/package.json index 450ddaca85..a73fa64797 100644 --- a/plugins/bitrise/package.json +++ b/plugins/bitrise/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-bitrise", - "version": "0.1.5", + "version": "0.1.6", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -20,10 +20,10 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -40,7 +40,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/catalog-backend-module-ldap/CHANGELOG.md b/plugins/catalog-backend-module-ldap/CHANGELOG.md index 3806a6b5d3..bd090ff847 100644 --- a/plugins/catalog-backend-module-ldap/CHANGELOG.md +++ b/plugins/catalog-backend-module-ldap/CHANGELOG.md @@ -1,5 +1,18 @@ # @backstage/plugin-catalog-backend-module-ldap +## 0.2.0 + +### Minor Changes + +- b055ef88a: Add extension points to the `LdapOrgReaderProcessor` to make it possible to do more advanced modifications + of the ingested users and groups. + +### Patch Changes + +- Updated dependencies + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-backend@0.12.0 + ## 0.1.1 ### Patch Changes diff --git a/plugins/catalog-backend-module-ldap/package.json b/plugins/catalog-backend-module-ldap/package.json index 4d840b7f48..27969ca463 100644 --- a/plugins/catalog-backend-module-ldap/package.json +++ b/plugins/catalog-backend-module-ldap/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-catalog-backend-module-ldap", - "version": "0.1.1", + "version": "0.2.0", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -28,9 +28,9 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.3", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.5", - "@backstage/plugin-catalog-backend": "^0.11.0", + "@backstage/plugin-catalog-backend": "^0.12.0", "@types/ldapjs": "^1.0.10", "ldapjs": "^2.2.0", "lodash": "^4.17.15", diff --git a/plugins/catalog-backend-module-msgraph/CHANGELOG.md b/plugins/catalog-backend-module-msgraph/CHANGELOG.md index 6de8b0ec07..1f23da520f 100644 --- a/plugins/catalog-backend-module-msgraph/CHANGELOG.md +++ b/plugins/catalog-backend-module-msgraph/CHANGELOG.md @@ -1,5 +1,13 @@ # @backstage/plugin-catalog-backend-module-msgraph +## 0.2.1 + +### Patch Changes + +- Updated dependencies + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-backend@0.12.0 + ## 0.2.0 ### Minor Changes diff --git a/plugins/catalog-backend-module-msgraph/package.json b/plugins/catalog-backend-module-msgraph/package.json index 1c1886d802..3d24b9efd6 100644 --- a/plugins/catalog-backend-module-msgraph/package.json +++ b/plugins/catalog-backend-module-msgraph/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-catalog-backend-module-msgraph", - "version": "0.2.0", + "version": "0.2.1", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -29,9 +29,9 @@ }, "dependencies": { "@azure/msal-node": "^1.1.0", - "@backstage/catalog-model": "^0.8.4", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.5", - "@backstage/plugin-catalog-backend": "^0.11.0", + "@backstage/plugin-catalog-backend": "^0.12.0", "@microsoft/microsoft-graph-types": "^1.25.0", "cross-fetch": "^3.0.6", "lodash": "^4.17.15", @@ -40,7 +40,7 @@ "qs": "^6.9.4" }, "devDependencies": { - "@backstage/backend-common": "^0.8.4", + "@backstage/backend-common": "^0.8.5", "@backstage/cli": "^0.7.3", "@backstage/test-utils": "^0.1.14", "@types/lodash": "^4.14.151", diff --git a/plugins/catalog-backend/CHANGELOG.md b/plugins/catalog-backend/CHANGELOG.md index 174f279b11..bc8de4878d 100644 --- a/plugins/catalog-backend/CHANGELOG.md +++ b/plugins/catalog-backend/CHANGELOG.md @@ -1,5 +1,82 @@ # @backstage/plugin-catalog-backend +## 0.12.0 + +### Minor Changes + +- 60e830222: Support for `Template` kinds with version `backstage.io/v1alpha1` has now been removed. This means that the old method of running templates with `Preparers`, `Templaters` and `Publishers` has also been removed. If you had any logic in these abstractions, they should now be moved to `actions` instead, and you can find out more about those in the [documentation](https://backstage.io/docs/features/software-templates/writing-custom-actions) + + If you need any help migrating existing templates, there's a [migration guide](https://backstage.io/docs/features/software-templates/migrating-from-v1alpha1-to-v1beta2). Reach out to us on Discord in the #support channel if you're having problems. + + The `scaffolder-backend` now no longer requires these `Preparers`, `Templaters`, and `Publishers` to be passed in, now all it needs is the `containerRunner`. + + Please update your `packages/backend/src/plugins/scaffolder.ts` like the following + + ```diff + - import { + - DockerContainerRunner, + - SingleHostDiscovery, + - } from '@backstage/backend-common'; + + import { DockerContainerRunner } from '@backstage/backend-common'; + import { CatalogClient } from '@backstage/catalog-client'; + - import { + - CookieCutter, + - CreateReactAppTemplater, + - createRouter, + - Preparers, + - Publishers, + - Templaters, + - } from '@backstage/plugin-scaffolder-backend'; + + import { createRouter } from '@backstage/plugin-scaffolder-backend'; + import Docker from 'dockerode'; + import { Router } from 'express'; + import type { PluginEnvironment } from '../types'; + + export default async function createPlugin({ + config, + database, + reader, + + discovery, + }: PluginEnvironment): Promise { + const dockerClient = new Docker(); + const containerRunner = new DockerContainerRunner({ dockerClient }); + + - const cookiecutterTemplater = new CookieCutter({ containerRunner }); + - const craTemplater = new CreateReactAppTemplater({ containerRunner }); + - const templaters = new Templaters(); + + - templaters.register('cookiecutter', cookiecutterTemplater); + - templaters.register('cra', craTemplater); + - + - const preparers = await Preparers.fromConfig(config, { logger }); + - const publishers = await Publishers.fromConfig(config, { logger }); + + - const discovery = SingleHostDiscovery.fromConfig(config); + const catalogClient = new CatalogClient({ discoveryApi: discovery }); + + return await createRouter({ + - preparers, + - templaters, + - publishers, + + containerRunner, + logger, + config, + database, + + ``` + +### Patch Changes + +- f7134c368: bump sqlite3 to 5.0.1 +- 6841e0113: fix minor version of git-url-parse as 11.5.x introduced a bug for Bitbucket Server +- 2d41b6993: Make use of the new `readUrl` method on `UrlReader` from `@backstage/backend-common`. +- Updated dependencies + - @backstage/integration@0.5.8 + - @backstage/catalog-model@0.9.0 + - @backstage/backend-common@0.8.5 + - @backstage/plugin-search-backend-node@0.3.0 + - @backstage/catalog-client@0.3.16 + ## 0.11.0 ### Minor Changes diff --git a/plugins/catalog-backend/package.json b/plugins/catalog-backend/package.json index b3ed5c7983..9ee7aeb7a6 100644 --- a/plugins/catalog-backend/package.json +++ b/plugins/catalog-backend/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-catalog-backend", - "version": "0.11.0", + "version": "0.12.0", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -29,13 +29,13 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.8.4", - "@backstage/catalog-client": "^0.3.15", - "@backstage/catalog-model": "^0.8.4", + "@backstage/backend-common": "^0.8.5", + "@backstage/catalog-client": "^0.3.16", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.5", "@backstage/errors": "^0.1.1", - "@backstage/integration": "^0.5.7", - "@backstage/plugin-search-backend-node": "^0.2.2", + "@backstage/integration": "^0.5.8", + "@backstage/plugin-search-backend-node": "^0.3.0", "@backstage/search-common": "^0.1.2", "@octokit/graphql": "^4.5.8", "@types/express": "^4.17.6", @@ -61,7 +61,7 @@ "yup": "^0.29.3" }, "devDependencies": { - "@backstage/backend-test-utils": "^0.1.3", + "@backstage/backend-test-utils": "^0.1.4", "@backstage/cli": "^0.7.3", "@backstage/test-utils": "^0.1.14", "@types/core-js": "^2.5.4", diff --git a/plugins/catalog-graphql/CHANGELOG.md b/plugins/catalog-graphql/CHANGELOG.md index 1641327823..c10aa98b53 100644 --- a/plugins/catalog-graphql/CHANGELOG.md +++ b/plugins/catalog-graphql/CHANGELOG.md @@ -1,5 +1,13 @@ # @backstage/plugin-catalog-graphql +## 0.2.11 + +### Patch Changes + +- Updated dependencies + - @backstage/catalog-model@0.9.0 + - @backstage/backend-common@0.8.5 + ## 0.2.10 ### Patch Changes diff --git a/plugins/catalog-graphql/package.json b/plugins/catalog-graphql/package.json index d14ae5df42..039ac931f3 100644 --- a/plugins/catalog-graphql/package.json +++ b/plugins/catalog-graphql/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-catalog-graphql", - "version": "0.2.10", + "version": "0.2.11", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,8 +30,8 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.8.2", - "@backstage/catalog-model": "^0.8.2", + "@backstage/backend-common": "^0.8.5", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.5", "@graphql-modules/core": "^0.7.17", "apollo-server": "^2.16.1", diff --git a/plugins/catalog-import/CHANGELOG.md b/plugins/catalog-import/CHANGELOG.md index 67a512df55..fb9ae20305 100644 --- a/plugins/catalog-import/CHANGELOG.md +++ b/plugins/catalog-import/CHANGELOG.md @@ -1,5 +1,18 @@ # @backstage/plugin-catalog-import +## 0.5.12 + +### Patch Changes + +- 43a4ef644: More helpful error message when trying to import by folder from non-github +- 6841e0113: fix minor version of git-url-parse as 11.5.x introduced a bug for Bitbucket Server +- Updated dependencies + - @backstage/integration@0.5.8 + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/catalog-client@0.3.16 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.5.11 ### Patch Changes diff --git a/plugins/catalog-import/package.json b/plugins/catalog-import/package.json index cedba14424..3b3f441e8a 100644 --- a/plugins/catalog-import/package.json +++ b/plugins/catalog-import/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-catalog-import", - "version": "0.5.11", + "version": "0.5.12", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,13 +30,13 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-client": "^0.3.14", - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-client": "^0.3.16", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/integration": "^0.5.6", + "@backstage/integration": "^0.5.8", "@backstage/integration-react": "^0.1.4", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -56,7 +56,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/catalog-react/CHANGELOG.md b/plugins/catalog-react/CHANGELOG.md index c7363dda54..bffefc4936 100644 --- a/plugins/catalog-react/CHANGELOG.md +++ b/plugins/catalog-react/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-catalog-react +## 0.2.6 + +### Patch Changes + +- Updated dependencies + - @backstage/integration@0.5.8 + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/catalog-client@0.3.16 + ## 0.2.5 ### Patch Changes diff --git a/plugins/catalog-react/package.json b/plugins/catalog-react/package.json index 8c760a16d0..99552cdb59 100644 --- a/plugins/catalog-react/package.json +++ b/plugins/catalog-react/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-catalog-react", - "version": "0.2.5", + "version": "0.2.6", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -28,12 +28,12 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-client": "^0.3.15", - "@backstage/catalog-model": "^0.8.4", + "@backstage/catalog-client": "^0.3.16", + "@backstage/catalog-model": "^0.9.0", "@backstage/core-app-api": "^0.1.4", - "@backstage/core-components": "^0.1.4", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/integration": "^0.5.7", + "@backstage/integration": "^0.5.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.45", @@ -46,7 +46,7 @@ }, "devDependencies": { "@backstage/cli": "^0.7.3", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/catalog/CHANGELOG.md b/plugins/catalog/CHANGELOG.md index 407f0f0f3f..0faa012cf3 100644 --- a/plugins/catalog/CHANGELOG.md +++ b/plugins/catalog/CHANGELOG.md @@ -1,5 +1,18 @@ # @backstage/plugin-catalog +## 0.6.6 + +### Patch Changes + +- ad5d05b69: Change catalog page layout to use Grid components to improve responsiveness +- 6841e0113: fix minor version of git-url-parse as 11.5.x introduced a bug for Bitbucket Server +- Updated dependencies + - @backstage/integration@0.5.8 + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/catalog-client@0.3.16 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.6.5 ### Patch Changes diff --git a/plugins/catalog/package.json b/plugins/catalog/package.json index 882f6202b2..2c5065755d 100644 --- a/plugins/catalog/package.json +++ b/plugins/catalog/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-catalog", - "version": "0.6.5", + "version": "0.6.6", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,14 +30,14 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-client": "^0.3.15", - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-client": "^0.3.16", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/errors": "^0.1.1", - "@backstage/integration": "^0.5.7", + "@backstage/integration": "^0.5.8", "@backstage/integration-react": "^0.1.4", - "@backstage/plugin-catalog-react": "^0.2.5", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -56,7 +56,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/circleci/CHANGELOG.md b/plugins/circleci/CHANGELOG.md index fbc8570479..7dbaea83e4 100644 --- a/plugins/circleci/CHANGELOG.md +++ b/plugins/circleci/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/plugin-circleci +## 0.2.18 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.2.17 ### Patch Changes diff --git a/plugins/circleci/package.json b/plugins/circleci/package.json index 1656d43798..f03debe9ac 100644 --- a/plugins/circleci/package.json +++ b/plugins/circleci/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-circleci", - "version": "0.2.17", + "version": "0.2.18", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,10 +31,10 @@ "postpack": "backstage-cli postpack" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -52,7 +52,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/cloudbuild/CHANGELOG.md b/plugins/cloudbuild/CHANGELOG.md index c097091f18..4e837d532b 100644 --- a/plugins/cloudbuild/CHANGELOG.md +++ b/plugins/cloudbuild/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/plugin-cloudbuild +## 0.2.18 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.2.17 ### Patch Changes diff --git a/plugins/cloudbuild/package.json b/plugins/cloudbuild/package.json index cac222787b..4fa32a8200 100644 --- a/plugins/cloudbuild/package.json +++ b/plugins/cloudbuild/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-cloudbuild", - "version": "0.2.17", + "version": "0.2.18", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,10 +30,10 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -50,7 +50,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/code-coverage-backend/CHANGELOG.md b/plugins/code-coverage-backend/CHANGELOG.md index 11e341abed..7e008b4dcf 100644 --- a/plugins/code-coverage-backend/CHANGELOG.md +++ b/plugins/code-coverage-backend/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-code-coverage-backend +## 0.1.8 + +### Patch Changes + +- Updated dependencies + - @backstage/integration@0.5.8 + - @backstage/catalog-model@0.9.0 + - @backstage/backend-common@0.8.5 + - @backstage/catalog-client@0.3.16 + ## 0.1.7 ### Patch Changes diff --git a/plugins/code-coverage-backend/package.json b/plugins/code-coverage-backend/package.json index 0d44ea3d12..fa2f38b3eb 100644 --- a/plugins/code-coverage-backend/package.json +++ b/plugins/code-coverage-backend/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-code-coverage-backend", - "version": "0.1.7", + "version": "0.1.8", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -19,12 +19,12 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.8.3", - "@backstage/catalog-client": "^0.3.13", - "@backstage/catalog-model": "^0.8.3", + "@backstage/backend-common": "^0.8.5", + "@backstage/catalog-client": "^0.3.16", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.5", "@backstage/errors": "^0.1.1", - "@backstage/integration": "^0.5.6", + "@backstage/integration": "^0.5.8", "@types/express": "^4.17.6", "cross-fetch": "^3.0.6", "express": "^4.17.1", diff --git a/plugins/code-coverage/CHANGELOG.md b/plugins/code-coverage/CHANGELOG.md index 0d892a08c6..4064ba3f1a 100644 --- a/plugins/code-coverage/CHANGELOG.md +++ b/plugins/code-coverage/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/plugin-code-coverage +## 0.1.6 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.1.5 ### Patch Changes diff --git a/plugins/code-coverage/package.json b/plugins/code-coverage/package.json index 771e425b36..2a4f7f4bf6 100644 --- a/plugins/code-coverage/package.json +++ b/plugins/code-coverage/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-code-coverage", - "version": "0.1.5", + "version": "0.1.6", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -20,12 +20,12 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.4", - "@backstage/core-components": "^0.1.4", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/errors": "^0.1.1", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -42,7 +42,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/config-schema/package.json b/plugins/config-schema/package.json index 8ae20e8782..ae88de45b4 100644 --- a/plugins/config-schema/package.json +++ b/plugins/config-schema/package.json @@ -21,7 +21,7 @@ }, "dependencies": { "@backstage/config": "^0.1.4", - "@backstage/core-components": "^0.1.4", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/errors": "^0.1.1", "@backstage/theme": "^0.2.8", @@ -37,7 +37,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/cost-insights/package.json b/plugins/cost-insights/package.json index 542b7ba327..13b9c9d85a 100644 --- a/plugins/cost-insights/package.json +++ b/plugins/cost-insights/package.json @@ -31,7 +31,7 @@ }, "dependencies": { "@backstage/config": "^0.1.5", - "@backstage/core-components": "^0.1.4", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", @@ -56,7 +56,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/explore/CHANGELOG.md b/plugins/explore/CHANGELOG.md index 00ba8b446c..7049978f85 100644 --- a/plugins/explore/CHANGELOG.md +++ b/plugins/explore/CHANGELOG.md @@ -1,5 +1,16 @@ # @backstage/plugin-explore +## 0.3.9 + +### Patch Changes + +- f11e50ea7: - Enhanced core `Button` component to open external links in new tab. + - Replaced the use of `Button` component from material by `core-components` in tools card. +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.3.8 ### Patch Changes diff --git a/plugins/explore/package.json b/plugins/explore/package.json index 8d69eed146..9a4d3b2d88 100644 --- a/plugins/explore/package.json +++ b/plugins/explore/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-explore", - "version": "0.3.8", + "version": "0.3.9", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,10 +30,10 @@ "start": "backstage-cli plugin:serve" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/plugin-catalog-react": "^0.2.5", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/plugin-explore-react": "^0.0.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", @@ -50,7 +50,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/fossa/CHANGELOG.md b/plugins/fossa/CHANGELOG.md index 59541f8d65..e0f30ed179 100644 --- a/plugins/fossa/CHANGELOG.md +++ b/plugins/fossa/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/plugin-fossa +## 0.2.10 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.2.9 ### Patch Changes diff --git a/plugins/fossa/package.json b/plugins/fossa/package.json index 8c11799ef3..8f6d32eb70 100644 --- a/plugins/fossa/package.json +++ b/plugins/fossa/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-fossa", - "version": "0.2.9", + "version": "0.2.10", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,11 +31,11 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/errors": "^0.1.1", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -50,7 +50,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/gcp-projects/package.json b/plugins/gcp-projects/package.json index 2d8de17196..539e9151f5 100644 --- a/plugins/gcp-projects/package.json +++ b/plugins/gcp-projects/package.json @@ -30,7 +30,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core-components": "^0.1.4", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", @@ -44,7 +44,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/git-release-manager/package.json b/plugins/git-release-manager/package.json index c736f082fb..19328c4ebd 100644 --- a/plugins/git-release-manager/package.json +++ b/plugins/git-release-manager/package.json @@ -20,7 +20,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core-components": "^0.1.4", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/integration": "^0.5.6", "@backstage/theme": "^0.2.8", @@ -39,7 +39,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/github-actions/CHANGELOG.md b/plugins/github-actions/CHANGELOG.md index 20717aed60..96ec437188 100644 --- a/plugins/github-actions/CHANGELOG.md +++ b/plugins/github-actions/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-github-actions +## 0.4.12 + +### Patch Changes + +- Updated dependencies + - @backstage/integration@0.5.8 + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.4.11 ### Patch Changes diff --git a/plugins/github-actions/package.json b/plugins/github-actions/package.json index 9d775fa09b..11262a91bc 100644 --- a/plugins/github-actions/package.json +++ b/plugins/github-actions/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-github-actions", - "version": "0.4.11", + "version": "0.4.12", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -32,11 +32,11 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/integration": "^0.5.7", - "@backstage/plugin-catalog-react": "^0.2.5", + "@backstage/integration": "^0.5.8", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -53,7 +53,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/github-deployments/CHANGELOG.md b/plugins/github-deployments/CHANGELOG.md index fb1a0cc11d..4c525a63dc 100644 --- a/plugins/github-deployments/CHANGELOG.md +++ b/plugins/github-deployments/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-github-deployments +## 0.1.10 + +### Patch Changes + +- Updated dependencies + - @backstage/integration@0.5.8 + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.1.9 ### Patch Changes diff --git a/plugins/github-deployments/package.json b/plugins/github-deployments/package.json index b65747eaa1..754f1d73bc 100644 --- a/plugins/github-deployments/package.json +++ b/plugins/github-deployments/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-github-deployments", - "version": "0.1.9", + "version": "0.1.10", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -20,13 +20,13 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/errors": "^0.1.1", - "@backstage/integration": "^0.5.6", + "@backstage/integration": "^0.5.8", "@backstage/integration-react": "^0.1.4", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -40,7 +40,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/gitops-profiles/package.json b/plugins/gitops-profiles/package.json index ed4695372c..f9d029b6d6 100644 --- a/plugins/gitops-profiles/package.json +++ b/plugins/gitops-profiles/package.json @@ -31,7 +31,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core-components": "^0.1.4", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", @@ -45,7 +45,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/graphiql/package.json b/plugins/graphiql/package.json index 58b0aac809..22eab92ba4 100644 --- a/plugins/graphiql/package.json +++ b/plugins/graphiql/package.json @@ -31,7 +31,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core-components": "^0.1.4", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", @@ -46,7 +46,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/ilert/CHANGELOG.md b/plugins/ilert/CHANGELOG.md index 041091f136..9521e1dfc4 100644 --- a/plugins/ilert/CHANGELOG.md +++ b/plugins/ilert/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-ilert +## 0.1.5 + +### Patch Changes + +- 4ca8e569a: chore: bump `@date-io/luxon` from 1.3.13 to 2.10.11 +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.1.4 ### Patch Changes diff --git a/plugins/ilert/package.json b/plugins/ilert/package.json index 521f379d64..e40f6ae310 100644 --- a/plugins/ilert/package.json +++ b/plugins/ilert/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-ilert", - "version": "0.1.4", + "version": "0.1.5", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -20,11 +20,11 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/errors": "^0.1.1", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@date-io/luxon": "2.x", "@material-ui/core": "^4.11.0", @@ -40,7 +40,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/jenkins/CHANGELOG.md b/plugins/jenkins/CHANGELOG.md index eabbecfa19..fbfb17926b 100644 --- a/plugins/jenkins/CHANGELOG.md +++ b/plugins/jenkins/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/plugin-jenkins +## 0.4.7 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.4.6 ### Patch Changes diff --git a/plugins/jenkins/package.json b/plugins/jenkins/package.json index 20674f92ef..6cc5436574 100644 --- a/plugins/jenkins/package.json +++ b/plugins/jenkins/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-jenkins", - "version": "0.4.6", + "version": "0.4.7", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,10 +31,10 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -50,7 +50,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/kafka-backend/CHANGELOG.md b/plugins/kafka-backend/CHANGELOG.md index 5b1d8520a3..9fae449a97 100644 --- a/plugins/kafka-backend/CHANGELOG.md +++ b/plugins/kafka-backend/CHANGELOG.md @@ -1,5 +1,13 @@ # @backstage/plugin-kafka-backend +## 0.2.8 + +### Patch Changes + +- Updated dependencies + - @backstage/catalog-model@0.9.0 + - @backstage/backend-common@0.8.5 + ## 0.2.7 ### Patch Changes diff --git a/plugins/kafka-backend/package.json b/plugins/kafka-backend/package.json index f06837a8e8..9e1b1d52c5 100644 --- a/plugins/kafka-backend/package.json +++ b/plugins/kafka-backend/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-kafka-backend", - "version": "0.2.7", + "version": "0.2.8", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,8 +31,8 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.8.4", - "@backstage/catalog-model": "^0.8.2", + "@backstage/backend-common": "^0.8.5", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.5", "@backstage/errors": "^0.1.1", "@types/express": "^4.17.6", diff --git a/plugins/kafka/CHANGELOG.md b/plugins/kafka/CHANGELOG.md index 3aa2ec1c5c..c7cb9c99ad 100644 --- a/plugins/kafka/CHANGELOG.md +++ b/plugins/kafka/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/plugin-kafka +## 0.2.10 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.2.9 ### Patch Changes diff --git a/plugins/kafka/package.json b/plugins/kafka/package.json index 70e4eea486..882edcd462 100644 --- a/plugins/kafka/package.json +++ b/plugins/kafka/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-kafka", - "version": "0.2.9", + "version": "0.2.10", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -20,10 +20,10 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -36,7 +36,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/kubernetes-backend/CHANGELOG.md b/plugins/kubernetes-backend/CHANGELOG.md index 66e228c1fe..dff8e1833d 100644 --- a/plugins/kubernetes-backend/CHANGELOG.md +++ b/plugins/kubernetes-backend/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/plugin-kubernetes-backend +## 0.3.9 + +### Patch Changes + +- Updated dependencies + - @backstage/catalog-model@0.9.0 + - @backstage/backend-common@0.8.5 + - @backstage/plugin-kubernetes-common@0.1.2 + ## 0.3.8 ### Patch Changes diff --git a/plugins/kubernetes-backend/package.json b/plugins/kubernetes-backend/package.json index 72f576616e..39bfedbbf4 100644 --- a/plugins/kubernetes-backend/package.json +++ b/plugins/kubernetes-backend/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-kubernetes-backend", - "version": "0.3.8", + "version": "0.3.9", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,10 +31,10 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.8.2", - "@backstage/catalog-model": "^0.8.2", + "@backstage/backend-common": "^0.8.5", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.5", - "@backstage/plugin-kubernetes-common": "^0.1.1", + "@backstage/plugin-kubernetes-common": "^0.1.2", "@google-cloud/container": "^2.2.0", "@kubernetes/client-node": "^0.14.0", "@types/express": "^4.17.6", diff --git a/plugins/kubernetes-common/CHANGELOG.md b/plugins/kubernetes-common/CHANGELOG.md index abda763958..3f6c1ea7db 100644 --- a/plugins/kubernetes-common/CHANGELOG.md +++ b/plugins/kubernetes-common/CHANGELOG.md @@ -1,5 +1,12 @@ # @backstage/plugin-kubernetes-common +## 0.1.2 + +### Patch Changes + +- Updated dependencies + - @backstage/catalog-model@0.9.0 + ## 0.1.1 ### Patch Changes diff --git a/plugins/kubernetes-common/package.json b/plugins/kubernetes-common/package.json index 30bf5794bf..1b645690b6 100644 --- a/plugins/kubernetes-common/package.json +++ b/plugins/kubernetes-common/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/plugin-kubernetes-common", "description": "Common functionalities for kubernetes, to be shared between kubernetes and kubernetes-backend plugin", - "version": "0.1.1", + "version": "0.1.2", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -35,7 +35,7 @@ "url": "https://github.com/backstage/backstage/issues" }, "dependencies": { - "@backstage/catalog-model": "^0.8.2", + "@backstage/catalog-model": "^0.9.0", "@kubernetes/client-node": "^0.14.0" }, "devDependencies": { diff --git a/plugins/kubernetes/CHANGELOG.md b/plugins/kubernetes/CHANGELOG.md index 375abba79c..dd9f4d8bfa 100644 --- a/plugins/kubernetes/CHANGELOG.md +++ b/plugins/kubernetes/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-kubernetes +## 0.4.7 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + - @backstage/plugin-kubernetes-common@0.1.2 + ## 0.4.6 ### Patch Changes diff --git a/plugins/kubernetes/package.json b/plugins/kubernetes/package.json index 3a172766c6..fdfb2a3431 100644 --- a/plugins/kubernetes/package.json +++ b/plugins/kubernetes/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-kubernetes", - "version": "0.4.6", + "version": "0.4.7", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,12 +30,12 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.5", - "@backstage/core-components": "^0.1.4", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/plugin-catalog-react": "^0.2.4", - "@backstage/plugin-kubernetes-common": "^0.1.1", + "@backstage/plugin-catalog-react": "^0.2.6", + "@backstage/plugin-kubernetes-common": "^0.1.2", "@backstage/theme": "^0.2.8", "@kubernetes/client-node": "^0.14.0", "@material-ui/core": "^4.11.0", @@ -52,7 +52,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/lighthouse/CHANGELOG.md b/plugins/lighthouse/CHANGELOG.md index 0742d51b4c..9bee12436d 100644 --- a/plugins/lighthouse/CHANGELOG.md +++ b/plugins/lighthouse/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/plugin-lighthouse +## 0.2.19 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.2.18 ### Patch Changes diff --git a/plugins/lighthouse/package.json b/plugins/lighthouse/package.json index fa82243a41..f648041655 100644 --- a/plugins/lighthouse/package.json +++ b/plugins/lighthouse/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-lighthouse", - "version": "0.2.18", + "version": "0.2.19", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,11 +31,11 @@ "start": "backstage-cli plugin:serve" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.4", - "@backstage/core-components": "^0.1.4", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -49,7 +49,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/newrelic/package.json b/plugins/newrelic/package.json index 8d46f381e5..dc5dbecf19 100644 --- a/plugins/newrelic/package.json +++ b/plugins/newrelic/package.json @@ -31,7 +31,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core-components": "^0.1.4", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", @@ -44,7 +44,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/org/CHANGELOG.md b/plugins/org/CHANGELOG.md index c87461ae32..f6042fc618 100644 --- a/plugins/org/CHANGELOG.md +++ b/plugins/org/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-org +## 0.3.16 + +### Patch Changes + +- 34352a79c: Add edit button to Group Profile Card +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.3.15 ### Patch Changes diff --git a/plugins/org/package.json b/plugins/org/package.json index 65710f0615..3962121289 100644 --- a/plugins/org/package.json +++ b/plugins/org/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-org", - "version": "0.3.15", + "version": "0.3.16", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -20,10 +20,10 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -37,7 +37,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/pagerduty/CHANGELOG.md b/plugins/pagerduty/CHANGELOG.md index 48abeffb17..9cb7fe11b4 100644 --- a/plugins/pagerduty/CHANGELOG.md +++ b/plugins/pagerduty/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-pagerduty +## 0.3.7 + +### Patch Changes + +- d1bd7bb82: Update README +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.3.6 ### Patch Changes diff --git a/plugins/pagerduty/package.json b/plugins/pagerduty/package.json index eae99c1e0f..9cb95c25d7 100644 --- a/plugins/pagerduty/package.json +++ b/plugins/pagerduty/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-pagerduty", - "version": "0.3.6", + "version": "0.3.7", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,10 +30,10 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -49,7 +49,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/register-component/CHANGELOG.md b/plugins/register-component/CHANGELOG.md index 9ef2d76266..642f465f54 100644 --- a/plugins/register-component/CHANGELOG.md +++ b/plugins/register-component/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/plugin-register-component +## 0.2.19 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.2.18 ### Patch Changes diff --git a/plugins/register-component/package.json b/plugins/register-component/package.json index 30c7be5b0a..5996b865fd 100644 --- a/plugins/register-component/package.json +++ b/plugins/register-component/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-register-component", - "version": "0.2.18", + "version": "0.2.19", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,10 +30,10 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/plugin-catalog-react": "^0.2.5", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -48,7 +48,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/rollbar/CHANGELOG.md b/plugins/rollbar/CHANGELOG.md index b4635777ee..5ba8a5fee2 100644 --- a/plugins/rollbar/CHANGELOG.md +++ b/plugins/rollbar/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/plugin-rollbar +## 0.3.8 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.3.7 ### Patch Changes diff --git a/plugins/rollbar/package.json b/plugins/rollbar/package.json index 14945abf50..4cbffe3fff 100644 --- a/plugins/rollbar/package.json +++ b/plugins/rollbar/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-rollbar", - "version": "0.3.7", + "version": "0.3.8", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,10 +31,10 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -50,7 +50,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/scaffolder-backend-module-rails/CHANGELOG.md b/plugins/scaffolder-backend-module-rails/CHANGELOG.md new file mode 100644 index 0000000000..45ba753e34 --- /dev/null +++ b/plugins/scaffolder-backend-module-rails/CHANGELOG.md @@ -0,0 +1,10 @@ +# @backstage/plugin-scaffolder-backend-module-rails + +## 0.1.2 + +### Patch Changes + +- Updated dependencies + - @backstage/integration@0.5.8 + - @backstage/plugin-scaffolder-backend@0.13.0 + - @backstage/backend-common@0.8.5 diff --git a/plugins/scaffolder-backend-module-rails/package.json b/plugins/scaffolder-backend-module-rails/package.json index b513100f16..4d734f8440 100644 --- a/plugins/scaffolder-backend-module-rails/package.json +++ b/plugins/scaffolder-backend-module-rails/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-scaffolder-backend-module-rails", - "version": "0.1.1", + "version": "0.1.2", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -20,11 +20,11 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.8.3", - "@backstage/plugin-scaffolder-backend": "^0.12.2", + "@backstage/backend-common": "^0.8.5", + "@backstage/plugin-scaffolder-backend": "^0.13.0", "@backstage/config": "^0.1.5", "@backstage/errors": "^0.1.1", - "@backstage/integration": "^0.5.6", + "@backstage/integration": "^0.5.8", "command-exists": "^1.2.9", "fs-extra": "^9.0.0" }, diff --git a/plugins/scaffolder-backend/CHANGELOG.md b/plugins/scaffolder-backend/CHANGELOG.md index 7d7f4e7dbe..5563bb0570 100644 --- a/plugins/scaffolder-backend/CHANGELOG.md +++ b/plugins/scaffolder-backend/CHANGELOG.md @@ -1,5 +1,106 @@ # @backstage/plugin-scaffolder-backend +## 0.13.0 + +### Minor Changes + +- 60e830222: Support for `Template` kinds with version `backstage.io/v1alpha1` has now been removed. This means that the old method of running templates with `Preparers`, `Templaters` and `Publishers` has also been removed. If you had any logic in these abstractions, they should now be moved to `actions` instead, and you can find out more about those in the [documentation](https://backstage.io/docs/features/software-templates/writing-custom-actions) + + If you need any help migrating existing templates, there's a [migration guide](https://backstage.io/docs/features/software-templates/migrating-from-v1alpha1-to-v1beta2). Reach out to us on Discord in the #support channel if you're having problems. + + The `scaffolder-backend` now no longer requires these `Preparers`, `Templaters`, and `Publishers` to be passed in, now all it needs is the `containerRunner`. + + Please update your `packages/backend/src/plugins/scaffolder.ts` like the following + + ```diff + - import { + - DockerContainerRunner, + - SingleHostDiscovery, + - } from '@backstage/backend-common'; + + import { DockerContainerRunner } from '@backstage/backend-common'; + import { CatalogClient } from '@backstage/catalog-client'; + - import { + - CookieCutter, + - CreateReactAppTemplater, + - createRouter, + - Preparers, + - Publishers, + - Templaters, + - } from '@backstage/plugin-scaffolder-backend'; + + import { createRouter } from '@backstage/plugin-scaffolder-backend'; + import Docker from 'dockerode'; + import { Router } from 'express'; + import type { PluginEnvironment } from '../types'; + + export default async function createPlugin({ + config, + database, + reader, + + discovery, + }: PluginEnvironment): Promise { + const dockerClient = new Docker(); + const containerRunner = new DockerContainerRunner({ dockerClient }); + + - const cookiecutterTemplater = new CookieCutter({ containerRunner }); + - const craTemplater = new CreateReactAppTemplater({ containerRunner }); + - const templaters = new Templaters(); + + - templaters.register('cookiecutter', cookiecutterTemplater); + - templaters.register('cra', craTemplater); + - + - const preparers = await Preparers.fromConfig(config, { logger }); + - const publishers = await Publishers.fromConfig(config, { logger }); + + - const discovery = SingleHostDiscovery.fromConfig(config); + const catalogClient = new CatalogClient({ discoveryApi: discovery }); + + return await createRouter({ + - preparers, + - templaters, + - publishers, + + containerRunner, + logger, + config, + database, + + ``` + +- 7cad18e2f: Adding `config: Config` as a required argument to `createBuiltinActions` and downstream methods in order to support configuration of the default git author used for Scaffolder commits. + + The affected methods are: + + - `createBuiltinActions` + - `createPublishGithubAction` + - `createPublishGitlabAction` + - `createPublishBitbucketAction` + - `createPublishAzureAction` + + Call sites to these methods will need to be migrated to include the new `config` argument. See `createRouter` in `plugins/scaffolder-backend/src/service/router.ts` for an example of adding this new argument. + + To configure the default git author, use the `defaultAuthor` key under `scaffolder` in `app-config.yaml`: + + ```yaml + scaffolder: + defaultAuthor: + name: Example + email: example@example.com + ``` + +### Patch Changes + +- dad481793: add default branch property for publish GitLab, Bitbucket and Azure actions +- 62c2f10f7: Added filesystem remove/rename built-in actions +- 6841e0113: fix minor version of git-url-parse as 11.5.x introduced a bug for Bitbucket Server +- 11e66e804: bump azure-devops-node to 10.2.2 +- 7a3ad92b5: Export the `fetchContents` from scaffolder-backend +- c2db794f5: add defaultBranch property for publish GitHub action +- 253136fba: removing mandatory of protection for the default branch, that could be handled by the GitHub automation in async manner, thus throwing floating errors +- Updated dependencies + - @backstage/integration@0.5.8 + - @backstage/catalog-model@0.9.0 + - @backstage/backend-common@0.8.5 + - @backstage/catalog-client@0.3.16 + ## 0.12.4 ### Patch Changes diff --git a/plugins/scaffolder-backend/package.json b/plugins/scaffolder-backend/package.json index e6709cdc80..16e66eb2e8 100644 --- a/plugins/scaffolder-backend/package.json +++ b/plugins/scaffolder-backend/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-scaffolder-backend", - "version": "0.12.4", + "version": "0.13.0", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -29,12 +29,12 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.8.4", - "@backstage/catalog-client": "^0.3.15", - "@backstage/catalog-model": "^0.8.4", + "@backstage/backend-common": "^0.8.5", + "@backstage/catalog-client": "^0.3.16", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.5", "@backstage/errors": "^0.1.1", - "@backstage/integration": "^0.5.7", + "@backstage/integration": "^0.5.8", "@gitbeaker/core": "^30.2.0", "@gitbeaker/node": "^30.2.0", "@octokit/rest": "^18.5.3", diff --git a/plugins/scaffolder/CHANGELOG.md b/plugins/scaffolder/CHANGELOG.md index 5a3231a133..53a2043456 100644 --- a/plugins/scaffolder/CHANGELOG.md +++ b/plugins/scaffolder/CHANGELOG.md @@ -1,5 +1,89 @@ # @backstage/plugin-scaffolder +## 0.10.0 + +### Minor Changes + +- 60e830222: Support for `Template` kinds with version `backstage.io/v1alpha1` has now been removed. This means that the old method of running templates with `Preparers`, `Templaters` and `Publishers` has also been removed. If you had any logic in these abstractions, they should now be moved to `actions` instead, and you can find out more about those in the [documentation](https://backstage.io/docs/features/software-templates/writing-custom-actions) + + If you need any help migrating existing templates, there's a [migration guide](https://backstage.io/docs/features/software-templates/migrating-from-v1alpha1-to-v1beta2). Reach out to us on Discord in the #support channel if you're having problems. + + The `scaffolder-backend` now no longer requires these `Preparers`, `Templaters`, and `Publishers` to be passed in, now all it needs is the `containerRunner`. + + Please update your `packages/backend/src/plugins/scaffolder.ts` like the following + + ```diff + - import { + - DockerContainerRunner, + - SingleHostDiscovery, + - } from '@backstage/backend-common'; + + import { DockerContainerRunner } from '@backstage/backend-common'; + import { CatalogClient } from '@backstage/catalog-client'; + - import { + - CookieCutter, + - CreateReactAppTemplater, + - createRouter, + - Preparers, + - Publishers, + - Templaters, + - } from '@backstage/plugin-scaffolder-backend'; + + import { createRouter } from '@backstage/plugin-scaffolder-backend'; + import Docker from 'dockerode'; + import { Router } from 'express'; + import type { PluginEnvironment } from '../types'; + + export default async function createPlugin({ + config, + database, + reader, + + discovery, + }: PluginEnvironment): Promise { + const dockerClient = new Docker(); + const containerRunner = new DockerContainerRunner({ dockerClient }); + + - const cookiecutterTemplater = new CookieCutter({ containerRunner }); + - const craTemplater = new CreateReactAppTemplater({ containerRunner }); + - const templaters = new Templaters(); + + - templaters.register('cookiecutter', cookiecutterTemplater); + - templaters.register('cra', craTemplater); + - + - const preparers = await Preparers.fromConfig(config, { logger }); + - const publishers = await Publishers.fromConfig(config, { logger }); + + - const discovery = SingleHostDiscovery.fromConfig(config); + const catalogClient = new CatalogClient({ discoveryApi: discovery }); + + return await createRouter({ + - preparers, + - templaters, + - publishers, + + containerRunner, + logger, + config, + database, + + ``` + +### Patch Changes + +- 02b962394: Added a `context` parameter to validator functions, letting them have access to + the API holder. + + If you have implemented custom validators and use `createScaffolderFieldExtension`, + your `validation` function can now optionally accept a third parameter, + `context: { apiHolder: ApiHolder }`. + +- 6841e0113: fix minor version of git-url-parse as 11.5.x introduced a bug for Bitbucket Server +- 0adfae5c8: add support for uiSchema on dependent form fields +- bd764f78a: Pass through the `idToken` in `Authorization` Header for `listActions` request +- Updated dependencies + - @backstage/integration@0.5.8 + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/catalog-client@0.3.16 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.9.10 ### Patch Changes diff --git a/plugins/scaffolder/package.json b/plugins/scaffolder/package.json index d4ccd08673..7694bff1ae 100644 --- a/plugins/scaffolder/package.json +++ b/plugins/scaffolder/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-scaffolder", - "version": "0.9.10", + "version": "0.10.0", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,15 +30,15 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-client": "^0.3.15", - "@backstage/catalog-model": "^0.8.4", + "@backstage/catalog-client": "^0.3.16", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.5", - "@backstage/core-components": "^0.1.4", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/errors": "^0.1.1", - "@backstage/integration": "^0.5.7", + "@backstage/integration": "^0.5.8", "@backstage/integration-react": "^0.1.4", - "@backstage/plugin-catalog-react": "^0.2.5", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -64,7 +64,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/search-backend-node/CHANGELOG.md b/plugins/search-backend-node/CHANGELOG.md index 9973191a24..1a231c252e 100644 --- a/plugins/search-backend-node/CHANGELOG.md +++ b/plugins/search-backend-node/CHANGELOG.md @@ -1,5 +1,26 @@ # @backstage/plugin-search-backend-node +## 0.3.0 + +### Minor Changes + +- 9f3ecb555: Build search queries using the query builder in `LunrSearchEngine`. This removes + the support for specifying custom queries with the lunr query syntax, but makes + sure that inputs are properly escaped. Supporting the full lunr syntax is still + possible by setting a custom query translator. + The interface of `LunrSearchEngine.setTranslator()` is changed to support + building lunr queries. + +### Patch Changes + +- 9f3ecb555: Enhance the search results of `LunrSearchEngine` to support a more natural + search experience. This is done by allowing typos (by using fuzzy search) and + supporting typeahead search (using wildcard queries to match incomplete words). +- 4176a60e5: Change search scheduler from starting indexing in a fixed interval (for example + every 60 seconds), to wait a fixed time between index runs. + This makes sure that no second index process for the same document type is + started when the previous one is still running. + ## 0.2.2 ### Patch Changes diff --git a/plugins/search-backend-node/package.json b/plugins/search-backend-node/package.json index c8a8eef143..f889c10188 100644 --- a/plugins/search-backend-node/package.json +++ b/plugins/search-backend-node/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-search-backend-node", - "version": "0.2.2", + "version": "0.3.0", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -25,7 +25,7 @@ "@types/lunr": "^2.3.3" }, "devDependencies": { - "@backstage/backend-common": "^0.8.3", + "@backstage/backend-common": "^0.8.5", "@backstage/cli": "^0.7.2" }, "files": [ diff --git a/plugins/search-backend/CHANGELOG.md b/plugins/search-backend/CHANGELOG.md index 47188017dc..678bcc8169 100644 --- a/plugins/search-backend/CHANGELOG.md +++ b/plugins/search-backend/CHANGELOG.md @@ -1,5 +1,13 @@ # @backstage/plugin-search-backend +## 0.2.2 + +### Patch Changes + +- Updated dependencies + - @backstage/backend-common@0.8.5 + - @backstage/plugin-search-backend-node@0.3.0 + ## 0.2.1 ### Patch Changes diff --git a/plugins/search-backend/package.json b/plugins/search-backend/package.json index 48729e88d9..d7e163198f 100644 --- a/plugins/search-backend/package.json +++ b/plugins/search-backend/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-search-backend", - "version": "0.2.1", + "version": "0.2.2", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -19,9 +19,9 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.8.3", + "@backstage/backend-common": "^0.8.5", "@backstage/search-common": "^0.1.2", - "@backstage/plugin-search-backend-node": "^0.2.1", + "@backstage/plugin-search-backend-node": "^0.3.0", "@types/express": "^4.17.6", "express": "^4.17.1", "express-promise-router": "^4.1.0", diff --git a/plugins/search/CHANGELOG.md b/plugins/search/CHANGELOG.md index 3292afa2d8..18fe34c720 100644 --- a/plugins/search/CHANGELOG.md +++ b/plugins/search/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/plugin-search +## 0.4.2 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.4.1 ### Patch Changes diff --git a/plugins/search/package.json b/plugins/search/package.json index fba0b2ab3b..c40885e357 100644 --- a/plugins/search/package.json +++ b/plugins/search/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-search", - "version": "0.4.1", + "version": "0.4.2", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -29,11 +29,11 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.5", - "@backstage/core-components": "^0.1.4", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/search-common": "^0.1.2", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", @@ -50,7 +50,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/sentry/CHANGELOG.md b/plugins/sentry/CHANGELOG.md index b51632b812..5153be2b93 100644 --- a/plugins/sentry/CHANGELOG.md +++ b/plugins/sentry/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/plugin-sentry +## 0.3.14 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.3.13 ### Patch Changes diff --git a/plugins/sentry/package.json b/plugins/sentry/package.json index e577cf385d..4d670a8a7f 100644 --- a/plugins/sentry/package.json +++ b/plugins/sentry/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-sentry", - "version": "0.3.13", + "version": "0.3.14", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,10 +31,10 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -49,7 +49,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/shortcuts/package.json b/plugins/shortcuts/package.json index 4a0b8f3eea..1dbbbb1a18 100644 --- a/plugins/shortcuts/package.json +++ b/plugins/shortcuts/package.json @@ -20,7 +20,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core-components": "^0.1.4", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", @@ -38,7 +38,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/sonarqube/CHANGELOG.md b/plugins/sonarqube/CHANGELOG.md index 8df5372fa9..390d8e4a68 100644 --- a/plugins/sonarqube/CHANGELOG.md +++ b/plugins/sonarqube/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/plugin-sonarqube +## 0.1.21 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.1.20 ### Patch Changes diff --git a/plugins/sonarqube/package.json b/plugins/sonarqube/package.json index c71b3e9177..3d120abf49 100644 --- a/plugins/sonarqube/package.json +++ b/plugins/sonarqube/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-sonarqube", - "version": "0.1.20", + "version": "0.1.21", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -32,10 +32,10 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -50,7 +50,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/splunk-on-call/CHANGELOG.md b/plugins/splunk-on-call/CHANGELOG.md index 037be680c9..a3a60c1b9d 100644 --- a/plugins/splunk-on-call/CHANGELOG.md +++ b/plugins/splunk-on-call/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/plugin-splunk-on-call +## 0.3.4 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.3.3 ### Patch Changes diff --git a/plugins/splunk-on-call/package.json b/plugins/splunk-on-call/package.json index 6fbbba61f3..b553c4510d 100644 --- a/plugins/splunk-on-call/package.json +++ b/plugins/splunk-on-call/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-splunk-on-call", - "version": "0.3.3", + "version": "0.3.4", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,10 +30,10 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -48,7 +48,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/tech-radar/package.json b/plugins/tech-radar/package.json index 3ad8d3020f..b6e9ccacc8 100644 --- a/plugins/tech-radar/package.json +++ b/plugins/tech-radar/package.json @@ -30,7 +30,7 @@ "start": "backstage-cli plugin:serve" }, "dependencies": { - "@backstage/core-components": "^0.1.4", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", @@ -46,7 +46,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/techdocs-backend/CHANGELOG.md b/plugins/techdocs-backend/CHANGELOG.md index 5f63c1b31d..c6dc26cb63 100644 --- a/plugins/techdocs-backend/CHANGELOG.md +++ b/plugins/techdocs-backend/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/plugin-techdocs-backend +## 0.8.6 + +### Patch Changes + +- Updated dependencies + - @backstage/catalog-model@0.9.0 + - @backstage/techdocs-common@0.6.7 + - @backstage/backend-common@0.8.5 + ## 0.8.5 ### Patch Changes diff --git a/plugins/techdocs-backend/package.json b/plugins/techdocs-backend/package.json index 0f0752a0c2..24d7694fe0 100644 --- a/plugins/techdocs-backend/package.json +++ b/plugins/techdocs-backend/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-techdocs-backend", - "version": "0.8.5", + "version": "0.8.6", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,11 +30,11 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.8.4", - "@backstage/catalog-model": "^0.8.4", + "@backstage/backend-common": "^0.8.5", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.5", "@backstage/errors": "^0.1.1", - "@backstage/techdocs-common": "^0.6.6", + "@backstage/techdocs-common": "^0.6.7", "@types/express": "^4.17.6", "cross-fetch": "^3.0.6", "dockerode": "^3.2.1", diff --git a/plugins/techdocs/CHANGELOG.md b/plugins/techdocs/CHANGELOG.md index 9e93c3a251..d0419ffd58 100644 --- a/plugins/techdocs/CHANGELOG.md +++ b/plugins/techdocs/CHANGELOG.md @@ -1,5 +1,16 @@ # @backstage/plugin-techdocs +## 0.9.9 + +### Patch Changes + +- 0172d3424: Fixed bug preventing scroll bar from showing up on code blocks in a TechDocs site. +- Updated dependencies + - @backstage/integration@0.5.8 + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.9.8 ### Patch Changes diff --git a/plugins/techdocs/package.json b/plugins/techdocs/package.json index 1a5abc6fbf..3b348873aa 100644 --- a/plugins/techdocs/package.json +++ b/plugins/techdocs/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-techdocs", - "version": "0.9.8", + "version": "0.9.9", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,14 +31,14 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.5", - "@backstage/core-components": "^0.1.4", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/errors": "^0.1.1", - "@backstage/integration": "^0.5.7", + "@backstage/integration": "^0.5.8", "@backstage/integration-react": "^0.1.4", - "@backstage/plugin-catalog-react": "^0.2.5", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -54,7 +54,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/todo-backend/CHANGELOG.md b/plugins/todo-backend/CHANGELOG.md index a295ad777c..cc69ae6c3d 100644 --- a/plugins/todo-backend/CHANGELOG.md +++ b/plugins/todo-backend/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-todo-backend +## 0.1.8 + +### Patch Changes + +- Updated dependencies + - @backstage/integration@0.5.8 + - @backstage/catalog-model@0.9.0 + - @backstage/backend-common@0.8.5 + - @backstage/catalog-client@0.3.16 + ## 0.1.7 ### Patch Changes diff --git a/plugins/todo-backend/package.json b/plugins/todo-backend/package.json index 3e2c87a5eb..61e84f8377 100644 --- a/plugins/todo-backend/package.json +++ b/plugins/todo-backend/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-todo-backend", - "version": "0.1.7", + "version": "0.1.8", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -24,12 +24,12 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.8.3", - "@backstage/catalog-client": "^0.3.13", - "@backstage/catalog-model": "^0.8.3", + "@backstage/backend-common": "^0.8.5", + "@backstage/catalog-client": "^0.3.16", + "@backstage/catalog-model": "^0.9.0", "@backstage/config": "^0.1.5", "@backstage/errors": "^0.1.1", - "@backstage/integration": "^0.5.6", + "@backstage/integration": "^0.5.8", "@types/express": "^4.17.6", "cross-fetch": "^3.0.6", "express": "^4.17.1", diff --git a/plugins/todo/CHANGELOG.md b/plugins/todo/CHANGELOG.md index d9b5ac52d1..e8a079880d 100644 --- a/plugins/todo/CHANGELOG.md +++ b/plugins/todo/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/plugin-todo +## 0.1.4 + +### Patch Changes + +- Updated dependencies + - @backstage/core-components@0.1.5 + - @backstage/catalog-model@0.9.0 + - @backstage/plugin-catalog-react@0.2.6 + ## 0.1.3 ### Patch Changes diff --git a/plugins/todo/package.json b/plugins/todo/package.json index d4a18a07b9..df719ef10e 100644 --- a/plugins/todo/package.json +++ b/plugins/todo/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-todo", - "version": "0.1.3", + "version": "0.1.4", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -26,11 +26,11 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.8.4", - "@backstage/core-components": "^0.1.4", + "@backstage/catalog-model": "^0.9.0", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/errors": "^0.1.1", - "@backstage/plugin-catalog-react": "^0.2.4", + "@backstage/plugin-catalog-react": "^0.2.6", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -42,7 +42,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/user-settings/package.json b/plugins/user-settings/package.json index 7a691594a4..941116b0bb 100644 --- a/plugins/user-settings/package.json +++ b/plugins/user-settings/package.json @@ -30,7 +30,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core-components": "^0.1.4", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", @@ -45,7 +45,7 @@ "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", "@backstage/core-plugin-api": "^0.1.3", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/plugins/welcome/package.json b/plugins/welcome/package.json index 311498ba49..a04d3cf9dd 100644 --- a/plugins/welcome/package.json +++ b/plugins/welcome/package.json @@ -30,7 +30,7 @@ "start": "backstage-cli plugin:serve" }, "dependencies": { - "@backstage/core-components": "^0.1.4", + "@backstage/core-components": "^0.1.5", "@backstage/core-plugin-api": "^0.1.3", "@backstage/theme": "^0.2.8", "@material-ui/core": "^4.11.0", @@ -44,7 +44,7 @@ "devDependencies": { "@backstage/cli": "^0.7.3", "@backstage/core-app-api": "^0.1.4", - "@backstage/dev-utils": "^0.2.0", + "@backstage/dev-utils": "^0.2.1", "@backstage/test-utils": "^0.1.14", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/yarn.lock b/yarn.lock index 37f7e691a7..14839a82f0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1360,6 +1360,19 @@ "@babel/helper-validator-identifier" "^7.14.0" to-fast-properties "^2.0.0" +"@backstage/catalog-model@^0.8.4": + version "0.9.0" + dependencies: + "@backstage/config" "^0.1.5" + "@backstage/errors" "^0.1.1" + "@types/json-schema" "^7.0.5" + "@types/yup" "^0.29.8" + ajv "^7.0.3" + json-schema "^0.3.0" + lodash "^4.17.15" + uuid "^8.0.0" + yup "^0.29.3" + "@backstage/core-api@^0.2.23": version "0.2.23" resolved "https://registry.npmjs.org/@backstage/core-api/-/core-api-0.2.23.tgz#c0ec13407ff7c78d376eb18e9d8e1490d54d995b" From e1f97de0531c081bd57e755950e8fc0ac1daf53b Mon Sep 17 00:00:00 2001 From: Iain Billett Date: Thu, 8 Jul 2021 15:02:26 +0100 Subject: [PATCH 157/168] Update plugins/catalog-backend/src/ingestion/processors/codeowners/resolve.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Signed-off-by: Iain Billett --- .../src/ingestion/processors/codeowners/resolve.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/catalog-backend/src/ingestion/processors/codeowners/resolve.ts b/plugins/catalog-backend/src/ingestion/processors/codeowners/resolve.ts index 0fe69fab97..00645f0c9d 100644 --- a/plugins/catalog-backend/src/ingestion/processors/codeowners/resolve.ts +++ b/plugins/catalog-backend/src/ingestion/processors/codeowners/resolve.ts @@ -42,7 +42,7 @@ export function normalizeCodeOwner(owner: string) { if (owner.match(GROUP_PATTERN)) { return owner.split('/')[1]; } else if (owner.match(USER_PATTERN)) { - return `user:${owner.substring(1)}`; + return `User:${owner.substring(1)}`; } else if (owner.match(EMAIL_PATTERN)) { return owner.split('@')[0]; } From fa6a5c025d9c384bdccd55267e32d1e0838b85da Mon Sep 17 00:00:00 2001 From: Iain Billett Date: Thu, 8 Jul 2021 15:47:19 +0100 Subject: [PATCH 158/168] Typo Signed-off-by: Iain Billett --- .../src/ingestion/processors/codeowners/resolve.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/catalog-backend/src/ingestion/processors/codeowners/resolve.test.ts b/plugins/catalog-backend/src/ingestion/processors/codeowners/resolve.test.ts index 9e1893e4b1..4e6c646073 100644 --- a/plugins/catalog-backend/src/ingestion/processors/codeowners/resolve.test.ts +++ b/plugins/catalog-backend/src/ingestion/processors/codeowners/resolve.test.ts @@ -29,7 +29,7 @@ describe('resolveCodeOwner', () => { describe('normalizeCodeOwner', () => { it('should remove the @ symbol', () => { - expect(normalizeCodeOwner('@yoda')).toBe('user:yoda'); + expect(normalizeCodeOwner('@yoda')).toBe('User:yoda'); }); it('should remove org from org/team format', () => { From dd696296255d8e232054b65054c90a9e6c538bfa Mon Sep 17 00:00:00 2001 From: Tim Hansen Date: Mon, 21 Jun 2021 11:28:09 -0600 Subject: [PATCH 159/168] Use query params with useEntityListProvider Signed-off-by: Tim Hansen --- .../EntityKindPicker/EntityKindPicker.tsx | 7 +++++-- plugins/catalog-react/src/filters.ts | 4 ++++ .../src/hooks/useEntityListProvider.tsx | 21 +++++++++++++++++++ plugins/catalog-react/src/types.ts | 7 +++++++ 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.tsx b/plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.tsx index 92831ea252..5b3f95b7ba 100644 --- a/plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.tsx +++ b/plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.tsx @@ -28,8 +28,11 @@ export const EntityKindPicker = ({ initialFilter, hidden, }: EntityKindFilterProps) => { - const [selectedKind] = useState(initialFilter); - const { updateFilters } = useEntityListProvider(); + const { updateFilters, queryParameters } = useEntityListProvider(); + const [selectedKind] = useState( + // TODO Cast here is not great 🤔 + (queryParameters.kind as string) ?? initialFilter, + ); useEffect(() => { updateFilters({ diff --git a/plugins/catalog-react/src/filters.ts b/plugins/catalog-react/src/filters.ts index 9b57e0f560..2b23031cc9 100644 --- a/plugins/catalog-react/src/filters.ts +++ b/plugins/catalog-react/src/filters.ts @@ -29,6 +29,10 @@ export class EntityKindFilter implements EntityFilter { getCatalogFilters(): Record { return { kind: this.value }; } + + toQueryValue(): string { + return this.value; + } } export class EntityTypeFilter implements EntityFilter { diff --git a/plugins/catalog-react/src/hooks/useEntityListProvider.tsx b/plugins/catalog-react/src/hooks/useEntityListProvider.tsx index 33c951acce..253184a851 100644 --- a/plugins/catalog-react/src/hooks/useEntityListProvider.tsx +++ b/plugins/catalog-react/src/hooks/useEntityListProvider.tsx @@ -77,6 +77,11 @@ export type EntityListContextProps< | ((prevFilters: EntityFilters) => Partial), ) => void; + /** + * Filter values from query parameters. + */ + queryParameters: Record; + loading: boolean; error?: Error; }; @@ -89,6 +94,7 @@ type OutputState = { appliedFilters: EntityFilters; entities: Entity[]; backendEntities: Entity[]; + queryParameters: Record; }; export const EntityListProvider = ({ @@ -102,6 +108,7 @@ export const EntityListProvider = ({ appliedFilters: {} as EntityFilters, entities: [], backendEntities: [], + queryParameters: {}, // TODO: Load (once!!) from query parameters }); // The main async filter worker. Note that while it has a lot of dependencies @@ -116,6 +123,15 @@ export const EntityListProvider = ({ compact(Object.values(outputState.appliedFilters)), ); + const queryParams = Object.keys(requestedFilters).reduce((params, key) => { + const filter: EntityFilter | undefined = + requestedFilters[key as keyof EntityFilters]; + if (filter?.toQueryValue) { + params[key] = filter.toQueryValue(); + } + return params; + }, {} as Record); + // TODO(mtlewis): currently entities will never be requested unless // there's at least one filter, we should allow an initial request // to happen with no filters. @@ -129,14 +145,18 @@ export const EntityListProvider = ({ appliedFilters: requestedFilters, backendEntities: response.items, entities: response.items.filter(entityFilter), + queryParameters: queryParams, }); } else { setOutputState({ appliedFilters: requestedFilters, backendEntities: outputState.backendEntities, entities: outputState.backendEntities.filter(entityFilter), + queryParameters: queryParams, }); } + + // TODO: write queryParams to query string }, [catalogApi, requestedFilters, outputState], { loading: true }, @@ -168,6 +188,7 @@ export const EntityListProvider = ({ entities: outputState.entities, backendEntities: outputState.backendEntities, updateFilters, + queryParameters: outputState.queryParameters, loading, error, }} diff --git a/plugins/catalog-react/src/types.ts b/plugins/catalog-react/src/types.ts index 68c11d7f38..4ac7644ee1 100644 --- a/plugins/catalog-react/src/types.ts +++ b/plugins/catalog-react/src/types.ts @@ -34,6 +34,13 @@ export type EntityFilter = { * @param env */ filterEntity?: (entity: Entity) => boolean; + + /** + * Serialize the filter value to a string for query params. The UI component responsible for + * handling this filter should retrieve this from useEntityListProvider.queryParameters. The + * value restored should be in the precedence: queryParameters > initialValue prop > default. + */ + toQueryValue?: () => string | string[]; }; export type UserListFilterKind = 'owned' | 'starred' | 'all'; From afe3e4b548a0986f6dda96ae57341812e1439303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20A=CC=8Ahsberg?= Date: Thu, 8 Jul 2021 16:21:20 +0000 Subject: [PATCH 160/168] Expose missing types used by the ldap transformers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathias Åhsberg --- .changeset/short-eggs-confess.md | 5 +++ .../catalog-backend-module-ldap/api-report.md | 45 +++++++++++++++++++ .../src/ldap/index.ts | 3 +- 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 .changeset/short-eggs-confess.md diff --git a/.changeset/short-eggs-confess.md b/.changeset/short-eggs-confess.md new file mode 100644 index 0000000000..3fa240a347 --- /dev/null +++ b/.changeset/short-eggs-confess.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend-module-ldap': patch +--- + +Expose missing types used by the custom transformers diff --git a/plugins/catalog-backend-module-ldap/api-report.md b/plugins/catalog-backend-module-ldap/api-report.md index 446dc2df52..82b07def03 100644 --- a/plugins/catalog-backend-module-ldap/api-report.md +++ b/plugins/catalog-backend-module-ldap/api-report.md @@ -22,6 +22,26 @@ export function defaultGroupTransformer(vendor: LdapVendor, config: GroupConfig, // @public (undocumented) export function defaultUserTransformer(vendor: LdapVendor, config: UserConfig, entry: SearchEntry): Promise; +// @public +export type GroupConfig = { + dn: string; + options: SearchOptions; + set?: { + [path: string]: JsonValue; + }; + map: { + rdn: string; + name: string; + description: string; + type: string; + displayName: string; + email?: string; + picture?: string; + memberOf: string; + members: string; + }; +}; + // @public export type GroupTransformer = (vendor: LdapVendor, config: GroupConfig, group: SearchEntry) => Promise; @@ -70,6 +90,13 @@ export type LdapProviderConfig = { groups: GroupConfig; }; +// @public +export type LdapVendor = { + dnAttributeName: string; + uuidAttributeName: string; + decodeStringAttribute: (entry: SearchEntry, name: string) => string[]; +}; + // @public export function mapStringAttr(entry: SearchEntry, vendor: LdapVendor, attributeName: string | undefined, setter: (value: string) => void): void; @@ -86,6 +113,24 @@ export function readLdapOrg(client: LdapClient, userConfig: UserConfig, groupCon groups: GroupEntity[]; }>; +// @public +export type UserConfig = { + dn: string; + options: SearchOptions; + set?: { + [path: string]: JsonValue; + }; + map: { + rdn: string; + name: string; + description?: string; + displayName: string; + email: string; + picture?: string; + memberOf: string; + }; +}; + // @public export type UserTransformer = (vendor: LdapVendor, config: UserConfig, user: SearchEntry) => Promise; diff --git a/plugins/catalog-backend-module-ldap/src/ldap/index.ts b/plugins/catalog-backend-module-ldap/src/ldap/index.ts index a9f127a3a7..70500299ae 100644 --- a/plugins/catalog-backend-module-ldap/src/ldap/index.ts +++ b/plugins/catalog-backend-module-ldap/src/ldap/index.ts @@ -17,7 +17,8 @@ export { LdapClient } from './client'; export { mapStringAttr } from './util'; export { readLdapConfig } from './config'; -export type { LdapProviderConfig } from './config'; +export type { LdapProviderConfig, GroupConfig, UserConfig } from './config'; +export type { LdapVendor } from './vendors'; export { LDAP_DN_ANNOTATION, LDAP_RDN_ANNOTATION, From 3129663cef869fb001464bcc8d6446dd1ed30bd8 Mon Sep 17 00:00:00 2001 From: Jeff Feng Date: Thu, 8 Jul 2021 13:18:21 -0400 Subject: [PATCH 161/168] Updated SVGs for core feature icons New SVG exports: Stroke width updated to 2.5px. Fixed the helm illustration in the K8s icon. Signed-off-by: Jeff Feng --- microsite/static/img/backstage-k8s.svg | 2 +- microsite/static/img/backstage-software-catalog.svg | 2 +- microsite/static/img/backstage-software-templates.svg | 2 +- microsite/static/img/backstage-techdocs.svg | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/microsite/static/img/backstage-k8s.svg b/microsite/static/img/backstage-k8s.svg index 9a6270f480..2796a396e7 100644 --- a/microsite/static/img/backstage-k8s.svg +++ b/microsite/static/img/backstage-k8s.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/microsite/static/img/backstage-software-catalog.svg b/microsite/static/img/backstage-software-catalog.svg index 188b52a43b..101439497b 100644 --- a/microsite/static/img/backstage-software-catalog.svg +++ b/microsite/static/img/backstage-software-catalog.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/microsite/static/img/backstage-software-templates.svg b/microsite/static/img/backstage-software-templates.svg index 41d51ff8e1..3984cd2870 100644 --- a/microsite/static/img/backstage-software-templates.svg +++ b/microsite/static/img/backstage-software-templates.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/microsite/static/img/backstage-techdocs.svg b/microsite/static/img/backstage-techdocs.svg index 48085df83c..aa9362b1bc 100644 --- a/microsite/static/img/backstage-techdocs.svg +++ b/microsite/static/img/backstage-techdocs.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file From 86e4920ee0a868ca49331f7357b13c94bf999a63 Mon Sep 17 00:00:00 2001 From: Tim Hansen Date: Thu, 8 Jul 2021 12:42:00 -0600 Subject: [PATCH 162/168] Add debugging instructions to backend README Signed-off-by: Tim Hansen --- packages/backend/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/backend/README.md b/packages/backend/README.md index 97890f72cb..cccd84afb8 100644 --- a/packages/backend/README.md +++ b/packages/backend/README.md @@ -39,6 +39,21 @@ You can also, instead of using dummy values for a huge number of environment var The backend starts up on port 7000 per default. +### Debugging + +The backend is a node process that can be inspected to allow breakpoints and live debugging. To enable this, pass the `--inspect` flag to [backend:dev](https://backstage.io/docs/cli/commands#backenddev). + +To debug the backend in [Visual Studio Code](https://code.visualstudio.com/): + +- Enable Auto Attach (⌘ + Shift + P > Toggle Auto Attach > Only With Flag) +- Open a VSCode terminal (Control + `) +- Run the backend from the VSCode terminal: + +``` +$ cd packages/backend +$ yarn backstage-cli backend:dev --inspect +``` + ## Populating The Catalog If you want to use the catalog functionality, you need to add so called From d84778c257b0b4ca1263cb9ada9d070d59d12e53 Mon Sep 17 00:00:00 2001 From: Phil Kuang Date: Tue, 6 Jul 2021 12:31:00 -0400 Subject: [PATCH 163/168] feat(EntityListProvider): store filter values in query params Signed-off-by: Phil Kuang --- .changeset/curly-badgers-sit.md | 5 ++ plugins/catalog-react/package.json | 1 + .../EntityKindPicker.test.tsx | 19 ++++++ .../EntityKindPicker/EntityKindPicker.tsx | 3 +- .../EntityLifecyclePicker.test.tsx | 29 ++++++++- .../EntityLifecyclePicker.tsx | 39 ++++++++---- .../EntityOwnerPicker.test.tsx | 29 ++++++++- .../EntityOwnerPicker/EntityOwnerPicker.tsx | 35 ++++++++--- .../EntityTagPicker/EntityTagPicker.test.tsx | 29 ++++++++- .../EntityTagPicker/EntityTagPicker.tsx | 33 +++++++--- .../EntityTypePicker/EntityTypePicker.tsx | 2 +- .../UserListPicker/UserListPicker.test.tsx | 18 ++++++ .../UserListPicker/UserListPicker.tsx | 19 ++++-- plugins/catalog-react/src/filters.ts | 20 ++++++ .../src/hooks/useEntityListProvider.test.tsx | 43 ++++++++++--- .../src/hooks/useEntityListProvider.tsx | 35 +++++++---- .../src/hooks/useEntityTypeFilter.tsx | 62 ++++++++++--------- .../catalog-react/src/testUtils/providers.tsx | 1 + 18 files changed, 330 insertions(+), 92 deletions(-) create mode 100644 .changeset/curly-badgers-sit.md diff --git a/.changeset/curly-badgers-sit.md b/.changeset/curly-badgers-sit.md new file mode 100644 index 0000000000..ca740e907a --- /dev/null +++ b/.changeset/curly-badgers-sit.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-react': patch +--- + +Store filter values set in `EntityListProvider` in query parameters. This allows selected filters to be restored when returning to pages that list catalog entities. diff --git a/plugins/catalog-react/package.json b/plugins/catalog-react/package.json index 99552cdb59..c65e06df29 100644 --- a/plugins/catalog-react/package.json +++ b/plugins/catalog-react/package.json @@ -39,6 +39,7 @@ "@material-ui/lab": "4.0.0-alpha.45", "@types/react": "^16.9", "lodash": "^4.17.15", + "qs": "^6.9.4", "react": "^16.13.1", "react-router": "6.0.0-beta.0", "react-router-dom": "6.0.0-beta.0", diff --git a/plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.test.tsx b/plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.test.tsx index 417b085cce..d6404fcf07 100644 --- a/plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.test.tsx +++ b/plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.test.tsx @@ -37,4 +37,23 @@ describe('', () => { kind: new EntityKindFilter('component'), }); }); + + it('respects the query parameter filter value', () => { + const updateFilters = jest.fn(); + const queryParameters = { kind: 'API' }; + render( + + , + ); + + expect(updateFilters).toHaveBeenLastCalledWith({ + kind: new EntityKindFilter('API'), + }); + }); }); diff --git a/plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.tsx b/plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.tsx index 5b3f95b7ba..6f9119c404 100644 --- a/plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.tsx +++ b/plugins/catalog-react/src/components/EntityKindPicker/EntityKindPicker.tsx @@ -30,8 +30,7 @@ export const EntityKindPicker = ({ }: EntityKindFilterProps) => { const { updateFilters, queryParameters } = useEntityListProvider(); const [selectedKind] = useState( - // TODO Cast here is not great 🤔 - (queryParameters.kind as string) ?? initialFilter, + [queryParameters.kind].flat()[0] ?? initialFilter, ); useEffect(() => { diff --git a/plugins/catalog-react/src/components/EntityLifecyclePicker/EntityLifecyclePicker.test.tsx b/plugins/catalog-react/src/components/EntityLifecyclePicker/EntityLifecyclePicker.test.tsx index 8fa0789c10..f7d915ef5b 100644 --- a/plugins/catalog-react/src/components/EntityLifecyclePicker/EntityLifecyclePicker.test.tsx +++ b/plugins/catalog-react/src/components/EntityLifecyclePicker/EntityLifecyclePicker.test.tsx @@ -91,6 +91,27 @@ describe('', () => { ]); }); + it('respects the query parameter filter value', () => { + const updateFilters = jest.fn(); + const queryParameters = { lifecycles: ['experimental'] }; + render( + + + , + ); + + expect(updateFilters).toHaveBeenLastCalledWith({ + lifecycles: new EntityLifecycleFilter(['experimental']), + }); + }); + it('adds lifecycles to filters', () => { const updateFilters = jest.fn(); const rendered = render( @@ -104,7 +125,9 @@ describe('', () => { , ); - expect(updateFilters).not.toHaveBeenCalled(); + expect(updateFilters).toHaveBeenLastCalledWith({ + lifecycles: undefined, + }); fireEvent.click(rendered.getByTestId('lifecycle-picker-expand')); fireEvent.click(rendered.getByText('production')); @@ -127,7 +150,9 @@ describe('', () => { , ); - expect(updateFilters).not.toHaveBeenCalled(); + expect(updateFilters).toHaveBeenLastCalledWith({ + lifecycles: new EntityLifecycleFilter(['production']), + }); fireEvent.click(rendered.getByTestId('lifecycle-picker-expand')); expect(rendered.getByLabelText('production')).toBeChecked(); diff --git a/plugins/catalog-react/src/components/EntityLifecyclePicker/EntityLifecyclePicker.tsx b/plugins/catalog-react/src/components/EntityLifecyclePicker/EntityLifecyclePicker.tsx index 31ab2911f7..9a899e161d 100644 --- a/plugins/catalog-react/src/components/EntityLifecyclePicker/EntityLifecyclePicker.tsx +++ b/plugins/catalog-react/src/components/EntityLifecyclePicker/EntityLifecyclePicker.tsx @@ -26,7 +26,7 @@ import CheckBoxIcon from '@material-ui/icons/CheckBox'; import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import { Autocomplete } from '@material-ui/lab'; -import React, { useMemo } from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import { useEntityListProvider } from '../../hooks/useEntityListProvider'; import { EntityLifecycleFilter } from '../../filters'; @@ -34,7 +34,30 @@ const icon = ; const checkedIcon = ; export const EntityLifecyclePicker = () => { - const { updateFilters, backendEntities, filters } = useEntityListProvider(); + const { + updateFilters, + backendEntities, + filters, + queryParameters, + } = useEntityListProvider(); + + const queryParamLifecycles = [queryParameters.lifecycles] + .flat() + .filter(Boolean) as string[]; + const [selectedLifecycles, setSelectedLifecycles] = useState( + queryParamLifecycles.length + ? queryParamLifecycles + : filters.lifecycles?.values ?? [], + ); + + useEffect(() => { + updateFilters({ + lifecycles: selectedLifecycles.length + ? new EntityLifecycleFilter(selectedLifecycles) + : undefined, + }); + }, [selectedLifecycles, updateFilters]); + const availableLifecycles = useMemo( () => [ @@ -49,22 +72,14 @@ export const EntityLifecyclePicker = () => { if (!availableLifecycles.length) return null; - const onChange = (lifecycles: string[]) => { - updateFilters({ - lifecycles: lifecycles.length - ? new EntityLifecycleFilter(lifecycles) - : undefined, - }); - }; - return ( Lifecycle multiple options={availableLifecycles} - value={filters.lifecycles?.values ?? []} - onChange={(_: object, value: string[]) => onChange(value)} + value={selectedLifecycles} + onChange={(_: object, value: string[]) => setSelectedLifecycles(value)} renderOption={(option, { selected }) => ( ', () => { ]); }); + it('respects the query parameter filter value', () => { + const updateFilters = jest.fn(); + const queryParameters = { owners: ['another-owner'] }; + render( + + + , + ); + + expect(updateFilters).toHaveBeenLastCalledWith({ + owners: new EntityOwnerFilter(['another-owner']), + }); + }); + it('adds owners to filters', () => { const updateFilters = jest.fn(); const rendered = render( @@ -134,7 +155,9 @@ describe('', () => { , ); - expect(updateFilters).not.toHaveBeenCalled(); + expect(updateFilters).toHaveBeenLastCalledWith({ + owners: undefined, + }); fireEvent.click(rendered.getByTestId('owner-picker-expand')); fireEvent.click(rendered.getByText('some-owner')); @@ -157,7 +180,9 @@ describe('', () => { , ); - expect(updateFilters).not.toHaveBeenCalled(); + expect(updateFilters).toHaveBeenLastCalledWith({ + owners: new EntityOwnerFilter(['some-owner']), + }); fireEvent.click(rendered.getByTestId('owner-picker-expand')); expect(rendered.getByLabelText('some-owner')).toBeChecked(); diff --git a/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.tsx b/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.tsx index 955f917c8c..90d94e32b5 100644 --- a/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.tsx +++ b/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.tsx @@ -26,7 +26,7 @@ import CheckBoxIcon from '@material-ui/icons/CheckBox'; import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import { Autocomplete } from '@material-ui/lab'; -import React, { useMemo } from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import { useEntityListProvider } from '../../hooks/useEntityListProvider'; import { EntityOwnerFilter } from '../../filters'; import { getEntityRelations } from '../../utils'; @@ -36,7 +36,28 @@ const icon = ; const checkedIcon = ; export const EntityOwnerPicker = () => { - const { updateFilters, backendEntities, filters } = useEntityListProvider(); + const { + updateFilters, + backendEntities, + filters, + queryParameters, + } = useEntityListProvider(); + + const queryParamOwners = [queryParameters.owners] + .flat() + .filter(Boolean) as string[]; + const [selectedOwners, setSelectedOwners] = useState( + queryParamOwners.length ? queryParamOwners : filters.owners?.values ?? [], + ); + + useEffect(() => { + updateFilters({ + owners: selectedOwners.length + ? new EntityOwnerFilter(selectedOwners) + : undefined, + }); + }, [selectedOwners, updateFilters]); + const availableOwners = useMemo( () => [ @@ -55,20 +76,14 @@ export const EntityOwnerPicker = () => { if (!availableOwners.length) return null; - const onChange = (owners: string[]) => { - updateFilters({ - owners: owners.length ? new EntityOwnerFilter(owners) : undefined, - }); - }; - return ( Owner multiple options={availableOwners} - value={filters.owners?.values ?? []} - onChange={(_: object, value: string[]) => onChange(value)} + value={selectedOwners} + onChange={(_: object, value: string[]) => setSelectedOwners(value)} renderOption={(option, { selected }) => ( ', () => { ]); }); + it('respects the query parameter filter value', () => { + const updateFilters = jest.fn(); + const queryParameters = { tags: ['tag3'] }; + render( + + + , + ); + + expect(updateFilters).toHaveBeenLastCalledWith({ + tags: new EntityTagFilter(['tag3']), + }); + }); + it('adds tags to filters', () => { const updateFilters = jest.fn(); const rendered = render( @@ -92,7 +113,9 @@ describe('', () => { , ); - expect(updateFilters).not.toHaveBeenCalled(); + expect(updateFilters).toHaveBeenLastCalledWith({ + tags: undefined, + }); fireEvent.click(rendered.getByTestId('tag-picker-expand')); fireEvent.click(rendered.getByText('tag1')); @@ -115,7 +138,9 @@ describe('', () => { , ); - expect(updateFilters).not.toHaveBeenCalled(); + expect(updateFilters).toHaveBeenLastCalledWith({ + tags: new EntityTagFilter(['tag1']), + }); fireEvent.click(rendered.getByTestId('tag-picker-expand')); expect(rendered.getByLabelText('tag1')).toBeChecked(); diff --git a/plugins/catalog-react/src/components/EntityTagPicker/EntityTagPicker.tsx b/plugins/catalog-react/src/components/EntityTagPicker/EntityTagPicker.tsx index 744ad447d8..b7fa8f1186 100644 --- a/plugins/catalog-react/src/components/EntityTagPicker/EntityTagPicker.tsx +++ b/plugins/catalog-react/src/components/EntityTagPicker/EntityTagPicker.tsx @@ -26,7 +26,7 @@ import CheckBoxIcon from '@material-ui/icons/CheckBox'; import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import { Autocomplete } from '@material-ui/lab'; -import React, { useMemo } from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import { useEntityListProvider } from '../../hooks/useEntityListProvider'; import { EntityTagFilter } from '../../filters'; @@ -34,7 +34,26 @@ const icon = ; const checkedIcon = ; export const EntityTagPicker = () => { - const { updateFilters, backendEntities, filters } = useEntityListProvider(); + const { + updateFilters, + backendEntities, + filters, + queryParameters, + } = useEntityListProvider(); + + const queryParamTags = [queryParameters.tags] + .flat() + .filter(Boolean) as string[]; + const [selectedTags, setSelectedTags] = useState( + queryParamTags.length ? queryParamTags : filters.tags?.values ?? [], + ); + + useEffect(() => { + updateFilters({ + tags: selectedTags.length ? new EntityTagFilter(selectedTags) : undefined, + }); + }, [selectedTags, updateFilters]); + const availableTags = useMemo( () => [ @@ -49,20 +68,14 @@ export const EntityTagPicker = () => { if (!availableTags.length) return null; - const onChange = (tags: string[]) => { - updateFilters({ - tags: tags.length ? new EntityTagFilter(tags) : undefined, - }); - }; - return ( Tags multiple options={availableTags} - value={filters.tags?.values ?? []} - onChange={(_: object, value: string[]) => onChange(value)} + value={selectedTags} + onChange={(_: object, value: string[]) => setSelectedTags(value)} renderOption={(option, { selected }) => ( {