From d3e9ec43b7218c1b27ecdededcefecf9cda83f1e Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Fri, 4 Mar 2022 10:00:50 +0100 Subject: [PATCH 1/7] catalog-model: Remove `target` from `EntityRelation` type. Signed-off-by: Johan Haals --- .changeset/weak-fans-sip.md | 127 ++++++++++++++++++ .changeset/yellow-shirts-study.md | 7 + packages/catalog-model/src/entity/Entity.ts | 8 -- .../ApisCards/ConsumedApisCard.test.tsx | 5 - .../components/ApisCards/HasApisCard.test.tsx | 5 - .../ApisCards/ProvidedApisCard.test.tsx | 5 - .../ConsumingComponentsCard.test.tsx | 5 - .../ProvidingComponentsCard.test.tsx | 5 - .../lib/catalog/CatalogIdentityClient.test.ts | 10 -- .../permissions/rules/isEntityOwner.test.ts | 10 -- .../src/service/DefaultEntitiesCatalog.ts | 27 +--- .../catalog-backend/src/stitching/Stitcher.ts | 3 - .../src/stitching/buildEntitySearch.test.ts | 4 - .../EntityRelationsGraph.test.tsx | 40 ------ .../useEntityRelationNodesAndEdges.test.ts | 40 ------ .../EntityOwnerPicker.test.tsx | 20 --- .../components/EntityTable/presets.test.tsx | 20 --- .../UserListPicker/UserListPicker.test.tsx | 2 - .../src/hooks/useEntityListProvider.test.tsx | 5 - .../src/hooks/useEntityOwnership.test.tsx | 2 - .../src/utils/getEntityRelations.test.ts | 2 - .../catalog-react/src/utils/isOwnerOf.test.ts | 3 - .../AboutCard/AboutContent.test.tsx | 65 --------- .../CatalogPage/DefaultCatalogPage.test.tsx | 1 - .../DependencyOfComponentsCard.test.tsx | 5 - .../DependsOnComponentsCard.test.tsx | 5 - .../DependsOnResourcesCard.test.tsx | 5 - .../HasComponentsCard.test.tsx | 5 - .../HasResourcesCard.test.tsx | 5 - .../HasSubcomponentsCard.test.tsx | 5 - .../HasSystemsCard/HasSystemsCard.test.tsx | 5 - .../SystemDiagramCard.test.tsx | 10 -- plugins/fossa/dev/index.tsx | 1 - .../MembersList/MembersListCard.test.tsx | 5 - .../OwnershipCard/OwnershipCard.test.tsx | 15 --- .../UserProfileCard/UserProfileCard.test.tsx | 5 - .../entityMetadataFactRetriever.test.ts | 1 - .../entityOwnershipFactRetriever.test.ts | 1 - .../techdocsFactRetriever.test.ts | 1 - .../home/components/Tables/DocsTable.test.tsx | 15 --- 40 files changed, 135 insertions(+), 375 deletions(-) create mode 100644 .changeset/weak-fans-sip.md create mode 100644 .changeset/yellow-shirts-study.md diff --git a/.changeset/weak-fans-sip.md b/.changeset/weak-fans-sip.md new file mode 100644 index 0000000000..2db4a40b79 --- /dev/null +++ b/.changeset/weak-fans-sip.md @@ -0,0 +1,127 @@ +--- +'@backstage/plugin-api-docs': patch +'@backstage/plugin-auth-backend': patch +'@backstage/plugin-catalog': patch +'@backstage/plugin-catalog-backend': patch +'@backstage/plugin-catalog-graph': patch +'@backstage/plugin-catalog-react': patch +'@backstage/plugin-fossa': patch +'@backstage/plugin-org': patch +'@backstage/plugin-tech-insights-backend': patch +'@backstage/plugin-techdocs': patch +'@backstage/app-defaults': patch +'@backstage/backend-common': patch +'@backstage/backend-tasks': patch +'@backstage/backend-test-utils': patch +'@backstage/catalog-client': patch +'@backstage/cli': patch +'@backstage/cli-common': patch +'@backstage/codemods': patch +'@backstage/config': patch +'@backstage/config-loader': patch +'@backstage/core-app-api': patch +'@backstage/core-components': patch +'@backstage/core-plugin-api': patch +'@backstage/create-app': patch +'@backstage/dev-utils': patch +'@backstage/errors': patch +'@backstage/integration': patch +'@backstage/integration-react': patch +'@backstage/release-manifests': patch +'@backstage/search-common': patch +'@techdocs/cli': patch +'techdocs-cli-embedded-app': patch +'@backstage/techdocs-common': patch +'@backstage/test-utils': patch +'@backstage/theme': patch +'@backstage/types': patch +'@backstage/version-bridge': patch +'@backstage/plugin-airbrake': patch +'@backstage/plugin-airbrake-backend': patch +'@backstage/plugin-allure': patch +'@backstage/plugin-analytics-module-ga': patch +'@backstage/plugin-apache-airflow': patch +'@backstage/plugin-app-backend': patch +'@backstage/plugin-auth-node': patch +'@backstage/plugin-azure-devops': patch +'@backstage/plugin-azure-devops-backend': patch +'@backstage/plugin-azure-devops-common': patch +'@backstage/plugin-badges': patch +'@backstage/plugin-badges-backend': patch +'@backstage/plugin-bazaar': patch +'@backstage/plugin-bazaar-backend': patch +'@backstage/plugin-bitrise': patch +'@backstage/plugin-catalog-backend-module-aws': patch +'@backstage/plugin-catalog-backend-module-ldap': patch +'@backstage/plugin-catalog-backend-module-msgraph': patch +'@backstage/plugin-catalog-common': patch +'@backstage/plugin-catalog-graphql': patch +'@backstage/plugin-catalog-import': patch +'@backstage/plugin-cicd-statistics': patch +'@backstage/plugin-circleci': patch +'@backstage/plugin-cloudbuild': patch +'@backstage/plugin-code-climate': patch +'@backstage/plugin-code-coverage': patch +'@backstage/plugin-code-coverage-backend': patch +'@backstage/plugin-config-schema': patch +'@backstage/plugin-cost-insights': patch +'@backstage/plugin-explore': patch +'@backstage/plugin-explore-react': patch +'@backstage/plugin-firehydrant': patch +'@backstage/plugin-gcp-projects': patch +'@backstage/plugin-git-release-manager': patch +'@backstage/plugin-github-actions': patch +'@backstage/plugin-github-deployments': patch +'@backstage/plugin-gitops-profiles': patch +'@backstage/plugin-gocd': patch +'@backstage/plugin-graphiql': patch +'@backstage/plugin-graphql-backend': patch +'@backstage/plugin-home': patch +'@backstage/plugin-ilert': patch +'@backstage/plugin-jenkins': patch +'@backstage/plugin-jenkins-backend': patch +'@backstage/plugin-jenkins-common': patch +'@backstage/plugin-kafka': patch +'@backstage/plugin-kafka-backend': patch +'@backstage/plugin-kubernetes': patch +'@backstage/plugin-kubernetes-backend': patch +'@backstage/plugin-kubernetes-common': patch +'@backstage/plugin-lighthouse': patch +'@backstage/plugin-newrelic': patch +'@backstage/plugin-newrelic-dashboard': patch +'@backstage/plugin-pagerduty': patch +'@backstage/plugin-permission-backend': patch +'@backstage/plugin-permission-common': patch +'@backstage/plugin-permission-node': patch +'@backstage/plugin-permission-react': patch +'@backstage/plugin-proxy-backend': patch +'@backstage/plugin-rollbar': patch +'@backstage/plugin-rollbar-backend': patch +'@backstage/plugin-scaffolder': patch +'@backstage/plugin-scaffolder-backend': patch +'@backstage/plugin-scaffolder-backend-module-cookiecutter': patch +'@backstage/plugin-scaffolder-backend-module-rails': patch +'@backstage/plugin-scaffolder-backend-module-yeoman': patch +'@backstage/plugin-scaffolder-common': patch +'@backstage/plugin-search': patch +'@backstage/plugin-search-backend': patch +'@backstage/plugin-search-backend-module-elasticsearch': patch +'@backstage/plugin-search-backend-module-pg': patch +'@backstage/plugin-search-backend-node': patch +'@backstage/plugin-sentry': patch +'@backstage/plugin-shortcuts': patch +'@backstage/plugin-sonarqube': patch +'@backstage/plugin-splunk-on-call': patch +'@backstage/plugin-tech-insights': patch +'@backstage/plugin-tech-insights-backend-module-jsonfc': patch +'@backstage/plugin-tech-insights-common': patch +'@backstage/plugin-tech-insights-node': patch +'@backstage/plugin-tech-radar': patch +'@backstage/plugin-techdocs-backend': patch +'@backstage/plugin-todo': patch +'@backstage/plugin-todo-backend': patch +'@backstage/plugin-user-settings': patch +'@backstage/plugin-xcmetrics': patch +--- + +Removed usage of `target` for `EntityRelation`s. diff --git a/.changeset/yellow-shirts-study.md b/.changeset/yellow-shirts-study.md new file mode 100644 index 0000000000..c7c812b71f --- /dev/null +++ b/.changeset/yellow-shirts-study.md @@ -0,0 +1,7 @@ +--- +'@backstage/catalog-model': minor +--- + +**BREAKING**: Removed the `target` property from `EntityRelation`, use `targetRef` instead. + +This means `target: { name: 'team-a', kind: 'group', namespace: 'default' }` is now replaced with `targetRef: 'group:default/team-a'` in entity relations. diff --git a/packages/catalog-model/src/entity/Entity.ts b/packages/catalog-model/src/entity/Entity.ts index 14cd01e40b..96f19b2c8a 100644 --- a/packages/catalog-model/src/entity/Entity.ts +++ b/packages/catalog-model/src/entity/Entity.ts @@ -15,7 +15,6 @@ */ import { JsonObject } from '@backstage/types'; -import { CompoundEntityRef } from '../types'; import { EntityStatus } from './EntityStatus'; /** @@ -185,13 +184,6 @@ export type EntityRelation = { */ type: string; - /** - * The target entity of this relation. - * - * @deprecated use targetRef instead - */ - target: CompoundEntityRef; - /** * The entity ref of the target of this relation. */ diff --git a/plugins/api-docs/src/components/ApisCards/ConsumedApisCard.test.tsx b/plugins/api-docs/src/components/ApisCards/ConsumedApisCard.test.tsx index f84f66cee8..afb836ecc9 100644 --- a/plugins/api-docs/src/components/ApisCards/ConsumedApisCard.test.tsx +++ b/plugins/api-docs/src/components/ApisCards/ConsumedApisCard.test.tsx @@ -94,11 +94,6 @@ describe('', () => { }, relations: [ { - target: { - kind: 'api', - namespace: 'my-namespace', - name: 'target-name', - }, targetRef: 'api:my-namespace/target-name', type: RELATION_CONSUMES_API, }, diff --git a/plugins/api-docs/src/components/ApisCards/HasApisCard.test.tsx b/plugins/api-docs/src/components/ApisCards/HasApisCard.test.tsx index daa909c7f8..85b353f04e 100644 --- a/plugins/api-docs/src/components/ApisCards/HasApisCard.test.tsx +++ b/plugins/api-docs/src/components/ApisCards/HasApisCard.test.tsx @@ -94,11 +94,6 @@ describe('', () => { }, relations: [ { - target: { - kind: 'api', - namespace: 'my-namespace', - name: 'target-name', - }, targetRef: 'api:my-namespace/target-name', type: RELATION_HAS_PART, }, diff --git a/plugins/api-docs/src/components/ApisCards/ProvidedApisCard.test.tsx b/plugins/api-docs/src/components/ApisCards/ProvidedApisCard.test.tsx index 852386140c..40ffeff330 100644 --- a/plugins/api-docs/src/components/ApisCards/ProvidedApisCard.test.tsx +++ b/plugins/api-docs/src/components/ApisCards/ProvidedApisCard.test.tsx @@ -94,11 +94,6 @@ describe('', () => { }, relations: [ { - target: { - kind: 'api', - namespace: 'my-namespace', - name: 'target-name', - }, targetRef: 'api:my-namespace/target-name', type: RELATION_PROVIDES_API, }, diff --git a/plugins/api-docs/src/components/ComponentsCards/ConsumingComponentsCard.test.tsx b/plugins/api-docs/src/components/ComponentsCards/ConsumingComponentsCard.test.tsx index a62b2119c7..abc91d8793 100644 --- a/plugins/api-docs/src/components/ComponentsCards/ConsumingComponentsCard.test.tsx +++ b/plugins/api-docs/src/components/ComponentsCards/ConsumingComponentsCard.test.tsx @@ -97,11 +97,6 @@ describe('', () => { }, relations: [ { - target: { - kind: 'component', - namespace: 'my-namespace', - name: 'target-name', - }, targetRef: 'component:my-namespace/target-name', type: RELATION_API_CONSUMED_BY, }, diff --git a/plugins/api-docs/src/components/ComponentsCards/ProvidingComponentsCard.test.tsx b/plugins/api-docs/src/components/ComponentsCards/ProvidingComponentsCard.test.tsx index 1a0aae12c7..bdd45c3d58 100644 --- a/plugins/api-docs/src/components/ComponentsCards/ProvidingComponentsCard.test.tsx +++ b/plugins/api-docs/src/components/ComponentsCards/ProvidingComponentsCard.test.tsx @@ -97,11 +97,6 @@ describe('', () => { }, relations: [ { - target: { - kind: 'component', - namespace: 'my-namespace', - name: 'target-name', - }, targetRef: 'component:my-namespace/target-name', type: RELATION_API_PROVIDED_BY, }, diff --git a/plugins/auth-backend/src/lib/catalog/CatalogIdentityClient.test.ts b/plugins/auth-backend/src/lib/catalog/CatalogIdentityClient.test.ts index b99c8a7615..587b433ca1 100644 --- a/plugins/auth-backend/src/lib/catalog/CatalogIdentityClient.test.ts +++ b/plugins/auth-backend/src/lib/catalog/CatalogIdentityClient.test.ts @@ -80,11 +80,6 @@ describe('CatalogIdentityClient', () => { { type: RELATION_MEMBER_OF, targetRef: 'group:default/team-a', - target: { - kind: 'group', - namespace: 'default', - name: 'team-a', - }, }, ], }, @@ -102,11 +97,6 @@ describe('CatalogIdentityClient', () => { { type: RELATION_MEMBER_OF, targetRef: 'group:reality/screen-actors-guild', - target: { - kind: 'group', - namespace: 'reality', - name: 'screen-actors-guild', - }, }, ], }, diff --git a/plugins/catalog-backend/src/permissions/rules/isEntityOwner.test.ts b/plugins/catalog-backend/src/permissions/rules/isEntityOwner.test.ts index 8e20655393..11304c768c 100644 --- a/plugins/catalog-backend/src/permissions/rules/isEntityOwner.test.ts +++ b/plugins/catalog-backend/src/permissions/rules/isEntityOwner.test.ts @@ -30,11 +30,6 @@ describe('isEntityOwner', () => { { type: 'ownedBy', targetRef: 'user:default/spiderman', - target: { - kind: 'user', - namespace: 'default', - name: 'spiderman', - }, }, ], }; @@ -54,11 +49,6 @@ describe('isEntityOwner', () => { { type: 'ownedBy', targetRef: 'user:default/green-goblin', - target: { - kind: 'user', - namespace: 'default', - name: 'green-goblin', - }, }, ], }; diff --git a/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts b/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts index f8b68bebc5..31f98c9f0c 100644 --- a/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts +++ b/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts @@ -14,11 +14,7 @@ * limitations under the License. */ -import { - Entity, - parseEntityRef, - stringifyEntityRef, -} from '@backstage/catalog-model'; +import { Entity, stringifyEntityRef } from '@backstage/catalog-model'; import { InputError, NotFoundError } from '@backstage/errors'; import { Knex } from 'knex'; import lodash from 'lodash'; @@ -204,27 +200,6 @@ export class DefaultEntitiesCatalog implements EntitiesCatalog { entities = entities.map(e => request.fields!(e)); } - // TODO(freben): This is added as a compatibility guarantee, until we can be - // sure that all adopters have re-stitched their entities so that the new - // targetRef field is present on them, and that they have stopped consuming - // the now-removed old field - for (const entity of entities) { - if (entity.relations) { - for (const relation of entity.relations) { - if (!relation.targetRef && relation.target) { - // This is the case where an old-form entity, not yet stitched with - // the updated code, was in the database - relation.targetRef = stringifyEntityRef(relation.target); - } else if (!relation.target && relation.targetRef) { - // This is the case where a new-form entity, stitched with the - // updated code, was in the database but we still want to produce - // the old data shape as well for compatibility reasons - relation.target = parseEntityRef(relation.targetRef); - } - } - } - } - return { entities, pageInfo, diff --git a/plugins/catalog-backend/src/stitching/Stitcher.ts b/plugins/catalog-backend/src/stitching/Stitcher.ts index 23fdffd272..c31052c01e 100644 --- a/plugins/catalog-backend/src/stitching/Stitcher.ts +++ b/plugins/catalog-backend/src/stitching/Stitcher.ts @@ -17,7 +17,6 @@ import { ENTITY_STATUS_CATALOG_PROCESSING_TYPE } from '@backstage/catalog-client'; import { AlphaEntity, - parseEntityRef, EntityRelation, EntityStatusItem, } from '@backstage/catalog-model'; @@ -186,8 +185,6 @@ export class Stitcher { .filter(row => row.relationType /* exclude null row, if relevant */) .map(row => ({ type: row.relationType!, - // TODO(freben): This field is deprecated and should be removed in a future release - target: parseEntityRef(row.relationTarget!), targetRef: row.relationTarget!, })); if (statusItems.length) { diff --git a/plugins/catalog-backend/src/stitching/buildEntitySearch.test.ts b/plugins/catalog-backend/src/stitching/buildEntitySearch.test.ts index 27b4421a83..e18f1c0c48 100644 --- a/plugins/catalog-backend/src/stitching/buildEntitySearch.test.ts +++ b/plugins/catalog-backend/src/stitching/buildEntitySearch.test.ts @@ -143,12 +143,10 @@ describe('buildEntitySearch', () => { { type: 't1', targetRef: 'k:ns/a', - target: { kind: 'k', namespace: 'ns', name: 'a' }, }, { type: 't2', targetRef: 'k:ns/b', - target: { kind: 'k', namespace: 'ns', name: 'b' }, }, ], apiVersion: 'a', @@ -192,12 +190,10 @@ describe('buildEntitySearch', () => { { type: 'dup', targetRef: 'k:ns/a', - target: { kind: 'k', namespace: 'ns', name: 'a' }, }, { type: 'DUP', targetRef: 'k:ns/b', - target: { kind: 'k', namespace: 'ns', name: 'b' }, }, ], apiVersion: 'a', diff --git a/plugins/catalog-graph/src/components/EntityRelationsGraph/EntityRelationsGraph.test.tsx b/plugins/catalog-graph/src/components/EntityRelationsGraph/EntityRelationsGraph.test.tsx index e8c9239739..2bf303bb92 100644 --- a/plugins/catalog-graph/src/components/EntityRelationsGraph/EntityRelationsGraph.test.tsx +++ b/plugins/catalog-graph/src/components/EntityRelationsGraph/EntityRelationsGraph.test.tsx @@ -49,20 +49,10 @@ describe('', () => { }, relations: [ { - target: { - kind: 'k', - name: 'a1', - namespace: 'd', - }, targetRef: 'k:d/a1', type: RELATION_OWNER_OF, }, { - target: { - kind: 'b', - name: 'c1', - namespace: 'd', - }, targetRef: 'b:d/c1', type: RELATION_HAS_PART, }, @@ -77,20 +67,10 @@ describe('', () => { }, relations: [ { - target: { - kind: 'b', - name: 'c', - namespace: 'd', - }, targetRef: 'b:d/c', type: RELATION_OWNED_BY, }, { - target: { - kind: 'b', - name: 'c1', - namespace: 'd', - }, targetRef: 'b:d/c1', type: RELATION_OWNED_BY, }, @@ -105,29 +85,14 @@ describe('', () => { }, relations: [ { - target: { - kind: 'b', - name: 'c', - namespace: 'd', - }, targetRef: 'b:d/c', type: RELATION_PART_OF, }, { - target: { - kind: 'k', - name: 'a1', - namespace: 'd', - }, targetRef: 'k:d/a1', type: RELATION_OWNER_OF, }, { - target: { - kind: 'b', - name: 'c2', - namespace: 'd', - }, targetRef: 'b:d/c2', type: RELATION_HAS_PART, }, @@ -142,11 +107,6 @@ describe('', () => { }, relations: [ { - target: { - kind: 'b', - name: 'c1', - namespace: 'd', - }, targetRef: 'b:d/c1', type: RELATION_PART_OF, }, diff --git a/plugins/catalog-graph/src/components/EntityRelationsGraph/useEntityRelationNodesAndEdges.test.ts b/plugins/catalog-graph/src/components/EntityRelationsGraph/useEntityRelationNodesAndEdges.test.ts index 4715cb106a..c2ee918e5b 100644 --- a/plugins/catalog-graph/src/components/EntityRelationsGraph/useEntityRelationNodesAndEdges.test.ts +++ b/plugins/catalog-graph/src/components/EntityRelationsGraph/useEntityRelationNodesAndEdges.test.ts @@ -44,20 +44,10 @@ describe('useEntityRelationNodesAndEdges', () => { }, relations: [ { - target: { - kind: 'k', - name: 'a1', - namespace: 'd', - }, targetRef: 'k:d/a1', type: RELATION_OWNER_OF, }, { - target: { - kind: 'b', - name: 'c1', - namespace: 'd', - }, targetRef: 'b:d/c1', type: RELATION_HAS_PART, }, @@ -72,20 +62,10 @@ describe('useEntityRelationNodesAndEdges', () => { }, relations: [ { - target: { - kind: 'b', - name: 'c', - namespace: 'd', - }, targetRef: 'b:d/c', type: RELATION_OWNED_BY, }, { - target: { - kind: 'b', - name: 'c1', - namespace: 'd', - }, targetRef: 'b:d/c1', type: RELATION_OWNED_BY, }, @@ -100,29 +80,14 @@ describe('useEntityRelationNodesAndEdges', () => { }, relations: [ { - target: { - kind: 'b', - name: 'c', - namespace: 'd', - }, targetRef: 'b:d/c', type: RELATION_PART_OF, }, { - target: { - kind: 'k', - name: 'a1', - namespace: 'd', - }, targetRef: 'k:d/a1', type: RELATION_OWNER_OF, }, { - target: { - kind: 'b', - name: 'c2', - namespace: 'd', - }, targetRef: 'b:d/c2', type: RELATION_HAS_PART, }, @@ -137,11 +102,6 @@ describe('useEntityRelationNodesAndEdges', () => { }, relations: [ { - target: { - kind: 'b', - name: 'c1', - namespace: 'd', - }, targetRef: 'b:d/c1', type: RELATION_PART_OF, }, diff --git a/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.test.tsx b/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.test.tsx index de21bfeee3..f648b51456 100644 --- a/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.test.tsx +++ b/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.test.tsx @@ -32,20 +32,10 @@ const sampleEntities: Entity[] = [ { type: 'ownedBy', targetRef: 'group:default/some-owner', - target: { - name: 'some-owner', - namespace: 'default', - kind: 'Group', - }, }, { type: 'ownedBy', targetRef: 'group:default/some-owner-2', - target: { - name: 'some-owner-2', - namespace: 'default', - kind: 'Group', - }, }, ], }, @@ -59,11 +49,6 @@ const sampleEntities: Entity[] = [ { type: 'ownedBy', targetRef: 'group:default/another-owner', - target: { - name: 'another-owner', - namespace: 'default', - kind: 'Group', - }, }, ], }, @@ -77,11 +62,6 @@ const sampleEntities: Entity[] = [ { type: 'ownedBy', targetRef: 'group:default/some-owner', - target: { - name: 'some-owner', - namespace: 'default', - kind: 'Group', - }, }, ], }, diff --git a/plugins/catalog-react/src/components/EntityTable/presets.test.tsx b/plugins/catalog-react/src/components/EntityTable/presets.test.tsx index f2fcd016f0..cca9c7d494 100644 --- a/plugins/catalog-react/src/components/EntityTable/presets.test.tsx +++ b/plugins/catalog-react/src/components/EntityTable/presets.test.tsx @@ -45,20 +45,10 @@ describe('systemEntityColumns', () => { { type: RELATION_PART_OF, targetRef: 'domain:my-namespace/my-domain', - target: { - kind: 'domain', - name: 'my-domain', - namespace: 'my-namespace', - }, }, { type: RELATION_OWNED_BY, targetRef: 'group:default/test', - target: { - kind: 'group', - name: 'test', - namespace: 'default', - }, }, ], }, @@ -107,20 +97,10 @@ describe('componentEntityColumns', () => { { type: RELATION_PART_OF, targetRef: 'system:my-namespace/my-system', - target: { - kind: 'system', - name: 'my-system', - namespace: 'my-namespace', - }, }, { type: RELATION_OWNED_BY, targetRef: 'group:default/test', - target: { - kind: 'group', - name: 'test', - namespace: 'default', - }, }, ], }, diff --git a/plugins/catalog-react/src/components/UserListPicker/UserListPicker.test.tsx b/plugins/catalog-react/src/components/UserListPicker/UserListPicker.test.tsx index 310deabbb7..db3ce7cf5d 100644 --- a/plugins/catalog-react/src/components/UserListPicker/UserListPicker.test.tsx +++ b/plugins/catalog-react/src/components/UserListPicker/UserListPicker.test.tsx @@ -104,7 +104,6 @@ const backendEntities: Entity[] = [ { type: RELATION_OWNED_BY, targetRef: 'user:default/testuser', - target: { kind: 'User', namespace: 'default', name: 'testUser' }, }, ], }, @@ -138,7 +137,6 @@ const backendEntities: Entity[] = [ { type: RELATION_OWNED_BY, targetRef: 'user:default/testuser', - target: { kind: 'User', namespace: 'default', name: 'testUser' }, }, ], }, diff --git a/plugins/catalog-react/src/hooks/useEntityListProvider.test.tsx b/plugins/catalog-react/src/hooks/useEntityListProvider.test.tsx index e3ab09f081..3353312955 100644 --- a/plugins/catalog-react/src/hooks/useEntityListProvider.test.tsx +++ b/plugins/catalog-react/src/hooks/useEntityListProvider.test.tsx @@ -46,11 +46,6 @@ const entities: Entity[] = [ { type: 'ownedBy', targetRef: 'user:default/guest', - target: { - name: 'guest', - namespace: 'default', - kind: 'User', - }, }, ], }, diff --git a/plugins/catalog-react/src/hooks/useEntityOwnership.test.tsx b/plugins/catalog-react/src/hooks/useEntityOwnership.test.tsx index d4d80203d3..616e4949c1 100644 --- a/plugins/catalog-react/src/hooks/useEntityOwnership.test.tsx +++ b/plugins/catalog-react/src/hooks/useEntityOwnership.test.tsx @@ -62,12 +62,10 @@ describe('useEntityOwnership', () => { { type: RELATION_OWNED_BY, targetRef: 'user:default/user1', - target: { kind: 'User', namespace: 'default', name: 'user1' }, }, { type: RELATION_OWNED_BY, targetRef: 'group:default/group1', - target: { kind: 'Group', namespace: 'default', name: 'group1' }, }, ], }; diff --git a/plugins/catalog-react/src/utils/getEntityRelations.test.ts b/plugins/catalog-react/src/utils/getEntityRelations.test.ts index ea0ba59399..f602e8dcc9 100644 --- a/plugins/catalog-react/src/utils/getEntityRelations.test.ts +++ b/plugins/catalog-react/src/utils/getEntityRelations.test.ts @@ -32,7 +32,6 @@ describe('getEntityRelations', () => { { type: RELATION_MEMBER_OF, targetRef: 'group:default/member', - target: { kind: 'group', namespace: 'default', name: 'member' }, }, { type: RELATION_CHILD_OF, @@ -53,7 +52,6 @@ describe('getEntityRelations', () => { { type: RELATION_MEMBER_OF, targetRef: 'group:default/member', - target: { kind: 'group', namespace: 'default', name: 'member' }, }, { type: RELATION_MEMBER_OF, diff --git a/plugins/catalog-react/src/utils/isOwnerOf.test.ts b/plugins/catalog-react/src/utils/isOwnerOf.test.ts index d3053646d8..224550d479 100644 --- a/plugins/catalog-react/src/utils/isOwnerOf.test.ts +++ b/plugins/catalog-react/src/utils/isOwnerOf.test.ts @@ -32,7 +32,6 @@ describe('isOwnerOf', () => { { type: RELATION_OWNED_BY, targetRef: 'user:default/user', - target: { kind: 'user', namespace: 'default', name: 'user' }, }, ], } as Entity; @@ -48,7 +47,6 @@ describe('isOwnerOf', () => { { type: RELATION_MEMBER_OF, targetRef: 'group:default/group', - target: { kind: 'group', namespace: 'default', name: 'group' }, }, ], } as Entity; @@ -57,7 +55,6 @@ describe('isOwnerOf', () => { { type: RELATION_OWNED_BY, targetRef: 'group:default/group', - target: { kind: 'group', namespace: 'default', name: 'group' }, }, ], } as Entity; diff --git a/plugins/catalog/src/components/AboutCard/AboutContent.test.tsx b/plugins/catalog/src/components/AboutCard/AboutContent.test.tsx index cf9673eeeb..87ee8cc6ec 100644 --- a/plugins/catalog/src/components/AboutCard/AboutContent.test.tsx +++ b/plugins/catalog/src/components/AboutCard/AboutContent.test.tsx @@ -48,29 +48,14 @@ describe('', () => { { type: RELATION_OWNED_BY, targetRef: 'user:default/o', - target: { - kind: 'user', - name: 'o', - namespace: 'default', - }, }, { type: RELATION_PART_OF, targetRef: 'system:default/s', - target: { - kind: 'system', - name: 's', - namespace: 'default', - }, }, { type: RELATION_PART_OF, targetRef: 'domain:default/d', - target: { - kind: 'domain', - name: 'd', - namespace: 'default', - }, }, ], }; @@ -156,20 +141,10 @@ describe('', () => { { type: RELATION_OWNED_BY, targetRef: 'user:default/guest', - target: { - kind: 'user', - name: 'guest', - namespace: 'default', - }, }, { type: RELATION_PART_OF, targetRef: 'system:default/system', - target: { - kind: 'system', - name: 'system', - namespace: 'default', - }, }, ], }; @@ -263,29 +238,14 @@ describe('', () => { { type: RELATION_OWNED_BY, targetRef: 'user:default/guest', - target: { - kind: 'user', - name: 'guest', - namespace: 'default', - }, }, { type: RELATION_PART_OF, targetRef: 'system:default/system', - target: { - kind: 'system', - name: 'system', - namespace: 'default', - }, }, { type: RELATION_PART_OF, targetRef: 'component:default/parent-software', - target: { - kind: 'component', - name: 'parent-software', - namespace: 'default', - }, }, ], }; @@ -378,11 +338,6 @@ describe('', () => { { type: RELATION_OWNED_BY, targetRef: 'user:default/guest', - target: { - kind: 'user', - name: 'guest', - namespace: 'default', - }, }, ], }; @@ -538,20 +493,10 @@ describe('', () => { { type: RELATION_OWNED_BY, targetRef: 'user:default/guest', - target: { - kind: 'user', - name: 'guest', - namespace: 'default', - }, }, { type: RELATION_PART_OF, targetRef: 'system:default/system', - target: { - kind: 'system', - name: 'system', - namespace: 'default', - }, }, ], }; @@ -637,20 +582,10 @@ describe('', () => { { type: RELATION_OWNED_BY, targetRef: 'user:default/guest', - target: { - kind: 'user', - name: 'guest', - namespace: 'default', - }, }, { type: RELATION_PART_OF, targetRef: 'domain:default/domain', - target: { - kind: 'domain', - name: 'domain', - namespace: 'default', - }, }, ], }; diff --git a/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.test.tsx b/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.test.tsx index 07bd81b287..c3135e5697 100644 --- a/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.test.tsx +++ b/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.test.tsx @@ -75,7 +75,6 @@ describe('DefaultCatalogPage', () => { { type: RELATION_OWNED_BY, targetRef: 'group:default/tools', - target: { kind: 'group', name: 'tools', namespace: 'default' }, }, ], }, diff --git a/plugins/catalog/src/components/DependencyOfComponentsCard/DependencyOfComponentsCard.test.tsx b/plugins/catalog/src/components/DependencyOfComponentsCard/DependencyOfComponentsCard.test.tsx index 05d836870f..b3f8262076 100644 --- a/plugins/catalog/src/components/DependencyOfComponentsCard/DependencyOfComponentsCard.test.tsx +++ b/plugins/catalog/src/components/DependencyOfComponentsCard/DependencyOfComponentsCard.test.tsx @@ -80,11 +80,6 @@ describe('', () => { }, relations: [ { - target: { - kind: 'component', - namespace: 'my-namespace', - name: 'target-name', - }, targetRef: 'component:my-namespace/target-name', type: RELATION_DEPENDENCY_OF, }, diff --git a/plugins/catalog/src/components/DependsOnComponentsCard/DependsOnComponentsCard.test.tsx b/plugins/catalog/src/components/DependsOnComponentsCard/DependsOnComponentsCard.test.tsx index b7ef594522..57106015b2 100644 --- a/plugins/catalog/src/components/DependsOnComponentsCard/DependsOnComponentsCard.test.tsx +++ b/plugins/catalog/src/components/DependsOnComponentsCard/DependsOnComponentsCard.test.tsx @@ -80,11 +80,6 @@ describe('', () => { }, relations: [ { - target: { - kind: 'component', - namespace: 'my-namespace', - name: 'target-name', - }, targetRef: 'component:my-namespace/target-name', type: RELATION_DEPENDS_ON, }, diff --git a/plugins/catalog/src/components/DependsOnResourcesCard/DependsOnResourcesCard.test.tsx b/plugins/catalog/src/components/DependsOnResourcesCard/DependsOnResourcesCard.test.tsx index b8d2801e48..bd52bfeeb8 100644 --- a/plugins/catalog/src/components/DependsOnResourcesCard/DependsOnResourcesCard.test.tsx +++ b/plugins/catalog/src/components/DependsOnResourcesCard/DependsOnResourcesCard.test.tsx @@ -80,11 +80,6 @@ describe('', () => { }, relations: [ { - target: { - kind: 'resource', - namespace: 'my-namespace', - name: 'target-name', - }, targetRef: 'resource:my-namespace/target-name', type: RELATION_DEPENDS_ON, }, diff --git a/plugins/catalog/src/components/HasComponentsCard/HasComponentsCard.test.tsx b/plugins/catalog/src/components/HasComponentsCard/HasComponentsCard.test.tsx index fbb474825f..77fdb74f2f 100644 --- a/plugins/catalog/src/components/HasComponentsCard/HasComponentsCard.test.tsx +++ b/plugins/catalog/src/components/HasComponentsCard/HasComponentsCard.test.tsx @@ -80,11 +80,6 @@ describe('', () => { }, relations: [ { - target: { - kind: 'component', - namespace: 'my-namespace', - name: 'target-name', - }, targetRef: 'component:my-namespace/target-name', type: RELATION_HAS_PART, }, diff --git a/plugins/catalog/src/components/HasResourcesCard/HasResourcesCard.test.tsx b/plugins/catalog/src/components/HasResourcesCard/HasResourcesCard.test.tsx index c75273e484..20830d2ccd 100644 --- a/plugins/catalog/src/components/HasResourcesCard/HasResourcesCard.test.tsx +++ b/plugins/catalog/src/components/HasResourcesCard/HasResourcesCard.test.tsx @@ -75,11 +75,6 @@ describe('', () => { }, relations: [ { - target: { - kind: 'resource', - namespace: 'my-namespace', - name: 'target-name', - }, targetRef: 'resource:my-namespace/target-name', type: RELATION_HAS_PART, }, diff --git a/plugins/catalog/src/components/HasSubcomponentsCard/HasSubcomponentsCard.test.tsx b/plugins/catalog/src/components/HasSubcomponentsCard/HasSubcomponentsCard.test.tsx index e021fea2f3..7fd0273939 100644 --- a/plugins/catalog/src/components/HasSubcomponentsCard/HasSubcomponentsCard.test.tsx +++ b/plugins/catalog/src/components/HasSubcomponentsCard/HasSubcomponentsCard.test.tsx @@ -80,11 +80,6 @@ describe('', () => { }, relations: [ { - target: { - kind: 'component', - namespace: 'my-namespace', - name: 'target-name', - }, targetRef: 'component:my-namespace/target-name', type: RELATION_HAS_PART, }, diff --git a/plugins/catalog/src/components/HasSystemsCard/HasSystemsCard.test.tsx b/plugins/catalog/src/components/HasSystemsCard/HasSystemsCard.test.tsx index 6a2e2a0b7f..cd11e4d3f3 100644 --- a/plugins/catalog/src/components/HasSystemsCard/HasSystemsCard.test.tsx +++ b/plugins/catalog/src/components/HasSystemsCard/HasSystemsCard.test.tsx @@ -78,11 +78,6 @@ describe('', () => { }, relations: [ { - target: { - kind: 'system', - namespace: 'my-namespace', - name: 'target-name', - }, targetRef: 'system:my-namespace/target-name', type: RELATION_HAS_PART, }, diff --git a/plugins/catalog/src/components/SystemDiagramCard/SystemDiagramCard.test.tsx b/plugins/catalog/src/components/SystemDiagramCard/SystemDiagramCard.test.tsx index eb6b71c47e..18b45a84d4 100644 --- a/plugins/catalog/src/components/SystemDiagramCard/SystemDiagramCard.test.tsx +++ b/plugins/catalog/src/components/SystemDiagramCard/SystemDiagramCard.test.tsx @@ -102,11 +102,6 @@ describe('', () => { }, relations: [ { - target: { - kind: 'domain', - namespace: 'namespace', - name: 'domain', - }, targetRef: 'domain:namespace/domain', type: RELATION_PART_OF, }, @@ -162,11 +157,6 @@ describe('', () => { }, relations: [ { - target: { - kind: 'Domain', - namespace: 'namespace', - name: 'alongdomainthatshouldgettruncated', - }, targetRef: 'domain:namespace/alongdomainthatshouldgettruncated', type: RELATION_PART_OF, }, diff --git a/plugins/fossa/dev/index.tsx b/plugins/fossa/dev/index.tsx index 1ce9ec58b2..78c0ad380b 100644 --- a/plugins/fossa/dev/index.tsx +++ b/plugins/fossa/dev/index.tsx @@ -43,7 +43,6 @@ const entity = (name?: string) => { type: RELATION_OWNED_BY, targetRef: `group:default/${name}`, - target: { kind: 'group', namespace: 'default', name }, }, ], } as Entity); diff --git a/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.test.tsx b/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.test.tsx index cffe3e0228..6b37afec1d 100644 --- a/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.test.tsx +++ b/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.test.tsx @@ -60,11 +60,6 @@ describe('MemberTab Test', () => { { type: 'memberOf', targetRef: 'group:default/team-d', - target: { - kind: 'group', - name: 'team-d', - namespace: 'default', - }, }, ], spec: { diff --git a/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.test.tsx b/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.test.tsx index f6aaef6344..483cf9744f 100644 --- a/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.test.tsx +++ b/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.test.tsx @@ -103,11 +103,6 @@ const items = [ { type: 'ownedBy', targetRef: 'group:default/my-team', - target: { - name: 'my-team', - namespace: 'default', - kind: 'group', - }, }, ], }, @@ -140,11 +135,6 @@ describe('OwnershipCard', () => { { type: 'memberOf', targetRef: 'group:default/examplegroup', - target: { - kind: 'group', - name: 'examplegroup', - namespace: 'default', - }, }, ], }; @@ -266,11 +256,6 @@ describe('OwnershipCard', () => { { type: 'memberOf', targetRef: 'group:default/my-team', - target: { - kind: 'group', - name: 'my-team', - namespace: 'default', - }, }, ], }; diff --git a/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.test.tsx b/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.test.tsx index 3e5e595eef..68e9715b06 100644 --- a/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.test.tsx +++ b/plugins/org/src/components/Cards/User/UserProfileCard/UserProfileCard.test.tsx @@ -43,11 +43,6 @@ describe('UserSummary Test', () => { { type: 'memberOf', targetRef: 'group:default/examplegroup', - target: { - kind: 'group', - name: 'ExampleGroup', - namespace: 'default', - }, }, ], }; diff --git a/plugins/tech-insights-backend/src/service/fact/factRetrievers/entityMetadataFactRetriever.test.ts b/plugins/tech-insights-backend/src/service/fact/factRetrievers/entityMetadataFactRetriever.test.ts index 14d0728cf6..9d5c57637d 100644 --- a/plugins/tech-insights-backend/src/service/fact/factRetrievers/entityMetadataFactRetriever.test.ts +++ b/plugins/tech-insights-backend/src/service/fact/factRetrievers/entityMetadataFactRetriever.test.ts @@ -58,7 +58,6 @@ const defaultEntityListResponse: GetEntitiesResponse = { { type: RELATION_OWNED_BY, targetRef: 'group:default/my-team', - target: { name: 'team-a', kind: 'group', namespace: 'default' }, }, ], }, diff --git a/plugins/tech-insights-backend/src/service/fact/factRetrievers/entityOwnershipFactRetriever.test.ts b/plugins/tech-insights-backend/src/service/fact/factRetrievers/entityOwnershipFactRetriever.test.ts index 374bda2569..555f761ae8 100644 --- a/plugins/tech-insights-backend/src/service/fact/factRetrievers/entityOwnershipFactRetriever.test.ts +++ b/plugins/tech-insights-backend/src/service/fact/factRetrievers/entityOwnershipFactRetriever.test.ts @@ -58,7 +58,6 @@ const defaultEntityListResponse: GetEntitiesResponse = { { type: RELATION_OWNED_BY, targetRef: 'group:default/team-a', - target: { name: 'team-a', kind: 'group', namespace: 'default' }, }, ], }, diff --git a/plugins/tech-insights-backend/src/service/fact/factRetrievers/techdocsFactRetriever.test.ts b/plugins/tech-insights-backend/src/service/fact/factRetrievers/techdocsFactRetriever.test.ts index b4fa8ba67c..be9397942d 100644 --- a/plugins/tech-insights-backend/src/service/fact/factRetrievers/techdocsFactRetriever.test.ts +++ b/plugins/tech-insights-backend/src/service/fact/factRetrievers/techdocsFactRetriever.test.ts @@ -58,7 +58,6 @@ const defaultEntityListResponse: GetEntitiesResponse = { { type: RELATION_OWNED_BY, targetRef: 'group:default/team-a', - target: { name: 'team-a', kind: 'group', namespace: 'default' }, }, ], }, diff --git a/plugins/techdocs/src/home/components/Tables/DocsTable.test.tsx b/plugins/techdocs/src/home/components/Tables/DocsTable.test.tsx index 730354f253..098f613773 100644 --- a/plugins/techdocs/src/home/components/Tables/DocsTable.test.tsx +++ b/plugins/techdocs/src/home/components/Tables/DocsTable.test.tsx @@ -61,11 +61,6 @@ describe('DocsTable test', () => { }, relations: [ { - target: { - kind: 'user', - namespace: 'default', - name: 'owned', - }, targetRef: 'user:default/owned', type: 'ownedBy', }, @@ -82,11 +77,6 @@ describe('DocsTable test', () => { }, relations: [ { - target: { - kind: 'user', - namespace: 'default', - name: 'not-owned', - }, targetRef: 'user:default/not-owned', type: 'ownedBy', }, @@ -134,11 +124,6 @@ describe('DocsTable test', () => { }, relations: [ { - target: { - kind: 'user', - namespace: 'default', - name: 'owned', - }, targetRef: 'user:default/owned', type: 'ownedBy', }, From 9803a47f31676c44426d6e133ed75801e0a84dbe Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Fri, 4 Mar 2022 10:04:38 +0100 Subject: [PATCH 2/7] app: Disable incompatible example app plugins until updated Signed-off-by: Johan Haals --- .../app/src/components/catalog/EntityPage.tsx | 57 +------------------ 1 file changed, 2 insertions(+), 55 deletions(-) diff --git a/packages/app/src/components/catalog/EntityPage.tsx b/packages/app/src/components/catalog/EntityPage.tsx index ba0eacf97e..5f0f22183f 100644 --- a/packages/app/src/components/catalog/EntityPage.tsx +++ b/packages/app/src/components/catalog/EntityPage.tsx @@ -108,27 +108,8 @@ import { EntityTodoContent } from '@backstage/plugin-todo'; import { Button, Grid } from '@material-ui/core'; import BadgeIcon from '@material-ui/icons/CallToAction'; -import { - EntityGithubInsightsContent, - EntityGithubInsightsLanguagesCard, - EntityGithubInsightsReadmeCard, - EntityGithubInsightsReleasesCard, - isGithubInsightsAvailable, -} from '@roadiehq/backstage-plugin-github-insights'; -import { - EntityGithubPullRequestsContent, - EntityGithubPullRequestsOverviewCard, - isGithubPullRequestsAvailable, -} from '@roadiehq/backstage-plugin-github-pull-requests'; -import { - EntityTravisCIContent, - EntityTravisCIOverviewCard, - isTravisciAvailable, -} from '@roadiehq/backstage-plugin-travis-ci'; -import { - EntityBuildkiteContent, - isBuildkiteAvailable, -} from '@roadiehq/backstage-plugin-buildkite'; +import { EntityGithubInsightsContent } from '@roadiehq/backstage-plugin-github-insights'; +import { EntityGithubPullRequestsContent } from '@roadiehq/backstage-plugin-github-pull-requests'; import { isNewRelicDashboardAvailable, EntityNewRelicDashboardContent, @@ -179,10 +160,6 @@ export const cicdContent = ( - - - - @@ -191,10 +168,6 @@ export const cicdContent = ( - - - - @@ -234,12 +207,6 @@ const cicdCard = ( - - - - - - @@ -325,18 +292,6 @@ const overviewContent = ( {cicdCard} - - Boolean(isGithubInsightsAvailable(e))}> - - - - - - - - - - @@ -345,14 +300,6 @@ const overviewContent = ( - - Boolean(isGithubPullRequestsAvailable(e))}> - - - - - - From ba6d2fecec2ec9908ef63a67b2590add0f8f92d8 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Fri, 4 Mar 2022 10:09:43 +0100 Subject: [PATCH 3/7] update changesets Signed-off-by: Johan Haals --- .changeset/weak-fans-sip.md | 127 ------------------------------ .changeset/yellow-shirts-study.md | 6 +- 2 files changed, 3 insertions(+), 130 deletions(-) delete mode 100644 .changeset/weak-fans-sip.md diff --git a/.changeset/weak-fans-sip.md b/.changeset/weak-fans-sip.md deleted file mode 100644 index 2db4a40b79..0000000000 --- a/.changeset/weak-fans-sip.md +++ /dev/null @@ -1,127 +0,0 @@ ---- -'@backstage/plugin-api-docs': patch -'@backstage/plugin-auth-backend': patch -'@backstage/plugin-catalog': patch -'@backstage/plugin-catalog-backend': patch -'@backstage/plugin-catalog-graph': patch -'@backstage/plugin-catalog-react': patch -'@backstage/plugin-fossa': patch -'@backstage/plugin-org': patch -'@backstage/plugin-tech-insights-backend': patch -'@backstage/plugin-techdocs': patch -'@backstage/app-defaults': patch -'@backstage/backend-common': patch -'@backstage/backend-tasks': patch -'@backstage/backend-test-utils': patch -'@backstage/catalog-client': patch -'@backstage/cli': patch -'@backstage/cli-common': patch -'@backstage/codemods': patch -'@backstage/config': patch -'@backstage/config-loader': patch -'@backstage/core-app-api': patch -'@backstage/core-components': patch -'@backstage/core-plugin-api': patch -'@backstage/create-app': patch -'@backstage/dev-utils': patch -'@backstage/errors': patch -'@backstage/integration': patch -'@backstage/integration-react': patch -'@backstage/release-manifests': patch -'@backstage/search-common': patch -'@techdocs/cli': patch -'techdocs-cli-embedded-app': patch -'@backstage/techdocs-common': patch -'@backstage/test-utils': patch -'@backstage/theme': patch -'@backstage/types': patch -'@backstage/version-bridge': patch -'@backstage/plugin-airbrake': patch -'@backstage/plugin-airbrake-backend': patch -'@backstage/plugin-allure': patch -'@backstage/plugin-analytics-module-ga': patch -'@backstage/plugin-apache-airflow': patch -'@backstage/plugin-app-backend': patch -'@backstage/plugin-auth-node': patch -'@backstage/plugin-azure-devops': patch -'@backstage/plugin-azure-devops-backend': patch -'@backstage/plugin-azure-devops-common': patch -'@backstage/plugin-badges': patch -'@backstage/plugin-badges-backend': patch -'@backstage/plugin-bazaar': patch -'@backstage/plugin-bazaar-backend': patch -'@backstage/plugin-bitrise': patch -'@backstage/plugin-catalog-backend-module-aws': patch -'@backstage/plugin-catalog-backend-module-ldap': patch -'@backstage/plugin-catalog-backend-module-msgraph': patch -'@backstage/plugin-catalog-common': patch -'@backstage/plugin-catalog-graphql': patch -'@backstage/plugin-catalog-import': patch -'@backstage/plugin-cicd-statistics': patch -'@backstage/plugin-circleci': patch -'@backstage/plugin-cloudbuild': patch -'@backstage/plugin-code-climate': patch -'@backstage/plugin-code-coverage': patch -'@backstage/plugin-code-coverage-backend': patch -'@backstage/plugin-config-schema': patch -'@backstage/plugin-cost-insights': patch -'@backstage/plugin-explore': patch -'@backstage/plugin-explore-react': patch -'@backstage/plugin-firehydrant': patch -'@backstage/plugin-gcp-projects': patch -'@backstage/plugin-git-release-manager': patch -'@backstage/plugin-github-actions': patch -'@backstage/plugin-github-deployments': patch -'@backstage/plugin-gitops-profiles': patch -'@backstage/plugin-gocd': patch -'@backstage/plugin-graphiql': patch -'@backstage/plugin-graphql-backend': patch -'@backstage/plugin-home': patch -'@backstage/plugin-ilert': patch -'@backstage/plugin-jenkins': patch -'@backstage/plugin-jenkins-backend': patch -'@backstage/plugin-jenkins-common': patch -'@backstage/plugin-kafka': patch -'@backstage/plugin-kafka-backend': patch -'@backstage/plugin-kubernetes': patch -'@backstage/plugin-kubernetes-backend': patch -'@backstage/plugin-kubernetes-common': patch -'@backstage/plugin-lighthouse': patch -'@backstage/plugin-newrelic': patch -'@backstage/plugin-newrelic-dashboard': patch -'@backstage/plugin-pagerduty': patch -'@backstage/plugin-permission-backend': patch -'@backstage/plugin-permission-common': patch -'@backstage/plugin-permission-node': patch -'@backstage/plugin-permission-react': patch -'@backstage/plugin-proxy-backend': patch -'@backstage/plugin-rollbar': patch -'@backstage/plugin-rollbar-backend': patch -'@backstage/plugin-scaffolder': patch -'@backstage/plugin-scaffolder-backend': patch -'@backstage/plugin-scaffolder-backend-module-cookiecutter': patch -'@backstage/plugin-scaffolder-backend-module-rails': patch -'@backstage/plugin-scaffolder-backend-module-yeoman': patch -'@backstage/plugin-scaffolder-common': patch -'@backstage/plugin-search': patch -'@backstage/plugin-search-backend': patch -'@backstage/plugin-search-backend-module-elasticsearch': patch -'@backstage/plugin-search-backend-module-pg': patch -'@backstage/plugin-search-backend-node': patch -'@backstage/plugin-sentry': patch -'@backstage/plugin-shortcuts': patch -'@backstage/plugin-sonarqube': patch -'@backstage/plugin-splunk-on-call': patch -'@backstage/plugin-tech-insights': patch -'@backstage/plugin-tech-insights-backend-module-jsonfc': patch -'@backstage/plugin-tech-insights-common': patch -'@backstage/plugin-tech-insights-node': patch -'@backstage/plugin-tech-radar': patch -'@backstage/plugin-techdocs-backend': patch -'@backstage/plugin-todo': patch -'@backstage/plugin-todo-backend': patch -'@backstage/plugin-user-settings': patch -'@backstage/plugin-xcmetrics': patch ---- - -Removed usage of `target` for `EntityRelation`s. diff --git a/.changeset/yellow-shirts-study.md b/.changeset/yellow-shirts-study.md index c7c812b71f..26ccfcb83f 100644 --- a/.changeset/yellow-shirts-study.md +++ b/.changeset/yellow-shirts-study.md @@ -1,7 +1,7 @@ --- '@backstage/catalog-model': minor +'@backstage/plugin-catalog-backend': minor --- -**BREAKING**: Removed the `target` property from `EntityRelation`, use `targetRef` instead. - -This means `target: { name: 'team-a', kind: 'group', namespace: 'default' }` is now replaced with `targetRef: 'group:default/team-a'` in entity relations. +**BREAKING**: Removed the `target` property from `EntityRelation`. This field has been replaced by `targetRef`. +This means that `target: { name: 'team-a', kind: 'group', namespace: 'default' }` is now replaced with `targetRef: 'group:default/team-a'` in entity relations. From cdb623445e02750b40b5a6e2dedeb38fd7396947 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Fri, 4 Mar 2022 10:19:43 +0100 Subject: [PATCH 4/7] remove target from catalog tests Signed-off-by: Johan Haals --- .../service/DefaultEntitiesCatalog.test.ts | 56 ------------------- .../src/stitching/Stitcher.test.ts | 15 ----- 2 files changed, 71 deletions(-) diff --git a/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.test.ts b/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.test.ts index 43e208197f..7094cfd1c2 100644 --- a/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.test.ts +++ b/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.test.ts @@ -469,62 +469,6 @@ describe('DefaultEntitiesCatalog', () => { expect(entities.length).toBe(0); }, ); - - it.each(databases.eachSupportedId())( - 'should return both target and targetRef for entities', - async databaseId => { - const { knex } = await createDatabase(databaseId); - await addEntity( - knex, - { - apiVersion: 'a', - kind: 'k', - metadata: { name: 'one' }, - spec: {}, - relations: [{ type: 'r', targetRef: 'x:y/z' } as any], - }, - [], - ); - await addEntity( - knex, - { - apiVersion: 'a', - kind: 'k', - metadata: { name: 'two' }, - spec: {}, - relations: [ - { - type: 'r', - target: { kind: 'x', namespace: 'y', name: 'z' }, - } as any, - ], - }, - [], - ); - const catalog = new DefaultEntitiesCatalog(knex); - - const { entities } = await catalog.entities(); - - expect( - entities.find(e => e.metadata.name === 'one')!.relations, - ).toEqual([ - { - type: 'r', - targetRef: 'x:y/z', - target: { kind: 'x', namespace: 'y', name: 'z' }, - }, - ]); - expect( - entities.find(e => e.metadata.name === 'two')!.relations, - ).toEqual([ - { - type: 'r', - targetRef: 'x:y/z', - target: { kind: 'x', namespace: 'y', name: 'z' }, - }, - ]); - }, - ); }); describe('removeEntityByUid', () => { diff --git a/plugins/catalog-backend/src/stitching/Stitcher.test.ts b/plugins/catalog-backend/src/stitching/Stitcher.test.ts index 582ed3f953..9accebf1fc 100644 --- a/plugins/catalog-backend/src/stitching/Stitcher.test.ts +++ b/plugins/catalog-backend/src/stitching/Stitcher.test.ts @@ -94,11 +94,6 @@ describe('Stitcher', () => { { type: 'looksAt', targetRef: 'k:ns/other', - target: { - kind: 'k', - namespace: 'ns', - name: 'other', - }, }, ], apiVersion: 'a', @@ -160,20 +155,10 @@ describe('Stitcher', () => { { type: 'looksAt', targetRef: 'k:ns/other', - target: { - kind: 'k', - namespace: 'ns', - name: 'other', - }, }, { type: 'looksAt', targetRef: 'k:ns/third', - target: { - kind: 'k', - namespace: 'ns', - name: 'third', - }, }, ]), apiVersion: 'a', From 36c2ada275f46a2051a1f8bb02bcbd48f4fc82a8 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Fri, 4 Mar 2022 10:49:17 +0100 Subject: [PATCH 5/7] Keep target field in entities output Signed-off-by: Johan Haals --- .../service/DefaultEntitiesCatalog.test.ts | 56 +++++++++++++++++++ .../src/service/DefaultEntitiesCatalog.ts | 28 +++++++++- 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.test.ts b/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.test.ts index 7094cfd1c2..43e208197f 100644 --- a/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.test.ts +++ b/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.test.ts @@ -469,6 +469,62 @@ describe('DefaultEntitiesCatalog', () => { expect(entities.length).toBe(0); }, ); + + it.each(databases.eachSupportedId())( + 'should return both target and targetRef for entities', + async databaseId => { + const { knex } = await createDatabase(databaseId); + await addEntity( + knex, + { + apiVersion: 'a', + kind: 'k', + metadata: { name: 'one' }, + spec: {}, + relations: [{ type: 'r', targetRef: 'x:y/z' } as any], + }, + [], + ); + await addEntity( + knex, + { + apiVersion: 'a', + kind: 'k', + metadata: { name: 'two' }, + spec: {}, + relations: [ + { + type: 'r', + target: { kind: 'x', namespace: 'y', name: 'z' }, + } as any, + ], + }, + [], + ); + const catalog = new DefaultEntitiesCatalog(knex); + + const { entities } = await catalog.entities(); + + expect( + entities.find(e => e.metadata.name === 'one')!.relations, + ).toEqual([ + { + type: 'r', + targetRef: 'x:y/z', + target: { kind: 'x', namespace: 'y', name: 'z' }, + }, + ]); + expect( + entities.find(e => e.metadata.name === 'two')!.relations, + ).toEqual([ + { + type: 'r', + targetRef: 'x:y/z', + target: { kind: 'x', namespace: 'y', name: 'z' }, + }, + ]); + }, + ); }); describe('removeEntityByUid', () => { diff --git a/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts b/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts index 31f98c9f0c..1e681a4f43 100644 --- a/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts +++ b/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts @@ -14,7 +14,11 @@ * limitations under the License. */ -import { Entity, stringifyEntityRef } from '@backstage/catalog-model'; +import { + Entity, + parseEntityRef, + stringifyEntityRef, +} from '@backstage/catalog-model'; import { InputError, NotFoundError } from '@backstage/errors'; import { Knex } from 'knex'; import lodash from 'lodash'; @@ -200,6 +204,28 @@ export class DefaultEntitiesCatalog implements EntitiesCatalog { entities = entities.map(e => request.fields!(e)); } + // TODO(freben): This is added as a compatibility guarantee, until we can be + // sure that all adopters have re-stitched their entities so that the new + // targetRef field is present on them, and that they have stopped consuming + // the now-removed old field + // TODO(jhaals): Remove this in April 2021 + for (const entity of entities) { + if (entity.relations) { + for (const relation of entity.relations as any) { + if (!relation.targetRef && relation.target) { + // This is the case where an old-form entity, not yet stitched with + // the updated code, was in the database + relation.targetRef = stringifyEntityRef(relation.target); + } else if (!relation.target && relation.targetRef) { + // This is the case where a new-form entity, stitched with the + // updated code, was in the database but we still want to produce + // the old data shape as well for compatibility reasons + relation.target = parseEntityRef(relation.targetRef); + } + } + } + } + return { entities, pageInfo, From ae6b614d8406797728927d986ab5c9ed9902c7ba Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Fri, 4 Mar 2022 11:08:08 +0100 Subject: [PATCH 6/7] update changeset, add api report Signed-off-by: Johan Haals --- .changeset/yellow-shirts-study.md | 2 ++ packages/catalog-model/api-report.md | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.changeset/yellow-shirts-study.md b/.changeset/yellow-shirts-study.md index 26ccfcb83f..7e464f1c26 100644 --- a/.changeset/yellow-shirts-study.md +++ b/.changeset/yellow-shirts-study.md @@ -5,3 +5,5 @@ **BREAKING**: Removed the `target` property from `EntityRelation`. This field has been replaced by `targetRef`. This means that `target: { name: 'team-a', kind: 'group', namespace: 'default' }` is now replaced with `targetRef: 'group:default/team-a'` in entity relations. + +The entities API endpoint still return the old `target` field for to ease transitions, however the future removal of this field will be considered non breaking. diff --git a/packages/catalog-model/api-report.md b/packages/catalog-model/api-report.md index 1a36ce43c7..eb0e4ad7f0 100644 --- a/packages/catalog-model/api-report.md +++ b/packages/catalog-model/api-report.md @@ -192,7 +192,6 @@ export type EntityPolicy = { // @public export type EntityRelation = { type: string; - target: CompoundEntityRef; targetRef: string; }; From be906d84fe40752e66568c990ee3e33949e8ab15 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Fri, 4 Mar 2022 13:23:14 +0100 Subject: [PATCH 7/7] fix year off-by-one error Signed-off-by: Johan Haals --- plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts b/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts index 1e681a4f43..eaa0ce0189 100644 --- a/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts +++ b/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.ts @@ -208,7 +208,7 @@ export class DefaultEntitiesCatalog implements EntitiesCatalog { // sure that all adopters have re-stitched their entities so that the new // targetRef field is present on them, and that they have stopped consuming // the now-removed old field - // TODO(jhaals): Remove this in April 2021 + // TODO(jhaals): Remove this in April 2022 for (const entity of entities) { if (entity.relations) { for (const relation of entity.relations as any) {