From 8e554c649a9bfe447894f14efe9f152a479f7734 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 6 Apr 2021 13:53:17 +0100 Subject: [PATCH 001/485] support GitHub enterprise and hosted GitHub on GithubDeployments plugin Signed-off-by: Andrew Johnson --- plugins/github-deployments/package.json | 3 + plugins/github-deployments/src/api/index.ts | 32 +++++++++++ .../components/GithubDeploymentsCard.test.tsx | 57 ++++++++++++++++++- .../src/components/GithubDeploymentsCard.tsx | 13 ++++- plugins/github-deployments/src/plugin.ts | 10 +++- 5 files changed, 108 insertions(+), 7 deletions(-) diff --git a/plugins/github-deployments/package.json b/plugins/github-deployments/package.json index b8761c1385..528d660ea8 100644 --- a/plugins/github-deployments/package.json +++ b/plugins/github-deployments/package.json @@ -22,6 +22,9 @@ "dependencies": { "@backstage/catalog-model": "^0.7.4", "@backstage/core": "^0.7.3", + "@backstage/errors": "^0.1.1", + "@backstage/integration": "^0.5.1", + "@backstage/integration-react": "^0.1.1", "@backstage/plugin-catalog-react": "^0.1.3", "@backstage/theme": "^0.2.5", "@material-ui/core": "^4.11.0", diff --git a/plugins/github-deployments/src/api/index.ts b/plugins/github-deployments/src/api/index.ts index ca69ac3853..f239af9ef8 100644 --- a/plugins/github-deployments/src/api/index.ts +++ b/plugins/github-deployments/src/api/index.ts @@ -14,8 +14,33 @@ * limitations under the License. */ import { createApiRef, OAuthApi } from '@backstage/core'; +import { InputError } from '@backstage/errors'; +import { ScmIntegrationRegistry } from '@backstage/integration'; import { graphql } from '@octokit/graphql'; +const getBaseUrl = ( + scmIntegrationsApi: ScmIntegrationRegistry, + host?: string, +): string => { + if (!host) { + return 'https://api.github.com'; + } + + const integrationConfig = scmIntegrationsApi.github.byHost(host); + + if (!integrationConfig) { + throw new InputError( + `No matching GitHub integration configuration for host ${host}, please check your integrations config`, + ); + } + + if (!integrationConfig.config.apiBaseUrl) { + throw new InputError(`No apiBaseUrl available for host ${host}`); + } + + return integrationConfig.config.apiBaseUrl; +}; + export type GithubDeployment = { environment: string; state: string; @@ -28,6 +53,7 @@ export type GithubDeployment = { export interface GithubDeploymentsApi { listDeployments(options: { + host?: string; owner: string; repo: string; last: number; @@ -41,6 +67,7 @@ export const githubDeploymentsApiRef = createApiRef({ export type Options = { githubAuthApi: OAuthApi; + scmIntegrationsApi: ScmIntegrationRegistry; }; const deploymentsQuery = ` @@ -71,19 +98,24 @@ export type QueryResponse = { export class GithubDeploymentsApiClient implements GithubDeploymentsApi { private readonly githubAuthApi: OAuthApi; + private readonly scmIntegrationsApi: ScmIntegrationRegistry; constructor(options: Options) { this.githubAuthApi = options.githubAuthApi; + this.scmIntegrationsApi = options.scmIntegrationsApi; } async listDeployments(options: { owner: string; repo: string; last: number; + host?: string; }): Promise { + const baseUrl = getBaseUrl(this.scmIntegrationsApi, options.host); const token = await this.githubAuthApi.getAccessToken(['repo']); const graphQLWithAuth = graphql.defaults({ + baseUrl, headers: { authorization: `token ${token}`, }, diff --git a/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx b/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx index e20183f1d6..db0092caa8 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx +++ b/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx @@ -39,6 +39,7 @@ import { import { setupServer } from 'msw/node'; import { graphql } from 'msw'; +import { ScmIntegrations } from '@backstage/integration'; jest.mock('@backstage/plugin-catalog-react', () => ({ useEntity: () => { @@ -48,7 +49,20 @@ jest.mock('@backstage/plugin-catalog-react', () => ({ const errorApiMock = { post: jest.fn(), error$: jest.fn() }; -const configApi: ConfigApi = new ConfigReader({}); +const configApi: ConfigApi = new ConfigReader({ + integrations: { + github: [ + { + host: 'missing-api-base-url.com', + }, + { + host: 'my-github.com', + apiBaseUrl: 'https://api.my-github.com', + }, + ], + }, +}); +const scmIntegrationsApi = ScmIntegrations.fromConfig(configApi); const githubAuthApi: OAuthApi = { getAccessToken: async _ => 'access_token', }; @@ -56,7 +70,10 @@ const githubAuthApi: OAuthApi = { const apis = ApiRegistry.from([ [configApiRef, configApi], [errorApiRef, errorApiMock], - [githubDeploymentsApiRef, new GithubDeploymentsApiClient({ githubAuthApi })], + [ + githubDeploymentsApiRef, + new GithubDeploymentsApiClient({ scmIntegrationsApi, githubAuthApi }), + ], ]); describe('github-deployments', () => { @@ -159,5 +176,41 @@ describe('github-deployments', () => { ).toBeInTheDocument(); expect(await rendered.findByText('failure')).toBeInTheDocument(); }); + + it('shows error when host does not exist', async () => { + worker.use( + graphql.query('deployments', (_, res, ctx) => + res(ctx.data(responseStub)), + ), + ); + + const rendered = await renderInTestApp( + + + , + ); + + expect(await rendered.findByText( + 'Warning: No matching GitHub integration configuration for host unknown-host.com, please check your integrations config', + )).toBeInTheDocument(); + }); + + it('shows error when baseApiURL does not exist forr host', async () => { + worker.use( + graphql.query('deployments', (_, res, ctx) => + res(ctx.data(responseStub)), + ), + ); + + const rendered = await renderInTestApp( + + + , + ); + + expect(await rendered.findByText( + 'Warning: No apiBaseUrl available for host missing-api-base-url.com', + )).toBeInTheDocument(); + }); }); }); diff --git a/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx b/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx index 99dfba560a..691c63fcc3 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx +++ b/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx @@ -29,9 +29,11 @@ import { import GithubDeploymentsTable from './GithubDeploymentsTable/GithubDeploymentsTable'; const GithubDeploymentsComponent = ({ + host, projectSlug, last, }: { + host?: string; projectSlug: string; last: number; }) => { @@ -39,7 +41,7 @@ const GithubDeploymentsComponent = ({ const [owner, repo] = projectSlug.split('/'); const { loading, value, error, retry: reload } = useAsyncRetry( - async () => await api.listDeployments({ owner, repo, last }), + async () => await api.listDeployments({ host, owner, repo, last }), ); if (error) { @@ -55,7 +57,13 @@ const GithubDeploymentsComponent = ({ ); }; -export const GithubDeploymentsCard = ({ last }: { last?: number }) => { +export const GithubDeploymentsCard = ({ + last, + host, +}: { + last?: number; + host?: string; +}) => { const { entity } = useEntity(); return !isGithubDeploymentsAvailable(entity) ? ( @@ -66,6 +74,7 @@ export const GithubDeploymentsCard = ({ last }: { last?: number }) => { entity?.metadata.annotations?.[GITHUB_PROJECT_SLUG_ANNOTATION] || '' } last={last || 10} + host={host} /> ); }; diff --git a/plugins/github-deployments/src/plugin.ts b/plugins/github-deployments/src/plugin.ts index 3707b1cf68..943d5e0bc6 100644 --- a/plugins/github-deployments/src/plugin.ts +++ b/plugins/github-deployments/src/plugin.ts @@ -19,6 +19,7 @@ import { createPlugin, githubAuthApiRef, } from '@backstage/core'; +import { scmIntegrationsApiRef } from '@backstage/integration-react'; import { githubDeploymentsApiRef, GithubDeploymentsApiClient } from './api'; export const githubDeploymentsPlugin = createPlugin({ @@ -26,9 +27,12 @@ export const githubDeploymentsPlugin = createPlugin({ apis: [ createApiFactory({ api: githubDeploymentsApiRef, - deps: { githubAuthApi: githubAuthApiRef }, - factory: ({ githubAuthApi }) => - new GithubDeploymentsApiClient({ githubAuthApi }), + deps: { + scmIntegrationsApi: scmIntegrationsApiRef, + githubAuthApi: githubAuthApiRef, + }, + factory: ({ scmIntegrationsApi, githubAuthApi }) => + new GithubDeploymentsApiClient({ scmIntegrationsApi, githubAuthApi }), }), ], }); From f5a916c497671f9f47b44eb6ff56a3fa018c1104 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 6 Apr 2021 14:00:58 +0100 Subject: [PATCH 002/485] changeset and typo Signed-off-by: Andrew Johnson --- .changeset/smooth-vans-travel.md | 5 +++++ .../src/components/GithubDeploymentsCard.test.tsx | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/smooth-vans-travel.md diff --git a/.changeset/smooth-vans-travel.md b/.changeset/smooth-vans-travel.md new file mode 100644 index 0000000000..0038c35e8e --- /dev/null +++ b/.changeset/smooth-vans-travel.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-github-deployments': patch +--- + +Support for GitHub Enterprise with GithubDeploymentsPlugin diff --git a/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx b/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx index db0092caa8..a671e6a847 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx +++ b/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx @@ -195,7 +195,7 @@ describe('github-deployments', () => { )).toBeInTheDocument(); }); - it('shows error when baseApiURL does not exist forr host', async () => { + it('shows error when baseApiURL does not exist for host', async () => { worker.use( graphql.query('deployments', (_, res, ctx) => res(ctx.data(responseStub)), From 612a9c03399b74b9cad0f6d0c444f21548b78e19 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 6 Apr 2021 14:06:57 +0100 Subject: [PATCH 003/485] update readme Signed-off-by: Andrew Johnson --- plugins/github-deployments/README.md | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/plugins/github-deployments/README.md b/plugins/github-deployments/README.md index 174d1bc8c7..64ae9c66ca 100644 --- a/plugins/github-deployments/README.md +++ b/plugins/github-deployments/README.md @@ -60,3 +60,33 @@ spec: owner: CNCF lifecycle: experimental ``` + +### Self-hosted / Enterprise GitHub + +1. Add the `host` and `apiBaseUrl` to your `app-config.yaml` + +```yaml +# app-config.yaml + +integrations: + github: + - host: 'your-github-host.com' + apiBaseUrl: 'https://api.your-github-host.com' +``` + +2. Pass the host into the `EntityGithubDeploymentsCard` + +```typescript +// packages/app/src/components/catalog/EntityPage.tsx + +import { EntityGithubDeploymentsCard } from '@backstage/plugin-github-deployments'; + +const OverviewContent = () => ( + + // ... + + + + // ... + +); \ No newline at end of file From b4c269777b383e096ed7daae2559dcf234c95dde Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 6 Apr 2021 14:11:19 +0100 Subject: [PATCH 004/485] prettier Signed-off-by: Andrew Johnson --- plugins/github-deployments/README.md | 5 +++-- .../components/GithubDeploymentsCard.test.tsx | 16 ++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/plugins/github-deployments/README.md b/plugins/github-deployments/README.md index 64ae9c66ca..42f550059c 100644 --- a/plugins/github-deployments/README.md +++ b/plugins/github-deployments/README.md @@ -85,8 +85,9 @@ const OverviewContent = () => ( // ... - + // ... -); \ No newline at end of file +); +``` diff --git a/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx b/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx index a671e6a847..d7bc0dfcc8 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx +++ b/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx @@ -190,9 +190,11 @@ describe('github-deployments', () => { , ); - expect(await rendered.findByText( - 'Warning: No matching GitHub integration configuration for host unknown-host.com, please check your integrations config', - )).toBeInTheDocument(); + expect( + await rendered.findByText( + 'Warning: No matching GitHub integration configuration for host unknown-host.com, please check your integrations config', + ), + ).toBeInTheDocument(); }); it('shows error when baseApiURL does not exist for host', async () => { @@ -208,9 +210,11 @@ describe('github-deployments', () => { , ); - expect(await rendered.findByText( - 'Warning: No apiBaseUrl available for host missing-api-base-url.com', - )).toBeInTheDocument(); + expect( + await rendered.findByText( + 'Warning: No apiBaseUrl available for host missing-api-base-url.com', + ), + ).toBeInTheDocument(); }); }); }); From c05da9a5d9bb07ee0c21483d0c3960f8c23f2be9 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 8 Apr 2021 12:18:34 +0100 Subject: [PATCH 005/485] use location from entity Signed-off-by: Andrew Johnson --- plugins/github-deployments/src/api/index.ts | 49 +++-- .../components/GithubDeploymentsCard.test.tsx | 208 ++++++++++++------ .../src/components/GithubDeploymentsCard.tsx | 23 +- plugins/github-deployments/src/mocks/mocks.ts | 7 +- 4 files changed, 188 insertions(+), 99 deletions(-) diff --git a/plugins/github-deployments/src/api/index.ts b/plugins/github-deployments/src/api/index.ts index f239af9ef8..31e3defa47 100644 --- a/plugins/github-deployments/src/api/index.ts +++ b/plugins/github-deployments/src/api/index.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { parseLocationReference } from '@backstage/catalog-model'; import { createApiRef, OAuthApi } from '@backstage/core'; import { InputError } from '@backstage/errors'; import { ScmIntegrationRegistry } from '@backstage/integration'; @@ -20,25 +21,29 @@ import { graphql } from '@octokit/graphql'; const getBaseUrl = ( scmIntegrationsApi: ScmIntegrationRegistry, - host?: string, + location?: string, ): string => { - if (!host) { + if (!location) { return 'https://api.github.com'; } - const integrationConfig = scmIntegrationsApi.github.byHost(host); + const config = scmIntegrationsApi.github.byUrl( + parseLocationReference(location).target, + ); - if (!integrationConfig) { + if (!config) { throw new InputError( - `No matching GitHub integration configuration for host ${host}, please check your integrations config`, + `No matching GitHub integration configuration for location ${location}, please check your integrations config`, ); } - if (!integrationConfig.config.apiBaseUrl) { - throw new InputError(`No apiBaseUrl available for host ${host}`); + if (!config.config.apiBaseUrl) { + throw new InputError( + `No apiBaseUrl available for location ${location}, please check your integrations config`, + ); } - return integrationConfig.config.apiBaseUrl; + return config?.config.apiBaseUrl; }; export type GithubDeployment = { @@ -51,13 +56,17 @@ export type GithubDeployment = { }; }; +type QueryOptions = { + owner: string; + repo: string; + last: number; +}; + export interface GithubDeploymentsApi { - listDeployments(options: { - host?: string; - owner: string; - repo: string; - last: number; - }): Promise; + listDeployments( + options: QueryOptions, + location?: string, + ): Promise; } export const githubDeploymentsApiRef = createApiRef({ @@ -105,13 +114,11 @@ export class GithubDeploymentsApiClient implements GithubDeploymentsApi { this.scmIntegrationsApi = options.scmIntegrationsApi; } - async listDeployments(options: { - owner: string; - repo: string; - last: number; - host?: string; - }): Promise { - const baseUrl = getBaseUrl(this.scmIntegrationsApi, options.host); + async listDeployments( + options: QueryOptions, + location?: string, + ): Promise { + const baseUrl = getBaseUrl(this.scmIntegrationsApi, location); const token = await this.githubAuthApi.getAccessToken(['repo']); const graphQLWithAuth = graphql.defaults({ diff --git a/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx b/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx index d7bc0dfcc8..040a9b6571 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx +++ b/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx @@ -40,10 +40,13 @@ import { import { setupServer } from 'msw/node'; import { graphql } from 'msw'; import { ScmIntegrations } from '@backstage/integration'; +import { Entity } from '@backstage/catalog-model'; + +let entity: { entity: Entity }; jest.mock('@backstage/plugin-catalog-react', () => ({ useEntity: () => { - return entityStub; + return entity; }, })); @@ -53,15 +56,24 @@ const configApi: ConfigApi = new ConfigReader({ integrations: { github: [ { - host: 'missing-api-base-url.com', + host: 'my-github-1.com', + apiBaseUrl: 'https://api.my-github-1.com', }, { - host: 'my-github.com', - apiBaseUrl: 'https://api.my-github.com', + host: 'my-github-2.com', + apiBaseUrl: 'https://api.my-github-2.com', + }, + { + host: 'my-github-3.com', }, ], }, }); + +const GRAPHQL_GITHUB_API = graphql.link('https://api.github.com/graphql'); +const GRAPHQL_CUSTOM_API_1 = graphql.link('https://api.github-1.com/graphql'); +const GRAPHQL_CUSTOM_API_2 = graphql.link('https://api.github-2.com/graphql'); + const scmIntegrationsApi = ScmIntegrations.fromConfig(configApi); const githubAuthApi: OAuthApi = { getAccessToken: async _ => 'access_token', @@ -76,11 +88,36 @@ const apis = ApiRegistry.from([ ], ]); +const assertFetchedData = async () => { + const rendered = await renderInTestApp( + + + , + ); + + expect(await rendered.findByText('GitHub Deployments')).toBeInTheDocument(); + + expect(await rendered.findByText('active')).toBeInTheDocument(); + expect(await rendered.findByText('prd')).toBeInTheDocument(); + expect(await rendered.findByText('12345')).toHaveAttribute( + 'href', + 'https://exampleapi.com/123456789', + ); + + expect(await rendered.findByText('pending')).toBeInTheDocument(); + expect(await rendered.findByText('lab')).toBeInTheDocument(); + expect(await rendered.findByText('54321')).toHaveAttribute( + 'href', + 'https://exampleapi.com/543212345', + ); +}; + describe('github-deployments', () => { const worker = setupServer(); msw.setupDefaultHandlers(worker); beforeEach(() => { + worker.resetHandlers(); jest.resetAllMocks(); }); @@ -91,40 +128,27 @@ describe('github-deployments', () => { }); describe('GithubDeploymentsCard', () => { - it('should display fetched data', async () => { + beforeEach(() => { + entity = entityStub; + entity.entity.metadata.annotations = { + 'github.com/project-slug': 'org/repo', + }; + }); + + it('displays fetched data using default github api', async () => { worker.use( - graphql.query('deployments', (_, res, ctx) => + GRAPHQL_GITHUB_API.query('deployments', (_, res, ctx) => res(ctx.data(responseStub)), ), ); - const rendered = await renderInTestApp( - - - , - ); - - expect( - await rendered.findByText('GitHub Deployments'), - ).toBeInTheDocument(); - expect(await rendered.findByText('active')).toBeInTheDocument(); - expect(await rendered.findByText('prd')).toBeInTheDocument(); - expect(await rendered.findByText('12345')).toHaveAttribute( - 'href', - 'https://exampleapi.com/123456789', - ); - - expect(await rendered.findByText('pending')).toBeInTheDocument(); - expect(await rendered.findByText('lab')).toBeInTheDocument(); - expect(await rendered.findByText('54321')).toHaveAttribute( - 'href', - 'https://exampleapi.com/543212345', - ); + await assertFetchedData(); + expect.assertions(7); }); it('should display empty state when no data', async () => { worker.use( - graphql.query('deployments', (_, res, ctx) => + GRAPHQL_GITHUB_API.query('deployments', (_, res, ctx) => res(ctx.data(noDataResponseStub)), ), ); @@ -145,7 +169,7 @@ describe('github-deployments', () => { it('should shows new data on reload', async () => { worker.use( - graphql.query('deployments', (_, res, ctx) => + GRAPHQL_GITHUB_API.query('deployments', (_, res, ctx) => res(ctx.data(responseStub)), ), ); @@ -163,7 +187,7 @@ describe('github-deployments', () => { worker.resetHandlers(); worker.use( - graphql.query('deployments', (_, res, ctx) => + GRAPHQL_GITHUB_API.query('deployments', (_, res, ctx) => res(ctx.data(refreshedResponseStub)), ), ); @@ -177,44 +201,102 @@ describe('github-deployments', () => { expect(await rendered.findByText('failure')).toBeInTheDocument(); }); - it('shows error when host does not exist', async () => { - worker.use( - graphql.query('deployments', (_, res, ctx) => - res(ctx.data(responseStub)), - ), - ); + describe('entity with source location', () => { + beforeEach(() => { + entity = entityStub; + entity.entity.metadata.annotations = { + 'github.com/project-slug': 'org/repo', + 'backstage.io/source-location': + 'url:https://my-github-1.com/org/repo', + }; + }); - const rendered = await renderInTestApp( - - - , - ); + it('should fetch data using custom api', async () => { + const customAPI = graphql.link('https://api.my-github-1.com/graphql'); - expect( - await rendered.findByText( - 'Warning: No matching GitHub integration configuration for host unknown-host.com, please check your integrations config', - ), - ).toBeInTheDocument(); + worker.use( + customAPI.query('deployments', (_, res, ctx) => + res(ctx.data(responseStub)), + ), + ); + + await assertFetchedData(); + expect.assertions(7); + }); }); - it('shows error when baseApiURL does not exist for host', async () => { - worker.use( - graphql.query('deployments', (_, res, ctx) => - res(ctx.data(responseStub)), - ), - ); + describe('entity with managed by location', () => { + beforeEach(() => { + entity = entityStub; + entity.entity.metadata.annotations = { + 'github.com/project-slug': 'org/repo', + 'backstage.io/managed-by-location': + 'url:https://my-github-2.com/org/repo', + }; + }); - const rendered = await renderInTestApp( - - - , - ); + it('should fetch data using custom api', async () => { + const customAPI = graphql.link('https://api.my-github-2.com/graphql'); - expect( - await rendered.findByText( - 'Warning: No apiBaseUrl available for host missing-api-base-url.com', - ), - ).toBeInTheDocument(); + worker.use( + customAPI.query('deployments', (_, res, ctx) => + res(ctx.data(responseStub)), + ), + ); + + await assertFetchedData(); + expect.assertions(7); + }); + }); + + describe('entity with location without baseApiURL', () => { + beforeEach(() => { + entity = entityStub; + entity.entity.metadata.annotations = { + 'github.com/project-slug': 'org/repo', + 'backstage.io/managed-by-location': + 'url:https://my-github-3.com/org/repo', + }; + }); + + it('shows error when no matching github host', async () => { + const rendered = await renderInTestApp( + + + , + ); + + expect( + await rendered.findByText( + 'Warning: No apiBaseUrl available for location url:https://my-github-3.com/org/repo, please check your integrations config', + ), + ).toBeInTheDocument(); + }); + }); + + describe('entity with location without matching host', () => { + beforeEach(() => { + entity = entityStub; + entity.entity.metadata.annotations = { + 'github.com/project-slug': 'org/repo', + 'backstage.io/managed-by-location': + 'url:https://my-github-unknown.com/org/repo', + }; + }); + + it('shows error when no matching github host', async () => { + const rendered = await renderInTestApp( + + + , + ); + + expect( + await rendered.findByText( + 'Warning: No matching GitHub integration configuration for location url:https://my-github-unknown.com/org/repo, please check your integrations config', + ), + ).toBeInTheDocument(); + }); }); }); }); diff --git a/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx b/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx index 691c63fcc3..f7ba6293ee 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx +++ b/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx @@ -27,21 +27,25 @@ import { isGithubDeploymentsAvailable, } from '../Router'; import GithubDeploymentsTable from './GithubDeploymentsTable/GithubDeploymentsTable'; +import { + LOCATION_ANNOTATION, + SOURCE_LOCATION_ANNOTATION, +} from '@backstage/catalog-model'; const GithubDeploymentsComponent = ({ - host, projectSlug, last, + location, }: { - host?: string; projectSlug: string; last: number; + location?: string; }) => { const api = useApi(githubDeploymentsApiRef); const [owner, repo] = projectSlug.split('/'); const { loading, value, error, retry: reload } = useAsyncRetry( - async () => await api.listDeployments({ host, owner, repo, last }), + async () => await api.listDeployments({ owner, repo, last }, location), ); if (error) { @@ -57,14 +61,11 @@ const GithubDeploymentsComponent = ({ ); }; -export const GithubDeploymentsCard = ({ - last, - host, -}: { - last?: number; - host?: string; -}) => { +export const GithubDeploymentsCard = ({ last }: { last?: number }) => { const { entity } = useEntity(); + const location = + entity?.metadata.annotations?.[SOURCE_LOCATION_ANNOTATION] || + entity?.metadata.annotations?.[LOCATION_ANNOTATION]; return !isGithubDeploymentsAvailable(entity) ? ( @@ -74,7 +75,7 @@ export const GithubDeploymentsCard = ({ entity?.metadata.annotations?.[GITHUB_PROJECT_SLUG_ANNOTATION] || '' } last={last || 10} - host={host} + location={location} /> ); }; diff --git a/plugins/github-deployments/src/mocks/mocks.ts b/plugins/github-deployments/src/mocks/mocks.ts index f636a08558..9e10e6c289 100644 --- a/plugins/github-deployments/src/mocks/mocks.ts +++ b/plugins/github-deployments/src/mocks/mocks.ts @@ -13,15 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { Entity } from '@backstage/catalog-model'; import { QueryResponse } from '../api'; -export const entityStub = { +export const entityStub: { entity: Entity } = { entity: { metadata: { namespace: 'default', - annotations: { - 'github.com/project-slug': 'org/repo', - }, + annotations: {}, name: 'sample-service', description: 'Sample service', uid: 'g0h33dd9-56h7-835b-b63v-7x5da3j64851', From ebce9fdbeef552544540a0c304c6aa85860d5524 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 8 Apr 2021 12:30:13 +0100 Subject: [PATCH 006/485] update test Signed-off-by: Andrew Johnson --- plugins/github-deployments/src/api/index.ts | 20 +++++--- .../components/GithubDeploymentsCard.test.tsx | 50 ++++++++++++++----- .../src/components/GithubDeploymentsCard.tsx | 15 +++--- 3 files changed, 57 insertions(+), 28 deletions(-) diff --git a/plugins/github-deployments/src/api/index.ts b/plugins/github-deployments/src/api/index.ts index 31e3defa47..221eb3be8a 100644 --- a/plugins/github-deployments/src/api/index.ts +++ b/plugins/github-deployments/src/api/index.ts @@ -21,15 +21,19 @@ import { graphql } from '@octokit/graphql'; const getBaseUrl = ( scmIntegrationsApi: ScmIntegrationRegistry, - location?: string, + locations: string[], ): string => { - if (!location) { + const targets = locations + .map(parseLocationReference) + .filter(location => location.type === 'url') + .map(location => location.target); + + if (targets.length === 0) { return 'https://api.github.com'; } - const config = scmIntegrationsApi.github.byUrl( - parseLocationReference(location).target, - ); + const location = targets[0]; + const config = scmIntegrationsApi.github.byUrl(location); if (!config) { throw new InputError( @@ -65,7 +69,7 @@ type QueryOptions = { export interface GithubDeploymentsApi { listDeployments( options: QueryOptions, - location?: string, + location: string[], ): Promise; } @@ -116,9 +120,9 @@ export class GithubDeploymentsApiClient implements GithubDeploymentsApi { async listDeployments( options: QueryOptions, - location?: string, + locations: string[], ): Promise { - const baseUrl = getBaseUrl(this.scmIntegrationsApi, location); + const baseUrl = getBaseUrl(this.scmIntegrationsApi, locations); const token = await this.githubAuthApi.getAccessToken(['repo']); const graphQLWithAuth = graphql.defaults({ diff --git a/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx b/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx index 040a9b6571..d2f6b1c4b6 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx +++ b/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx @@ -71,8 +71,12 @@ const configApi: ConfigApi = new ConfigReader({ }); const GRAPHQL_GITHUB_API = graphql.link('https://api.github.com/graphql'); -const GRAPHQL_CUSTOM_API_1 = graphql.link('https://api.github-1.com/graphql'); -const GRAPHQL_CUSTOM_API_2 = graphql.link('https://api.github-2.com/graphql'); +const GRAPHQL_CUSTOM_API_1 = graphql.link( + 'https://api.my-github-1.com/graphql', +); +const GRAPHQL_CUSTOM_API_2 = graphql.link( + 'https://api.my-github-2.com/graphql', +); const scmIntegrationsApi = ScmIntegrations.fromConfig(configApi); const githubAuthApi: OAuthApi = { @@ -167,7 +171,7 @@ describe('github-deployments', () => { ).toBeInTheDocument(); }); - it('should shows new data on reload', async () => { + it('should show new data on reload', async () => { worker.use( GRAPHQL_GITHUB_API.query('deployments', (_, res, ctx) => res(ctx.data(responseStub)), @@ -212,10 +216,8 @@ describe('github-deployments', () => { }); it('should fetch data using custom api', async () => { - const customAPI = graphql.link('https://api.my-github-1.com/graphql'); - worker.use( - customAPI.query('deployments', (_, res, ctx) => + GRAPHQL_CUSTOM_API_1.query('deployments', (_, res, ctx) => res(ctx.data(responseStub)), ), ); @@ -236,10 +238,8 @@ describe('github-deployments', () => { }); it('should fetch data using custom api', async () => { - const customAPI = graphql.link('https://api.my-github-2.com/graphql'); - worker.use( - customAPI.query('deployments', (_, res, ctx) => + GRAPHQL_CUSTOM_API_2.query('deployments', (_, res, ctx) => res(ctx.data(responseStub)), ), ); @@ -259,7 +259,7 @@ describe('github-deployments', () => { }; }); - it('shows error when no matching github host', async () => { + it('shows no apiBaseUrl error', async () => { const rendered = await renderInTestApp( @@ -268,7 +268,7 @@ describe('github-deployments', () => { expect( await rendered.findByText( - 'Warning: No apiBaseUrl available for location url:https://my-github-3.com/org/repo, please check your integrations config', + 'Warning: No apiBaseUrl available for location https://my-github-3.com/org/repo, please check your integrations config', ), ).toBeInTheDocument(); }); @@ -284,7 +284,7 @@ describe('github-deployments', () => { }; }); - it('shows error when no matching github host', async () => { + it('shows no matching host error', async () => { const rendered = await renderInTestApp( @@ -293,10 +293,34 @@ describe('github-deployments', () => { expect( await rendered.findByText( - 'Warning: No matching GitHub integration configuration for location url:https://my-github-unknown.com/org/repo, please check your integrations config', + 'Warning: No matching GitHub integration configuration for location https://my-github-unknown.com/org/repo, please check your integrations config', ), ).toBeInTheDocument(); }); }); + + describe('entity with non url location', () => { + beforeEach(() => { + entity = entityStub; + entity.entity.metadata.annotations = { + 'github.com/project-slug': 'org/repo', + 'backstage.io/source-location': + 'some-other-managed-location:my-favourite-location/org/repo', + 'backstage.io/managed-by-location': + 'file:my-favourite-file/org/repo.yaml', + }; + }); + + it('displays fetched data using default github api', async () => { + worker.use( + GRAPHQL_GITHUB_API.query('deployments', (_, res, ctx) => + res(ctx.data(responseStub)), + ), + ); + + await assertFetchedData(); + expect.assertions(7); + }); + }); }); }); diff --git a/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx b/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx index f7ba6293ee..eccab4089a 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx +++ b/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx @@ -35,17 +35,17 @@ import { const GithubDeploymentsComponent = ({ projectSlug, last, - location, + locations, }: { projectSlug: string; last: number; - location?: string; + locations: string[]; }) => { const api = useApi(githubDeploymentsApiRef); const [owner, repo] = projectSlug.split('/'); const { loading, value, error, retry: reload } = useAsyncRetry( - async () => await api.listDeployments({ owner, repo, last }, location), + async () => await api.listDeployments({ owner, repo, last }, locations), ); if (error) { @@ -63,9 +63,10 @@ const GithubDeploymentsComponent = ({ export const GithubDeploymentsCard = ({ last }: { last?: number }) => { const { entity } = useEntity(); - const location = - entity?.metadata.annotations?.[SOURCE_LOCATION_ANNOTATION] || - entity?.metadata.annotations?.[LOCATION_ANNOTATION]; + const locations = [ + entity?.metadata.annotations?.[SOURCE_LOCATION_ANNOTATION], + entity?.metadata.annotations?.[LOCATION_ANNOTATION], + ].filter(location => location !== undefined) as string[]; return !isGithubDeploymentsAvailable(entity) ? ( @@ -75,7 +76,7 @@ export const GithubDeploymentsCard = ({ last }: { last?: number }) => { entity?.metadata.annotations?.[GITHUB_PROJECT_SLUG_ANNOTATION] || '' } last={last || 10} - location={location} + locations={locations} /> ); }; From 2842e953f42d2df618c80aa8281221692b484f93 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 8 Apr 2021 16:37:22 +0100 Subject: [PATCH 007/485] as per feedback Signed-off-by: Andrew Johnson --- .changeset/smooth-vans-travel.md | 2 +- plugins/github-deployments/README.md | 21 +++---------------- plugins/github-deployments/package.json | 8 +++---- plugins/github-deployments/src/api/index.ts | 14 ++++++++----- .../src/components/GithubDeploymentsCard.tsx | 2 +- 5 files changed, 18 insertions(+), 29 deletions(-) diff --git a/.changeset/smooth-vans-travel.md b/.changeset/smooth-vans-travel.md index 0038c35e8e..eb074c8ecf 100644 --- a/.changeset/smooth-vans-travel.md +++ b/.changeset/smooth-vans-travel.md @@ -1,5 +1,5 @@ --- -'@backstage/plugin-github-deployments': patch +'@backstage/plugin-github-deployments': minor --- Support for GitHub Enterprise with GithubDeploymentsPlugin diff --git a/plugins/github-deployments/README.md b/plugins/github-deployments/README.md index 42f550059c..e1f3d7c2c0 100644 --- a/plugins/github-deployments/README.md +++ b/plugins/github-deployments/README.md @@ -63,6 +63,9 @@ spec: ### Self-hosted / Enterprise GitHub +The plugin will try to use `backstage.io/source-location` or `backstage.io/managed-by-location` +annotations to figure out the location of the source code. + 1. Add the `host` and `apiBaseUrl` to your `app-config.yaml` ```yaml @@ -73,21 +76,3 @@ integrations: - host: 'your-github-host.com' apiBaseUrl: 'https://api.your-github-host.com' ``` - -2. Pass the host into the `EntityGithubDeploymentsCard` - -```typescript -// packages/app/src/components/catalog/EntityPage.tsx - -import { EntityGithubDeploymentsCard } from '@backstage/plugin-github-deployments'; - -const OverviewContent = () => ( - - // ... - - - - // ... - -); -``` diff --git a/plugins/github-deployments/package.json b/plugins/github-deployments/package.json index 528d660ea8..39c7577bb5 100644 --- a/plugins/github-deployments/package.json +++ b/plugins/github-deployments/package.json @@ -20,8 +20,8 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.7.4", - "@backstage/core": "^0.7.3", + "@backstage/catalog-model": "^0.7.6", + "@backstage/core": "^0.7.4", "@backstage/errors": "^0.1.1", "@backstage/integration": "^0.5.1", "@backstage/integration-react": "^0.1.1", @@ -37,9 +37,9 @@ "react-use": "^15.3.3" }, "devDependencies": { - "@backstage/cli": "^0.6.6", + "@backstage/cli": "^0.6.7", "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.9", + "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^12.0.7", diff --git a/plugins/github-deployments/src/api/index.ts b/plugins/github-deployments/src/api/index.ts index 221eb3be8a..0deb586e6d 100644 --- a/plugins/github-deployments/src/api/index.ts +++ b/plugins/github-deployments/src/api/index.ts @@ -60,16 +60,20 @@ export type GithubDeployment = { }; }; -type QueryOptions = { +type QueryParams = { owner: string; repo: string; last: number; }; +type QueryOptions = { + locations: string[]; +}; + export interface GithubDeploymentsApi { listDeployments( + params: QueryParams, options: QueryOptions, - location: string[], ): Promise; } @@ -119,10 +123,10 @@ export class GithubDeploymentsApiClient implements GithubDeploymentsApi { } async listDeployments( + params: QueryParams, options: QueryOptions, - locations: string[], ): Promise { - const baseUrl = getBaseUrl(this.scmIntegrationsApi, locations); + const baseUrl = getBaseUrl(this.scmIntegrationsApi, options.locations); const token = await this.githubAuthApi.getAccessToken(['repo']); const graphQLWithAuth = graphql.defaults({ @@ -134,7 +138,7 @@ export class GithubDeploymentsApiClient implements GithubDeploymentsApi { const response: QueryResponse = await graphQLWithAuth( deploymentsQuery, - options, + params, ); return response.repository?.deployments?.nodes?.reverse() || []; } diff --git a/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx b/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx index eccab4089a..fb433338fa 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx +++ b/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx @@ -45,7 +45,7 @@ const GithubDeploymentsComponent = ({ const [owner, repo] = projectSlug.split('/'); const { loading, value, error, retry: reload } = useAsyncRetry( - async () => await api.listDeployments({ owner, repo, last }, locations), + async () => await api.listDeployments({ owner, repo, last }, { locations }), ); if (error) { From 5d8339cfee72a399a748e80b025f40009d409559 Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 9 Apr 2021 14:26:37 +0200 Subject: [PATCH 008/485] some more tests Signed-off-by: blam --- cypress/cypress.json | 2 +- cypress/src/integration/integrations.ts | 45 +++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 cypress/src/integration/integrations.ts diff --git a/cypress/cypress.json b/cypress/cypress.json index ebbbe59901..59f7516c47 100644 --- a/cypress/cypress.json +++ b/cypress/cypress.json @@ -1,5 +1,5 @@ { - "baseUrl": "http://localhost:7000", + "baseUrl": "http://localhost:3000", "integrationFolder": "./src/integration", "supportFile": "./src/support", "fixturesFolder": "./src/fixures", diff --git a/cypress/src/integration/integrations.ts b/cypress/src/integration/integrations.ts new file mode 100644 index 0000000000..76d0b6b28a --- /dev/null +++ b/cypress/src/integration/integrations.ts @@ -0,0 +1,45 @@ +/* + * 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 'os'; + +describe('Integrations', () => { + describe('ReadTree', () => { + // it('should work for azure', () => { + // cy.loginAsGuest(); + + // cy.visit('/catalog-import'); + + // cy.get('input[name=url]').type( + // 'https://dev.azure.com/backstage-verification/_git/test-repo?path=%2Fnested%2F*', + // ); + + // cy.contains('Analyze').click(); + // }); + + it('should work for github', () => { + cy.loginAsGuest(); + + cy.visit('/catalog-import'); + + cy.get('input[name=url]').type( + 'https://github.com/backstage-verification/test-repo', + ); + + cy.contains('Analyze').click(); + }); + }); +}); From 382531e50195a22cbde71b91e2107a184a40b09c Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 12 Apr 2021 10:21:42 +0200 Subject: [PATCH 009/485] chore: more work towards fixing Signed-off-by: blam --- cypress/src/integration/integrations.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cypress/src/integration/integrations.ts b/cypress/src/integration/integrations.ts index 76d0b6b28a..839159d34e 100644 --- a/cypress/src/integration/integrations.ts +++ b/cypress/src/integration/integrations.ts @@ -38,6 +38,11 @@ describe('Integrations', () => { cy.get('input[name=url]').type( 'https://github.com/backstage-verification/test-repo', ); + cy.request('/api/catalog/locations', { + target: + 'https://github.com/backstage-verification/test-repo/blob/main/**/*', + type: 'url', + }); cy.contains('Analyze').click(); }); From ce1749f2d64f7a4899d992820410fa6b1a33ab3e Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Mon, 12 Apr 2021 18:31:35 +0200 Subject: [PATCH 010/485] Migrate ReleaseManagerAsAService to BOSS Signed-off-by: Erik Engervall --- .../plugins/release-manager-as-a-service.yaml | 9 + .../img/release-manager-as-a-service-logo.svg | 13 + packages/app/package.json | 1 + packages/app/src/plugins.ts | 1 + .../release-manager-as-a-service/.eslintrc.js | 3 + .../release-manager-as-a-service/README.md | 45 + .../dev/README.md | 13 + .../dev/index.tsx | 55 + .../release-manager-as-a-service/package.json | 51 + .../src/ReleaseManagerAsAService.tsx | 179 ++ .../src/api/PluginApiClientConfig.ts | 51 + .../src/api/RMaaSApiClient.ts | 412 ++++ .../src/api/serviceApiRef.ts | 26 + .../src/cards/createRc/CreateRc.test.tsx | 67 + .../src/cards/createRc/CreateRc.tsx | 205 ++ .../src/cards/createRc/getRcGheInfo.test.ts | 88 + .../src/cards/createRc/getRcGheInfo.ts | 60 + .../createRc/sideEffects/createGheRc.test.ts | 59 + .../cards/createRc/sideEffects/createGheRc.ts | 129 ++ .../src/cards/info/Info.test.tsx | 38 + .../src/cards/info/Info.tsx | 133 ++ .../src/cards/info/rmaas-flow.png | Bin 0 -> 77527 bytes .../src/cards/patchRc/Patch.test.tsx | 41 + .../src/cards/patchRc/Patch.tsx | 81 + .../src/cards/patchRc/PatchBody.test.tsx | 77 + .../src/cards/patchRc/PatchBody.tsx | 301 +++ .../cards/patchRc/sideEffects/patch.test.ts | 75 + .../src/cards/patchRc/sideEffects/patch.ts | 194 ++ .../src/cards/promoteRc/PromoteRc.test.tsx | 61 + .../src/cards/promoteRc/PromoteRc.tsx | 80 + .../cards/promoteRc/PromoteRcBody.test.tsx | 35 + .../src/cards/promoteRc/PromoteRcBody.tsx | 100 + .../sideEffects/promoteGheRc.test.ts | 42 + .../promoteRc/sideEffects/promoteGheRc.ts | 60 + .../src/components/Differ.tsx | 79 + .../src/components/Divider.test.tsx | 28 + .../src/components/Divider.tsx | 27 + .../src/components/InfoCardPlus.test.tsx | 28 + .../src/components/InfoCardPlus.tsx | 39 + .../src/components/NoLatestRelease.test.tsx | 30 + .../src/components/NoLatestRelease.tsx | 34 + .../src/components/ProjectContext.ts | 33 + .../src/components/ReloadButton.test.tsx | 28 + .../src/components/ReloadButton.tsx | 35 + .../ResponseStepList.test.tsx | 65 + .../ResponseStepList/ResponseStepList.tsx | 113 + .../ResponseStepListItem.test.tsx | 96 + .../ResponseStepList/ResponseStepListItem.tsx | 135 ++ .../src/constants/constants.test.ts | 30 + .../src/constants/constants.ts | 24 + .../errors/ReleaseManagerAsAServiceError.ts | 22 + .../src/helpers/date.test.ts | 26 + .../src/helpers/date.ts | 16 + .../src/helpers/getBumpedTag.test.ts | 124 ++ .../src/helpers/getBumpedTag.ts | 94 + .../src/helpers/getShortCommitHash.test.ts | 33 + .../src/helpers/getShortCommitHash.ts | 28 + .../src/helpers/isCalverTagParts.test.ts | 32 + .../src/helpers/isCalverTagParts.ts | 24 + .../src/helpers/tagParts/getCalverTagParts.ts | 40 + .../src/helpers/tagParts/getSemverTagParts.ts | 40 + .../src/helpers/tagParts/getTagParts.test.ts | 112 + .../src/helpers/tagParts/getTagParts.ts | 32 + .../release-manager-as-a-service/src/index.ts | 19 + .../src/plugin.test.ts | 22 + .../src/plugin.ts | 54 + .../src/routes.ts | 20 + .../src/setupTests.ts | 17 + .../src/sideEffects/getGitHubBatchInfo.ts | 48 + .../src/sideEffects/getLatestRelease.test.ts | 42 + .../src/sideEffects/getLatestRelease.ts | 34 + .../src/styles/styles.ts | 22 + .../src/test-helpers/test-helpers.test.ts | 165 ++ .../src/test-helpers/test-helpers.ts | 255 +++ .../src/test-helpers/test-ids.ts | 53 + .../src/types/types.ts | 1939 +++++++++++++++++ yarn.lock | 5 + 77 files changed, 6927 insertions(+) create mode 100644 microsite/data/plugins/release-manager-as-a-service.yaml create mode 100644 microsite/static/img/release-manager-as-a-service-logo.svg create mode 100644 plugins/release-manager-as-a-service/.eslintrc.js create mode 100644 plugins/release-manager-as-a-service/README.md create mode 100644 plugins/release-manager-as-a-service/dev/README.md create mode 100644 plugins/release-manager-as-a-service/dev/index.tsx create mode 100644 plugins/release-manager-as-a-service/package.json create mode 100644 plugins/release-manager-as-a-service/src/ReleaseManagerAsAService.tsx create mode 100644 plugins/release-manager-as-a-service/src/api/PluginApiClientConfig.ts create mode 100644 plugins/release-manager-as-a-service/src/api/RMaaSApiClient.ts create mode 100644 plugins/release-manager-as-a-service/src/api/serviceApiRef.ts create mode 100644 plugins/release-manager-as-a-service/src/cards/createRc/CreateRc.test.tsx create mode 100644 plugins/release-manager-as-a-service/src/cards/createRc/CreateRc.tsx create mode 100644 plugins/release-manager-as-a-service/src/cards/createRc/getRcGheInfo.test.ts create mode 100644 plugins/release-manager-as-a-service/src/cards/createRc/getRcGheInfo.ts create mode 100644 plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createGheRc.test.ts create mode 100644 plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createGheRc.ts create mode 100644 plugins/release-manager-as-a-service/src/cards/info/Info.test.tsx create mode 100644 plugins/release-manager-as-a-service/src/cards/info/Info.tsx create mode 100644 plugins/release-manager-as-a-service/src/cards/info/rmaas-flow.png create mode 100644 plugins/release-manager-as-a-service/src/cards/patchRc/Patch.test.tsx create mode 100644 plugins/release-manager-as-a-service/src/cards/patchRc/Patch.tsx create mode 100644 plugins/release-manager-as-a-service/src/cards/patchRc/PatchBody.test.tsx create mode 100644 plugins/release-manager-as-a-service/src/cards/patchRc/PatchBody.tsx create mode 100644 plugins/release-manager-as-a-service/src/cards/patchRc/sideEffects/patch.test.ts create mode 100644 plugins/release-manager-as-a-service/src/cards/patchRc/sideEffects/patch.ts create mode 100644 plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRc.test.tsx create mode 100644 plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRc.tsx create mode 100644 plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRcBody.test.tsx create mode 100644 plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRcBody.tsx create mode 100644 plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteGheRc.test.ts create mode 100644 plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteGheRc.ts create mode 100644 plugins/release-manager-as-a-service/src/components/Differ.tsx create mode 100644 plugins/release-manager-as-a-service/src/components/Divider.test.tsx create mode 100644 plugins/release-manager-as-a-service/src/components/Divider.tsx create mode 100644 plugins/release-manager-as-a-service/src/components/InfoCardPlus.test.tsx create mode 100644 plugins/release-manager-as-a-service/src/components/InfoCardPlus.tsx create mode 100644 plugins/release-manager-as-a-service/src/components/NoLatestRelease.test.tsx create mode 100644 plugins/release-manager-as-a-service/src/components/NoLatestRelease.tsx create mode 100644 plugins/release-manager-as-a-service/src/components/ProjectContext.ts create mode 100644 plugins/release-manager-as-a-service/src/components/ReloadButton.test.tsx create mode 100644 plugins/release-manager-as-a-service/src/components/ReloadButton.tsx create mode 100644 plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepList.test.tsx create mode 100644 plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepList.tsx create mode 100644 plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepListItem.test.tsx create mode 100644 plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepListItem.tsx create mode 100644 plugins/release-manager-as-a-service/src/constants/constants.test.ts create mode 100644 plugins/release-manager-as-a-service/src/constants/constants.ts create mode 100644 plugins/release-manager-as-a-service/src/errors/ReleaseManagerAsAServiceError.ts create mode 100644 plugins/release-manager-as-a-service/src/helpers/date.test.ts create mode 100644 plugins/release-manager-as-a-service/src/helpers/date.ts create mode 100644 plugins/release-manager-as-a-service/src/helpers/getBumpedTag.test.ts create mode 100644 plugins/release-manager-as-a-service/src/helpers/getBumpedTag.ts create mode 100644 plugins/release-manager-as-a-service/src/helpers/getShortCommitHash.test.ts create mode 100644 plugins/release-manager-as-a-service/src/helpers/getShortCommitHash.ts create mode 100644 plugins/release-manager-as-a-service/src/helpers/isCalverTagParts.test.ts create mode 100644 plugins/release-manager-as-a-service/src/helpers/isCalverTagParts.ts create mode 100644 plugins/release-manager-as-a-service/src/helpers/tagParts/getCalverTagParts.ts create mode 100644 plugins/release-manager-as-a-service/src/helpers/tagParts/getSemverTagParts.ts create mode 100644 plugins/release-manager-as-a-service/src/helpers/tagParts/getTagParts.test.ts create mode 100644 plugins/release-manager-as-a-service/src/helpers/tagParts/getTagParts.ts create mode 100644 plugins/release-manager-as-a-service/src/index.ts create mode 100644 plugins/release-manager-as-a-service/src/plugin.test.ts create mode 100644 plugins/release-manager-as-a-service/src/plugin.ts create mode 100644 plugins/release-manager-as-a-service/src/routes.ts create mode 100644 plugins/release-manager-as-a-service/src/setupTests.ts create mode 100644 plugins/release-manager-as-a-service/src/sideEffects/getGitHubBatchInfo.ts create mode 100644 plugins/release-manager-as-a-service/src/sideEffects/getLatestRelease.test.ts create mode 100644 plugins/release-manager-as-a-service/src/sideEffects/getLatestRelease.ts create mode 100644 plugins/release-manager-as-a-service/src/styles/styles.ts create mode 100644 plugins/release-manager-as-a-service/src/test-helpers/test-helpers.test.ts create mode 100644 plugins/release-manager-as-a-service/src/test-helpers/test-helpers.ts create mode 100644 plugins/release-manager-as-a-service/src/test-helpers/test-ids.ts create mode 100644 plugins/release-manager-as-a-service/src/types/types.ts diff --git a/microsite/data/plugins/release-manager-as-a-service.yaml b/microsite/data/plugins/release-manager-as-a-service.yaml new file mode 100644 index 0000000000..08138f6d3b --- /dev/null +++ b/microsite/data/plugins/release-manager-as-a-service.yaml @@ -0,0 +1,9 @@ +--- +title: Release Manager as a Service +author: '@erikengervall' +authorUrl: https://github.com/erikengervall +category: Release management +description: Manage releases without having to juggle git commands +documentation: https://github.com/backstage/backstage/tree/master/plugins/release-manager-as-a-service +iconUrl: img/release-manager-as-a-service.svg +npmPackageName: '@backstage/plugin-release-manager-as-a-service' diff --git a/microsite/static/img/release-manager-as-a-service-logo.svg b/microsite/static/img/release-manager-as-a-service-logo.svg new file mode 100644 index 0000000000..b505d21560 --- /dev/null +++ b/microsite/static/img/release-manager-as-a-service-logo.svg @@ -0,0 +1,13 @@ + + + Export + + + + + + + + + + \ No newline at end of file diff --git a/packages/app/package.json b/packages/app/package.json index e5dbbaa5ff..26d5c36ab6 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -30,6 +30,7 @@ "@backstage/plugin-org": "^0.3.10", "@backstage/plugin-pagerduty": "0.3.2", "@backstage/plugin-register-component": "^0.2.12", + "@backstage/plugin-release-manager-as-a-service": "^0.1.1", "@backstage/plugin-rollbar": "^0.3.3", "@backstage/plugin-scaffolder": "^0.8.0", "@backstage/plugin-search": "^0.3.4", diff --git a/packages/app/src/plugins.ts b/packages/app/src/plugins.ts index ccc7e2a45c..bedd533e69 100644 --- a/packages/app/src/plugins.ts +++ b/packages/app/src/plugins.ts @@ -46,3 +46,4 @@ export { plugin as Kafka } from '@backstage/plugin-kafka'; export { todoPlugin } from '@backstage/plugin-todo'; export { badgesPlugin } from '@backstage/plugin-badges'; export { githubDeploymentsPlugin } from '@backstage/plugin-github-deployments'; +export { releaseManagerAsAServicePlugin } from '@backstage/plugin-release-manager-as-a-service'; diff --git a/plugins/release-manager-as-a-service/.eslintrc.js b/plugins/release-manager-as-a-service/.eslintrc.js new file mode 100644 index 0000000000..13573efa9c --- /dev/null +++ b/plugins/release-manager-as-a-service/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + extends: [require.resolve('@backstage/cli/config/eslint')], +}; diff --git a/plugins/release-manager-as-a-service/README.md b/plugins/release-manager-as-a-service/README.md new file mode 100644 index 0000000000..cdd50d35c6 --- /dev/null +++ b/plugins/release-manager-as-a-service/README.md @@ -0,0 +1,45 @@ +# Release Manager as a Service (RMaaS) + +## Overview + +`RMaaS` enables developers to manage their releases without having to juggle git commands. + +Does it bundle and ship your code? **No**. + +What `RMaaS` does is manage your **[releases](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/managing-releases-in-a-repository)** on GitHub, building and shipping is entirely up to you as a developer to handle in your CI. + +`RMaaS` is build with industry standards in mind and the flow is as follows: + +![](./src/cards/info/rmaas-flow.png) + +> **GitHub Enterprise (GHE)**: The source control system where releases reside in a practical sense. Read more about GitHub releases here. Note that this plugin works just as well with a non-enterprise account. +> +> **Release Candidate (RC)**: A GHE pre-release intended primarily for internal testing +> +> **Release Version**: A GHE release intended for end users + +Looking at the flow above, a common release lifecycle could be: + +- User presses **Create Release Candidate** + - `RMaaS` + 1. Creates a release branch `rc/` + 1. Creates Release Candidate tag `rc-` + 1. Creates a GitHub prerelease with Release Candidate tag + - Your CI + 1. Detects the new tag by matching the git reference `refs/tags/rc-.*` + 1. Builds and deploys to staging environment for testing +- User presses **Patch** + - `RMaaS` + 1. The selected commit is cherry-picked to the release branch + 1. The release tag is bumped + 1. Updates GitHub release's tag and description with the patch's details + - Your CI + 1. Detects the new tag by matching the git reference `refs/tags/(rc|version)-.*` (Release Versions are patchable as well) + 1. Builds and deploys to staging (or production if Release Version) for testing +- User presses **Promote Release Candidate to Release Version** + - `RMaaS` + 1. Creates Release Version tag `version-` + 1. Promotes the GitHub release by removing the prerelease flag + - Your CI + 1. Detects the new tag by matching the git reference `refs/tags/version-.*` + 1. Builds and deploys to production for testing diff --git a/plugins/release-manager-as-a-service/dev/README.md b/plugins/release-manager-as-a-service/dev/README.md new file mode 100644 index 0000000000..550c8e1844 --- /dev/null +++ b/plugins/release-manager-as-a-service/dev/README.md @@ -0,0 +1,13 @@ +# release-manager-as-a-service + +Welcome to the release-manager-as-a-service plugin! + +_This plugin was created through the Backstage CLI_ + +## Getting started + +Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn start` in the root directory, and then navigating to [/release-manager-as-a-service](http://localhost:3000/release-manager-as-a-service). + +You can also serve the plugin in isolation by running `yarn start` in the plugin directory. +This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads. +It is only meant for local development, and the setup for it can be found inside the [/dev](./dev) directory. diff --git a/plugins/release-manager-as-a-service/dev/index.tsx b/plugins/release-manager-as-a-service/dev/index.tsx new file mode 100644 index 0000000000..7bdc0ba12a --- /dev/null +++ b/plugins/release-manager-as-a-service/dev/index.tsx @@ -0,0 +1,55 @@ +/* + * 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 React from 'react'; +import { createDevApp } from '@backstage/dev-utils'; +import { + releaseManagerAsAServicePlugin, + ReleaseManagerAsAServicePage, +} from '../src/plugin'; + +createDevApp() + .registerPlugin(releaseManagerAsAServicePlugin) + .addPage({ + element: ( + + ), + title: 'Root Page', + }) + .addPage({ + element: ( + + ), + title: 'Another page', + }) + .render(); diff --git a/plugins/release-manager-as-a-service/package.json b/plugins/release-manager-as-a-service/package.json new file mode 100644 index 0000000000..9a8f1bb7ef --- /dev/null +++ b/plugins/release-manager-as-a-service/package.json @@ -0,0 +1,51 @@ +{ + "name": "@backstage/plugin-release-manager-as-a-service", + "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/core": "^0.7.3", + "@backstage/integration": "^0.5.1", + "@backstage/theme": "^0.2.5", + "@material-ui/core": "^4.11.0", + "@material-ui/icons": "^4.9.1", + "@material-ui/lab": "4.0.0-alpha.45", + "@octokit/rest": "^18.0.12", + "date-fns": "^2.19.0", + "react-dom": "^16.13.1", + "react-router": "6.0.0-beta.0", + "react-use": "^15.3.3", + "react": "^16.13.1" + }, + "devDependencies": { + "@backstage/cli": "^0.6.6", + "@backstage/dev-utils": "^0.1.13", + "@backstage/test-utils": "^0.1.9", + "@testing-library/jest-dom": "^5.10.1", + "@testing-library/react": "^11.2.5", + "@testing-library/user-event": "^12.0.7", + "@types/jest": "^26.0.7", + "@types/node": "^14.14.32", + "msw": "^0.21.2", + "cross-fetch": "^3.0.6" + }, + "files": [ + "dist" + ] +} diff --git a/plugins/release-manager-as-a-service/src/ReleaseManagerAsAService.tsx b/plugins/release-manager-as-a-service/src/ReleaseManagerAsAService.tsx new file mode 100644 index 0000000000..35fd88b03f --- /dev/null +++ b/plugins/release-manager-as-a-service/src/ReleaseManagerAsAService.tsx @@ -0,0 +1,179 @@ +/* + * 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 { Alert } from '@material-ui/lab'; +import { CircularProgress, makeStyles } from '@material-ui/core'; +import { useAsync } from 'react-use'; +import React, { useState } from 'react'; +import { useApi, ContentHeader, ErrorBoundary } from '@backstage/core'; + +import { CreateRc } from './cards/createRc/CreateRc'; +import { getGitHubBatchInfo } from './sideEffects/getGitHubBatchInfo'; +import { Info } from './cards/info/Info'; +import { Patch } from './cards/patchRc/Patch'; +import { + ComponentConfigCreateRc, + ComponentConfigPatch, + ComponentConfigPromoteRc, + GhGetBranchResponse, + GhGetReleaseResponse, + GhGetRepositoryResponse, + Project, + SetRefetch, +} from './types/types'; +import { PromoteRc } from './cards/promoteRc/PromoteRc'; +import { releaseManagerAsAServiceApiRef } from './api/serviceApiRef'; +import { + ApiClientContext, + useApiClientContext, +} from './components/ProjectContext'; +import { RMaaSApiClient } from './api/RMaaSApiClient'; + +interface ReleaseManagerAsAServiceProps { + project: Project; + components?: { + default?: { + createRc?: ComponentConfigCreateRc; + promoteRc?: ComponentConfigPromoteRc; + patch?: ComponentConfigPatch; + }; + custom?: ({ + project, + setRefetch, + latestRelease, + releaseBranch, + repository, + }: { + project: Project; + setRefetch: SetRefetch; + latestRelease: GhGetReleaseResponse | null; + releaseBranch: GhGetBranchResponse | null; + repository: GhGetRepositoryResponse; + }) => JSX.Element[]; + }; +} + +const useStyles = makeStyles(() => ({ + root: { + maxWidth: '999px', + }, +})); + +export function ReleaseManagerAsAService({ + project, + components, +}: ReleaseManagerAsAServiceProps) { + const pluginApiClient = useApi(releaseManagerAsAServiceApiRef); + const RMaaSApi = new RMaaSApiClient({ + pluginApiClient, + repoPath: `${project.github.org}/${project.github.repo}`, + }); + const classes = useStyles(); + + return ( + +
+ + + +
+
+ ); +} + +function Cards({ project, components }: ReleaseManagerAsAServiceProps) { + const apiClient = useApiClientContext(); + const [refetch, setRefetch] = useState(0); + const gitHubBatchInfo = useAsync(getGitHubBatchInfo({ apiClient }), [ + project, + refetch, + ]); + + if (gitHubBatchInfo.error) { + return {gitHubBatchInfo.error.message}; + } + + if (gitHubBatchInfo.loading) { + return ( +
+ +
+ ); + } + + if (gitHubBatchInfo.value === undefined) { + return Failed to fetch latest GHE release; + } + + if (!gitHubBatchInfo.value.repository.permissions.push) { + return ( + + You lack push permissions for repository "{project.github.org}/ + {project.github.repo}" + + ); + } + + return ( + + + + {components?.default?.createRc?.omit !== true && ( + + )} + + {components?.default?.promoteRc?.omit !== true && ( + + )} + + {components?.default?.patch?.omit !== true && ( + + )} + + {components + ?.custom?.({ + project, + setRefetch, + latestRelease: gitHubBatchInfo.value.latestRelease, + releaseBranch: gitHubBatchInfo.value.releaseBranch, + repository: gitHubBatchInfo.value.repository, + }) + .map((customElement, index) => ( +
{customElement}
+ ))} +
+ ); +} diff --git a/plugins/release-manager-as-a-service/src/api/PluginApiClientConfig.ts b/plugins/release-manager-as-a-service/src/api/PluginApiClientConfig.ts new file mode 100644 index 0000000000..430b005b92 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/api/PluginApiClientConfig.ts @@ -0,0 +1,51 @@ +/* + * 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 { ConfigApi, OAuthApi } from '@backstage/core'; +import { Octokit } from '@octokit/rest'; +import { readGitHubIntegrationConfigs } from '@backstage/integration'; + +export class PluginApiClientConfig { + private readonly githubAuthApi: OAuthApi; + readonly baseUrl: string; + + constructor({ + configApi, + githubAuthApi, + }: { + configApi: ConfigApi; + githubAuthApi: OAuthApi; + }) { + this.githubAuthApi = githubAuthApi; + + const configs = readGitHubIntegrationConfigs( + configApi.getOptionalConfigArray('integrations.github') ?? [], + ); + const githubIntegrationConfig = configs.find(v => v.host === 'github.com'); + this.baseUrl = + githubIntegrationConfig?.apiBaseUrl ?? 'https://api.github.com'; + } + + public async getOctokit() { + const token = await this.githubAuthApi.getAccessToken(['repo']); + + return { + octokit: new Octokit({ + auth: token, + baseUrl: this.baseUrl, + }), + }; + } +} diff --git a/plugins/release-manager-as-a-service/src/api/RMaaSApiClient.ts b/plugins/release-manager-as-a-service/src/api/RMaaSApiClient.ts new file mode 100644 index 0000000000..e67d50e46a --- /dev/null +++ b/plugins/release-manager-as-a-service/src/api/RMaaSApiClient.ts @@ -0,0 +1,412 @@ +/* + * 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 { + GhCompareCommitsResponse, + GhCreateCommitResponse, + GhCreateReferenceResponse, + GhCreateReleaseResponse, + GhCreateTagObjectResponse, + GhGetBranchResponse, + GhGetCommitResponse, + GhGetReleaseResponse, + GhGetRepositoryResponse, + GhMergeResponse, + GhUpdateReferenceResponse, + GhUpdateReleaseResponse, +} from '../types/types'; +import { CalverTagParts } from '../helpers/tagParts/getCalverTagParts'; +import { getRcGheInfo } from '../cards/createRc/getRcGheInfo'; +import { PluginApiClientConfig } from './PluginApiClientConfig'; +import { SemverTagParts } from '../helpers/tagParts/getSemverTagParts'; + +/** + * Docs + * https://github.com/octokit/request.js/#the-data-parameter--set-request-body-directly + */ + +export class RMaaSApiClient { + private readonly pluginApiClient: PluginApiClientConfig; + private readonly repoPath: string; + private readonly githubCommonPath: string; + + constructor({ + pluginApiClient, + repoPath, + }: { + pluginApiClient: PluginApiClientConfig; + repoPath: string; + }) { + this.pluginApiClient = pluginApiClient; + this.repoPath = repoPath; + this.githubCommonPath = `/repos/${this.repoPath}`; + } + + public getRepoPath() { + return this.repoPath; + } + + async getRecentCommits({ + releaseBranchName, + }: { releaseBranchName?: string } = {}) { + const { octokit } = await this.pluginApiClient.getOctokit(); + const sha = releaseBranchName ? `?sha=${releaseBranchName}` : ''; + + const recentCommits: GhGetCommitResponse[] = ( + await octokit.request(`${this.githubCommonPath}/commits${sha}`) + ).data; + + return { recentCommits }; + } + + async getReleases() { + const { octokit } = await this.pluginApiClient.getOctokit(); + + const releases: GhGetReleaseResponse[] = ( + await octokit.request(`${this.githubCommonPath}/releases`) + ).data; + + return { releases }; + } + + async getRelease({ releaseId }: { releaseId: number }) { + const { octokit } = await this.pluginApiClient.getOctokit(); + + const latestRelease: GhGetReleaseResponse = ( + await octokit.request(`${this.githubCommonPath}/releases/${releaseId}`) + ).data; + + return { latestRelease }; + } + + async getRepository() { + const { octokit } = await this.pluginApiClient.getOctokit(); + + const repository: GhGetRepositoryResponse = ( + await octokit.request(this.githubCommonPath) + ).data; + + return { repository }; + } + + async getLatestCommit({ defaultBranch }: { defaultBranch: string }) { + const { octokit } = await this.pluginApiClient.getOctokit(); + + const latestCommit: GhGetCommitResponse = ( + await octokit.request( + `${this.githubCommonPath}/commits/refs/heads/${defaultBranch}`, + ) + ).data; + + return { latestCommit }; + } + + async getBranch({ branchName }: { branchName: string }) { + const { octokit } = await this.pluginApiClient.getOctokit(); + + const branch: GhGetBranchResponse = ( + await octokit.request(`${this.githubCommonPath}/branches/${branchName}`) + ).data; + + return { branch }; + } + + createRc = { + createRef: async ({ + mostRecentSha, + targetBranch, + }: { + mostRecentSha: string; + targetBranch: string; + }) => { + const { octokit } = await this.pluginApiClient.getOctokit(); + + const createdRef: GhCreateReferenceResponse = ( + await octokit.request(`${this.githubCommonPath}/git/refs`, { + method: 'POST', + data: { + ref: `refs/heads/${targetBranch}`, + sha: mostRecentSha, + }, + }) + ).data; + + return { createdRef }; + }, + + getComparison: async ({ + previousReleaseBranch, + nextReleaseBranch, + }: { + previousReleaseBranch: string; + nextReleaseBranch: string; + }) => { + const { octokit } = await this.pluginApiClient.getOctokit(); + + const comparison: GhCompareCommitsResponse = ( + await octokit.request( + `${this.githubCommonPath}/compare/${previousReleaseBranch}...${nextReleaseBranch}`, + ) + ).data; + + return { comparison }; + }, + + createRelease: async ({ + nextGheInfo, + releaseBody, + }: { + nextGheInfo: ReturnType; + releaseBody: string; + }) => { + const { octokit } = await this.pluginApiClient.getOctokit(); + + const createReleaseResponse: GhCreateReleaseResponse = ( + await octokit.request(`${this.githubCommonPath}/releases`, { + method: 'POST', + data: { + tag_name: nextGheInfo.rcReleaseTag, + name: nextGheInfo.releaseName, + target_commitish: nextGheInfo.rcBranch, + body: releaseBody, + prerelease: true, + }, + }) + ).data; + + return { createReleaseResponse }; + }, + }; + + patch = { + createTempCommit: async ({ + tagParts, + releaseBranchTree, + selectedPatchCommit, + }: { + tagParts: SemverTagParts | CalverTagParts; + releaseBranchTree: string; + selectedPatchCommit: GhGetCommitResponse; + }) => { + const { octokit } = await this.pluginApiClient.getOctokit(); + + const tempCommit: GhCreateCommitResponse = ( + await octokit.request(`${this.githubCommonPath}/git/commits`, { + method: 'POST', + data: { + message: `Temporary commit for patch ${tagParts.patch}`, + tree: releaseBranchTree, + parents: [selectedPatchCommit.parents[0].sha], + }, + }) + ).data; + + return { tempCommit }; + }, + + forceBranchHeadToTempCommit: async ({ + releaseBranchName, + tempCommit, + }: { + releaseBranchName: string; + tempCommit: GhCreateCommitResponse; + }) => { + const { octokit } = await this.pluginApiClient.getOctokit(); + + await octokit.request( + `${this.githubCommonPath}/git/refs/heads/${releaseBranchName}`, + { + method: 'PATCH', + data: { + sha: tempCommit.sha, + force: true, + }, + }, + ); + }, + + merge: async ({ base, head }: { base: string; head: string }) => { + const { octokit } = await this.pluginApiClient.getOctokit(); + + const merge: GhMergeResponse = ( + await octokit.request(`${this.githubCommonPath}/merges`, { + method: 'POST', + data: { base, head }, + }) + ).data; + + return { merge }; + }, + + createCherryPickCommit: async ({ + bumpedTag, + selectedPatchCommit, + mergeTree, + releaseBranchSha, + }: { + bumpedTag: string; + selectedPatchCommit: GhGetCommitResponse; + mergeTree: string; + releaseBranchSha: string; + }) => { + const { octokit } = await this.pluginApiClient.getOctokit(); + + const cherryPickCommit: GhCreateCommitResponse = ( + await octokit.request(`${this.githubCommonPath}/git/commits`, { + method: 'POST', + data: { + message: `[patch ${bumpedTag}] ${selectedPatchCommit.commit.message}`, + tree: mergeTree, + parents: [releaseBranchSha], + }, + }) + ).data; + + return { cherryPickCommit }; + }, + + replaceTempCommit: async ({ + releaseBranchName, + cherryPickCommit, + }: { + releaseBranchName: string; + cherryPickCommit: GhCreateCommitResponse; + }) => { + const { octokit } = await this.pluginApiClient.getOctokit(); + + const updatedReference: GhUpdateReferenceResponse = ( + await octokit.request( + `${this.githubCommonPath}/git/refs/heads/${releaseBranchName}`, + { + method: 'PATCH', + data: { + sha: cherryPickCommit.sha, + force: true, + }, + }, + ) + ).data; + + return { updatedReference }; + }, + + createTagObject: async ({ + bumpedTag, + updatedReference, + }: { + bumpedTag: string; + updatedReference: GhUpdateReferenceResponse; + }) => { + const { octokit } = await this.pluginApiClient.getOctokit(); + + const tagObjectResponse: GhCreateTagObjectResponse = ( + await octokit.request(`${this.githubCommonPath}/git/tags`, { + method: 'POST', + data: { + type: 'commit', + message: + 'Tag generated by your friendly neighborhood Release Manager as a Service', + tag: bumpedTag, + object: updatedReference.object.sha, + }, + }) + ).data; + + return { tagObjectResponse }; + }, + + createReference: async ({ + bumpedTag, + tagObjectResponse, + }: { + bumpedTag: string; + tagObjectResponse: GhCreateTagObjectResponse; + }) => { + const { octokit } = await this.pluginApiClient.getOctokit(); + + const reference: GhCreateReferenceResponse = ( + await octokit.request(`${this.githubCommonPath}/git/refs`, { + method: 'POST', + data: { + ref: `refs/tags/${bumpedTag}`, + sha: tagObjectResponse.sha, + }, + }) + ).data; + + return { reference }; + }, + + updateRelease: async ({ + bumpedTag, + latestRelease, + tagParts, + selectedPatchCommit, + }: { + bumpedTag: string; + latestRelease: GhGetReleaseResponse; + tagParts: SemverTagParts | CalverTagParts; + selectedPatchCommit: GhGetCommitResponse; + }) => { + const { octokit } = await this.pluginApiClient.getOctokit(); + + const release: GhUpdateReleaseResponse = ( + await octokit.request( + `${this.githubCommonPath}/releases/${latestRelease.id}`, + { + method: 'PATCH', + data: { + tag_name: bumpedTag, + body: `${latestRelease.body} + + #### [Patch ${tagParts.patch}](${selectedPatchCommit.html_url}) + + ${selectedPatchCommit.commit.message}`, + }, + }, + ) + ).data; + + return { release }; + }, + }; + + promoteRc = { + promoteRelease: async ({ + releaseId, + releaseVersion, + }: { + releaseId: GhGetReleaseResponse['id']; + releaseVersion: string; + }) => { + const { octokit } = await this.pluginApiClient.getOctokit(); + + const release: GhGetReleaseResponse = ( + await octokit.request( + `${this.githubCommonPath}/releases/${releaseId}`, + { + method: 'PATCH', + data: { + tag_name: releaseVersion, + prerelease: false, + }, + }, + ) + ).data; + + return { release }; + }, + }; +} diff --git a/plugins/release-manager-as-a-service/src/api/serviceApiRef.ts b/plugins/release-manager-as-a-service/src/api/serviceApiRef.ts new file mode 100644 index 0000000000..1daea6f4c1 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/api/serviceApiRef.ts @@ -0,0 +1,26 @@ +/* + * 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 { createApiRef } from '@backstage/core'; + +import { PluginApiClientConfig } from './PluginApiClientConfig'; + +export const releaseManagerAsAServiceApiRef = createApiRef( + { + id: 'plugin.release-manager-as-a-service.service', + description: + 'Used by the Release Manager as a Service plugin to make requests', + }, +); diff --git a/plugins/release-manager-as-a-service/src/cards/createRc/CreateRc.test.tsx b/plugins/release-manager-as-a-service/src/cards/createRc/CreateRc.test.tsx new file mode 100644 index 0000000000..d4dba6841e --- /dev/null +++ b/plugins/release-manager-as-a-service/src/cards/createRc/CreateRc.test.tsx @@ -0,0 +1,67 @@ +/* + * 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 React from 'react'; +import { render } from '@testing-library/react'; + +import { + mockCalverProject, + mockNextGheInfo, + mockRcRelease, + mockReleaseBranch, + mockReleaseVersion, + mockSemverProject, + mockApiClient, +} from '../../test-helpers/test-helpers'; +import { TEST_IDS } from '../../test-helpers/test-ids'; + +jest.mock('../../components/ProjectContext', () => ({ + useApiClientContext: () => mockApiClient, +})); +jest.mock('./getRcGheInfo', () => ({ + getRcGheInfo: () => mockNextGheInfo, +})); + +import { CreateRc } from './CreateRc'; + +describe('CreateRc', () => { + it('should display CTA', () => { + const { getByTestId } = render( + , + ); + + expect(getByTestId(TEST_IDS.createRc.cta)).toBeInTheDocument(); + }); + + it('should display select element for semver', () => { + const { getByTestId } = render( + , + ); + + expect(getByTestId(TEST_IDS.createRc.semverSelect)).toBeInTheDocument(); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/cards/createRc/CreateRc.tsx b/plugins/release-manager-as-a-service/src/cards/createRc/CreateRc.tsx new file mode 100644 index 0000000000..22877ec1a3 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/cards/createRc/CreateRc.tsx @@ -0,0 +1,205 @@ +/* + * 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 React, { useState, useEffect } from 'react'; +import { Alert } from '@material-ui/lab'; +import { + Button, + FormControl, + InputLabel, + MenuItem, + Select, + Typography, +} from '@material-ui/core'; +import { useAsyncFn } from 'react-use'; + +import { createGheRc } from './sideEffects/createGheRc'; +import { Differ } from '../../components/Differ'; +import { getRcGheInfo } from './getRcGheInfo'; +import { InfoCardPlus } from '../../components/InfoCardPlus'; +import { + ComponentConfigCreateRc, + GhGetBranchResponse, + GhGetReleaseResponse, + GhGetRepositoryResponse, + Project, + SetRefetch, +} from '../../types/types'; +import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; +import { useStyles } from '../../styles/styles'; +import { useApiClientContext } from '../../components/ProjectContext'; +import { SEMVER_PARTS } from '../../constants/constants'; +import { TEST_IDS } from '../../test-helpers/test-ids'; + +interface CreateRcProps { + defaultBranch: GhGetRepositoryResponse['default_branch']; + latestRelease: GhGetReleaseResponse | null; + project: Project; + releaseBranch: GhGetBranchResponse | null; + setRefetch: SetRefetch; + successCb?: ComponentConfigCreateRc['successCb']; +} + +export const CreateRc = ({ + defaultBranch, + latestRelease, + project, + releaseBranch, + setRefetch, + successCb, +}: CreateRcProps) => { + const apiClient = useApiClientContext(); + const classes = useStyles(); + + const [semverBumpLevel, setSemverBumpLevel] = useState<'major' | 'minor'>( + SEMVER_PARTS.minor, + ); + const [nextGheInfo, setNextGheInfo] = useState( + getRcGheInfo({ latestRelease, project, semverBumpLevel }), + ); + + useEffect(() => { + setNextGheInfo(getRcGheInfo({ latestRelease, project, semverBumpLevel })); + }, [semverBumpLevel, setNextGheInfo, latestRelease, project]); + + const [createReleaseResponse, callCreateGheRc] = useAsyncFn( + async (...args) => { + const createGheRcResponseSteps = await createGheRc({ + apiClient, + defaultBranch, + latestRelease, + nextGheInfo: args[0], + successCb, + }); + + return createGheRcResponseSteps; + }, + ); + + if (createReleaseResponse.error) { + return ( + {createReleaseResponse.error.message} + ); + } + + const tagAlreadyExists = + latestRelease !== null && + latestRelease.tag_name === nextGheInfo.rcReleaseTag; + const conflictingPreRelease = + latestRelease !== null && latestRelease.prerelease; + + function Description() { + if (conflictingPreRelease) { + return ( + + The most recent release is already a Release Candidate + + ); + } + + if (tagAlreadyExists) { + return ( + + There's already a tag named{' '} + {nextGheInfo.rcReleaseTag} + + ); + } + + return ( +
+ + + + + + + +
+ ); + } + + function CTA() { + if (createReleaseResponse.loading || createReleaseResponse.value) { + return ( + + ); + } + + return ( + + ); + } + + return ( + + + Create Release Candidate + + + {project.versioningStrategy === 'semver' && + latestRelease && + !conflictingPreRelease && ( +
+ + Select bump severity + + + +
+ )} + + + + +
+ ); +}; diff --git a/plugins/release-manager-as-a-service/src/cards/createRc/getRcGheInfo.test.ts b/plugins/release-manager-as-a-service/src/cards/createRc/getRcGheInfo.test.ts new file mode 100644 index 0000000000..0feb95734f --- /dev/null +++ b/plugins/release-manager-as-a-service/src/cards/createRc/getRcGheInfo.test.ts @@ -0,0 +1,88 @@ +/* + * 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 { format } from 'date-fns'; + +import { GhGetReleaseResponse } from '../../types/types'; +import { + mockSemverProject, + mockCalverProject, +} from '../../test-helpers/test-helpers'; +import { getRcGheInfo } from './getRcGheInfo'; + +const injectedDate = format(1611869955783, 'yyyy.MM.dd'); + +describe('getRCGheInfo', () => { + describe('calver', () => { + const latestRelease = { + tag_name: 'rc-2020.01.01_0', + } as GhGetReleaseResponse; + + it('should return correct Ghe info', () => { + expect( + getRcGheInfo({ + project: mockCalverProject, + latestRelease, + semverBumpLevel: 'minor', + injectedDate, + }), + ).toMatchInlineSnapshot(` + Object { + "rcBranch": "rc/2021.01.28", + "rcReleaseTag": "rc-2021.01.28_0", + "releaseName": "Version 2021.01.28", + } + `); + }); + }); + + describe('semver', () => { + const latestRelease = { + tag_name: 'rc-1.1.1', + } as GhGetReleaseResponse; + + it("should return correct Ghe info when there's previous releases", () => { + expect( + getRcGheInfo({ + project: mockSemverProject, + latestRelease, + semverBumpLevel: 'minor', + }), + ).toMatchInlineSnapshot(` + Object { + "rcBranch": "rc/1.2.0", + "rcReleaseTag": "rc-1.2.0", + "releaseName": "Version 1.2.0", + } + `); + }); + + it("should return correct Ghe info when there's no previous release", () => { + expect( + getRcGheInfo({ + project: mockSemverProject, + latestRelease: null, + semverBumpLevel: 'minor', + }), + ).toMatchInlineSnapshot(` + Object { + "rcBranch": "rc/0.0.1", + "rcReleaseTag": "rc-0.0.1", + "releaseName": "Version 0.0.1", + } + `); + }); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/cards/createRc/getRcGheInfo.ts b/plugins/release-manager-as-a-service/src/cards/createRc/getRcGheInfo.ts new file mode 100644 index 0000000000..6054117d9c --- /dev/null +++ b/plugins/release-manager-as-a-service/src/cards/createRc/getRcGheInfo.ts @@ -0,0 +1,60 @@ +/* + * 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 { format } from 'date-fns'; + +import { getBumpedSemverTagParts } from '../../helpers/getBumpedTag'; +import { getSemverTagParts } from '../../helpers/tagParts/getSemverTagParts'; +import { Project, GhGetReleaseResponse } from '../../types/types'; +import { SEMVER_PARTS } from '../../constants/constants'; + +export const getRcGheInfo = ({ + project, + latestRelease, + semverBumpLevel, + injectedDate = format(new Date(), 'yyyy.MM.dd'), // '0012-01-01T13:37:00.000Z' +}: { + project: Project; + latestRelease: GhGetReleaseResponse | null; + semverBumpLevel: keyof typeof SEMVER_PARTS; + injectedDate?: string; +}) => { + if (project.versioningStrategy === 'calver') { + return { + rcBranch: `rc/${injectedDate}`, + rcReleaseTag: `rc-${injectedDate}_0`, + releaseName: `Version ${injectedDate}`, + }; + } + + if (!latestRelease) { + return { + rcBranch: 'rc/0.0.1', + rcReleaseTag: 'rc-0.0.1', + releaseName: 'Version 0.0.1', + }; + } + + const tagParts = getSemverTagParts(latestRelease.tag_name); + const { bumpedTagParts } = getBumpedSemverTagParts(tagParts, semverBumpLevel); + + const bumpedTag = `${bumpedTagParts.major}.${bumpedTagParts.minor}.${bumpedTagParts.patch}`; + + return { + rcBranch: `rc/${bumpedTag}`, + rcReleaseTag: `rc-${bumpedTag}`, + releaseName: `Version ${bumpedTag}`, + }; +}; diff --git a/plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createGheRc.test.ts b/plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createGheRc.test.ts new file mode 100644 index 0000000000..a94cd682ee --- /dev/null +++ b/plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createGheRc.test.ts @@ -0,0 +1,59 @@ +/* + * 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 { + mockDefaultBranch, + mockReleaseVersion, + mockNextGheInfo, + mockApiClient, +} from '../../../test-helpers/test-helpers'; +import { createGheRc } from './createGheRc'; + +describe('createGheRc', () => { + beforeEach(jest.clearAllMocks); + + it('should work', async () => { + const result = await createGheRc({ + apiClient: mockApiClient, + defaultBranch: mockDefaultBranch, + latestRelease: mockReleaseVersion, + nextGheInfo: mockNextGheInfo, + }); + + expect(result).toMatchInlineSnapshot(` + Array [ + Object { + "link": "mock_latestCommit_html_url", + "message": "Fetched latest commit from \\"mock_defaultBranch\\"", + "secondaryMessage": "with message \\"mock_latestCommit_message\\"", + }, + Object { + "message": "Cut Release Branch", + "secondaryMessage": "with ref \\"mock_createRef_ref\\"", + }, + Object { + "link": "mock_compareCommits_html_url", + "message": "Fetched commit comparision", + "secondaryMessage": "rc/1.2.3...rc/1.2.3", + }, + Object { + "link": "mock_createRelease_html_url", + "message": "Created Release Candidate \\"mock_createRelease_name\\"", + "secondaryMessage": "with tag \\"rc-1.2.3\\"", + }, + ] + `); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createGheRc.ts b/plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createGheRc.ts new file mode 100644 index 0000000000..29491fb13e --- /dev/null +++ b/plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createGheRc.ts @@ -0,0 +1,129 @@ +/* + * 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 { getRcGheInfo } from '../getRcGheInfo'; +import { + ComponentConfigCreateRc, + GhCreateReferenceResponse, + GhGetReleaseResponse, + GhGetRepositoryResponse, + ResponseStep, +} from '../../../types/types'; +import { RMaaSApiClient } from '../../../api/RMaaSApiClient'; +import { ReleaseManagerAsAServiceError } from '../../../errors/ReleaseManagerAsAServiceError'; + +interface CreateGheRC { + apiClient: RMaaSApiClient; + defaultBranch: GhGetRepositoryResponse['default_branch']; + latestRelease: GhGetReleaseResponse | null; + nextGheInfo: ReturnType; + successCb?: ComponentConfigCreateRc['successCb']; +} + +export async function createGheRc({ + apiClient, + defaultBranch, + latestRelease, + nextGheInfo, + successCb, +}: CreateGheRC) { + const responseSteps: ResponseStep[] = []; + + /** + * 1. Get the default branch's most recent commit + */ + const { latestCommit } = await apiClient.getLatestCommit({ + defaultBranch, + }); + responseSteps.push({ + message: `Fetched latest commit from "${defaultBranch}"`, + secondaryMessage: `with message "${latestCommit.commit.message}"`, + link: latestCommit.html_url, + }); + + /** + * 2. Create a new ref based on the default branch's most recent sha + */ + const mostRecentSha = latestCommit.sha; + let createdRef: GhCreateReferenceResponse; + try { + createdRef = ( + await apiClient.createRc.createRef({ + mostRecentSha, + targetBranch: nextGheInfo.rcBranch, + }) + ).createdRef; + } catch (error) { + if (error.body.message === 'Reference already exists') { + throw new ReleaseManagerAsAServiceError( + `Branch "${nextGheInfo.rcBranch}" already exists: .../tree/${nextGheInfo.rcBranch}`, + ); + } + throw error; + } + responseSteps.push({ + message: 'Cut Release Branch', + secondaryMessage: `with ref "${createdRef.ref}"`, + }); + + /** + * 3. Compose a body for the release + */ + const previousReleaseBranch = latestRelease + ? latestRelease.target_commitish + : defaultBranch; + const nextReleaseBranch = nextGheInfo.rcBranch; + const { comparison } = await apiClient.createRc.getComparison({ + previousReleaseBranch, + nextReleaseBranch, + }); + const releaseBody = `**Compare** ${comparison.html_url} + +**Ahead by** ${comparison.ahead_by} commits + +**Release branch** ${createdRef.ref} + +--- + +`; + responseSteps.push({ + message: 'Fetched commit comparision', + secondaryMessage: `${previousReleaseBranch}...${nextReleaseBranch}`, + link: comparison.html_url, + }); + + /** + * 4. Creates the release itself in GHE + */ + const { createReleaseResponse } = await apiClient.createRc.createRelease({ + nextGheInfo, + releaseBody, + }); + responseSteps.push({ + message: `Created Release Candidate "${createReleaseResponse.name}"`, + secondaryMessage: `with tag "${nextGheInfo.rcReleaseTag}"`, + link: createReleaseResponse.html_url, + }); + + await successCb?.({ + gitHubReleaseUrl: createReleaseResponse.html_url, + gitHubReleaseName: createReleaseResponse.name, + comparisonUrl: comparison.html_url, + previousTag: latestRelease?.tag_name, + createdTag: createReleaseResponse.tag_name, + }); + + return responseSteps; +} diff --git a/plugins/release-manager-as-a-service/src/cards/info/Info.test.tsx b/plugins/release-manager-as-a-service/src/cards/info/Info.test.tsx new file mode 100644 index 0000000000..2c1176aa62 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/cards/info/Info.test.tsx @@ -0,0 +1,38 @@ +/* + * 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 React from 'react'; +import { render } from '@testing-library/react'; + +import { + mockCalverProject, + mockReleaseBranch, +} from '../../test-helpers/test-helpers'; +import { TEST_IDS } from '../../test-helpers/test-ids'; +import { Info } from './Info'; + +describe('Info', () => { + it('should return early if no latestRelease exists', () => { + const { getByTestId } = render( + , + ); + + expect(getByTestId(TEST_IDS.info.info)).toBeInTheDocument(); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/cards/info/Info.tsx b/plugins/release-manager-as-a-service/src/cards/info/Info.tsx new file mode 100644 index 0000000000..3d27e24297 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/cards/info/Info.tsx @@ -0,0 +1,133 @@ +/* + * 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 React from 'react'; +import { Link, Typography } from '@material-ui/core'; + +import { Differ } from '../../components/Differ'; +import { InfoCardPlus } from '../../components/InfoCardPlus'; +import { + GhGetBranchResponse, + GhGetReleaseResponse, + Project, +} from '../../types/types'; +import { useStyles } from '../../styles/styles'; +import { TEST_IDS } from '../../test-helpers/test-ids'; +import rmaasFlowImage from './rmaas-flow.png'; + +interface InfoCardProps { + releaseBranch: GhGetBranchResponse | null; + latestRelease: GhGetReleaseResponse | null; + project: Project; +} + +export const Info = ({ + releaseBranch, + latestRelease, + project, +}: InfoCardProps) => { + const classes = useStyles(); + + return ( + +
+ Terminology + + + GitHub Enterprise (GHE): The source control system + where releases reside in a practical sense. Read more about GitHub + releases{' '} + + here + + . Note that this plugin works just as well with a non-enterprise + account. + + + + Release Candidate: A GHE pre-release intended + primarily for internal testing + + + + Release Version: A GHE release intended for end users + +
+ +
+ Flow + + + RMaaS is built with a specific flow in mind. For example, it assumes + your project is configured to react to tags prefixed with rc or{' '} + version. + + + + Here's an overview of the flow: + + + rmaas-flow +
+ +
+ Details + + + Repository:{' '} + + + + {project.slack && ( + + Slack channel:{' '} + + #{project.slack.channel} + + ) : ( + <>(#{project.slack.channel}) + ) + } + /> + + )} + + + Versioning strategy:{' '} + + + + + Latest release branch:{' '} + + + + + Latest release: + +
+
+ ); +}; diff --git a/plugins/release-manager-as-a-service/src/cards/info/rmaas-flow.png b/plugins/release-manager-as-a-service/src/cards/info/rmaas-flow.png new file mode 100644 index 0000000000000000000000000000000000000000..947f9c0f35da00b84f1267fee8cd06e9c286d1e8 GIT binary patch literal 77527 zcma&N1yo(l&M=I-ySqc-;O=&CIMCt_#hv0(+}&M@wZ);hyL)kWch`?T_r3D}@3+4D zu-0CC&Ynp!lVm2DB!np|N+Tl>Ab^2^A$WsQiDSk1g=6IK*eH+Axe5+C&fZx$cDm; z_LMV~uWKozi<*iShWcB9n|ug`MvO3mJc7|woB2{@AZ{wWj_z`ob+_t%mpS-6Hk!qM zH9v0WALhJF_7xlk%@2EG)4tH?vzr^7h_&Twb89PQh$mg_}6$e#SNK8O}Ki>EqHaNL2$5-A@@-@d!hY}h=!c-AhNDY z2gQtS*R4#pPV;98d1op_Lt?OV6BOxq7_bGRi)p7u3m}OjSyvrJwsN37NmsTGcu0sn zV^>Xeb#?y(ci?E88!H$VTUTUa`?ma(_A8d84+^b9XM(o^-l{qswwYt{bB^>?`v*o< zu3sVaYy%K722^Z}>YV<%vl=y#mp8l}0wZ%dzx| z*pD^X?vC@5sv{|nk_uH+{GclJAA!A@M$sl7`kGRaT`cQ0*bi6GlMbqxjFDOVy;G4T z>j!wrT`X~u42OFW5MD)hH|p2f)Gu=FVs%C~(PVtell*2)K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<_|$`p}wZg!rcPxQ&K= zX)63NK-1;A+8(-m*45wN%wA_nYF)zR_UFd@{SCx}g^Q~#j&C8;ZfhikMGyLqh!GPG zFU4FT=zV;nj2ECl$$8~{Yp{jFu?>H}V8o*A*dtB3J`IsA0Y*x6@S`7xGL9;+MDo8R zfWZhb6=?1c#j-laK?K+{)#Bp0E&9B88y>+iWYm)4!D}GYhuv+Kn;z9)NoJnz#$w)C zS@Vv3Wz`Hhi22BRMdGmPL zT*UvX%bMMb1jIJaF5Bx5kYx>HjD_+CjsBZDIbbX!{(mF? { + it('should return early if no latestRelease exists', () => { + const { getByTestId } = render( + , + ); + + expect( + getByTestId(TEST_IDS.components.noLatestRelease), + ).toBeInTheDocument(); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/cards/patchRc/Patch.tsx b/plugins/release-manager-as-a-service/src/cards/patchRc/Patch.tsx new file mode 100644 index 0000000000..0b5a9fd9aa --- /dev/null +++ b/plugins/release-manager-as-a-service/src/cards/patchRc/Patch.tsx @@ -0,0 +1,81 @@ +/* + * 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 React from 'react'; +import { Typography } from '@material-ui/core'; + +import { getBumpedTag } from '../../helpers/getBumpedTag'; +import { InfoCardPlus } from '../../components/InfoCardPlus'; +import { NoLatestRelease } from '../../components/NoLatestRelease'; +import { + ComponentConfigPatch, + GhGetBranchResponse, + GhGetReleaseResponse, + Project, + SetRefetch, +} from '../../types/types'; +import { useStyles } from '../../styles/styles'; +import { PatchBody } from './PatchBody'; + +interface PatchProps { + latestRelease: GhGetReleaseResponse | null; + project: Project; + releaseBranch: GhGetBranchResponse | null; + setRefetch: SetRefetch; + successCb?: ComponentConfigPatch['successCb']; +} + +export const Patch = ({ + latestRelease, + project, + releaseBranch, + setRefetch, + successCb, +}: PatchProps) => { + const classes = useStyles(); + + function Body() { + if (latestRelease === null) { + return ; + } + + const { bumpedTag, tagParts } = getBumpedTag({ + project, + tag: latestRelease.tag_name, + bumpLevel: 'patch', + }); + + return ( + + ); + } + + return ( + + + Patch Release {latestRelease?.prerelease ? 'Candidate' : 'Version'} + + + + + ); +}; diff --git a/plugins/release-manager-as-a-service/src/cards/patchRc/PatchBody.test.tsx b/plugins/release-manager-as-a-service/src/cards/patchRc/PatchBody.test.tsx new file mode 100644 index 0000000000..74f701a120 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/cards/patchRc/PatchBody.test.tsx @@ -0,0 +1,77 @@ +/* + * 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 React from 'react'; +import { render, waitFor, screen } from '@testing-library/react'; + +import { + mockBumpedTag, + mockRcRelease, + mockReleaseBranch, + mockReleaseVersion, + mockTagParts, + mockApiClient, +} from '../../test-helpers/test-helpers'; + +jest.mock('../../components/ProjectContext', () => ({ + useApiClientContext: () => mockApiClient, +})); + +import { PatchBody } from './PatchBody'; +import { TEST_IDS } from '../../test-helpers/test-ids'; + +describe('PatchBody', () => { + beforeEach(jest.clearAllMocks); + + it('should render error', async () => { + mockApiClient.getBranch.mockImplementationOnce(() => { + throw new Error('lmao hehe'); + }); + + const { getByTestId } = render( + , + ); + + expect(getByTestId(TEST_IDS.patch.loading)).toBeInTheDocument(); + + await waitFor(() => screen.getByTestId(TEST_IDS.patch.error)); + + expect(getByTestId(TEST_IDS.patch.error)).toBeInTheDocument(); + }); + + it('should render not-prerelease description', async () => { + const { getByTestId } = render( + , + ); + + expect(getByTestId(TEST_IDS.patch.loading)).toBeInTheDocument(); + + await waitFor(() => screen.getByTestId(TEST_IDS.patch.notPrerelease)); + + expect(getByTestId(TEST_IDS.patch.notPrerelease)).toBeInTheDocument(); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/cards/patchRc/PatchBody.tsx b/plugins/release-manager-as-a-service/src/cards/patchRc/PatchBody.tsx new file mode 100644 index 0000000000..a30515c9b6 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/cards/patchRc/PatchBody.tsx @@ -0,0 +1,301 @@ +/* + * 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 React, { useState } from 'react'; +import { Alert, AlertTitle } from '@material-ui/lab'; +import { useAsync, useAsyncFn } from 'react-use'; +import FileCopyIcon from '@material-ui/icons/FileCopy'; +import Paper from '@material-ui/core/Paper'; +import { + Button, + Checkbox, + CircularProgress, + IconButton, + Link, + List, + ListItem, + ListItemIcon, + ListItemSecondaryAction, + ListItemText, + Typography, +} from '@material-ui/core'; +import OpenInNewIcon from '@material-ui/icons/OpenInNew'; + +import { Differ } from '../../components/Differ'; +import { + ComponentConfigPatch, + GhGetBranchResponse, + GhGetCommitResponse, + GhGetReleaseResponse, + SetRefetch, +} from '../../types/types'; +import { CalverTagParts } from '../../helpers/tagParts/getCalverTagParts'; +import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; +import { SemverTagParts } from '../../helpers/tagParts/getSemverTagParts'; +import { useApiClientContext } from '../../components/ProjectContext'; +import { useStyles } from '../../styles/styles'; +import { TEST_IDS } from '../../test-helpers/test-ids'; +import { patch } from './sideEffects/patch'; + +interface PatchBodyProps { + bumpedTag: string; + latestRelease: GhGetReleaseResponse; + releaseBranch: GhGetBranchResponse | null; + setRefetch: SetRefetch; + successCb?: ComponentConfigPatch['successCb']; + tagParts: NonNullable; +} + +export const PatchBody = ({ + bumpedTag, + latestRelease, + releaseBranch, + setRefetch, + successCb, + tagParts, +}: PatchBodyProps) => { + const apiClient = useApiClientContext(); + const [checkedCommitIndex, setCheckedCommitIndex] = useState(-1); + + const gheDataResponse = useAsync(async () => { + const [ + { branch: releaseBranchResponse }, + { recentCommits }, + ] = await Promise.all([ + apiClient.getBranch({ branchName: latestRelease.target_commitish }), + apiClient.getRecentCommits(), + ]); + + const { + recentCommits: recentReleaseBranchCommits, + } = await apiClient.getRecentCommits({ + releaseBranchName: releaseBranchResponse.name, + }); + + return { + releaseBranch: releaseBranchResponse, + recentReleaseBranchCommits, + recentCommits, + }; + }); + + const [patchGheRcResponse, patchGheRcFn] = useAsyncFn(async (...args) => { + const selectedPatchCommit: GhGetCommitResponse = args[0]; + const patchResponseSteps = await patch({ + apiClient, + bumpedTag, + latestRelease, + selectedPatchCommit, + successCb, + tagParts, + }); + + return patchResponseSteps; + }); + + if (gheDataResponse.error) { + return ( + + {gheDataResponse.error.message} + + ); + } + if (patchGheRcResponse.error) { + return {patchGheRcResponse.error.message}; + } + if (gheDataResponse.loading) { + return ; + } + + function Description() { + const classes = useStyles(); + + return ( + <> + {!latestRelease.prerelease && ( + + + The current GHE release is a Release Version + + It's still possible to patch it, but be extra mindful of changes + + )} + + + + + + ); + } + + function CommitList() { + if (!gheDataResponse.value?.recentCommits) { + return null; + } + + return ( + + {gheDataResponse.value.recentCommits.map((commit, index) => { + const commitExistsOnReleaseBranch = !!gheDataResponse.value?.recentReleaseBranchCommits.find( + ({ sha }) => { + return sha === commit.sha; + }, + ); + + return ( +
+ {commitExistsOnReleaseBranch && ( + + {' '} + Already exists on {releaseBranch?.name} + + )} + + 0) || + commitExistsOnReleaseBranch + } + role={undefined} + dense + button + onClick={() => { + if (index === checkedCommitIndex) { + setCheckedCommitIndex(-1); + } else { + setCheckedCommitIndex(index); + } + }} + > + + + + + + {commit.sha}{' '} + + @{commit.author.login} + + + } + /> + + + { + const repoPath = apiClient.getRepoPath(); + + const newTab = window.open( + `https://github.com/${repoPath}/compare/${releaseBranch?.name}...${commit.sha}`, + '_blank', + ); + newTab?.focus(); + }} + > + + + + +
+ ); + })} +
+ ); + } + + function CTA() { + if (patchGheRcResponse.loading || patchGheRcResponse.value) { + return ( + + ); + } + + if (!gheDataResponse.value?.recentCommits[checkedCommitIndex]) { + return ( + + ); + } + + return ( + + ); + } + + return ( +
+ + + + + +
+ ); +}; diff --git a/plugins/release-manager-as-a-service/src/cards/patchRc/sideEffects/patch.test.ts b/plugins/release-manager-as-a-service/src/cards/patchRc/sideEffects/patch.test.ts new file mode 100644 index 0000000000..7a37c0ce72 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/cards/patchRc/sideEffects/patch.test.ts @@ -0,0 +1,75 @@ +/* + * 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 { + mockBumpedTag, + mockReleaseVersion, + mockSelectedPatchCommit, + mockTagParts, + mockApiClient, +} from '../../../test-helpers/test-helpers'; +import { patch } from './patch'; + +describe('patch', () => { + beforeEach(jest.clearAllMocks); + + it('should work', async () => { + const result = await patch({ + apiClient: mockApiClient, + latestRelease: mockReleaseVersion, + bumpedTag: mockBumpedTag, + selectedPatchCommit: mockSelectedPatchCommit, + tagParts: mockTagParts, + }); + + expect(result).toMatchInlineSnapshot(` + Array [ + Object { + "link": "mock_branch__links_html", + "message": "Fetched release branch \\"rc/1.2.3\\"", + }, + Object { + "message": "Created temporary commit", + "secondaryMessage": "with message \\"mock_commit_message\\"", + }, + Object { + "link": "mock_merge_html_url", + "message": "Merged temporary commit into \\"rc/1.2.3\\"", + "secondaryMessage": "with message \\"mock_merge_commit_message\\"", + }, + Object { + "message": "Cherry-picked patch commit to \\"mock_branch_commit_sha\\"", + "secondaryMessage": "with message \\"undefined\\"", + }, + Object { + "message": "Updated reference \\"mock_reference_ref\\"", + }, + Object { + "message": "Created new tag object", + "secondaryMessage": "with name \\"mock_tag_object_tag\\"", + }, + Object { + "message": "Created new reference \\"mock_reference_ref\\"", + "secondaryMessage": "for tag object \\"mock_tag_object_tag\\"", + }, + Object { + "link": "mock_update_release_html_url", + "message": "Updated release \\"mock_update_release_name\\"", + "secondaryMessage": "with tag mock_update_release_tag_name", + }, + ] + `); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/cards/patchRc/sideEffects/patch.ts b/plugins/release-manager-as-a-service/src/cards/patchRc/sideEffects/patch.ts new file mode 100644 index 0000000000..797ed8229c --- /dev/null +++ b/plugins/release-manager-as-a-service/src/cards/patchRc/sideEffects/patch.ts @@ -0,0 +1,194 @@ +/* + * 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 { + ComponentConfigPatch, + GhGetCommitResponse, + GhGetReleaseResponse, + ResponseStep, +} from '../../../types/types'; +import { CalverTagParts } from '../../../helpers/tagParts/getCalverTagParts'; +import { ReleaseManagerAsAServiceError } from '../../../errors/ReleaseManagerAsAServiceError'; +import { RMaaSApiClient } from '../../../api/RMaaSApiClient'; +import { SemverTagParts } from '../../../helpers/tagParts/getSemverTagParts'; + +interface Patch { + apiClient: RMaaSApiClient; + bumpedTag: string; + latestRelease: GhGetReleaseResponse; + selectedPatchCommit: GhGetCommitResponse; + successCb?: ComponentConfigPatch['successCb']; + tagParts: NonNullable; +} + +/** + * Inspo: https://stackoverflow.com/questions/53859199/how-to-cherry-pick-through-githubs-api + */ +export async function patch({ + apiClient, + bumpedTag, + latestRelease, + selectedPatchCommit, + successCb, + tagParts, +}: Patch) { + const responseSteps: ResponseStep[] = []; + + if (!selectedPatchCommit || !selectedPatchCommit.sha) { + throw new ReleaseManagerAsAServiceError('Invalid commit'); + } + + const releaseBranchName = latestRelease.target_commitish; + /** + * 1. Here is the branch we want to cherry-pick to: + * > branch = GET /repos/$owner/$repo/branches/$branchName + * > branchSha = branch.commit.sha + * > branchTree = branch.commit.commit.tree.sha + */ + const { branch: releaseBranch } = await apiClient.getBranch({ + branchName: releaseBranchName, + }); + const releaseBranchSha = releaseBranch.commit.sha; + const releaseBranchTree = releaseBranch.commit.commit.tree.sha; + responseSteps.push({ + message: `Fetched release branch "${releaseBranch.name}"`, + link: releaseBranch._links.html, + }); + + /** + * 2. Create a temporary commit on the branch, which extends as a sibling of + * the commit we want but contains the current tree of the target branch: + * > parentSha = commit.parents.head // first parent -- there should only be one + * > tempCommit = POST /repos/$owner/$repo/git/commits { "message": "temp", "tree": branchTree, "parents": [parentSha] } + */ + const { tempCommit } = await apiClient.patch.createTempCommit({ + releaseBranchTree, + selectedPatchCommit, + tagParts, + }); + responseSteps.push({ + message: 'Created temporary commit', + secondaryMessage: `with message "${tempCommit.message}"`, + }); + + /** + * 3. Now temporarily force the branch over to that commit: + * > PATCH /repos/$owner/$repo/git/refs/heads/$refName { sha = tempCommit.sha, force = true } + */ + await apiClient.patch.forceBranchHeadToTempCommit({ + tempCommit, + releaseBranchName, + }); + + /** + * 4. Merge the commit we want into this mess: + * > merge = POST /repos/$owner/$repo/merges { "base": branchName, "head": commit.sha } + */ + const { merge } = await apiClient.patch.merge({ + base: releaseBranchName, + head: selectedPatchCommit.sha, + }); + responseSteps.push({ + message: `Merged temporary commit into "${releaseBranchName}"`, + secondaryMessage: `with message "${merge.commit.message}"`, + link: merge.html_url, + }); + + /** + * and get that tree! + * > mergeTree = merge.commit.tree.sha + */ + const mergeTree = merge.commit.tree.sha; + + /** + * 5. Now that we know what the tree should be, create the cherry-pick commit. + * Note that branchSha is the original from up at the top. + * > cherry = POST /repos/$owner/$repo/git/commits { "message": "looks good!", "tree": mergeTree, "parents": [branchSha] } + */ + const { cherryPickCommit } = await apiClient.patch.createCherryPickCommit({ + bumpedTag, + mergeTree, + releaseBranchSha, + selectedPatchCommit, + }); + responseSteps.push({ + message: `Cherry-picked patch commit to "${releaseBranchSha}"`, + secondaryMessage: `with message "${cherryPickCommit.message}"`, + }); + + /** + * 6. Replace the temp commit with the real commit: + * > PATCH /repos/$owner/$repo/git/refs/heads/$refName { sha = cherry.sha, force = true } + */ + const { updatedReference } = await apiClient.patch.replaceTempCommit({ + cherryPickCommit, + releaseBranchName, + }); + responseSteps.push({ + message: `Updated reference "${updatedReference.ref}"`, + }); + + /** + * 7. Create tag object: https://developer.github.com/v3/git/tags/#create-a-tag-object + * > POST /repos/:owner/:repo/git/tags + */ + const { tagObjectResponse } = await apiClient.patch.createTagObject({ + bumpedTag, + updatedReference, + }); + responseSteps.push({ + message: 'Created new tag object', + secondaryMessage: `with name "${tagObjectResponse.tag}"`, + }); + + /** + * 8. Create a reference: https://developer.github.com/v3/git/refs/#create-a-reference + * > POST /repos/:owner/:repo/git/refs + */ + const { reference } = await apiClient.patch.createReference({ + bumpedTag, + tagObjectResponse, + }); + responseSteps.push({ + message: `Created new reference "${reference.ref}"`, + secondaryMessage: `for tag object "${tagObjectResponse.tag}"`, + }); + + /** + * 9. Update release + */ + const { release: updatedRelease } = await apiClient.patch.updateRelease({ + bumpedTag, + latestRelease, + selectedPatchCommit, + tagParts, + }); + responseSteps.push({ + message: `Updated release "${updatedRelease.name}"`, + secondaryMessage: `with tag ${updatedRelease.tag_name}`, + link: updatedRelease.html_url, + }); + + await successCb?.({ + updatedReleaseUrl: updatedRelease.html_url, + updatedReleaseName: updatedRelease.name, + previousTag: latestRelease.tag_name, + patchedTag: updatedRelease.tag_name, + patchCommitUrl: selectedPatchCommit.html_url, + patchCommitMessage: selectedPatchCommit.commit.message, + }); + + return responseSteps; +} diff --git a/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRc.test.tsx b/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRc.test.tsx new file mode 100644 index 0000000000..d38b2e0991 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRc.test.tsx @@ -0,0 +1,61 @@ +/* + * 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 React from 'react'; +import { render } from '@testing-library/react'; + +import { + mockRcRelease, + mockReleaseVersion, +} from '../../test-helpers/test-helpers'; +import { TEST_IDS } from '../../test-helpers/test-ids'; + +jest.mock('./PromoteRcBody', () => ({ + PromoteRcBody: () => ( +
Hello
+ ), +})); + +import { PromoteRc } from './PromoteRc'; + +describe('PromoteRc', () => { + it('return early if no latest release present', () => { + const { getByTestId } = render( + , + ); + + expect( + getByTestId(TEST_IDS.components.noLatestRelease), + ).toBeInTheDocument(); + }); + + it('should display not-rc warning', () => { + const { getByTestId } = render( + , + ); + + expect(getByTestId(TEST_IDS.promoteRc.notRcWarning)).toBeInTheDocument(); + }); + + it('should display PromoteRcBody', () => { + const { getByTestId } = render( + , + ); + + expect( + getByTestId(TEST_IDS.promoteRc.mockedPromoteRcBody), + ).toBeInTheDocument(); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRc.tsx b/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRc.tsx new file mode 100644 index 0000000000..a591f71cd1 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRc.tsx @@ -0,0 +1,80 @@ +/* + * 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 React from 'react'; +import { Alert, AlertTitle } from '@material-ui/lab'; +import { Typography } from '@material-ui/core'; + +import { InfoCardPlus } from '../../components/InfoCardPlus'; +import { NoLatestRelease } from '../../components/NoLatestRelease'; +import { + ComponentConfigPromoteRc, + GhGetReleaseResponse, + SetRefetch, +} from '../../types/types'; +import { PromoteRcBody } from './PromoteRcBody'; +import { useStyles } from '../../styles/styles'; +import { TEST_IDS } from '../../test-helpers/test-ids'; + +interface PromoteRcProps { + latestRelease: GhGetReleaseResponse | null; + setRefetch: SetRefetch; + successCb?: ComponentConfigPromoteRc['successCb']; +} + +export const PromoteRc = ({ + latestRelease, + setRefetch, + successCb, +}: PromoteRcProps) => { + const classes = useStyles(); + + function Body() { + if (latestRelease === null) { + return ; + } + + if (!latestRelease.prerelease) { + return ( + + Latest GHE release is not a Release Candidate + One can only promote Release Candidates to Release Versions + + ); + } + + return ( + + ); + } + + return ( + + + Promote Release Candidate + + + + + ); +}; diff --git a/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRcBody.test.tsx b/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRcBody.test.tsx new file mode 100644 index 0000000000..4e78e117b6 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRcBody.test.tsx @@ -0,0 +1,35 @@ +/* + * 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 React from 'react'; +import { render } from '@testing-library/react'; + +import { mockRcRelease, mockApiClient } from '../../test-helpers/test-helpers'; +import { TEST_IDS } from '../../test-helpers/test-ids'; + +jest.mock('../../components/ProjectContext', () => ({ + useApiClientContext: () => mockApiClient, +})); +import { PromoteRcBody } from './PromoteRcBody'; + +describe('PromoteRcBody', () => { + it('should display CTA', () => { + const { getByTestId } = render( + , + ); + + expect(getByTestId(TEST_IDS.promoteRc.cta)).toBeInTheDocument(); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRcBody.tsx b/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRcBody.tsx new file mode 100644 index 0000000000..31eb883dee --- /dev/null +++ b/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRcBody.tsx @@ -0,0 +1,100 @@ +/* + * 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 React from 'react'; +import { Alert } from '@material-ui/lab'; +import { Button, Typography } from '@material-ui/core'; +import { useAsyncFn } from 'react-use'; + +import { Differ } from '../../components/Differ'; +import { + ComponentConfigPromoteRc, + GhGetReleaseResponse, + SetRefetch, +} from '../../types/types'; +import { promoteGheRc } from './sideEffects/promoteGheRc'; +import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; +import { useApiClientContext } from '../../components/ProjectContext'; +import { useStyles } from '../../styles/styles'; +import { TEST_IDS } from '../../test-helpers/test-ids'; + +interface PromoteRcBodyProps { + rcRelease: GhGetReleaseResponse; + setRefetch: SetRefetch; + successCb?: ComponentConfigPromoteRc['successCb']; +} + +export const PromoteRcBody = ({ + rcRelease, + setRefetch, + successCb, +}: PromoteRcBodyProps) => { + const apiClient = useApiClientContext(); + const classes = useStyles(); + const releaseVersion = rcRelease.tag_name.replace('rc-', 'version-'); + const [promoteGheRcResponse, promoseGheRcFn] = useAsyncFn( + promoteGheRc({ apiClient, rcRelease, releaseVersion, successCb }), + ); + + if (promoteGheRcResponse.error) { + return {promoteGheRcResponse.error.message}; + } + + function Description() { + return ( + <> + + Promotes the current Release Candidate to a Release Version. + + + + + + + ); + } + + function CTA() { + if (promoteGheRcResponse.loading || promoteGheRcResponse.value) { + return ( + + ); + } + + return ( + + ); + } + + return ( +
+ + + +
+ ); +}; diff --git a/plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteGheRc.test.ts b/plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteGheRc.test.ts new file mode 100644 index 0000000000..d6df61a1f3 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteGheRc.test.ts @@ -0,0 +1,42 @@ +/* + * 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 { + mockRcRelease, + mockApiClient, +} from '../../../test-helpers/test-helpers'; +import { promoteGheRc } from './promoteGheRc'; + +describe('promoteGheRc', () => { + beforeEach(jest.clearAllMocks); + + it('should work', async () => { + const result = await promoteGheRc({ + apiClient: mockApiClient, + rcRelease: mockRcRelease, + releaseVersion: 'version-1.2.3', + })(); + + expect(result).toMatchInlineSnapshot(` + Array [ + Object { + "link": "mock_release_html_url", + "message": "Promoted \\"mock_release_name\\"", + "secondaryMessage": "from \\"rc-2020.01.01_1\\" to \\"mock_release_tag_name\\"", + }, + ] + `); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteGheRc.ts b/plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteGheRc.ts new file mode 100644 index 0000000000..91371b72a6 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteGheRc.ts @@ -0,0 +1,60 @@ +/* + * 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 { + ComponentConfigPromoteRc, + GhGetReleaseResponse, + ResponseStep, +} from '../../../types/types'; +import { RMaaSApiClient } from '../../../api/RMaaSApiClient'; + +interface PromoteGheRc { + apiClient: RMaaSApiClient; + rcRelease: GhGetReleaseResponse; + releaseVersion: string; + successCb?: ComponentConfigPromoteRc['successCb']; +} + +export function promoteGheRc({ + apiClient, + rcRelease, + releaseVersion, + successCb, +}: PromoteGheRc) { + return async (): Promise => { + const responseSteps: ResponseStep[] = []; + + const { release } = await apiClient.promoteRc.promoteRelease({ + releaseId: rcRelease.id, + releaseVersion, + }); + responseSteps.push({ + message: `Promoted "${release.name}"`, + secondaryMessage: `from "${rcRelease.tag_name}" to "${release.tag_name}"`, + link: release.html_url, + }); + + await successCb?.({ + gitHubReleaseUrl: release.html_url, + gitHubReleaseName: release.name, + previousTagUrl: rcRelease.html_url, + previousTag: rcRelease.tag_name, + updatedTagUrl: release.html_url, + updatedTag: release.tag_name, + }); + + return responseSteps; + }; +} diff --git a/plugins/release-manager-as-a-service/src/components/Differ.tsx b/plugins/release-manager-as-a-service/src/components/Differ.tsx new file mode 100644 index 0000000000..7af998792b --- /dev/null +++ b/plugins/release-manager-as-a-service/src/components/Differ.tsx @@ -0,0 +1,79 @@ +/* + * 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 React, { ReactNode } from 'react'; +import { grey } from '@material-ui/core/colors'; +import CallSplitIcon from '@material-ui/icons/CallSplit'; +import ChatIcon from '@material-ui/icons/Chat'; +import DynamicFeedIcon from '@material-ui/icons/DynamicFeed'; +import GitHubIcon from '@material-ui/icons/GitHub'; +import LocalOfferIcon from '@material-ui/icons/LocalOffer'; + +interface DifferProps { + next?: string | ReactNode; + prev?: string; + prefix?: string; + icon?: 'tag' | 'branch' | 'ghe' | 'slack' | 'versioning'; +} + +const Icon = ({ icon }: { icon: DifferProps['icon'] }) => { + switch (icon) { + case 'tag': + return ( + + ); + + case 'branch': + return ( + + ); + + case 'ghe': + return ( + + ); + + case 'slack': + return ; + + case 'versioning': + return ( + + ); + + default: + return null; + } +}; + +export const Differ = ({ prev, next, prefix, icon }: DifferProps) => { + return ( + <> + {icon && ( + + {' '} + + )} + {prefix && {prefix}: } + {prev && ( + <> + {prev} + {' → '} + + )} + {next ?? 'None'} + + ); +}; diff --git a/plugins/release-manager-as-a-service/src/components/Divider.test.tsx b/plugins/release-manager-as-a-service/src/components/Divider.test.tsx new file mode 100644 index 0000000000..7a5ac8ad09 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/components/Divider.test.tsx @@ -0,0 +1,28 @@ +/* + * 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 React from 'react'; +import { render } from '@testing-library/react'; + +import { TEST_IDS } from '../test-helpers/test-ids'; +import { Divider } from './Divider'; + +describe('Divider', () => { + it('render Divider', () => { + const { getByTestId } = render(); + + expect(getByTestId(TEST_IDS.components.divider)).toBeInTheDocument(); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/components/Divider.tsx b/plugins/release-manager-as-a-service/src/components/Divider.tsx new file mode 100644 index 0000000000..879a55b98a --- /dev/null +++ b/plugins/release-manager-as-a-service/src/components/Divider.tsx @@ -0,0 +1,27 @@ +/* + * 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 React from 'react'; +import { Divider as MaterialDivider } from '@material-ui/core'; + +import { TEST_IDS } from '../test-helpers/test-ids'; + +export const Divider = () => { + return ( +
+ +
+ ); +}; diff --git a/plugins/release-manager-as-a-service/src/components/InfoCardPlus.test.tsx b/plugins/release-manager-as-a-service/src/components/InfoCardPlus.test.tsx new file mode 100644 index 0000000000..9486d2ac94 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/components/InfoCardPlus.test.tsx @@ -0,0 +1,28 @@ +/* + * 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 React from 'react'; +import { render } from '@testing-library/react'; + +import { TEST_IDS } from '../test-helpers/test-ids'; +import { InfoCardPlus } from './InfoCardPlus'; + +describe('InfoCardPlus', () => { + it('render InfoCardPlus', () => { + const { getByTestId } = render(); + + expect(getByTestId(TEST_IDS.info.infoCardPlus)).toBeInTheDocument(); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/components/InfoCardPlus.tsx b/plugins/release-manager-as-a-service/src/components/InfoCardPlus.tsx new file mode 100644 index 0000000000..9adf295064 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/components/InfoCardPlus.tsx @@ -0,0 +1,39 @@ +/* + * 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 React from 'react'; +import { InfoCard } from '@backstage/core'; +import { makeStyles } from '@material-ui/core'; + +import { TEST_IDS } from '../test-helpers/test-ids'; + +const useStyles = makeStyles(() => ({ + card: { + marginBottom: '3em', + }, +})); + +export const InfoCardPlus = ({ children }: { children?: React.ReactNode }) => { + const classes = useStyles(); + + return ( +
+ {children} +
+ ); +}; diff --git a/plugins/release-manager-as-a-service/src/components/NoLatestRelease.test.tsx b/plugins/release-manager-as-a-service/src/components/NoLatestRelease.test.tsx new file mode 100644 index 0000000000..83eb4f6802 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/components/NoLatestRelease.test.tsx @@ -0,0 +1,30 @@ +/* + * 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 React from 'react'; +import { render } from '@testing-library/react'; + +import { TEST_IDS } from '../test-helpers/test-ids'; +import { NoLatestRelease } from './NoLatestRelease'; + +describe('NoLatestRelease', () => { + it('render NoLatestRelease', () => { + const { getByTestId } = render(); + + expect( + getByTestId(TEST_IDS.components.noLatestRelease), + ).toBeInTheDocument(); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/components/NoLatestRelease.tsx b/plugins/release-manager-as-a-service/src/components/NoLatestRelease.tsx new file mode 100644 index 0000000000..85909d526d --- /dev/null +++ b/plugins/release-manager-as-a-service/src/components/NoLatestRelease.tsx @@ -0,0 +1,34 @@ +/* + * 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 React from 'react'; +import { Alert } from '@material-ui/lab'; + +import { useStyles } from '../styles/styles'; +import { TEST_IDS } from '../test-helpers/test-ids'; + +export const NoLatestRelease = () => { + const classes = useStyles(); + + return ( + + Unable to find any GHE releases + + ); +}; diff --git a/plugins/release-manager-as-a-service/src/components/ProjectContext.ts b/plugins/release-manager-as-a-service/src/components/ProjectContext.ts new file mode 100644 index 0000000000..26a195b5ed --- /dev/null +++ b/plugins/release-manager-as-a-service/src/components/ProjectContext.ts @@ -0,0 +1,33 @@ +/* + * 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 { createContext, useContext } from 'react'; + +import { RMaaSApiClient } from '../api/RMaaSApiClient'; +import { ReleaseManagerAsAServiceError } from '../errors/ReleaseManagerAsAServiceError'; + +export const ApiClientContext = createContext( + undefined, +); + +export const useApiClientContext = () => { + const apiClient = useContext(ApiClientContext); + + if (!apiClient) { + throw new ReleaseManagerAsAServiceError('apiClient not found'); + } + + return apiClient; +}; diff --git a/plugins/release-manager-as-a-service/src/components/ReloadButton.test.tsx b/plugins/release-manager-as-a-service/src/components/ReloadButton.test.tsx new file mode 100644 index 0000000000..c7a52bcdf9 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/components/ReloadButton.test.tsx @@ -0,0 +1,28 @@ +/* + * 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 React from 'react'; +import { render } from '@testing-library/react'; + +import { TEST_IDS } from '../test-helpers/test-ids'; +import { ReloadButton } from './ReloadButton'; + +describe('ReloadButton', () => { + it('render ReloadButton', () => { + const { getByTestId } = render(); + + expect(getByTestId(TEST_IDS.components.reloadButton)).toBeInTheDocument(); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/components/ReloadButton.tsx b/plugins/release-manager-as-a-service/src/components/ReloadButton.tsx new file mode 100644 index 0000000000..44e7ce89b3 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/components/ReloadButton.tsx @@ -0,0 +1,35 @@ +/* + * 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 React from 'react'; +import { Button } from '@material-ui/core'; + +import { TEST_IDS } from '../test-helpers/test-ids'; + +interface ReloadButtonProps { + style?: React.CSSProperties; +} + +export const ReloadButton = ({ style }: ReloadButtonProps) => ( + +); diff --git a/plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepList.test.tsx b/plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepList.test.tsx new file mode 100644 index 0000000000..3aa0986d33 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepList.test.tsx @@ -0,0 +1,65 @@ +/* + * 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 React from 'react'; +import { render } from '@testing-library/react'; + +import { TEST_IDS } from '../../test-helpers/test-ids'; +import { ResponseStepList } from './ResponseStepList'; + +describe('ResponseStepList', () => { + it('should render loading state when loading', () => { + const { getByTestId } = render( + , + ); + + expect( + getByTestId(TEST_IDS.components.circularProgress), + ).toBeInTheDocument(); + }); + + it('should render loading state when no responseSteps', () => { + const { getByTestId } = render( + , + ); + + expect( + getByTestId(TEST_IDS.components.circularProgress), + ).toBeInTheDocument(); + }); + + it('should render dialog content when loading is completed', () => { + const { getByTestId } = render( + , + ); + + expect( + getByTestId(TEST_IDS.components.responseStepListDialogContent), + ).toBeInTheDocument(); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepList.tsx b/plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepList.tsx new file mode 100644 index 0000000000..e4a3d78308 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepList.tsx @@ -0,0 +1,113 @@ +/* + * 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 React, { PropsWithChildren } from 'react'; +import { List, CircularProgress } from '@material-ui/core'; +import Button from '@material-ui/core/Button'; +import Dialog from '@material-ui/core/Dialog'; +import DialogActions from '@material-ui/core/DialogActions'; +import DialogContent from '@material-ui/core/DialogContent'; +import DialogTitle from '@material-ui/core/DialogTitle'; + +import { ResponseStep, SetRefetch } from '../../types/types'; +import { TEST_IDS } from '../../test-helpers/test-ids'; +import { ResponseStepListItem } from './ResponseStepListItem'; + +interface ResponseStepListProps { + responseSteps?: ResponseStep[]; + setRefetch: SetRefetch; + title: string; + animationDelay?: number; + loading: boolean; + closeable?: boolean; + denseList?: boolean; +} + +export const ResponseStepList = ({ + responseSteps, + animationDelay, + setRefetch, + loading = false, + closeable = false, + denseList = false, + title, + children, +}: PropsWithChildren) => { + const [open, setOpen] = React.useState(true); + + const handleClose = () => setOpen(false); + + return ( + { + if (closeable) { + handleClose(); + } + }} + maxWidth="md" + fullWidth + > + {title} + + {loading || !responseSteps ? ( +
+ +
+ ) : ( + <> + + + {responseSteps.map((responseStep, index) => ( + + ))} + + + {children} + + + {closeable && ( + + )} + + + + )} +
+ ); +}; diff --git a/plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepListItem.test.tsx b/plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepListItem.test.tsx new file mode 100644 index 0000000000..0b4ce11887 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepListItem.test.tsx @@ -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 React from 'react'; +import { render } from '@testing-library/react'; + +import { TEST_IDS } from '../../test-helpers/test-ids'; +import { ResponseStepListItem } from './ResponseStepListItem'; + +describe('ResponseStepListItem', () => { + it('should render', () => { + const { getByTestId } = render( + , + ); + + expect( + getByTestId(TEST_IDS.components.responseStepListItem), + ).toBeInTheDocument(); + }); + + it('should render success icon', () => { + const { getByTestId } = render( + , + ); + + expect( + getByTestId(TEST_IDS.components.responseStepListItemIconSuccess), + ).toBeInTheDocument(); + }); + + it('should render failure icon', () => { + const { getByTestId } = render( + , + ); + + expect( + getByTestId(TEST_IDS.components.responseStepListItemIconFailure), + ).toBeInTheDocument(); + }); + + it('should render link icon', () => { + const { getByTestId } = render( + , + ); + + expect( + getByTestId(TEST_IDS.components.responseStepListItemIconLink), + ).toBeInTheDocument(); + }); + + it('should render default icon', () => { + const { getByTestId } = render( + , + ); + + expect( + getByTestId(TEST_IDS.components.responseStepListItemIconDefault), + ).toBeInTheDocument(); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepListItem.tsx b/plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepListItem.tsx new file mode 100644 index 0000000000..fd139dae89 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepListItem.tsx @@ -0,0 +1,135 @@ +/* + * 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 React, { useEffect, useState } from 'react'; +import { green, red } from '@material-ui/core/colors'; +import { + IconButton, + ListItem, + ListItemIcon, + ListItemText, + makeStyles, +} from '@material-ui/core'; +import CheckCircleOutline from '@material-ui/icons/CheckCircleOutline'; +import ErrorOutlineIcon from '@material-ui/icons/ErrorOutline'; +import FiberManualRecordIcon from '@material-ui/icons/FiberManualRecord'; +import OpenInNewIcon from '@material-ui/icons/OpenInNew'; + +import { TEST_IDS } from '../../test-helpers/test-ids'; +import { ResponseStep } from '../../types/types'; + +interface ResponseStepListItemProps { + responseStep: ResponseStep; + index: number; + animationDelay?: number; +} + +const useStyles = makeStyles({ + item: { + transition: `opacity ${(props: any) => + props.animationDelay <= 0 + ? 0 + : Math.ceil(props.animationDelay / 2)}ms ease-in`, + overflow: 'hidden', + '&:before': { + flex: 'none', + }, + }, + hidden: { + opacity: 0, + height: 0, + minHeight: 0, + }, + shown: { + opacity: 1, + }, +}); + +export const ResponseStepListItem = ({ + responseStep, + index, + animationDelay = 300, +}: ResponseStepListItemProps) => { + const classes = useStyles({ animationDelay }); + const [renderMe, setRenderMe] = useState(false); + + useEffect(() => { + const timeoutId = setTimeout(() => { + setRenderMe(true); + }, animationDelay * index); + + return () => clearTimeout(timeoutId); + }, [animationDelay, index, setRenderMe]); + + function ItemIcon() { + if (responseStep.icon === 'success') { + return ( + + ); + } + + if (responseStep.icon === 'failure') { + return ( + + ); + } + + if (responseStep.link) { + return ( + { + const newTab = window.open(responseStep.link, '_blank'); + newTab?.focus(); + }} + > + + + ); + } + + return ( + + ); + } + + return ( + + + + + + + + ); +}; diff --git a/plugins/release-manager-as-a-service/src/constants/constants.test.ts b/plugins/release-manager-as-a-service/src/constants/constants.test.ts new file mode 100644 index 0000000000..616cf6f21e --- /dev/null +++ b/plugins/release-manager-as-a-service/src/constants/constants.test.ts @@ -0,0 +1,30 @@ +/* + * 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 * as constants from './constants'; + +describe('constants', () => { + it('should match snapshot', () => { + expect(constants).toMatchInlineSnapshot(` + Object { + "SEMVER_PARTS": Object { + "major": "major", + "minor": "minor", + "patch": "patch", + }, + } + `); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/constants/constants.ts b/plugins/release-manager-as-a-service/src/constants/constants.ts new file mode 100644 index 0000000000..c36c3b63b3 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/constants/constants.ts @@ -0,0 +1,24 @@ +/* + * 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. + */ +export const SEMVER_PARTS: { + major: 'major'; + minor: 'minor'; + patch: 'patch'; +} = { + major: 'major', + minor: 'minor', + patch: 'patch', +} as const; diff --git a/plugins/release-manager-as-a-service/src/errors/ReleaseManagerAsAServiceError.ts b/plugins/release-manager-as-a-service/src/errors/ReleaseManagerAsAServiceError.ts new file mode 100644 index 0000000000..cd6231d229 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/errors/ReleaseManagerAsAServiceError.ts @@ -0,0 +1,22 @@ +/* + * 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. + */ +export class ReleaseManagerAsAServiceError extends Error { + constructor(message: string) { + super(message); + + this.name = 'ReleaseManagerAsAServiceError'; + } +} diff --git a/plugins/release-manager-as-a-service/src/helpers/date.test.ts b/plugins/release-manager-as-a-service/src/helpers/date.test.ts new file mode 100644 index 0000000000..06bdd31573 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/helpers/date.test.ts @@ -0,0 +1,26 @@ +/* + * 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 { getNewDate } from './date'; + +describe('getNewDate', () => { + it('should get a date', () => { + const newDate = getNewDate(); + + expect(newDate.toISOString()).toMatch( + /[\d]{4}-[\d]{2}-[\d]{2}T[\d]{2}:[\d]{2}:[\d]{2}.[\d]{3}Z/, + ); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/helpers/date.ts b/plugins/release-manager-as-a-service/src/helpers/date.ts new file mode 100644 index 0000000000..6c9d8423b6 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/helpers/date.ts @@ -0,0 +1,16 @@ +/* + * 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. + */ +export const getNewDate = () => new Date(); diff --git a/plugins/release-manager-as-a-service/src/helpers/getBumpedTag.test.ts b/plugins/release-manager-as-a-service/src/helpers/getBumpedTag.test.ts new file mode 100644 index 0000000000..dc81f93e67 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/helpers/getBumpedTag.test.ts @@ -0,0 +1,124 @@ +/* + * 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 { + mockCalverProject, + mockSemverProject, +} from '../test-helpers/test-helpers'; +import { getBumpedTag } from './getBumpedTag'; + +describe('getBumpedTag', () => { + describe('calver', () => { + it('should increment patch by 1', () => { + const result = getBumpedTag({ + project: mockCalverProject, + tag: 'rc-2020.01.01_1', + bumpLevel: 'patch', + }); + + expect(result).toMatchInlineSnapshot(` + Object { + "bumpedTag": "rc-2020.01.01_2", + "tagParts": Object { + "calver": "2020.01.01", + "patch": 2, + "prefix": "rc", + }, + } + `); + }); + + it('should increment patch by 1 regardless of semver-specific arg "bumpLevel"', () => { + const result = getBumpedTag({ + project: mockCalverProject, + tag: 'rc-2020.01.01_1', + bumpLevel: 'major', + }); + + expect(result).toMatchInlineSnapshot(` + Object { + "bumpedTag": "rc-2020.01.01_2", + "tagParts": Object { + "calver": "2020.01.01", + "patch": 2, + "prefix": "rc", + }, + } + `); + }); + }); + + describe('semver', () => { + it('should increment patch by 1', () => { + const result = getBumpedTag({ + project: mockSemverProject, + tag: 'rc-1.2.3', + bumpLevel: 'patch', + }); + + expect(result).toMatchInlineSnapshot(` + Object { + "bumpedTag": "rc-1.2.4", + "tagParts": Object { + "major": 1, + "minor": 2, + "patch": 4, + "prefix": "rc", + }, + } + `); + }); + + it('should increment minor by 1', () => { + const result = getBumpedTag({ + project: mockSemverProject, + tag: 'rc-1.2.3', + bumpLevel: 'minor', + }); + + expect(result).toMatchInlineSnapshot(` + Object { + "bumpedTag": "rc-1.3.0", + "tagParts": Object { + "major": 1, + "minor": 3, + "patch": 0, + "prefix": "rc", + }, + } + `); + }); + + it('should increment major by 1', () => { + const result = getBumpedTag({ + project: mockSemverProject, + tag: 'rc-1.2.3', + bumpLevel: 'major', + }); + + expect(result).toMatchInlineSnapshot(` + Object { + "bumpedTag": "rc-2.0.0", + "tagParts": Object { + "major": 2, + "minor": 0, + "patch": 0, + "prefix": "rc", + }, + } + `); + }); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/helpers/getBumpedTag.ts b/plugins/release-manager-as-a-service/src/helpers/getBumpedTag.ts new file mode 100644 index 0000000000..a6d4e43172 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/helpers/getBumpedTag.ts @@ -0,0 +1,94 @@ +/* + * 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 { CalverTagParts } from './tagParts/getCalverTagParts'; +import { getTagParts } from './tagParts/getTagParts'; +import { isCalverTagParts } from './isCalverTagParts'; +import { Project } from '../types/types'; +import { SEMVER_PARTS } from '../constants/constants'; +import { SemverTagParts } from './tagParts/getSemverTagParts'; + +export function getBumpedTag({ + project, + tag, + bumpLevel, +}: { + project: Project; + tag: string; + bumpLevel: keyof typeof SEMVER_PARTS; +}) { + const tagParts = getTagParts({ project, tag }); + + if (isCalverTagParts(project, tagParts)) { + return getPatchedCalverTag(tagParts); + } + + return getBumpedSemverTag(tagParts, bumpLevel); +} + +function getPatchedCalverTag(tagParts: CalverTagParts) { + const bumpedTagParts: CalverTagParts = { + ...tagParts, + patch: tagParts.patch + 1, + }; + const bumpedTag = `${bumpedTagParts.prefix}-${bumpedTagParts.calver}_${bumpedTagParts.patch}`; + + return { + bumpedTag, + tagParts: bumpedTagParts, + }; +} + +function getBumpedSemverTag( + tagParts: SemverTagParts, + semverBumpLevel: keyof typeof SEMVER_PARTS, +) { + const { bumpedTagParts } = getBumpedSemverTagParts(tagParts, semverBumpLevel); + + const bumpedTag = `${bumpedTagParts.prefix}-${bumpedTagParts.major}.${bumpedTagParts.minor}.${bumpedTagParts.patch}`; + + return { + bumpedTag, + tagParts: bumpedTagParts, + }; +} + +export function getBumpedSemverTagParts( + tagParts: SemverTagParts, + semverBumpLevel: keyof typeof SEMVER_PARTS, +) { + const bumpedTagParts = { + ...tagParts, + }; + + if (semverBumpLevel === 'major') { + bumpedTagParts.major = bumpedTagParts.major + 1; + bumpedTagParts.minor = 0; + bumpedTagParts.patch = 0; + } + + if (semverBumpLevel === 'minor') { + bumpedTagParts.minor = bumpedTagParts.minor + 1; + bumpedTagParts.patch = 0; + } + + if (semverBumpLevel === 'patch') { + bumpedTagParts.patch = bumpedTagParts.patch + 1; + } + + return { + bumpedTagParts, + }; +} diff --git a/plugins/release-manager-as-a-service/src/helpers/getShortCommitHash.test.ts b/plugins/release-manager-as-a-service/src/helpers/getShortCommitHash.test.ts new file mode 100644 index 0000000000..4f9b57f6f1 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/helpers/getShortCommitHash.test.ts @@ -0,0 +1,33 @@ +/* + * 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 { getShortCommitHash } from './getShortCommitHash'; + +describe('getShortCommitHash', () => { + it('should get the short version of the commit hash', () => { + const result = getShortCommitHash( + 'bd3fc6f6351018a748bb7f94c0ecf6c1577d8e06', + ); + + expect(result).toEqual('bd3fc6f'); + expect(result.length).toEqual(7); + }); + + it('should throw for invalid commit hashes (too short)', () => { + expect(() => getShortCommitHash('bd3')).toThrowErrorMatchingInlineSnapshot( + `"Invalid shortCommitHash: less than 7 characters"`, + ); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/helpers/getShortCommitHash.ts b/plugins/release-manager-as-a-service/src/helpers/getShortCommitHash.ts new file mode 100644 index 0000000000..7abc541606 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/helpers/getShortCommitHash.ts @@ -0,0 +1,28 @@ +/* + * 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 { ReleaseManagerAsAServiceError } from '../errors/ReleaseManagerAsAServiceError'; + +export function getShortCommitHash(hash: string) { + const shortCommitHash = hash.substr(0, 7); + + if (shortCommitHash.length < 7) { + throw new ReleaseManagerAsAServiceError( + 'Invalid shortCommitHash: less than 7 characters', + ); + } + + return shortCommitHash; +} diff --git a/plugins/release-manager-as-a-service/src/helpers/isCalverTagParts.test.ts b/plugins/release-manager-as-a-service/src/helpers/isCalverTagParts.test.ts new file mode 100644 index 0000000000..33be3cc2e0 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/helpers/isCalverTagParts.test.ts @@ -0,0 +1,32 @@ +/* + * 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 { + mockCalverProject, + mockSemverProject, +} from '../test-helpers/test-helpers'; +import { isCalverTagParts } from './isCalverTagParts'; + +describe('isCalverTagParts', () => { + describe('calver', () => { + it('should return true', () => + expect(isCalverTagParts(mockCalverProject, {})).toEqual(true)); + }); + + describe('semver', () => { + it('should return false', () => + expect(isCalverTagParts(mockSemverProject, {})).toEqual(false)); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/helpers/isCalverTagParts.ts b/plugins/release-manager-as-a-service/src/helpers/isCalverTagParts.ts new file mode 100644 index 0000000000..825486c248 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/helpers/isCalverTagParts.ts @@ -0,0 +1,24 @@ +/* + * 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 { CalverTagParts } from './tagParts/getCalverTagParts'; +import { Project } from '../types/types'; + +export function isCalverTagParts( + project: Project, + _tagParts: unknown, +): _tagParts is CalverTagParts { + return project.versioningStrategy === 'calver'; +} diff --git a/plugins/release-manager-as-a-service/src/helpers/tagParts/getCalverTagParts.ts b/plugins/release-manager-as-a-service/src/helpers/tagParts/getCalverTagParts.ts new file mode 100644 index 0000000000..c6169ac7f5 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/helpers/tagParts/getCalverTagParts.ts @@ -0,0 +1,40 @@ +/* + * 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 { ReleaseManagerAsAServiceError } from '../../errors/ReleaseManagerAsAServiceError'; + +export type CalverTagParts = { + prefix: string; + calver: string; + patch: number; +}; + +export function getCalverTagParts(tag: string) { + const result = tag.match( + /(rc|version)-([0-9]{4}\.[0-9]{2}\.[0-9]{2})_([0-9]+)/, + ); + + if (result === null || result.length < 4) { + throw new ReleaseManagerAsAServiceError('Invalid calver tag'); + } + + const tagParts: CalverTagParts = { + prefix: result[1], + calver: result[2], + patch: parseInt(result[3], 10), + }; + + return tagParts; +} diff --git a/plugins/release-manager-as-a-service/src/helpers/tagParts/getSemverTagParts.ts b/plugins/release-manager-as-a-service/src/helpers/tagParts/getSemverTagParts.ts new file mode 100644 index 0000000000..8b2ae2873b --- /dev/null +++ b/plugins/release-manager-as-a-service/src/helpers/tagParts/getSemverTagParts.ts @@ -0,0 +1,40 @@ +/* + * 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 { ReleaseManagerAsAServiceError } from '../../errors/ReleaseManagerAsAServiceError'; + +export type SemverTagParts = { + prefix: string; + major: number; + minor: number; + patch: number; +}; + +export function getSemverTagParts(tag: string) { + const result = tag.match(/(rc|version)-([0-9]+)\.([0-9]+)\.([0-9]+)/); + + if (result === null || result.length < 4) { + throw new ReleaseManagerAsAServiceError('Invalid semver tag'); + } + + const tagParts: SemverTagParts = { + prefix: result[1], + major: parseInt(result[2], 10), + minor: parseInt(result[3], 10), + patch: parseInt(result[4], 10), + }; + + return tagParts; +} diff --git a/plugins/release-manager-as-a-service/src/helpers/tagParts/getTagParts.test.ts b/plugins/release-manager-as-a-service/src/helpers/tagParts/getTagParts.test.ts new file mode 100644 index 0000000000..0536cd3d7d --- /dev/null +++ b/plugins/release-manager-as-a-service/src/helpers/tagParts/getTagParts.test.ts @@ -0,0 +1,112 @@ +/* + * 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 { + mockCalverProject, + mockSemverProject, +} from '../../test-helpers/test-helpers'; +import { getTagParts } from './getTagParts'; + +describe('getTagParts', () => { + describe('calver', () => { + it('should return tagParts for RC tag', () => + expect( + getTagParts({ project: mockCalverProject, tag: 'rc-2020.01.01_1' }), + ).toMatchInlineSnapshot(` + Object { + "calver": "2020.01.01", + "patch": 1, + "prefix": "rc", + } + `)); + + it('should return tagParts for Version tag', () => + expect( + getTagParts({ + project: mockCalverProject, + tag: 'version-2020.01.01_1', + }), + ).toMatchInlineSnapshot(` + Object { + "calver": "2020.01.01", + "patch": 1, + "prefix": "version", + } + `)); + + it('should return null for invalid prefix', () => { + expect(() => + getTagParts({ + project: mockCalverProject, + tag: 'invalid-2020.01.01_1', + }), + ).toThrowErrorMatchingInlineSnapshot(`"Invalid calver tag"`); + }); + + it('should return null for invalid calver (missing padded zero)', () => { + expect(() => + getTagParts({ project: mockCalverProject, tag: 'rc-2020.1.01_1' }), + ).toThrowErrorMatchingInlineSnapshot(`"Invalid calver tag"`); + }); + + it('should return null for invalid calver (missing day)', () => { + expect(() => + getTagParts({ project: mockCalverProject, tag: 'rc-2020.01_1' }), + ).toThrowErrorMatchingInlineSnapshot(`"Invalid calver tag"`); + }); + + it('should return null for invalid patch (letter instead of number)', () => { + expect(() => + getTagParts({ project: mockCalverProject, tag: 'rc-2020.01.01_a' }), + ).toThrowErrorMatchingInlineSnapshot(`"Invalid calver tag"`); + }); + }); + + describe('semver', () => { + it('should return tagParts for RC tag', () => + expect(getTagParts({ project: mockSemverProject, tag: 'rc-1.2.3' })) + .toMatchInlineSnapshot(` + Object { + "major": 1, + "minor": 2, + "patch": 3, + "prefix": "rc", + } + `)); + + it('should return tagParts for Version tag', () => + expect(getTagParts({ project: mockSemverProject, tag: 'version-1.2.3' })) + .toMatchInlineSnapshot(` + Object { + "major": 1, + "minor": 2, + "patch": 3, + "prefix": "version", + } + `)); + + it('should throw for invalid prefix', () => { + expect(() => + getTagParts({ project: mockSemverProject, tag: 'invalid-1.2.3' }), + ).toThrowErrorMatchingInlineSnapshot(`"Invalid semver tag"`); + }); + + it('should throw for invalid semver (missing patch)', () => { + expect(() => + getTagParts({ project: mockSemverProject, tag: 'rc-1.2' }), + ).toThrowErrorMatchingInlineSnapshot(`"Invalid semver tag"`); + }); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/helpers/tagParts/getTagParts.ts b/plugins/release-manager-as-a-service/src/helpers/tagParts/getTagParts.ts new file mode 100644 index 0000000000..3e7f85598b --- /dev/null +++ b/plugins/release-manager-as-a-service/src/helpers/tagParts/getTagParts.ts @@ -0,0 +1,32 @@ +/* + * 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 { getCalverTagParts } from './getCalverTagParts'; +import { getSemverTagParts } from './getSemverTagParts'; +import { Project } from '../../types/types'; + +export function getTagParts({ + project, + tag, +}: { + project: Project; + tag: string; +}) { + if (project.versioningStrategy === 'calver') { + return getCalverTagParts(tag); + } + + return getSemverTagParts(tag); +} diff --git a/plugins/release-manager-as-a-service/src/index.ts b/plugins/release-manager-as-a-service/src/index.ts new file mode 100644 index 0000000000..3461c92d03 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/index.ts @@ -0,0 +1,19 @@ +/* + * 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. + */ +export { + releaseManagerAsAServicePlugin, + ReleaseManagerAsAServicePage, +} from './plugin'; diff --git a/plugins/release-manager-as-a-service/src/plugin.test.ts b/plugins/release-manager-as-a-service/src/plugin.test.ts new file mode 100644 index 0000000000..2ecbad7bc5 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/plugin.test.ts @@ -0,0 +1,22 @@ +/* + * 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 { releaseManagerAsAServicePlugin } from './plugin'; + +describe('release-manager-as-a-service', () => { + it('should export plugin', () => { + expect(releaseManagerAsAServicePlugin).toBeDefined(); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/plugin.ts b/plugins/release-manager-as-a-service/src/plugin.ts new file mode 100644 index 0000000000..a1ccabd20f --- /dev/null +++ b/plugins/release-manager-as-a-service/src/plugin.ts @@ -0,0 +1,54 @@ +/* + * 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 { + configApiRef, + createPlugin, + createApiFactory, + githubAuthApiRef, + createRoutableExtension, +} from '@backstage/core'; + +import { releaseManagerAsAServiceApiRef } from './api/serviceApiRef'; +import { PluginApiClientConfig } from './api/PluginApiClientConfig'; +import { rootRouteRef } from './routes'; + +export const releaseManagerAsAServicePlugin = createPlugin({ + id: 'release-manager-as-a-service', + routes: { + root: rootRouteRef, + }, + apis: [ + createApiFactory({ + api: releaseManagerAsAServiceApiRef, + deps: { + configApi: configApiRef, + githubAuthApi: githubAuthApiRef, + }, + factory: ({ configApi, githubAuthApi }) => + new PluginApiClientConfig({ configApi, githubAuthApi }), + }), + ], +}); + +export const ReleaseManagerAsAServicePage = releaseManagerAsAServicePlugin.provide( + createRoutableExtension({ + component: () => + import('./ReleaseManagerAsAService').then( + m => m.ReleaseManagerAsAService, + ), + mountPoint: rootRouteRef, + }), +); diff --git a/plugins/release-manager-as-a-service/src/routes.ts b/plugins/release-manager-as-a-service/src/routes.ts new file mode 100644 index 0000000000..6527388235 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/routes.ts @@ -0,0 +1,20 @@ +/* + * 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 { createRouteRef } from '@backstage/core'; + +export const rootRouteRef = createRouteRef({ + title: 'release-manager-as-a-service', +}); diff --git a/plugins/release-manager-as-a-service/src/setupTests.ts b/plugins/release-manager-as-a-service/src/setupTests.ts new file mode 100644 index 0000000000..0cec5b395d --- /dev/null +++ b/plugins/release-manager-as-a-service/src/setupTests.ts @@ -0,0 +1,17 @@ +/* + * 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 '@testing-library/jest-dom'; +import 'cross-fetch/polyfill'; diff --git a/plugins/release-manager-as-a-service/src/sideEffects/getGitHubBatchInfo.ts b/plugins/release-manager-as-a-service/src/sideEffects/getGitHubBatchInfo.ts new file mode 100644 index 0000000000..cb044f6f92 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/sideEffects/getGitHubBatchInfo.ts @@ -0,0 +1,48 @@ +/* + * 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 { RMaaSApiClient } from '../api/RMaaSApiClient'; +import { getLatestRelease } from './getLatestRelease'; + +interface GetGitHubBatchInfo { + apiClient: RMaaSApiClient; +} + +export const getGitHubBatchInfo = ({ + apiClient, +}: GetGitHubBatchInfo) => async () => { + const [{ repository }, latestRelease] = await Promise.all([ + apiClient.getRepository(), + getLatestRelease({ apiClient }), + ]); + + if (latestRelease === null) { + return { + latestRelease, + releaseBranch: null, + repository, + }; + } + + const { branch } = await apiClient.getBranch({ + branchName: latestRelease.target_commitish, + }); + + return { + latestRelease, + releaseBranch: branch, + repository, + }; +}; diff --git a/plugins/release-manager-as-a-service/src/sideEffects/getLatestRelease.test.ts b/plugins/release-manager-as-a-service/src/sideEffects/getLatestRelease.test.ts new file mode 100644 index 0000000000..eb275092da --- /dev/null +++ b/plugins/release-manager-as-a-service/src/sideEffects/getLatestRelease.test.ts @@ -0,0 +1,42 @@ +/* + * 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 { mockApiClient } from '../test-helpers/test-helpers'; +import { getLatestRelease } from './getLatestRelease'; + +describe('getLatestRelease', () => { + beforeEach(jest.clearAllMocks); + + it('should return the latest release with id=1', async () => { + const result = await getLatestRelease({ apiClient: mockApiClient }); + + expect(result).toMatchInlineSnapshot(` + Object { + "body": "mock_latest_release", + "html_url": "mock_release_html_url", + "id": 1, + "prerelease": false, + } + `); + }); + + it('should return early with `null` if no releases found', async () => { + mockApiClient.getReleases.mockImplementationOnce(() => ({ releases: [] })); + + const result = await getLatestRelease({ apiClient: mockApiClient }); + + expect(result).toMatchInlineSnapshot(`null`); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/sideEffects/getLatestRelease.ts b/plugins/release-manager-as-a-service/src/sideEffects/getLatestRelease.ts new file mode 100644 index 0000000000..1044d510c5 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/sideEffects/getLatestRelease.ts @@ -0,0 +1,34 @@ +/* + * 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 { RMaaSApiClient } from '../api/RMaaSApiClient'; + +interface GetLatestRelease { + apiClient: RMaaSApiClient; +} + +export async function getLatestRelease({ apiClient }: GetLatestRelease) { + const { releases } = await apiClient.getReleases(); + + if (releases.length === 0) { + return null; + } + + const { latestRelease } = await apiClient.getRelease({ + releaseId: releases[0].id, + }); + + return latestRelease; +} diff --git a/plugins/release-manager-as-a-service/src/styles/styles.ts b/plugins/release-manager-as-a-service/src/styles/styles.ts new file mode 100644 index 0000000000..1548953069 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/styles/styles.ts @@ -0,0 +1,22 @@ +/* + * 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 { makeStyles, Theme } from '@material-ui/core'; + +export const useStyles = makeStyles((_theme: Theme) => ({ + paragraph: { + marginBottom: '1em', + }, +})); diff --git a/plugins/release-manager-as-a-service/src/test-helpers/test-helpers.test.ts b/plugins/release-manager-as-a-service/src/test-helpers/test-helpers.test.ts new file mode 100644 index 0000000000..e72eba4df4 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/test-helpers/test-helpers.test.ts @@ -0,0 +1,165 @@ +/* + * 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 * as testHelpers from './test-helpers'; + +describe('testHelpers', () => { + it('should match snapshot', () => { + expect(testHelpers).toMatchInlineSnapshot(` + Object { + "mockApiClient": Object { + "createRc": Object { + "createRef": [MockFunction], + "createRelease": [MockFunction], + "getComparison": [MockFunction], + }, + "getBranch": [MockFunction], + "getLatestCommit": [MockFunction], + "getOctokit": [Function], + "getProject": [MockFunction], + "getRecentCommits": [MockFunction], + "getRelease": [MockFunction], + "getReleases": [MockFunction], + "getRepoPath": [MockFunction], + "getRepository": [MockFunction], + "githubAuthApi": Object { + "getAccessToken": [MockFunction], + }, + "patch": Object { + "createCherryPickCommit": [MockFunction], + "createReference": [MockFunction], + "createTagObject": [MockFunction], + "createTempCommit": [MockFunction], + "forceBranchHeadToTempCommit": [MockFunction], + "merge": [MockFunction], + "replaceTempCommit": [MockFunction], + "updateRelease": [MockFunction], + }, + "pluginApiClient": Object { + "baseUrl": "http://mock_base_url.hehe", + "getOctokit": [MockFunction], + }, + "project": Object { + "github": Object { + "org": "mock_org", + "repo": "mock_repo", + }, + "name": "mock_name", + "versioningStrategy": "semver", + }, + "promoteRc": Object { + "promoteRelease": [MockFunction], + }, + }, + "mockBumpedTag": "rc-2020.01.01_1337", + "mockCalverProject": Object { + "github": Object { + "org": "mock_org", + "repo": "mock_repo", + }, + "name": "mock_name", + "versioningStrategy": "calver", + }, + "mockDefaultBranch": "mock_defaultBranch", + "mockNextGheInfo": Object { + "rcBranch": "rc/1.2.3", + "rcReleaseTag": "rc-1.2.3", + "releaseName": "Version 1.2.3", + }, + "mockRcRelease": Object { + "body": "mock_body", + "html_url": "mock_release_html_url", + "id": 1, + "prerelease": true, + "tag_name": "rc-2020.01.01_1", + "target_commitish": "rc/1.2.3", + }, + "mockRecentCommits": Array [ + Object { + "author": Object { + "html_url": "mock_recentCommits_author_html_url", + "login": "mock_recentCommit_author_login", + }, + "commit": Object { + "message": "mock_latestCommit_message", + }, + "html_url": "mock_latestCommit_html_url", + "node_id": "1", + "sha": "mock_latestCommit_sha", + }, + Object { + "author": Object { + "html_url": "mock_recentCommits_author_html_url", + "login": "mock_recentCommit_author_login", + }, + "commit": Object { + "message": "mock_latestCommit_message", + }, + "html_url": "mock_latestCommit_html_url", + "node_id": "2", + "sha": "mock_latestCommit_sha", + }, + ], + "mockReleaseBranch": Object { + "_links": Object { + "html": "mock_branch__links_html", + }, + "commit": Object { + "commit": Object { + "tree": Object { + "sha": "mock_branch_commit_commit_tree_sha", + }, + }, + "sha": "mock_branch_commit_sha", + }, + "name": "rc/1.2.3", + }, + "mockReleaseVersion": Object { + "body": "mock_body", + "html_url": "mock_release_html_url", + "id": 1, + "prerelease": false, + "tag_name": "version-2020.01.01_1", + "target_commitish": "rc/1.2.3", + }, + "mockSelectedPatchCommit": Object { + "author": Object { + "html_url": "mock_recentCommits_author_html_url", + "login": "mock_recentCommit_author_login", + }, + "commit": Object { + "message": "mock_latestCommit_message", + }, + "html_url": "mock_latestCommit_html_url", + "node_id": "mock_selected_patch_commit", + "sha": "mock_latestCommit_sha", + }, + "mockSemverProject": Object { + "github": Object { + "org": "mock_org", + "repo": "mock_repo", + }, + "name": "mock_name", + "versioningStrategy": "semver", + }, + "mockTagParts": Object { + "calver": "2020.01.01", + "patch": 1, + "prefix": "rc", + }, + } + `); + }); +}); diff --git a/plugins/release-manager-as-a-service/src/test-helpers/test-helpers.ts b/plugins/release-manager-as-a-service/src/test-helpers/test-helpers.ts new file mode 100644 index 0000000000..b994e591d2 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/test-helpers/test-helpers.ts @@ -0,0 +1,255 @@ +/* + * 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 { CalverTagParts } from '../helpers/tagParts/getCalverTagParts'; +import { getRcGheInfo } from '../cards/createRc/getRcGheInfo'; +import { + GhCompareCommitsResponse, + GhCreateCommitResponse, + GhCreateReferenceResponse, + GhCreateReleaseResponse, + GhCreateTagObjectResponse, + GhGetBranchResponse, + GhGetCommitResponse, + GhGetReleaseResponse, + GhMergeResponse, + GhUpdateReferenceResponse, + GhUpdateReleaseResponse, + Project, +} from '../types/types'; + +export const mockSemverProject: Project = { + github: { + org: 'mock_org', + repo: 'mock_repo', + }, + name: 'mock_name', + versioningStrategy: 'semver', +}; + +export const mockCalverProject: Project = { + github: { + org: 'mock_org', + repo: 'mock_repo', + }, + name: 'mock_name', + versioningStrategy: 'calver', +}; + +export const mockDefaultBranch = 'mock_defaultBranch'; + +export const mockNextGheInfo: ReturnType = { + rcBranch: 'rc/1.2.3', + rcReleaseTag: 'rc-1.2.3', + releaseName: 'Version 1.2.3', +}; + +export const mockTagParts = { + prefix: 'rc', + calver: '2020.01.01', + patch: 1, +} as CalverTagParts; + +export const mockBumpedTag = 'rc-2020.01.01_1337'; + +/** + * MOCK RELEASE + */ +const createMockRelease = ({ + id = 1, + prerelease = false, + ...rest +}: Partial = {}) => + ({ + id: 1, + body: 'mock_body', + html_url: 'mock_release_html_url', + prerelease, + ...rest, + } as GhGetReleaseResponse); +export const mockRcRelease = createMockRelease({ + prerelease: true, + tag_name: 'rc-2020.01.01_1', + target_commitish: 'rc/1.2.3', +}); +export const mockReleaseVersion = createMockRelease({ + prerelease: false, + tag_name: 'version-2020.01.01_1', + target_commitish: 'rc/1.2.3', +}); + +/** + * MOCK BRANCH + */ +const createMockBranch = ({ ...rest }: Partial = {}) => + ({ + name: 'rc/1.2.3', + commit: { + sha: 'mock_branch_commit_sha', + commit: { tree: { sha: 'mock_branch_commit_commit_tree_sha' } }, + }, + _links: { html: 'mock_branch__links_html' }, + ...rest, + } as GhGetBranchResponse); +export const mockReleaseBranch = createMockBranch(); + +/** + * MOCK COMMIT + */ +const createMockCommit = ({ node_id = '1' }: Partial) => + ({ + node_id, + author: { + html_url: 'mock_recentCommits_author_html_url', + login: 'mock_recentCommit_author_login', + }, + commit: { + message: 'mock_latestCommit_message', + }, + html_url: 'mock_latestCommit_html_url', + sha: 'mock_latestCommit_sha', + } as GhGetCommitResponse); +export const mockRecentCommits = [ + createMockCommit({ node_id: '1' }), + createMockCommit({ node_id: '2' }), +] as GhGetCommitResponse[]; + +export const mockSelectedPatchCommit = createMockCommit({ + node_id: 'mock_selected_patch_commit', +}); + +/** + * MOCK API CLIENT + */ +export const mockApiClient = { + pluginApiClient: { + getOctokit: jest.fn(), + baseUrl: 'http://mock_base_url.hehe', + }, + + getRepoPath: jest.fn(() => 'erikengervall/playground'), + + getRecentCommits: jest.fn().mockResolvedValue({ + recentCommits: mockRecentCommits, + }), + getReleases: jest.fn().mockResolvedValue({ + releases: [ + createMockRelease({ id: 1, body: 'mock_releases[0]' }), + createMockRelease({ id: 2, body: 'mock_releases[1]' }), + ], + }), + getRelease: jest.fn().mockResolvedValue({ + latestRelease: createMockRelease({ id: 1, body: 'mock_latest_release' }), + }), + + getBranch: jest.fn().mockResolvedValue({ + branch: mockReleaseBranch, + }), + getLatestCommit: jest.fn().mockResolvedValue({ + latestCommit: createMockCommit({ node_id: 'mock_latest_commit' }), + }), + getOctokit: () => ({ + octokit: { + request: jest.fn(), + }, + }), + getProject: jest.fn(), + + getRepository: jest.fn(), + githubAuthApi: { + getAccessToken: jest.fn(), + }, + createRc: { + createRef: jest.fn().mockResolvedValue({ + createdRef: { + ref: 'mock_createRef_ref', + } as GhCreateReferenceResponse, + }), + createRelease: jest.fn().mockResolvedValue({ + createReleaseResponse: { + name: 'mock_createRelease_name', + html_url: 'mock_createRelease_html_url', + tag_name: 'mock_createRelease_tag_name', + } as GhCreateReleaseResponse, + }), + getComparison: jest.fn().mockResolvedValue({ + comparison: { + html_url: 'mock_compareCommits_html_url', + ahead_by: 1, + } as GhCompareCommitsResponse, + }), + }, + patch: { + createCherryPickCommit: jest.fn().mockResolvedValue({ + cherryPickCommit: { + commit: { + message: 'mock_merge_commit_message', + tree: { sha: 'mock_merge_commit_tree_sha' }, + }, + html_url: 'mock_merge_html_url', + } as GhMergeResponse, + }), + createReference: jest.fn().mockResolvedValue({ + reference: { + ref: 'mock_reference_ref', + } as GhCreateReferenceResponse, + }), + createTagObject: jest.fn().mockResolvedValue({ + tagObjectResponse: { + tag: 'mock_tag_object_tag', + sha: 'mock_tag_object_sha', + } as GhCreateTagObjectResponse, + }), + createTempCommit: jest.fn().mockResolvedValue({ + tempCommit: { + message: 'mock_commit_message', + sha: 'mock_commit_sha', + } as GhCreateCommitResponse, + }), + forceBranchHeadToTempCommit: jest.fn().mockResolvedValue(undefined), + merge: jest.fn().mockResolvedValue({ + merge: { + commit: { + message: 'mock_merge_commit_message', + tree: { sha: 'mock_merge_commit_tree_sha' }, + }, + html_url: 'mock_merge_html_url', + } as GhMergeResponse, + }), + replaceTempCommit: jest.fn().mockResolvedValue({ + updatedReference: { + ref: 'mock_reference_ref', + object: { sha: 'mock_reference_object_sha' }, + } as GhUpdateReferenceResponse, + }), + updateRelease: jest.fn().mockResolvedValue({ + release: { + name: 'mock_update_release_name', + tag_name: 'mock_update_release_tag_name', + html_url: 'mock_update_release_html_url', + } as GhUpdateReleaseResponse, + }), + }, + promoteRc: { + promoteRelease: jest.fn().mockResolvedValue({ + release: { + name: 'mock_release_name', + tag_name: 'mock_release_tag_name', + html_url: 'mock_release_html_url', + } as GhGetReleaseResponse, + }), + }, + project: mockSemverProject, +} as any; diff --git a/plugins/release-manager-as-a-service/src/test-helpers/test-ids.ts b/plugins/release-manager-as-a-service/src/test-helpers/test-ids.ts new file mode 100644 index 0000000000..7eae6a3978 --- /dev/null +++ b/plugins/release-manager-as-a-service/src/test-helpers/test-ids.ts @@ -0,0 +1,53 @@ +/* + * 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. + */ +export const TEST_IDS = { + info: { + info: 'rmaas--info', + infoCardPlus: 'rmaas--info-card-plus', + }, + createRc: { + cta: 'rmaas--create-rc--cta', + semverSelect: 'rmaas--create-rc--semver-select', + }, + promoteRc: { + mockedPromoteRcBody: 'rmaas-mocked-promote-rc-body', + notRcWarning: 'rmaas--promote-rc--not-rc-warning', + promoteRc: 'rmaas--promote-rc', + cta: 'rmaas--promote-rc-body--cta', + }, + patch: { + error: 'rmaas--patch-body--error', + loading: 'rmaas--patch-body--loading', + notPrerelease: 'rmaas--patch-body--not-prerelease--info', + body: 'rmaas--patch-body', + }, + components: { + divider: 'rmaas--divider', + reloadButton: 'rmaas--reload-button', + noLatestRelease: 'rmaas--no-latest-release', + circularProgress: 'rmaas--circular-progress', + responseStepListDialogContent: 'rmaas--response-step-list--dialog-content', + responseStepListItem: 'rmaas--response-step-list-item', + responseStepListItemIconSuccess: + 'rmaas--response-step-list-item--item-icon--success', + responseStepListItemIconFailure: + 'rmaas--response-step-list-item--item-icon--failure', + responseStepListItemIconLink: + 'rmaas--response-step-list-item--item-icon--link', + responseStepListItemIconDefault: + 'rmaas--response-step-list-item--item-icon--default', + }, +}; diff --git a/plugins/release-manager-as-a-service/src/types/types.ts b/plugins/release-manager-as-a-service/src/types/types.ts new file mode 100644 index 0000000000..5af069b39b --- /dev/null +++ b/plugins/release-manager-as-a-service/src/types/types.ts @@ -0,0 +1,1939 @@ +/* + * 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. + */ +export interface Project { + /** A unique (in the context of RMaaS) project name */ + name: string; + + /** GitHub details */ + github: { + /** + * Repository's organization + * + * @example erikengervall + */ + org: string; + /** + * Repository's name + * + * @example dockest + */ + repo: string; + }; + + /** Slack details */ + slack?: { + /** Relevant slack channel for the project */ + channel: string; + /** Link to slack channel */ + link?: string; + }; + + /** + * Declares the versioning strategy of the project + * + * semver: `1.2.3` (major.minor.patch) + * calver: `2020.01.01_0` (YYYY.0M.0D_patch) + * + * Default: false + */ + versioningStrategy: 'calver' | 'semver'; +} + +interface ComponentConfig { + successCb?: (args: Args) => Promise | void; + omit?: boolean; +} + +export interface ComponentConfigCreateRcSuccessCbArgs { + gitHubReleaseUrl: string; + gitHubReleaseName: string; + comparisonUrl: string; + previousTag?: string; + createdTag: string; +} +export type ComponentConfigCreateRc = ComponentConfig; + +export interface ComponentConfigPromoteRcSuccessCbArgs { + gitHubReleaseUrl: string; + gitHubReleaseName: string; + previousTagUrl: string; + previousTag: string; + updatedTagUrl: string; + updatedTag: string; +} +export type ComponentConfigPromoteRc = ComponentConfig; + +export interface ComponentConfigPatchSuccessCbArgs { + updatedReleaseUrl: string; + updatedReleaseName: string; + previousTag: string; + patchedTag: string; + patchCommitUrl: string; + patchCommitMessage: string; +} +export type ComponentConfigPatch = ComponentConfig; + +export type SetRefetch = React.Dispatch>; + +export interface ResponseStep { + message: string | React.ReactNode; + secondaryMessage?: string | React.ReactNode; + link?: string; + icon?: 'success' | 'failure'; +} + +/** ******************************** + ******** GitHub API Types ********* + ***********************************/ +export interface GhCompareCommitsResponse { + /** @example 'https://api.github.com/repos/octocat/Hello-World/compare/master...topic'; */ + url: string; + /** @example 'https://github.com/octocat/Hello-World/compare/master...topic'; */ + html_url: string; + /** @example 'https://github.com/octocat/Hello-World/compare/octocat:bbcd538c8e72b8c175046e27cc8f907076331401...octocat:0328041d1152db8ae77652d1618a02e57f745f17'; */ + permalink_url: string; + /** @example 'https://github.com/octocat/Hello-World/compare/master...topic.diff'; */ + diff_url: string; + /** @example 'https://github.com/octocat/Hello-World/compare/master...topic.patch'; */ + patch_url: string; + base_commit: { + /** @example 'https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + url: string; + /** @example '6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + sha: string; + /** @example 'MDY6Q29tbWl0NmRjYjA5YjViNTc4NzVmMzM0ZjYxYWViZWQ2OTVlMmU0MTkzZGI1ZQ=='; */ + node_id: string; + /** @example 'https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + html_url: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e/comments'; */ + comments_url: string; + commit: { + /** @example 'https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + url: string; + author: { + /** @example 'Monalisa Octocat'; */ + name: string; + /** @example 'support@github.com'; */ + email: string; + /** @example '2011-04-14T16:00:49Z'; */ + date: string; + }; + committer: { + /** @example 'Monalisa Octocat'; */ + name: string; + /** @example 'support@github.com'; */ + email: string; + /** @example '2011-04-14T16:00:49Z'; */ + date: string; + }; + /** @example 'Fix all the bugs'; */ + message: string; + tree: { + /** @example 'https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + url: string; + /** @example '6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + sha: string; + }; + comment_count: number; + verification: { + verified: boolean; + /** @example 'unsigned'; */ + reason: string; + signature: null | any; + payload: null | any; + }; + }; + author: { + /** @example 'octocat'; */ + login: string; + id: number; + /** @example 'MDQ6VXNlcjE='; */ + node_id: string; + /** @example 'https://github.com/images/error/octocat_happy.gif'; */ + avatar_url: string; + /** @example ''; */ + gravatar_id: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + /** @example 'https://github.com/octocat'; */ + html_url: string; + /** @example 'https://api.github.com/users/octocat/followers'; */ + followers_url: string; + /** @example 'https://api.github.com/users/octocat/following{/other_user}'; */ + following_url: string; + /** @example 'https://api.github.com/users/octocat/gists{/gist_id}'; */ + gists_url: string; + /** @example 'https://api.github.com/users/octocat/starred{/owner}{/repo}'; */ + starred_url: string; + /** @example 'https://api.github.com/users/octocat/subscriptions'; */ + subscriptions_url: string; + /** @example 'https://api.github.com/users/octocat/orgs'; */ + organizations_url: string; + /** @example 'https://api.github.com/users/octocat/repos'; */ + repos_url: string; + /** @example 'https://api.github.com/users/octocat/events{/privacy}'; */ + events_url: string; + /** @example 'https://api.github.com/users/octocat/received_events'; */ + received_events_url: string; + /** @example 'User'; */ + type: string; + site_admin: boolean; + }; + committer: { + /** @example 'octocat'; */ + login: string; + id: number; + /** @example 'MDQ6VXNlcjE='; */ + node_id: string; + /** @example 'https://github.com/images/error/octocat_happy.gif'; */ + avatar_url: string; + /** @example ''; */ + gravatar_id: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + /** @example 'https://github.com/octocat'; */ + html_url: string; + /** @example 'https://api.github.com/users/octocat/followers'; */ + followers_url: string; + /** @example 'https://api.github.com/users/octocat/following{/other_user}'; */ + following_url: string; + /** @example 'https://api.github.com/users/octocat/gists{/gist_id}'; */ + gists_url: string; + /** @example 'https://api.github.com/users/octocat/starred{/owner}{/repo}'; */ + starred_url: string; + /** @example 'https://api.github.com/users/octocat/subscriptions'; */ + subscriptions_url: string; + /** @example 'https://api.github.com/users/octocat/orgs'; */ + organizations_url: string; + /** @example 'https://api.github.com/users/octocat/repos'; */ + repos_url: string; + /** @example 'https://api.github.com/users/octocat/events{/privacy}'; */ + events_url: string; + /** @example 'https://api.github.com/users/octocat/received_events'; */ + received_events_url: string; + /** @example 'User'; */ + type: string; + site_admin: boolean; + }; + parents: [ + { + /** @example 'https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + url: string; + /** @example '6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + sha: string; + }, + ]; + }; + merge_base_commit: { + /** @example 'https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + url: string; + /** @example '6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + sha: string; + /** @example 'MDY6Q29tbWl0NmRjYjA5YjViNTc4NzVmMzM0ZjYxYWViZWQ2OTVlMmU0MTkzZGI1ZQ=='; */ + node_id: string; + /** @example 'https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + html_url: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e/comments'; */ + comments_url: string; + commit: { + /** @example 'https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + url: string; + author: { + /** @example 'Monalisa Octocat'; */ + name: string; + /** @example 'support@github.com'; */ + email: string; + /** @example '2011-04-14T16:00:49Z'; */ + date: string; + }; + committer: { + /** @example 'Monalisa Octocat'; */ + name: string; + /** @example 'support@github.com'; */ + email: string; + /** @example '2011-04-14T16:00:49Z'; */ + date: string; + }; + /** @example 'Fix all the bugs'; */ + message: string; + tree: { + /** @example 'https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + url: string; + /** @example '6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + sha: string; + }; + comment_count: number; + verification: { + verified: boolean; + /** @example 'unsigned'; */ + reason: string; + signature: null | any; + payload: null | any; + }; + }; + author: { + /** @example 'octocat'; */ + login: string; + id: number; + /** @example 'MDQ6VXNlcjE='; */ + node_id: string; + /** @example 'https://github.com/images/error/octocat_happy.gif'; */ + avatar_url: string; + /** @example ''; */ + gravatar_id: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + /** @example 'https://github.com/octocat'; */ + html_url: string; + /** @example 'https://api.github.com/users/octocat/followers'; */ + followers_url: string; + /** @example 'https://api.github.com/users/octocat/following{/other_user}'; */ + following_url: string; + /** @example 'https://api.github.com/users/octocat/gists{/gist_id}'; */ + gists_url: string; + /** @example 'https://api.github.com/users/octocat/starred{/owner}{/repo}'; */ + starred_url: string; + /** @example 'https://api.github.com/users/octocat/subscriptions'; */ + subscriptions_url: string; + /** @example 'https://api.github.com/users/octocat/orgs'; */ + organizations_url: string; + /** @example 'https://api.github.com/users/octocat/repos'; */ + repos_url: string; + /** @example 'https://api.github.com/users/octocat/events{/privacy}'; */ + events_url: string; + /** @example 'https://api.github.com/users/octocat/received_events'; */ + received_events_url: string; + /** @example 'User'; */ + type: string; + site_admin: boolean; + }; + committer: { + /** @example 'octocat'; */ + login: string; + id: number; + /** @example 'MDQ6VXNlcjE='; */ + node_id: string; + /** @example 'https://github.com/images/error/octocat_happy.gif'; */ + avatar_url: string; + /** @example ''; */ + gravatar_id: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + /** @example 'https://github.com/octocat'; */ + html_url: string; + /** @example 'https://api.github.com/users/octocat/followers'; */ + followers_url: string; + /** @example 'https://api.github.com/users/octocat/following{/other_user}'; */ + following_url: string; + /** @example 'https://api.github.com/users/octocat/gists{/gist_id}'; */ + gists_url: string; + /** @example 'https://api.github.com/users/octocat/starred{/owner}{/repo}'; */ + starred_url: string; + /** @example 'https://api.github.com/users/octocat/subscriptions'; */ + subscriptions_url: string; + /** @example 'https://api.github.com/users/octocat/orgs'; */ + organizations_url: string; + /** @example 'https://api.github.com/users/octocat/repos'; */ + repos_url: string; + /** @example 'https://api.github.com/users/octocat/events{/privacy}'; */ + events_url: string; + /** @example 'https://api.github.com/users/octocat/received_events'; */ + received_events_url: string; + /** @example 'User'; */ + type: string; + site_admin: boolean; + }; + parents: [ + { + /** @example 'https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + url: string; + /** @example '6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + sha: string; + }, + ]; + }; + /** @example 'behind'; */ + status: string; + ahead_by: number; + behind_by: number; + total_commits: number; + commits: [ + { + /** @example 'https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + url: string; + /** @example '6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + sha: string; + /** @example 'MDY6Q29tbWl0NmRjYjA5YjViNTc4NzVmMzM0ZjYxYWViZWQ2OTVlMmU0MTkzZGI1ZQ=='; */ + node_id: string; + /** @example 'https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + html_url: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e/comments'; */ + comments_url: string; + commit: { + /** @example 'https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + url: string; + author: { + /** @example 'Monalisa Octocat'; */ + name: string; + /** @example 'support@github.com'; */ + email: string; + /** @example '2011-04-14T16:00:49Z'; */ + date: string; + }; + committer: { + /** @example 'Monalisa Octocat'; */ + name: string; + /** @example 'support@github.com'; */ + email: string; + /** @example '2011-04-14T16:00:49Z'; */ + date: string; + }; + /** @example 'Fix all the bugs'; */ + message: string; + tree: { + /** @example 'https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + url: string; + /** @example '6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + sha: string; + }; + comment_count: number; + verification: { + verified: boolean; + /** @example 'unsigned'; */ + reason: string; + signature: null | any; + payload: null | any; + }; + }; + author: { + /** @example 'octocat'; */ + login: string; + id: number; + /** @example 'MDQ6VXNlcjE='; */ + node_id: string; + /** @example 'https://github.com/images/error/octocat_happy.gif'; */ + avatar_url: string; + /** @example ''; */ + gravatar_id: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + /** @example 'https://github.com/octocat'; */ + html_url: string; + /** @example 'https://api.github.com/users/octocat/followers'; */ + followers_url: string; + /** @example 'https://api.github.com/users/octocat/following{/other_user}'; */ + following_url: string; + /** @example 'https://api.github.com/users/octocat/gists{/gist_id}'; */ + gists_url: string; + /** @example 'https://api.github.com/users/octocat/starred{/owner}{/repo}'; */ + starred_url: string; + /** @example 'https://api.github.com/users/octocat/subscriptions'; */ + subscriptions_url: string; + /** @example 'https://api.github.com/users/octocat/orgs'; */ + organizations_url: string; + /** @example 'https://api.github.com/users/octocat/repos'; */ + repos_url: string; + /** @example 'https://api.github.com/users/octocat/events{/privacy}'; */ + events_url: string; + /** @example 'https://api.github.com/users/octocat/received_events'; */ + received_events_url: string; + /** @example 'User'; */ + type: string; + site_admin: boolean; + }; + committer: { + /** @example 'octocat'; */ + login: string; + id: number; + /** @example 'MDQ6VXNlcjE='; */ + node_id: string; + /** @example 'https://github.com/images/error/octocat_happy.gif'; */ + avatar_url: string; + /** @example ''; */ + gravatar_id: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + /** @example 'https://github.com/octocat'; */ + html_url: string; + /** @example 'https://api.github.com/users/octocat/followers'; */ + followers_url: string; + /** @example 'https://api.github.com/users/octocat/following{/other_user}'; */ + following_url: string; + /** @example 'https://api.github.com/users/octocat/gists{/gist_id}'; */ + gists_url: string; + /** @example 'https://api.github.com/users/octocat/starred{/owner}{/repo}'; */ + starred_url: string; + /** @example 'https://api.github.com/users/octocat/subscriptions'; */ + subscriptions_url: string; + /** @example 'https://api.github.com/users/octocat/orgs'; */ + organizations_url: string; + /** @example 'https://api.github.com/users/octocat/repos'; */ + repos_url: string; + /** @example 'https://api.github.com/users/octocat/events{/privacy}'; */ + events_url: string; + /** @example 'https://api.github.com/users/octocat/received_events'; */ + received_events_url: string; + /** @example 'User'; */ + type: string; + site_admin: boolean; + }; + parents: [ + { + /** @example 'https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + url: string; + /** @example '6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + sha: string; + }, + ]; + }, + ]; + files: [ + { + /** @example 'bbcd538c8e72b8c175046e27cc8f907076331401'; */ + sha: string; + /** @example 'file1.txt'; */ + filename: string; + /** @example 'added'; */ + status: string; + additions: number; + deletions: number; + changes: number; + /** @example 'https://github.com/octocat/Hello-World/blob/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt'; */ + blob_url: string; + /** @example 'https://github.com/octocat/Hello-World/raw/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt'; */ + raw_url: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/contents/file1.txt?ref=6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + contents_url: string; + /** @example '@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test'; */ + patch: string; + }, + ]; +} + +export interface GhCreateReleaseResponse { + /** @example 'https://api.github.com/repos/octocat/Hello-World/releases/1'; */ + url: string; + /** @example 'https://github.com/octocat/Hello-World/releases/v1.0.0'; */ + html_url: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/releases/1/assets'; */ + assets_url: string; + /** @example 'https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name,label}'; */ + upload_url: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/tarball/v1.0.0'; */ + tarball_url: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/zipball/v1.0.0'; */ + zipball_url: string; + id: number; + /** @example 'MDc6UmVsZWFzZTE='; */ + node_id: string; + /** @example 'v1.0.0'; */ + tag_name: string; + /** @example 'master'; */ + target_commitish: string; + /** @example 'v1.0.0'; */ + name: string; + /** @example 'Description of the release'; */ + body: string; + draft: boolean; + prerelease: boolean; + /** @example '2013-02-27T19:35:32Z'; */ + created_at: string; + /** @example '2013-02-27T19:35:32Z'; */ + published_at: string; + author: { + /** @example 'octocat'; */ + login: string; + id: number; + /** @example 'MDQ6VXNlcjE='; */ + node_id: string; + /** @example 'https://github.com/images/error/octocat_happy.gif'; */ + avatar_url: string; + /** @example ''; */ + gravatar_id: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + /** @example 'https://github.com/octocat'; */ + html_url: string; + /** @example 'https://api.github.com/users/octocat/followers'; */ + followers_url: string; + /** @example 'https://api.github.com/users/octocat/following{/other_user}'; */ + following_url: string; + /** @example 'https://api.github.com/users/octocat/gists{/gist_id}'; */ + gists_url: string; + /** @example 'https://api.github.com/users/octocat/starred{/owner}{/repo}'; */ + starred_url: string; + /** @example 'https://api.github.com/users/octocat/subscriptions'; */ + subscriptions_url: string; + /** @example 'https://api.github.com/users/octocat/orgs'; */ + organizations_url: string; + /** @example 'https://api.github.com/users/octocat/repos'; */ + repos_url: string; + /** @example 'https://api.github.com/users/octocat/events{/privacy}'; */ + events_url: string; + /** @example 'https://api.github.com/users/octocat/received_events'; */ + received_events_url: string; + /** @example 'User'; */ + type: string; + site_admin: boolean; + }; + assets: any[]; +} + +export interface GhUpdateReleaseResponse { + /** @example 'https://api.github.com/repos/octocat/Hello-World/releases/1'; */ + url: string; + /** @example 'https://github.com/octocat/Hello-World/releases/v1.0.0'; */ + html_url: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/releases/1/assets'; */ + assets_url: string; + /** @example 'https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name,label}'; */ + upload_url: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/tarball/v1.0.0'; */ + tarball_url: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/zipball/v1.0.0'; */ + zipball_url: string; + id: number; + /** @example 'MDc6UmVsZWFzZTE='; */ + node_id: string; + /** @example 'v1.0.0'; */ + tag_name: string; + /** @example 'master'; */ + target_commitish: string; + /** @example 'v1.0.0'; */ + name: string; + /** @example 'Description of the release'; */ + body: string; + draft: boolean; + prerelease: boolean; + /** @example '2013-02-27T19:35:32Z'; */ + created_at: string; + /** @example '2013-02-27T19:35:32Z'; */ + published_at: string; + author: { + /** @example 'octocat'; */ + login: string; + id: number; + /** @example 'MDQ6VXNlcjE='; */ + node_id: string; + /** @example 'https://github.com/images/error/octocat_happy.gif'; */ + avatar_url: string; + /** @example ''; */ + gravatar_id: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + /** @example 'https://github.com/octocat'; */ + html_url: string; + /** @example 'https://api.github.com/users/octocat/followers'; */ + followers_url: string; + /** @example 'https://api.github.com/users/octocat/following{/other_user}'; */ + following_url: string; + /** @example 'https://api.github.com/users/octocat/gists{/gist_id}'; */ + gists_url: string; + /** @example 'https://api.github.com/users/octocat/starred{/owner}{/repo}'; */ + starred_url: string; + /** @example 'https://api.github.com/users/octocat/subscriptions'; */ + subscriptions_url: string; + /** @example 'https://api.github.com/users/octocat/orgs'; */ + organizations_url: string; + /** @example 'https://api.github.com/users/octocat/repos'; */ + repos_url: string; + /** @example 'https://api.github.com/users/octocat/events{/privacy}'; */ + events_url: string; + /** @example 'https://api.github.com/users/octocat/received_events'; */ + received_events_url: string; + /** @example 'User'; */ + type: string; + site_admin: boolean; + }; + assets: [ + { + /** @example 'https://api.github.com/repos/octocat/Hello-World/releases/assets/1'; */ + url: string; + /** @example 'https://github.com/octocat/Hello-World/releases/download/v1.0.0/example.zip'; */ + browser_download_url: string; + id: number; + /** @example 'MDEyOlJlbGVhc2VBc3NldDE='; */ + node_id: string; + /** @example 'example.zip'; */ + name: string; + /** @example 'short description'; */ + label: string; + /** @example 'uploaded'; */ + state: string; + /** @example 'application/zip'; */ + content_type: string; + size: number; + download_count: number; + /** @example '2013-02-27T19:35:32Z'; */ + created_at: string; + /** @example '2013-02-27T19:35:32Z'; */ + updated_at: string; + uploader: { + /** @example 'octocat'; */ + login: string; + id: number; + /** @example 'MDQ6VXNlcjE='; */ + node_id: string; + /** @example 'https://github.com/images/error/octocat_happy.gif'; */ + avatar_url: string; + /** @example ''; */ + gravatar_id: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + /** @example 'https://github.com/octocat'; */ + html_url: string; + /** @example 'https://api.github.com/users/octocat/followers'; */ + followers_url: string; + /** @example 'https://api.github.com/users/octocat/following{/other_user}'; */ + following_url: string; + /** @example 'https://api.github.com/users/octocat/gists{/gist_id}'; */ + gists_url: string; + /** @example 'https://api.github.com/users/octocat/starred{/owner}{/repo}'; */ + starred_url: string; + /** @example 'https://api.github.com/users/octocat/subscriptions'; */ + subscriptions_url: string; + /** @example 'https://api.github.com/users/octocat/orgs'; */ + organizations_url: string; + /** @example 'https://api.github.com/users/octocat/repos'; */ + repos_url: string; + /** @example 'https://api.github.com/users/octocat/events{/privacy}'; */ + events_url: string; + /** @example 'https://api.github.com/users/octocat/received_events'; */ + received_events_url: string; + /** @example 'User'; */ + type: string; + site_admin: boolean; + }; + }, + ]; +} + +export interface GhGetReleaseResponse { + /** @example 'https://api.github.com/repos/octocat/Hello-World/releases/1'; */ + url: string; + /** @example 'https://github.com/octocat/Hello-World/releases/v1.0.0'; */ + html_url: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/releases/1/assets'; */ + assets_url: string; + /** @example 'https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name,label}'; */ + upload_url: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/tarball/v1.0.0'; */ + tarball_url: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/zipball/v1.0.0'; */ + zipball_url: string; + id: number; + /** @example 'MDc6UmVsZWFzZTE='; */ + node_id: string; + /** @example 'v1.0.0'; */ + tag_name: string; + /** @example 'master'; */ + target_commitish: string; + /** @example 'v1.0.0'; */ + name: string; + /** @example 'Description of the release'; */ + body: string; + draft: boolean; + prerelease: boolean; + /** @example '2013-02-27T19:35:32Z'; */ + created_at: string; + /** @example '2013-02-27T19:35:32Z'; */ + published_at: string; + author: { + /** @example 'octocat'; */ + login: string; + id: number; + /** @example 'MDQ6VXNlcjE='; */ + node_id: string; + /** @example 'https://github.com/images/error/octocat_happy.gif'; */ + avatar_url: string; + /** @example ''; */ + gravatar_id: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + /** @example 'https://github.com/octocat'; */ + html_url: string; + /** @example 'https://api.github.com/users/octocat/followers'; */ + followers_url: string; + /** @example 'https://api.github.com/users/octocat/following{/other_user}'; */ + following_url: string; + /** @example 'https://api.github.com/users/octocat/gists{/gist_id}'; */ + gists_url: string; + /** @example 'https://api.github.com/users/octocat/starred{/owner}{/repo}'; */ + starred_url: string; + /** @example 'https://api.github.com/users/octocat/subscriptions'; */ + subscriptions_url: string; + /** @example 'https://api.github.com/users/octocat/orgs'; */ + organizations_url: string; + /** @example 'https://api.github.com/users/octocat/repos'; */ + repos_url: string; + /** @example 'https://api.github.com/users/octocat/events{/privacy}'; */ + events_url: string; + /** @example 'https://api.github.com/users/octocat/received_events'; */ + received_events_url: string; + /** @example 'User'; */ + type: string; + site_admin: boolean; + }; + assets: [ + { + /** @example 'https://api.github.com/repos/octocat/Hello-World/releases/assets/1'; */ + url: string; + /** @example 'https://github.com/octocat/Hello-World/releases/download/v1.0.0/example.zip'; */ + browser_download_url: string; + id: number; + /** @example 'MDEyOlJlbGVhc2VBc3NldDE='; */ + node_id: string; + /** @example 'example.zip'; */ + name: string; + /** @example 'short description'; */ + label: string; + /** @example 'uploaded'; */ + state: string; + /** @example 'application/zip'; */ + content_type: string; + size: number; + download_count: number; + /** @example '2013-02-27T19:35:32Z'; */ + created_at: string; + /** @example '2013-02-27T19:35:32Z'; */ + updated_at: string; + uploader: { + /** @example 'octocat'; */ + login: string; + id: number; + /** @example 'MDQ6VXNlcjE='; */ + node_id: string; + /** @example 'https://github.com/images/error/octocat_happy.gif'; */ + avatar_url: string; + /** @example ''; */ + gravatar_id: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + /** @example 'https://github.com/octocat'; */ + html_url: string; + /** @example 'https://api.github.com/users/octocat/followers'; */ + followers_url: string; + /** @example 'https://api.github.com/users/octocat/following{/other_user}'; */ + following_url: string; + /** @example 'https://api.github.com/users/octocat/gists{/gist_id}'; */ + gists_url: string; + /** @example 'https://api.github.com/users/octocat/starred{/owner}{/repo}'; */ + starred_url: string; + /** @example 'https://api.github.com/users/octocat/subscriptions'; */ + subscriptions_url: string; + /** @example 'https://api.github.com/users/octocat/orgs'; */ + organizations_url: string; + /** @example 'https://api.github.com/users/octocat/repos'; */ + repos_url: string; + /** @example 'https://api.github.com/users/octocat/events{/privacy}'; */ + events_url: string; + /** @example 'https://api.github.com/users/octocat/received_events'; */ + received_events_url: string; + /** @example 'User'; */ + type: string; + site_admin: boolean; + }; + }, + ]; +} + +export interface GhGetCommitResponse { + /** @example 'https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + url: string; + /** @example '6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + sha: string; + /** @example 'MDY6Q29tbWl0NmRjYjA5YjViNTc4NzVmMzM0ZjYxYWViZWQ2OTVlMmU0MTkzZGI1ZQ=='; */ + node_id: string; + /** @example 'https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + html_url: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e/comments'; */ + comments_url: string; + commit: { + /** @example 'https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + url: string; + author: { + /** @example 'Monalisa Octocat'; */ + name: string; + /** @example 'support@github.com'; */ + email: string; + /** @example '2011-04-14T16:00:49Z'; */ + date: string; + }; + committer: { + /** @example 'Monalisa Octocat'; */ + name: string; + /** @example 'support@github.com'; */ + email: string; + /** @example '2011-04-14T16:00:49Z'; */ + date: string; + }; + /** @example 'Fix all the bugs'; */ + message: string; + tree: { + /** @example 'https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + url: string; + /** @example '6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + sha: string; + }; + comment_count: number; + verification: { + verified: boolean; + /** @example 'unsigned'; */ + reason: string; + signature: null | any; + payload: null | any; + }; + }; + author: { + /** @example 'octocat'; */ + login: string; + id: number; + /** @example 'MDQ6VXNlcjE='; */ + node_id: string; + /** @example 'https://github.com/images/error/octocat_happy.gif'; */ + avatar_url: string; + /** @example ''; */ + gravatar_id: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + /** @example 'https://github.com/octocat'; */ + html_url: string; + /** @example 'https://api.github.com/users/octocat/followers'; */ + followers_url: string; + /** @example 'https://api.github.com/users/octocat/following{/other_user}'; */ + following_url: string; + /** @example 'https://api.github.com/users/octocat/gists{/gist_id}'; */ + gists_url: string; + /** @example 'https://api.github.com/users/octocat/starred{/owner}{/repo}'; */ + starred_url: string; + /** @example 'https://api.github.com/users/octocat/subscriptions'; */ + subscriptions_url: string; + /** @example 'https://api.github.com/users/octocat/orgs'; */ + organizations_url: string; + /** @example 'https://api.github.com/users/octocat/repos'; */ + repos_url: string; + /** @example 'https://api.github.com/users/octocat/events{/privacy}'; */ + events_url: string; + /** @example 'https://api.github.com/users/octocat/received_events'; */ + received_events_url: string; + /** @example 'User'; */ + type: string; + site_admin: boolean; + }; + committer: { + /** @example 'octocat'; */ + login: string; + id: number; + /** @example 'MDQ6VXNlcjE='; */ + node_id: string; + /** @example 'https://github.com/images/error/octocat_happy.gif'; */ + avatar_url: string; + /** @example ''; */ + gravatar_id: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + /** @example 'https://github.com/octocat'; */ + html_url: string; + /** @example 'https://api.github.com/users/octocat/followers'; */ + followers_url: string; + /** @example 'https://api.github.com/users/octocat/following{/other_user}'; */ + following_url: string; + /** @example 'https://api.github.com/users/octocat/gists{/gist_id}'; */ + gists_url: string; + /** @example 'https://api.github.com/users/octocat/starred{/owner}{/repo}'; */ + starred_url: string; + /** @example 'https://api.github.com/users/octocat/subscriptions'; */ + subscriptions_url: string; + /** @example 'https://api.github.com/users/octocat/orgs'; */ + organizations_url: string; + /** @example 'https://api.github.com/users/octocat/repos'; */ + repos_url: string; + /** @example 'https://api.github.com/users/octocat/events{/privacy}'; */ + events_url: string; + /** @example 'https://api.github.com/users/octocat/received_events'; */ + received_events_url: string; + /** @example 'User'; */ + type: string; + site_admin: boolean; + }; + parents: [ + { + /** @example 'https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + url: string; + /** @example '6dcb09b5b57875f334f61aebed695e2e4193db5e'; */ + sha: string; + }, + ]; + stats: { + additions: number; + deletions: number; + total: number; + }; + files: [ + { + /** @example 'file1.txt'; */ + filename: string; + additions: number; + deletions: number; + changes: number; + /** @example 'modified'; */ + status: string; + /** @example 'https://github.com/octocat/Hello-World/raw/7ca483543807a51b6079e54ac4cc392bc29ae284/file1.txt'; */ + raw_url: string; + /** @example 'https://github.com/octocat/Hello-World/blob/7ca483543807a51b6079e54ac4cc392bc29ae284/file1.txt'; */ + blob_url: string; + /** @example '@@ -29,7 +29,7 @@\n.....'; */ + patch: string; + }, + ]; +} + +export interface GhGetBranchResponse { + /** @example 'master'; */ + name: string; + commit: { + /** @example '7fd1a60b01f91b314f59955a4e4d4e80d8edf11d'; */ + sha: string; + /** @example 'MDY6Q29tbWl0N2ZkMWE2MGIwMWY5MWIzMTRmNTk5NTVhNGU0ZDRlODBkOGVkZjExZA=='; */ + node_id: string; + commit: { + author: { + /** @example 'The Octocat'; */ + name: string; + /** @example '2012-03-06T15:06:50-08:00'; */ + date: string; + /** @example 'octocat@nowhere.com'; */ + email: string; + }; + /** @example 'https://api.github.com/repos/octocat/Hello-World/git/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d'; */ + url: string; + /** @example 'Merge pull request #6 from Spaceghost/patch-1\n\nNew line at end of file.'; */ + message: string; + tree: { + /** @example 'b4eecafa9be2f2006ce1b709d6857b07069b4608'; */ + sha: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/git/trees/b4eecafa9be2f2006ce1b709d6857b07069b4608'; */ + url: string; + }; + committer: { + /** @example 'The Octocat'; */ + name: string; + /** @example '2012-03-06T15:06:50-08:00'; */ + date: string; + /** @example 'octocat@nowhere.com'; */ + email: string; + }; + verification: { + verified: boolean; + /** @example 'unsigned'; */ + reason: string; + signature: null | any; + payload: null | any; + }; + }; + author: { + /** @example ''; */ + gravatar_id: string; + /** @example 'https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png'; */ + avatar_url: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + id: number; + /** @example 'octocat'; */ + login: string; + }; + parents: [ + { + /** @example '553c2077f0edc3d5dc5d17262f6aa498e69d6f8e'; */ + sha: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/commits/553c2077f0edc3d5dc5d17262f6aa498e69d6f8e'; */ + url: string; + }, + { + /** @example '762941318ee16e59dabbacb1b4049eec22f0d303'; */ + sha: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/commits/762941318ee16e59dabbacb1b4049eec22f0d303'; */ + url: string; + }, + ]; + /** @example 'https://api.github.com/repos/octocat/Hello-World/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d'; */ + url: string; + committer: { + /** @example ''; */ + gravatar_id: string; + /** @example 'https://secure.gravatar.com/avatar/7ad39074b0584bc555d0417ae3e7d974?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png'; */ + avatar_url: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + id: number; + /** @example 'octocat'; */ + login: string; + }; + }; + _links: { + /** @example 'https://github.com/octocat/Hello-World/tree/master'; */ + html: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/branches/master'; */ + self: string; + }; + protected: boolean; + protection: { + enabled: boolean; + required_status_checks: { + /** @example 'non_admins'; */ + enforcement_level: string; + /** @example ['ci-test', 'linter'] */ + contexts: string[]; + }; + }; + /** @example 'https://api.github.com/repos/octocat/hello-world/branches/master/protection'; */ + protection_url: string; +} + +export interface GhCreateCommitResponse { + /** @example '7638417db6d59f3c431d3e1f261cc637155684cd'; */ + sha: string; + /** @example 'MDY6Q29tbWl0NzYzODQxN2RiNmQ1OWYzYzQzMWQzZTFmMjYxY2M2MzcxNTU2ODRjZA=='; */ + node_id: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/git/commits/7638417db6d59f3c431d3e1f261cc637155684cd'; */ + url: string; + author: { + /** @example '2014-11-07T22:01:45Z'; */ + date: string; + /** @example 'Monalisa Octocat'; */ + name: string; + /** @example 'octocat@github.com'; */ + email: string; + }; + committer: { + /** @example '2014-11-07T22:01:45Z'; */ + date: string; + /** @example 'Monalisa Octocat'; */ + name: string; + /** @example 'octocat@github.com'; */ + email: string; + }; + /** @example 'my commit message'; */ + message: string; + tree: { + /** @example 'https://api.github.com/repos/octocat/Hello-World/git/trees/827efc6d56897b048c772eb4087f854f46256132'; */ + url: string; + /** @example '827efc6d56897b048c772eb4087f854f46256132'; */ + sha: string; + }; + parents: [ + { + /** @example 'https://api.github.com/repos/octocat/Hello-World/git/commits/7d1b31e74ee336d15cbd21741bc88a537ed063a0'; */ + url: string; + /** @example '7d1b31e74ee336d15cbd21741bc88a537ed063a0'; */ + sha: string; + }, + ]; + verification: { + verified: boolean; + /** @example 'unsigned'; */ + reason: string; + signature: null | any; + payload: null | any; + }; +} + +export interface GhCreateReferenceResponse { + /** @example 'refs/heads/featureA'; */ + ref: string; + /** @example 'MDM6UmVmcmVmcy9oZWFkcy9mZWF0dXJlQQ=='; */ + node_id: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/git/refs/heads/featureA'; */ + url: string; + object: { + /** @example 'commit'; */ + type: string; + /** @example 'aa218f56b14c9653891f9e74264a383fa43fefbd'; */ + sha: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd'; */ + url: string; + }; +} + +export interface GhUpdateReferenceResponse { + /** @example 'refs/heads/featureA'; */ + ref: string; + /** @example 'MDM6UmVmcmVmcy9oZWFkcy9mZWF0dXJlQQ=='; */ + node_id: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/git/refs/heads/featureA'; */ + url: string; + object: { + /** @example 'commit'; */ + type: string; + /** @example 'aa218f56b14c9653891f9e74264a383fa43fefbd'; */ + sha: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/git/commits/aa218f56b14c9653891f9e74264a383fa43fefbd'; */ + url: string; + }; +} + +export interface GhMergeResponse { + /** @example '7fd1a60b01f91b314f59955a4e4d4e80d8edf11d'; */ + sha: string; + /** @example 'MDY6Q29tbWl0N2ZkMWE2MGIwMWY5MWIzMTRmNTk5NTVhNGU0ZDRlODBkOGVkZjExZA=='; */ + node_id: string; + commit: { + author: { + /** @example 'The Octocat'; */ + name: string; + /** @example '2012-03-06T15:06:50-08:00'; */ + date: string; + /** @example 'octocat@nowhere.com'; */ + email: string; + }; + committer: { + /** @example 'The Octocat'; */ + name: string; + /** @example '2012-03-06T15:06:50-08:00'; */ + date: string; + /** @example 'octocat@nowhere.com'; */ + email: string; + }; + /** @example 'Shipped cool_feature!'; */ + message: string; + tree: { + /** @example 'b4eecafa9be2f2006ce1b709d6857b07069b4608'; */ + sha: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/git/trees/b4eecafa9be2f2006ce1b709d6857b07069b4608'; */ + url: string; + }; + /** @example 'https://api.github.com/repos/octocat/Hello-World/git/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d'; */ + url: string; + comment_count: number; + verification: { + verified: boolean; + /** @example 'unsigned'; */ + reason: string; + signature: null | any; + payload: null | any; + }; + }; + /** @example 'https://api.github.com/repos/octocat/Hello-World/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d'; */ + url: string; + /** @example 'https://github.com/octocat/Hello-World/commit/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d'; */ + html_url: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d/comments'; */ + comments_url: string; + author: { + /** @example 'octocat'; */ + login: string; + id: number; + /** @example 'MDQ6VXNlcjE='; */ + node_id: string; + /** @example 'https://github.com/images/error/octocat_happy.gif'; */ + avatar_url: string; + /** @example ''; */ + gravatar_id: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + /** @example 'https://github.com/octocat'; */ + html_url: string; + /** @example 'https://api.github.com/users/octocat/followers'; */ + followers_url: string; + /** @example 'https://api.github.com/users/octocat/following{/other_user}'; */ + following_url: string; + /** @example 'https://api.github.com/users/octocat/gists{/gist_id}'; */ + gists_url: string; + /** @example 'https://api.github.com/users/octocat/starred{/owner}{/repo}'; */ + starred_url: string; + /** @example 'https://api.github.com/users/octocat/subscriptions'; */ + subscriptions_url: string; + /** @example 'https://api.github.com/users/octocat/orgs'; */ + organizations_url: string; + /** @example 'https://api.github.com/users/octocat/repos'; */ + repos_url: string; + /** @example 'https://api.github.com/users/octocat/events{/privacy}'; */ + events_url: string; + /** @example 'https://api.github.com/users/octocat/received_events'; */ + received_events_url: string; + /** @example 'User'; */ + type: string; + site_admin: boolean; + }; + committer: { + /** @example 'octocat'; */ + login: string; + id: number; + /** @example 'MDQ6VXNlcjE='; */ + node_id: string; + /** @example 'https://github.com/images/error/octocat_happy.gif'; */ + avatar_url: string; + /** @example ''; */ + gravatar_id: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + /** @example 'https://github.com/octocat'; */ + html_url: string; + /** @example 'https://api.github.com/users/octocat/followers'; */ + followers_url: string; + /** @example 'https://api.github.com/users/octocat/following{/other_user}'; */ + following_url: string; + /** @example 'https://api.github.com/users/octocat/gists{/gist_id}'; */ + gists_url: string; + /** @example 'https://api.github.com/users/octocat/starred{/owner}{/repo}'; */ + starred_url: string; + /** @example 'https://api.github.com/users/octocat/subscriptions'; */ + subscriptions_url: string; + /** @example 'https://api.github.com/users/octocat/orgs'; */ + organizations_url: string; + /** @example 'https://api.github.com/users/octocat/repos'; */ + repos_url: string; + /** @example 'https://api.github.com/users/octocat/events{/privacy}'; */ + events_url: string; + /** @example 'https://api.github.com/users/octocat/received_events'; */ + received_events_url: string; + /** @example 'User'; */ + type: string; + site_admin: boolean; + }; + parents: [ + { + /** @example '553c2077f0edc3d5dc5d17262f6aa498e69d6f8e'; */ + sha: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/commits/553c2077f0edc3d5dc5d17262f6aa498e69d6f8e'; */ + url: string; + }, + { + /** @example '762941318ee16e59dabbacb1b4049eec22f0d303'; */ + sha: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/commits/762941318ee16e59dabbacb1b4049eec22f0d303'; */ + url: string; + }, + ]; +} + +export interface GhCreateTagObjectResponse { + /** @example 'MDM6VGFnOTQwYmQzMzYyNDhlZmFlMGY5ZWU1YmM3YjJkNWM5ODU4ODdiMTZhYw=='; */ + node_id: string; + /** @example 'v0.0.1'; */ + tag: string; + /** @example '940bd336248efae0f9ee5bc7b2d5c985887b16ac'; */ + sha: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac'; */ + url: string; + /** @example 'initial version'; */ + message: string; + tagger: { + /** @example 'Monalisa Octocat'; */ + name: string; + /** @example 'octocat@github.com'; */ + email: string; + /** @example '2014-11-07T22:01:45Z'; */ + date: string; + }; + object: { + /** @example 'commit'; */ + type: string; + /** @example 'c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c'; */ + sha: string; + /** @example 'https://api.github.com/repos/octocat/Hello-World/git/commits/c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c'; */ + url: string; + }; + verification: { + verified: boolean; + /** @example 'unsigned'; */ + reason: string; + signature: null | any; + payload: null | any; + }; +} + +export interface GhGetRepositoryResponse { + id: number; + /** @example 'MDEwOlJlcG9zaXRvcnkxMjk2MjY5'; */ + node_id: string; + /** @example 'Hello-World'; */ + name: string; + /** @example 'octocat/Hello-World'; */ + full_name: string; + owner: { + /** @example 'octocat'; */ + login: string; + id: number; + /** @example 'MDQ6VXNlcjE='; */ + node_id: string; + /** @example 'https://github.com/images/error/octocat_happy.gif'; */ + avatar_url: string; + /** @example ''; */ + gravatar_id: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + /** @example 'https://github.com/octocat'; */ + html_url: string; + /** @example 'https://api.github.com/users/octocat/followers'; */ + followers_url: string; + /** @example 'https://api.github.com/users/octocat/following{/other_user}'; */ + following_url: string; + /** @example 'https://api.github.com/users/octocat/gists{/gist_id}'; */ + gists_url: string; + /** @example 'https://api.github.com/users/octocat/starred{/owner}{/repo}'; */ + starred_url: string; + /** @example 'https://api.github.com/users/octocat/subscriptions'; */ + subscriptions_url: string; + /** @example 'https://api.github.com/users/octocat/orgs'; */ + organizations_url: string; + /** @example 'https://api.github.com/users/octocat/repos'; */ + repos_url: string; + /** @example 'https://api.github.com/users/octocat/events{/privacy}'; */ + events_url: string; + /** @example 'https://api.github.com/users/octocat/received_events'; */ + received_events_url: string; + /** @example 'User'; */ + type: string; + site_admin: boolean; + }; + private: boolean; + /** @example 'https://github.com/octocat/Hello-World'; */ + html_url: string; + /** @example 'This your first repo!'; */ + description: string; + fork: boolean; + /** @example 'https://api.github.com/repos/octocat/Hello-World'; */ + url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}'; */ + archive_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/assignees{/user}'; */ + assignees_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}'; */ + blobs_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/branches{/branch}'; */ + branches_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}'; */ + collaborators_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/comments{/number}'; */ + comments_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/commits{/sha}'; */ + commits_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}'; */ + compare_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/contents/{+path}'; */ + contents_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/contributors'; */ + contributors_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/deployments'; */ + deployments_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/downloads'; */ + downloads_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/events'; */ + events_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/forks'; */ + forks_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}'; */ + git_commits_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}'; */ + git_refs_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}'; */ + git_tags_url: string; + /** @example 'git:github.com/octocat/Hello-World.git'; */ + git_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}'; */ + issue_comment_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/issues/events{/number}'; */ + issue_events_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/issues{/number}'; */ + issues_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/keys{/key_id}'; */ + keys_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/labels{/name}'; */ + labels_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/languages'; */ + languages_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/merges'; */ + merges_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/milestones{/number}'; */ + milestones_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}'; */ + notifications_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/pulls{/number}'; */ + pulls_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/releases{/id}'; */ + releases_url: string; + /** @example 'git@github.com:octocat/Hello-World.git'; */ + ssh_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/stargazers'; */ + stargazers_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/statuses/{sha}'; */ + statuses_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/subscribers'; */ + subscribers_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/subscription'; */ + subscription_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/tags'; */ + tags_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/teams'; */ + teams_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}'; */ + trees_url: string; + /** @example 'https://github.com/octocat/Hello-World.git'; */ + clone_url: string; + /** @example 'git:git.example.com/octocat/Hello-World'; */ + mirror_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/hooks'; */ + hooks_url: string; + /** @example 'https://svn.github.com/octocat/Hello-World'; */ + svn_url: string; + /** @example 'https://github.com'; */ + homepage: string; + language: null | any; + forks_count: number; + stargazers_count: number; + watchers_count: number; + size: number; + /** @example 'master'; */ + default_branch: string; + open_issues_count: number; + is_template: boolean; + /** @example ['octocat', 'atom', 'electron', 'api'] */ + topics: string[]; + has_issues: boolean; + has_projects: boolean; + has_wiki: boolean; + has_pages: boolean; + has_downloads: boolean; + archived: boolean; + disabled: boolean; + /** @example 'public'; */ + visibility: string; + /** @example '2011-01-26T19:06:43Z'; */ + pushed_at: string; + /** @example '2011-01-26T19:01:12Z'; */ + created_at: string; + /** @example '2011-01-26T19:14:43Z'; */ + updated_at: string; + permissions: { + pull: boolean; + triage: boolean; + push: boolean; + maintain: boolean; + admin: boolean; + }; + allow_rebase_merge: boolean; + template_repository: null | any; + /** @example 'ABTLWHOULUVAXGTRYU7OC2876QJ2O'; */ + temp_clone_token: string; + allow_squash_merge: boolean; + delete_branch_on_merge: boolean; + allow_merge_commit: boolean; + subscribers_count: number; + network_count: number; + license: { + /** @example 'mit'; */ + key: string; + /** @example 'MIT License'; */ + name: string; + /** @example 'MIT'; */ + spdx_id: string; + /** @example 'https://api.github.com/licenses/mit'; */ + url: string; + /** @example 'MDc6TGljZW5zZW1pdA=='; */ + node_id: string; + }; + organization: { + /** @example 'octocat'; */ + login: string; + id: number; + /** @example 'MDQ6VXNlcjE='; */ + node_id: string; + /** @example 'https://github.com/images/error/octocat_happy.gif'; */ + avatar_url: string; + /** @example ''; */ + gravatar_id: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + /** @example 'https://github.com/octocat'; */ + html_url: string; + /** @example 'https://api.github.com/users/octocat/followers'; */ + followers_url: string; + /** @example 'https://api.github.com/users/octocat/following{/other_user}'; */ + following_url: string; + /** @example 'https://api.github.com/users/octocat/gists{/gist_id}'; */ + gists_url: string; + /** @example 'https://api.github.com/users/octocat/starred{/owner}{/repo}'; */ + starred_url: string; + /** @example 'https://api.github.com/users/octocat/subscriptions'; */ + subscriptions_url: string; + /** @example 'https://api.github.com/users/octocat/orgs'; */ + organizations_url: string; + /** @example 'https://api.github.com/users/octocat/repos'; */ + repos_url: string; + /** @example 'https://api.github.com/users/octocat/events{/privacy}'; */ + events_url: string; + /** @example 'https://api.github.com/users/octocat/received_events'; */ + received_events_url: string; + /** @example 'Organization'; */ + type: string; + site_admin: boolean; + }; + parent: { + id: number; + /** @example 'MDEwOlJlcG9zaXRvcnkxMjk2MjY5'; */ + node_id: string; + /** @example 'Hello-World'; */ + name: string; + /** @example 'octocat/Hello-World'; */ + full_name: string; + owner: { + /** @example 'octocat'; */ + login: string; + id: number; + /** @example 'MDQ6VXNlcjE='; */ + node_id: string; + /** @example 'https://github.com/images/error/octocat_happy.gif'; */ + avatar_url: string; + /** @example ''; */ + gravatar_id: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + /** @example 'https://github.com/octocat'; */ + html_url: string; + /** @example 'https://api.github.com/users/octocat/followers'; */ + followers_url: string; + /** @example 'https://api.github.com/users/octocat/following{/other_user}'; */ + following_url: string; + /** @example 'https://api.github.com/users/octocat/gists{/gist_id}'; */ + gists_url: string; + /** @example 'https://api.github.com/users/octocat/starred{/owner}{/repo}'; */ + starred_url: string; + /** @example 'https://api.github.com/users/octocat/subscriptions'; */ + subscriptions_url: string; + /** @example 'https://api.github.com/users/octocat/orgs'; */ + organizations_url: string; + /** @example 'https://api.github.com/users/octocat/repos'; */ + repos_url: string; + /** @example 'https://api.github.com/users/octocat/events{/privacy}'; */ + events_url: string; + /** @example 'https://api.github.com/users/octocat/received_events'; */ + received_events_url: string; + /** @example 'User'; */ + type: string; + site_admin: boolean; + }; + private: boolean; + /** @example 'https://github.com/octocat/Hello-World'; */ + html_url: string; + /** @example 'This your first repo!'; */ + description: string; + fork: boolean; + /** @example 'https://api.github.com/repos/octocat/Hello-World'; */ + url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}'; */ + archive_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/assignees{/user}'; */ + assignees_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}'; */ + blobs_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/branches{/branch}'; */ + branches_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}'; */ + collaborators_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/comments{/number}'; */ + comments_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/commits{/sha}'; */ + commits_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}'; */ + compare_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/contents/{+path}'; */ + contents_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/contributors'; */ + contributors_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/deployments'; */ + deployments_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/downloads'; */ + downloads_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/events'; */ + events_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/forks'; */ + forks_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}'; */ + git_commits_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}'; */ + git_refs_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}'; */ + git_tags_url: string; + /** @example 'git:github.com/octocat/Hello-World.git'; */ + git_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}'; */ + issue_comment_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/issues/events{/number}'; */ + issue_events_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/issues{/number}'; */ + issues_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/keys{/key_id}'; */ + keys_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/labels{/name}'; */ + labels_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/languages'; */ + languages_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/merges'; */ + merges_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/milestones{/number}'; */ + milestones_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}'; */ + notifications_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/pulls{/number}'; */ + pulls_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/releases{/id}'; */ + releases_url: string; + /** @example 'git@github.com:octocat/Hello-World.git'; */ + ssh_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/stargazers'; */ + stargazers_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/statuses/{sha}'; */ + statuses_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/subscribers'; */ + subscribers_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/subscription'; */ + subscription_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/tags'; */ + tags_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/teams'; */ + teams_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}'; */ + trees_url: string; + /** @example 'https://github.com/octocat/Hello-World.git'; */ + clone_url: string; + /** @example 'git:git.example.com/octocat/Hello-World'; */ + mirror_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/hooks'; */ + hooks_url: string; + /** @example 'https://svn.github.com/octocat/Hello-World'; */ + svn_url: string; + /** @example 'https://github.com'; */ + homepage: string; + language: null | any; + forks_count: number; + stargazers_count: number; + watchers_count: number; + size: number; + /** @example 'master'; */ + default_branch: string; + open_issues_count: number; + is_template: boolean; + /** @example ['octocat', 'atom', 'electron', 'api'] */ + topics: string[]; + has_issues: boolean; + has_projects: boolean; + has_wiki: boolean; + has_pages: boolean; + has_downloads: boolean; + archived: boolean; + disabled: boolean; + /** @example 'public'; */ + visibility: string; + /** @example '2011-01-26T19:06:43Z'; */ + pushed_at: string; + /** @example '2011-01-26T19:01:12Z'; */ + created_at: string; + /** @example '2011-01-26T19:14:43Z'; */ + updated_at: string; + permissions: { + admin: boolean; + push: boolean; + pull: boolean; + }; + allow_rebase_merge: boolean; + template_repository: null | any; + /** @example 'ABTLWHOULUVAXGTRYU7OC2876QJ2O'; */ + temp_clone_token: string; + allow_squash_merge: boolean; + delete_branch_on_merge: boolean; + allow_merge_commit: boolean; + subscribers_count: number; + network_count: number; + }; + source: { + id: number; + /** @example 'MDEwOlJlcG9zaXRvcnkxMjk2MjY5'; */ + node_id: string; + /** @example 'Hello-World'; */ + name: string; + /** @example 'octocat/Hello-World'; */ + full_name: string; + owner: { + /** @example 'octocat'; */ + login: string; + id: number; + /** @example 'MDQ6VXNlcjE='; */ + node_id: string; + /** @example 'https://github.com/images/error/octocat_happy.gif'; */ + avatar_url: string; + /** @example ''; */ + gravatar_id: string; + /** @example 'https://api.github.com/users/octocat'; */ + url: string; + /** @example 'https://github.com/octocat'; */ + html_url: string; + /** @example 'https://api.github.com/users/octocat/followers'; */ + followers_url: string; + /** @example 'https://api.github.com/users/octocat/following{/other_user}'; */ + following_url: string; + /** @example 'https://api.github.com/users/octocat/gists{/gist_id}'; */ + gists_url: string; + /** @example 'https://api.github.com/users/octocat/starred{/owner}{/repo}'; */ + starred_url: string; + /** @example 'https://api.github.com/users/octocat/subscriptions'; */ + subscriptions_url: string; + /** @example 'https://api.github.com/users/octocat/orgs'; */ + organizations_url: string; + /** @example 'https://api.github.com/users/octocat/repos'; */ + repos_url: string; + /** @example 'https://api.github.com/users/octocat/events{/privacy}'; */ + events_url: string; + /** @example 'https://api.github.com/users/octocat/received_events'; */ + received_events_url: string; + /** @example 'User'; */ + type: string; + site_admin: boolean; + }; + private: boolean; + /** @example 'https://github.com/octocat/Hello-World'; */ + html_url: string; + /** @example 'This your first repo!'; */ + description: string; + fork: boolean; + /** @example 'https://api.github.com/repos/octocat/Hello-World'; */ + url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}'; */ + archive_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/assignees{/user}'; */ + assignees_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}'; */ + blobs_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/branches{/branch}'; */ + branches_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}'; */ + collaborators_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/comments{/number}'; */ + comments_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/commits{/sha}'; */ + commits_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}'; */ + compare_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/contents/{+path}'; */ + contents_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/contributors'; */ + contributors_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/deployments'; */ + deployments_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/downloads'; */ + downloads_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/events'; */ + events_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/forks'; */ + forks_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}'; */ + git_commits_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}'; */ + git_refs_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}'; */ + git_tags_url: string; + /** @example 'git:github.com/octocat/Hello-World.git'; */ + git_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}'; */ + issue_comment_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/issues/events{/number}'; */ + issue_events_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/issues{/number}'; */ + issues_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/keys{/key_id}'; */ + keys_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/labels{/name}'; */ + labels_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/languages'; */ + languages_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/merges'; */ + merges_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/milestones{/number}'; */ + milestones_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}'; */ + notifications_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/pulls{/number}'; */ + pulls_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/releases{/id}'; */ + releases_url: string; + /** @example 'git@github.com:octocat/Hello-World.git'; */ + ssh_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/stargazers'; */ + stargazers_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/statuses/{sha}'; */ + statuses_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/subscribers'; */ + subscribers_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/subscription'; */ + subscription_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/tags'; */ + tags_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/teams'; */ + teams_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}'; */ + trees_url: string; + /** @example 'https://github.com/octocat/Hello-World.git'; */ + clone_url: string; + /** @example 'git:git.example.com/octocat/Hello-World'; */ + mirror_url: string; + /** @example 'http://api.github.com/repos/octocat/Hello-World/hooks'; */ + hooks_url: string; + /** @example 'https://svn.github.com/octocat/Hello-World'; */ + svn_url: string; + /** @example 'https://github.com'; */ + homepage: string; + language: null | any; + forks_count: number; + stargazers_count: number; + watchers_count: number; + size: number; + /** @example 'master'; */ + default_branch: string; + open_issues_count: number; + is_template: boolean; + /** @example ['octocat', 'atom', 'electron', 'api'] */ + topics: string[]; + has_issues: boolean; + has_projects: boolean; + has_wiki: boolean; + has_pages: boolean; + has_downloads: boolean; + archived: boolean; + disabled: boolean; + /** @example 'public'; */ + visibility: string; + /** @example '2011-01-26T19:06:43Z'; */ + pushed_at: string; + /** @example '2011-01-26T19:01:12Z'; */ + created_at: string; + /** @example '2011-01-26T19:14:43Z'; */ + updated_at: string; + permissions: { + admin: boolean; + push: boolean; + pull: boolean; + }; + allow_rebase_merge: boolean; + template_repository: null | any; + /** @example 'ABTLWHOULUVAXGTRYU7OC2876QJ2O'; */ + temp_clone_token: string; + allow_squash_merge: boolean; + delete_branch_on_merge: boolean; + allow_merge_commit: boolean; + subscribers_count: number; + network_count: number; + }; +} diff --git a/yarn.lock b/yarn.lock index d341a67170..cca4a0ed44 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11408,6 +11408,11 @@ date-fns@^2.0.0-alpha.27, date-fns@^2.16.1: resolved "https://registry.npmjs.org/date-fns/-/date-fns-2.18.0.tgz#08e50aee300ad0d2c5e054e3f0d10d8f9cdfe09e" integrity sha512-NYyAg4wRmGVU4miKq5ivRACOODdZRY3q5WLmOJSq8djyzftYphU7dTHLcEtLqEvfqMKQ0jVv91P4BAwIjsXIcw== +date-fns@^2.19.0: + version "2.19.0" + resolved "https://artifactory.spotify.net/artifactory/api/npm/virtual-npm/date-fns/-/date-fns-2.19.0.tgz#65193348635a28d5d916c43ec7ce6fbd145059e1" + integrity sha1-ZRkzSGNaKNXZFsQ+x85vvRRQWeE= + dateformat@^3.0.0: version "3.0.3" resolved "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" From 64ede919009915fc34605d83aa0c7860d1a9c4cd Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Mon, 12 Apr 2021 18:39:25 +0200 Subject: [PATCH 011/485] Add 'Usage' to docs Signed-off-by: Erik Engervall --- plugins/release-manager-as-a-service/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/release-manager-as-a-service/README.md b/plugins/release-manager-as-a-service/README.md index cdd50d35c6..ffb39f2c8f 100644 --- a/plugins/release-manager-as-a-service/README.md +++ b/plugins/release-manager-as-a-service/README.md @@ -43,3 +43,7 @@ Looking at the flow above, a common release lifecycle could be: - Your CI 1. Detects the new tag by matching the git reference `refs/tags/version-.*` 1. Builds and deploys to production for testing + +## Usage + +The plugin exports a single full-page extension `ReleaseManagerAsAServicePage`, which one can add to an app like a usual top-level tool on a dedicated route. From 33aa168c2b285a1a098c23df4b5d9ca725d79aea Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Tue, 13 Apr 2021 09:39:39 +0200 Subject: [PATCH 012/485] Replace references to GHE with GitHub Signed-off-by: Erik Engervall --- .../release-manager-as-a-service/README.md | 12 ++-- .../src/ReleaseManagerAsAService.tsx | 2 +- .../src/api/RMaaSApiClient.ts | 12 ++-- .../src/cards/createRc/CreateRc.test.tsx | 6 +- .../src/cards/createRc/CreateRc.tsx | 53 +++++++++--------- ...heInfo.test.ts => getRcGitHubInfo.test.ts} | 16 +++--- .../{getRcGheInfo.ts => getRcGitHubInfo.ts} | 2 +- .../{createGheRc.test.ts => createRc.test.ts} | 12 ++-- .../{createGheRc.ts => createRc.ts} | 24 ++++---- .../src/cards/info/Info.tsx | 22 ++++---- .../cards/info/{rmaas-flow.png => flow.png} | Bin .../src/cards/patchRc/PatchBody.tsx | 40 ++++++------- .../src/cards/promoteRc/PromoteRc.tsx | 4 +- .../src/cards/promoteRc/PromoteRcBody.tsx | 20 ++++--- ...promoteGheRc.test.ts => promoteRc.test.ts} | 6 +- .../{promoteGheRc.ts => promoteRc.ts} | 6 +- .../src/components/Differ.tsx | 4 +- .../src/components/NoLatestRelease.tsx | 2 +- .../src/test-helpers/test-helpers.test.ts | 2 +- .../src/test-helpers/test-helpers.ts | 4 +- 20 files changed, 128 insertions(+), 121 deletions(-) rename plugins/release-manager-as-a-service/src/cards/createRc/{getRcGheInfo.test.ts => getRcGitHubInfo.test.ts} (84%) rename plugins/release-manager-as-a-service/src/cards/createRc/{getRcGheInfo.ts => getRcGitHubInfo.ts} (98%) rename plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/{createGheRc.test.ts => createRc.test.ts} (92%) rename plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/{createGheRc.ts => createRc.ts} (85%) rename plugins/release-manager-as-a-service/src/cards/info/{rmaas-flow.png => flow.png} (100%) rename plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/{promoteGheRc.test.ts => promoteRc.test.ts} (90%) rename plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/{promoteGheRc.ts => promoteRc.ts} (95%) diff --git a/plugins/release-manager-as-a-service/README.md b/plugins/release-manager-as-a-service/README.md index ffb39f2c8f..46e45f9ca5 100644 --- a/plugins/release-manager-as-a-service/README.md +++ b/plugins/release-manager-as-a-service/README.md @@ -4,19 +4,19 @@ `RMaaS` enables developers to manage their releases without having to juggle git commands. -Does it bundle and ship your code? **No**. +Does it build and ship your code? **No**. What `RMaaS` does is manage your **[releases](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/managing-releases-in-a-repository)** on GitHub, building and shipping is entirely up to you as a developer to handle in your CI. -`RMaaS` is build with industry standards in mind and the flow is as follows: +`RMaaS` is built with industry standards in mind and the flow is as follows: -![](./src/cards/info/rmaas-flow.png) +![](./src/cards/info/flow.png) -> **GitHub Enterprise (GHE)**: The source control system where releases reside in a practical sense. Read more about GitHub releases here. Note that this plugin works just as well with a non-enterprise account. +> **GitHub**: The source control system where releases reside in a practical sense. Read more about GitHub releases [here](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/. Note that this plugin works just as well with GitHub Enterprise) > -> **Release Candidate (RC)**: A GHE pre-release intended primarily for internal testing +> **Release Candidate (RC)**: A GitHub pre-release intended primarily for internal testing > -> **Release Version**: A GHE release intended for end users +> **Release Version**: A GitHub release intended for end users Looking at the flow above, a common release lifecycle could be: diff --git a/plugins/release-manager-as-a-service/src/ReleaseManagerAsAService.tsx b/plugins/release-manager-as-a-service/src/ReleaseManagerAsAService.tsx index 35fd88b03f..b79c492bbb 100644 --- a/plugins/release-manager-as-a-service/src/ReleaseManagerAsAService.tsx +++ b/plugins/release-manager-as-a-service/src/ReleaseManagerAsAService.tsx @@ -85,7 +85,7 @@ export function ReleaseManagerAsAService({ return (
- +
diff --git a/plugins/release-manager-as-a-service/src/api/RMaaSApiClient.ts b/plugins/release-manager-as-a-service/src/api/RMaaSApiClient.ts index e67d50e46a..fb4ad0daa7 100644 --- a/plugins/release-manager-as-a-service/src/api/RMaaSApiClient.ts +++ b/plugins/release-manager-as-a-service/src/api/RMaaSApiClient.ts @@ -28,7 +28,7 @@ import { GhUpdateReleaseResponse, } from '../types/types'; import { CalverTagParts } from '../helpers/tagParts/getCalverTagParts'; -import { getRcGheInfo } from '../cards/createRc/getRcGheInfo'; +import { getRcGitHubInfo } from '../cards/createRc/getRcGitHubInfo'; import { PluginApiClientConfig } from './PluginApiClientConfig'; import { SemverTagParts } from '../helpers/tagParts/getSemverTagParts'; @@ -165,10 +165,10 @@ export class RMaaSApiClient { }, createRelease: async ({ - nextGheInfo, + nextGitHubInfo, releaseBody, }: { - nextGheInfo: ReturnType; + nextGitHubInfo: ReturnType; releaseBody: string; }) => { const { octokit } = await this.pluginApiClient.getOctokit(); @@ -177,9 +177,9 @@ export class RMaaSApiClient { await octokit.request(`${this.githubCommonPath}/releases`, { method: 'POST', data: { - tag_name: nextGheInfo.rcReleaseTag, - name: nextGheInfo.releaseName, - target_commitish: nextGheInfo.rcBranch, + tag_name: nextGitHubInfo.rcReleaseTag, + name: nextGitHubInfo.releaseName, + target_commitish: nextGitHubInfo.rcBranch, body: releaseBody, prerelease: true, }, diff --git a/plugins/release-manager-as-a-service/src/cards/createRc/CreateRc.test.tsx b/plugins/release-manager-as-a-service/src/cards/createRc/CreateRc.test.tsx index d4dba6841e..07582351e8 100644 --- a/plugins/release-manager-as-a-service/src/cards/createRc/CreateRc.test.tsx +++ b/plugins/release-manager-as-a-service/src/cards/createRc/CreateRc.test.tsx @@ -18,7 +18,7 @@ import { render } from '@testing-library/react'; import { mockCalverProject, - mockNextGheInfo, + mockNextGitHubInfo, mockRcRelease, mockReleaseBranch, mockReleaseVersion, @@ -30,8 +30,8 @@ import { TEST_IDS } from '../../test-helpers/test-ids'; jest.mock('../../components/ProjectContext', () => ({ useApiClientContext: () => mockApiClient, })); -jest.mock('./getRcGheInfo', () => ({ - getRcGheInfo: () => mockNextGheInfo, +jest.mock('./getRcGitHubInfo', () => ({ + getRcGitHubInfo: () => mockNextGitHubInfo, })); import { CreateRc } from './CreateRc'; diff --git a/plugins/release-manager-as-a-service/src/cards/createRc/CreateRc.tsx b/plugins/release-manager-as-a-service/src/cards/createRc/CreateRc.tsx index 22877ec1a3..8c4a5bff87 100644 --- a/plugins/release-manager-as-a-service/src/cards/createRc/CreateRc.tsx +++ b/plugins/release-manager-as-a-service/src/cards/createRc/CreateRc.tsx @@ -25,9 +25,9 @@ import { } from '@material-ui/core'; import { useAsyncFn } from 'react-use'; -import { createGheRc } from './sideEffects/createGheRc'; +import { createRc } from './sideEffects/createRc'; import { Differ } from '../../components/Differ'; -import { getRcGheInfo } from './getRcGheInfo'; +import { getRcGitHubInfo } from './getRcGitHubInfo'; import { InfoCardPlus } from '../../components/InfoCardPlus'; import { ComponentConfigCreateRc, @@ -66,37 +66,37 @@ export const CreateRc = ({ const [semverBumpLevel, setSemverBumpLevel] = useState<'major' | 'minor'>( SEMVER_PARTS.minor, ); - const [nextGheInfo, setNextGheInfo] = useState( - getRcGheInfo({ latestRelease, project, semverBumpLevel }), + const [nextGitHubInfo, setNextGitHubInfo] = useState( + getRcGitHubInfo({ latestRelease, project, semverBumpLevel }), ); useEffect(() => { - setNextGheInfo(getRcGheInfo({ latestRelease, project, semverBumpLevel })); - }, [semverBumpLevel, setNextGheInfo, latestRelease, project]); + setNextGitHubInfo( + getRcGitHubInfo({ latestRelease, project, semverBumpLevel }), + ); + }, [semverBumpLevel, setNextGitHubInfo, latestRelease, project]); - const [createReleaseResponse, callCreateGheRc] = useAsyncFn( - async (...args) => { - const createGheRcResponseSteps = await createGheRc({ + const [createGitHubReleaseResponse, createGitHubReleaseFn] = useAsyncFn( + (...args) => + createRc({ apiClient, defaultBranch, latestRelease, - nextGheInfo: args[0], + nextGitHubInfo: args[0], successCb, - }); - - return createGheRcResponseSteps; - }, + }), ); - - if (createReleaseResponse.error) { + if (createGitHubReleaseResponse.error) { return ( - {createReleaseResponse.error.message} + + {createGitHubReleaseResponse.error.message} + ); } const tagAlreadyExists = latestRelease !== null && - latestRelease.tag_name === nextGheInfo.rcReleaseTag; + latestRelease.tag_name === nextGitHubInfo.rcReleaseTag; const conflictingPreRelease = latestRelease !== null && latestRelease.prerelease; @@ -113,7 +113,7 @@ export const CreateRc = ({ return ( There's already a tag named{' '} - {nextGheInfo.rcReleaseTag} + {nextGitHubInfo.rcReleaseTag} ); } @@ -124,7 +124,7 @@ export const CreateRc = ({ @@ -132,7 +132,7 @@ export const CreateRc = ({ @@ -140,11 +140,14 @@ export const CreateRc = ({ } function CTA() { - if (createReleaseResponse.loading || createReleaseResponse.value) { + if ( + createGitHubReleaseResponse.loading || + createGitHubReleaseResponse.value + ) { return ( @@ -157,7 +160,7 @@ export const CreateRc = ({ disabled={conflictingPreRelease || tagAlreadyExists} variant="contained" color="primary" - onClick={() => callCreateGheRc(nextGheInfo)} + onClick={() => createGitHubReleaseFn(nextGitHubInfo)} > Create RC diff --git a/plugins/release-manager-as-a-service/src/cards/createRc/getRcGheInfo.test.ts b/plugins/release-manager-as-a-service/src/cards/createRc/getRcGitHubInfo.test.ts similarity index 84% rename from plugins/release-manager-as-a-service/src/cards/createRc/getRcGheInfo.test.ts rename to plugins/release-manager-as-a-service/src/cards/createRc/getRcGitHubInfo.test.ts index 0feb95734f..1ed3027f14 100644 --- a/plugins/release-manager-as-a-service/src/cards/createRc/getRcGheInfo.test.ts +++ b/plugins/release-manager-as-a-service/src/cards/createRc/getRcGitHubInfo.test.ts @@ -20,19 +20,19 @@ import { mockSemverProject, mockCalverProject, } from '../../test-helpers/test-helpers'; -import { getRcGheInfo } from './getRcGheInfo'; +import { getRcGitHubInfo } from './getRcGitHubInfo'; const injectedDate = format(1611869955783, 'yyyy.MM.dd'); -describe('getRCGheInfo', () => { +describe('getRcGitHubInfo', () => { describe('calver', () => { const latestRelease = { tag_name: 'rc-2020.01.01_0', } as GhGetReleaseResponse; - it('should return correct Ghe info', () => { + it('should return correct GitHub info', () => { expect( - getRcGheInfo({ + getRcGitHubInfo({ project: mockCalverProject, latestRelease, semverBumpLevel: 'minor', @@ -53,9 +53,9 @@ describe('getRCGheInfo', () => { tag_name: 'rc-1.1.1', } as GhGetReleaseResponse; - it("should return correct Ghe info when there's previous releases", () => { + it("should return correct GitHub info when there's previous releases", () => { expect( - getRcGheInfo({ + getRcGitHubInfo({ project: mockSemverProject, latestRelease, semverBumpLevel: 'minor', @@ -69,9 +69,9 @@ describe('getRCGheInfo', () => { `); }); - it("should return correct Ghe info when there's no previous release", () => { + it("should return correct GitHub info when there's no previous release", () => { expect( - getRcGheInfo({ + getRcGitHubInfo({ project: mockSemverProject, latestRelease: null, semverBumpLevel: 'minor', diff --git a/plugins/release-manager-as-a-service/src/cards/createRc/getRcGheInfo.ts b/plugins/release-manager-as-a-service/src/cards/createRc/getRcGitHubInfo.ts similarity index 98% rename from plugins/release-manager-as-a-service/src/cards/createRc/getRcGheInfo.ts rename to plugins/release-manager-as-a-service/src/cards/createRc/getRcGitHubInfo.ts index 6054117d9c..a35b46480e 100644 --- a/plugins/release-manager-as-a-service/src/cards/createRc/getRcGheInfo.ts +++ b/plugins/release-manager-as-a-service/src/cards/createRc/getRcGitHubInfo.ts @@ -20,7 +20,7 @@ import { getSemverTagParts } from '../../helpers/tagParts/getSemverTagParts'; import { Project, GhGetReleaseResponse } from '../../types/types'; import { SEMVER_PARTS } from '../../constants/constants'; -export const getRcGheInfo = ({ +export const getRcGitHubInfo = ({ project, latestRelease, semverBumpLevel, diff --git a/plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createGheRc.test.ts b/plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createRc.test.ts similarity index 92% rename from plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createGheRc.test.ts rename to plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createRc.test.ts index a94cd682ee..26450ac162 100644 --- a/plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createGheRc.test.ts +++ b/plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createRc.test.ts @@ -14,22 +14,22 @@ * limitations under the License. */ import { - mockDefaultBranch, - mockReleaseVersion, - mockNextGheInfo, mockApiClient, + mockDefaultBranch, + mockNextGitHubInfo, + mockReleaseVersion, } from '../../../test-helpers/test-helpers'; -import { createGheRc } from './createGheRc'; +import { createRc } from './createRc'; describe('createGheRc', () => { beforeEach(jest.clearAllMocks); it('should work', async () => { - const result = await createGheRc({ + const result = await createRc({ apiClient: mockApiClient, defaultBranch: mockDefaultBranch, latestRelease: mockReleaseVersion, - nextGheInfo: mockNextGheInfo, + nextGitHubInfo: mockNextGitHubInfo, }); expect(result).toMatchInlineSnapshot(` diff --git a/plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createGheRc.ts b/plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createRc.ts similarity index 85% rename from plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createGheRc.ts rename to plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createRc.ts index 29491fb13e..2b5b71ee24 100644 --- a/plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createGheRc.ts +++ b/plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createRc.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { getRcGheInfo } from '../getRcGheInfo'; +import { getRcGitHubInfo } from '../getRcGitHubInfo'; import { ComponentConfigCreateRc, GhCreateReferenceResponse, @@ -24,21 +24,21 @@ import { import { RMaaSApiClient } from '../../../api/RMaaSApiClient'; import { ReleaseManagerAsAServiceError } from '../../../errors/ReleaseManagerAsAServiceError'; -interface CreateGheRC { +interface CreateRC { apiClient: RMaaSApiClient; defaultBranch: GhGetRepositoryResponse['default_branch']; latestRelease: GhGetReleaseResponse | null; - nextGheInfo: ReturnType; + nextGitHubInfo: ReturnType; successCb?: ComponentConfigCreateRc['successCb']; } -export async function createGheRc({ +export async function createRc({ apiClient, defaultBranch, latestRelease, - nextGheInfo, + nextGitHubInfo, successCb, -}: CreateGheRC) { +}: CreateRC) { const responseSteps: ResponseStep[] = []; /** @@ -62,13 +62,13 @@ export async function createGheRc({ createdRef = ( await apiClient.createRc.createRef({ mostRecentSha, - targetBranch: nextGheInfo.rcBranch, + targetBranch: nextGitHubInfo.rcBranch, }) ).createdRef; } catch (error) { if (error.body.message === 'Reference already exists') { throw new ReleaseManagerAsAServiceError( - `Branch "${nextGheInfo.rcBranch}" already exists: .../tree/${nextGheInfo.rcBranch}`, + `Branch "${nextGitHubInfo.rcBranch}" already exists: .../tree/${nextGitHubInfo.rcBranch}`, ); } throw error; @@ -84,7 +84,7 @@ export async function createGheRc({ const previousReleaseBranch = latestRelease ? latestRelease.target_commitish : defaultBranch; - const nextReleaseBranch = nextGheInfo.rcBranch; + const nextReleaseBranch = nextGitHubInfo.rcBranch; const { comparison } = await apiClient.createRc.getComparison({ previousReleaseBranch, nextReleaseBranch, @@ -105,15 +105,15 @@ export async function createGheRc({ }); /** - * 4. Creates the release itself in GHE + * 4. Creates the release itself in GitHub */ const { createReleaseResponse } = await apiClient.createRc.createRelease({ - nextGheInfo, + nextGitHubInfo: nextGitHubInfo, releaseBody, }); responseSteps.push({ message: `Created Release Candidate "${createReleaseResponse.name}"`, - secondaryMessage: `with tag "${nextGheInfo.rcReleaseTag}"`, + secondaryMessage: `with tag "${nextGitHubInfo.rcReleaseTag}"`, link: createReleaseResponse.html_url, }); diff --git a/plugins/release-manager-as-a-service/src/cards/info/Info.tsx b/plugins/release-manager-as-a-service/src/cards/info/Info.tsx index 3d27e24297..76d821b0a5 100644 --- a/plugins/release-manager-as-a-service/src/cards/info/Info.tsx +++ b/plugins/release-manager-as-a-service/src/cards/info/Info.tsx @@ -25,7 +25,7 @@ import { } from '../../types/types'; import { useStyles } from '../../styles/styles'; import { TEST_IDS } from '../../test-helpers/test-ids'; -import rmaasFlowImage from './rmaas-flow.png'; +import flowImage from './flow.png'; interface InfoCardProps { releaseBranch: GhGetBranchResponse | null; @@ -46,26 +46,26 @@ export const Info = ({ Terminology - GitHub Enterprise (GHE): The source control system - where releases reside in a practical sense. Read more about GitHub - releases{' '} + GitHub: The source control system where releases + reside in a practical sense. Read more about GitHub releases{' '} here - . Note that this plugin works just as well with a non-enterprise - account. + . Note that this plugin works just as well with GitHub Enterprise + (GHE) - Release Candidate: A GHE pre-release intended - primarily for internal testing + Release Candidate: A GitHub prerelease{' '} + intended primarily for internal testing - Release Version: A GHE release intended for end users + Release Version: A GitHub release intended for end + users @@ -82,7 +82,7 @@ export const Info = ({ Here's an overview of the flow: - rmaas-flow + flow
@@ -91,7 +91,7 @@ export const Info = ({ Repository:{' '} diff --git a/plugins/release-manager-as-a-service/src/cards/info/rmaas-flow.png b/plugins/release-manager-as-a-service/src/cards/info/flow.png similarity index 100% rename from plugins/release-manager-as-a-service/src/cards/info/rmaas-flow.png rename to plugins/release-manager-as-a-service/src/cards/info/flow.png diff --git a/plugins/release-manager-as-a-service/src/cards/patchRc/PatchBody.tsx b/plugins/release-manager-as-a-service/src/cards/patchRc/PatchBody.tsx index a30515c9b6..6d15bc6a08 100644 --- a/plugins/release-manager-as-a-service/src/cards/patchRc/PatchBody.tsx +++ b/plugins/release-manager-as-a-service/src/cards/patchRc/PatchBody.tsx @@ -69,7 +69,7 @@ export const PatchBody = ({ const apiClient = useApiClientContext(); const [checkedCommitIndex, setCheckedCommitIndex] = useState(-1); - const gheDataResponse = useAsync(async () => { + const githubDataResponse = useAsync(async () => { const [ { branch: releaseBranchResponse }, { recentCommits }, @@ -91,7 +91,7 @@ export const PatchBody = ({ }; }); - const [patchGheRcResponse, patchGheRcFn] = useAsyncFn(async (...args) => { + const [patchReleaseResponse, patchReleaseFn] = useAsyncFn(async (...args) => { const selectedPatchCommit: GhGetCommitResponse = args[0]; const patchResponseSteps = await patch({ apiClient, @@ -105,17 +105,17 @@ export const PatchBody = ({ return patchResponseSteps; }); - if (gheDataResponse.error) { + if (githubDataResponse.error) { return ( - {gheDataResponse.error.message} + {githubDataResponse.error.message} ); } - if (patchGheRcResponse.error) { - return {patchGheRcResponse.error.message}; + if (patchReleaseResponse.error) { + return {patchReleaseResponse.error.message}; } - if (gheDataResponse.loading) { + if (githubDataResponse.loading) { return ; } @@ -131,7 +131,7 @@ export const PatchBody = ({ severity="info" > - The current GHE release is a Release Version + The current GitHub release is a Release Version It's still possible to patch it, but be extra mindful of changes @@ -145,14 +145,14 @@ export const PatchBody = ({ } function CommitList() { - if (!gheDataResponse.value?.recentCommits) { + if (!githubDataResponse.value?.recentCommits) { return null; } return ( - {gheDataResponse.value.recentCommits.map((commit, index) => { - const commitExistsOnReleaseBranch = !!gheDataResponse.value?.recentReleaseBranchCommits.find( + {githubDataResponse.value.recentCommits.map((commit, index) => { + const commitExistsOnReleaseBranch = !!githubDataResponse.value?.recentReleaseBranchCommits.find( ({ sha }) => { return sha === commit.sha; }, @@ -185,9 +185,9 @@ export const PatchBody = ({ 0) || + patchReleaseResponse.loading || + (patchReleaseResponse.value && + patchReleaseResponse.value.length > 0) || commitExistsOnReleaseBranch } role={undefined} @@ -252,11 +252,11 @@ export const PatchBody = ({ } function CTA() { - if (patchGheRcResponse.loading || patchGheRcResponse.value) { + if (patchReleaseResponse.loading || patchReleaseResponse.value) { return ( Patch Release Candidate @@ -279,8 +279,8 @@ export const PatchBody = ({ color="primary" onClick={() => { // FIXME: Optional chaining shouldn't be needed here due to the if-statement above - patchGheRcFn( - gheDataResponse.value?.recentCommits[checkedCommitIndex], + patchReleaseFn( + githubDataResponse.value?.recentCommits[checkedCommitIndex], ); }} > diff --git a/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRc.tsx b/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRc.tsx index a591f71cd1..e7583e7085 100644 --- a/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRc.tsx +++ b/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRc.tsx @@ -53,7 +53,9 @@ export const PromoteRc = ({ className={classes.paragraph} severity="warning" > - Latest GHE release is not a Release Candidate + + Latest GitHub release is not a Release Candidate + One can only promote Release Candidates to Release Versions ); diff --git a/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRcBody.tsx b/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRcBody.tsx index 31eb883dee..99ca136fac 100644 --- a/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRcBody.tsx +++ b/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRcBody.tsx @@ -24,7 +24,7 @@ import { GhGetReleaseResponse, SetRefetch, } from '../../types/types'; -import { promoteGheRc } from './sideEffects/promoteGheRc'; +import { promoteRc } from './sideEffects/promoteRc'; import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; import { useApiClientContext } from '../../components/ProjectContext'; import { useStyles } from '../../styles/styles'; @@ -44,12 +44,14 @@ export const PromoteRcBody = ({ const apiClient = useApiClientContext(); const classes = useStyles(); const releaseVersion = rcRelease.tag_name.replace('rc-', 'version-'); - const [promoteGheRcResponse, promoseGheRcFn] = useAsyncFn( - promoteGheRc({ apiClient, rcRelease, releaseVersion, successCb }), + const [promoteGitHubRcResponse, promoseGitHubRcFn] = useAsyncFn( + promoteRc({ apiClient, rcRelease, releaseVersion, successCb }), ); - if (promoteGheRcResponse.error) { - return {promoteGheRcResponse.error.message}; + if (promoteGitHubRcResponse.error) { + return ( + {promoteGitHubRcResponse.error.message} + ); } function Description() { @@ -67,13 +69,13 @@ export const PromoteRcBody = ({ } function CTA() { - if (promoteGheRcResponse.loading || promoteGheRcResponse.value) { + if (promoteGitHubRcResponse.loading || promoteGitHubRcResponse.value) { return ( ); } @@ -83,7 +85,7 @@ export const PromoteRcBody = ({ data-testid={TEST_IDS.promoteRc.cta} variant="contained" color="primary" - onClick={() => promoseGheRcFn()} + onClick={() => promoseGitHubRcFn()} > Promote Release Candidate diff --git a/plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteGheRc.test.ts b/plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteRc.test.ts similarity index 90% rename from plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteGheRc.test.ts rename to plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteRc.test.ts index d6df61a1f3..a64cf70f81 100644 --- a/plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteGheRc.test.ts +++ b/plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteRc.test.ts @@ -17,13 +17,13 @@ import { mockRcRelease, mockApiClient, } from '../../../test-helpers/test-helpers'; -import { promoteGheRc } from './promoteGheRc'; +import { promoteRc } from './promoteRc'; -describe('promoteGheRc', () => { +describe('promoteRc', () => { beforeEach(jest.clearAllMocks); it('should work', async () => { - const result = await promoteGheRc({ + const result = await promoteRc({ apiClient: mockApiClient, rcRelease: mockRcRelease, releaseVersion: 'version-1.2.3', diff --git a/plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteGheRc.ts b/plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteRc.ts similarity index 95% rename from plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteGheRc.ts rename to plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteRc.ts index 91371b72a6..d473951a91 100644 --- a/plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteGheRc.ts +++ b/plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteRc.ts @@ -20,19 +20,19 @@ import { } from '../../../types/types'; import { RMaaSApiClient } from '../../../api/RMaaSApiClient'; -interface PromoteGheRc { +interface PromoteRc { apiClient: RMaaSApiClient; rcRelease: GhGetReleaseResponse; releaseVersion: string; successCb?: ComponentConfigPromoteRc['successCb']; } -export function promoteGheRc({ +export function promoteRc({ apiClient, rcRelease, releaseVersion, successCb, -}: PromoteGheRc) { +}: PromoteRc) { return async (): Promise => { const responseSteps: ResponseStep[] = []; diff --git a/plugins/release-manager-as-a-service/src/components/Differ.tsx b/plugins/release-manager-as-a-service/src/components/Differ.tsx index 7af998792b..02bf60ce46 100644 --- a/plugins/release-manager-as-a-service/src/components/Differ.tsx +++ b/plugins/release-manager-as-a-service/src/components/Differ.tsx @@ -25,7 +25,7 @@ interface DifferProps { next?: string | ReactNode; prev?: string; prefix?: string; - icon?: 'tag' | 'branch' | 'ghe' | 'slack' | 'versioning'; + icon?: 'tag' | 'branch' | 'github' | 'slack' | 'versioning'; } const Icon = ({ icon }: { icon: DifferProps['icon'] }) => { @@ -40,7 +40,7 @@ const Icon = ({ icon }: { icon: DifferProps['icon'] }) => { ); - case 'ghe': + case 'github': return ( ); diff --git a/plugins/release-manager-as-a-service/src/components/NoLatestRelease.tsx b/plugins/release-manager-as-a-service/src/components/NoLatestRelease.tsx index 85909d526d..f09049f3cf 100644 --- a/plugins/release-manager-as-a-service/src/components/NoLatestRelease.tsx +++ b/plugins/release-manager-as-a-service/src/components/NoLatestRelease.tsx @@ -28,7 +28,7 @@ export const NoLatestRelease = () => { className={classes.paragraph} severity="warning" > - Unable to find any GHE releases + Unable to find any GitHub release ); }; diff --git a/plugins/release-manager-as-a-service/src/test-helpers/test-helpers.test.ts b/plugins/release-manager-as-a-service/src/test-helpers/test-helpers.test.ts index e72eba4df4..78c48eb0a7 100644 --- a/plugins/release-manager-as-a-service/src/test-helpers/test-helpers.test.ts +++ b/plugins/release-manager-as-a-service/src/test-helpers/test-helpers.test.ts @@ -73,7 +73,7 @@ describe('testHelpers', () => { "versioningStrategy": "calver", }, "mockDefaultBranch": "mock_defaultBranch", - "mockNextGheInfo": Object { + "mockNextGitHubInfo": Object { "rcBranch": "rc/1.2.3", "rcReleaseTag": "rc-1.2.3", "releaseName": "Version 1.2.3", diff --git a/plugins/release-manager-as-a-service/src/test-helpers/test-helpers.ts b/plugins/release-manager-as-a-service/src/test-helpers/test-helpers.ts index b994e591d2..61d8cb3b17 100644 --- a/plugins/release-manager-as-a-service/src/test-helpers/test-helpers.ts +++ b/plugins/release-manager-as-a-service/src/test-helpers/test-helpers.ts @@ -14,7 +14,7 @@ * limitations under the License. */ import { CalverTagParts } from '../helpers/tagParts/getCalverTagParts'; -import { getRcGheInfo } from '../cards/createRc/getRcGheInfo'; +import { getRcGitHubInfo } from '../cards/createRc/getRcGitHubInfo'; import { GhCompareCommitsResponse, GhCreateCommitResponse, @@ -50,7 +50,7 @@ export const mockCalverProject: Project = { export const mockDefaultBranch = 'mock_defaultBranch'; -export const mockNextGheInfo: ReturnType = { +export const mockNextGitHubInfo: ReturnType = { rcBranch: 'rc/1.2.3', rcReleaseTag: 'rc-1.2.3', releaseName: 'Version 1.2.3', From f90918b6c8e6f95464815bb65c17e87425be6b52 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Tue, 13 Apr 2021 10:02:11 +0200 Subject: [PATCH 013/485] Replace date-fns with luxon Signed-off-by: Erik Engervall --- plugins/release-manager-as-a-service/package.json | 2 +- .../src/cards/createRc/getRcGitHubInfo.test.ts | 14 ++++++++++---- .../src/cards/createRc/getRcGitHubInfo.ts | 4 ++-- yarn.lock | 5 ----- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/plugins/release-manager-as-a-service/package.json b/plugins/release-manager-as-a-service/package.json index 9a8f1bb7ef..33b0c5279b 100644 --- a/plugins/release-manager-as-a-service/package.json +++ b/plugins/release-manager-as-a-service/package.json @@ -27,7 +27,7 @@ "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.45", "@octokit/rest": "^18.0.12", - "date-fns": "^2.19.0", + "luxon": "^1.26.0", "react-dom": "^16.13.1", "react-router": "6.0.0-beta.0", "react-use": "^15.3.3", diff --git a/plugins/release-manager-as-a-service/src/cards/createRc/getRcGitHubInfo.test.ts b/plugins/release-manager-as-a-service/src/cards/createRc/getRcGitHubInfo.test.ts index 1ed3027f14..59676e989b 100644 --- a/plugins/release-manager-as-a-service/src/cards/createRc/getRcGitHubInfo.test.ts +++ b/plugins/release-manager-as-a-service/src/cards/createRc/getRcGitHubInfo.test.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { format } from 'date-fns'; +import { DateTime } from 'luxon'; import { GhGetReleaseResponse } from '../../types/types'; import { @@ -22,9 +22,15 @@ import { } from '../../test-helpers/test-helpers'; import { getRcGitHubInfo } from './getRcGitHubInfo'; -const injectedDate = format(1611869955783, 'yyyy.MM.dd'); - describe('getRcGitHubInfo', () => { + describe('DateTime', () => { + it('should format dates as expected', () => { + const formattedDate = DateTime.now().toFormat('yyyy.MM.dd'); + + expect(formattedDate).toMatch(/^\d{4}.\d{2}.\d{2}$/); + }); + }); + describe('calver', () => { const latestRelease = { tag_name: 'rc-2020.01.01_0', @@ -36,7 +42,7 @@ describe('getRcGitHubInfo', () => { project: mockCalverProject, latestRelease, semverBumpLevel: 'minor', - injectedDate, + injectedDate: '2021.01.28', }), ).toMatchInlineSnapshot(` Object { diff --git a/plugins/release-manager-as-a-service/src/cards/createRc/getRcGitHubInfo.ts b/plugins/release-manager-as-a-service/src/cards/createRc/getRcGitHubInfo.ts index a35b46480e..df58f73f11 100644 --- a/plugins/release-manager-as-a-service/src/cards/createRc/getRcGitHubInfo.ts +++ b/plugins/release-manager-as-a-service/src/cards/createRc/getRcGitHubInfo.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { format } from 'date-fns'; +import { DateTime } from 'luxon'; import { getBumpedSemverTagParts } from '../../helpers/getBumpedTag'; import { getSemverTagParts } from '../../helpers/tagParts/getSemverTagParts'; @@ -24,7 +24,7 @@ export const getRcGitHubInfo = ({ project, latestRelease, semverBumpLevel, - injectedDate = format(new Date(), 'yyyy.MM.dd'), // '0012-01-01T13:37:00.000Z' + injectedDate = DateTime.now().toFormat('yyyy.MM.dd'), }: { project: Project; latestRelease: GhGetReleaseResponse | null; diff --git a/yarn.lock b/yarn.lock index cca4a0ed44..d341a67170 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11408,11 +11408,6 @@ date-fns@^2.0.0-alpha.27, date-fns@^2.16.1: resolved "https://registry.npmjs.org/date-fns/-/date-fns-2.18.0.tgz#08e50aee300ad0d2c5e054e3f0d10d8f9cdfe09e" integrity sha512-NYyAg4wRmGVU4miKq5ivRACOODdZRY3q5WLmOJSq8djyzftYphU7dTHLcEtLqEvfqMKQ0jVv91P4BAwIjsXIcw== -date-fns@^2.19.0: - version "2.19.0" - resolved "https://artifactory.spotify.net/artifactory/api/npm/virtual-npm/date-fns/-/date-fns-2.19.0.tgz#65193348635a28d5d916c43ec7ce6fbd145059e1" - integrity sha1-ZRkzSGNaKNXZFsQ+x85vvRRQWeE= - dateformat@^3.0.0: version "3.0.3" resolved "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" From 379e568d670b2ae85782bd05b05d1662948d384c Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Tue, 13 Apr 2021 10:18:42 +0200 Subject: [PATCH 014/485] Rename plugin to GitHub Release Manager and remove references to RMaaS Signed-off-by: Erik Engervall --- .../plugins/release-manager-as-a-service.yaml | 8 +-- ...go.svg => github-release-manager-logo.svg} | 0 packages/app/package.json | 2 +- packages/app/src/plugins.ts | 2 +- .../.eslintrc.js | 0 .../README.md | 14 ++--- .../dev/README.md | 6 +- .../dev/index.tsx | 4 +- .../package.json | 2 +- .../src/GitHubReleaseManager.tsx} | 14 ++--- .../src/api/ApiClient.ts} | 4 +- .../src/api/PluginApiClientConfig.ts | 0 .../src/api/serviceApiRef.ts | 11 ++-- .../src/cards/createRc/CreateRc.test.tsx | 0 .../src/cards/createRc/CreateRc.tsx | 0 .../cards/createRc/getRcGitHubInfo.test.ts | 0 .../src/cards/createRc/getRcGitHubInfo.ts | 0 .../createRc/sideEffects/createRc.test.ts | 0 .../cards/createRc/sideEffects/createRc.ts | 4 +- .../src/cards/info/Info.test.tsx | 0 .../src/cards/info/Info.tsx | 6 +- .../src/cards/info/flow.png | Bin 0 -> 78736 bytes .../src/cards/patchRc/Patch.test.tsx | 0 .../src/cards/patchRc/Patch.tsx | 0 .../src/cards/patchRc/PatchBody.test.tsx | 0 .../src/cards/patchRc/PatchBody.tsx | 0 .../cards/patchRc/sideEffects/patch.test.ts | 0 .../src/cards/patchRc/sideEffects/patch.ts | 4 +- .../src/cards/promoteRc/PromoteRc.test.tsx | 0 .../src/cards/promoteRc/PromoteRc.tsx | 0 .../cards/promoteRc/PromoteRcBody.test.tsx | 0 .../src/cards/promoteRc/PromoteRcBody.tsx | 0 .../promoteRc/sideEffects/promoteRc.test.ts | 0 .../cards/promoteRc/sideEffects/promoteRc.ts | 4 +- .../src/components/Differ.tsx | 0 .../src/components/Divider.test.tsx | 0 .../src/components/Divider.tsx | 0 .../src/components/InfoCardPlus.test.tsx | 0 .../src/components/InfoCardPlus.tsx | 0 .../src/components/NoLatestRelease.test.tsx | 0 .../src/components/NoLatestRelease.tsx | 0 .../src/components/ProjectContext.ts | 6 +- .../src/components/ReloadButton.test.tsx | 0 .../src/components/ReloadButton.tsx | 0 .../ResponseStepList.test.tsx | 0 .../ResponseStepList/ResponseStepList.tsx | 0 .../ResponseStepListItem.test.tsx | 0 .../ResponseStepList/ResponseStepListItem.tsx | 0 .../src/constants/constants.test.ts | 0 .../src/constants/constants.ts | 0 .../errors/ReleaseManagerAsAServiceError.ts | 0 .../src/helpers/date.test.ts | 0 .../src/helpers/date.ts | 0 .../src/helpers/getBumpedTag.test.ts | 0 .../src/helpers/getBumpedTag.ts | 0 .../src/helpers/getShortCommitHash.test.ts | 0 .../src/helpers/getShortCommitHash.ts | 0 .../src/helpers/isCalverTagParts.test.ts | 0 .../src/helpers/isCalverTagParts.ts | 0 .../src/helpers/tagParts/getCalverTagParts.ts | 0 .../src/helpers/tagParts/getSemverTagParts.ts | 0 .../src/helpers/tagParts/getTagParts.test.ts | 0 .../src/helpers/tagParts/getTagParts.ts | 0 .../src/index.ts | 2 +- .../src/plugin.test.ts | 6 +- .../src/plugin.ts | 14 ++--- .../src/routes.ts | 4 +- .../src/setupTests.ts | 0 .../src/sideEffects/getGitHubBatchInfo.ts | 4 +- .../src/sideEffects/getLatestRelease.test.ts | 0 .../src/sideEffects/getLatestRelease.ts | 4 +- .../src/styles/styles.ts | 0 .../src/test-helpers/test-helpers.test.ts | 0 .../src/test-helpers/test-helpers.ts | 0 .../src/test-helpers/test-ids.ts | 53 ++++++++++++++++++ .../src/types/types.ts | 2 +- .../src/cards/info/flow.png | Bin 77527 -> 0 bytes .../src/test-helpers/test-ids.ts | 53 ------------------ 78 files changed, 112 insertions(+), 121 deletions(-) rename microsite/static/img/{release-manager-as-a-service-logo.svg => github-release-manager-logo.svg} (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/.eslintrc.js (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/README.md (78%) rename plugins/{release-manager-as-a-service => github-release-manager}/dev/README.md (70%) rename plugins/{release-manager-as-a-service => github-release-manager}/dev/index.tsx (94%) rename plugins/{release-manager-as-a-service => github-release-manager}/package.json (95%) rename plugins/{release-manager-as-a-service/src/ReleaseManagerAsAService.tsx => github-release-manager/src/GitHubReleaseManager.tsx} (92%) rename plugins/{release-manager-as-a-service/src/api/RMaaSApiClient.ts => github-release-manager/src/api/ApiClient.ts} (98%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/api/PluginApiClientConfig.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/api/serviceApiRef.ts (74%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/cards/createRc/CreateRc.test.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/cards/createRc/CreateRc.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/cards/createRc/getRcGitHubInfo.test.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/cards/createRc/getRcGitHubInfo.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/cards/createRc/sideEffects/createRc.test.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/cards/createRc/sideEffects/createRc.ts (97%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/cards/info/Info.test.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/cards/info/Info.tsx (95%) create mode 100644 plugins/github-release-manager/src/cards/info/flow.png rename plugins/{release-manager-as-a-service => github-release-manager}/src/cards/patchRc/Patch.test.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/cards/patchRc/Patch.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/cards/patchRc/PatchBody.test.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/cards/patchRc/PatchBody.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/cards/patchRc/sideEffects/patch.test.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/cards/patchRc/sideEffects/patch.ts (98%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/cards/promoteRc/PromoteRc.test.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/cards/promoteRc/PromoteRc.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/cards/promoteRc/PromoteRcBody.test.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/cards/promoteRc/PromoteRcBody.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/cards/promoteRc/sideEffects/promoteRc.test.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/cards/promoteRc/sideEffects/promoteRc.ts (94%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/components/Differ.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/components/Divider.test.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/components/Divider.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/components/InfoCardPlus.test.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/components/InfoCardPlus.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/components/NoLatestRelease.test.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/components/NoLatestRelease.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/components/ProjectContext.ts (86%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/components/ReloadButton.test.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/components/ReloadButton.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/components/ResponseStepList/ResponseStepList.test.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/components/ResponseStepList/ResponseStepList.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/components/ResponseStepList/ResponseStepListItem.test.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/components/ResponseStepList/ResponseStepListItem.tsx (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/constants/constants.test.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/constants/constants.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/errors/ReleaseManagerAsAServiceError.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/helpers/date.test.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/helpers/date.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/helpers/getBumpedTag.test.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/helpers/getBumpedTag.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/helpers/getShortCommitHash.test.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/helpers/getShortCommitHash.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/helpers/isCalverTagParts.test.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/helpers/isCalverTagParts.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/helpers/tagParts/getCalverTagParts.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/helpers/tagParts/getSemverTagParts.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/helpers/tagParts/getTagParts.test.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/helpers/tagParts/getTagParts.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/index.ts (91%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/plugin.test.ts (79%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/plugin.ts (75%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/routes.ts (87%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/setupTests.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/sideEffects/getGitHubBatchInfo.ts (93%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/sideEffects/getLatestRelease.test.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/sideEffects/getLatestRelease.ts (91%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/styles/styles.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/test-helpers/test-helpers.test.ts (100%) rename plugins/{release-manager-as-a-service => github-release-manager}/src/test-helpers/test-helpers.ts (100%) create mode 100644 plugins/github-release-manager/src/test-helpers/test-ids.ts rename plugins/{release-manager-as-a-service => github-release-manager}/src/types/types.ts (99%) delete mode 100644 plugins/release-manager-as-a-service/src/cards/info/flow.png delete mode 100644 plugins/release-manager-as-a-service/src/test-helpers/test-ids.ts diff --git a/microsite/data/plugins/release-manager-as-a-service.yaml b/microsite/data/plugins/release-manager-as-a-service.yaml index 08138f6d3b..9c930b2bbb 100644 --- a/microsite/data/plugins/release-manager-as-a-service.yaml +++ b/microsite/data/plugins/release-manager-as-a-service.yaml @@ -1,9 +1,9 @@ --- -title: Release Manager as a Service +title: GitHub Release Manager author: '@erikengervall' authorUrl: https://github.com/erikengervall category: Release management description: Manage releases without having to juggle git commands -documentation: https://github.com/backstage/backstage/tree/master/plugins/release-manager-as-a-service -iconUrl: img/release-manager-as-a-service.svg -npmPackageName: '@backstage/plugin-release-manager-as-a-service' +documentation: https://github.com/backstage/backstage/tree/master/plugins/github-release-manager +iconUrl: img/github-release-manager-logo.svg +npmPackageName: '@backstage/plugin-github-release-manager' diff --git a/microsite/static/img/release-manager-as-a-service-logo.svg b/microsite/static/img/github-release-manager-logo.svg similarity index 100% rename from microsite/static/img/release-manager-as-a-service-logo.svg rename to microsite/static/img/github-release-manager-logo.svg diff --git a/packages/app/package.json b/packages/app/package.json index 26d5c36ab6..4c734b85f3 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -30,7 +30,7 @@ "@backstage/plugin-org": "^0.3.10", "@backstage/plugin-pagerduty": "0.3.2", "@backstage/plugin-register-component": "^0.2.12", - "@backstage/plugin-release-manager-as-a-service": "^0.1.1", + "@backstage/plugin-github-release-manager": "^0.1.1", "@backstage/plugin-rollbar": "^0.3.3", "@backstage/plugin-scaffolder": "^0.8.0", "@backstage/plugin-search": "^0.3.4", diff --git a/packages/app/src/plugins.ts b/packages/app/src/plugins.ts index bedd533e69..744456bfaa 100644 --- a/packages/app/src/plugins.ts +++ b/packages/app/src/plugins.ts @@ -46,4 +46,4 @@ export { plugin as Kafka } from '@backstage/plugin-kafka'; export { todoPlugin } from '@backstage/plugin-todo'; export { badgesPlugin } from '@backstage/plugin-badges'; export { githubDeploymentsPlugin } from '@backstage/plugin-github-deployments'; -export { releaseManagerAsAServicePlugin } from '@backstage/plugin-release-manager-as-a-service'; +export { releaseManagerAsAServicePlugin } from '@backstage/plugin-github-release-manager'; diff --git a/plugins/release-manager-as-a-service/.eslintrc.js b/plugins/github-release-manager/.eslintrc.js similarity index 100% rename from plugins/release-manager-as-a-service/.eslintrc.js rename to plugins/github-release-manager/.eslintrc.js diff --git a/plugins/release-manager-as-a-service/README.md b/plugins/github-release-manager/README.md similarity index 78% rename from plugins/release-manager-as-a-service/README.md rename to plugins/github-release-manager/README.md index 46e45f9ca5..3411c51000 100644 --- a/plugins/release-manager-as-a-service/README.md +++ b/plugins/github-release-manager/README.md @@ -1,14 +1,14 @@ -# Release Manager as a Service (RMaaS) +# GitHub Release Manager (GRM) ## Overview -`RMaaS` enables developers to manage their releases without having to juggle git commands. +`GRM` enables developers to manage their releases without having to juggle git commands. Does it build and ship your code? **No**. -What `RMaaS` does is manage your **[releases](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/managing-releases-in-a-repository)** on GitHub, building and shipping is entirely up to you as a developer to handle in your CI. +What `GRM` does is manage your **[releases](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/managing-releases-in-a-repository)** on GitHub, building and shipping is entirely up to you as a developer to handle in your CI. -`RMaaS` is built with industry standards in mind and the flow is as follows: +`GRM` is built with industry standards in mind and the flow is as follows: ![](./src/cards/info/flow.png) @@ -21,7 +21,7 @@ What `RMaaS` does is manage your **[releases](https://docs.github.com/en/free-pr Looking at the flow above, a common release lifecycle could be: - User presses **Create Release Candidate** - - `RMaaS` + - `GRM` 1. Creates a release branch `rc/` 1. Creates Release Candidate tag `rc-` 1. Creates a GitHub prerelease with Release Candidate tag @@ -29,7 +29,7 @@ Looking at the flow above, a common release lifecycle could be: 1. Detects the new tag by matching the git reference `refs/tags/rc-.*` 1. Builds and deploys to staging environment for testing - User presses **Patch** - - `RMaaS` + - `GRM` 1. The selected commit is cherry-picked to the release branch 1. The release tag is bumped 1. Updates GitHub release's tag and description with the patch's details @@ -37,7 +37,7 @@ Looking at the flow above, a common release lifecycle could be: 1. Detects the new tag by matching the git reference `refs/tags/(rc|version)-.*` (Release Versions are patchable as well) 1. Builds and deploys to staging (or production if Release Version) for testing - User presses **Promote Release Candidate to Release Version** - - `RMaaS` + - `GRM` 1. Creates Release Version tag `version-` 1. Promotes the GitHub release by removing the prerelease flag - Your CI diff --git a/plugins/release-manager-as-a-service/dev/README.md b/plugins/github-release-manager/dev/README.md similarity index 70% rename from plugins/release-manager-as-a-service/dev/README.md rename to plugins/github-release-manager/dev/README.md index 550c8e1844..736d20766e 100644 --- a/plugins/release-manager-as-a-service/dev/README.md +++ b/plugins/github-release-manager/dev/README.md @@ -1,12 +1,12 @@ -# release-manager-as-a-service +# github-release-manager -Welcome to the release-manager-as-a-service plugin! +Welcome to the github-release-manager plugin! _This plugin was created through the Backstage CLI_ ## Getting started -Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn start` in the root directory, and then navigating to [/release-manager-as-a-service](http://localhost:3000/release-manager-as-a-service). +Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn start` in the root directory, and then navigating to [/github-release-manager](http://localhost:3000/github-release-manager). You can also serve the plugin in isolation by running `yarn start` in the plugin directory. This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads. diff --git a/plugins/release-manager-as-a-service/dev/index.tsx b/plugins/github-release-manager/dev/index.tsx similarity index 94% rename from plugins/release-manager-as-a-service/dev/index.tsx rename to plugins/github-release-manager/dev/index.tsx index 7bdc0ba12a..ff794f428a 100644 --- a/plugins/release-manager-as-a-service/dev/index.tsx +++ b/plugins/github-release-manager/dev/index.tsx @@ -16,12 +16,12 @@ import React from 'react'; import { createDevApp } from '@backstage/dev-utils'; import { - releaseManagerAsAServicePlugin, + gitHubReleaseManagerPlugin, ReleaseManagerAsAServicePage, } from '../src/plugin'; createDevApp() - .registerPlugin(releaseManagerAsAServicePlugin) + .registerPlugin(gitHubReleaseManagerPlugin) .addPage({ element: ( +
- +
@@ -172,7 +172,7 @@ function Cards({ project, components }: ReleaseManagerAsAServiceProps) { repository: gitHubBatchInfo.value.repository, }) .map((customElement, index) => ( -
{customElement}
+
{customElement}
))} ); diff --git a/plugins/release-manager-as-a-service/src/api/RMaaSApiClient.ts b/plugins/github-release-manager/src/api/ApiClient.ts similarity index 98% rename from plugins/release-manager-as-a-service/src/api/RMaaSApiClient.ts rename to plugins/github-release-manager/src/api/ApiClient.ts index fb4ad0daa7..a3c1ce35e5 100644 --- a/plugins/release-manager-as-a-service/src/api/RMaaSApiClient.ts +++ b/plugins/github-release-manager/src/api/ApiClient.ts @@ -37,7 +37,7 @@ import { SemverTagParts } from '../helpers/tagParts/getSemverTagParts'; * https://github.com/octokit/request.js/#the-data-parameter--set-request-body-directly */ -export class RMaaSApiClient { +export class ApiClient { private readonly pluginApiClient: PluginApiClientConfig; private readonly repoPath: string; private readonly githubCommonPath: string; @@ -317,7 +317,7 @@ export class RMaaSApiClient { data: { type: 'commit', message: - 'Tag generated by your friendly neighborhood Release Manager as a Service', + 'Tag generated by your friendly neighborhood GitHub Release Manager', tag: bumpedTag, object: updatedReference.object.sha, }, diff --git a/plugins/release-manager-as-a-service/src/api/PluginApiClientConfig.ts b/plugins/github-release-manager/src/api/PluginApiClientConfig.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/api/PluginApiClientConfig.ts rename to plugins/github-release-manager/src/api/PluginApiClientConfig.ts diff --git a/plugins/release-manager-as-a-service/src/api/serviceApiRef.ts b/plugins/github-release-manager/src/api/serviceApiRef.ts similarity index 74% rename from plugins/release-manager-as-a-service/src/api/serviceApiRef.ts rename to plugins/github-release-manager/src/api/serviceApiRef.ts index 1daea6f4c1..e55e99b072 100644 --- a/plugins/release-manager-as-a-service/src/api/serviceApiRef.ts +++ b/plugins/github-release-manager/src/api/serviceApiRef.ts @@ -17,10 +17,7 @@ import { createApiRef } from '@backstage/core'; import { PluginApiClientConfig } from './PluginApiClientConfig'; -export const releaseManagerAsAServiceApiRef = createApiRef( - { - id: 'plugin.release-manager-as-a-service.service', - description: - 'Used by the Release Manager as a Service plugin to make requests', - }, -); +export const githubReleaseManagerApiRef = createApiRef({ + id: 'plugin.github-release-manager.service', + description: 'Used by the GitHub Release Manager plugin to make requests', +}); diff --git a/plugins/release-manager-as-a-service/src/cards/createRc/CreateRc.test.tsx b/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/cards/createRc/CreateRc.test.tsx rename to plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx diff --git a/plugins/release-manager-as-a-service/src/cards/createRc/CreateRc.tsx b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/cards/createRc/CreateRc.tsx rename to plugins/github-release-manager/src/cards/createRc/CreateRc.tsx diff --git a/plugins/release-manager-as-a-service/src/cards/createRc/getRcGitHubInfo.test.ts b/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.test.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/cards/createRc/getRcGitHubInfo.test.ts rename to plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.test.ts diff --git a/plugins/release-manager-as-a-service/src/cards/createRc/getRcGitHubInfo.ts b/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/cards/createRc/getRcGitHubInfo.ts rename to plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.ts diff --git a/plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createRc.test.ts b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createRc.test.ts rename to plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts diff --git a/plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createRc.ts b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts similarity index 97% rename from plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createRc.ts rename to plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts index 2b5b71ee24..6d45abbb0f 100644 --- a/plugins/release-manager-as-a-service/src/cards/createRc/sideEffects/createRc.ts +++ b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts @@ -21,11 +21,11 @@ import { GhGetRepositoryResponse, ResponseStep, } from '../../../types/types'; -import { RMaaSApiClient } from '../../../api/RMaaSApiClient'; +import { ApiClient } from '../../../api/ApiClient'; import { ReleaseManagerAsAServiceError } from '../../../errors/ReleaseManagerAsAServiceError'; interface CreateRC { - apiClient: RMaaSApiClient; + apiClient: ApiClient; defaultBranch: GhGetRepositoryResponse['default_branch']; latestRelease: GhGetReleaseResponse | null; nextGitHubInfo: ReturnType; diff --git a/plugins/release-manager-as-a-service/src/cards/info/Info.test.tsx b/plugins/github-release-manager/src/cards/info/Info.test.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/cards/info/Info.test.tsx rename to plugins/github-release-manager/src/cards/info/Info.test.tsx diff --git a/plugins/release-manager-as-a-service/src/cards/info/Info.tsx b/plugins/github-release-manager/src/cards/info/Info.tsx similarity index 95% rename from plugins/release-manager-as-a-service/src/cards/info/Info.tsx rename to plugins/github-release-manager/src/cards/info/Info.tsx index 76d821b0a5..6b371ea873 100644 --- a/plugins/release-manager-as-a-service/src/cards/info/Info.tsx +++ b/plugins/github-release-manager/src/cards/info/Info.tsx @@ -73,9 +73,9 @@ export const Info = ({ Flow - RMaaS is built with a specific flow in mind. For example, it assumes - your project is configured to react to tags prefixed with rc or{' '} - version. + GitHub Release Manager is built with a specific flow in mind. For + example, it assumes your project is configured to react to tags + prefixed with rc or version. diff --git a/plugins/github-release-manager/src/cards/info/flow.png b/plugins/github-release-manager/src/cards/info/flow.png new file mode 100644 index 0000000000000000000000000000000000000000..e70df0d7faaa4944671e29177a0377fa07f6506a GIT binary patch literal 78736 zcmcG#byQqU);@~6OK^90cWWFvIKdr)ySuw<(4a90PH=Y*!QC2nf;4hF^UcgV>$~^< z=Kbf_Yn^qft9IG5cb%%U_j6)_YVznP#3)cuQ0R&Z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e*fc#3{06fVM| zI>C<5siWH6kzWtgPEc>qzl3})5op95qNAgjXDn95u{<(FU)|T%yNwI1O6g&+Dy2pI zufF#6+I`*qa3GLQaRDEi>bt(X%lCi(qf4^03ix`+octEC?Q!ydDq1ltQl7*`iO7|I z+7b-HU`sGu;$dX^>n*W6ShaKDnN=enu>bty2H10kC5%!=3*(}{u%l1?o56;58GwD$ zRTIXoyvG}TZ#+;sg;SE=|1ag=nH#)k|EEh?w@uCWyN`+U%%xLQ;HRTuppH?4hy5Gv C@nBW} literal 0 HcmV?d00001 diff --git a/plugins/release-manager-as-a-service/src/cards/patchRc/Patch.test.tsx b/plugins/github-release-manager/src/cards/patchRc/Patch.test.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/cards/patchRc/Patch.test.tsx rename to plugins/github-release-manager/src/cards/patchRc/Patch.test.tsx diff --git a/plugins/release-manager-as-a-service/src/cards/patchRc/Patch.tsx b/plugins/github-release-manager/src/cards/patchRc/Patch.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/cards/patchRc/Patch.tsx rename to plugins/github-release-manager/src/cards/patchRc/Patch.tsx diff --git a/plugins/release-manager-as-a-service/src/cards/patchRc/PatchBody.test.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/cards/patchRc/PatchBody.test.tsx rename to plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx diff --git a/plugins/release-manager-as-a-service/src/cards/patchRc/PatchBody.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/cards/patchRc/PatchBody.tsx rename to plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx diff --git a/plugins/release-manager-as-a-service/src/cards/patchRc/sideEffects/patch.test.ts b/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.test.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/cards/patchRc/sideEffects/patch.test.ts rename to plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.test.ts diff --git a/plugins/release-manager-as-a-service/src/cards/patchRc/sideEffects/patch.ts b/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.ts similarity index 98% rename from plugins/release-manager-as-a-service/src/cards/patchRc/sideEffects/patch.ts rename to plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.ts index 797ed8229c..6b6190e723 100644 --- a/plugins/release-manager-as-a-service/src/cards/patchRc/sideEffects/patch.ts +++ b/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.ts @@ -21,11 +21,11 @@ import { } from '../../../types/types'; import { CalverTagParts } from '../../../helpers/tagParts/getCalverTagParts'; import { ReleaseManagerAsAServiceError } from '../../../errors/ReleaseManagerAsAServiceError'; -import { RMaaSApiClient } from '../../../api/RMaaSApiClient'; +import { ApiClient } from '../../../api/ApiClient'; import { SemverTagParts } from '../../../helpers/tagParts/getSemverTagParts'; interface Patch { - apiClient: RMaaSApiClient; + apiClient: ApiClient; bumpedTag: string; latestRelease: GhGetReleaseResponse; selectedPatchCommit: GhGetCommitResponse; diff --git a/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRc.test.tsx b/plugins/github-release-manager/src/cards/promoteRc/PromoteRc.test.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRc.test.tsx rename to plugins/github-release-manager/src/cards/promoteRc/PromoteRc.test.tsx diff --git a/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRc.tsx b/plugins/github-release-manager/src/cards/promoteRc/PromoteRc.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRc.tsx rename to plugins/github-release-manager/src/cards/promoteRc/PromoteRc.tsx diff --git a/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRcBody.test.tsx b/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.test.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRcBody.test.tsx rename to plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.test.tsx diff --git a/plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRcBody.tsx b/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/cards/promoteRc/PromoteRcBody.tsx rename to plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx diff --git a/plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteRc.test.ts b/plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.test.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteRc.test.ts rename to plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.test.ts diff --git a/plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteRc.ts b/plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.ts similarity index 94% rename from plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteRc.ts rename to plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.ts index d473951a91..34085a3d12 100644 --- a/plugins/release-manager-as-a-service/src/cards/promoteRc/sideEffects/promoteRc.ts +++ b/plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.ts @@ -18,10 +18,10 @@ import { GhGetReleaseResponse, ResponseStep, } from '../../../types/types'; -import { RMaaSApiClient } from '../../../api/RMaaSApiClient'; +import { ApiClient } from '../../../api/ApiClient'; interface PromoteRc { - apiClient: RMaaSApiClient; + apiClient: ApiClient; rcRelease: GhGetReleaseResponse; releaseVersion: string; successCb?: ComponentConfigPromoteRc['successCb']; diff --git a/plugins/release-manager-as-a-service/src/components/Differ.tsx b/plugins/github-release-manager/src/components/Differ.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/components/Differ.tsx rename to plugins/github-release-manager/src/components/Differ.tsx diff --git a/plugins/release-manager-as-a-service/src/components/Divider.test.tsx b/plugins/github-release-manager/src/components/Divider.test.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/components/Divider.test.tsx rename to plugins/github-release-manager/src/components/Divider.test.tsx diff --git a/plugins/release-manager-as-a-service/src/components/Divider.tsx b/plugins/github-release-manager/src/components/Divider.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/components/Divider.tsx rename to plugins/github-release-manager/src/components/Divider.tsx diff --git a/plugins/release-manager-as-a-service/src/components/InfoCardPlus.test.tsx b/plugins/github-release-manager/src/components/InfoCardPlus.test.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/components/InfoCardPlus.test.tsx rename to plugins/github-release-manager/src/components/InfoCardPlus.test.tsx diff --git a/plugins/release-manager-as-a-service/src/components/InfoCardPlus.tsx b/plugins/github-release-manager/src/components/InfoCardPlus.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/components/InfoCardPlus.tsx rename to plugins/github-release-manager/src/components/InfoCardPlus.tsx diff --git a/plugins/release-manager-as-a-service/src/components/NoLatestRelease.test.tsx b/plugins/github-release-manager/src/components/NoLatestRelease.test.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/components/NoLatestRelease.test.tsx rename to plugins/github-release-manager/src/components/NoLatestRelease.test.tsx diff --git a/plugins/release-manager-as-a-service/src/components/NoLatestRelease.tsx b/plugins/github-release-manager/src/components/NoLatestRelease.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/components/NoLatestRelease.tsx rename to plugins/github-release-manager/src/components/NoLatestRelease.tsx diff --git a/plugins/release-manager-as-a-service/src/components/ProjectContext.ts b/plugins/github-release-manager/src/components/ProjectContext.ts similarity index 86% rename from plugins/release-manager-as-a-service/src/components/ProjectContext.ts rename to plugins/github-release-manager/src/components/ProjectContext.ts index 26a195b5ed..e9cf87a859 100644 --- a/plugins/release-manager-as-a-service/src/components/ProjectContext.ts +++ b/plugins/github-release-manager/src/components/ProjectContext.ts @@ -15,12 +15,10 @@ */ import { createContext, useContext } from 'react'; -import { RMaaSApiClient } from '../api/RMaaSApiClient'; +import { ApiClient } from '../api/ApiClient'; import { ReleaseManagerAsAServiceError } from '../errors/ReleaseManagerAsAServiceError'; -export const ApiClientContext = createContext( - undefined, -); +export const ApiClientContext = createContext(undefined); export const useApiClientContext = () => { const apiClient = useContext(ApiClientContext); diff --git a/plugins/release-manager-as-a-service/src/components/ReloadButton.test.tsx b/plugins/github-release-manager/src/components/ReloadButton.test.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/components/ReloadButton.test.tsx rename to plugins/github-release-manager/src/components/ReloadButton.test.tsx diff --git a/plugins/release-manager-as-a-service/src/components/ReloadButton.tsx b/plugins/github-release-manager/src/components/ReloadButton.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/components/ReloadButton.tsx rename to plugins/github-release-manager/src/components/ReloadButton.tsx diff --git a/plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepList.test.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.test.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepList.test.tsx rename to plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.test.tsx diff --git a/plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepList.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepList.tsx rename to plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx diff --git a/plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepListItem.test.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.test.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepListItem.test.tsx rename to plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.test.tsx diff --git a/plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepListItem.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx similarity index 100% rename from plugins/release-manager-as-a-service/src/components/ResponseStepList/ResponseStepListItem.tsx rename to plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx diff --git a/plugins/release-manager-as-a-service/src/constants/constants.test.ts b/plugins/github-release-manager/src/constants/constants.test.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/constants/constants.test.ts rename to plugins/github-release-manager/src/constants/constants.test.ts diff --git a/plugins/release-manager-as-a-service/src/constants/constants.ts b/plugins/github-release-manager/src/constants/constants.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/constants/constants.ts rename to plugins/github-release-manager/src/constants/constants.ts diff --git a/plugins/release-manager-as-a-service/src/errors/ReleaseManagerAsAServiceError.ts b/plugins/github-release-manager/src/errors/ReleaseManagerAsAServiceError.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/errors/ReleaseManagerAsAServiceError.ts rename to plugins/github-release-manager/src/errors/ReleaseManagerAsAServiceError.ts diff --git a/plugins/release-manager-as-a-service/src/helpers/date.test.ts b/plugins/github-release-manager/src/helpers/date.test.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/helpers/date.test.ts rename to plugins/github-release-manager/src/helpers/date.test.ts diff --git a/plugins/release-manager-as-a-service/src/helpers/date.ts b/plugins/github-release-manager/src/helpers/date.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/helpers/date.ts rename to plugins/github-release-manager/src/helpers/date.ts diff --git a/plugins/release-manager-as-a-service/src/helpers/getBumpedTag.test.ts b/plugins/github-release-manager/src/helpers/getBumpedTag.test.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/helpers/getBumpedTag.test.ts rename to plugins/github-release-manager/src/helpers/getBumpedTag.test.ts diff --git a/plugins/release-manager-as-a-service/src/helpers/getBumpedTag.ts b/plugins/github-release-manager/src/helpers/getBumpedTag.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/helpers/getBumpedTag.ts rename to plugins/github-release-manager/src/helpers/getBumpedTag.ts diff --git a/plugins/release-manager-as-a-service/src/helpers/getShortCommitHash.test.ts b/plugins/github-release-manager/src/helpers/getShortCommitHash.test.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/helpers/getShortCommitHash.test.ts rename to plugins/github-release-manager/src/helpers/getShortCommitHash.test.ts diff --git a/plugins/release-manager-as-a-service/src/helpers/getShortCommitHash.ts b/plugins/github-release-manager/src/helpers/getShortCommitHash.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/helpers/getShortCommitHash.ts rename to plugins/github-release-manager/src/helpers/getShortCommitHash.ts diff --git a/plugins/release-manager-as-a-service/src/helpers/isCalverTagParts.test.ts b/plugins/github-release-manager/src/helpers/isCalverTagParts.test.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/helpers/isCalverTagParts.test.ts rename to plugins/github-release-manager/src/helpers/isCalverTagParts.test.ts diff --git a/plugins/release-manager-as-a-service/src/helpers/isCalverTagParts.ts b/plugins/github-release-manager/src/helpers/isCalverTagParts.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/helpers/isCalverTagParts.ts rename to plugins/github-release-manager/src/helpers/isCalverTagParts.ts diff --git a/plugins/release-manager-as-a-service/src/helpers/tagParts/getCalverTagParts.ts b/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/helpers/tagParts/getCalverTagParts.ts rename to plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.ts diff --git a/plugins/release-manager-as-a-service/src/helpers/tagParts/getSemverTagParts.ts b/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/helpers/tagParts/getSemverTagParts.ts rename to plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.ts diff --git a/plugins/release-manager-as-a-service/src/helpers/tagParts/getTagParts.test.ts b/plugins/github-release-manager/src/helpers/tagParts/getTagParts.test.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/helpers/tagParts/getTagParts.test.ts rename to plugins/github-release-manager/src/helpers/tagParts/getTagParts.test.ts diff --git a/plugins/release-manager-as-a-service/src/helpers/tagParts/getTagParts.ts b/plugins/github-release-manager/src/helpers/tagParts/getTagParts.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/helpers/tagParts/getTagParts.ts rename to plugins/github-release-manager/src/helpers/tagParts/getTagParts.ts diff --git a/plugins/release-manager-as-a-service/src/index.ts b/plugins/github-release-manager/src/index.ts similarity index 91% rename from plugins/release-manager-as-a-service/src/index.ts rename to plugins/github-release-manager/src/index.ts index 3461c92d03..6768091ee9 100644 --- a/plugins/release-manager-as-a-service/src/index.ts +++ b/plugins/github-release-manager/src/index.ts @@ -14,6 +14,6 @@ * limitations under the License. */ export { - releaseManagerAsAServicePlugin, + gitHubReleaseManagerPlugin as releaseManagerAsAServicePlugin, ReleaseManagerAsAServicePage, } from './plugin'; diff --git a/plugins/release-manager-as-a-service/src/plugin.test.ts b/plugins/github-release-manager/src/plugin.test.ts similarity index 79% rename from plugins/release-manager-as-a-service/src/plugin.test.ts rename to plugins/github-release-manager/src/plugin.test.ts index 2ecbad7bc5..c952ce30fa 100644 --- a/plugins/release-manager-as-a-service/src/plugin.test.ts +++ b/plugins/github-release-manager/src/plugin.test.ts @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { releaseManagerAsAServicePlugin } from './plugin'; +import { gitHubReleaseManagerPlugin } from './plugin'; -describe('release-manager-as-a-service', () => { +describe('github-release-manager', () => { it('should export plugin', () => { - expect(releaseManagerAsAServicePlugin).toBeDefined(); + expect(gitHubReleaseManagerPlugin).toBeDefined(); }); }); diff --git a/plugins/release-manager-as-a-service/src/plugin.ts b/plugins/github-release-manager/src/plugin.ts similarity index 75% rename from plugins/release-manager-as-a-service/src/plugin.ts rename to plugins/github-release-manager/src/plugin.ts index a1ccabd20f..276691762a 100644 --- a/plugins/release-manager-as-a-service/src/plugin.ts +++ b/plugins/github-release-manager/src/plugin.ts @@ -21,18 +21,18 @@ import { createRoutableExtension, } from '@backstage/core'; -import { releaseManagerAsAServiceApiRef } from './api/serviceApiRef'; +import { githubReleaseManagerApiRef } from './api/serviceApiRef'; import { PluginApiClientConfig } from './api/PluginApiClientConfig'; import { rootRouteRef } from './routes'; -export const releaseManagerAsAServicePlugin = createPlugin({ - id: 'release-manager-as-a-service', +export const gitHubReleaseManagerPlugin = createPlugin({ + id: 'github-release-manager', routes: { root: rootRouteRef, }, apis: [ createApiFactory({ - api: releaseManagerAsAServiceApiRef, + api: githubReleaseManagerApiRef, deps: { configApi: configApiRef, githubAuthApi: githubAuthApiRef, @@ -43,12 +43,10 @@ export const releaseManagerAsAServicePlugin = createPlugin({ ], }); -export const ReleaseManagerAsAServicePage = releaseManagerAsAServicePlugin.provide( +export const ReleaseManagerAsAServicePage = gitHubReleaseManagerPlugin.provide( createRoutableExtension({ component: () => - import('./ReleaseManagerAsAService').then( - m => m.ReleaseManagerAsAService, - ), + import('./GitHubReleaseManager').then(m => m.ReleaseManagerAsAService), mountPoint: rootRouteRef, }), ); diff --git a/plugins/release-manager-as-a-service/src/routes.ts b/plugins/github-release-manager/src/routes.ts similarity index 87% rename from plugins/release-manager-as-a-service/src/routes.ts rename to plugins/github-release-manager/src/routes.ts index 6527388235..d9dd0774b9 100644 --- a/plugins/release-manager-as-a-service/src/routes.ts +++ b/plugins/github-release-manager/src/routes.ts @@ -15,6 +15,4 @@ */ import { createRouteRef } from '@backstage/core'; -export const rootRouteRef = createRouteRef({ - title: 'release-manager-as-a-service', -}); +export const rootRouteRef = createRouteRef({ title: 'github-release-manager' }); diff --git a/plugins/release-manager-as-a-service/src/setupTests.ts b/plugins/github-release-manager/src/setupTests.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/setupTests.ts rename to plugins/github-release-manager/src/setupTests.ts diff --git a/plugins/release-manager-as-a-service/src/sideEffects/getGitHubBatchInfo.ts b/plugins/github-release-manager/src/sideEffects/getGitHubBatchInfo.ts similarity index 93% rename from plugins/release-manager-as-a-service/src/sideEffects/getGitHubBatchInfo.ts rename to plugins/github-release-manager/src/sideEffects/getGitHubBatchInfo.ts index cb044f6f92..8051569772 100644 --- a/plugins/release-manager-as-a-service/src/sideEffects/getGitHubBatchInfo.ts +++ b/plugins/github-release-manager/src/sideEffects/getGitHubBatchInfo.ts @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { RMaaSApiClient } from '../api/RMaaSApiClient'; +import { ApiClient } from '../api/ApiClient'; import { getLatestRelease } from './getLatestRelease'; interface GetGitHubBatchInfo { - apiClient: RMaaSApiClient; + apiClient: ApiClient; } export const getGitHubBatchInfo = ({ diff --git a/plugins/release-manager-as-a-service/src/sideEffects/getLatestRelease.test.ts b/plugins/github-release-manager/src/sideEffects/getLatestRelease.test.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/sideEffects/getLatestRelease.test.ts rename to plugins/github-release-manager/src/sideEffects/getLatestRelease.test.ts diff --git a/plugins/release-manager-as-a-service/src/sideEffects/getLatestRelease.ts b/plugins/github-release-manager/src/sideEffects/getLatestRelease.ts similarity index 91% rename from plugins/release-manager-as-a-service/src/sideEffects/getLatestRelease.ts rename to plugins/github-release-manager/src/sideEffects/getLatestRelease.ts index 1044d510c5..5690206553 100644 --- a/plugins/release-manager-as-a-service/src/sideEffects/getLatestRelease.ts +++ b/plugins/github-release-manager/src/sideEffects/getLatestRelease.ts @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { RMaaSApiClient } from '../api/RMaaSApiClient'; +import { ApiClient } from '../api/ApiClient'; interface GetLatestRelease { - apiClient: RMaaSApiClient; + apiClient: ApiClient; } export async function getLatestRelease({ apiClient }: GetLatestRelease) { diff --git a/plugins/release-manager-as-a-service/src/styles/styles.ts b/plugins/github-release-manager/src/styles/styles.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/styles/styles.ts rename to plugins/github-release-manager/src/styles/styles.ts diff --git a/plugins/release-manager-as-a-service/src/test-helpers/test-helpers.test.ts b/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/test-helpers/test-helpers.test.ts rename to plugins/github-release-manager/src/test-helpers/test-helpers.test.ts diff --git a/plugins/release-manager-as-a-service/src/test-helpers/test-helpers.ts b/plugins/github-release-manager/src/test-helpers/test-helpers.ts similarity index 100% rename from plugins/release-manager-as-a-service/src/test-helpers/test-helpers.ts rename to plugins/github-release-manager/src/test-helpers/test-helpers.ts diff --git a/plugins/github-release-manager/src/test-helpers/test-ids.ts b/plugins/github-release-manager/src/test-helpers/test-ids.ts new file mode 100644 index 0000000000..27aef5567f --- /dev/null +++ b/plugins/github-release-manager/src/test-helpers/test-ids.ts @@ -0,0 +1,53 @@ +/* + * 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. + */ +export const TEST_IDS = { + info: { + info: 'grm--info', + infoCardPlus: 'grm--info-card-plus', + }, + createRc: { + cta: 'grm--create-rc--cta', + semverSelect: 'grm--create-rc--semver-select', + }, + promoteRc: { + mockedPromoteRcBody: 'grm-mocked-promote-rc-body', + notRcWarning: 'grm--promote-rc--not-rc-warning', + promoteRc: 'grm--promote-rc', + cta: 'grm--promote-rc-body--cta', + }, + patch: { + error: 'grm--patch-body--error', + loading: 'grm--patch-body--loading', + notPrerelease: 'grm--patch-body--not-prerelease--info', + body: 'grm--patch-body', + }, + components: { + divider: 'grm--divider', + reloadButton: 'grm--reload-button', + noLatestRelease: 'grm--no-latest-release', + circularProgress: 'grm--circular-progress', + responseStepListDialogContent: 'grm--response-step-list--dialog-content', + responseStepListItem: 'grm--response-step-list-item', + responseStepListItemIconSuccess: + 'grm--response-step-list-item--item-icon--success', + responseStepListItemIconFailure: + 'grm--response-step-list-item--item-icon--failure', + responseStepListItemIconLink: + 'grm--response-step-list-item--item-icon--link', + responseStepListItemIconDefault: + 'grm--response-step-list-item--item-icon--default', + }, +}; diff --git a/plugins/release-manager-as-a-service/src/types/types.ts b/plugins/github-release-manager/src/types/types.ts similarity index 99% rename from plugins/release-manager-as-a-service/src/types/types.ts rename to plugins/github-release-manager/src/types/types.ts index 5af069b39b..f4fadefce3 100644 --- a/plugins/release-manager-as-a-service/src/types/types.ts +++ b/plugins/github-release-manager/src/types/types.ts @@ -14,7 +14,7 @@ * limitations under the License. */ export interface Project { - /** A unique (in the context of RMaaS) project name */ + /** A unique (in the context of GitHub Release Manager) project name */ name: string; /** GitHub details */ diff --git a/plugins/release-manager-as-a-service/src/cards/info/flow.png b/plugins/release-manager-as-a-service/src/cards/info/flow.png deleted file mode 100644 index 947f9c0f35da00b84f1267fee8cd06e9c286d1e8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 77527 zcma&N1yo(l&M=I-ySqc-;O=&CIMCt_#hv0(+}&M@wZ);hyL)kWch`?T_r3D}@3+4D zu-0CC&Ynp!lVm2DB!np|N+Tl>Ab^2^A$WsQiDSk1g=6IK*eH+Axe5+C&fZx$cDm; z_LMV~uWKozi<*iShWcB9n|ug`MvO3mJc7|woB2{@AZ{wWj_z`ob+_t%mpS-6Hk!qM zH9v0WALhJF_7xlk%@2EG)4tH?vzr^7h_&Twb89PQh$mg_}6$e#SNK8O}Ki>EqHaNL2$5-A@@-@d!hY}h=!c-AhNDY z2gQtS*R4#pPV;98d1op_Lt?OV6BOxq7_bGRi)p7u3m}OjSyvrJwsN37NmsTGcu0sn zV^>Xeb#?y(ci?E88!H$VTUTUa`?ma(_A8d84+^b9XM(o^-l{qswwYt{bB^>?`v*o< zu3sVaYy%K722^Z}>YV<%vl=y#mp8l}0wZ%dzx| z*pD^X?vC@5sv{|nk_uH+{GclJAA!A@M$sl7`kGRaT`cQ0*bi6GlMbqxjFDOVy;G4T z>j!wrT`X~u42OFW5MD)hH|p2f)G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&*?=)Zd&ASh6z8QK<_|$`p}wZg!rcPxQ&K= zX)63NK-1;A+8(-m*45wN%wA_nYF)zR_UFd@{SCx}g^Q~#j&C8;ZfhikMGyLqh!GPG zFU4FT=zV;nj2ECl$$8~{Yp{jFu?>H}V8o*A*dtB3J`IsA0Y*x6@S`7xGL9;+MDo8R zfWZhb6=?1c#j-laK?K+{)#Bp0E&9B88y>+iWYm)4!D}GYhuv+Kn;z9)NoJnz#$w)C zS@Vv3Wz`Hhi22BRMdGmPL zT*UvX%bMMb1jIJaF5Bx5kYx>HjD_+CjsBZDIbbX!{(mF? Date: Tue, 13 Apr 2021 10:28:39 +0200 Subject: [PATCH 015/485] Additional renamings Signed-off-by: Erik Engervall --- ...rvice.yaml => github-release-manager.yaml} | 0 plugins/github-release-manager/dev/index.tsx | 15 ++++++----- .../src/GitHubReleaseManager.tsx | 4 ++- .../createRc/sideEffects/createRc.test.ts | 2 +- .../cards/createRc/sideEffects/createRc.ts | 4 +-- .../src/cards/patchRc/PatchBody.test.tsx | 2 +- .../src/cards/patchRc/sideEffects/patch.ts | 8 +++--- .../src/components/ProjectContext.ts | 4 +-- ...eError.ts => GitHubReleaseManagerError.ts} | 4 +-- .../src/helpers/date.test.ts | 26 ------------------- .../src/helpers/date.ts | 16 ------------ .../src/helpers/getShortCommitHash.ts | 4 +-- .../src/helpers/tagParts/getCalverTagParts.ts | 4 +-- .../src/helpers/tagParts/getSemverTagParts.ts | 4 +-- plugins/github-release-manager/src/index.ts | 5 +--- plugins/github-release-manager/src/plugin.ts | 2 +- 16 files changed, 30 insertions(+), 74 deletions(-) rename microsite/data/plugins/{release-manager-as-a-service.yaml => github-release-manager.yaml} (100%) rename plugins/github-release-manager/src/errors/{ReleaseManagerAsAServiceError.ts => GitHubReleaseManagerError.ts} (85%) delete mode 100644 plugins/github-release-manager/src/helpers/date.test.ts delete mode 100644 plugins/github-release-manager/src/helpers/date.ts diff --git a/microsite/data/plugins/release-manager-as-a-service.yaml b/microsite/data/plugins/github-release-manager.yaml similarity index 100% rename from microsite/data/plugins/release-manager-as-a-service.yaml rename to microsite/data/plugins/github-release-manager.yaml diff --git a/plugins/github-release-manager/dev/index.tsx b/plugins/github-release-manager/dev/index.tsx index ff794f428a..d525b3f55b 100644 --- a/plugins/github-release-manager/dev/index.tsx +++ b/plugins/github-release-manager/dev/index.tsx @@ -15,41 +15,42 @@ */ import React from 'react'; import { createDevApp } from '@backstage/dev-utils'; + import { gitHubReleaseManagerPlugin, - ReleaseManagerAsAServicePage, + GitHubReleaseManagerPage, } from '../src/plugin'; createDevApp() .registerPlugin(gitHubReleaseManagerPlugin) .addPage({ + title: 'Page 1', element: ( - ), - title: 'Root Page', }) .addPage({ + title: 'Page 2', element: ( - ), - title: 'Another page', }) .render(); diff --git a/plugins/github-release-manager/src/GitHubReleaseManager.tsx b/plugins/github-release-manager/src/GitHubReleaseManager.tsx index 6b89eb4439..2011fb40b0 100644 --- a/plugins/github-release-manager/src/GitHubReleaseManager.tsx +++ b/plugins/github-release-manager/src/GitHubReleaseManager.tsx @@ -114,7 +114,9 @@ function Cards({ project, components }: ReleaseManagerAsAServiceProps) { } if (gitHubBatchInfo.value === undefined) { - return Failed to fetch latest GHE release; + return ( + Failed to fetch latest GitHub release + ); } if (!gitHubBatchInfo.value.repository.permissions.push) { diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts index 26450ac162..407790f252 100644 --- a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts +++ b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts @@ -21,7 +21,7 @@ import { } from '../../../test-helpers/test-helpers'; import { createRc } from './createRc'; -describe('createGheRc', () => { +describe('createRc', () => { beforeEach(jest.clearAllMocks); it('should work', async () => { diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts index 6d45abbb0f..0a532dcb0d 100644 --- a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts +++ b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts @@ -22,7 +22,7 @@ import { ResponseStep, } from '../../../types/types'; import { ApiClient } from '../../../api/ApiClient'; -import { ReleaseManagerAsAServiceError } from '../../../errors/ReleaseManagerAsAServiceError'; +import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; interface CreateRC { apiClient: ApiClient; @@ -67,7 +67,7 @@ export async function createRc({ ).createdRef; } catch (error) { if (error.body.message === 'Reference already exists') { - throw new ReleaseManagerAsAServiceError( + throw new GitHubReleaseManagerError( `Branch "${nextGitHubInfo.rcBranch}" already exists: .../tree/${nextGitHubInfo.rcBranch}`, ); } diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx index 74f701a120..7ddc6308cf 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx @@ -37,7 +37,7 @@ describe('PatchBody', () => { it('should render error', async () => { mockApiClient.getBranch.mockImplementationOnce(() => { - throw new Error('lmao hehe'); + throw new Error('banana'); }); const { getByTestId } = render( diff --git a/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.ts b/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.ts index 6b6190e723..1d592b330b 100644 --- a/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.ts +++ b/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.ts @@ -20,7 +20,7 @@ import { ResponseStep, } from '../../../types/types'; import { CalverTagParts } from '../../../helpers/tagParts/getCalverTagParts'; -import { ReleaseManagerAsAServiceError } from '../../../errors/ReleaseManagerAsAServiceError'; +import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; import { ApiClient } from '../../../api/ApiClient'; import { SemverTagParts } from '../../../helpers/tagParts/getSemverTagParts'; @@ -33,9 +33,7 @@ interface Patch { tagParts: NonNullable; } -/** - * Inspo: https://stackoverflow.com/questions/53859199/how-to-cherry-pick-through-githubs-api - */ +// Inspo: https://stackoverflow.com/questions/53859199/how-to-cherry-pick-through-githubs-api export async function patch({ apiClient, bumpedTag, @@ -47,7 +45,7 @@ export async function patch({ const responseSteps: ResponseStep[] = []; if (!selectedPatchCommit || !selectedPatchCommit.sha) { - throw new ReleaseManagerAsAServiceError('Invalid commit'); + throw new GitHubReleaseManagerError('Invalid commit'); } const releaseBranchName = latestRelease.target_commitish; diff --git a/plugins/github-release-manager/src/components/ProjectContext.ts b/plugins/github-release-manager/src/components/ProjectContext.ts index e9cf87a859..61d41f8dc9 100644 --- a/plugins/github-release-manager/src/components/ProjectContext.ts +++ b/plugins/github-release-manager/src/components/ProjectContext.ts @@ -16,7 +16,7 @@ import { createContext, useContext } from 'react'; import { ApiClient } from '../api/ApiClient'; -import { ReleaseManagerAsAServiceError } from '../errors/ReleaseManagerAsAServiceError'; +import { GitHubReleaseManagerError } from '../errors/GitHubReleaseManagerError'; export const ApiClientContext = createContext(undefined); @@ -24,7 +24,7 @@ export const useApiClientContext = () => { const apiClient = useContext(ApiClientContext); if (!apiClient) { - throw new ReleaseManagerAsAServiceError('apiClient not found'); + throw new GitHubReleaseManagerError('apiClient not found'); } return apiClient; diff --git a/plugins/github-release-manager/src/errors/ReleaseManagerAsAServiceError.ts b/plugins/github-release-manager/src/errors/GitHubReleaseManagerError.ts similarity index 85% rename from plugins/github-release-manager/src/errors/ReleaseManagerAsAServiceError.ts rename to plugins/github-release-manager/src/errors/GitHubReleaseManagerError.ts index cd6231d229..144ad7af90 100644 --- a/plugins/github-release-manager/src/errors/ReleaseManagerAsAServiceError.ts +++ b/plugins/github-release-manager/src/errors/GitHubReleaseManagerError.ts @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export class ReleaseManagerAsAServiceError extends Error { +export class GitHubReleaseManagerError extends Error { constructor(message: string) { super(message); - this.name = 'ReleaseManagerAsAServiceError'; + this.name = 'GitHubReleaseManagerError'; } } diff --git a/plugins/github-release-manager/src/helpers/date.test.ts b/plugins/github-release-manager/src/helpers/date.test.ts deleted file mode 100644 index 06bdd31573..0000000000 --- a/plugins/github-release-manager/src/helpers/date.test.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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 { getNewDate } from './date'; - -describe('getNewDate', () => { - it('should get a date', () => { - const newDate = getNewDate(); - - expect(newDate.toISOString()).toMatch( - /[\d]{4}-[\d]{2}-[\d]{2}T[\d]{2}:[\d]{2}:[\d]{2}.[\d]{3}Z/, - ); - }); -}); diff --git a/plugins/github-release-manager/src/helpers/date.ts b/plugins/github-release-manager/src/helpers/date.ts deleted file mode 100644 index 6c9d8423b6..0000000000 --- a/plugins/github-release-manager/src/helpers/date.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* - * 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. - */ -export const getNewDate = () => new Date(); diff --git a/plugins/github-release-manager/src/helpers/getShortCommitHash.ts b/plugins/github-release-manager/src/helpers/getShortCommitHash.ts index 7abc541606..bb85703477 100644 --- a/plugins/github-release-manager/src/helpers/getShortCommitHash.ts +++ b/plugins/github-release-manager/src/helpers/getShortCommitHash.ts @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { ReleaseManagerAsAServiceError } from '../errors/ReleaseManagerAsAServiceError'; +import { GitHubReleaseManagerError } from '../errors/GitHubReleaseManagerError'; export function getShortCommitHash(hash: string) { const shortCommitHash = hash.substr(0, 7); if (shortCommitHash.length < 7) { - throw new ReleaseManagerAsAServiceError( + throw new GitHubReleaseManagerError( 'Invalid shortCommitHash: less than 7 characters', ); } diff --git a/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.ts b/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.ts index c6169ac7f5..c76ef92a85 100644 --- a/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.ts +++ b/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { ReleaseManagerAsAServiceError } from '../../errors/ReleaseManagerAsAServiceError'; +import { GitHubReleaseManagerError } from '../../errors/GitHubReleaseManagerError'; export type CalverTagParts = { prefix: string; @@ -27,7 +27,7 @@ export function getCalverTagParts(tag: string) { ); if (result === null || result.length < 4) { - throw new ReleaseManagerAsAServiceError('Invalid calver tag'); + throw new GitHubReleaseManagerError('Invalid calver tag'); } const tagParts: CalverTagParts = { diff --git a/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.ts b/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.ts index 8b2ae2873b..f6a97908e2 100644 --- a/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.ts +++ b/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { ReleaseManagerAsAServiceError } from '../../errors/ReleaseManagerAsAServiceError'; +import { GitHubReleaseManagerError } from '../../errors/GitHubReleaseManagerError'; export type SemverTagParts = { prefix: string; @@ -26,7 +26,7 @@ export function getSemverTagParts(tag: string) { const result = tag.match(/(rc|version)-([0-9]+)\.([0-9]+)\.([0-9]+)/); if (result === null || result.length < 4) { - throw new ReleaseManagerAsAServiceError('Invalid semver tag'); + throw new GitHubReleaseManagerError('Invalid semver tag'); } const tagParts: SemverTagParts = { diff --git a/plugins/github-release-manager/src/index.ts b/plugins/github-release-manager/src/index.ts index 6768091ee9..c4177089eb 100644 --- a/plugins/github-release-manager/src/index.ts +++ b/plugins/github-release-manager/src/index.ts @@ -13,7 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export { - gitHubReleaseManagerPlugin as releaseManagerAsAServicePlugin, - ReleaseManagerAsAServicePage, -} from './plugin'; +export { gitHubReleaseManagerPlugin, GitHubReleaseManagerPage } from './plugin'; diff --git a/plugins/github-release-manager/src/plugin.ts b/plugins/github-release-manager/src/plugin.ts index 276691762a..252b0c6674 100644 --- a/plugins/github-release-manager/src/plugin.ts +++ b/plugins/github-release-manager/src/plugin.ts @@ -43,7 +43,7 @@ export const gitHubReleaseManagerPlugin = createPlugin({ ], }); -export const ReleaseManagerAsAServicePage = gitHubReleaseManagerPlugin.provide( +export const GitHubReleaseManagerPage = gitHubReleaseManagerPlugin.provide( createRoutableExtension({ component: () => import('./GitHubReleaseManager').then(m => m.ReleaseManagerAsAService), From c98ffab90107de8322302af96d9d68a915af07be Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Tue, 13 Apr 2021 10:32:27 +0200 Subject: [PATCH 016/485] Fix broken link in dev README Signed-off-by: Erik Engervall --- plugins/github-release-manager/dev/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/github-release-manager/dev/README.md b/plugins/github-release-manager/dev/README.md index 736d20766e..52a8c8656b 100644 --- a/plugins/github-release-manager/dev/README.md +++ b/plugins/github-release-manager/dev/README.md @@ -10,4 +10,4 @@ Your plugin has been added to the example app in this repository, meaning you'll You can also serve the plugin in isolation by running `yarn start` in the plugin directory. This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads. -It is only meant for local development, and the setup for it can be found inside the [/dev](./dev) directory. +It is only meant for local development, and the setup for it can be found inside the `/dev` directory. From 5300b2a3fa41670f98be0ddf483669460d59c991 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Tue, 13 Apr 2021 10:56:58 +0200 Subject: [PATCH 017/485] Renaming related fixes Signed-off-by: Erik Engervall --- packages/app/src/plugins.ts | 2 +- plugins/github-release-manager/README.md | 2 +- .../github-release-manager/src/GitHubReleaseManager.tsx | 8 ++++---- plugins/github-release-manager/src/plugin.ts | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/app/src/plugins.ts b/packages/app/src/plugins.ts index 744456bfaa..4099061428 100644 --- a/packages/app/src/plugins.ts +++ b/packages/app/src/plugins.ts @@ -46,4 +46,4 @@ export { plugin as Kafka } from '@backstage/plugin-kafka'; export { todoPlugin } from '@backstage/plugin-todo'; export { badgesPlugin } from '@backstage/plugin-badges'; export { githubDeploymentsPlugin } from '@backstage/plugin-github-deployments'; -export { releaseManagerAsAServicePlugin } from '@backstage/plugin-github-release-manager'; +export { gitHubReleaseManagerPlugin } from '@backstage/plugin-github-release-manager'; diff --git a/plugins/github-release-manager/README.md b/plugins/github-release-manager/README.md index 3411c51000..273e81b252 100644 --- a/plugins/github-release-manager/README.md +++ b/plugins/github-release-manager/README.md @@ -46,4 +46,4 @@ Looking at the flow above, a common release lifecycle could be: ## Usage -The plugin exports a single full-page extension `ReleaseManagerAsAServicePage`, which one can add to an app like a usual top-level tool on a dedicated route. +The plugin exports a single full-page extension `GitHubReleaseManagerPage`, which one can add to an app like a usual top-level tool on a dedicated route. diff --git a/plugins/github-release-manager/src/GitHubReleaseManager.tsx b/plugins/github-release-manager/src/GitHubReleaseManager.tsx index 2011fb40b0..78f7b14b69 100644 --- a/plugins/github-release-manager/src/GitHubReleaseManager.tsx +++ b/plugins/github-release-manager/src/GitHubReleaseManager.tsx @@ -41,7 +41,7 @@ import { } from './components/ProjectContext'; import { ApiClient } from './api/ApiClient'; -interface ReleaseManagerAsAServiceProps { +interface GitHubReleaseManagerProps { project: Project; components?: { default?: { @@ -71,10 +71,10 @@ const useStyles = makeStyles(() => ({ }, })); -export function ReleaseManagerAsAService({ +export function GitHubReleaseManager({ project, components, -}: ReleaseManagerAsAServiceProps) { +}: GitHubReleaseManagerProps) { const pluginApiClient = useApi(githubReleaseManagerApiRef); const apiClient = new ApiClient({ pluginApiClient, @@ -93,7 +93,7 @@ export function ReleaseManagerAsAService({ ); } -function Cards({ project, components }: ReleaseManagerAsAServiceProps) { +function Cards({ project, components }: GitHubReleaseManagerProps) { const apiClient = useApiClientContext(); const [refetch, setRefetch] = useState(0); const gitHubBatchInfo = useAsync(getGitHubBatchInfo({ apiClient }), [ diff --git a/plugins/github-release-manager/src/plugin.ts b/plugins/github-release-manager/src/plugin.ts index 252b0c6674..5f40d4581e 100644 --- a/plugins/github-release-manager/src/plugin.ts +++ b/plugins/github-release-manager/src/plugin.ts @@ -46,7 +46,7 @@ export const gitHubReleaseManagerPlugin = createPlugin({ export const GitHubReleaseManagerPage = gitHubReleaseManagerPlugin.provide( createRoutableExtension({ component: () => - import('./GitHubReleaseManager').then(m => m.ReleaseManagerAsAService), + import('./GitHubReleaseManager').then(m => m.GitHubReleaseManager), mountPoint: rootRouteRef, }), ); From e48f59a90b8ebf13c24a683dd174e6aa02ec1e63 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Tue, 13 Apr 2021 11:46:17 +0200 Subject: [PATCH 018/485] Upgrade required packages in plugin Signed-off-by: Erik Engervall --- plugins/github-release-manager/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/github-release-manager/package.json b/plugins/github-release-manager/package.json index 230a1c4bb4..5eebc11105 100644 --- a/plugins/github-release-manager/package.json +++ b/plugins/github-release-manager/package.json @@ -20,7 +20,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.7.3", + "@backstage/core": "^0.7.4", "@backstage/integration": "^0.5.1", "@backstage/theme": "^0.2.5", "@material-ui/core": "^4.11.0", @@ -34,9 +34,9 @@ "react": "^16.13.1" }, "devDependencies": { - "@backstage/cli": "^0.6.6", + "@backstage/cli": "^0.6.7", "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.9", + "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^12.0.7", From c003e06cc004cc085153112af6240a30e7d73200 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Wed, 14 Apr 2021 11:30:21 +0200 Subject: [PATCH 019/485] Address latest batch of comments Signed-off-by: Erik Engervall --- plugins/github-release-manager/README.md | 4 ++-- .../github-release-manager/src/api/ApiClient.ts | 4 ++++ .../src/api/PluginApiClientConfig.ts | 10 ++++++++-- .../src/cards/createRc/sideEffects/createRc.ts | 2 +- .../src/cards/info/Info.tsx | 6 +++--- .../src/cards/patchRc/PatchBody.tsx | 9 +++++---- .../ResponseStepList/ResponseStepList.tsx | 15 +++++++++------ .../ResponseStepList/ResponseStepListItem.tsx | 6 +++--- 8 files changed, 35 insertions(+), 21 deletions(-) diff --git a/plugins/github-release-manager/README.md b/plugins/github-release-manager/README.md index 273e81b252..331d04bafa 100644 --- a/plugins/github-release-manager/README.md +++ b/plugins/github-release-manager/README.md @@ -6,13 +6,13 @@ Does it build and ship your code? **No**. -What `GRM` does is manage your **[releases](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/managing-releases-in-a-repository)** on GitHub, building and shipping is entirely up to you as a developer to handle in your CI. +What `GRM` does is manage your **[releases](https://docs.github.com/en/github/administering-a-repository/managing-releases-in-a-repository)** on GitHub, building and shipping is entirely up to you as a developer to handle in your CI. `GRM` is built with industry standards in mind and the flow is as follows: ![](./src/cards/info/flow.png) -> **GitHub**: The source control system where releases reside in a practical sense. Read more about GitHub releases [here](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/. Note that this plugin works just as well with GitHub Enterprise) +> **GitHub**: The source control system where releases reside in a practical sense. Read more about [GitHub releases](https://docs.github.com/en/github/administering-a-repository/managing-releases-in-a-repository). Note that this plugin works just as well with GitHub Enterprise) > > **Release Candidate (RC)**: A GitHub pre-release intended primarily for internal testing > diff --git a/plugins/github-release-manager/src/api/ApiClient.ts b/plugins/github-release-manager/src/api/ApiClient.ts index a3c1ce35e5..dcb9ba2288 100644 --- a/plugins/github-release-manager/src/api/ApiClient.ts +++ b/plugins/github-release-manager/src/api/ApiClient.ts @@ -54,6 +54,10 @@ export class ApiClient { this.githubCommonPath = `/repos/${this.repoPath}`; } + public getHost() { + return this.pluginApiClient.host; + } + public getRepoPath() { return this.repoPath; } diff --git a/plugins/github-release-manager/src/api/PluginApiClientConfig.ts b/plugins/github-release-manager/src/api/PluginApiClientConfig.ts index 430b005b92..f06f25998c 100644 --- a/plugins/github-release-manager/src/api/PluginApiClientConfig.ts +++ b/plugins/github-release-manager/src/api/PluginApiClientConfig.ts @@ -19,7 +19,8 @@ import { readGitHubIntegrationConfigs } from '@backstage/integration'; export class PluginApiClientConfig { private readonly githubAuthApi: OAuthApi; - readonly baseUrl: string; + private readonly baseUrl: string; + readonly host: string; constructor({ configApi, @@ -33,7 +34,12 @@ export class PluginApiClientConfig { const configs = readGitHubIntegrationConfigs( configApi.getOptionalConfigArray('integrations.github') ?? [], ); - const githubIntegrationConfig = configs.find(v => v.host === 'github.com'); + + const githubIntegrationConfig = configs.find( + v => v.host === 'github.com' || v.host.startsWith('ghe.'), + ); + + this.host = githubIntegrationConfig?.host ?? 'github.com'; this.baseUrl = githubIntegrationConfig?.apiBaseUrl ?? 'https://api.github.com'; } diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts index 0a532dcb0d..11f93aedf1 100644 --- a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts +++ b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts @@ -99,7 +99,7 @@ export async function createRc({ `; responseSteps.push({ - message: 'Fetched commit comparision', + message: 'Fetched commit comparison', secondaryMessage: `${previousReleaseBranch}...${nextReleaseBranch}`, link: comparison.html_url, }); diff --git a/plugins/github-release-manager/src/cards/info/Info.tsx b/plugins/github-release-manager/src/cards/info/Info.tsx index 6b371ea873..d05d16bf85 100644 --- a/plugins/github-release-manager/src/cards/info/Info.tsx +++ b/plugins/github-release-manager/src/cards/info/Info.tsx @@ -47,12 +47,12 @@ export const Info = ({ GitHub: The source control system where releases - reside in a practical sense. Read more about GitHub releases{' '} + reside in a practical sense. Read more about{' '} - here + GitHub releases . Note that this plugin works just as well with GitHub Enterprise (GHE) diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx index 6d15bc6a08..80b53bb208 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx @@ -16,8 +16,6 @@ import React, { useState } from 'react'; import { Alert, AlertTitle } from '@material-ui/lab'; import { useAsync, useAsyncFn } from 'react-use'; -import FileCopyIcon from '@material-ui/icons/FileCopy'; -import Paper from '@material-ui/core/Paper'; import { Button, Checkbox, @@ -29,8 +27,10 @@ import { ListItemIcon, ListItemSecondaryAction, ListItemText, + Paper, Typography, } from '@material-ui/core'; +import FileCopyIcon from '@material-ui/icons/FileCopy'; import OpenInNewIcon from '@material-ui/icons/OpenInNew'; import { Differ } from '../../components/Differ'; @@ -229,12 +229,13 @@ export const PatchBody = ({ { const repoPath = apiClient.getRepoPath(); + const host = apiClient.getHost(); const newTab = window.open( - `https://github.com/${repoPath}/compare/${releaseBranch?.name}...${commit.sha}`, + `https://${host}/${repoPath}/compare/${releaseBranch?.name}...${commit.sha}`, '_blank', ); newTab?.focus(); diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx index e4a3d78308..239e642884 100644 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx @@ -14,12 +14,15 @@ * limitations under the License. */ import React, { PropsWithChildren } from 'react'; -import { List, CircularProgress } from '@material-ui/core'; -import Button from '@material-ui/core/Button'; -import Dialog from '@material-ui/core/Dialog'; -import DialogActions from '@material-ui/core/DialogActions'; -import DialogContent from '@material-ui/core/DialogContent'; -import DialogTitle from '@material-ui/core/DialogTitle'; +import { + List, + CircularProgress, + Button, + Dialog, + DialogActions, + DialogContent, + DialogTitle, +} from '@material-ui/core'; import { ResponseStep, SetRefetch } from '../../types/types'; import { TEST_IDS } from '../../test-helpers/test-ids'; diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx index fd139dae89..21486ed87f 100644 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx @@ -14,8 +14,8 @@ * limitations under the License. */ import React, { useEffect, useState } from 'react'; -import { green, red } from '@material-ui/core/colors'; import { + colors, IconButton, ListItem, ListItemIcon, @@ -78,7 +78,7 @@ export const ResponseStepListItem = ({ return ( ); } @@ -87,7 +87,7 @@ export const ResponseStepListItem = ({ return ( ); } From 9f2def6e0dc9ae1a89f49de2eb7e5aac8d71a070 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Wed, 14 Apr 2021 13:45:33 +0200 Subject: [PATCH 020/485] Fix snapshots for copy update Signed-off-by: Erik Engervall --- .../src/cards/createRc/sideEffects/createRc.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts index 407790f252..c50ab0a830 100644 --- a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts +++ b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts @@ -45,7 +45,7 @@ describe('createRc', () => { }, Object { "link": "mock_compareCommits_html_url", - "message": "Fetched commit comparision", + "message": "Fetched commit comparison", "secondaryMessage": "rc/1.2.3...rc/1.2.3", }, Object { From ef60f6be08cfb2d46791a0e7e0c0e2428800bc48 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Wed, 14 Apr 2021 16:07:48 +0200 Subject: [PATCH 021/485] Merge PluginApiClientConfig and ApiClient into PluginApiClient Signed-off-by: Erik Engervall --- packages/app/src/apis.ts | 11 ++ plugins/github-release-manager/dev/index.tsx | 1 + .../src/GitHubReleaseManager.tsx | 23 ++- .../api/{ApiClient.ts => PluginApiClient.ts} | 150 +++++++++++------- .../src/api/PluginApiClientConfig.ts | 57 ------- .../src/api/serviceApiRef.ts | 5 +- .../src/cards/createRc/CreateRc.test.tsx | 3 +- .../src/cards/createRc/CreateRc.tsx | 7 +- .../cards/createRc/getRcGitHubInfo.test.ts | 1 + .../src/cards/createRc/getRcGitHubInfo.ts | 1 + .../createRc/sideEffects/createRc.test.ts | 3 +- .../cards/createRc/sideEffects/createRc.ts | 17 +- .../src/cards/info/Info.test.tsx | 1 + .../src/cards/info/Info.tsx | 1 + .../src/cards/patchRc/Patch.test.tsx | 1 + .../src/cards/patchRc/Patch.tsx | 1 + .../src/cards/patchRc/PatchBody.test.tsx | 3 +- .../src/cards/patchRc/PatchBody.tsx | 17 +- .../cards/patchRc/sideEffects/patch.test.ts | 3 +- .../src/cards/patchRc/sideEffects/patch.ts | 39 +++-- .../src/cards/promoteRc/PromoteRc.test.tsx | 1 + .../src/cards/promoteRc/PromoteRc.tsx | 1 + .../cards/promoteRc/PromoteRcBody.test.tsx | 3 +- .../src/cards/promoteRc/PromoteRcBody.tsx | 12 +- .../promoteRc/sideEffects/promoteRc.test.ts | 3 +- .../cards/promoteRc/sideEffects/promoteRc.ts | 9 +- .../src/components/Differ.tsx | 1 + .../src/components/Divider.test.tsx | 1 + .../src/components/Divider.tsx | 1 + .../src/components/InfoCardPlus.test.tsx | 1 + .../src/components/InfoCardPlus.tsx | 1 + .../src/components/NoLatestRelease.test.tsx | 1 + .../src/components/NoLatestRelease.tsx | 1 + .../src/components/ProjectContext.ts | 17 +- .../src/components/ReloadButton.test.tsx | 1 + .../src/components/ReloadButton.tsx | 1 + .../ResponseStepList.test.tsx | 1 + .../ResponseStepList/ResponseStepList.tsx | 1 + .../ResponseStepListItem.test.tsx | 1 + .../ResponseStepList/ResponseStepListItem.tsx | 1 + .../src/constants/constants.test.ts | 1 + .../src/constants/constants.ts | 1 + .../src/errors/GitHubReleaseManagerError.ts | 1 + .../src/helpers/getBumpedTag.test.ts | 1 + .../src/helpers/getBumpedTag.ts | 1 + .../src/helpers/getShortCommitHash.test.ts | 1 + .../src/helpers/getShortCommitHash.ts | 1 + .../src/helpers/isCalverTagParts.test.ts | 1 + .../src/helpers/isCalverTagParts.ts | 1 + .../src/helpers/tagParts/getCalverTagParts.ts | 1 + .../src/helpers/tagParts/getSemverTagParts.ts | 1 + .../src/helpers/tagParts/getTagParts.test.ts | 1 + .../src/helpers/tagParts/getTagParts.ts | 1 + plugins/github-release-manager/src/index.ts | 7 +- .../github-release-manager/src/plugin.test.ts | 1 + plugins/github-release-manager/src/plugin.ts | 10 +- plugins/github-release-manager/src/routes.ts | 5 +- .../github-release-manager/src/setupTests.ts | 1 + .../src/sideEffects/getGitHubBatchInfo.ts | 13 +- .../src/sideEffects/getLatestRelease.test.ts | 5 +- .../src/sideEffects/getLatestRelease.ts | 11 +- .../src/styles/styles.ts | 1 + .../src/test-helpers/test-helpers.test.ts | 1 + .../src/test-helpers/test-helpers.ts | 1 + .../src/test-helpers/test-ids.ts | 1 + .../github-release-manager/src/types/types.ts | 1 + 66 files changed, 277 insertions(+), 198 deletions(-) rename plugins/github-release-manager/src/api/{ApiClient.ts => PluginApiClient.ts} (67%) delete mode 100644 plugins/github-release-manager/src/api/PluginApiClientConfig.ts diff --git a/packages/app/src/apis.ts b/packages/app/src/apis.ts index ccc576e727..beea444a6c 100644 --- a/packages/app/src/apis.ts +++ b/packages/app/src/apis.ts @@ -33,6 +33,7 @@ import { graphQlBrowseApiRef, GraphQLEndpoints, } from '@backstage/plugin-graphiql'; +// import { githubReleaseManagerApiRef } from '@backstage/plugin-github-release-manager'; export const apis: AnyApiFactory[] = [ createApiFactory({ @@ -41,6 +42,16 @@ export const apis: AnyApiFactory[] = [ factory: ({ configApi }) => ScmIntegrationsApi.fromConfig(configApi), }), + // createApiFactory({ + // api: githubReleaseManagerApiRef, + // deps: { githubAuthApi: githubAuthApiRef }, + // factory: ({ githubAuthApi }) => { + // return { + + // } + // }, + // }), + createApiFactory({ api: graphQlBrowseApiRef, deps: { errorApi: errorApiRef, githubAuthApi: githubAuthApiRef }, diff --git a/plugins/github-release-manager/dev/index.tsx b/plugins/github-release-manager/dev/index.tsx index d525b3f55b..b3d343382f 100644 --- a/plugins/github-release-manager/dev/index.tsx +++ b/plugins/github-release-manager/dev/index.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { createDevApp } from '@backstage/dev-utils'; diff --git a/plugins/github-release-manager/src/GitHubReleaseManager.tsx b/plugins/github-release-manager/src/GitHubReleaseManager.tsx index 78f7b14b69..82396438f0 100644 --- a/plugins/github-release-manager/src/GitHubReleaseManager.tsx +++ b/plugins/github-release-manager/src/GitHubReleaseManager.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { Alert } from '@material-ui/lab'; import { CircularProgress, makeStyles } from '@material-ui/core'; import { useAsync } from 'react-use'; @@ -36,10 +37,9 @@ import { import { PromoteRc } from './cards/promoteRc/PromoteRc'; import { githubReleaseManagerApiRef } from './api/serviceApiRef'; import { - ApiClientContext, - useApiClientContext, + PluginApiClientContext, + usePluginApiClientContext, } from './components/ProjectContext'; -import { ApiClient } from './api/ApiClient'; interface GitHubReleaseManagerProps { project: Project; @@ -76,30 +76,29 @@ export function GitHubReleaseManager({ components, }: GitHubReleaseManagerProps) { const pluginApiClient = useApi(githubReleaseManagerApiRef); - const apiClient = new ApiClient({ - pluginApiClient, + pluginApiClient.setRepoPath({ repoPath: `${project.github.org}/${project.github.repo}`, }); const classes = useStyles(); return ( - +
-
+ ); } function Cards({ project, components }: GitHubReleaseManagerProps) { - const apiClient = useApiClientContext(); + const pluginApiClient = usePluginApiClientContext(); const [refetch, setRefetch] = useState(0); - const gitHubBatchInfo = useAsync(getGitHubBatchInfo({ apiClient }), [ - project, - refetch, - ]); + const gitHubBatchInfo = useAsync( + getGitHubBatchInfo({ pluginApiClient: pluginApiClient }), + [project, refetch], + ); if (gitHubBatchInfo.error) { return {gitHubBatchInfo.error.message}; diff --git a/plugins/github-release-manager/src/api/ApiClient.ts b/plugins/github-release-manager/src/api/PluginApiClient.ts similarity index 67% rename from plugins/github-release-manager/src/api/ApiClient.ts rename to plugins/github-release-manager/src/api/PluginApiClient.ts index dcb9ba2288..c2bf8547d4 100644 --- a/plugins/github-release-manager/src/api/ApiClient.ts +++ b/plugins/github-release-manager/src/api/PluginApiClient.ts @@ -13,6 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +import { ConfigApi, OAuthApi } from '@backstage/core'; +import { Octokit } from '@octokit/rest'; +import { readGitHubIntegrationConfigs } from '@backstage/integration'; + import { GhCompareCommitsResponse, GhCreateCommitResponse, @@ -29,88 +34,123 @@ import { } from '../types/types'; import { CalverTagParts } from '../helpers/tagParts/getCalverTagParts'; import { getRcGitHubInfo } from '../cards/createRc/getRcGitHubInfo'; -import { PluginApiClientConfig } from './PluginApiClientConfig'; import { SemverTagParts } from '../helpers/tagParts/getSemverTagParts'; +import { GitHubReleaseManagerError } from '../errors/GitHubReleaseManagerError'; -/** - * Docs - * https://github.com/octokit/request.js/#the-data-parameter--set-request-body-directly - */ - -export class ApiClient { - private readonly pluginApiClient: PluginApiClientConfig; - private readonly repoPath: string; - private readonly githubCommonPath: string; +export class PluginApiClient { + private readonly githubAuthApi: OAuthApi; + private readonly baseUrl: string; + private repoPath?: string; + readonly host: string; constructor({ - pluginApiClient, - repoPath, + configApi, + githubAuthApi, }: { - pluginApiClient: PluginApiClientConfig; - repoPath: string; + configApi: ConfigApi; + githubAuthApi: OAuthApi; }) { - this.pluginApiClient = pluginApiClient; - this.repoPath = repoPath; - this.githubCommonPath = `/repos/${this.repoPath}`; + this.githubAuthApi = githubAuthApi; + + const githubIntegrationConfig = this.getGithubIntegrationConfig({ + configApi, + }); + + this.host = githubIntegrationConfig?.host ?? 'github.com'; + this.baseUrl = + githubIntegrationConfig?.apiBaseUrl ?? 'https://api.github.com'; + } + + private getGithubIntegrationConfig({ configApi }: { configApi: ConfigApi }) { + const configs = readGitHubIntegrationConfigs( + configApi.getOptionalConfigArray('integrations.github') ?? [], + ); + + const githubIntegrationConfig = configs.find( + v => v.host === 'github.com' || v.host.startsWith('ghe.'), + ); + + return githubIntegrationConfig; + } + + private async getOctokit() { + const token = await this.githubAuthApi.getAccessToken(['repo']); + + return { + octokit: new Octokit({ + auth: token, + baseUrl: this.baseUrl, + }), + }; } public getHost() { - return this.pluginApiClient.host; + return this.host; + } + + public setRepoPath({ repoPath }: { repoPath: string }) { + this.repoPath = repoPath; } public getRepoPath() { + if (!this.repoPath) { + throw new GitHubReleaseManagerError('Could not find repoPath'); + } + return this.repoPath; } async getRecentCommits({ releaseBranchName, }: { releaseBranchName?: string } = {}) { - const { octokit } = await this.pluginApiClient.getOctokit(); + const { octokit } = await this.getOctokit(); const sha = releaseBranchName ? `?sha=${releaseBranchName}` : ''; const recentCommits: GhGetCommitResponse[] = ( - await octokit.request(`${this.githubCommonPath}/commits${sha}`) + await octokit.request(`/repos/${this.getRepoPath()}/commits${sha}`) ).data; return { recentCommits }; } async getReleases() { - const { octokit } = await this.pluginApiClient.getOctokit(); + const { octokit } = await this.getOctokit(); const releases: GhGetReleaseResponse[] = ( - await octokit.request(`${this.githubCommonPath}/releases`) + await octokit.request(`/repos/${this.getRepoPath()}/releases`) ).data; return { releases }; } async getRelease({ releaseId }: { releaseId: number }) { - const { octokit } = await this.pluginApiClient.getOctokit(); + const { octokit } = await this.getOctokit(); const latestRelease: GhGetReleaseResponse = ( - await octokit.request(`${this.githubCommonPath}/releases/${releaseId}`) + await octokit.request( + `/repos/${this.getRepoPath()}/releases/${releaseId}`, + ) ).data; return { latestRelease }; } async getRepository() { - const { octokit } = await this.pluginApiClient.getOctokit(); + const { octokit } = await this.getOctokit(); const repository: GhGetRepositoryResponse = ( - await octokit.request(this.githubCommonPath) + await octokit.request(`/repos/${this.getRepoPath()}`) ).data; return { repository }; } async getLatestCommit({ defaultBranch }: { defaultBranch: string }) { - const { octokit } = await this.pluginApiClient.getOctokit(); + const { octokit } = await this.getOctokit(); const latestCommit: GhGetCommitResponse = ( await octokit.request( - `${this.githubCommonPath}/commits/refs/heads/${defaultBranch}`, + `/repos/${this.getRepoPath()}/commits/refs/heads/${defaultBranch}`, ) ).data; @@ -118,10 +158,12 @@ export class ApiClient { } async getBranch({ branchName }: { branchName: string }) { - const { octokit } = await this.pluginApiClient.getOctokit(); + const { octokit } = await this.getOctokit(); const branch: GhGetBranchResponse = ( - await octokit.request(`${this.githubCommonPath}/branches/${branchName}`) + await octokit.request( + `/repos/${this.getRepoPath()}/branches/${branchName}`, + ) ).data; return { branch }; @@ -135,10 +177,10 @@ export class ApiClient { mostRecentSha: string; targetBranch: string; }) => { - const { octokit } = await this.pluginApiClient.getOctokit(); + const { octokit } = await this.getOctokit(); const createdRef: GhCreateReferenceResponse = ( - await octokit.request(`${this.githubCommonPath}/git/refs`, { + await octokit.request(`/repos/${this.getRepoPath()}/git/refs`, { method: 'POST', data: { ref: `refs/heads/${targetBranch}`, @@ -157,11 +199,11 @@ export class ApiClient { previousReleaseBranch: string; nextReleaseBranch: string; }) => { - const { octokit } = await this.pluginApiClient.getOctokit(); + const { octokit } = await this.getOctokit(); const comparison: GhCompareCommitsResponse = ( await octokit.request( - `${this.githubCommonPath}/compare/${previousReleaseBranch}...${nextReleaseBranch}`, + `/repos/${this.getRepoPath()}/compare/${previousReleaseBranch}...${nextReleaseBranch}`, ) ).data; @@ -175,10 +217,10 @@ export class ApiClient { nextGitHubInfo: ReturnType; releaseBody: string; }) => { - const { octokit } = await this.pluginApiClient.getOctokit(); + const { octokit } = await this.getOctokit(); const createReleaseResponse: GhCreateReleaseResponse = ( - await octokit.request(`${this.githubCommonPath}/releases`, { + await octokit.request(`/repos/${this.getRepoPath()}/releases`, { method: 'POST', data: { tag_name: nextGitHubInfo.rcReleaseTag, @@ -204,10 +246,10 @@ export class ApiClient { releaseBranchTree: string; selectedPatchCommit: GhGetCommitResponse; }) => { - const { octokit } = await this.pluginApiClient.getOctokit(); + const { octokit } = await this.getOctokit(); const tempCommit: GhCreateCommitResponse = ( - await octokit.request(`${this.githubCommonPath}/git/commits`, { + await octokit.request(`/repos/${this.getRepoPath()}/git/commits`, { method: 'POST', data: { message: `Temporary commit for patch ${tagParts.patch}`, @@ -227,10 +269,10 @@ export class ApiClient { releaseBranchName: string; tempCommit: GhCreateCommitResponse; }) => { - const { octokit } = await this.pluginApiClient.getOctokit(); + const { octokit } = await this.getOctokit(); await octokit.request( - `${this.githubCommonPath}/git/refs/heads/${releaseBranchName}`, + `/repos/${this.getRepoPath()}/git/refs/heads/${releaseBranchName}`, { method: 'PATCH', data: { @@ -242,10 +284,10 @@ export class ApiClient { }, merge: async ({ base, head }: { base: string; head: string }) => { - const { octokit } = await this.pluginApiClient.getOctokit(); + const { octokit } = await this.getOctokit(); const merge: GhMergeResponse = ( - await octokit.request(`${this.githubCommonPath}/merges`, { + await octokit.request(`/repos/${this.getRepoPath()}/merges`, { method: 'POST', data: { base, head }, }) @@ -265,10 +307,10 @@ export class ApiClient { mergeTree: string; releaseBranchSha: string; }) => { - const { octokit } = await this.pluginApiClient.getOctokit(); + const { octokit } = await this.getOctokit(); const cherryPickCommit: GhCreateCommitResponse = ( - await octokit.request(`${this.githubCommonPath}/git/commits`, { + await octokit.request(`/repos/${this.getRepoPath()}/git/commits`, { method: 'POST', data: { message: `[patch ${bumpedTag}] ${selectedPatchCommit.commit.message}`, @@ -288,11 +330,11 @@ export class ApiClient { releaseBranchName: string; cherryPickCommit: GhCreateCommitResponse; }) => { - const { octokit } = await this.pluginApiClient.getOctokit(); + const { octokit } = await this.getOctokit(); const updatedReference: GhUpdateReferenceResponse = ( await octokit.request( - `${this.githubCommonPath}/git/refs/heads/${releaseBranchName}`, + `/repos/${this.getRepoPath()}/git/refs/heads/${releaseBranchName}`, { method: 'PATCH', data: { @@ -313,10 +355,10 @@ export class ApiClient { bumpedTag: string; updatedReference: GhUpdateReferenceResponse; }) => { - const { octokit } = await this.pluginApiClient.getOctokit(); + const { octokit } = await this.getOctokit(); const tagObjectResponse: GhCreateTagObjectResponse = ( - await octokit.request(`${this.githubCommonPath}/git/tags`, { + await octokit.request(`/repos/${this.getRepoPath()}/git/tags`, { method: 'POST', data: { type: 'commit', @@ -338,10 +380,10 @@ export class ApiClient { bumpedTag: string; tagObjectResponse: GhCreateTagObjectResponse; }) => { - const { octokit } = await this.pluginApiClient.getOctokit(); + const { octokit } = await this.getOctokit(); const reference: GhCreateReferenceResponse = ( - await octokit.request(`${this.githubCommonPath}/git/refs`, { + await octokit.request(`/repos/${this.getRepoPath()}/git/refs`, { method: 'POST', data: { ref: `refs/tags/${bumpedTag}`, @@ -364,11 +406,11 @@ export class ApiClient { tagParts: SemverTagParts | CalverTagParts; selectedPatchCommit: GhGetCommitResponse; }) => { - const { octokit } = await this.pluginApiClient.getOctokit(); + const { octokit } = await this.getOctokit(); const release: GhUpdateReleaseResponse = ( await octokit.request( - `${this.githubCommonPath}/releases/${latestRelease.id}`, + `/repos/${this.getRepoPath()}/releases/${latestRelease.id}`, { method: 'PATCH', data: { @@ -395,11 +437,11 @@ export class ApiClient { releaseId: GhGetReleaseResponse['id']; releaseVersion: string; }) => { - const { octokit } = await this.pluginApiClient.getOctokit(); + const { octokit } = await this.getOctokit(); const release: GhGetReleaseResponse = ( await octokit.request( - `${this.githubCommonPath}/releases/${releaseId}`, + `/repos/${this.getRepoPath()}/releases/${releaseId}`, { method: 'PATCH', data: { diff --git a/plugins/github-release-manager/src/api/PluginApiClientConfig.ts b/plugins/github-release-manager/src/api/PluginApiClientConfig.ts deleted file mode 100644 index f06f25998c..0000000000 --- a/plugins/github-release-manager/src/api/PluginApiClientConfig.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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 { ConfigApi, OAuthApi } from '@backstage/core'; -import { Octokit } from '@octokit/rest'; -import { readGitHubIntegrationConfigs } from '@backstage/integration'; - -export class PluginApiClientConfig { - private readonly githubAuthApi: OAuthApi; - private readonly baseUrl: string; - readonly host: string; - - constructor({ - configApi, - githubAuthApi, - }: { - configApi: ConfigApi; - githubAuthApi: OAuthApi; - }) { - this.githubAuthApi = githubAuthApi; - - const configs = readGitHubIntegrationConfigs( - configApi.getOptionalConfigArray('integrations.github') ?? [], - ); - - const githubIntegrationConfig = configs.find( - v => v.host === 'github.com' || v.host.startsWith('ghe.'), - ); - - this.host = githubIntegrationConfig?.host ?? 'github.com'; - this.baseUrl = - githubIntegrationConfig?.apiBaseUrl ?? 'https://api.github.com'; - } - - public async getOctokit() { - const token = await this.githubAuthApi.getAccessToken(['repo']); - - return { - octokit: new Octokit({ - auth: token, - baseUrl: this.baseUrl, - }), - }; - } -} diff --git a/plugins/github-release-manager/src/api/serviceApiRef.ts b/plugins/github-release-manager/src/api/serviceApiRef.ts index e55e99b072..ea5eb7fee3 100644 --- a/plugins/github-release-manager/src/api/serviceApiRef.ts +++ b/plugins/github-release-manager/src/api/serviceApiRef.ts @@ -13,11 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { createApiRef } from '@backstage/core'; -import { PluginApiClientConfig } from './PluginApiClientConfig'; +import { PluginApiClient } from './PluginApiClient'; -export const githubReleaseManagerApiRef = createApiRef({ +export const githubReleaseManagerApiRef = createApiRef({ id: 'plugin.github-release-manager.service', description: 'Used by the GitHub Release Manager plugin to make requests', }); diff --git a/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx b/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx index 07582351e8..6a918c68eb 100644 --- a/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx +++ b/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { render } from '@testing-library/react'; @@ -28,7 +29,7 @@ import { import { TEST_IDS } from '../../test-helpers/test-ids'; jest.mock('../../components/ProjectContext', () => ({ - useApiClientContext: () => mockApiClient, + usePluginApiClientContext: () => mockApiClient, })); jest.mock('./getRcGitHubInfo', () => ({ getRcGitHubInfo: () => mockNextGitHubInfo, diff --git a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx index 8c4a5bff87..c02fba01d5 100644 --- a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx +++ b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React, { useState, useEffect } from 'react'; import { Alert } from '@material-ui/lab'; import { @@ -39,7 +40,7 @@ import { } from '../../types/types'; import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; import { useStyles } from '../../styles/styles'; -import { useApiClientContext } from '../../components/ProjectContext'; +import { usePluginApiClientContext } from '../../components/ProjectContext'; import { SEMVER_PARTS } from '../../constants/constants'; import { TEST_IDS } from '../../test-helpers/test-ids'; @@ -60,7 +61,7 @@ export const CreateRc = ({ setRefetch, successCb, }: CreateRcProps) => { - const apiClient = useApiClientContext(); + const pluginApiClient = usePluginApiClientContext(); const classes = useStyles(); const [semverBumpLevel, setSemverBumpLevel] = useState<'major' | 'minor'>( @@ -79,7 +80,7 @@ export const CreateRc = ({ const [createGitHubReleaseResponse, createGitHubReleaseFn] = useAsyncFn( (...args) => createRc({ - apiClient, + pluginApiClient, defaultBranch, latestRelease, nextGitHubInfo: args[0], diff --git a/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.test.ts b/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.test.ts index 59676e989b..08eeacdcc9 100644 --- a/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.test.ts +++ b/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.test.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { DateTime } from 'luxon'; import { GhGetReleaseResponse } from '../../types/types'; diff --git a/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.ts b/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.ts index df58f73f11..b507f84b20 100644 --- a/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.ts +++ b/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { DateTime } from 'luxon'; import { getBumpedSemverTagParts } from '../../helpers/getBumpedTag'; diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts index c50ab0a830..713f0d12f2 100644 --- a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts +++ b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { mockApiClient, mockDefaultBranch, @@ -26,7 +27,7 @@ describe('createRc', () => { it('should work', async () => { const result = await createRc({ - apiClient: mockApiClient, + pluginApiClient: mockApiClient, defaultBranch: mockDefaultBranch, latestRelease: mockReleaseVersion, nextGitHubInfo: mockNextGitHubInfo, diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts index 11f93aedf1..433ba8e40d 100644 --- a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts +++ b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { getRcGitHubInfo } from '../getRcGitHubInfo'; import { ComponentConfigCreateRc, @@ -21,11 +22,11 @@ import { GhGetRepositoryResponse, ResponseStep, } from '../../../types/types'; -import { ApiClient } from '../../../api/ApiClient'; +import { PluginApiClient } from '../../../api/PluginApiClient'; import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; interface CreateRC { - apiClient: ApiClient; + pluginApiClient: PluginApiClient; defaultBranch: GhGetRepositoryResponse['default_branch']; latestRelease: GhGetReleaseResponse | null; nextGitHubInfo: ReturnType; @@ -33,7 +34,7 @@ interface CreateRC { } export async function createRc({ - apiClient, + pluginApiClient, defaultBranch, latestRelease, nextGitHubInfo, @@ -44,7 +45,7 @@ export async function createRc({ /** * 1. Get the default branch's most recent commit */ - const { latestCommit } = await apiClient.getLatestCommit({ + const { latestCommit } = await pluginApiClient.getLatestCommit({ defaultBranch, }); responseSteps.push({ @@ -60,7 +61,7 @@ export async function createRc({ let createdRef: GhCreateReferenceResponse; try { createdRef = ( - await apiClient.createRc.createRef({ + await pluginApiClient.createRc.createRef({ mostRecentSha, targetBranch: nextGitHubInfo.rcBranch, }) @@ -85,7 +86,7 @@ export async function createRc({ ? latestRelease.target_commitish : defaultBranch; const nextReleaseBranch = nextGitHubInfo.rcBranch; - const { comparison } = await apiClient.createRc.getComparison({ + const { comparison } = await pluginApiClient.createRc.getComparison({ previousReleaseBranch, nextReleaseBranch, }); @@ -107,7 +108,9 @@ export async function createRc({ /** * 4. Creates the release itself in GitHub */ - const { createReleaseResponse } = await apiClient.createRc.createRelease({ + const { + createReleaseResponse, + } = await pluginApiClient.createRc.createRelease({ nextGitHubInfo: nextGitHubInfo, releaseBody, }); diff --git a/plugins/github-release-manager/src/cards/info/Info.test.tsx b/plugins/github-release-manager/src/cards/info/Info.test.tsx index 2c1176aa62..ac278b04c9 100644 --- a/plugins/github-release-manager/src/cards/info/Info.test.tsx +++ b/plugins/github-release-manager/src/cards/info/Info.test.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { render } from '@testing-library/react'; diff --git a/plugins/github-release-manager/src/cards/info/Info.tsx b/plugins/github-release-manager/src/cards/info/Info.tsx index d05d16bf85..f74065d78a 100644 --- a/plugins/github-release-manager/src/cards/info/Info.tsx +++ b/plugins/github-release-manager/src/cards/info/Info.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { Link, Typography } from '@material-ui/core'; diff --git a/plugins/github-release-manager/src/cards/patchRc/Patch.test.tsx b/plugins/github-release-manager/src/cards/patchRc/Patch.test.tsx index 13e1045b6e..fd81b2cd34 100644 --- a/plugins/github-release-manager/src/cards/patchRc/Patch.test.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/Patch.test.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { render } from '@testing-library/react'; diff --git a/plugins/github-release-manager/src/cards/patchRc/Patch.tsx b/plugins/github-release-manager/src/cards/patchRc/Patch.tsx index 0b5a9fd9aa..2bc4ebf652 100644 --- a/plugins/github-release-manager/src/cards/patchRc/Patch.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/Patch.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { Typography } from '@material-ui/core'; diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx index 7ddc6308cf..c6020ed3c6 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { render, waitFor, screen } from '@testing-library/react'; @@ -26,7 +27,7 @@ import { } from '../../test-helpers/test-helpers'; jest.mock('../../components/ProjectContext', () => ({ - useApiClientContext: () => mockApiClient, + usePluginApiClientContext: () => mockApiClient, })); import { PatchBody } from './PatchBody'; diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx index 80b53bb208..5f14286ed3 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React, { useState } from 'react'; import { Alert, AlertTitle } from '@material-ui/lab'; import { useAsync, useAsyncFn } from 'react-use'; @@ -44,7 +45,7 @@ import { import { CalverTagParts } from '../../helpers/tagParts/getCalverTagParts'; import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; import { SemverTagParts } from '../../helpers/tagParts/getSemverTagParts'; -import { useApiClientContext } from '../../components/ProjectContext'; +import { usePluginApiClientContext } from '../../components/ProjectContext'; import { useStyles } from '../../styles/styles'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { patch } from './sideEffects/patch'; @@ -66,7 +67,7 @@ export const PatchBody = ({ successCb, tagParts, }: PatchBodyProps) => { - const apiClient = useApiClientContext(); + const pluginApiClient = usePluginApiClientContext(); const [checkedCommitIndex, setCheckedCommitIndex] = useState(-1); const githubDataResponse = useAsync(async () => { @@ -74,13 +75,13 @@ export const PatchBody = ({ { branch: releaseBranchResponse }, { recentCommits }, ] = await Promise.all([ - apiClient.getBranch({ branchName: latestRelease.target_commitish }), - apiClient.getRecentCommits(), + pluginApiClient.getBranch({ branchName: latestRelease.target_commitish }), + pluginApiClient.getRecentCommits(), ]); const { recentCommits: recentReleaseBranchCommits, - } = await apiClient.getRecentCommits({ + } = await pluginApiClient.getRecentCommits({ releaseBranchName: releaseBranchResponse.name, }); @@ -94,7 +95,7 @@ export const PatchBody = ({ const [patchReleaseResponse, patchReleaseFn] = useAsyncFn(async (...args) => { const selectedPatchCommit: GhGetCommitResponse = args[0]; const patchResponseSteps = await patch({ - apiClient, + pluginApiClient, bumpedTag, latestRelease, selectedPatchCommit, @@ -231,8 +232,8 @@ export const PatchBody = ({ aria-label="commit" disabled={commitExistsOnReleaseBranch || !releaseBranch} onClick={() => { - const repoPath = apiClient.getRepoPath(); - const host = apiClient.getHost(); + const repoPath = pluginApiClient.getRepoPath(); + const host = pluginApiClient.getHost(); const newTab = window.open( `https://${host}/${repoPath}/compare/${releaseBranch?.name}...${commit.sha}`, diff --git a/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.test.ts b/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.test.ts index 7a37c0ce72..2b3b9bf3b2 100644 --- a/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.test.ts +++ b/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.test.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { mockBumpedTag, mockReleaseVersion, @@ -27,7 +28,7 @@ describe('patch', () => { it('should work', async () => { const result = await patch({ - apiClient: mockApiClient, + pluginApiClient: mockApiClient, latestRelease: mockReleaseVersion, bumpedTag: mockBumpedTag, selectedPatchCommit: mockSelectedPatchCommit, diff --git a/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.ts b/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.ts index 1d592b330b..1c97a8f0f6 100644 --- a/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.ts +++ b/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { ComponentConfigPatch, GhGetCommitResponse, @@ -21,11 +22,11 @@ import { } from '../../../types/types'; import { CalverTagParts } from '../../../helpers/tagParts/getCalverTagParts'; import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; -import { ApiClient } from '../../../api/ApiClient'; +import { PluginApiClient } from '../../../api/PluginApiClient'; import { SemverTagParts } from '../../../helpers/tagParts/getSemverTagParts'; interface Patch { - apiClient: ApiClient; + pluginApiClient: PluginApiClient; bumpedTag: string; latestRelease: GhGetReleaseResponse; selectedPatchCommit: GhGetCommitResponse; @@ -35,7 +36,7 @@ interface Patch { // Inspo: https://stackoverflow.com/questions/53859199/how-to-cherry-pick-through-githubs-api export async function patch({ - apiClient, + pluginApiClient, bumpedTag, latestRelease, selectedPatchCommit, @@ -55,7 +56,7 @@ export async function patch({ * > branchSha = branch.commit.sha * > branchTree = branch.commit.commit.tree.sha */ - const { branch: releaseBranch } = await apiClient.getBranch({ + const { branch: releaseBranch } = await pluginApiClient.getBranch({ branchName: releaseBranchName, }); const releaseBranchSha = releaseBranch.commit.sha; @@ -71,7 +72,7 @@ export async function patch({ * > parentSha = commit.parents.head // first parent -- there should only be one * > tempCommit = POST /repos/$owner/$repo/git/commits { "message": "temp", "tree": branchTree, "parents": [parentSha] } */ - const { tempCommit } = await apiClient.patch.createTempCommit({ + const { tempCommit } = await pluginApiClient.patch.createTempCommit({ releaseBranchTree, selectedPatchCommit, tagParts, @@ -85,7 +86,7 @@ export async function patch({ * 3. Now temporarily force the branch over to that commit: * > PATCH /repos/$owner/$repo/git/refs/heads/$refName { sha = tempCommit.sha, force = true } */ - await apiClient.patch.forceBranchHeadToTempCommit({ + await pluginApiClient.patch.forceBranchHeadToTempCommit({ tempCommit, releaseBranchName, }); @@ -94,7 +95,7 @@ export async function patch({ * 4. Merge the commit we want into this mess: * > merge = POST /repos/$owner/$repo/merges { "base": branchName, "head": commit.sha } */ - const { merge } = await apiClient.patch.merge({ + const { merge } = await pluginApiClient.patch.merge({ base: releaseBranchName, head: selectedPatchCommit.sha, }); @@ -115,7 +116,9 @@ export async function patch({ * Note that branchSha is the original from up at the top. * > cherry = POST /repos/$owner/$repo/git/commits { "message": "looks good!", "tree": mergeTree, "parents": [branchSha] } */ - const { cherryPickCommit } = await apiClient.patch.createCherryPickCommit({ + const { + cherryPickCommit, + } = await pluginApiClient.patch.createCherryPickCommit({ bumpedTag, mergeTree, releaseBranchSha, @@ -130,7 +133,7 @@ export async function patch({ * 6. Replace the temp commit with the real commit: * > PATCH /repos/$owner/$repo/git/refs/heads/$refName { sha = cherry.sha, force = true } */ - const { updatedReference } = await apiClient.patch.replaceTempCommit({ + const { updatedReference } = await pluginApiClient.patch.replaceTempCommit({ cherryPickCommit, releaseBranchName, }); @@ -142,7 +145,7 @@ export async function patch({ * 7. Create tag object: https://developer.github.com/v3/git/tags/#create-a-tag-object * > POST /repos/:owner/:repo/git/tags */ - const { tagObjectResponse } = await apiClient.patch.createTagObject({ + const { tagObjectResponse } = await pluginApiClient.patch.createTagObject({ bumpedTag, updatedReference, }); @@ -155,7 +158,7 @@ export async function patch({ * 8. Create a reference: https://developer.github.com/v3/git/refs/#create-a-reference * > POST /repos/:owner/:repo/git/refs */ - const { reference } = await apiClient.patch.createReference({ + const { reference } = await pluginApiClient.patch.createReference({ bumpedTag, tagObjectResponse, }); @@ -167,12 +170,14 @@ export async function patch({ /** * 9. Update release */ - const { release: updatedRelease } = await apiClient.patch.updateRelease({ - bumpedTag, - latestRelease, - selectedPatchCommit, - tagParts, - }); + const { release: updatedRelease } = await pluginApiClient.patch.updateRelease( + { + bumpedTag, + latestRelease, + selectedPatchCommit, + tagParts, + }, + ); responseSteps.push({ message: `Updated release "${updatedRelease.name}"`, secondaryMessage: `with tag ${updatedRelease.tag_name}`, diff --git a/plugins/github-release-manager/src/cards/promoteRc/PromoteRc.test.tsx b/plugins/github-release-manager/src/cards/promoteRc/PromoteRc.test.tsx index d38b2e0991..d2602218f9 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/PromoteRc.test.tsx +++ b/plugins/github-release-manager/src/cards/promoteRc/PromoteRc.test.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { render } from '@testing-library/react'; diff --git a/plugins/github-release-manager/src/cards/promoteRc/PromoteRc.tsx b/plugins/github-release-manager/src/cards/promoteRc/PromoteRc.tsx index e7583e7085..d30271be48 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/PromoteRc.tsx +++ b/plugins/github-release-manager/src/cards/promoteRc/PromoteRc.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { Alert, AlertTitle } from '@material-ui/lab'; import { Typography } from '@material-ui/core'; diff --git a/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.test.tsx b/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.test.tsx index 4e78e117b6..0dac702791 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.test.tsx +++ b/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.test.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { render } from '@testing-library/react'; @@ -20,7 +21,7 @@ import { mockRcRelease, mockApiClient } from '../../test-helpers/test-helpers'; import { TEST_IDS } from '../../test-helpers/test-ids'; jest.mock('../../components/ProjectContext', () => ({ - useApiClientContext: () => mockApiClient, + usePluginApiClientContext: () => mockApiClient, })); import { PromoteRcBody } from './PromoteRcBody'; diff --git a/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx b/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx index 99ca136fac..ef9a67d89f 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx +++ b/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { Alert } from '@material-ui/lab'; import { Button, Typography } from '@material-ui/core'; @@ -26,7 +27,7 @@ import { } from '../../types/types'; import { promoteRc } from './sideEffects/promoteRc'; import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; -import { useApiClientContext } from '../../components/ProjectContext'; +import { usePluginApiClientContext } from '../../components/ProjectContext'; import { useStyles } from '../../styles/styles'; import { TEST_IDS } from '../../test-helpers/test-ids'; @@ -41,11 +42,16 @@ export const PromoteRcBody = ({ setRefetch, successCb, }: PromoteRcBodyProps) => { - const apiClient = useApiClientContext(); + const pluginApiClient = usePluginApiClientContext(); const classes = useStyles(); const releaseVersion = rcRelease.tag_name.replace('rc-', 'version-'); const [promoteGitHubRcResponse, promoseGitHubRcFn] = useAsyncFn( - promoteRc({ apiClient, rcRelease, releaseVersion, successCb }), + promoteRc({ + pluginApiClient, + rcRelease, + releaseVersion, + successCb, + }), ); if (promoteGitHubRcResponse.error) { diff --git a/plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.test.ts b/plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.test.ts index a64cf70f81..e57ccd5898 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.test.ts +++ b/plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.test.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { mockRcRelease, mockApiClient, @@ -24,7 +25,7 @@ describe('promoteRc', () => { it('should work', async () => { const result = await promoteRc({ - apiClient: mockApiClient, + pluginApiClient: mockApiClient, rcRelease: mockRcRelease, releaseVersion: 'version-1.2.3', })(); diff --git a/plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.ts b/plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.ts index 34085a3d12..e27f26289a 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.ts +++ b/plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.ts @@ -13,22 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { ComponentConfigPromoteRc, GhGetReleaseResponse, ResponseStep, } from '../../../types/types'; -import { ApiClient } from '../../../api/ApiClient'; +import { PluginApiClient } from '../../../api/PluginApiClient'; interface PromoteRc { - apiClient: ApiClient; + pluginApiClient: PluginApiClient; rcRelease: GhGetReleaseResponse; releaseVersion: string; successCb?: ComponentConfigPromoteRc['successCb']; } export function promoteRc({ - apiClient, + pluginApiClient, rcRelease, releaseVersion, successCb, @@ -36,7 +37,7 @@ export function promoteRc({ return async (): Promise => { const responseSteps: ResponseStep[] = []; - const { release } = await apiClient.promoteRc.promoteRelease({ + const { release } = await pluginApiClient.promoteRc.promoteRelease({ releaseId: rcRelease.id, releaseVersion, }); diff --git a/plugins/github-release-manager/src/components/Differ.tsx b/plugins/github-release-manager/src/components/Differ.tsx index 02bf60ce46..05241e43df 100644 --- a/plugins/github-release-manager/src/components/Differ.tsx +++ b/plugins/github-release-manager/src/components/Differ.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React, { ReactNode } from 'react'; import { grey } from '@material-ui/core/colors'; import CallSplitIcon from '@material-ui/icons/CallSplit'; diff --git a/plugins/github-release-manager/src/components/Divider.test.tsx b/plugins/github-release-manager/src/components/Divider.test.tsx index 7a5ac8ad09..35e725d2ee 100644 --- a/plugins/github-release-manager/src/components/Divider.test.tsx +++ b/plugins/github-release-manager/src/components/Divider.test.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { render } from '@testing-library/react'; diff --git a/plugins/github-release-manager/src/components/Divider.tsx b/plugins/github-release-manager/src/components/Divider.tsx index 879a55b98a..9ddf21e0ff 100644 --- a/plugins/github-release-manager/src/components/Divider.tsx +++ b/plugins/github-release-manager/src/components/Divider.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { Divider as MaterialDivider } from '@material-ui/core'; diff --git a/plugins/github-release-manager/src/components/InfoCardPlus.test.tsx b/plugins/github-release-manager/src/components/InfoCardPlus.test.tsx index 9486d2ac94..efd30b67da 100644 --- a/plugins/github-release-manager/src/components/InfoCardPlus.test.tsx +++ b/plugins/github-release-manager/src/components/InfoCardPlus.test.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { render } from '@testing-library/react'; diff --git a/plugins/github-release-manager/src/components/InfoCardPlus.tsx b/plugins/github-release-manager/src/components/InfoCardPlus.tsx index 9adf295064..38e3c5f388 100644 --- a/plugins/github-release-manager/src/components/InfoCardPlus.tsx +++ b/plugins/github-release-manager/src/components/InfoCardPlus.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { InfoCard } from '@backstage/core'; import { makeStyles } from '@material-ui/core'; diff --git a/plugins/github-release-manager/src/components/NoLatestRelease.test.tsx b/plugins/github-release-manager/src/components/NoLatestRelease.test.tsx index 83eb4f6802..779412ec25 100644 --- a/plugins/github-release-manager/src/components/NoLatestRelease.test.tsx +++ b/plugins/github-release-manager/src/components/NoLatestRelease.test.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { render } from '@testing-library/react'; diff --git a/plugins/github-release-manager/src/components/NoLatestRelease.tsx b/plugins/github-release-manager/src/components/NoLatestRelease.tsx index f09049f3cf..232eb1c6b1 100644 --- a/plugins/github-release-manager/src/components/NoLatestRelease.tsx +++ b/plugins/github-release-manager/src/components/NoLatestRelease.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { Alert } from '@material-ui/lab'; diff --git a/plugins/github-release-manager/src/components/ProjectContext.ts b/plugins/github-release-manager/src/components/ProjectContext.ts index 61d41f8dc9..6417d7bdf5 100644 --- a/plugins/github-release-manager/src/components/ProjectContext.ts +++ b/plugins/github-release-manager/src/components/ProjectContext.ts @@ -13,19 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { createContext, useContext } from 'react'; -import { ApiClient } from '../api/ApiClient'; +import { PluginApiClient } from '../api/PluginApiClient'; import { GitHubReleaseManagerError } from '../errors/GitHubReleaseManagerError'; -export const ApiClientContext = createContext(undefined); +export const PluginApiClientContext = createContext< + PluginApiClient | undefined +>(undefined); -export const useApiClientContext = () => { - const apiClient = useContext(ApiClientContext); +export const usePluginApiClientContext = () => { + const pluginApiClient = useContext(PluginApiClientContext); - if (!apiClient) { - throw new GitHubReleaseManagerError('apiClient not found'); + if (!pluginApiClient) { + throw new GitHubReleaseManagerError('pluginApiClient not found'); } - return apiClient; + return pluginApiClient; }; diff --git a/plugins/github-release-manager/src/components/ReloadButton.test.tsx b/plugins/github-release-manager/src/components/ReloadButton.test.tsx index c7a52bcdf9..b33cc0b931 100644 --- a/plugins/github-release-manager/src/components/ReloadButton.test.tsx +++ b/plugins/github-release-manager/src/components/ReloadButton.test.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { render } from '@testing-library/react'; diff --git a/plugins/github-release-manager/src/components/ReloadButton.tsx b/plugins/github-release-manager/src/components/ReloadButton.tsx index 44e7ce89b3..d11f39f954 100644 --- a/plugins/github-release-manager/src/components/ReloadButton.tsx +++ b/plugins/github-release-manager/src/components/ReloadButton.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { Button } from '@material-ui/core'; diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.test.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.test.tsx index 3aa0986d33..18974b079f 100644 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.test.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.test.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { render } from '@testing-library/react'; diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx index 239e642884..ab545153f7 100644 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React, { PropsWithChildren } from 'react'; import { List, diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.test.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.test.tsx index 0b4ce11887..c549ef4f11 100644 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.test.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.test.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React from 'react'; import { render } from '@testing-library/react'; diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx index 21486ed87f..dd54a7a11d 100644 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import React, { useEffect, useState } from 'react'; import { colors, diff --git a/plugins/github-release-manager/src/constants/constants.test.ts b/plugins/github-release-manager/src/constants/constants.test.ts index 616cf6f21e..c731731392 100644 --- a/plugins/github-release-manager/src/constants/constants.test.ts +++ b/plugins/github-release-manager/src/constants/constants.test.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import * as constants from './constants'; describe('constants', () => { diff --git a/plugins/github-release-manager/src/constants/constants.ts b/plugins/github-release-manager/src/constants/constants.ts index c36c3b63b3..4cfd06b7ca 100644 --- a/plugins/github-release-manager/src/constants/constants.ts +++ b/plugins/github-release-manager/src/constants/constants.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + export const SEMVER_PARTS: { major: 'major'; minor: 'minor'; diff --git a/plugins/github-release-manager/src/errors/GitHubReleaseManagerError.ts b/plugins/github-release-manager/src/errors/GitHubReleaseManagerError.ts index 144ad7af90..7806d4baad 100644 --- a/plugins/github-release-manager/src/errors/GitHubReleaseManagerError.ts +++ b/plugins/github-release-manager/src/errors/GitHubReleaseManagerError.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + export class GitHubReleaseManagerError extends Error { constructor(message: string) { super(message); diff --git a/plugins/github-release-manager/src/helpers/getBumpedTag.test.ts b/plugins/github-release-manager/src/helpers/getBumpedTag.test.ts index dc81f93e67..1fd7cd2ecf 100644 --- a/plugins/github-release-manager/src/helpers/getBumpedTag.test.ts +++ b/plugins/github-release-manager/src/helpers/getBumpedTag.test.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { mockCalverProject, mockSemverProject, diff --git a/plugins/github-release-manager/src/helpers/getBumpedTag.ts b/plugins/github-release-manager/src/helpers/getBumpedTag.ts index a6d4e43172..7e2ebadd35 100644 --- a/plugins/github-release-manager/src/helpers/getBumpedTag.ts +++ b/plugins/github-release-manager/src/helpers/getBumpedTag.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { CalverTagParts } from './tagParts/getCalverTagParts'; import { getTagParts } from './tagParts/getTagParts'; import { isCalverTagParts } from './isCalverTagParts'; diff --git a/plugins/github-release-manager/src/helpers/getShortCommitHash.test.ts b/plugins/github-release-manager/src/helpers/getShortCommitHash.test.ts index 4f9b57f6f1..82cfd031cf 100644 --- a/plugins/github-release-manager/src/helpers/getShortCommitHash.test.ts +++ b/plugins/github-release-manager/src/helpers/getShortCommitHash.test.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { getShortCommitHash } from './getShortCommitHash'; describe('getShortCommitHash', () => { diff --git a/plugins/github-release-manager/src/helpers/getShortCommitHash.ts b/plugins/github-release-manager/src/helpers/getShortCommitHash.ts index bb85703477..e2088caced 100644 --- a/plugins/github-release-manager/src/helpers/getShortCommitHash.ts +++ b/plugins/github-release-manager/src/helpers/getShortCommitHash.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { GitHubReleaseManagerError } from '../errors/GitHubReleaseManagerError'; export function getShortCommitHash(hash: string) { diff --git a/plugins/github-release-manager/src/helpers/isCalverTagParts.test.ts b/plugins/github-release-manager/src/helpers/isCalverTagParts.test.ts index 33be3cc2e0..1f74f2fe40 100644 --- a/plugins/github-release-manager/src/helpers/isCalverTagParts.test.ts +++ b/plugins/github-release-manager/src/helpers/isCalverTagParts.test.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { mockCalverProject, mockSemverProject, diff --git a/plugins/github-release-manager/src/helpers/isCalverTagParts.ts b/plugins/github-release-manager/src/helpers/isCalverTagParts.ts index 825486c248..dbc373a5aa 100644 --- a/plugins/github-release-manager/src/helpers/isCalverTagParts.ts +++ b/plugins/github-release-manager/src/helpers/isCalverTagParts.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { CalverTagParts } from './tagParts/getCalverTagParts'; import { Project } from '../types/types'; diff --git a/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.ts b/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.ts index c76ef92a85..27fe59844a 100644 --- a/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.ts +++ b/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { GitHubReleaseManagerError } from '../../errors/GitHubReleaseManagerError'; export type CalverTagParts = { diff --git a/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.ts b/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.ts index f6a97908e2..eabf1c0a7e 100644 --- a/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.ts +++ b/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { GitHubReleaseManagerError } from '../../errors/GitHubReleaseManagerError'; export type SemverTagParts = { diff --git a/plugins/github-release-manager/src/helpers/tagParts/getTagParts.test.ts b/plugins/github-release-manager/src/helpers/tagParts/getTagParts.test.ts index 0536cd3d7d..7493887d15 100644 --- a/plugins/github-release-manager/src/helpers/tagParts/getTagParts.test.ts +++ b/plugins/github-release-manager/src/helpers/tagParts/getTagParts.test.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { mockCalverProject, mockSemverProject, diff --git a/plugins/github-release-manager/src/helpers/tagParts/getTagParts.ts b/plugins/github-release-manager/src/helpers/tagParts/getTagParts.ts index 3e7f85598b..ff42779d99 100644 --- a/plugins/github-release-manager/src/helpers/tagParts/getTagParts.ts +++ b/plugins/github-release-manager/src/helpers/tagParts/getTagParts.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { getCalverTagParts } from './getCalverTagParts'; import { getSemverTagParts } from './getSemverTagParts'; import { Project } from '../../types/types'; diff --git a/plugins/github-release-manager/src/index.ts b/plugins/github-release-manager/src/index.ts index c4177089eb..bb9a29c419 100644 --- a/plugins/github-release-manager/src/index.ts +++ b/plugins/github-release-manager/src/index.ts @@ -13,4 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export { gitHubReleaseManagerPlugin, GitHubReleaseManagerPage } from './plugin'; + +export { + gitHubReleaseManagerPlugin, + GitHubReleaseManagerPage, + githubReleaseManagerApiRef, +} from './plugin'; diff --git a/plugins/github-release-manager/src/plugin.test.ts b/plugins/github-release-manager/src/plugin.test.ts index c952ce30fa..a13dda5688 100644 --- a/plugins/github-release-manager/src/plugin.test.ts +++ b/plugins/github-release-manager/src/plugin.test.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { gitHubReleaseManagerPlugin } from './plugin'; describe('github-release-manager', () => { diff --git a/plugins/github-release-manager/src/plugin.ts b/plugins/github-release-manager/src/plugin.ts index 5f40d4581e..c0c6f4fda9 100644 --- a/plugins/github-release-manager/src/plugin.ts +++ b/plugins/github-release-manager/src/plugin.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { configApiRef, createPlugin, @@ -22,9 +23,11 @@ import { } from '@backstage/core'; import { githubReleaseManagerApiRef } from './api/serviceApiRef'; -import { PluginApiClientConfig } from './api/PluginApiClientConfig'; +import { PluginApiClient } from './api/PluginApiClient'; import { rootRouteRef } from './routes'; +export { githubReleaseManagerApiRef }; + export const gitHubReleaseManagerPlugin = createPlugin({ id: 'github-release-manager', routes: { @@ -37,8 +40,9 @@ export const gitHubReleaseManagerPlugin = createPlugin({ configApi: configApiRef, githubAuthApi: githubAuthApiRef, }, - factory: ({ configApi, githubAuthApi }) => - new PluginApiClientConfig({ configApi, githubAuthApi }), + factory: ({ configApi, githubAuthApi }) => { + return new PluginApiClient({ configApi, githubAuthApi }); + }, }), ], }); diff --git a/plugins/github-release-manager/src/routes.ts b/plugins/github-release-manager/src/routes.ts index d9dd0774b9..9406a4c6a7 100644 --- a/plugins/github-release-manager/src/routes.ts +++ b/plugins/github-release-manager/src/routes.ts @@ -13,6 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { createRouteRef } from '@backstage/core'; -export const rootRouteRef = createRouteRef({ title: 'github-release-manager' }); +export const rootRouteRef = createRouteRef({ + title: 'github-release-manager', +}); diff --git a/plugins/github-release-manager/src/setupTests.ts b/plugins/github-release-manager/src/setupTests.ts index 0cec5b395d..3ffe1424cc 100644 --- a/plugins/github-release-manager/src/setupTests.ts +++ b/plugins/github-release-manager/src/setupTests.ts @@ -13,5 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import '@testing-library/jest-dom'; import 'cross-fetch/polyfill'; diff --git a/plugins/github-release-manager/src/sideEffects/getGitHubBatchInfo.ts b/plugins/github-release-manager/src/sideEffects/getGitHubBatchInfo.ts index 8051569772..9c7a220ea1 100644 --- a/plugins/github-release-manager/src/sideEffects/getGitHubBatchInfo.ts +++ b/plugins/github-release-manager/src/sideEffects/getGitHubBatchInfo.ts @@ -13,19 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { ApiClient } from '../api/ApiClient'; + +import { PluginApiClient } from '../api/PluginApiClient'; import { getLatestRelease } from './getLatestRelease'; interface GetGitHubBatchInfo { - apiClient: ApiClient; + pluginApiClient: PluginApiClient; } export const getGitHubBatchInfo = ({ - apiClient, + pluginApiClient, }: GetGitHubBatchInfo) => async () => { const [{ repository }, latestRelease] = await Promise.all([ - apiClient.getRepository(), - getLatestRelease({ apiClient }), + pluginApiClient.getRepository(), + getLatestRelease({ pluginApiClient }), ]); if (latestRelease === null) { @@ -36,7 +37,7 @@ export const getGitHubBatchInfo = ({ }; } - const { branch } = await apiClient.getBranch({ + const { branch } = await pluginApiClient.getBranch({ branchName: latestRelease.target_commitish, }); diff --git a/plugins/github-release-manager/src/sideEffects/getLatestRelease.test.ts b/plugins/github-release-manager/src/sideEffects/getLatestRelease.test.ts index eb275092da..15ef97d453 100644 --- a/plugins/github-release-manager/src/sideEffects/getLatestRelease.test.ts +++ b/plugins/github-release-manager/src/sideEffects/getLatestRelease.test.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { mockApiClient } from '../test-helpers/test-helpers'; import { getLatestRelease } from './getLatestRelease'; @@ -20,7 +21,7 @@ describe('getLatestRelease', () => { beforeEach(jest.clearAllMocks); it('should return the latest release with id=1', async () => { - const result = await getLatestRelease({ apiClient: mockApiClient }); + const result = await getLatestRelease({ pluginApiClient: mockApiClient }); expect(result).toMatchInlineSnapshot(` Object { @@ -35,7 +36,7 @@ describe('getLatestRelease', () => { it('should return early with `null` if no releases found', async () => { mockApiClient.getReleases.mockImplementationOnce(() => ({ releases: [] })); - const result = await getLatestRelease({ apiClient: mockApiClient }); + const result = await getLatestRelease({ pluginApiClient: mockApiClient }); expect(result).toMatchInlineSnapshot(`null`); }); diff --git a/plugins/github-release-manager/src/sideEffects/getLatestRelease.ts b/plugins/github-release-manager/src/sideEffects/getLatestRelease.ts index 5690206553..9d3ebf647d 100644 --- a/plugins/github-release-manager/src/sideEffects/getLatestRelease.ts +++ b/plugins/github-release-manager/src/sideEffects/getLatestRelease.ts @@ -13,20 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { ApiClient } from '../api/ApiClient'; + +import { PluginApiClient } from '../api/PluginApiClient'; interface GetLatestRelease { - apiClient: ApiClient; + pluginApiClient: PluginApiClient; } -export async function getLatestRelease({ apiClient }: GetLatestRelease) { - const { releases } = await apiClient.getReleases(); +export async function getLatestRelease({ pluginApiClient }: GetLatestRelease) { + const { releases } = await pluginApiClient.getReleases(); if (releases.length === 0) { return null; } - const { latestRelease } = await apiClient.getRelease({ + const { latestRelease } = await pluginApiClient.getRelease({ releaseId: releases[0].id, }); diff --git a/plugins/github-release-manager/src/styles/styles.ts b/plugins/github-release-manager/src/styles/styles.ts index 1548953069..19a9434c69 100644 --- a/plugins/github-release-manager/src/styles/styles.ts +++ b/plugins/github-release-manager/src/styles/styles.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { makeStyles, Theme } from '@material-ui/core'; export const useStyles = makeStyles((_theme: Theme) => ({ diff --git a/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts b/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts index 78c48eb0a7..eb359d06dd 100644 --- a/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts +++ b/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import * as testHelpers from './test-helpers'; describe('testHelpers', () => { diff --git a/plugins/github-release-manager/src/test-helpers/test-helpers.ts b/plugins/github-release-manager/src/test-helpers/test-helpers.ts index 61d8cb3b17..fc246ab4bc 100644 --- a/plugins/github-release-manager/src/test-helpers/test-helpers.ts +++ b/plugins/github-release-manager/src/test-helpers/test-helpers.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { CalverTagParts } from '../helpers/tagParts/getCalverTagParts'; import { getRcGitHubInfo } from '../cards/createRc/getRcGitHubInfo'; import { diff --git a/plugins/github-release-manager/src/test-helpers/test-ids.ts b/plugins/github-release-manager/src/test-helpers/test-ids.ts index 27aef5567f..3620b03248 100644 --- a/plugins/github-release-manager/src/test-helpers/test-ids.ts +++ b/plugins/github-release-manager/src/test-helpers/test-ids.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + export const TEST_IDS = { info: { info: 'grm--info', diff --git a/plugins/github-release-manager/src/types/types.ts b/plugins/github-release-manager/src/types/types.ts index f4fadefce3..6eafd8f797 100644 --- a/plugins/github-release-manager/src/types/types.ts +++ b/plugins/github-release-manager/src/types/types.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + export interface Project { /** A unique (in the context of GitHub Release Manager) project name */ name: string; From 191cb7f893b140bddf4a55f88a710b09c4ef3179 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Wed, 14 Apr 2021 18:11:21 +0200 Subject: [PATCH 022/485] Turn Project into a context and bind it to root component Signed-off-by: Erik Engervall --- plugins/github-release-manager/dev/index.tsx | 26 +- .../src/GitHubReleaseManager.tsx | 81 ++-- .../src/api/PluginApiClient.ts | 392 +++++++++++++----- .../src/api/serviceApiRef.ts | 4 +- .../src/cards/createRc/CreateRc.tsx | 12 +- .../src/cards/createRc/getRcGitHubInfo.ts | 3 +- .../cards/createRc/sideEffects/createRc.ts | 11 +- .../src/cards/info/Info.tsx | 40 +- .../src/cards/patchRc/Patch.tsx | 7 +- .../src/cards/patchRc/PatchBody.tsx | 17 +- .../src/cards/patchRc/sideEffects/patch.ts | 32 +- .../src/cards/promoteRc/PromoteRcBody.tsx | 9 +- .../cards/promoteRc/sideEffects/promoteRc.ts | 4 + .../PluginApiClientContext.ts} | 0 .../src/contexts/ProjectContext.ts | 55 +++ .../src/helpers/getBumpedTag.ts | 2 +- .../src/sideEffects/getGitHubBatchInfo.ts | 10 +- .../src/sideEffects/getLatestRelease.ts | 10 +- .../github-release-manager/src/types/types.ts | 59 +-- 19 files changed, 496 insertions(+), 278 deletions(-) rename plugins/github-release-manager/src/{components/ProjectContext.ts => contexts/PluginApiClientContext.ts} (100%) create mode 100644 plugins/github-release-manager/src/contexts/ProjectContext.ts diff --git a/plugins/github-release-manager/dev/index.tsx b/plugins/github-release-manager/dev/index.tsx index b3d343382f..5518d633e2 100644 --- a/plugins/github-release-manager/dev/index.tsx +++ b/plugins/github-release-manager/dev/index.tsx @@ -26,32 +26,10 @@ createDevApp() .registerPlugin(gitHubReleaseManagerPlugin) .addPage({ title: 'Page 1', - element: ( - - ), + element: , }) .addPage({ title: 'Page 2', - element: ( - - ), + element: , }) .render(); diff --git a/plugins/github-release-manager/src/GitHubReleaseManager.tsx b/plugins/github-release-manager/src/GitHubReleaseManager.tsx index 82396438f0..83ccab5dd1 100644 --- a/plugins/github-release-manager/src/GitHubReleaseManager.tsx +++ b/plugins/github-release-manager/src/GitHubReleaseManager.tsx @@ -28,40 +28,26 @@ import { ComponentConfigCreateRc, ComponentConfigPatch, ComponentConfigPromoteRc, - GhGetBranchResponse, - GhGetReleaseResponse, - GhGetRepositoryResponse, - Project, - SetRefetch, } from './types/types'; import { PromoteRc } from './cards/promoteRc/PromoteRc'; import { githubReleaseManagerApiRef } from './api/serviceApiRef'; import { PluginApiClientContext, usePluginApiClientContext, -} from './components/ProjectContext'; +} from './contexts/PluginApiClientContext'; +import { + ProjectContext, + useProjectContext, + Project, +} from './contexts/ProjectContext'; interface GitHubReleaseManagerProps { - project: Project; components?: { default?: { createRc?: ComponentConfigCreateRc; promoteRc?: ComponentConfigPromoteRc; patch?: ComponentConfigPatch; }; - custom?: ({ - project, - setRefetch, - latestRelease, - releaseBranch, - repository, - }: { - project: Project; - setRefetch: SetRefetch; - latestRelease: GhGetReleaseResponse | null; - releaseBranch: GhGetBranchResponse | null; - repository: GhGetRepositoryResponse; - }) => JSX.Element[]; }; } @@ -72,31 +58,37 @@ const useStyles = makeStyles(() => ({ })); export function GitHubReleaseManager({ - project, components, }: GitHubReleaseManagerProps) { const pluginApiClient = useApi(githubReleaseManagerApiRef); - pluginApiClient.setRepoPath({ - repoPath: `${project.github.org}/${project.github.repo}`, - }); const classes = useStyles(); - return ( - -
- + const project: Project = { + owner: 'erikengervall', + repo: 'playground', + versioningStrategy: 'semver', + }; - -
-
+ return ( + + {/* @ts-ignore-error TODO: Update interface for PluginApiClient */} + +
+ + + +
+
+
); } -function Cards({ project, components }: GitHubReleaseManagerProps) { +function Cards({ components }: GitHubReleaseManagerProps) { const pluginApiClient = usePluginApiClientContext(); + const project = useProjectContext(); const [refetch, setRefetch] = useState(0); const gitHubBatchInfo = useAsync( - getGitHubBatchInfo({ pluginApiClient: pluginApiClient }), + getGitHubBatchInfo({ project, pluginApiClient }), [project, refetch], ); @@ -118,11 +110,11 @@ function Cards({ project, components }: GitHubReleaseManagerProps) { ); } - if (!gitHubBatchInfo.value.repository.permissions.push) { + if (!gitHubBatchInfo.value.repository.pushPermissions) { return ( - You lack push permissions for repository "{project.github.org}/ - {project.github.repo}" + You lack push permissions for repository "{project.owner}/{project.repo} + " ); } @@ -132,15 +124,13 @@ function Cards({ project, components }: GitHubReleaseManagerProps) { {components?.default?.createRc?.omit !== true && ( @@ -158,23 +148,10 @@ function Cards({ project, components }: GitHubReleaseManagerProps) { )} - - {components - ?.custom?.({ - project, - setRefetch, - latestRelease: gitHubBatchInfo.value.latestRelease, - releaseBranch: gitHubBatchInfo.value.releaseBranch, - repository: gitHubBatchInfo.value.repository, - }) - .map((customElement, index) => ( -
{customElement}
- ))} ); } diff --git a/plugins/github-release-manager/src/api/PluginApiClient.ts b/plugins/github-release-manager/src/api/PluginApiClient.ts index c2bf8547d4..0615221c77 100644 --- a/plugins/github-release-manager/src/api/PluginApiClient.ts +++ b/plugins/github-release-manager/src/api/PluginApiClient.ts @@ -27,7 +27,6 @@ import { GhGetBranchResponse, GhGetCommitResponse, GhGetReleaseResponse, - GhGetRepositoryResponse, GhMergeResponse, GhUpdateReferenceResponse, GhUpdateReleaseResponse, @@ -35,12 +34,135 @@ import { import { CalverTagParts } from '../helpers/tagParts/getCalverTagParts'; import { getRcGitHubInfo } from '../cards/createRc/getRcGitHubInfo'; import { SemverTagParts } from '../helpers/tagParts/getSemverTagParts'; -import { GitHubReleaseManagerError } from '../errors/GitHubReleaseManagerError'; +import { Project } from '../contexts/ProjectContext'; -export class PluginApiClient { +// export type UnboxPromise> = T extends Promise +// ? U +// : never; + +type Todo = any; +type PartialProject = Omit; + +export interface IPluginApiClient { + getHost: () => string; + + getRecentCommits: ( + args: { releaseBranchName?: string } & PartialProject, + ) => Promise; + getReleases: (args: { releaseId: number } & PartialProject) => Promise; + getRelease: (args: { releaseId: number } & PartialProject) => Promise; + getRepository: ( + args: PartialProject, + ) => Promise<{ + repository: { + pushPermissions: boolean | undefined; + defaultBranch: string; + }; + }>; + getLatestCommit: ( + args: { defaultBranch: string } & PartialProject, + ) => Promise; + getBranch: (args: { branchName: string } & PartialProject) => Promise; + + createRc: { + createRef: ( + args: { + mostRecentSha: string; + targetBranch: string; + } & PartialProject, + ) => Promise; + + getComparison: ( + args: { + previousReleaseBranch: string; + nextReleaseBranch: string; + } & PartialProject, + ) => Promise; + + createRelease: ( + args: { + nextGitHubInfo: ReturnType; + releaseBody: string; + } & PartialProject, + ) => Promise; + }; + + patch: { + createTempCommit: ( + args: { + tagParts: SemverTagParts | CalverTagParts; + releaseBranchTree: string; + selectedPatchCommit: GhGetCommitResponse; + } & PartialProject, + ) => Promise; + + forceBranchHeadToTempCommit: ( + args: { + releaseBranchName: string; + tempCommit: GhCreateCommitResponse; + } & PartialProject, + ) => Promise; + + merge: ({ + base, + head, + }: { base: string; head: string } & PartialProject) => Promise; + + createCherryPickCommit: ( + args: { + bumpedTag: string; + selectedPatchCommit: GhGetCommitResponse; + mergeTree: string; + releaseBranchSha: string; + } & PartialProject, + ) => Promise; + + replaceTempCommit: ( + args: { + releaseBranchName: string; + cherryPickCommit: GhCreateCommitResponse; + } & PartialProject, + ) => Promise; + + createTagObject: ({ + bumpedTag, + updatedReference, + }: { + bumpedTag: string; + updatedReference: GhUpdateReferenceResponse; + } & PartialProject) => Promise; + + createReference: ( + args: { + bumpedTag: string; + tagObjectResponse: GhCreateTagObjectResponse; + } & PartialProject, + ) => Promise; + + updateRelease: ( + args: { + bumpedTag: string; + latestRelease: GhGetReleaseResponse; + tagParts: SemverTagParts | CalverTagParts; + selectedPatchCommit: GhGetCommitResponse; + } & PartialProject, + ) => Promise; + }; + + promoteRc: { + promoteRelease: ( + args: { + releaseId: GhGetReleaseResponse['id']; + releaseVersion: string; + } & PartialProject, + ) => Promise; + }; +} + +export class PluginApiClient implements IPluginApiClient { + // private readonly getAccessToken: any; private readonly githubAuthApi: OAuthApi; private readonly baseUrl: string; - private repoPath?: string; readonly host: string; constructor({ @@ -52,6 +174,8 @@ export class PluginApiClient { }) { this.githubAuthApi = githubAuthApi; + // this.getAccessToken = () => this.githubAuthApi.getAccessToken(); + const githubIntegrationConfig = this.getGithubIntegrationConfig({ configApi, }); @@ -88,81 +212,102 @@ export class PluginApiClient { return this.host; } - public setRepoPath({ repoPath }: { repoPath: string }) { - this.repoPath = repoPath; - } - - public getRepoPath() { - if (!this.repoPath) { - throw new GitHubReleaseManagerError('Could not find repoPath'); - } - - return this.repoPath; + public getRepoPath({ owner, repo }: PartialProject) { + return `${owner}/${repo}`; } async getRecentCommits({ + owner, + repo, releaseBranchName, - }: { releaseBranchName?: string } = {}) { + }: { + releaseBranchName?: string; + } & PartialProject) { const { octokit } = await this.getOctokit(); const sha = releaseBranchName ? `?sha=${releaseBranchName}` : ''; const recentCommits: GhGetCommitResponse[] = ( - await octokit.request(`/repos/${this.getRepoPath()}/commits${sha}`) + await octokit.request( + `/repos/${this.getRepoPath({ owner, repo })}/commits${sha}`, + ) ).data; return { recentCommits }; } - async getReleases() { + async getReleases({ owner, repo }: PartialProject) { const { octokit } = await this.getOctokit(); const releases: GhGetReleaseResponse[] = ( - await octokit.request(`/repos/${this.getRepoPath()}/releases`) + await octokit.request( + `/repos/${this.getRepoPath({ owner, repo })}/releases`, + ) ).data; return { releases }; } - async getRelease({ releaseId }: { releaseId: number }) { + async getRelease({ + owner, + repo, + releaseId, + }: { releaseId: number } & PartialProject) { const { octokit } = await this.getOctokit(); const latestRelease: GhGetReleaseResponse = ( await octokit.request( - `/repos/${this.getRepoPath()}/releases/${releaseId}`, + `/repos/${this.getRepoPath({ owner, repo })}/releases/${releaseId}`, ) ).data; return { latestRelease }; } - async getRepository() { + async getRepository({ owner, repo }: PartialProject) { const { octokit } = await this.getOctokit(); - const repository: GhGetRepositoryResponse = ( - await octokit.request(`/repos/${this.getRepoPath()}`) - ).data; + const { data: repository } = await octokit.repos.get({ + owner: owner, + repo, + }); - return { repository }; + return { + repository: { + pushPermissions: repository.permissions?.push, + defaultBranch: repository.default_branch, + }, + }; } - async getLatestCommit({ defaultBranch }: { defaultBranch: string }) { + async getLatestCommit({ + owner, + repo, + defaultBranch, + }: { defaultBranch: string } & PartialProject) { const { octokit } = await this.getOctokit(); const latestCommit: GhGetCommitResponse = ( await octokit.request( - `/repos/${this.getRepoPath()}/commits/refs/heads/${defaultBranch}`, + `/repos/${this.getRepoPath({ + owner, + repo, + })}/commits/refs/heads/${defaultBranch}`, ) ).data; return { latestCommit }; } - async getBranch({ branchName }: { branchName: string }) { + async getBranch({ + owner, + repo, + branchName, + }: { branchName: string } & PartialProject) { const { octokit } = await this.getOctokit(); const branch: GhGetBranchResponse = ( await octokit.request( - `/repos/${this.getRepoPath()}/branches/${branchName}`, + `/repos/${this.getRepoPath({ owner, repo })}/branches/${branchName}`, ) ).data; @@ -171,39 +316,49 @@ export class PluginApiClient { createRc = { createRef: async ({ + owner, + repo, mostRecentSha, targetBranch, }: { mostRecentSha: string; targetBranch: string; - }) => { + } & PartialProject) => { const { octokit } = await this.getOctokit(); const createdRef: GhCreateReferenceResponse = ( - await octokit.request(`/repos/${this.getRepoPath()}/git/refs`, { - method: 'POST', - data: { - ref: `refs/heads/${targetBranch}`, - sha: mostRecentSha, + await octokit.request( + `/repos/${this.getRepoPath({ owner, repo })}/git/refs`, + { + method: 'POST', + data: { + ref: `refs/heads/${targetBranch}`, + sha: mostRecentSha, + }, }, - }) + ) ).data; return { createdRef }; }, getComparison: async ({ + owner, + repo, previousReleaseBranch, nextReleaseBranch, }: { previousReleaseBranch: string; nextReleaseBranch: string; - }) => { + } & PartialProject) => { const { octokit } = await this.getOctokit(); const comparison: GhCompareCommitsResponse = ( await octokit.request( - `/repos/${this.getRepoPath()}/compare/${previousReleaseBranch}...${nextReleaseBranch}`, + `/repos/${this.getRepoPath({ + owner, + repo, + })}/compare/${previousReleaseBranch}...${nextReleaseBranch}`, ) ).data; @@ -211,25 +366,30 @@ export class PluginApiClient { }, createRelease: async ({ + owner, + repo, nextGitHubInfo, releaseBody, }: { nextGitHubInfo: ReturnType; releaseBody: string; - }) => { + } & PartialProject) => { const { octokit } = await this.getOctokit(); const createReleaseResponse: GhCreateReleaseResponse = ( - await octokit.request(`/repos/${this.getRepoPath()}/releases`, { - method: 'POST', - data: { - tag_name: nextGitHubInfo.rcReleaseTag, - name: nextGitHubInfo.releaseName, - target_commitish: nextGitHubInfo.rcBranch, - body: releaseBody, - prerelease: true, + await octokit.request( + `/repos/${this.getRepoPath({ owner, repo })}/releases`, + { + method: 'POST', + data: { + tag_name: nextGitHubInfo.rcReleaseTag, + name: nextGitHubInfo.releaseName, + target_commitish: nextGitHubInfo.rcBranch, + body: releaseBody, + prerelease: true, + }, }, - }) + ) ).data; return { createReleaseResponse }; @@ -238,6 +398,8 @@ export class PluginApiClient { patch = { createTempCommit: async ({ + owner, + repo, tagParts, releaseBranchTree, selectedPatchCommit, @@ -245,34 +407,42 @@ export class PluginApiClient { tagParts: SemverTagParts | CalverTagParts; releaseBranchTree: string; selectedPatchCommit: GhGetCommitResponse; - }) => { + } & PartialProject) => { const { octokit } = await this.getOctokit(); const tempCommit: GhCreateCommitResponse = ( - await octokit.request(`/repos/${this.getRepoPath()}/git/commits`, { - method: 'POST', - data: { - message: `Temporary commit for patch ${tagParts.patch}`, - tree: releaseBranchTree, - parents: [selectedPatchCommit.parents[0].sha], + await octokit.request( + `/repos/${this.getRepoPath({ owner, repo })}/git/commits`, + { + method: 'POST', + data: { + message: `Temporary commit for patch ${tagParts.patch}`, + tree: releaseBranchTree, + parents: [selectedPatchCommit.parents[0].sha], + }, }, - }) + ) ).data; return { tempCommit }; }, forceBranchHeadToTempCommit: async ({ + owner, + repo, releaseBranchName, tempCommit, }: { releaseBranchName: string; tempCommit: GhCreateCommitResponse; - }) => { + } & PartialProject) => { const { octokit } = await this.getOctokit(); await octokit.request( - `/repos/${this.getRepoPath()}/git/refs/heads/${releaseBranchName}`, + `/repos/${this.getRepoPath({ + owner, + repo, + })}/git/refs/heads/${releaseBranchName}`, { method: 'PATCH', data: { @@ -283,20 +453,30 @@ export class PluginApiClient { ); }, - merge: async ({ base, head }: { base: string; head: string }) => { + merge: async ({ + owner, + repo, + base, + head, + }: { base: string; head: string } & PartialProject) => { const { octokit } = await this.getOctokit(); const merge: GhMergeResponse = ( - await octokit.request(`/repos/${this.getRepoPath()}/merges`, { - method: 'POST', - data: { base, head }, - }) + await octokit.request( + `/repos/${this.getRepoPath({ owner, repo })}/merges`, + { + method: 'POST', + data: { base, head }, + }, + ) ).data; return { merge }; }, createCherryPickCommit: async ({ + owner, + repo, bumpedTag, selectedPatchCommit, mergeTree, @@ -306,35 +486,43 @@ export class PluginApiClient { selectedPatchCommit: GhGetCommitResponse; mergeTree: string; releaseBranchSha: string; - }) => { + } & PartialProject) => { const { octokit } = await this.getOctokit(); const cherryPickCommit: GhCreateCommitResponse = ( - await octokit.request(`/repos/${this.getRepoPath()}/git/commits`, { - method: 'POST', - data: { - message: `[patch ${bumpedTag}] ${selectedPatchCommit.commit.message}`, - tree: mergeTree, - parents: [releaseBranchSha], + await octokit.request( + `/repos/${this.getRepoPath({ owner, repo })}/git/commits`, + { + method: 'POST', + data: { + message: `[patch ${bumpedTag}] ${selectedPatchCommit.commit.message}`, + tree: mergeTree, + parents: [releaseBranchSha], + }, }, - }) + ) ).data; return { cherryPickCommit }; }, replaceTempCommit: async ({ + owner, + repo, releaseBranchName, cherryPickCommit, }: { releaseBranchName: string; cherryPickCommit: GhCreateCommitResponse; - }) => { + } & PartialProject) => { const { octokit } = await this.getOctokit(); const updatedReference: GhUpdateReferenceResponse = ( await octokit.request( - `/repos/${this.getRepoPath()}/git/refs/heads/${releaseBranchName}`, + `/repos/${this.getRepoPath({ + owner, + repo, + })}/git/refs/heads/${releaseBranchName}`, { method: 'PATCH', data: { @@ -349,53 +537,65 @@ export class PluginApiClient { }, createTagObject: async ({ + owner, + repo, bumpedTag, updatedReference, }: { bumpedTag: string; updatedReference: GhUpdateReferenceResponse; - }) => { + } & PartialProject) => { const { octokit } = await this.getOctokit(); const tagObjectResponse: GhCreateTagObjectResponse = ( - await octokit.request(`/repos/${this.getRepoPath()}/git/tags`, { - method: 'POST', - data: { - type: 'commit', - message: - 'Tag generated by your friendly neighborhood GitHub Release Manager', - tag: bumpedTag, - object: updatedReference.object.sha, + await octokit.request( + `/repos/${this.getRepoPath({ owner, repo })}/git/tags`, + { + method: 'POST', + data: { + type: 'commit', + message: + 'Tag generated by your friendly neighborhood GitHub Release Manager', + tag: bumpedTag, + object: updatedReference.object.sha, + }, }, - }) + ) ).data; return { tagObjectResponse }; }, createReference: async ({ + owner, + repo, bumpedTag, tagObjectResponse, }: { bumpedTag: string; tagObjectResponse: GhCreateTagObjectResponse; - }) => { + } & PartialProject) => { const { octokit } = await this.getOctokit(); const reference: GhCreateReferenceResponse = ( - await octokit.request(`/repos/${this.getRepoPath()}/git/refs`, { - method: 'POST', - data: { - ref: `refs/tags/${bumpedTag}`, - sha: tagObjectResponse.sha, + await octokit.request( + `/repos/${this.getRepoPath({ owner, repo })}/git/refs`, + { + method: 'POST', + data: { + ref: `refs/tags/${bumpedTag}`, + sha: tagObjectResponse.sha, + }, }, - }) + ) ).data; return { reference }; }, updateRelease: async ({ + owner, + repo, bumpedTag, latestRelease, tagParts, @@ -405,12 +605,14 @@ export class PluginApiClient { latestRelease: GhGetReleaseResponse; tagParts: SemverTagParts | CalverTagParts; selectedPatchCommit: GhGetCommitResponse; - }) => { + } & PartialProject) => { const { octokit } = await this.getOctokit(); const release: GhUpdateReleaseResponse = ( await octokit.request( - `/repos/${this.getRepoPath()}/releases/${latestRelease.id}`, + `/repos/${this.getRepoPath({ owner, repo })}/releases/${ + latestRelease.id + }`, { method: 'PATCH', data: { @@ -431,17 +633,19 @@ export class PluginApiClient { promoteRc = { promoteRelease: async ({ + owner, + repo, releaseId, releaseVersion, }: { releaseId: GhGetReleaseResponse['id']; releaseVersion: string; - }) => { + } & PartialProject) => { const { octokit } = await this.getOctokit(); const release: GhGetReleaseResponse = ( await octokit.request( - `/repos/${this.getRepoPath()}/releases/${releaseId}`, + `/repos/${this.getRepoPath({ owner, repo })}/releases/${releaseId}`, { method: 'PATCH', data: { diff --git a/plugins/github-release-manager/src/api/serviceApiRef.ts b/plugins/github-release-manager/src/api/serviceApiRef.ts index ea5eb7fee3..4451dd8dc8 100644 --- a/plugins/github-release-manager/src/api/serviceApiRef.ts +++ b/plugins/github-release-manager/src/api/serviceApiRef.ts @@ -16,9 +16,9 @@ import { createApiRef } from '@backstage/core'; -import { PluginApiClient } from './PluginApiClient'; +import { IPluginApiClient } from './PluginApiClient'; -export const githubReleaseManagerApiRef = createApiRef({ +export const githubReleaseManagerApiRef = createApiRef({ id: 'plugin.github-release-manager.service', description: 'Used by the GitHub Release Manager plugin to make requests', }); diff --git a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx index c02fba01d5..2f2fb6963b 100644 --- a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx +++ b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx @@ -35,19 +35,18 @@ import { GhGetBranchResponse, GhGetReleaseResponse, GhGetRepositoryResponse, - Project, SetRefetch, } from '../../types/types'; import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; -import { useStyles } from '../../styles/styles'; -import { usePluginApiClientContext } from '../../components/ProjectContext'; import { SEMVER_PARTS } from '../../constants/constants'; import { TEST_IDS } from '../../test-helpers/test-ids'; +import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; +import { useProjectContext } from '../../contexts/ProjectContext'; +import { useStyles } from '../../styles/styles'; interface CreateRcProps { defaultBranch: GhGetRepositoryResponse['default_branch']; latestRelease: GhGetReleaseResponse | null; - project: Project; releaseBranch: GhGetBranchResponse | null; setRefetch: SetRefetch; successCb?: ComponentConfigCreateRc['successCb']; @@ -56,12 +55,12 @@ interface CreateRcProps { export const CreateRc = ({ defaultBranch, latestRelease, - project, releaseBranch, setRefetch, successCb, }: CreateRcProps) => { const pluginApiClient = usePluginApiClientContext(); + const project = useProjectContext(); const classes = useStyles(); const [semverBumpLevel, setSemverBumpLevel] = useState<'major' | 'minor'>( @@ -80,10 +79,11 @@ export const CreateRc = ({ const [createGitHubReleaseResponse, createGitHubReleaseFn] = useAsyncFn( (...args) => createRc({ - pluginApiClient, defaultBranch, latestRelease, nextGitHubInfo: args[0], + pluginApiClient, + project, successCb, }), ); diff --git a/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.ts b/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.ts index b507f84b20..cd2140296f 100644 --- a/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.ts +++ b/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.ts @@ -18,8 +18,9 @@ import { DateTime } from 'luxon'; import { getBumpedSemverTagParts } from '../../helpers/getBumpedTag'; import { getSemverTagParts } from '../../helpers/tagParts/getSemverTagParts'; -import { Project, GhGetReleaseResponse } from '../../types/types'; +import { GhGetReleaseResponse } from '../../types/types'; import { SEMVER_PARTS } from '../../constants/constants'; +import { Project } from '../../contexts/ProjectContext'; export const getRcGitHubInfo = ({ project, diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts index 433ba8e40d..0f659fc994 100644 --- a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts +++ b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts @@ -24,20 +24,23 @@ import { } from '../../../types/types'; import { PluginApiClient } from '../../../api/PluginApiClient'; import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; +import { Project } from '../../../contexts/ProjectContext'; interface CreateRC { - pluginApiClient: PluginApiClient; defaultBranch: GhGetRepositoryResponse['default_branch']; latestRelease: GhGetReleaseResponse | null; nextGitHubInfo: ReturnType; + pluginApiClient: PluginApiClient; + project: Project; successCb?: ComponentConfigCreateRc['successCb']; } export async function createRc({ - pluginApiClient, defaultBranch, latestRelease, nextGitHubInfo, + pluginApiClient, + project, successCb, }: CreateRC) { const responseSteps: ResponseStep[] = []; @@ -46,6 +49,7 @@ export async function createRc({ * 1. Get the default branch's most recent commit */ const { latestCommit } = await pluginApiClient.getLatestCommit({ + ...project, defaultBranch, }); responseSteps.push({ @@ -62,6 +66,7 @@ export async function createRc({ try { createdRef = ( await pluginApiClient.createRc.createRef({ + ...project, mostRecentSha, targetBranch: nextGitHubInfo.rcBranch, }) @@ -87,6 +92,7 @@ export async function createRc({ : defaultBranch; const nextReleaseBranch = nextGitHubInfo.rcBranch; const { comparison } = await pluginApiClient.createRc.getComparison({ + ...project, previousReleaseBranch, nextReleaseBranch, }); @@ -111,6 +117,7 @@ export async function createRc({ const { createReleaseResponse, } = await pluginApiClient.createRc.createRelease({ + ...project, nextGitHubInfo: nextGitHubInfo, releaseBody, }); diff --git a/plugins/github-release-manager/src/cards/info/Info.tsx b/plugins/github-release-manager/src/cards/info/Info.tsx index f74065d78a..1f42c5b603 100644 --- a/plugins/github-release-manager/src/cards/info/Info.tsx +++ b/plugins/github-release-manager/src/cards/info/Info.tsx @@ -18,27 +18,20 @@ import React from 'react'; import { Link, Typography } from '@material-ui/core'; import { Differ } from '../../components/Differ'; +import { GhGetBranchResponse, GhGetReleaseResponse } from '../../types/types'; import { InfoCardPlus } from '../../components/InfoCardPlus'; -import { - GhGetBranchResponse, - GhGetReleaseResponse, - Project, -} from '../../types/types'; -import { useStyles } from '../../styles/styles'; import { TEST_IDS } from '../../test-helpers/test-ids'; +import { useProjectContext } from '../../contexts/ProjectContext'; +import { useStyles } from '../../styles/styles'; import flowImage from './flow.png'; interface InfoCardProps { releaseBranch: GhGetBranchResponse | null; latestRelease: GhGetReleaseResponse | null; - project: Project; } -export const Info = ({ - releaseBranch, - latestRelease, - project, -}: InfoCardProps) => { +export const Info = ({ releaseBranch, latestRelease }: InfoCardProps) => { + const project = useProjectContext(); const classes = useStyles(); return ( @@ -91,30 +84,9 @@ export const Info = ({ Repository:{' '} - + - {project.slack && ( - - Slack channel:{' '} - - #{project.slack.channel} - - ) : ( - <>(#{project.slack.channel}) - ) - } - /> - - )} - Versioning strategy:{' '} diff --git a/plugins/github-release-manager/src/cards/patchRc/Patch.tsx b/plugins/github-release-manager/src/cards/patchRc/Patch.tsx index 2bc4ebf652..e0c1be7a24 100644 --- a/plugins/github-release-manager/src/cards/patchRc/Patch.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/Patch.tsx @@ -24,15 +24,14 @@ import { ComponentConfigPatch, GhGetBranchResponse, GhGetReleaseResponse, - Project, SetRefetch, } from '../../types/types'; -import { useStyles } from '../../styles/styles'; import { PatchBody } from './PatchBody'; +import { useProjectContext } from '../../contexts/ProjectContext'; +import { useStyles } from '../../styles/styles'; interface PatchProps { latestRelease: GhGetReleaseResponse | null; - project: Project; releaseBranch: GhGetBranchResponse | null; setRefetch: SetRefetch; successCb?: ComponentConfigPatch['successCb']; @@ -40,11 +39,11 @@ interface PatchProps { export const Patch = ({ latestRelease, - project, releaseBranch, setRefetch, successCb, }: PatchProps) => { + const project = useProjectContext(); const classes = useStyles(); function Body() { diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx index 5f14286ed3..22edde9ad9 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx @@ -45,10 +45,11 @@ import { import { CalverTagParts } from '../../helpers/tagParts/getCalverTagParts'; import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; import { SemverTagParts } from '../../helpers/tagParts/getSemverTagParts'; -import { usePluginApiClientContext } from '../../components/ProjectContext'; +import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; import { useStyles } from '../../styles/styles'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { patch } from './sideEffects/patch'; +import { useProjectContext } from '../../contexts/ProjectContext'; interface PatchBodyProps { bumpedTag: string; @@ -68,6 +69,7 @@ export const PatchBody = ({ tagParts, }: PatchBodyProps) => { const pluginApiClient = usePluginApiClientContext(); + const project = useProjectContext(); const [checkedCommitIndex, setCheckedCommitIndex] = useState(-1); const githubDataResponse = useAsync(async () => { @@ -75,13 +77,17 @@ export const PatchBody = ({ { branch: releaseBranchResponse }, { recentCommits }, ] = await Promise.all([ - pluginApiClient.getBranch({ branchName: latestRelease.target_commitish }), - pluginApiClient.getRecentCommits(), + pluginApiClient.getBranch({ + ...project, + branchName: latestRelease.target_commitish, + }), + pluginApiClient.getRecentCommits({ ...project }), ]); const { recentCommits: recentReleaseBranchCommits, } = await pluginApiClient.getRecentCommits({ + ...project, releaseBranchName: releaseBranchResponse.name, }); @@ -95,6 +101,7 @@ export const PatchBody = ({ const [patchReleaseResponse, patchReleaseFn] = useAsyncFn(async (...args) => { const selectedPatchCommit: GhGetCommitResponse = args[0]; const patchResponseSteps = await patch({ + project, pluginApiClient, bumpedTag, latestRelease, @@ -232,7 +239,9 @@ export const PatchBody = ({ aria-label="commit" disabled={commitExistsOnReleaseBranch || !releaseBranch} onClick={() => { - const repoPath = pluginApiClient.getRepoPath(); + const repoPath = pluginApiClient.getRepoPath({ + ...project, + }); const host = pluginApiClient.getHost(); const newTab = window.open( diff --git a/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.ts b/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.ts index 1c97a8f0f6..de24b5b142 100644 --- a/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.ts +++ b/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.ts @@ -24,11 +24,13 @@ import { CalverTagParts } from '../../../helpers/tagParts/getCalverTagParts'; import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; import { PluginApiClient } from '../../../api/PluginApiClient'; import { SemverTagParts } from '../../../helpers/tagParts/getSemverTagParts'; +import { Project } from '../../../contexts/ProjectContext'; interface Patch { - pluginApiClient: PluginApiClient; bumpedTag: string; latestRelease: GhGetReleaseResponse; + pluginApiClient: PluginApiClient; + project: Project; selectedPatchCommit: GhGetCommitResponse; successCb?: ComponentConfigPatch['successCb']; tagParts: NonNullable; @@ -36,9 +38,10 @@ interface Patch { // Inspo: https://stackoverflow.com/questions/53859199/how-to-cherry-pick-through-githubs-api export async function patch({ - pluginApiClient, bumpedTag, latestRelease, + pluginApiClient, + project, selectedPatchCommit, successCb, tagParts, @@ -57,6 +60,7 @@ export async function patch({ * > branchTree = branch.commit.commit.tree.sha */ const { branch: releaseBranch } = await pluginApiClient.getBranch({ + ...project, branchName: releaseBranchName, }); const releaseBranchSha = releaseBranch.commit.sha; @@ -73,6 +77,7 @@ export async function patch({ * > tempCommit = POST /repos/$owner/$repo/git/commits { "message": "temp", "tree": branchTree, "parents": [parentSha] } */ const { tempCommit } = await pluginApiClient.patch.createTempCommit({ + ...project, releaseBranchTree, selectedPatchCommit, tagParts, @@ -87,6 +92,7 @@ export async function patch({ * > PATCH /repos/$owner/$repo/git/refs/heads/$refName { sha = tempCommit.sha, force = true } */ await pluginApiClient.patch.forceBranchHeadToTempCommit({ + ...project, tempCommit, releaseBranchName, }); @@ -96,6 +102,7 @@ export async function patch({ * > merge = POST /repos/$owner/$repo/merges { "base": branchName, "head": commit.sha } */ const { merge } = await pluginApiClient.patch.merge({ + ...project, base: releaseBranchName, head: selectedPatchCommit.sha, }); @@ -119,6 +126,7 @@ export async function patch({ const { cherryPickCommit, } = await pluginApiClient.patch.createCherryPickCommit({ + ...project, bumpedTag, mergeTree, releaseBranchSha, @@ -134,6 +142,7 @@ export async function patch({ * > PATCH /repos/$owner/$repo/git/refs/heads/$refName { sha = cherry.sha, force = true } */ const { updatedReference } = await pluginApiClient.patch.replaceTempCommit({ + ...project, cherryPickCommit, releaseBranchName, }); @@ -146,6 +155,7 @@ export async function patch({ * > POST /repos/:owner/:repo/git/tags */ const { tagObjectResponse } = await pluginApiClient.patch.createTagObject({ + ...project, bumpedTag, updatedReference, }); @@ -159,6 +169,7 @@ export async function patch({ * > POST /repos/:owner/:repo/git/refs */ const { reference } = await pluginApiClient.patch.createReference({ + ...project, bumpedTag, tagObjectResponse, }); @@ -170,14 +181,15 @@ export async function patch({ /** * 9. Update release */ - const { release: updatedRelease } = await pluginApiClient.patch.updateRelease( - { - bumpedTag, - latestRelease, - selectedPatchCommit, - tagParts, - }, - ); + const { + release: updatedRelease, + } = await pluginApiClient.patch.updateRelease({ + ...project, + bumpedTag, + latestRelease, + selectedPatchCommit, + tagParts, + }); responseSteps.push({ message: `Updated release "${updatedRelease.name}"`, secondaryMessage: `with tag ${updatedRelease.tag_name}`, diff --git a/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx b/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx index ef9a67d89f..7b20845c92 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx +++ b/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx @@ -15,9 +15,9 @@ */ import React from 'react'; +import { useAsyncFn } from 'react-use'; import { Alert } from '@material-ui/lab'; import { Button, Typography } from '@material-ui/core'; -import { useAsyncFn } from 'react-use'; import { Differ } from '../../components/Differ'; import { @@ -27,9 +27,10 @@ import { } from '../../types/types'; import { promoteRc } from './sideEffects/promoteRc'; import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; -import { usePluginApiClientContext } from '../../components/ProjectContext'; -import { useStyles } from '../../styles/styles'; import { TEST_IDS } from '../../test-helpers/test-ids'; +import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; +import { useProjectContext } from '../../contexts/ProjectContext'; +import { useStyles } from '../../styles/styles'; interface PromoteRcBodyProps { rcRelease: GhGetReleaseResponse; @@ -43,11 +44,13 @@ export const PromoteRcBody = ({ successCb, }: PromoteRcBodyProps) => { const pluginApiClient = usePluginApiClientContext(); + const project = useProjectContext(); const classes = useStyles(); const releaseVersion = rcRelease.tag_name.replace('rc-', 'version-'); const [promoteGitHubRcResponse, promoseGitHubRcFn] = useAsyncFn( promoteRc({ pluginApiClient, + project, rcRelease, releaseVersion, successCb, diff --git a/plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.ts b/plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.ts index e27f26289a..0d38b53fba 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.ts +++ b/plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.ts @@ -20,9 +20,11 @@ import { ResponseStep, } from '../../../types/types'; import { PluginApiClient } from '../../../api/PluginApiClient'; +import { Project } from '../../../contexts/ProjectContext'; interface PromoteRc { pluginApiClient: PluginApiClient; + project: Project; rcRelease: GhGetReleaseResponse; releaseVersion: string; successCb?: ComponentConfigPromoteRc['successCb']; @@ -30,6 +32,7 @@ interface PromoteRc { export function promoteRc({ pluginApiClient, + project, rcRelease, releaseVersion, successCb, @@ -38,6 +41,7 @@ export function promoteRc({ const responseSteps: ResponseStep[] = []; const { release } = await pluginApiClient.promoteRc.promoteRelease({ + ...project, releaseId: rcRelease.id, releaseVersion, }); diff --git a/plugins/github-release-manager/src/components/ProjectContext.ts b/plugins/github-release-manager/src/contexts/PluginApiClientContext.ts similarity index 100% rename from plugins/github-release-manager/src/components/ProjectContext.ts rename to plugins/github-release-manager/src/contexts/PluginApiClientContext.ts diff --git a/plugins/github-release-manager/src/contexts/ProjectContext.ts b/plugins/github-release-manager/src/contexts/ProjectContext.ts new file mode 100644 index 0000000000..8e4e8df0ae --- /dev/null +++ b/plugins/github-release-manager/src/contexts/ProjectContext.ts @@ -0,0 +1,55 @@ +/* + * 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 { createContext, useContext } from 'react'; + +import { GitHubReleaseManagerError } from '../errors/GitHubReleaseManagerError'; + +export interface Project { + /** + * Repository's owner (user or organisation) + * + * @example erikengervall + */ + owner: string; + /** + * Repository's name + * + * @example dockest + */ + repo: string; + /** + * Declares the versioning strategy of the project + * + * semver: `1.2.3` (major.minor.patch) + * calver: `2020.01.01_0` (YYYY.0M.0D_patch) + * + * Default: false + */ + versioningStrategy: 'calver' | 'semver'; +} + +export const ProjectContext = createContext(undefined); + +export const useProjectContext = () => { + const project = useContext(ProjectContext); + + if (!project) { + throw new GitHubReleaseManagerError('project not found'); + } + + return project; +}; diff --git a/plugins/github-release-manager/src/helpers/getBumpedTag.ts b/plugins/github-release-manager/src/helpers/getBumpedTag.ts index 7e2ebadd35..5409f7d2b3 100644 --- a/plugins/github-release-manager/src/helpers/getBumpedTag.ts +++ b/plugins/github-release-manager/src/helpers/getBumpedTag.ts @@ -17,7 +17,7 @@ import { CalverTagParts } from './tagParts/getCalverTagParts'; import { getTagParts } from './tagParts/getTagParts'; import { isCalverTagParts } from './isCalverTagParts'; -import { Project } from '../types/types'; +import { Project } from '../contexts/ProjectContext'; import { SEMVER_PARTS } from '../constants/constants'; import { SemverTagParts } from './tagParts/getSemverTagParts'; diff --git a/plugins/github-release-manager/src/sideEffects/getGitHubBatchInfo.ts b/plugins/github-release-manager/src/sideEffects/getGitHubBatchInfo.ts index 9c7a220ea1..8a1bec9165 100644 --- a/plugins/github-release-manager/src/sideEffects/getGitHubBatchInfo.ts +++ b/plugins/github-release-manager/src/sideEffects/getGitHubBatchInfo.ts @@ -14,19 +14,22 @@ * limitations under the License. */ -import { PluginApiClient } from '../api/PluginApiClient'; import { getLatestRelease } from './getLatestRelease'; +import { PluginApiClient } from '../api/PluginApiClient'; +import { Project } from '../contexts/ProjectContext'; interface GetGitHubBatchInfo { + project: Project; pluginApiClient: PluginApiClient; } export const getGitHubBatchInfo = ({ + project, pluginApiClient, }: GetGitHubBatchInfo) => async () => { const [{ repository }, latestRelease] = await Promise.all([ - pluginApiClient.getRepository(), - getLatestRelease({ pluginApiClient }), + pluginApiClient.getRepository({ ...project }), + getLatestRelease({ project, pluginApiClient }), ]); if (latestRelease === null) { @@ -38,6 +41,7 @@ export const getGitHubBatchInfo = ({ } const { branch } = await pluginApiClient.getBranch({ + ...project, branchName: latestRelease.target_commitish, }); diff --git a/plugins/github-release-manager/src/sideEffects/getLatestRelease.ts b/plugins/github-release-manager/src/sideEffects/getLatestRelease.ts index 9d3ebf647d..ef609cfd5e 100644 --- a/plugins/github-release-manager/src/sideEffects/getLatestRelease.ts +++ b/plugins/github-release-manager/src/sideEffects/getLatestRelease.ts @@ -15,19 +15,25 @@ */ import { PluginApiClient } from '../api/PluginApiClient'; +import { Project } from '../contexts/ProjectContext'; interface GetLatestRelease { pluginApiClient: PluginApiClient; + project: Project; } -export async function getLatestRelease({ pluginApiClient }: GetLatestRelease) { - const { releases } = await pluginApiClient.getReleases(); +export async function getLatestRelease({ + pluginApiClient, + project, +}: GetLatestRelease) { + const { releases } = await pluginApiClient.getReleases({ ...project }); if (releases.length === 0) { return null; } const { latestRelease } = await pluginApiClient.getRelease({ + ...project, releaseId: releases[0].id, }); diff --git a/plugins/github-release-manager/src/types/types.ts b/plugins/github-release-manager/src/types/types.ts index 6eafd8f797..be0fa6169b 100644 --- a/plugins/github-release-manager/src/types/types.ts +++ b/plugins/github-release-manager/src/types/types.ts @@ -14,44 +14,31 @@ * limitations under the License. */ -export interface Project { - /** A unique (in the context of GitHub Release Manager) project name */ - name: string; +// export interface Project { +// /** +// * Repository's owner (user or organisation) +// * +// * @example erikengervall +// */ +// owner: string; - /** GitHub details */ - github: { - /** - * Repository's organization - * - * @example erikengervall - */ - org: string; - /** - * Repository's name - * - * @example dockest - */ - repo: string; - }; +// /** +// * Repository's name +// * +// * @example dockest +// */ +// repo: string; - /** Slack details */ - slack?: { - /** Relevant slack channel for the project */ - channel: string; - /** Link to slack channel */ - link?: string; - }; - - /** - * Declares the versioning strategy of the project - * - * semver: `1.2.3` (major.minor.patch) - * calver: `2020.01.01_0` (YYYY.0M.0D_patch) - * - * Default: false - */ - versioningStrategy: 'calver' | 'semver'; -} +// /** +// * Declares the versioning strategy of the project +// * +// * semver: `1.2.3` (major.minor.patch) +// * calver: `2020.01.01_0` (YYYY.0M.0D_patch) +// * +// * Default: false +// */ +// versioningStrategy: 'calver' | 'semver'; +// } interface ComponentConfig { successCb?: (args: Args) => Promise | void; From 6691570ec105091326e7696590dc903ef04b9439 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Wed, 14 Apr 2021 23:20:42 +0200 Subject: [PATCH 023/485] Replace root component props with input fields Signed-off-by: Erik Engervall --- plugins/github-release-manager/package.json | 1 + .../src/GitHubReleaseManager.tsx | 135 ++++++++++-------- .../src/api/PluginApiClient.ts | 49 ++++++- .../src/cards/patchRc/PatchBody.tsx | 4 +- .../src/cards/projectForm/Owner.tsx | 85 +++++++++++ .../src/cards/projectForm/Repo.tsx | 90 ++++++++++++ .../src/cards/projectForm/RepoDetailsForm.tsx | 66 +++++++++ .../cards/projectForm/VersioningStrategy.tsx | 62 ++++++++ .../src/cards/projectForm/isProjectValid.tsx | 25 ++++ .../src/cards/projectForm/styles.ts | 29 ++++ .../components/CenteredCircularProgress.tsx | 26 ++++ .../ResponseStepList/ResponseStepList.tsx | 4 +- .../src/helpers/tagParts/getCalverTagParts.ts | 6 +- .../src/helpers/tagParts/getSemverTagParts.ts | 5 + .../src/helpers/tagParts/getTagParts.test.ts | 8 ++ 15 files changed, 526 insertions(+), 69 deletions(-) create mode 100644 plugins/github-release-manager/src/cards/projectForm/Owner.tsx create mode 100644 plugins/github-release-manager/src/cards/projectForm/Repo.tsx create mode 100644 plugins/github-release-manager/src/cards/projectForm/RepoDetailsForm.tsx create mode 100644 plugins/github-release-manager/src/cards/projectForm/VersioningStrategy.tsx create mode 100644 plugins/github-release-manager/src/cards/projectForm/isProjectValid.tsx create mode 100644 plugins/github-release-manager/src/cards/projectForm/styles.ts create mode 100644 plugins/github-release-manager/src/components/CenteredCircularProgress.tsx diff --git a/plugins/github-release-manager/package.json b/plugins/github-release-manager/package.json index 5eebc11105..ec067920e4 100644 --- a/plugins/github-release-manager/package.json +++ b/plugins/github-release-manager/package.json @@ -29,6 +29,7 @@ "@octokit/rest": "^18.0.12", "luxon": "^1.26.0", "react-dom": "^16.13.1", + "react-hook-form": "^6.6.0", "react-router": "6.0.0-beta.0", "react-use": "^15.3.3", "react": "^16.13.1" diff --git a/plugins/github-release-manager/src/GitHubReleaseManager.tsx b/plugins/github-release-manager/src/GitHubReleaseManager.tsx index 83ccab5dd1..3f7887ad53 100644 --- a/plugins/github-release-manager/src/GitHubReleaseManager.tsx +++ b/plugins/github-release-manager/src/GitHubReleaseManager.tsx @@ -15,10 +15,11 @@ */ import { Alert } from '@material-ui/lab'; -import { CircularProgress, makeStyles } from '@material-ui/core'; +import { makeStyles } from '@material-ui/core'; import { useAsync } from 'react-use'; -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { useApi, ContentHeader, ErrorBoundary } from '@backstage/core'; +import { useForm } from 'react-hook-form'; import { CreateRc } from './cards/createRc/CreateRc'; import { getGitHubBatchInfo } from './sideEffects/getGitHubBatchInfo'; @@ -35,11 +36,11 @@ import { PluginApiClientContext, usePluginApiClientContext, } from './contexts/PluginApiClientContext'; -import { - ProjectContext, - useProjectContext, - Project, -} from './contexts/ProjectContext'; +import { ProjectContext, Project } from './contexts/ProjectContext'; +import { isProjectValid } from './cards/projectForm/isProjectValid'; +import { InfoCardPlus } from './components/InfoCardPlus'; +import { RepoDetailsForm } from './cards/projectForm/RepoDetailsForm'; +import { CenteredCircularProgress } from './components/CenteredCircularProgress'; interface GitHubReleaseManagerProps { components?: { @@ -62,30 +63,54 @@ export function GitHubReleaseManager({ }: GitHubReleaseManagerProps) { const pluginApiClient = useApi(githubReleaseManagerApiRef); const classes = useStyles(); + const usernameResponse = useAsync(() => pluginApiClient.getUsername()); + const { control, watch } = useForm(); + const project: Project = watch('repo-details-form'); - const project: Project = { - owner: 'erikengervall', - repo: 'playground', - versioningStrategy: 'semver', - }; + if (usernameResponse.error) { + return {usernameResponse.error.message}; + } + + if (usernameResponse.loading) { + return ; + } + + if (!usernameResponse.value?.username) { + return Unable to retrieve username; + } return ( - - {/* @ts-ignore-error TODO: Update interface for PluginApiClient */} - -
- + +
+ - -
-
- + + + + + {isProjectValid(project) && ( + + )} +
+
); } -function Cards({ components }: GitHubReleaseManagerProps) { +function Cards({ + components, + project, +}: { + components: GitHubReleaseManagerProps['components']; + project: Project; +}) { const pluginApiClient = usePluginApiClientContext(); - const project = useProjectContext(); const [refetch, setRefetch] = useState(0); const gitHubBatchInfo = useAsync( getGitHubBatchInfo({ project, pluginApiClient }), @@ -97,11 +122,7 @@ function Cards({ components }: GitHubReleaseManagerProps) { } if (gitHubBatchInfo.loading) { - return ( -
- -
- ); + return ; } if (gitHubBatchInfo.value === undefined) { @@ -120,38 +141,40 @@ function Cards({ components }: GitHubReleaseManagerProps) { } return ( - - - - {components?.default?.createRc?.omit !== true && ( - + + - )} - {components?.default?.promoteRc?.omit !== true && ( - - )} + {components?.default?.createRc?.omit !== true && ( + + )} - {components?.default?.patch?.omit !== true && ( - - )} - + {components?.default?.promoteRc?.omit !== true && ( + + )} + + {components?.default?.patch?.omit !== true && ( + + )} + +
); } diff --git a/plugins/github-release-manager/src/api/PluginApiClient.ts b/plugins/github-release-manager/src/api/PluginApiClient.ts index 0615221c77..c0a6476b2b 100644 --- a/plugins/github-release-manager/src/api/PluginApiClient.ts +++ b/plugins/github-release-manager/src/api/PluginApiClient.ts @@ -157,10 +157,13 @@ export interface IPluginApiClient { } & PartialProject, ) => Promise; }; + + getOrganizations: (args: { ownerIsUser: boolean }) => Promise; + getUsername: () => Promise<{ username: string }>; + getRepositories: (args: { owner: string; username: string }) => Promise; } export class PluginApiClient implements IPluginApiClient { - // private readonly getAccessToken: any; private readonly githubAuthApi: OAuthApi; private readonly baseUrl: string; readonly host: string; @@ -174,8 +177,6 @@ export class PluginApiClient implements IPluginApiClient { }) { this.githubAuthApi = githubAuthApi; - // this.getAccessToken = () => this.githubAuthApi.getAccessToken(); - const githubIntegrationConfig = this.getGithubIntegrationConfig({ configApi, }); @@ -190,11 +191,13 @@ export class PluginApiClient implements IPluginApiClient { configApi.getOptionalConfigArray('integrations.github') ?? [], ); - const githubIntegrationConfig = configs.find( - v => v.host === 'github.com' || v.host.startsWith('ghe.'), + const githubIntegrationEnterpriseConfig = configs.find(v => + v.host.startsWith('ghe.'), ); + const githubIntegrationConfig = configs.find(v => v.host === 'github.com'); - return githubIntegrationConfig; + // Prioritize enterprise configs if available + return githubIntegrationEnterpriseConfig ?? githubIntegrationConfig; } private async getOctokit() { @@ -216,6 +219,40 @@ export class PluginApiClient implements IPluginApiClient { return `${owner}/${repo}`; } + async getOrganizations() { + const { octokit } = await this.getOctokit(); + const { data: orgs } = await octokit.orgs.listForAuthenticatedUser(); + + return { orgs }; + } + + async getRepositories({ + owner, + username, + }: { + owner: string; + username: string; + }) { + const { octokit } = await this.getOctokit(); + + if (owner === username) { + const { data: repos } = await octokit.repos.listForUser({ username }); + + return { repos }; + } + + const { data: repos } = await octokit.repos.listForOrg({ org: owner }); + + return { repos }; + } + + async getUsername() { + const { octokit } = await this.getOctokit(); + const { data: user } = await octokit.users.getAuthenticated(); + + return { username: user.login }; + } + async getRecentCommits({ owner, repo, diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx index 22edde9ad9..7eea133827 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx @@ -20,7 +20,6 @@ import { useAsync, useAsyncFn } from 'react-use'; import { Button, Checkbox, - CircularProgress, IconButton, Link, List, @@ -50,6 +49,7 @@ import { useStyles } from '../../styles/styles'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { patch } from './sideEffects/patch'; import { useProjectContext } from '../../contexts/ProjectContext'; +import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; interface PatchBodyProps { bumpedTag: string; @@ -124,7 +124,7 @@ export const PatchBody = ({ return {patchReleaseResponse.error.message}; } if (githubDataResponse.loading) { - return ; + return ; } function Description() { diff --git a/plugins/github-release-manager/src/cards/projectForm/Owner.tsx b/plugins/github-release-manager/src/cards/projectForm/Owner.tsx new file mode 100644 index 0000000000..f95d66159f --- /dev/null +++ b/plugins/github-release-manager/src/cards/projectForm/Owner.tsx @@ -0,0 +1,85 @@ +/* + * 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 React from 'react'; +import { useAsync } from 'react-use'; +import { ControllerRenderProps } from 'react-hook-form'; +import { Alert } from '@material-ui/lab'; +import { FormControl, InputLabel, MenuItem, Select } from '@material-ui/core'; + +import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; +import { useFormClasses } from './styles'; +import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; +import { Project } from '../../contexts/ProjectContext'; + +export function Owner({ + controllerRenderProps, + username, +}: { + controllerRenderProps: ControllerRenderProps; + username: string; +}) { + const pluginApiClient = usePluginApiClientContext(); + const formClasses = useFormClasses(); + const project: Project = controllerRenderProps.value; + + const { loading, error, value } = useAsync(() => + pluginApiClient.getOrganizations(), + ); + + if (error) { + return {error.message}; + } + + if (loading) { + return ; + } + + if (!value?.orgs) { + return Could not fetch organizations; + } + + return ( + + Organizations + + + ); +} diff --git a/plugins/github-release-manager/src/cards/projectForm/Repo.tsx b/plugins/github-release-manager/src/cards/projectForm/Repo.tsx new file mode 100644 index 0000000000..9c83c30565 --- /dev/null +++ b/plugins/github-release-manager/src/cards/projectForm/Repo.tsx @@ -0,0 +1,90 @@ +/* + * 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 React from 'react'; +import { useAsync } from 'react-use'; +import { FormControl, InputLabel, Select, MenuItem } from '@material-ui/core'; +import { Alert } from '@material-ui/lab'; +import { ControllerRenderProps, useForm } from 'react-hook-form'; + +import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; +import { useFormClasses } from './styles'; +import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; +import { Project } from '../../contexts/ProjectContext'; + +export function Repo({ + username, + controllerRenderProps, +}: { + username: string; + controllerRenderProps: ControllerRenderProps; +}) { + const pluginApiClient = usePluginApiClientContext(); + const formClasses = useFormClasses(); + const project: Project = controllerRenderProps.value; + + const { loading, error, value } = useAsync( + () => + pluginApiClient.getRepositories({ + owner: project.owner, + username, + }), + [project.owner], + ); + + if (error) { + return {error.message}; + } + + if (loading) { + return ; + } + + if (!value?.repos) { + return ( + + Could not fetch repositories for "{project.owner}" + + ); + } + + return ( + + Repositories + + + ); +} diff --git a/plugins/github-release-manager/src/cards/projectForm/RepoDetailsForm.tsx b/plugins/github-release-manager/src/cards/projectForm/RepoDetailsForm.tsx new file mode 100644 index 0000000000..03996b484d --- /dev/null +++ b/plugins/github-release-manager/src/cards/projectForm/RepoDetailsForm.tsx @@ -0,0 +1,66 @@ +/* + * 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 React from 'react'; +import { Controller, useForm } from 'react-hook-form'; +import { Project } from '../../contexts/ProjectContext'; + +import { VersioningStrategy } from './VersioningStrategy'; +import { Owner } from './Owner'; +import { Repo } from './Repo'; + +export function RepoDetailsForm({ + control, + username, +}: { + control: ReturnType['control']; + username: string; +}) { + return ( + { + const project: Project = controllerRenderProps.value; + + return ( + <> + + + + + {project.owner.length > 0 && ( + + )} + + ); + }} + control={control} + name="repo-details-form" + defaultValue={ + { + owner: '', + repo: '', + versioningStrategy: 'semver', + } as Project + } + /> + ); +} diff --git a/plugins/github-release-manager/src/cards/projectForm/VersioningStrategy.tsx b/plugins/github-release-manager/src/cards/projectForm/VersioningStrategy.tsx new file mode 100644 index 0000000000..b6fa367b00 --- /dev/null +++ b/plugins/github-release-manager/src/cards/projectForm/VersioningStrategy.tsx @@ -0,0 +1,62 @@ +/* + * 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 { + FormControl, + FormControlLabel, + FormLabel, + Radio, + RadioGroup, +} from '@material-ui/core'; +import React from 'react'; +import { ControllerRenderProps } from 'react-hook-form'; +import { Project } from '../../contexts/ProjectContext'; + +export function VersioningStrategy({ + controllerRenderProps, +}: { + controllerRenderProps: ControllerRenderProps; +}) { + const project: Project = controllerRenderProps.value; + + return ( + + Calendar strategy + { + controllerRenderProps.onChange({ + ...project, + versioningStrategy: event.target.value, + } as Project); + }} + > + } + label="Semantic versioning" + /> + } + label="Calendar versioning" + /> + + + ); +} diff --git a/plugins/github-release-manager/src/cards/projectForm/isProjectValid.tsx b/plugins/github-release-manager/src/cards/projectForm/isProjectValid.tsx new file mode 100644 index 0000000000..dd6e9871bb --- /dev/null +++ b/plugins/github-release-manager/src/cards/projectForm/isProjectValid.tsx @@ -0,0 +1,25 @@ +/* + * 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 { Project } from '../../contexts/ProjectContext'; + +export function isProjectValid(project: any): project is Project { + return ( + project?.owner?.length > 0 && + project?.repo?.length > 0 && + project?.versioningStrategy?.length > 0 + ); +} diff --git a/plugins/github-release-manager/src/cards/projectForm/styles.ts b/plugins/github-release-manager/src/cards/projectForm/styles.ts new file mode 100644 index 0000000000..274d0523ac --- /dev/null +++ b/plugins/github-release-manager/src/cards/projectForm/styles.ts @@ -0,0 +1,29 @@ +/* + * 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 { createStyles, makeStyles, Theme } from '@material-ui/core'; + +export const useFormClasses = makeStyles((theme: Theme) => + createStyles({ + formControl: { + margin: theme.spacing(1), + minWidth: 120, + }, + selectEmpty: { + marginTop: theme.spacing(2), + }, + }), +); diff --git a/plugins/github-release-manager/src/components/CenteredCircularProgress.tsx b/plugins/github-release-manager/src/components/CenteredCircularProgress.tsx new file mode 100644 index 0000000000..83b6314021 --- /dev/null +++ b/plugins/github-release-manager/src/components/CenteredCircularProgress.tsx @@ -0,0 +1,26 @@ +/* + * 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 React from 'react'; +import { CircularProgress } from '@material-ui/core'; + +export const CenteredCircularProgress = () => { + return ( +
+ +
+ ); +}; diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx index ab545153f7..29b8b13dac 100644 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx @@ -17,7 +17,6 @@ import React, { PropsWithChildren } from 'react'; import { List, - CircularProgress, Button, Dialog, DialogActions, @@ -28,6 +27,7 @@ import { import { ResponseStep, SetRefetch } from '../../types/types'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { ResponseStepListItem } from './ResponseStepListItem'; +import { CenteredCircularProgress } from '../CenteredCircularProgress'; interface ResponseStepListProps { responseSteps?: ResponseStep[]; @@ -68,7 +68,7 @@ export const ResponseStepList = ({ {loading || !responseSteps ? (
-
diff --git a/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.ts b/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.ts index 27fe59844a..0fdd31444e 100644 --- a/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.ts +++ b/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.ts @@ -22,10 +22,10 @@ export type CalverTagParts = { patch: number; }; +export const calverRegexp = /(rc|version)-([0-9]{4}\.[0-9]{2}\.[0-9]{2})_([0-9]+)/; + export function getCalverTagParts(tag: string) { - const result = tag.match( - /(rc|version)-([0-9]{4}\.[0-9]{2}\.[0-9]{2})_([0-9]+)/, - ); + const result = tag.match(calverRegexp); if (result === null || result.length < 4) { throw new GitHubReleaseManagerError('Invalid calver tag'); diff --git a/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.ts b/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.ts index eabf1c0a7e..018dedcee0 100644 --- a/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.ts +++ b/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.ts @@ -15,6 +15,7 @@ */ import { GitHubReleaseManagerError } from '../../errors/GitHubReleaseManagerError'; +import { calverRegexp } from './getCalverTagParts'; export type SemverTagParts = { prefix: string; @@ -30,6 +31,10 @@ export function getSemverTagParts(tag: string) { throw new GitHubReleaseManagerError('Invalid semver tag'); } + if (tag.match(calverRegexp)) { + throw new GitHubReleaseManagerError('Invalid semver tag, found calver'); + } + const tagParts: SemverTagParts = { prefix: result[1], major: parseInt(result[2], 10), diff --git a/plugins/github-release-manager/src/helpers/tagParts/getTagParts.test.ts b/plugins/github-release-manager/src/helpers/tagParts/getTagParts.test.ts index 7493887d15..91a753dbe3 100644 --- a/plugins/github-release-manager/src/helpers/tagParts/getTagParts.test.ts +++ b/plugins/github-release-manager/src/helpers/tagParts/getTagParts.test.ts @@ -109,5 +109,13 @@ describe('getTagParts', () => { getTagParts({ project: mockSemverProject, tag: 'rc-1.2' }), ).toThrowErrorMatchingInlineSnapshot(`"Invalid semver tag"`); }); + + it('should throw for invalid semver (founds calver)', () => { + expect(() => + getTagParts({ project: mockSemverProject, tag: 'rc-1337.01.01_1' }), + ).toThrowErrorMatchingInlineSnapshot( + `"Invalid semver tag, found calver"`, + ); + }); }); }); From 39914e88ee6df2a01a624bf2aebf4e09c03203f8 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 15 Apr 2021 16:44:09 +0200 Subject: [PATCH 024/485] Introduce useVersioningStrategyMatchesRepoTags to validate versioningStratefy match at an earlier stage Signed-off-by: Erik Engervall --- .../src/GitHubReleaseManager.tsx | 22 ++++++-- .../src/api/PluginApiClient.ts | 3 +- .../src/cards/patchRc/sideEffects/patch.ts | 20 +++---- .../src/helpers/tagParts/getTagParts.ts | 2 +- .../useVersioningStrategyMatchesRepoTags.ts | 52 +++++++++++++++++++ .../github-release-manager/src/types/types.ts | 26 ---------- 6 files changed, 84 insertions(+), 41 deletions(-) create mode 100644 plugins/github-release-manager/src/helpers/useVersioningStrategyMatchesRepoTags.ts diff --git a/plugins/github-release-manager/src/GitHubReleaseManager.tsx b/plugins/github-release-manager/src/GitHubReleaseManager.tsx index 3f7887ad53..3876d2b3fc 100644 --- a/plugins/github-release-manager/src/GitHubReleaseManager.tsx +++ b/plugins/github-release-manager/src/GitHubReleaseManager.tsx @@ -14,12 +14,12 @@ * limitations under the License. */ +import React, { useState } from 'react'; +import { useAsync } from 'react-use'; +import { useForm } from 'react-hook-form'; import { Alert } from '@material-ui/lab'; import { makeStyles } from '@material-ui/core'; -import { useAsync } from 'react-use'; -import React, { useEffect, useState } from 'react'; import { useApi, ContentHeader, ErrorBoundary } from '@backstage/core'; -import { useForm } from 'react-hook-form'; import { CreateRc } from './cards/createRc/CreateRc'; import { getGitHubBatchInfo } from './sideEffects/getGitHubBatchInfo'; @@ -41,6 +41,7 @@ import { isProjectValid } from './cards/projectForm/isProjectValid'; import { InfoCardPlus } from './components/InfoCardPlus'; import { RepoDetailsForm } from './cards/projectForm/RepoDetailsForm'; import { CenteredCircularProgress } from './components/CenteredCircularProgress'; +import { useVersioningStrategyMatchesRepoTags } from './helpers/useVersioningStrategyMatchesRepoTags'; interface GitHubReleaseManagerProps { components?: { @@ -117,6 +118,12 @@ function Cards({ [project, refetch], ); + const { versioningStrategyMatches } = useVersioningStrategyMatchesRepoTags({ + latestReleaseTagName: gitHubBatchInfo.value?.latestRelease?.tag_name, + project, + repositoryName: gitHubBatchInfo.value?.repository.name, + }); + if (gitHubBatchInfo.error) { return {gitHubBatchInfo.error.message}; } @@ -140,6 +147,15 @@ function Cards({ ); } + if (!versioningStrategyMatches) { + return ( + + Versioning mismatch, expected {project.versioningStrategy} version, got{' '} + {gitHubBatchInfo.value?.latestRelease?.tag_name} + + ); + } + return ( diff --git a/plugins/github-release-manager/src/api/PluginApiClient.ts b/plugins/github-release-manager/src/api/PluginApiClient.ts index c0a6476b2b..24310ef688 100644 --- a/plugins/github-release-manager/src/api/PluginApiClient.ts +++ b/plugins/github-release-manager/src/api/PluginApiClient.ts @@ -304,7 +304,7 @@ export class PluginApiClient implements IPluginApiClient { const { octokit } = await this.getOctokit(); const { data: repository } = await octokit.repos.get({ - owner: owner, + owner, repo, }); @@ -312,6 +312,7 @@ export class PluginApiClient implements IPluginApiClient { repository: { pushPermissions: repository.permissions?.push, defaultBranch: repository.default_branch, + name: repository.name, }, }; } diff --git a/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.ts b/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.ts index de24b5b142..7bb0d5e6f0 100644 --- a/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.ts +++ b/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.ts @@ -23,8 +23,8 @@ import { import { CalverTagParts } from '../../../helpers/tagParts/getCalverTagParts'; import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; import { PluginApiClient } from '../../../api/PluginApiClient'; -import { SemverTagParts } from '../../../helpers/tagParts/getSemverTagParts'; import { Project } from '../../../contexts/ProjectContext'; +import { SemverTagParts } from '../../../helpers/tagParts/getSemverTagParts'; interface Patch { bumpedTag: string; @@ -181,15 +181,15 @@ export async function patch({ /** * 9. Update release */ - const { - release: updatedRelease, - } = await pluginApiClient.patch.updateRelease({ - ...project, - bumpedTag, - latestRelease, - selectedPatchCommit, - tagParts, - }); + const { release: updatedRelease } = await pluginApiClient.patch.updateRelease( + { + ...project, + bumpedTag, + latestRelease, + selectedPatchCommit, + tagParts, + }, + ); responseSteps.push({ message: `Updated release "${updatedRelease.name}"`, secondaryMessage: `with tag ${updatedRelease.tag_name}`, diff --git a/plugins/github-release-manager/src/helpers/tagParts/getTagParts.ts b/plugins/github-release-manager/src/helpers/tagParts/getTagParts.ts index ff42779d99..a3f8665554 100644 --- a/plugins/github-release-manager/src/helpers/tagParts/getTagParts.ts +++ b/plugins/github-release-manager/src/helpers/tagParts/getTagParts.ts @@ -16,7 +16,7 @@ import { getCalverTagParts } from './getCalverTagParts'; import { getSemverTagParts } from './getSemverTagParts'; -import { Project } from '../../types/types'; +import { Project } from '../../contexts/ProjectContext'; export function getTagParts({ project, diff --git a/plugins/github-release-manager/src/helpers/useVersioningStrategyMatchesRepoTags.ts b/plugins/github-release-manager/src/helpers/useVersioningStrategyMatchesRepoTags.ts new file mode 100644 index 0000000000..91f4501585 --- /dev/null +++ b/plugins/github-release-manager/src/helpers/useVersioningStrategyMatchesRepoTags.ts @@ -0,0 +1,52 @@ +/* + * 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 { useEffect, useState } from 'react'; + +import { Project } from '../contexts/ProjectContext'; +import { getTagParts } from './tagParts/getTagParts'; + +export const useVersioningStrategyMatchesRepoTags = ({ + latestReleaseTagName, + project, + repositoryName, +}: { + latestReleaseTagName?: string; + project: Project; + repositoryName?: string; +}) => { + const [versioningStrategyMatches, setVersioningStrategyMatches] = useState( + false, + ); + useEffect(() => { + setVersioningStrategyMatches(false); + + if (latestReleaseTagName) { + try { + if (project.repo === repositoryName) { + getTagParts({ project, tag: latestReleaseTagName }); + setVersioningStrategyMatches(true); + } + } catch (error) { + setVersioningStrategyMatches(false); + } + } + }, [latestReleaseTagName, project, repositoryName]); + + return { + versioningStrategyMatches, + }; +}; diff --git a/plugins/github-release-manager/src/types/types.ts b/plugins/github-release-manager/src/types/types.ts index be0fa6169b..04f53fd80a 100644 --- a/plugins/github-release-manager/src/types/types.ts +++ b/plugins/github-release-manager/src/types/types.ts @@ -14,32 +14,6 @@ * limitations under the License. */ -// export interface Project { -// /** -// * Repository's owner (user or organisation) -// * -// * @example erikengervall -// */ -// owner: string; - -// /** -// * Repository's name -// * -// * @example dockest -// */ -// repo: string; - -// /** -// * Declares the versioning strategy of the project -// * -// * semver: `1.2.3` (major.minor.patch) -// * calver: `2020.01.01_0` (YYYY.0M.0D_patch) -// * -// * Default: false -// */ -// versioningStrategy: 'calver' | 'semver'; -// } - interface ComponentConfig { successCb?: (args: Args) => Promise | void; omit?: boolean; From a1163bb8cbb86f278cdb90eeb5cba449021193f5 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 15 Apr 2021 17:17:52 +0200 Subject: [PATCH 025/485] Fix tests (data-testid props weren't forwarded to CircularProgress) Signed-off-by: Erik Engervall --- .../src/cards/createRc/CreateRc.test.tsx | 12 ++++++++---- .../cards/createRc/sideEffects/createRc.test.ts | 2 ++ .../src/cards/info/Info.test.tsx | 11 ++++++----- .../src/cards/patchRc/Patch.test.tsx | 6 +++++- .../src/cards/patchRc/PatchBody.test.tsx | 10 +++++++--- .../src/cards/patchRc/PatchBody.tsx | 10 +++++----- .../src/cards/patchRc/sideEffects/patch.test.ts | 4 +++- .../src/cards/promoteRc/PromoteRcBody.test.tsx | 14 +++++++++++--- .../src/components/CenteredCircularProgress.tsx | 6 +++--- 9 files changed, 50 insertions(+), 25 deletions(-) diff --git a/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx b/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx index 6a918c68eb..4bc22398b2 100644 --- a/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx +++ b/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx @@ -28,13 +28,17 @@ import { } from '../../test-helpers/test-helpers'; import { TEST_IDS } from '../../test-helpers/test-ids'; -jest.mock('../../components/ProjectContext', () => ({ - usePluginApiClientContext: () => mockApiClient, +jest.mock('../../contexts/PluginApiClientContext', () => ({ + usePluginApiClientContext: jest.fn(() => mockApiClient), +})); +jest.mock('../../contexts/ProjectContext', () => ({ + useProjectContext: jest.fn(() => mockCalverProject), })); jest.mock('./getRcGitHubInfo', () => ({ getRcGitHubInfo: () => mockNextGitHubInfo, })); +import { useProjectContext } from '../../contexts/ProjectContext'; import { CreateRc } from './CreateRc'; describe('CreateRc', () => { @@ -43,7 +47,6 @@ describe('CreateRc', () => { , @@ -53,11 +56,12 @@ describe('CreateRc', () => { }); it('should display select element for semver', () => { + (useProjectContext as jest.Mock).mockReturnValue(mockSemverProject); + const { getByTestId } = render( , diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts index 713f0d12f2..9f75a6c927 100644 --- a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts +++ b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts @@ -16,6 +16,7 @@ import { mockApiClient, + mockCalverProject, mockDefaultBranch, mockNextGitHubInfo, mockReleaseVersion, @@ -31,6 +32,7 @@ describe('createRc', () => { defaultBranch: mockDefaultBranch, latestRelease: mockReleaseVersion, nextGitHubInfo: mockNextGitHubInfo, + project: mockCalverProject, }); expect(result).toMatchInlineSnapshot(` diff --git a/plugins/github-release-manager/src/cards/info/Info.test.tsx b/plugins/github-release-manager/src/cards/info/Info.test.tsx index ac278b04c9..ee73f05274 100644 --- a/plugins/github-release-manager/src/cards/info/Info.test.tsx +++ b/plugins/github-release-manager/src/cards/info/Info.test.tsx @@ -22,16 +22,17 @@ import { mockReleaseBranch, } from '../../test-helpers/test-helpers'; import { TEST_IDS } from '../../test-helpers/test-ids'; + +jest.mock('../../contexts/ProjectContext', () => ({ + useProjectContext: jest.fn(() => mockCalverProject), +})); + import { Info } from './Info'; describe('Info', () => { it('should return early if no latestRelease exists', () => { const { getByTestId } = render( - , + , ); expect(getByTestId(TEST_IDS.info.info)).toBeInTheDocument(); diff --git a/plugins/github-release-manager/src/cards/patchRc/Patch.test.tsx b/plugins/github-release-manager/src/cards/patchRc/Patch.test.tsx index fd81b2cd34..3f83a0d9ea 100644 --- a/plugins/github-release-manager/src/cards/patchRc/Patch.test.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/Patch.test.tsx @@ -22,6 +22,11 @@ import { mockCalverProject, } from '../../test-helpers/test-helpers'; import { TEST_IDS } from '../../test-helpers/test-ids'; + +jest.mock('../../contexts/ProjectContext', () => ({ + useProjectContext: jest.fn(() => mockCalverProject), +})); + import { Patch } from './Patch'; describe('Patch', () => { @@ -29,7 +34,6 @@ describe('Patch', () => { const { getByTestId } = render( , diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx index c6020ed3c6..5c208e9955 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx @@ -18,16 +18,20 @@ import React from 'react'; import { render, waitFor, screen } from '@testing-library/react'; import { + mockApiClient, mockBumpedTag, + mockCalverProject, mockRcRelease, mockReleaseBranch, mockReleaseVersion, mockTagParts, - mockApiClient, } from '../../test-helpers/test-helpers'; -jest.mock('../../components/ProjectContext', () => ({ - usePluginApiClientContext: () => mockApiClient, +jest.mock('../../contexts/PluginApiClientContext', () => ({ + usePluginApiClientContext: jest.fn(() => mockApiClient), +})); +jest.mock('../../contexts/ProjectContext', () => ({ + useProjectContext: jest.fn(() => mockCalverProject), })); import { PatchBody } from './PatchBody'; diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx index 7eea133827..40582dbc0f 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx @@ -15,8 +15,8 @@ */ import React, { useState } from 'react'; -import { Alert, AlertTitle } from '@material-ui/lab'; import { useAsync, useAsyncFn } from 'react-use'; +import { Alert, AlertTitle } from '@material-ui/lab'; import { Button, Checkbox, @@ -42,14 +42,14 @@ import { SetRefetch, } from '../../types/types'; import { CalverTagParts } from '../../helpers/tagParts/getCalverTagParts'; +import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; +import { patch } from './sideEffects/patch'; import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; import { SemverTagParts } from '../../helpers/tagParts/getSemverTagParts'; -import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; -import { useStyles } from '../../styles/styles'; import { TEST_IDS } from '../../test-helpers/test-ids'; -import { patch } from './sideEffects/patch'; +import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; import { useProjectContext } from '../../contexts/ProjectContext'; -import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; +import { useStyles } from '../../styles/styles'; interface PatchBodyProps { bumpedTag: string; diff --git a/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.test.ts b/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.test.ts index 2b3b9bf3b2..322fe54255 100644 --- a/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.test.ts +++ b/plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.test.ts @@ -15,11 +15,12 @@ */ import { + mockApiClient, mockBumpedTag, + mockCalverProject, mockReleaseVersion, mockSelectedPatchCommit, mockTagParts, - mockApiClient, } from '../../../test-helpers/test-helpers'; import { patch } from './patch'; @@ -33,6 +34,7 @@ describe('patch', () => { bumpedTag: mockBumpedTag, selectedPatchCommit: mockSelectedPatchCommit, tagParts: mockTagParts, + project: mockCalverProject, }); expect(result).toMatchInlineSnapshot(` diff --git a/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.test.tsx b/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.test.tsx index 0dac702791..a749567043 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.test.tsx +++ b/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.test.tsx @@ -17,12 +17,20 @@ import React from 'react'; import { render } from '@testing-library/react'; -import { mockRcRelease, mockApiClient } from '../../test-helpers/test-helpers'; +import { + mockApiClient, + mockCalverProject, + mockRcRelease, +} from '../../test-helpers/test-helpers'; import { TEST_IDS } from '../../test-helpers/test-ids'; -jest.mock('../../components/ProjectContext', () => ({ - usePluginApiClientContext: () => mockApiClient, +jest.mock('../../contexts/PluginApiClientContext', () => ({ + usePluginApiClientContext: jest.fn(() => mockApiClient), })); +jest.mock('../../contexts/ProjectContext', () => ({ + useProjectContext: jest.fn(() => mockCalverProject), +})); + import { PromoteRcBody } from './PromoteRcBody'; describe('PromoteRcBody', () => { diff --git a/plugins/github-release-manager/src/components/CenteredCircularProgress.tsx b/plugins/github-release-manager/src/components/CenteredCircularProgress.tsx index 83b6314021..262ce13816 100644 --- a/plugins/github-release-manager/src/components/CenteredCircularProgress.tsx +++ b/plugins/github-release-manager/src/components/CenteredCircularProgress.tsx @@ -15,12 +15,12 @@ */ import React from 'react'; -import { CircularProgress } from '@material-ui/core'; +import { CircularProgress, CircularProgressProps } from '@material-ui/core'; -export const CenteredCircularProgress = () => { +export const CenteredCircularProgress = (props: CircularProgressProps) => { return (
- +
); }; From 6c68b63d3243c0e90f51ff27c6806a3b62f5f3c1 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 15 Apr 2021 20:59:41 +0200 Subject: [PATCH 026/485] Continue overhaul of the API's interface - normalize and decouple dependency on GitHub Signed-off-by: Erik Engervall --- .../src/GitHubReleaseManager.tsx | 10 +- .../src/api/PluginApiClient.ts | 271 +++++++++++------- .../src/cards/createRc/CreateRc.tsx | 10 +- .../cards/createRc/getRcGitHubInfo.test.ts | 10 +- .../src/cards/createRc/getRcGitHubInfo.ts | 8 +- .../createRc/sideEffects/createRc.test.ts | 2 +- .../cards/createRc/sideEffects/createRc.ts | 64 ++--- .../src/cards/info/Info.tsx | 10 +- .../src/cards/patchRc/Patch.tsx | 8 +- .../src/cards/patchRc/PatchBody.test.tsx | 2 +- .../src/cards/patchRc/PatchBody.tsx | 222 +++++++------- .../src/cards/patchRc/sideEffects/patch.ts | 16 +- .../src/cards/projectForm/Owner.tsx | 8 +- .../src/cards/projectForm/Repo.tsx | 18 +- .../src/cards/projectForm/RepoDetailsForm.tsx | 5 +- .../src/cards/promoteRc/PromoteRc.tsx | 11 +- .../src/cards/promoteRc/PromoteRcBody.tsx | 15 +- .../promoteRc/sideEffects/promoteRc.test.ts | 4 +- .../cards/promoteRc/sideEffects/promoteRc.ts | 21 +- .../src/contexts/PluginApiClientContext.ts | 4 +- .../src/helpers/isCalverTagParts.ts | 2 +- .../src/sideEffects/getGitHubBatchInfo.ts | 11 +- .../src/sideEffects/getLatestRelease.test.ts | 43 --- .../src/sideEffects/getLatestRelease.ts | 41 --- .../src/test-helpers/test-helpers.test.ts | 52 +--- .../src/test-helpers/test-helpers.ts | 104 +++---- .../github-release-manager/src/types/types.ts | 4 +- 27 files changed, 455 insertions(+), 521 deletions(-) delete mode 100644 plugins/github-release-manager/src/sideEffects/getLatestRelease.test.ts delete mode 100644 plugins/github-release-manager/src/sideEffects/getLatestRelease.ts diff --git a/plugins/github-release-manager/src/GitHubReleaseManager.tsx b/plugins/github-release-manager/src/GitHubReleaseManager.tsx index 3876d2b3fc..a52db523d4 100644 --- a/plugins/github-release-manager/src/GitHubReleaseManager.tsx +++ b/plugins/github-release-manager/src/GitHubReleaseManager.tsx @@ -81,11 +81,7 @@ export function GitHubReleaseManager({ } return ( - +
@@ -119,7 +115,7 @@ function Cards({ ); const { versioningStrategyMatches } = useVersioningStrategyMatchesRepoTags({ - latestReleaseTagName: gitHubBatchInfo.value?.latestRelease?.tag_name, + latestReleaseTagName: gitHubBatchInfo.value?.latestRelease?.tagName, project, repositoryName: gitHubBatchInfo.value?.repository.name, }); @@ -151,7 +147,7 @@ function Cards({ return ( Versioning mismatch, expected {project.versioningStrategy} version, got{' '} - {gitHubBatchInfo.value?.latestRelease?.tag_name} + {gitHubBatchInfo.value.latestRelease?.tagName} ); } diff --git a/plugins/github-release-manager/src/api/PluginApiClient.ts b/plugins/github-release-manager/src/api/PluginApiClient.ts index 24310ef688..d348680cd1 100644 --- a/plugins/github-release-manager/src/api/PluginApiClient.ts +++ b/plugins/github-release-manager/src/api/PluginApiClient.ts @@ -19,10 +19,8 @@ import { Octokit } from '@octokit/rest'; import { readGitHubIntegrationConfigs } from '@backstage/integration'; import { - GhCompareCommitsResponse, GhCreateCommitResponse, GhCreateReferenceResponse, - GhCreateReleaseResponse, GhCreateTagObjectResponse, GhGetBranchResponse, GhGetCommitResponse, @@ -36,32 +34,72 @@ import { getRcGitHubInfo } from '../cards/createRc/getRcGitHubInfo'; import { SemverTagParts } from '../helpers/tagParts/getSemverTagParts'; import { Project } from '../contexts/ProjectContext'; -// export type UnboxPromise> = T extends Promise -// ? U -// : never; +type UnboxPromise> = T extends Promise + ? U + : never; -type Todo = any; +export type ApiMethodRetval< + T extends (...args: any) => Promise +> = UnboxPromise>; + +type Todo = any; // TODO: type PartialProject = Omit; export interface IPluginApiClient { getHost: () => string; + getRepoPath: (args: PartialProject) => string; + + getOrganizations: () => Promise<{ organizations: string[] }>; + + getRepositories: (args: { + owner: string; + }) => Promise<{ repositories: string[] }>; + + getUsername: () => Promise<{ username: string }>; + getRecentCommits: ( args: { releaseBranchName?: string } & PartialProject, - ) => Promise; - getReleases: (args: { releaseId: number } & PartialProject) => Promise; - getRelease: (args: { releaseId: number } & PartialProject) => Promise; + ) => Promise<{ + recentCommits: { + sha: string; + author: { + htmlUrl?: string; + login?: string; + }; + commit: { + message: string; + }; + }[]; + }>; + + getLatestRelease: ( + args: PartialProject, + ) => Promise<{ + latestRelease: { + targetCommitish: string; + tagName: string; + prerelease: boolean; + id: number; + htmlUrl: string; + body?: string | null; + } | null; + }>; + getRepository: ( args: PartialProject, ) => Promise<{ repository: { pushPermissions: boolean | undefined; defaultBranch: string; + name: string; }; }>; + getLatestCommit: ( args: { defaultBranch: string } & PartialProject, ) => Promise; + getBranch: (args: { branchName: string } & PartialProject) => Promise; createRc: { @@ -70,21 +108,27 @@ export interface IPluginApiClient { mostRecentSha: string; targetBranch: string; } & PartialProject, - ) => Promise; + ) => Promise<{ ref: string }>; getComparison: ( args: { previousReleaseBranch: string; nextReleaseBranch: string; } & PartialProject, - ) => Promise; + ) => Promise<{ htmlUrl: string; aheadBy: number }>; createRelease: ( args: { nextGitHubInfo: ReturnType; releaseBody: string; } & PartialProject, - ) => Promise; + ) => Promise<{ + createReleaseResponse: { + name: string | null; + htmlUrl: string; + tagName: string; + }; + }>; }; patch: { @@ -142,7 +186,9 @@ export interface IPluginApiClient { updateRelease: ( args: { bumpedTag: string; - latestRelease: GhGetReleaseResponse; + latestRelease: NonNullable< + ApiMethodRetval['latestRelease'] + >; tagParts: SemverTagParts | CalverTagParts; selectedPatchCommit: GhGetCommitResponse; } & PartialProject, @@ -157,10 +203,6 @@ export interface IPluginApiClient { } & PartialProject, ) => Promise; }; - - getOrganizations: (args: { ownerIsUser: boolean }) => Promise; - getUsername: () => Promise<{ username: string }>; - getRepositories: (args: { owner: string; username: string }) => Promise; } export class PluginApiClient implements IPluginApiClient { @@ -221,36 +263,46 @@ export class PluginApiClient implements IPluginApiClient { async getOrganizations() { const { octokit } = await this.getOctokit(); - const { data: orgs } = await octokit.orgs.listForAuthenticatedUser(); + const orgListResponse = await octokit.paginate( + octokit.orgs.listForAuthenticatedUser, + { per_page: 100 }, + ); - return { orgs }; + return { + organizations: orgListResponse.map(organization => organization.login), + }; } - async getRepositories({ - owner, - username, - }: { - owner: string; - username: string; - }) { + async getRepositories({ owner }: { owner: string }) { const { octokit } = await this.getOctokit(); - if (owner === username) { - const { data: repos } = await octokit.repos.listForUser({ username }); + const repositoryResponse = await octokit + .paginate(octokit.repos.listForOrg, { org: owner, per_page: 100 }) + .catch(async error => { + // `owner` is not an org, try listing a user's repositories instead + if (error.status === 404) { + const userRepositoryResponse = await octokit.paginate( + octokit.repos.listForUser, + { username: owner, per_page: 100 }, + ); + return userRepositoryResponse; + } - return { repos }; - } + throw error; + }); - const { data: repos } = await octokit.repos.listForOrg({ org: owner }); - - return { repos }; + return { + repositories: repositoryResponse.map(repository => repository.name), + }; } async getUsername() { const { octokit } = await this.getOctokit(); - const { data: user } = await octokit.users.getAuthenticated(); + const userResponse = await octokit.users.getAuthenticated(); - return { username: user.login }; + return { + username: userResponse.data.login, + }; } async getRecentCommits({ @@ -261,43 +313,52 @@ export class PluginApiClient implements IPluginApiClient { releaseBranchName?: string; } & PartialProject) { const { octokit } = await this.getOctokit(); - const sha = releaseBranchName ? `?sha=${releaseBranchName}` : ''; + const recentCommitsResponse = await octokit.repos.listCommits({ + owner, + repo, + ...(releaseBranchName ? { sha: releaseBranchName } : {}), + }); - const recentCommits: GhGetCommitResponse[] = ( - await octokit.request( - `/repos/${this.getRepoPath({ owner, repo })}/commits${sha}`, - ) - ).data; - - return { recentCommits }; + return { + recentCommits: recentCommitsResponse.data.map(commit => ({ + sha: commit.sha, + author: { + htmlUrl: commit.author?.html_url, + login: commit.author?.login, + }, + commit: { + message: commit.commit.message, + }, + })), + }; } - async getReleases({ owner, repo }: PartialProject) { + async getLatestRelease({ owner, repo }: PartialProject) { const { octokit } = await this.getOctokit(); + const { data: latestReleases } = await octokit.repos.listReleases({ + owner, + repo, + per_page: 1, + }); - const releases: GhGetReleaseResponse[] = ( - await octokit.request( - `/repos/${this.getRepoPath({ owner, repo })}/releases`, - ) - ).data; + if (latestReleases.length === 0) { + return { + latestRelease: null, + }; + } - return { releases }; - } + const latestRelease = latestReleases[0]; - async getRelease({ - owner, - repo, - releaseId, - }: { releaseId: number } & PartialProject) { - const { octokit } = await this.getOctokit(); - - const latestRelease: GhGetReleaseResponse = ( - await octokit.request( - `/repos/${this.getRepoPath({ owner, repo })}/releases/${releaseId}`, - ) - ).data; - - return { latestRelease }; + return { + latestRelease: { + targetCommitish: latestRelease.target_commitish, + tagName: latestRelease.tag_name, + prerelease: latestRelease.prerelease, + id: latestRelease.id, + htmlUrl: latestRelease.html_url, + body: latestRelease.body, + }, + }; } async getRepository({ owner, repo }: PartialProject) { @@ -363,21 +424,16 @@ export class PluginApiClient implements IPluginApiClient { targetBranch: string; } & PartialProject) => { const { octokit } = await this.getOctokit(); + const createRefResponse = await octokit.git.createRef({ + owner, + repo, + ref: `refs/heads/${targetBranch}`, + sha: mostRecentSha, + }); - const createdRef: GhCreateReferenceResponse = ( - await octokit.request( - `/repos/${this.getRepoPath({ owner, repo })}/git/refs`, - { - method: 'POST', - data: { - ref: `refs/heads/${targetBranch}`, - sha: mostRecentSha, - }, - }, - ) - ).data; - - return { createdRef }; + return { + ref: createRefResponse.data.ref, + }; }, getComparison: async ({ @@ -390,17 +446,17 @@ export class PluginApiClient implements IPluginApiClient { nextReleaseBranch: string; } & PartialProject) => { const { octokit } = await this.getOctokit(); + const compareCommitsResponse = await octokit.repos.compareCommits({ + owner, + repo, + base: previousReleaseBranch, + head: nextReleaseBranch, + }); - const comparison: GhCompareCommitsResponse = ( - await octokit.request( - `/repos/${this.getRepoPath({ - owner, - repo, - })}/compare/${previousReleaseBranch}...${nextReleaseBranch}`, - ) - ).data; - - return { comparison }; + return { + htmlUrl: compareCommitsResponse.data.html_url, + aheadBy: compareCommitsResponse.data.ahead_by, + }; }, createRelease: async ({ @@ -413,24 +469,23 @@ export class PluginApiClient implements IPluginApiClient { releaseBody: string; } & PartialProject) => { const { octokit } = await this.getOctokit(); + const createReleaseResponse = await octokit.repos.createRelease({ + owner, + repo, + tag_name: nextGitHubInfo.rcReleaseTag, + name: nextGitHubInfo.releaseName, + target_commitish: nextGitHubInfo.rcBranch, + body: releaseBody, + prerelease: true, + }); - const createReleaseResponse: GhCreateReleaseResponse = ( - await octokit.request( - `/repos/${this.getRepoPath({ owner, repo })}/releases`, - { - method: 'POST', - data: { - tag_name: nextGitHubInfo.rcReleaseTag, - name: nextGitHubInfo.releaseName, - target_commitish: nextGitHubInfo.rcBranch, - body: releaseBody, - prerelease: true, - }, - }, - ) - ).data; - - return { createReleaseResponse }; + return { + createReleaseResponse: { + name: createReleaseResponse.data.name, + htmlUrl: createReleaseResponse.data.html_url, + tagName: createReleaseResponse.data.tag_name, + }, + }; }, }; @@ -640,7 +695,9 @@ export class PluginApiClient implements IPluginApiClient { selectedPatchCommit, }: { bumpedTag: string; - latestRelease: GhGetReleaseResponse; + latestRelease: NonNullable< + ApiMethodRetval['latestRelease'] + >; tagParts: SemverTagParts | CalverTagParts; selectedPatchCommit: GhGetCommitResponse; } & PartialProject) => { diff --git a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx index 2f2fb6963b..b36478f082 100644 --- a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx +++ b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx @@ -33,7 +33,6 @@ import { InfoCardPlus } from '../../components/InfoCardPlus'; import { ComponentConfigCreateRc, GhGetBranchResponse, - GhGetReleaseResponse, GhGetRepositoryResponse, SetRefetch, } from '../../types/types'; @@ -43,10 +42,13 @@ import { TEST_IDS } from '../../test-helpers/test-ids'; import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; import { useProjectContext } from '../../contexts/ProjectContext'; import { useStyles } from '../../styles/styles'; +import { ApiMethodRetval, IPluginApiClient } from '../../api/PluginApiClient'; interface CreateRcProps { defaultBranch: GhGetRepositoryResponse['default_branch']; - latestRelease: GhGetReleaseResponse | null; + latestRelease: ApiMethodRetval< + IPluginApiClient['getLatestRelease'] + >['latestRelease']; releaseBranch: GhGetBranchResponse | null; setRefetch: SetRefetch; successCb?: ComponentConfigCreateRc['successCb']; @@ -97,7 +99,7 @@ export const CreateRc = ({ const tagAlreadyExists = latestRelease !== null && - latestRelease.tag_name === nextGitHubInfo.rcReleaseTag; + latestRelease.tagName === nextGitHubInfo.rcReleaseTag; const conflictingPreRelease = latestRelease !== null && latestRelease.prerelease; @@ -132,7 +134,7 @@ export const CreateRc = ({ diff --git a/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.test.ts b/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.test.ts index 08eeacdcc9..31f9b6a4f4 100644 --- a/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.test.ts +++ b/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.test.ts @@ -16,7 +16,7 @@ import { DateTime } from 'luxon'; -import { GhGetReleaseResponse } from '../../types/types'; +import { ApiMethodRetval, IPluginApiClient } from '../../api/PluginApiClient'; import { mockSemverProject, mockCalverProject, @@ -34,8 +34,8 @@ describe('getRcGitHubInfo', () => { describe('calver', () => { const latestRelease = { - tag_name: 'rc-2020.01.01_0', - } as GhGetReleaseResponse; + tagName: 'rc-2020.01.01_0', + } as ApiMethodRetval['latestRelease']; it('should return correct GitHub info', () => { expect( @@ -57,8 +57,8 @@ describe('getRcGitHubInfo', () => { describe('semver', () => { const latestRelease = { - tag_name: 'rc-1.1.1', - } as GhGetReleaseResponse; + tagName: 'rc-1.1.1', + } as ApiMethodRetval['latestRelease']; it("should return correct GitHub info when there's previous releases", () => { expect( diff --git a/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.ts b/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.ts index cd2140296f..de70da6f9c 100644 --- a/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.ts +++ b/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.ts @@ -18,9 +18,9 @@ import { DateTime } from 'luxon'; import { getBumpedSemverTagParts } from '../../helpers/getBumpedTag'; import { getSemverTagParts } from '../../helpers/tagParts/getSemverTagParts'; -import { GhGetReleaseResponse } from '../../types/types'; import { SEMVER_PARTS } from '../../constants/constants'; import { Project } from '../../contexts/ProjectContext'; +import { ApiMethodRetval, IPluginApiClient } from '../../api/PluginApiClient'; export const getRcGitHubInfo = ({ project, @@ -29,7 +29,9 @@ export const getRcGitHubInfo = ({ injectedDate = DateTime.now().toFormat('yyyy.MM.dd'), }: { project: Project; - latestRelease: GhGetReleaseResponse | null; + latestRelease: ApiMethodRetval< + IPluginApiClient['getLatestRelease'] + >['latestRelease']; semverBumpLevel: keyof typeof SEMVER_PARTS; injectedDate?: string; }) => { @@ -49,7 +51,7 @@ export const getRcGitHubInfo = ({ }; } - const tagParts = getSemverTagParts(latestRelease.tag_name); + const tagParts = getSemverTagParts(latestRelease.tagName); const { bumpedTagParts } = getBumpedSemverTagParts(tagParts, semverBumpLevel); const bumpedTag = `${bumpedTagParts.major}.${bumpedTagParts.minor}.${bumpedTagParts.patch}`; diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts index 9f75a6c927..e9ad6aca5a 100644 --- a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts +++ b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts @@ -28,10 +28,10 @@ describe('createRc', () => { it('should work', async () => { const result = await createRc({ - pluginApiClient: mockApiClient, defaultBranch: mockDefaultBranch, latestRelease: mockReleaseVersion, nextGitHubInfo: mockNextGitHubInfo, + pluginApiClient: mockApiClient, project: mockCalverProject, }); diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts index 0f659fc994..c136f33cc2 100644 --- a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts +++ b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts @@ -17,20 +17,23 @@ import { getRcGitHubInfo } from '../getRcGitHubInfo'; import { ComponentConfigCreateRc, - GhCreateReferenceResponse, - GhGetReleaseResponse, GhGetRepositoryResponse, ResponseStep, } from '../../../types/types'; -import { PluginApiClient } from '../../../api/PluginApiClient'; +import { + ApiMethodRetval, + IPluginApiClient, +} from '../../../api/PluginApiClient'; import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; import { Project } from '../../../contexts/ProjectContext'; interface CreateRC { defaultBranch: GhGetRepositoryResponse['default_branch']; - latestRelease: GhGetReleaseResponse | null; + latestRelease: ApiMethodRetval< + IPluginApiClient['getLatestRelease'] + >['latestRelease']; nextGitHubInfo: ReturnType; - pluginApiClient: PluginApiClient; + pluginApiClient: IPluginApiClient; project: Project; successCb?: ComponentConfigCreateRc['successCb']; } @@ -62,23 +65,20 @@ export async function createRc({ * 2. Create a new ref based on the default branch's most recent sha */ const mostRecentSha = latestCommit.sha; - let createdRef: GhCreateReferenceResponse; - try { - createdRef = ( - await pluginApiClient.createRc.createRef({ - ...project, - mostRecentSha, - targetBranch: nextGitHubInfo.rcBranch, - }) - ).createdRef; - } catch (error) { - if (error.body.message === 'Reference already exists') { - throw new GitHubReleaseManagerError( - `Branch "${nextGitHubInfo.rcBranch}" already exists: .../tree/${nextGitHubInfo.rcBranch}`, - ); - } - throw error; - } + const createdRef = await pluginApiClient.createRc + .createRef({ + ...project, + mostRecentSha, + targetBranch: nextGitHubInfo.rcBranch, + }) + .catch(error => { + if (error?.body?.message === 'Reference already exists') { + throw new GitHubReleaseManagerError( + `Branch "${nextGitHubInfo.rcBranch}" already exists: .../tree/${nextGitHubInfo.rcBranch}`, + ); + } + throw error; + }); responseSteps.push({ message: 'Cut Release Branch', secondaryMessage: `with ref "${createdRef.ref}"`, @@ -88,17 +88,17 @@ export async function createRc({ * 3. Compose a body for the release */ const previousReleaseBranch = latestRelease - ? latestRelease.target_commitish + ? latestRelease.targetCommitish : defaultBranch; const nextReleaseBranch = nextGitHubInfo.rcBranch; - const { comparison } = await pluginApiClient.createRc.getComparison({ + const comparison = await pluginApiClient.createRc.getComparison({ ...project, previousReleaseBranch, nextReleaseBranch, }); - const releaseBody = `**Compare** ${comparison.html_url} + const releaseBody = `**Compare** ${comparison.htmlUrl} -**Ahead by** ${comparison.ahead_by} commits +**Ahead by** ${comparison.aheadBy} commits **Release branch** ${createdRef.ref} @@ -108,7 +108,7 @@ export async function createRc({ responseSteps.push({ message: 'Fetched commit comparison', secondaryMessage: `${previousReleaseBranch}...${nextReleaseBranch}`, - link: comparison.html_url, + link: comparison.htmlUrl, }); /** @@ -124,15 +124,15 @@ export async function createRc({ responseSteps.push({ message: `Created Release Candidate "${createReleaseResponse.name}"`, secondaryMessage: `with tag "${nextGitHubInfo.rcReleaseTag}"`, - link: createReleaseResponse.html_url, + link: createReleaseResponse.htmlUrl, }); await successCb?.({ - gitHubReleaseUrl: createReleaseResponse.html_url, + gitHubReleaseUrl: createReleaseResponse.htmlUrl, gitHubReleaseName: createReleaseResponse.name, - comparisonUrl: comparison.html_url, - previousTag: latestRelease?.tag_name, - createdTag: createReleaseResponse.tag_name, + comparisonUrl: comparison.htmlUrl, + previousTag: latestRelease?.tagName, + createdTag: createReleaseResponse.tagName, }); return responseSteps; diff --git a/plugins/github-release-manager/src/cards/info/Info.tsx b/plugins/github-release-manager/src/cards/info/Info.tsx index 1f42c5b603..782ed30460 100644 --- a/plugins/github-release-manager/src/cards/info/Info.tsx +++ b/plugins/github-release-manager/src/cards/info/Info.tsx @@ -18,20 +18,24 @@ import React from 'react'; import { Link, Typography } from '@material-ui/core'; import { Differ } from '../../components/Differ'; -import { GhGetBranchResponse, GhGetReleaseResponse } from '../../types/types'; +import { GhGetBranchResponse } from '../../types/types'; import { InfoCardPlus } from '../../components/InfoCardPlus'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { useProjectContext } from '../../contexts/ProjectContext'; import { useStyles } from '../../styles/styles'; import flowImage from './flow.png'; +import { ApiMethodRetval, IPluginApiClient } from '../../api/PluginApiClient'; interface InfoCardProps { releaseBranch: GhGetBranchResponse | null; - latestRelease: GhGetReleaseResponse | null; + latestRelease: ApiMethodRetval< + IPluginApiClient['getLatestRelease'] + >['latestRelease']; } export const Info = ({ releaseBranch, latestRelease }: InfoCardProps) => { const project = useProjectContext(); + const classes = useStyles(); return ( @@ -98,7 +102,7 @@ export const Info = ({ releaseBranch, latestRelease }: InfoCardProps) => { - Latest release: + Latest release:
diff --git a/plugins/github-release-manager/src/cards/patchRc/Patch.tsx b/plugins/github-release-manager/src/cards/patchRc/Patch.tsx index e0c1be7a24..e19287024c 100644 --- a/plugins/github-release-manager/src/cards/patchRc/Patch.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/Patch.tsx @@ -23,15 +23,17 @@ import { NoLatestRelease } from '../../components/NoLatestRelease'; import { ComponentConfigPatch, GhGetBranchResponse, - GhGetReleaseResponse, SetRefetch, } from '../../types/types'; import { PatchBody } from './PatchBody'; import { useProjectContext } from '../../contexts/ProjectContext'; import { useStyles } from '../../styles/styles'; +import { ApiMethodRetval, IPluginApiClient } from '../../api/PluginApiClient'; interface PatchProps { - latestRelease: GhGetReleaseResponse | null; + latestRelease: ApiMethodRetval< + IPluginApiClient['getLatestRelease'] + >['latestRelease']; releaseBranch: GhGetBranchResponse | null; setRefetch: SetRefetch; successCb?: ComponentConfigPatch['successCb']; @@ -53,7 +55,7 @@ export const Patch = ({ const { bumpedTag, tagParts } = getBumpedTag({ project, - tag: latestRelease.tag_name, + tag: latestRelease.tagName, bumpLevel: 'patch', }); diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx index 5c208e9955..54daf2894f 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx @@ -41,7 +41,7 @@ describe('PatchBody', () => { beforeEach(jest.clearAllMocks); it('should render error', async () => { - mockApiClient.getBranch.mockImplementationOnce(() => { + (mockApiClient.getBranch as jest.Mock).mockImplementationOnce(() => { throw new Error('banana'); }); diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx index 40582dbc0f..44907d30f1 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx @@ -38,7 +38,6 @@ import { ComponentConfigPatch, GhGetBranchResponse, GhGetCommitResponse, - GhGetReleaseResponse, SetRefetch, } from '../../types/types'; import { CalverTagParts } from '../../helpers/tagParts/getCalverTagParts'; @@ -50,10 +49,13 @@ import { TEST_IDS } from '../../test-helpers/test-ids'; import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; import { useProjectContext } from '../../contexts/ProjectContext'; import { useStyles } from '../../styles/styles'; +import { ApiMethodRetval, IPluginApiClient } from '../../api/PluginApiClient'; interface PatchBodyProps { bumpedTag: string; - latestRelease: GhGetReleaseResponse; + latestRelease: NonNullable< + ApiMethodRetval['latestRelease'] + >; releaseBranch: GhGetBranchResponse | null; setRefetch: SetRefetch; successCb?: ComponentConfigPatch['successCb']; @@ -75,17 +77,17 @@ export const PatchBody = ({ const githubDataResponse = useAsync(async () => { const [ { branch: releaseBranchResponse }, - { recentCommits }, + { recentCommits: recentCommitsOnDefaultBranch }, ] = await Promise.all([ pluginApiClient.getBranch({ ...project, - branchName: latestRelease.target_commitish, + branchName: latestRelease.targetCommitish, }), pluginApiClient.getRecentCommits({ ...project }), ]); const { - recentCommits: recentReleaseBranchCommits, + recentCommits: recentCommitsOnReleaseBranch, } = await pluginApiClient.getRecentCommits({ ...project, releaseBranchName: releaseBranchResponse.name, @@ -93,8 +95,8 @@ export const PatchBody = ({ return { releaseBranch: releaseBranchResponse, - recentReleaseBranchCommits, - recentCommits, + recentCommitsOnReleaseBranch, + recentCommitsOnDefaultBranch, }; }); @@ -146,118 +148,118 @@ export const PatchBody = ({ )} - + ); } function CommitList() { - if (!githubDataResponse.value?.recentCommits) { + if (!githubDataResponse.value?.recentCommitsOnDefaultBranch) { return null; } return ( - {githubDataResponse.value.recentCommits.map((commit, index) => { - const commitExistsOnReleaseBranch = !!githubDataResponse.value?.recentReleaseBranchCommits.find( - ({ sha }) => { - return sha === commit.sha; - }, - ); + {githubDataResponse.value.recentCommitsOnDefaultBranch.map( + (commit, index) => { + const commitExistsOnReleaseBranch = !!githubDataResponse.value?.recentCommitsOnReleaseBranch.find( + releaseBranchCommit => releaseBranchCommit.sha === commit.sha, + ); - return ( -
- {commitExistsOnReleaseBranch && ( - - {' '} - Already exists on {releaseBranch?.name} - - )} - - 0) || - commitExistsOnReleaseBranch - } - role={undefined} - dense - button - onClick={() => { - if (index === checkedCommitIndex) { - setCheckedCommitIndex(-1); - } else { - setCheckedCommitIndex(index); - } - }} - > - - - - - - {commit.sha}{' '} - - @{commit.author.login} - - - } - /> - - - { - const repoPath = pluginApiClient.getRepoPath({ - ...project, - }); - const host = pluginApiClient.getHost(); - - const newTab = window.open( - `https://${host}/${repoPath}/compare/${releaseBranch?.name}...${commit.sha}`, - '_blank', - ); - newTab?.focus(); + return ( +
+ {commitExistsOnReleaseBranch && ( + - - - - -
- ); - })} + {' '} + Already exists on {releaseBranch?.name} + + )} + + 0) || + commitExistsOnReleaseBranch + } + role={undefined} + dense + button + onClick={() => { + if (index === checkedCommitIndex) { + setCheckedCommitIndex(-1); + } else { + setCheckedCommitIndex(index); + } + }} + > + + + + + + {commit.sha}{' '} + + @{commit.author.login} + + + } + /> + + + { + const repoPath = pluginApiClient.getRepoPath({ + ...project, + }); + const host = pluginApiClient.getHost(); + + const newTab = window.open( + `https://${host}/${repoPath}/compare/${releaseBranch?.name}...${commit.sha}`, + '_blank', + ); + newTab?.focus(); + }} + > + + + + +
+ ); + }, + )}
); } @@ -275,7 +277,11 @@ export const PatchBody = ({ ); } - if (!githubDataResponse.value?.recentCommits[checkedCommitIndex]) { + if ( + !githubDataResponse.value?.recentCommitsOnDefaultBranch[ + checkedCommitIndex + ] + ) { return ( - ); - } - + ]; return ( )}
diff --git a/plugins/github-release-manager/src/cards/Cards.tsx b/plugins/github-release-manager/src/cards/Cards.tsx index 52a44ecd8b..f39697b664 100644 --- a/plugins/github-release-manager/src/cards/Cards.tsx +++ b/plugins/github-release-manager/src/cards/Cards.tsx @@ -94,32 +94,34 @@ export function Cards({ )} - + {components?.info?.omit !== true && ( + + )} - {components?.default?.createRc?.omit !== true && ( + {components?.createRc?.omit !== true && ( )} - {components?.default?.promoteRc?.omit !== true && ( + {components?.promoteRc?.omit !== true && ( )} - {components?.default?.patch?.omit !== true && ( + {components?.patch?.omit !== true && ( )} diff --git a/plugins/github-release-manager/src/cards/projectForm/Owner.tsx b/plugins/github-release-manager/src/cards/projectForm/Owner.tsx index 5e7d5b2f30..8f67038697 100644 --- a/plugins/github-release-manager/src/cards/projectForm/Owner.tsx +++ b/plugins/github-release-manager/src/cards/projectForm/Owner.tsx @@ -46,7 +46,12 @@ export function Owner({ username }: { username: string }) { .includes(project.owner); return ( - + {loading ? ( ) : ( diff --git a/plugins/github-release-manager/src/cards/projectForm/Repo.tsx b/plugins/github-release-manager/src/cards/projectForm/Repo.tsx index fb05783e3e..4c7b995c44 100644 --- a/plugins/github-release-manager/src/cards/projectForm/Repo.tsx +++ b/plugins/github-release-manager/src/cards/projectForm/Repo.tsx @@ -52,7 +52,12 @@ export function Repo() { const customRepoFromUrl = !repositories.concat(['']).includes(project.repo); return ( - + {loading ? ( ) : ( diff --git a/plugins/github-release-manager/src/cards/projectForm/VersioningStrategy.tsx b/plugins/github-release-manager/src/cards/projectForm/VersioningStrategy.tsx index 23d42009df..ebbee5b419 100644 --- a/plugins/github-release-manager/src/cards/projectForm/VersioningStrategy.tsx +++ b/plugins/github-release-manager/src/cards/projectForm/VersioningStrategy.tsx @@ -36,7 +36,7 @@ export function VersioningStrategy() { useEffect(() => { const { parsedQuery } = getParsedQuery(); - if (!parsedQuery.versioningStrategy) { + if (!parsedQuery.versioningStrategy && !project.isProvidedViaProps) { const { queryParams } = getQueryParamsWithUpdates({ updates: [ { key: 'versioningStrategy', value: project.versioningStrategy }, @@ -48,7 +48,11 @@ export function VersioningStrategy() { }, []); // eslint-disable-line react-hooks/exhaustive-deps return ( - + Calendar strategy (undefined); diff --git a/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts b/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts index 293bf01891..fb2735182e 100644 --- a/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts +++ b/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts @@ -52,6 +52,7 @@ describe('testHelpers', () => { }, "mockBumpedTag": "rc-2020.01.01_1337", "mockCalverProject": Object { + "isProvidedViaProps": false, "owner": "mock_owner", "repo": "mock_repo", "versioningStrategy": "calver", @@ -112,6 +113,7 @@ describe('testHelpers', () => { "sha": "mock_sha_selected_patch_commit", }, "mockSemverProject": Object { + "isProvidedViaProps": false, "owner": "mock_owner", "repo": "mock_repo", "versioningStrategy": "semver", diff --git a/plugins/github-release-manager/src/test-helpers/test-helpers.ts b/plugins/github-release-manager/src/test-helpers/test-helpers.ts index 80200e2ff0..19e3c57184 100644 --- a/plugins/github-release-manager/src/test-helpers/test-helpers.ts +++ b/plugins/github-release-manager/src/test-helpers/test-helpers.ts @@ -31,12 +31,14 @@ export const mockSemverProject: Project = { owner: mockOwner, repo: mockRepo, versioningStrategy: 'semver', + isProvidedViaProps: false, }; export const mockCalverProject: Project = { owner: mockOwner, repo: mockRepo, versioningStrategy: 'calver', + isProvidedViaProps: false, }; export const mockSearchCalver = `?versioningStrategy=${mockCalverProject.versioningStrategy}&owner=${mockCalverProject.owner}&repo=${mockCalverProject.repo}`; diff --git a/plugins/github-release-manager/src/types/types.ts b/plugins/github-release-manager/src/types/types.ts index a92200614d..84a27add68 100644 --- a/plugins/github-release-manager/src/types/types.ts +++ b/plugins/github-release-manager/src/types/types.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -interface ComponentConfig { +export interface ComponentConfig { successCb?: (args: Args) => Promise | void; omit?: boolean; } From 68fe248d6326aee62bce7f042f2903186a2daa87 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Sun, 18 Apr 2021 18:22:09 +0200 Subject: [PATCH 047/485] Slightly improve types Signed-off-by: Erik Engervall --- plugins/github-release-manager/README.md | 10 +++++ plugins/github-release-manager/dev/index.tsx | 41 ++++++++++++++----- .../src/cards/Cards.tsx | 8 ++-- .../github-release-manager/src/types/types.ts | 25 ++++++----- 4 files changed, 59 insertions(+), 25 deletions(-) diff --git a/plugins/github-release-manager/README.md b/plugins/github-release-manager/README.md index 075068c51a..43c842bc26 100644 --- a/plugins/github-release-manager/README.md +++ b/plugins/github-release-manager/README.md @@ -46,4 +46,14 @@ Looking at the flow above, a common release lifecycle could be: ## Usage +### Importing + The plugin exports a single full-page extension `GitHubReleaseManagerPage`, which one can add to an app like a usual top-level tool on a dedicated route. + +### Configuration + +The plugin is configurable either via props or the select elements on the page. + +If project configuration is provided via props, the select elements are disabled. It is also possible to omit components from the page via props, as well as attaching callbacks for successful executions. + +See the plugin's dev folder (`dev/index.tsx`) to see some examples. diff --git a/plugins/github-release-manager/dev/index.tsx b/plugins/github-release-manager/dev/index.tsx index b6897e2a9b..bca24d56a4 100644 --- a/plugins/github-release-manager/dev/index.tsx +++ b/plugins/github-release-manager/dev/index.tsx @@ -16,12 +16,13 @@ import React from 'react'; import { createDevApp } from '@backstage/dev-utils'; -import { Alert } from '@material-ui/lab'; +import { Typography } from '@material-ui/core'; import { gitHubReleaseManagerPlugin, GitHubReleaseManagerPage, } from '../src/plugin'; +import { InfoCardPlus } from '../src/components/InfoCardPlus'; function DevWrapper({ children }: { children: React.ReactNode }) { return
{children}
; @@ -31,21 +32,30 @@ createDevApp() .registerPlugin(gitHubReleaseManagerPlugin) .addPage({ title: 'Dynamic', + path: '/dynamic', element: ( - <> - Configure via select inputs + + + Dev notes + Configure plugin via select inputs + - - - - + + ), }) .addPage({ title: 'Static', + path: '/static', element: ( - Statically configured via props + + Dev notes + + Configure plugin statically by passing props to the + `GitHubReleaseManagerPage` component + + - Optionally omit components + + Dev notes + Each components can be omitted + Success callbacks can also be added + diff --git a/plugins/github-release-manager/src/cards/Cards.tsx b/plugins/github-release-manager/src/cards/Cards.tsx index f39697b664..5773717cd8 100644 --- a/plugins/github-release-manager/src/cards/Cards.tsx +++ b/plugins/github-release-manager/src/cards/Cards.tsx @@ -94,14 +94,14 @@ export function Cards({ )} - {components?.info?.omit !== true && ( + {!components?.info?.omit && ( )} - {components?.createRc?.omit !== true && ( + {!components?.createRc?.omit && ( )} - {components?.promoteRc?.omit !== true && ( + {!components?.promoteRc?.omit && ( )} - {components?.patch?.omit !== true && ( + {!components?.patch?.omit && ( { - successCb?: (args: Args) => Promise | void; - omit?: boolean; -} +export type ComponentConfig = + | { + omit?: void; + successCb?: (args: Args) => Promise | void; + } + | { + omit: boolean; + successCb?: void; + }; -interface ComponentConfigCreateRcSuccessCbArgs { +interface CreateRcSuccessCbArgs { gitHubReleaseUrl: string; gitHubReleaseName: string | null; comparisonUrl: string; previousTag?: string; createdTag: string; } -export type ComponentConfigCreateRc = ComponentConfig; +export type ComponentConfigCreateRc = ComponentConfig; -interface ComponentConfigPromoteRcSuccessCbArgs { +interface PromoteRcSuccessCbArgs { gitHubReleaseUrl: string; gitHubReleaseName: string | null; previousTagUrl: string; @@ -36,9 +41,9 @@ interface ComponentConfigPromoteRcSuccessCbArgs { updatedTagUrl: string; updatedTag: string; } -export type ComponentConfigPromoteRc = ComponentConfig; +export type ComponentConfigPromoteRc = ComponentConfig; -interface ComponentConfigPatchSuccessCbArgs { +interface PatchSuccessCbArgs { updatedReleaseUrl: string; updatedReleaseName: string | null; previousTag: string; @@ -46,7 +51,7 @@ interface ComponentConfigPatchSuccessCbArgs { patchCommitUrl: string; patchCommitMessage: string; } -export type ComponentConfigPatch = ComponentConfig; +export type ComponentConfigPatch = ComponentConfig; export interface ResponseStep { message: string | React.ReactNode; From a0145d69c89a474d4cdd11cb7de48463ed050d26 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Sun, 18 Apr 2021 18:24:47 +0200 Subject: [PATCH 048/485] Revert type 'improvement' Signed-off-by: Erik Engervall --- app-config.yaml | 14 +++++++------- plugins/github-release-manager/src/types/types.ts | 13 ++++--------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/app-config.yaml b/app-config.yaml index afbda40852..dd1a3f17eb 100644 --- a/app-config.yaml +++ b/app-config.yaml @@ -119,12 +119,12 @@ integrations: - host: github.com token: ${GITHUB_TOKEN} ### Example for how to add your GitHub Enterprise instance using the API: - # - host: ghe.example.net - # apiBaseUrl: https://ghe.example.net/api/v3 - # token: ${GHE_TOKEN} + - host: ghe.spotify.net + apiBaseUrl: https://ghe.spotify.net/api/v3 + token: ${GHE_TOKEN} ### Example for how to add your GitHub Enterprise instance using raw HTTP fetches (token is optional): - # - host: ghe.example.net - # rawBaseUrl: https://ghe.example.net/raw + # - host: ghe.spotify.net + # rawBaseUrl: https://ghe.spotify.net/raw # token: ${GHE_TOKEN} gitlab: - host: gitlab.com @@ -159,8 +159,8 @@ catalog: - target: https://github.com token: ${GITHUB_TOKEN} #### Example for how to add your GitHub Enterprise instance using the API: - # - target: https://ghe.example.net - # apiBaseUrl: https://ghe.example.net/api + # - target: https://ghe.spotify.net + # apiBaseUrl: https://ghe.spotify.net/api # token: ${GHE_TOKEN} ldapOrg: ### Example for how to add your enterprise LDAP server diff --git a/plugins/github-release-manager/src/types/types.ts b/plugins/github-release-manager/src/types/types.ts index 6d7099b9eb..8687150d7e 100644 --- a/plugins/github-release-manager/src/types/types.ts +++ b/plugins/github-release-manager/src/types/types.ts @@ -14,15 +14,10 @@ * limitations under the License. */ -export type ComponentConfig = - | { - omit?: void; - successCb?: (args: Args) => Promise | void; - } - | { - omit: boolean; - successCb?: void; - }; +export type ComponentConfig = { + omit?: boolean; + successCb?: (args: Args) => Promise | void; +}; interface CreateRcSuccessCbArgs { gitHubReleaseUrl: string; From 6436802d298374da72eb8e4a6270e85e46333214 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Tue, 20 Apr 2021 08:29:12 +0200 Subject: [PATCH 049/485] Add useResponseSteps helper and refactor sideeffect accordingly to get iterative progress updates Signed-off-by: Erik Engervall --- .../src/cards/createRc/CreateRc.test.tsx | 7 + .../src/cards/createRc/CreateRc.tsx | 56 ++--- .../createRc/sideEffects/createRc.test.ts | 11 +- .../cards/createRc/sideEffects/createRc.ts | 136 ---------- .../cards/createRc/sideEffects/useCreateRc.ts | 234 ++++++++++++++++++ .../src/cards/patchRc/PatchBody.tsx | 1 - .../src/cards/promoteRc/PromoteRcBody.tsx | 59 ++--- .../components/LinearProgressWithLabel.tsx | 40 +++ .../ResponseStepList/ResponseStepList.tsx | 49 ++-- .../ResponseStepList/ResponseStepList2.tsx | 91 +++++++ .../ResponseStepList/ResponseStepListItem.tsx | 14 +- .../src/helpers/createResponseStepError.ts | 25 ++ .../src/hooks/useResponseSteps.ts | 55 ++++ 13 files changed, 518 insertions(+), 260 deletions(-) delete mode 100644 plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts create mode 100644 plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.ts create mode 100644 plugins/github-release-manager/src/components/LinearProgressWithLabel.tsx create mode 100644 plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList2.tsx create mode 100644 plugins/github-release-manager/src/helpers/createResponseStepError.ts create mode 100644 plugins/github-release-manager/src/hooks/useResponseSteps.ts diff --git a/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx b/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx index 42942d8a38..fa83f39592 100644 --- a/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx +++ b/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx @@ -37,6 +37,13 @@ jest.mock('../../contexts/ProjectContext', () => ({ jest.mock('./getRcGitHubInfo', () => ({ getRcGitHubInfo: () => mockNextGitHubInfo, })); +jest.mock('./sideEffects/useCreateRc', () => ({ + useCreateRc: () => ({ + run: jest.fn(), + responseSteps: [], + progress: 0, + }), +})); import { useProjectContext } from '../../contexts/ProjectContext'; import { CreateRc } from './CreateRc'; diff --git a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx index 3787e1b253..3b08198457 100644 --- a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx +++ b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx @@ -18,20 +18,20 @@ import React, { useState, useEffect } from 'react'; import { Alert } from '@material-ui/lab'; import { Button, + Dialog, + DialogTitle, FormControl, InputLabel, MenuItem, Select, Typography, } from '@material-ui/core'; -import { useAsyncFn } from 'react-use'; import { ComponentConfigCreateRc } from '../../types/types'; -import { createRc } from './sideEffects/createRc'; +import { useCreateRc } from './sideEffects/useCreateRc'; import { Differ } from '../../components/Differ'; import { getRcGitHubInfo } from './getRcGitHubInfo'; import { InfoCardPlus } from '../../components/InfoCardPlus'; -import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; import { SEMVER_PARTS } from '../../constants/constants'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; @@ -42,6 +42,8 @@ import { GetLatestReleaseResult, GetRepositoryResult, } from '../../api/PluginApiClient'; +import { ResponseStepList2 } from '../../components/ResponseStepList/ResponseStepList2'; +import { LinearProgressWithLabel } from '../../components/LinearProgressWithLabel'; interface CreateRcProps { defaultBranch: GetRepositoryResult['defaultBranch']; @@ -73,22 +75,23 @@ export const CreateRc = ({ ); }, [semverBumpLevel, setNextGitHubInfo, latestRelease, project]); - const [createGitHubReleaseResponse, createGitHubReleaseFn] = useAsyncFn( - (...args) => - createRc({ - defaultBranch, - latestRelease, - nextGitHubInfo: args[0], - pluginApiClient, - project, - successCb, - }), - ); - if (createGitHubReleaseResponse.error) { + const { run, responseSteps, progress } = useCreateRc({ + defaultBranch, + latestRelease, + nextGitHubInfo, + pluginApiClient, + project, + successCb, + }); + if (responseSteps.length > 0) { return ( - - {createGitHubReleaseResponse.error.message} - + + Create Release Candidate (step {progress}) + + + + + ); } @@ -138,26 +141,15 @@ export const CreateRc = ({ } function CTA() { - if ( - createGitHubReleaseResponse.loading || - createGitHubReleaseResponse.value - ) { - return ( - - ); - } - return ( diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts index 824290bbb7..8cecaf6fd5 100644 --- a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts +++ b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts @@ -21,13 +21,16 @@ import { mockNextGitHubInfo, mockReleaseVersionCalver, } from '../../../test-helpers/test-helpers'; -import { createRc } from './createRc'; +import { useCreateRc } from './useCreateRc'; -describe('createRc', () => { +// TODO: Fix tests +/* eslint-disable jest/no-disabled-tests */ + +describe.skip('useCreateRc', () => { beforeEach(jest.clearAllMocks); - it('should work', async () => { - const result = await createRc({ + it('should work', () => { + const result = useCreateRc({ defaultBranch: mockDefaultBranch, latestRelease: mockReleaseVersionCalver, nextGitHubInfo: mockNextGitHubInfo, diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts deleted file mode 100644 index 06c408f022..0000000000 --- a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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 { getRcGitHubInfo } from '../getRcGitHubInfo'; -import { ComponentConfigCreateRc, ResponseStep } from '../../../types/types'; -import { - GetLatestReleaseResult, - GetRepositoryResult, - IPluginApiClient, -} from '../../../api/PluginApiClient'; -import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; -import { Project } from '../../../contexts/ProjectContext'; - -interface CreateRC { - defaultBranch: GetRepositoryResult['defaultBranch']; - latestRelease: GetLatestReleaseResult; - nextGitHubInfo: ReturnType; - pluginApiClient: IPluginApiClient; - project: Project; - successCb?: ComponentConfigCreateRc['successCb']; -} - -export async function createRc({ - defaultBranch, - latestRelease, - nextGitHubInfo, - pluginApiClient, - project, - successCb, -}: CreateRC) { - const responseSteps: ResponseStep[] = []; - - /** - * 1. Get the default branch's most recent commit - */ - const latestCommit = await pluginApiClient.getLatestCommit({ - owner: project.owner, - repo: project.repo, - defaultBranch, - }); - responseSteps.push({ - message: `Fetched latest commit from "${defaultBranch}"`, - secondaryMessage: `with message "${latestCommit.commit.message}"`, - link: latestCommit.htmlUrl, - }); - - /** - * 2. Create a new ref based on the default branch's most recent sha - */ - const mostRecentSha = latestCommit.sha; - const createdRef = await pluginApiClient.createRc - .createRef({ - owner: project.owner, - repo: project.repo, - mostRecentSha, - targetBranch: nextGitHubInfo.rcBranch, - }) - .catch(error => { - if (error?.body?.message === 'Reference already exists') { - throw new GitHubReleaseManagerError( - `Branch "${nextGitHubInfo.rcBranch}" already exists: .../tree/${nextGitHubInfo.rcBranch}`, - ); - } - throw error; - }); - responseSteps.push({ - message: 'Cut Release Branch', - secondaryMessage: `with ref "${createdRef.ref}"`, - }); - - /** - * 3. Compose a body for the release - */ - const previousReleaseBranch = latestRelease - ? latestRelease.targetCommitish - : defaultBranch; - const nextReleaseBranch = nextGitHubInfo.rcBranch; - const comparison = await pluginApiClient.createRc.getComparison({ - owner: project.owner, - repo: project.repo, - previousReleaseBranch, - nextReleaseBranch, - }); - const releaseBody = `**Compare** ${comparison.htmlUrl} - -**Ahead by** ${comparison.aheadBy} commits - -**Release branch** ${createdRef.ref} - ---- - -`; - responseSteps.push({ - message: 'Fetched commit comparison', - secondaryMessage: `${previousReleaseBranch}...${nextReleaseBranch}`, - link: comparison.htmlUrl, - }); - - /** - * 4. Creates the release itself in GitHub - */ - const createReleaseResult = await pluginApiClient.createRc.createRelease({ - owner: project.owner, - repo: project.repo, - nextGitHubInfo: nextGitHubInfo, - releaseBody, - }); - responseSteps.push({ - message: `Created Release Candidate "${createReleaseResult.name}"`, - secondaryMessage: `with tag "${nextGitHubInfo.rcReleaseTag}"`, - link: createReleaseResult.htmlUrl, - }); - - await successCb?.({ - gitHubReleaseUrl: createReleaseResult.htmlUrl, - gitHubReleaseName: createReleaseResult.name, - comparisonUrl: comparison.htmlUrl, - previousTag: latestRelease?.tagName, - createdTag: createReleaseResult.tagName, - }); - - return responseSteps; -} diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.ts b/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.ts new file mode 100644 index 0000000000..6c3596669e --- /dev/null +++ b/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.ts @@ -0,0 +1,234 @@ +/* + * 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 { useAsync, useAsyncFn } from 'react-use'; + +import { getRcGitHubInfo } from '../getRcGitHubInfo'; +import { ComponentConfigCreateRc, ResponseStep } from '../../../types/types'; +import { + GetLatestReleaseResult, + GetRepositoryResult, + IPluginApiClient, +} from '../../../api/PluginApiClient'; +import { Project } from '../../../contexts/ProjectContext'; +import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; +import { useResponseSteps } from '../../../hooks/useResponseSteps'; +import { useEffect, useState } from 'react'; + +interface CreateRC { + defaultBranch: GetRepositoryResult['defaultBranch']; + latestRelease: GetLatestReleaseResult; + nextGitHubInfo: ReturnType; + pluginApiClient: IPluginApiClient; + project: Project; + successCb?: ComponentConfigCreateRc['successCb']; +} + +export function useCreateRc({ + defaultBranch, + latestRelease, + nextGitHubInfo, + pluginApiClient, + project, + successCb, +}: CreateRC) { + const { + responseSteps, + setResponseSteps, + asyncCatcher, + abortIfError: skipIfError, + } = useResponseSteps(); + + /** + * (1) Get the default branch's most recent commit + */ + const getLatestCommit = async () => { + const latestCommit = await pluginApiClient.getLatestCommit({ + owner: project.owner, + repo: project.repo, + defaultBranch, + }); + + const responseStep: ResponseStep = { + message: `Fetched latest commit from "${defaultBranch}"`, + secondaryMessage: `with message "${latestCommit.commit.message}"`, + link: latestCommit.htmlUrl, + }; + setResponseSteps([...responseSteps, responseStep]); + + return { latestCommit }; + }; + + const [latestCommitRes, run] = useAsyncFn(async () => + getLatestCommit().catch(asyncCatcher), + ); + + /** + * (2) Create a new ref based on the default branch's most recent sha + */ + const createRcFromDefaultBranch = async (latestCommitSha: string) => { + const createdRef = await pluginApiClient.createRc + .createRef({ + owner: project.owner, + repo: project.repo, + mostRecentSha: latestCommitSha, + targetBranch: nextGitHubInfo.rcBranch, + }) + .catch(error => { + if (error?.body?.message === 'Reference already exists') { + throw new GitHubReleaseManagerError( + `Branch "${nextGitHubInfo.rcBranch}" already exists: .../tree/${nextGitHubInfo.rcBranch}`, + ); + } + throw error; + }); + + const responseStep: ResponseStep = { + message: 'Cut Release Branch', + secondaryMessage: `with ref "${createdRef.ref}"`, + }; + setResponseSteps([...responseSteps, responseStep]); + + return { ...createdRef }; + }; + + const createRcRes = useAsync(async () => { + skipIfError(latestCommitRes.error); + + if (latestCommitRes.value) { + return createRcFromDefaultBranch( + latestCommitRes.value.latestCommit.sha, + ).catch(asyncCatcher); + } + + return undefined; + }, [latestCommitRes.value, latestCommitRes.error]); + + /** + * (3) Compose a body for the release + */ + const getComparison = async (createdRefRef: string) => { + const previousReleaseBranch = latestRelease + ? latestRelease.targetCommitish + : defaultBranch; + const nextReleaseBranch = nextGitHubInfo.rcBranch; + const comparison = await pluginApiClient.createRc.getComparison({ + owner: project.owner, + repo: project.repo, + previousReleaseBranch, + nextReleaseBranch, + }); + const releaseBody = `**Compare** ${comparison.htmlUrl} + +**Ahead by** ${comparison.aheadBy} commits + +**Release branch** ${createdRefRef} + +--- + +`; + + const responseStep: ResponseStep = { + message: 'Fetched commit comparison', + secondaryMessage: `${previousReleaseBranch}...${nextReleaseBranch}`, + link: comparison.htmlUrl, + }; + setResponseSteps([...responseSteps, responseStep]); + + return { ...comparison, releaseBody }; + }; + + const getComparisonRes = useAsync(async () => { + skipIfError(createRcRes.error); + + if (createRcRes.value) { + return getComparison(createRcRes.value.ref).catch(asyncCatcher); + } + + return undefined; + }, [createRcRes.value, createRcRes.error]); + + /** + * (4) Creates the release itself in GitHub + */ + const createRelease = async (releaseBody: string) => { + const createReleaseResult = await pluginApiClient.createRc.createRelease({ + owner: project.owner, + repo: project.repo, + nextGitHubInfo: nextGitHubInfo, + releaseBody, + }); + + const responseStep: ResponseStep = { + message: `Created Release Candidate "${createReleaseResult.name}"`, + secondaryMessage: `with tag "${nextGitHubInfo.rcReleaseTag}"`, + link: createReleaseResult.htmlUrl, + }; + setResponseSteps([...responseSteps, responseStep]); + + return { ...createReleaseResult }; + }; + + const createReleaseRes = useAsync(async () => { + skipIfError(getComparisonRes.error); + + if (getComparisonRes.value) { + return createRelease(getComparisonRes.value.releaseBody).catch( + asyncCatcher, + ); + } + + return undefined; + }, [getComparisonRes.value, getComparisonRes.error]); + + /** + * (5) Run successCb if defined + */ + useAsync(async () => { + if (successCb && !!createReleaseRes.value && !!getComparisonRes.value) { + skipIfError(createReleaseRes.error); + + try { + await successCb({ + comparisonUrl: getComparisonRes.value.htmlUrl, + createdTag: createReleaseRes.value.tagName, + gitHubReleaseName: createReleaseRes.value.name, + gitHubReleaseUrl: createReleaseRes.value.htmlUrl, + previousTag: latestRelease?.tagName, + }); + } catch (error) { + asyncCatcher(error); + } + + const responseStep: ResponseStep = { + message: 'Success callback successfully called 🚀', + icon: 'success', + }; + setResponseSteps([...responseSteps, responseStep]); + } + }, [createReleaseRes.value]); + + const [progress, setProgress] = useState(0); + useEffect(() => { + setProgress((responseSteps.length / (4 + (!!successCb ? 1 : 0))) * 100); + }, [responseSteps.length, successCb]); + + return { + run, + responseSteps, + progress, + }; +} diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx index f6f16f0199..c32b692c14 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx @@ -278,7 +278,6 @@ export const PatchBody = ({ responseSteps={patchReleaseResponse.value} loading={patchReleaseResponse.loading} title="Patch result" - closeable /> ); } diff --git a/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx b/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx index ffea5659a1..14a860031b 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx +++ b/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx @@ -16,18 +16,17 @@ import React from 'react'; import { useAsyncFn } from 'react-use'; -import { Alert } from '@material-ui/lab'; -import { Button, Typography } from '@material-ui/core'; +import { Button, Dialog, DialogTitle, Typography } from '@material-ui/core'; import { Differ } from '../../components/Differ'; import { ComponentConfigPromoteRc } from '../../types/types'; import { promoteRc } from './sideEffects/promoteRc'; -import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; import { useProjectContext } from '../../contexts/ProjectContext'; import { useStyles } from '../../styles/styles'; import { GetLatestReleaseResult } from '../../api/PluginApiClient'; +import { ResponseStepList2 } from '../../components/ResponseStepList/ResponseStepList2'; interface PromoteRcBodyProps { rcRelease: NonNullable; @@ -49,42 +48,26 @@ export const PromoteRcBody = ({ rcRelease, successCb }: PromoteRcBodyProps) => { }), ); - if (promoteGitHubRcResponse.error) { + if (promoteGitHubRcResponse.loading || promoteGitHubRcResponse.value) { return ( - {promoteGitHubRcResponse.error.message} + + Hello + + + ); } - function Description() { - return ( - <> - - Promotes the current Release Candidate to a Release Version. - + return ( + <> + + Promotes the current Release Candidate to a Release Version. + - - - - - ); - } + + + - function CTA() { - if (promoteGitHubRcResponse.loading || promoteGitHubRcResponse.value) { - return ( - - ); - } - - return ( - ); - } - - return ( -
- - - -
+ ); }; diff --git a/plugins/github-release-manager/src/components/LinearProgressWithLabel.tsx b/plugins/github-release-manager/src/components/LinearProgressWithLabel.tsx new file mode 100644 index 0000000000..9b0a0ec1f9 --- /dev/null +++ b/plugins/github-release-manager/src/components/LinearProgressWithLabel.tsx @@ -0,0 +1,40 @@ +/* + * 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 React from 'react'; +import { + Box, + LinearProgress, + LinearProgressProps, + Typography, +} from '@material-ui/core'; + +export function LinearProgressWithLabel( + props: LinearProgressProps & { value: number }, +) { + return ( + + + + + + {`${Math.round( + props.value, + )}%`} + + + ); +} diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx index 5c309cf394..c3b84487f3 100644 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx @@ -31,7 +31,7 @@ import { TEST_IDS } from '../../test-helpers/test-ids'; import { useRefetchContext } from '../../contexts/RefetchContext'; interface ResponseStepListProps { - responseSteps?: ResponseStep[]; + responseSteps?: (ResponseStep | undefined)[]; title: string; animationDelay?: number; loading: boolean; @@ -43,27 +43,14 @@ export const ResponseStepList = ({ responseSteps, animationDelay, loading = false, - closeable = false, denseList = false, title, children, }: PropsWithChildren) => { - const [open, setOpen] = React.useState(true); const { setRefetchTrigger } = useRefetchContext(); - const handleClose = () => setOpen(false); - return ( - { - if (closeable) { - handleClose(); - } - }} - maxWidth="md" - fullWidth - > + {title} {loading || !responseSteps ? ( @@ -78,29 +65,25 @@ export const ResponseStepList = ({ data-testid={TEST_IDS.components.responseStepListDialogContent} > - {responseSteps.map((responseStep, index) => ( - - ))} + {responseSteps.map((responseStep, index) => { + if (!responseStep) { + return null; + } + + return ( + + ); + })} {children} - {closeable && ( - - )} + + + )} + + ); +}; diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx index dd54a7a11d..08ac005c8d 100644 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ -import React, { useEffect, useState } from 'react'; +import React from 'react'; import { colors, IconButton, @@ -60,19 +60,9 @@ const useStyles = makeStyles({ export const ResponseStepListItem = ({ responseStep, - index, animationDelay = 300, }: ResponseStepListItemProps) => { const classes = useStyles({ animationDelay }); - const [renderMe, setRenderMe] = useState(false); - - useEffect(() => { - const timeoutId = setTimeout(() => { - setRenderMe(true); - }, animationDelay * index); - - return () => clearTimeout(timeoutId); - }, [animationDelay, index, setRenderMe]); function ItemIcon() { if (responseStep.icon === 'success') { @@ -120,7 +110,7 @@ export const ResponseStepListItem = ({ return ( diff --git a/plugins/github-release-manager/src/helpers/createResponseStepError.ts b/plugins/github-release-manager/src/helpers/createResponseStepError.ts new file mode 100644 index 0000000000..7de042a7e7 --- /dev/null +++ b/plugins/github-release-manager/src/helpers/createResponseStepError.ts @@ -0,0 +1,25 @@ +/* + * 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 { ResponseStep } from '../types/types'; + +export function createResponseStepError(error: Error): ResponseStep { + return { + message: 'Something went wrong ❌', + secondaryMessage: `Error message: ${error.message}`, + icon: 'failure', + }; +} diff --git a/plugins/github-release-manager/src/hooks/useResponseSteps.ts b/plugins/github-release-manager/src/hooks/useResponseSteps.ts new file mode 100644 index 0000000000..7efa4188f6 --- /dev/null +++ b/plugins/github-release-manager/src/hooks/useResponseSteps.ts @@ -0,0 +1,55 @@ +/* + * 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 { useState } from 'react'; + +import { ResponseStep } from '../types/types'; + +export function useResponseSteps() { + const [responseSteps, setResponseSteps] = useState([]); + + function abortIfError(error?: Error) { + const RESPONSE_STEP_SKIP = { + responseStep: { + message: 'Skipped due to error in previous step', + icon: 'failure', + } as ResponseStep, + }; + + if (error) { + setResponseSteps([...responseSteps, RESPONSE_STEP_SKIP.responseStep]); + throw error; + } + } + + function asyncCatcher(error: Error) { + const responseStepError: ResponseStep = { + message: 'Something went wrong ❌', + secondaryMessage: `Error message: ${error.message}`, + icon: 'failure', + }; + + setResponseSteps([...responseSteps, responseStepError]); + throw error; + } + + return { + responseSteps, + setResponseSteps, + asyncCatcher, + abortIfError, + }; +} From fef2edfc22eff87a930cc52e7b8238c40259b4c2 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Tue, 20 Apr 2021 10:22:26 +0200 Subject: [PATCH 050/485] Add useResponseSteps to promoteRc & patch as well Signed-off-by: Erik Engervall --- .../src/api/PluginApiClient.ts | 3 +- .../src/cards/createRc/CreateRc.tsx | 2 +- .../{createRc.test.ts => useCreateRc.test.ts} | 0 .../cards/createRc/sideEffects/useCreateRc.ts | 162 ++++---- .../src/cards/patchRc/PatchBody.test.tsx | 12 +- .../src/cards/patchRc/PatchBody.tsx | 65 ++-- .../src/cards/patchRc/sideEffects/patch.ts | 208 ----------- .../{patch.test.ts => usePatch.test.ts} | 11 +- .../src/cards/patchRc/sideEffects/usePatch.ts | 352 ++++++++++++++++++ .../cards/promoteRc/PromoteRcBody.test.tsx | 7 + .../src/cards/promoteRc/PromoteRcBody.tsx | 31 +- .../cards/promoteRc/sideEffects/promoteRc.ts | 64 ---- ...promoteRc.test.ts => usePromoteRc.test.ts} | 16 +- .../promoteRc/sideEffects/usePromoteRc.ts | 112 ++++++ .../src/hooks/useResponseSteps.ts | 8 +- 15 files changed, 622 insertions(+), 431 deletions(-) rename plugins/github-release-manager/src/cards/createRc/sideEffects/{createRc.test.ts => useCreateRc.test.ts} (100%) delete mode 100644 plugins/github-release-manager/src/cards/patchRc/sideEffects/patch.ts rename plugins/github-release-manager/src/cards/patchRc/sideEffects/{patch.test.ts => usePatch.test.ts} (93%) create mode 100644 plugins/github-release-manager/src/cards/patchRc/sideEffects/usePatch.ts delete mode 100644 plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.ts rename plugins/github-release-manager/src/cards/promoteRc/sideEffects/{promoteRc.test.ts => usePromoteRc.test.ts} (83%) create mode 100644 plugins/github-release-manager/src/cards/promoteRc/sideEffects/usePromoteRc.ts diff --git a/plugins/github-release-manager/src/api/PluginApiClient.ts b/plugins/github-release-manager/src/api/PluginApiClient.ts index 04f39539eb..9c6b840989 100644 --- a/plugins/github-release-manager/src/api/PluginApiClient.ts +++ b/plugins/github-release-manager/src/api/PluginApiClient.ts @@ -414,8 +414,7 @@ export class PluginApiClient implements IPluginApiClient { repo, message: `[patch ${bumpedTag}] ${selectedPatchCommit.commit.message} -${selectedPatchCommit.sha} -${selectedPatchCommit.htmlUrl}`, +${selectedPatchCommit.sha}`, tree: mergeTree, parents: [releaseBranchSha], }); diff --git a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx index 3b08198457..172375f115 100644 --- a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx +++ b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx @@ -86,7 +86,7 @@ export const CreateRc = ({ if (responseSteps.length > 0) { return ( - Create Release Candidate (step {progress}) + Create Release Candidate diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts b/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.test.ts similarity index 100% rename from plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.test.ts rename to plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.test.ts diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.ts b/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.ts index 6c3596669e..eb11e25702 100644 --- a/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.ts +++ b/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.ts @@ -14,10 +14,11 @@ * limitations under the License. */ +import { useEffect, useState } from 'react'; import { useAsync, useAsyncFn } from 'react-use'; import { getRcGitHubInfo } from '../getRcGitHubInfo'; -import { ComponentConfigCreateRc, ResponseStep } from '../../../types/types'; +import { ComponentConfigCreateRc } from '../../../types/types'; import { GetLatestReleaseResult, GetRepositoryResult, @@ -26,7 +27,6 @@ import { import { Project } from '../../../contexts/ProjectContext'; import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; import { useResponseSteps } from '../../../hooks/useResponseSteps'; -import { useEffect, useState } from 'react'; interface CreateRC { defaultBranch: GetRepositoryResult['defaultBranch']; @@ -47,44 +47,46 @@ export function useCreateRc({ }: CreateRC) { const { responseSteps, - setResponseSteps, + addStepToResponseSteps, asyncCatcher, - abortIfError: skipIfError, + abortIfError, } = useResponseSteps(); /** * (1) Get the default branch's most recent commit */ - const getLatestCommit = async () => { - const latestCommit = await pluginApiClient.getLatestCommit({ - owner: project.owner, - repo: project.repo, - defaultBranch, - }); + const [latestCommitRes, run] = useAsyncFn(async () => { + const latestCommit = await pluginApiClient + .getLatestCommit({ + owner: project.owner, + repo: project.repo, + defaultBranch, + }) + .catch(asyncCatcher); - const responseStep: ResponseStep = { + addStepToResponseSteps({ message: `Fetched latest commit from "${defaultBranch}"`, secondaryMessage: `with message "${latestCommit.commit.message}"`, link: latestCommit.htmlUrl, + }); + + return { + latestCommit, }; - setResponseSteps([...responseSteps, responseStep]); - - return { latestCommit }; - }; - - const [latestCommitRes, run] = useAsyncFn(async () => - getLatestCommit().catch(asyncCatcher), - ); + }); /** * (2) Create a new ref based on the default branch's most recent sha */ - const createRcFromDefaultBranch = async (latestCommitSha: string) => { + const createRcRes = useAsync(async () => { + abortIfError(latestCommitRes.error); + if (!latestCommitRes.value) return undefined; + const createdRef = await pluginApiClient.createRc .createRef({ owner: project.owner, repo: project.repo, - mostRecentSha: latestCommitSha, + mostRecentSha: latestCommitRes.value.latestCommit.sha, targetBranch: nextGitHubInfo.rcBranch, }) .catch(error => { @@ -94,104 +96,86 @@ export function useCreateRc({ ); } throw error; - }); + }) + .catch(asyncCatcher); - const responseStep: ResponseStep = { + addStepToResponseSteps({ message: 'Cut Release Branch', secondaryMessage: `with ref "${createdRef.ref}"`, + }); + + return { + ...createdRef, }; - setResponseSteps([...responseSteps, responseStep]); - - return { ...createdRef }; - }; - - const createRcRes = useAsync(async () => { - skipIfError(latestCommitRes.error); - - if (latestCommitRes.value) { - return createRcFromDefaultBranch( - latestCommitRes.value.latestCommit.sha, - ).catch(asyncCatcher); - } - - return undefined; }, [latestCommitRes.value, latestCommitRes.error]); /** * (3) Compose a body for the release */ - const getComparison = async (createdRefRef: string) => { + const getComparisonRes = useAsync(async () => { + abortIfError(createRcRes.error); + if (!createRcRes.value) return undefined; + const previousReleaseBranch = latestRelease ? latestRelease.targetCommitish : defaultBranch; const nextReleaseBranch = nextGitHubInfo.rcBranch; - const comparison = await pluginApiClient.createRc.getComparison({ - owner: project.owner, - repo: project.repo, - previousReleaseBranch, - nextReleaseBranch, - }); + const comparison = await pluginApiClient.createRc + .getComparison({ + owner: project.owner, + repo: project.repo, + previousReleaseBranch, + nextReleaseBranch, + }) + .catch(asyncCatcher); + const releaseBody = `**Compare** ${comparison.htmlUrl} **Ahead by** ${comparison.aheadBy} commits -**Release branch** ${createdRefRef} +**Release branch** ${createRcRes.value.ref} --- `; - const responseStep: ResponseStep = { + addStepToResponseSteps({ message: 'Fetched commit comparison', secondaryMessage: `${previousReleaseBranch}...${nextReleaseBranch}`, link: comparison.htmlUrl, + }); + + return { + ...comparison, + releaseBody, }; - setResponseSteps([...responseSteps, responseStep]); - - return { ...comparison, releaseBody }; - }; - - const getComparisonRes = useAsync(async () => { - skipIfError(createRcRes.error); - - if (createRcRes.value) { - return getComparison(createRcRes.value.ref).catch(asyncCatcher); - } - - return undefined; }, [createRcRes.value, createRcRes.error]); /** * (4) Creates the release itself in GitHub */ - const createRelease = async (releaseBody: string) => { - const createReleaseResult = await pluginApiClient.createRc.createRelease({ - owner: project.owner, - repo: project.repo, - nextGitHubInfo: nextGitHubInfo, - releaseBody, - }); + const createReleaseRes = useAsync(async () => { + abortIfError(getComparisonRes.error); + if (!getComparisonRes.value) return undefined; - const responseStep: ResponseStep = { + const createReleaseResult = await pluginApiClient.createRc + .createRelease({ + owner: project.owner, + repo: project.repo, + nextGitHubInfo: nextGitHubInfo, + releaseBody: getComparisonRes.value.releaseBody, + }) + .catch(asyncCatcher); + + addStepToResponseSteps({ message: `Created Release Candidate "${createReleaseResult.name}"`, secondaryMessage: `with tag "${nextGitHubInfo.rcReleaseTag}"`, link: createReleaseResult.htmlUrl, + }); + + return { + ...createReleaseResult, }; - setResponseSteps([...responseSteps, responseStep]); - - return { ...createReleaseResult }; - }; - - const createReleaseRes = useAsync(async () => { - skipIfError(getComparisonRes.error); - - if (getComparisonRes.value) { - return createRelease(getComparisonRes.value.releaseBody).catch( - asyncCatcher, - ); - } - - return undefined; }, [getComparisonRes.value, getComparisonRes.error]); /** @@ -199,7 +183,7 @@ export function useCreateRc({ */ useAsync(async () => { if (successCb && !!createReleaseRes.value && !!getComparisonRes.value) { - skipIfError(createReleaseRes.error); + abortIfError(createReleaseRes.error); try { await successCb({ @@ -213,18 +197,18 @@ export function useCreateRc({ asyncCatcher(error); } - const responseStep: ResponseStep = { + addStepToResponseSteps({ message: 'Success callback successfully called 🚀', icon: 'success', - }; - setResponseSteps([...responseSteps, responseStep]); + }); } }, [createReleaseRes.value]); + const TOTAL_STEPS = 4 + (!!successCb ? 1 : 0); const [progress, setProgress] = useState(0); useEffect(() => { - setProgress((responseSteps.length / (4 + (!!successCb ? 1 : 0))) * 100); - }, [responseSteps.length, successCb]); + setProgress((responseSteps.length / TOTAL_STEPS) * 100); + }, [TOTAL_STEPS, responseSteps.length]); return { run, diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx index 7cae67d126..3f62c1a262 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx @@ -33,11 +33,21 @@ jest.mock('../../contexts/PluginApiClientContext', () => ({ jest.mock('../../contexts/ProjectContext', () => ({ useProjectContext: jest.fn(() => mockCalverProject), })); +jest.mock('./sideEffects/usePatch', () => ({ + useCreateRc: () => ({ + run: jest.fn(), + responseSteps: [], + progress: 0, + }), +})); import { PatchBody } from './PatchBody'; import { TEST_IDS } from '../../test-helpers/test-ids'; -describe('PatchBody', () => { +// TODO: Fix tests +/* eslint-disable jest/no-disabled-tests */ + +describe.skip('PatchBody', () => { beforeEach(jest.clearAllMocks); it('should render error', async () => { diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx index c32b692c14..0123363768 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx @@ -15,11 +15,13 @@ */ import React, { useState } from 'react'; -import { useAsync, useAsyncFn } from 'react-use'; +import { useAsync } from 'react-use'; import { Alert, AlertTitle } from '@material-ui/lab'; import { Button, Checkbox, + Dialog, + DialogTitle, IconButton, Link, List, @@ -37,8 +39,7 @@ import { CalverTagParts } from '../../helpers/tagParts/getCalverTagParts'; import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; import { ComponentConfigPatch } from '../../types/types'; import { Differ } from '../../components/Differ'; -import { patch } from './sideEffects/patch'; -import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; +import { usePatch } from './sideEffects/usePatch'; import { SemverTagParts } from '../../helpers/tagParts/getSemverTagParts'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; @@ -47,9 +48,10 @@ import { useStyles } from '../../styles/styles'; import { GetBranchResult, GetLatestReleaseResult, - GetRecentCommitsResultSingle, } from '../../api/PluginApiClient'; import { GitHubReleaseManagerError } from '../../errors/GitHubReleaseManagerError'; +import { LinearProgressWithLabel } from '../../components/LinearProgressWithLabel'; +import { ResponseStepList2 } from '../../components/ResponseStepList/ResponseStepList2'; interface PatchBodyProps { bumpedTag: string; @@ -92,20 +94,25 @@ export const PatchBody = ({ }; }); - const [patchReleaseResponse, patchReleaseFn] = useAsyncFn(async (...args) => { - const selectedPatchCommit: GetRecentCommitsResultSingle = args[0]; - const patchResponseSteps = await patch({ - project, - pluginApiClient, - bumpedTag, - latestRelease, - selectedPatchCommit, - successCb, - tagParts, - }); - - return patchResponseSteps; + const { run, responseSteps, progress } = usePatch({ + bumpedTag, + latestRelease, + pluginApiClient, + project, + tagParts, + successCb, }); + if (responseSteps.length > 0) { + return ( + + Patch Release Candidate + + + + + + ); + } if (githubDataResponse.error) { return ( @@ -115,10 +122,6 @@ export const PatchBody = ({ ); } - if (patchReleaseResponse.error) { - return {patchReleaseResponse.error.message}; - } - if (githubDataResponse.loading) { return ; } @@ -192,11 +195,7 @@ export const PatchBody = ({ 0) || - commitExistsOnReleaseBranch || - hasNoParent + progress > 0 || commitExistsOnReleaseBranch || hasNoParent } role={undefined} dense @@ -272,19 +271,9 @@ export const PatchBody = ({ } function CTA() { - if (patchReleaseResponse.loading || patchReleaseResponse.value) { - return ( - - ); - } - return ( diff --git a/plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.ts b/plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.ts deleted file mode 100644 index b7a275f3b5..0000000000 --- a/plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.ts +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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 { ComponentConfigPromoteRc, ResponseStep } from '../../../types/types'; -import { - GetLatestReleaseResult, - IPluginApiClient, -} from '../../../api/PluginApiClient'; -import { Project } from '../../../contexts/ProjectContext'; - -interface PromoteRc { - pluginApiClient: IPluginApiClient; - project: Project; - rcRelease: NonNullable; - releaseVersion: string; - successCb?: ComponentConfigPromoteRc['successCb']; -} - -export function promoteRc({ - pluginApiClient, - project, - rcRelease, - releaseVersion, - successCb, -}: PromoteRc) { - return async (): Promise => { - const responseSteps: ResponseStep[] = []; - - const promotedRelease = await pluginApiClient.promoteRc.promoteRelease({ - ...project, - releaseId: rcRelease.id, - releaseVersion, - }); - responseSteps.push({ - message: `Promoted "${promotedRelease.name}"`, - secondaryMessage: `from "${rcRelease.tagName}" to "${promotedRelease.tagName}"`, - link: promotedRelease.htmlUrl, - }); - - await successCb?.({ - gitHubReleaseUrl: promotedRelease.htmlUrl, - gitHubReleaseName: promotedRelease.name, - previousTagUrl: rcRelease.htmlUrl, - previousTag: rcRelease.tagName, - updatedTagUrl: promotedRelease.htmlUrl, - updatedTag: promotedRelease.tagName, - }); - - return responseSteps; - }; -} diff --git a/plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.test.ts b/plugins/github-release-manager/src/cards/promoteRc/sideEffects/usePromoteRc.test.ts similarity index 83% rename from plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.test.ts rename to plugins/github-release-manager/src/cards/promoteRc/sideEffects/usePromoteRc.test.ts index 109f886e5b..d1ef45d9d6 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/sideEffects/promoteRc.test.ts +++ b/plugins/github-release-manager/src/cards/promoteRc/sideEffects/usePromoteRc.test.ts @@ -19,18 +19,22 @@ import { mockReleaseCandidateCalver, mockSemverProject, } from '../../../test-helpers/test-helpers'; -import { promoteRc } from './promoteRc'; +import { usePromoteRc } from './usePromoteRc'; -describe('promoteRc', () => { +// TODO: Fix tests +/* eslint-disable jest/no-disabled-tests */ + +describe.skip('usePromoteRc', () => { beforeEach(jest.clearAllMocks); - it('should work', async () => { - const result = await promoteRc({ + it('should work', () => { + const result = usePromoteRc({ pluginApiClient: mockApiClient, + project: mockSemverProject, rcRelease: mockReleaseCandidateCalver, releaseVersion: 'version-1.2.3', - project: mockSemverProject, - })(); + successCb: jest.fn(), + }); expect(result).toMatchInlineSnapshot(` Array [ diff --git a/plugins/github-release-manager/src/cards/promoteRc/sideEffects/usePromoteRc.ts b/plugins/github-release-manager/src/cards/promoteRc/sideEffects/usePromoteRc.ts new file mode 100644 index 0000000000..b882b0bdcf --- /dev/null +++ b/plugins/github-release-manager/src/cards/promoteRc/sideEffects/usePromoteRc.ts @@ -0,0 +1,112 @@ +/* + * 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 { useState, useEffect } from 'react'; +import { useAsync, useAsyncFn } from 'react-use'; + +import { ComponentConfigPromoteRc } from '../../../types/types'; +import { + GetLatestReleaseResult, + IPluginApiClient, +} from '../../../api/PluginApiClient'; +import { Project } from '../../../contexts/ProjectContext'; +import { useResponseSteps } from '../../../hooks/useResponseSteps'; + +interface PromoteRc { + pluginApiClient: IPluginApiClient; + project: Project; + rcRelease: NonNullable; + releaseVersion: string; + successCb?: ComponentConfigPromoteRc['successCb']; +} + +export function usePromoteRc({ + pluginApiClient, + project, + rcRelease, + releaseVersion, + successCb, +}: PromoteRc) { + const { + responseSteps, + addStepToResponseSteps, + asyncCatcher, + abortIfError, + } = useResponseSteps(); + + /** + * (1) Promote Release Candidate to Release Version + */ + const [promotedReleaseRes, run] = useAsyncFn(async () => { + const promotedRelease = await pluginApiClient.promoteRc + .promoteRelease({ + owner: project.owner, + repo: project.repo, + releaseId: rcRelease.id, + releaseVersion, + }) + .catch(asyncCatcher); + + addStepToResponseSteps({ + message: `Promoted "${promotedRelease.name}"`, + secondaryMessage: `from "${rcRelease.tagName}" to "${promotedRelease.tagName}"`, + link: promotedRelease.htmlUrl, + }); + + return { + ...promotedRelease, + }; + }); + + /** + * (2) Run successCb if defined + */ + useAsync(async () => { + if (successCb && !!promotedReleaseRes.value) { + abortIfError(promotedReleaseRes.error); + + try { + await successCb?.({ + gitHubReleaseUrl: promotedReleaseRes.value.htmlUrl, + gitHubReleaseName: promotedReleaseRes.value.name, + previousTagUrl: rcRelease.htmlUrl, + previousTag: rcRelease.tagName, + updatedTagUrl: promotedReleaseRes.value.htmlUrl, + updatedTag: promotedReleaseRes.value.tagName, + }); + } catch (error) { + asyncCatcher(error); + } + + addStepToResponseSteps({ + message: 'Success callback successfully called 🚀', + icon: 'success', + }); + } + }, [promotedReleaseRes.value]); + + const TOTAL_STEPS = 1 + (!!successCb ? 1 : 0); + const [progress, setProgress] = useState(0); + useEffect(() => { + setProgress((responseSteps.length / TOTAL_STEPS) * 100); + }, [TOTAL_STEPS, responseSteps.length]); + + return { + run, + responseSteps, + progress, + }; +} diff --git a/plugins/github-release-manager/src/hooks/useResponseSteps.ts b/plugins/github-release-manager/src/hooks/useResponseSteps.ts index 7efa4188f6..dae2612df1 100644 --- a/plugins/github-release-manager/src/hooks/useResponseSteps.ts +++ b/plugins/github-release-manager/src/hooks/useResponseSteps.ts @@ -35,7 +35,7 @@ export function useResponseSteps() { } } - function asyncCatcher(error: Error) { + function asyncCatcher(error: Error): never { const responseStepError: ResponseStep = { message: 'Something went wrong ❌', secondaryMessage: `Error message: ${error.message}`, @@ -46,9 +46,13 @@ export function useResponseSteps() { throw error; } + function addStepToResponseSteps(responseStep: ResponseStep) { + setResponseSteps([...responseSteps, responseStep]); + } + return { responseSteps, - setResponseSteps, + addStepToResponseSteps, asyncCatcher, abortIfError, }; From 546005f732c75b457f9632cf29fd802e544e1a54 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Tue, 20 Apr 2021 13:23:36 +0200 Subject: [PATCH 051/485] Add @testing-library/react-hooks devDep Fix tests for Components that use hooks Remove ReloadButton component Signed-off-by: Erik Engervall --- plugins/github-release-manager/package.json | 5 +- .../src/cards/createRc/CreateRc.tsx | 4 +- .../createRc/sideEffects/useCreateRc.test.ts | 65 --------- .../createRc/sideEffects/useCreateRc.test.tsx | 100 +++++++++++++ .../src/cards/patchRc/PatchBody.test.tsx | 7 +- .../src/cards/patchRc/PatchBody.tsx | 4 +- .../patchRc/sideEffects/usePatch.test.ts | 134 ++++++++++++------ .../src/cards/promoteRc/PromoteRcBody.tsx | 4 +- .../sideEffects/usePromoteRc.test.ts | 71 +++++++--- .../src/components/ReloadButton.test.tsx | 29 ---- .../src/components/ReloadButton.tsx | 36 ----- .../ResponseStepList.test.tsx | 7 +- .../ResponseStepList/ResponseStepList.tsx | 23 +-- .../ResponseStepList/ResponseStepList2.tsx | 91 ------------ .../src/hooks/useQueryHandler.test.tsx | 4 +- .../src/test-helpers/test-ids.ts | 1 - yarn.lock | 52 +++++++ 17 files changed, 313 insertions(+), 324 deletions(-) delete mode 100644 plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.test.ts create mode 100644 plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.test.tsx delete mode 100644 plugins/github-release-manager/src/components/ReloadButton.test.tsx delete mode 100644 plugins/github-release-manager/src/components/ReloadButton.tsx delete mode 100644 plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList2.tsx diff --git a/plugins/github-release-manager/package.json b/plugins/github-release-manager/package.json index bd6939a128..cd32f0c105 100644 --- a/plugins/github-release-manager/package.json +++ b/plugins/github-release-manager/package.json @@ -39,12 +39,13 @@ "@backstage/dev-utils": "^0.1.13", "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", + "@testing-library/react-hooks": "^5.1.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^12.0.7", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", - "msw": "^0.21.2", - "cross-fetch": "^3.0.6" + "cross-fetch": "^3.0.6", + "msw": "^0.21.2" }, "files": [ "dist" diff --git a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx index 172375f115..f3c55693dc 100644 --- a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx +++ b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx @@ -42,7 +42,7 @@ import { GetLatestReleaseResult, GetRepositoryResult, } from '../../api/PluginApiClient'; -import { ResponseStepList2 } from '../../components/ResponseStepList/ResponseStepList2'; +import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; import { LinearProgressWithLabel } from '../../components/LinearProgressWithLabel'; interface CreateRcProps { @@ -90,7 +90,7 @@ export const CreateRc = ({ - + ); } diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.test.ts b/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.test.ts deleted file mode 100644 index 8cecaf6fd5..0000000000 --- a/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.test.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 { - mockApiClient, - mockCalverProject, - mockDefaultBranch, - mockNextGitHubInfo, - mockReleaseVersionCalver, -} from '../../../test-helpers/test-helpers'; -import { useCreateRc } from './useCreateRc'; - -// TODO: Fix tests -/* eslint-disable jest/no-disabled-tests */ - -describe.skip('useCreateRc', () => { - beforeEach(jest.clearAllMocks); - - it('should work', () => { - const result = useCreateRc({ - defaultBranch: mockDefaultBranch, - latestRelease: mockReleaseVersionCalver, - nextGitHubInfo: mockNextGitHubInfo, - pluginApiClient: mockApiClient, - project: mockCalverProject, - }); - - expect(result).toMatchInlineSnapshot(` - Array [ - Object { - "link": "latestCommit.html_url", - "message": "Fetched latest commit from \\"mock_defaultBranch\\"", - "secondaryMessage": "with message \\"latestCommit.commit.message\\"", - }, - Object { - "message": "Cut Release Branch", - "secondaryMessage": "with ref \\"mock_createRef_ref\\"", - }, - Object { - "link": "mock_compareCommits_html_url", - "message": "Fetched commit comparison", - "secondaryMessage": "rc/1.2.3...rc/1.2.3", - }, - Object { - "link": "mock_createRelease_html_url", - "message": "Created Release Candidate \\"mock_createRelease_name\\"", - "secondaryMessage": "with tag \\"rc-1.2.3\\"", - }, - ] - `); - }); -}); diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.test.tsx b/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.test.tsx new file mode 100644 index 0000000000..b0ce35a3ec --- /dev/null +++ b/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.test.tsx @@ -0,0 +1,100 @@ +/* + * 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 { renderHook, act } from '@testing-library/react-hooks'; +import { waitFor } from '@testing-library/react'; + +import { + mockApiClient, + mockCalverProject, + mockDefaultBranch, + mockNextGitHubInfo, + mockReleaseVersionCalver, +} from '../../../test-helpers/test-helpers'; +import { useCreateRc } from './useCreateRc'; + +describe('useCreateRc', () => { + beforeEach(jest.clearAllMocks); + + it('should return the expected responseSteps and progress', async () => { + const { result } = renderHook(() => + useCreateRc({ + defaultBranch: mockDefaultBranch, + latestRelease: mockReleaseVersionCalver, + nextGitHubInfo: mockNextGitHubInfo, + pluginApiClient: mockApiClient, + project: mockCalverProject, + }), + ); + + await act(async () => { + await waitFor(() => result.current.run()); + }); + + expect(result.error).toEqual(undefined); + expect(result.current.responseSteps).toHaveLength(4); + }); + + it('should return the expected responseSteps and progress (with successCb)', async () => { + const { result } = renderHook(() => + useCreateRc({ + defaultBranch: mockDefaultBranch, + latestRelease: mockReleaseVersionCalver, + nextGitHubInfo: mockNextGitHubInfo, + pluginApiClient: mockApiClient, + project: mockCalverProject, + successCb: jest.fn(), + }), + ); + + await act(async () => { + await waitFor(() => result.current.run()); + }); + + expect(result.current.responseSteps).toHaveLength(5); + expect(result.current).toMatchInlineSnapshot(` + Object { + "progress": 100, + "responseSteps": Array [ + Object { + "link": "latestCommit.html_url", + "message": "Fetched latest commit from \\"mock_defaultBranch\\"", + "secondaryMessage": "with message \\"latestCommit.commit.message\\"", + }, + Object { + "message": "Cut Release Branch", + "secondaryMessage": "with ref \\"mock_createRef_ref\\"", + }, + Object { + "link": "mock_compareCommits_html_url", + "message": "Fetched commit comparison", + "secondaryMessage": "rc/1.2.3...rc/1.2.3", + }, + Object { + "link": "mock_createRelease_html_url", + "message": "Created Release Candidate \\"mock_createRelease_name\\"", + "secondaryMessage": "with tag \\"rc-1.2.3\\"", + }, + Object { + "icon": "success", + "message": "Success callback successfully called 🚀", + }, + ], + "run": [Function], + } + `); + }); +}); diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx index 3f62c1a262..f9a8babb5d 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx @@ -34,7 +34,7 @@ jest.mock('../../contexts/ProjectContext', () => ({ useProjectContext: jest.fn(() => mockCalverProject), })); jest.mock('./sideEffects/usePatch', () => ({ - useCreateRc: () => ({ + usePatch: () => ({ run: jest.fn(), responseSteps: [], progress: 0, @@ -44,10 +44,7 @@ jest.mock('./sideEffects/usePatch', () => ({ import { PatchBody } from './PatchBody'; import { TEST_IDS } from '../../test-helpers/test-ids'; -// TODO: Fix tests -/* eslint-disable jest/no-disabled-tests */ - -describe.skip('PatchBody', () => { +describe('PatchBody', () => { beforeEach(jest.clearAllMocks); it('should render error', async () => { diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx index 0123363768..cd001c5110 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx @@ -51,7 +51,7 @@ import { } from '../../api/PluginApiClient'; import { GitHubReleaseManagerError } from '../../errors/GitHubReleaseManagerError'; import { LinearProgressWithLabel } from '../../components/LinearProgressWithLabel'; -import { ResponseStepList2 } from '../../components/ResponseStepList/ResponseStepList2'; +import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; interface PatchBodyProps { bumpedTag: string; @@ -109,7 +109,7 @@ export const PatchBody = ({ - + ); } diff --git a/plugins/github-release-manager/src/cards/patchRc/sideEffects/usePatch.test.ts b/plugins/github-release-manager/src/cards/patchRc/sideEffects/usePatch.test.ts index 17892c3c9d..ff280ed181 100644 --- a/plugins/github-release-manager/src/cards/patchRc/sideEffects/usePatch.test.ts +++ b/plugins/github-release-manager/src/cards/patchRc/sideEffects/usePatch.test.ts @@ -14,66 +14,106 @@ * limitations under the License. */ +import { renderHook, act } from '@testing-library/react-hooks'; +import { waitFor } from '@testing-library/react'; + import { mockApiClient, mockBumpedTag, mockCalverProject, mockReleaseVersionCalver, + mockSelectedPatchCommit, mockTagParts, } from '../../../test-helpers/test-helpers'; import { usePatch } from './usePatch'; -// TODO: Fix tests -/* eslint-disable jest/no-disabled-tests */ - -describe.skip('patch', () => { +describe('patch', () => { beforeEach(jest.clearAllMocks); - it('should work', async () => { - const result = await usePatch({ - bumpedTag: mockBumpedTag, - latestRelease: mockReleaseVersionCalver, - pluginApiClient: mockApiClient, - project: mockCalverProject, - tagParts: mockTagParts, + it('should return the expected responseSteps and progress', async () => { + const { result } = renderHook(() => + usePatch({ + bumpedTag: mockBumpedTag, + latestRelease: mockReleaseVersionCalver, + pluginApiClient: mockApiClient, + project: mockCalverProject, + tagParts: mockTagParts, + }), + ); + + await act(async () => { + await waitFor(() => result.current.run(mockSelectedPatchCommit)); }); - expect(result).toMatchInlineSnapshot(` - Array [ - Object { - "link": "mock_branch_links_html", - "message": "Fetched release branch \\"rc/1.2.3\\"", - }, - Object { - "message": "Created temporary commit", - "secondaryMessage": "with message \\"mock_commit_message\\"", - }, - Object { - "link": "mock_merge_html_url", - "message": "Merged temporary commit into \\"rc/1.2.3\\"", - "secondaryMessage": "with message \\"mock_merge_commit_message\\"", - }, - Object { - "message": "Cherry-picked patch commit to \\"mock_branch_commit_sha\\"", - "secondaryMessage": "with message \\"mock_cherrypick_message\\"", - }, - Object { - "message": "Updated reference \\"mock_reference_ref\\"", - }, - Object { - "message": "Created new tag object", - "secondaryMessage": "with name \\"mock_tag_object_tag\\"", - }, - Object { - "message": "Created new reference \\"mock_reference_ref\\"", - "secondaryMessage": "for tag object \\"mock_tag_object_tag\\"", - }, - Object { - "link": "mock_update_release_html_url", - "message": "Updated release \\"mock_update_release_name\\"", - "secondaryMessage": "with tag mock_update_release_tag_name", - }, - ] + expect(result.error).toEqual(undefined); + expect(result.current.responseSteps).toHaveLength(9); + }); + + it('should return the expected responseSteps and progress (with successCb)', async () => { + const { result } = renderHook(() => + usePatch({ + bumpedTag: mockBumpedTag, + latestRelease: mockReleaseVersionCalver, + pluginApiClient: mockApiClient, + project: mockCalverProject, + tagParts: mockTagParts, + successCb: jest.fn(), + }), + ); + + await act(async () => { + await waitFor(() => result.current.run(mockSelectedPatchCommit)); + }); + + expect(result.error).toEqual(undefined); + expect(result.current.responseSteps).toHaveLength(10); + expect(result.current).toMatchInlineSnapshot(` + Object { + "progress": 100, + "responseSteps": Array [ + Object { + "link": "mock_branch_links_html", + "message": "Fetched release branch \\"rc/1.2.3\\"", + }, + Object { + "message": "Created temporary commit", + "secondaryMessage": "with message \\"mock_commit_message\\"", + }, + Object { + "message": "Forced branch \\"rc/1.2.3\\" to temporary commit \\"mock_commit_sha\\"", + }, + Object { + "link": "mock_merge_html_url", + "message": "Merged temporary commit into \\"rc/1.2.3\\"", + "secondaryMessage": "with message \\"mock_merge_commit_message\\"", + }, + Object { + "message": "Cherry-picked patch commit to \\"mock_branch_commit_sha\\"", + "secondaryMessage": "with message \\"mock_cherrypick_message\\"", + }, + Object { + "message": "Updated reference \\"mock_reference_ref\\"", + }, + Object { + "message": "Created new tag object", + "secondaryMessage": "with name \\"mock_tag_object_tag\\"", + }, + Object { + "message": "Created new reference \\"mock_reference_ref\\"", + "secondaryMessage": "for tag object \\"mock_tag_object_tag\\"", + }, + Object { + "link": "mock_update_release_html_url", + "message": "Updated release \\"mock_update_release_name\\"", + "secondaryMessage": "with tag mock_update_release_tag_name", + }, + Object { + "icon": "success", + "message": "Success callback successfully called 🚀", + }, + ], + "run": [Function], + } `); }); }); diff --git a/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx b/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx index fa902a35f0..274d40e6dd 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx +++ b/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx @@ -25,7 +25,7 @@ import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext import { useProjectContext } from '../../contexts/ProjectContext'; import { useStyles } from '../../styles/styles'; import { GetLatestReleaseResult } from '../../api/PluginApiClient'; -import { ResponseStepList2 } from '../../components/ResponseStepList/ResponseStepList2'; +import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; import { LinearProgressWithLabel } from '../../components/LinearProgressWithLabel'; interface PromoteRcBodyProps { @@ -54,7 +54,7 @@ export const PromoteRcBody = ({ rcRelease, successCb }: PromoteRcBodyProps) => { - + ); } diff --git a/plugins/github-release-manager/src/cards/promoteRc/sideEffects/usePromoteRc.test.ts b/plugins/github-release-manager/src/cards/promoteRc/sideEffects/usePromoteRc.test.ts index d1ef45d9d6..a055e4acd8 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/sideEffects/usePromoteRc.test.ts +++ b/plugins/github-release-manager/src/cards/promoteRc/sideEffects/usePromoteRc.test.ts @@ -14,6 +14,9 @@ * limitations under the License. */ +import { renderHook, act } from '@testing-library/react-hooks'; +import { waitFor } from '@testing-library/react'; + import { mockApiClient, mockReleaseCandidateCalver, @@ -21,29 +24,59 @@ import { } from '../../../test-helpers/test-helpers'; import { usePromoteRc } from './usePromoteRc'; -// TODO: Fix tests -/* eslint-disable jest/no-disabled-tests */ - -describe.skip('usePromoteRc', () => { +describe('usePromoteRc', () => { beforeEach(jest.clearAllMocks); - it('should work', () => { - const result = usePromoteRc({ - pluginApiClient: mockApiClient, - project: mockSemverProject, - rcRelease: mockReleaseCandidateCalver, - releaseVersion: 'version-1.2.3', - successCb: jest.fn(), + it('should return the expected responseSteps and progress', async () => { + const { result } = renderHook(() => + usePromoteRc({ + pluginApiClient: mockApiClient, + project: mockSemverProject, + rcRelease: mockReleaseCandidateCalver, + releaseVersion: 'version-1.2.3', + }), + ); + + await act(async () => { + await waitFor(() => result.current.run()); }); - expect(result).toMatchInlineSnapshot(` - Array [ - Object { - "link": "mock_release_html_url", - "message": "Promoted \\"mock_release_name\\"", - "secondaryMessage": "from \\"rc-2020.01.01_1\\" to \\"mock_release_tag_name\\"", - }, - ] + expect(result.error).toEqual(undefined); + expect(result.current.responseSteps).toHaveLength(1); + }); + + it('should return the expected responseSteps and progress (with successCb)', async () => { + const { result } = renderHook(() => + usePromoteRc({ + pluginApiClient: mockApiClient, + project: mockSemverProject, + rcRelease: mockReleaseCandidateCalver, + releaseVersion: 'version-1.2.3', + successCb: jest.fn(), + }), + ); + + await act(async () => { + await waitFor(() => result.current.run()); + }); + + expect(result.current.responseSteps).toHaveLength(2); + expect(result.current).toMatchInlineSnapshot(` + Object { + "progress": 100, + "responseSteps": Array [ + Object { + "link": "mock_release_html_url", + "message": "Promoted \\"mock_release_name\\"", + "secondaryMessage": "from \\"rc-2020.01.01_1\\" to \\"mock_release_tag_name\\"", + }, + Object { + "icon": "success", + "message": "Success callback successfully called 🚀", + }, + ], + "run": [Function], + } `); }); }); diff --git a/plugins/github-release-manager/src/components/ReloadButton.test.tsx b/plugins/github-release-manager/src/components/ReloadButton.test.tsx deleted file mode 100644 index b33cc0b931..0000000000 --- a/plugins/github-release-manager/src/components/ReloadButton.test.tsx +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 React from 'react'; -import { render } from '@testing-library/react'; - -import { TEST_IDS } from '../test-helpers/test-ids'; -import { ReloadButton } from './ReloadButton'; - -describe('ReloadButton', () => { - it('render ReloadButton', () => { - const { getByTestId } = render(); - - expect(getByTestId(TEST_IDS.components.reloadButton)).toBeInTheDocument(); - }); -}); diff --git a/plugins/github-release-manager/src/components/ReloadButton.tsx b/plugins/github-release-manager/src/components/ReloadButton.tsx deleted file mode 100644 index d11f39f954..0000000000 --- a/plugins/github-release-manager/src/components/ReloadButton.tsx +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 React from 'react'; -import { Button } from '@material-ui/core'; - -import { TEST_IDS } from '../test-helpers/test-ids'; - -interface ReloadButtonProps { - style?: React.CSSProperties; -} - -export const ReloadButton = ({ style }: ReloadButtonProps) => ( - -); diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.test.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.test.tsx index cfa68b0c32..21f6c6925e 100644 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.test.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.test.tsx @@ -27,7 +27,7 @@ jest.mock('../../contexts/RefetchContext', () => ({ describe('ResponseStepList', () => { it('should render loading state when loading', () => { const { getByTestId } = render( - , + , ); expect( @@ -37,7 +37,7 @@ describe('ResponseStepList', () => { it('should render loading state when no responseSteps', () => { const { getByTestId } = render( - , + , ); expect( @@ -49,8 +49,7 @@ describe('ResponseStepList', () => { const { getByTestId } = render( , ); diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx index c3b84487f3..e703f08d34 100644 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx @@ -15,14 +15,7 @@ */ import React, { PropsWithChildren } from 'react'; -import { - Button, - Dialog, - DialogActions, - DialogContent, - DialogTitle, - List, -} from '@material-ui/core'; +import { Button, DialogActions, DialogContent, List } from '@material-ui/core'; import { CenteredCircularProgress } from '../CenteredCircularProgress'; import { ResponseStep } from '../../types/types'; @@ -31,10 +24,9 @@ import { TEST_IDS } from '../../test-helpers/test-ids'; import { useRefetchContext } from '../../contexts/RefetchContext'; interface ResponseStepListProps { - responseSteps?: (ResponseStep | undefined)[]; - title: string; + responseSteps: (ResponseStep | undefined)[]; animationDelay?: number; - loading: boolean; + loading?: boolean; closeable?: boolean; denseList?: boolean; } @@ -44,16 +36,13 @@ export const ResponseStepList = ({ animationDelay, loading = false, denseList = false, - title, children, }: PropsWithChildren) => { const { setRefetchTrigger } = useRefetchContext(); return ( - - {title} - - {loading || !responseSteps ? ( + <> + {loading || responseSteps.length === 0 ? (
)} -
+ ); }; diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList2.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList2.tsx deleted file mode 100644 index 7239d223bb..0000000000 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList2.tsx +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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 React, { PropsWithChildren } from 'react'; -import { Button, DialogActions, DialogContent, List } from '@material-ui/core'; - -import { CenteredCircularProgress } from '../CenteredCircularProgress'; -import { ResponseStep } from '../../types/types'; -import { ResponseStepListItem } from './ResponseStepListItem'; -import { TEST_IDS } from '../../test-helpers/test-ids'; -import { useRefetchContext } from '../../contexts/RefetchContext'; - -interface ResponseStepListProps { - responseSteps?: (ResponseStep | undefined)[]; - animationDelay?: number; - loading?: boolean; - closeable?: boolean; - denseList?: boolean; -} - -// TODO: Replace `ResponseStepList` with this component - -export const ResponseStepList2 = ({ - responseSteps, - animationDelay, - loading = false, - denseList = false, - children, -}: PropsWithChildren) => { - const { setRefetchTrigger } = useRefetchContext(); - - return ( - <> - {loading || !responseSteps ? ( -
- -
- ) : ( - <> - - - {responseSteps.map((responseStep, index) => { - if (!responseStep) { - return null; - } - - return ( - - ); - })} - - - {children} - - - - - - )} - - ); -}; diff --git a/plugins/github-release-manager/src/hooks/useQueryHandler.test.tsx b/plugins/github-release-manager/src/hooks/useQueryHandler.test.tsx index 757bca9859..a80fa3df04 100644 --- a/plugins/github-release-manager/src/hooks/useQueryHandler.test.tsx +++ b/plugins/github-release-manager/src/hooks/useQueryHandler.test.tsx @@ -48,9 +48,9 @@ describe('useQueryHandler', () => { it('should get parsedQuery and queryParams', () => { const { getByTestId } = render(); - const smt = getByTestId(TEST_ID).innerHTML; + const result = getByTestId(TEST_ID).innerHTML; - expect(smt).toMatchInlineSnapshot(` + expect(result).toMatchInlineSnapshot(` "{ \\"parsedQuery\\": { \\"versioningStrategy\\": \\"semver\\", diff --git a/plugins/github-release-manager/src/test-helpers/test-ids.ts b/plugins/github-release-manager/src/test-helpers/test-ids.ts index 5f537803ca..52a426c9b8 100644 --- a/plugins/github-release-manager/src/test-helpers/test-ids.ts +++ b/plugins/github-release-manager/src/test-helpers/test-ids.ts @@ -54,7 +54,6 @@ export const TEST_IDS = { }, components: { divider: 'grm--divider', - reloadButton: 'grm--reload-button', noLatestRelease: 'grm--no-latest-release', noReleaseBranch: 'grm--no-release-branch', circularProgress: 'grm--circular-progress', diff --git a/yarn.lock b/yarn.lock index 90072e3f79..43cc98ce87 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5550,6 +5550,18 @@ "@babel/runtime" "^7.5.4" "@types/testing-library__react-hooks" "^3.4.0" +"@testing-library/react-hooks@^5.1.1": + version "5.1.1" + resolved "https://registry.npmjs.org/@testing-library/react-hooks/-/react-hooks-5.1.1.tgz#1fbaae8a4e8a4a7f97b176c23e1e890c41bbbfa5" + integrity sha512-52D2XnpelFDefnWpy/V6z2qGNj8JLIvW5DjYtelMvFXdEyWiykSaI7IXHwFy4ICoqXJDmmwHAiFRiFboub/U5g== + dependencies: + "@babel/runtime" "^7.12.5" + "@types/react" ">=16.9.0" + "@types/react-dom" ">=16.9.0" + "@types/react-test-renderer" ">=16.9.0" + filter-console "^0.1.1" + react-error-boundary "^3.1.0" + "@testing-library/react@^11.2.5": version "11.2.6" resolved "https://registry.npmjs.org/@testing-library/react/-/react-11.2.6.tgz#586a23adc63615985d85be0c903f374dab19200b" @@ -6483,6 +6495,13 @@ "@types/webpack" "*" "@types/webpack-dev-server" "*" +"@types/react-dom@>=16.9.0": + version "17.0.3" + resolved "https://registry.npmjs.org/@types/react-dom/-/react-dom-17.0.3.tgz#7fdf37b8af9d6d40127137865bb3fff8871d7ee1" + integrity sha512-4NnJbCeWE+8YBzupn/YrJxZ8VnjcJq5iR1laqQ1vkpQgBiA7bwk0Rp24fxsdNinzJY2U+HHS4dJJDPdoMjdJ7w== + dependencies: + "@types/react" "*" + "@types/react-dom@^16.9.8": version "16.9.8" resolved "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.9.8.tgz#fe4c1e11dfc67155733dfa6aa65108b4971cb423" @@ -6526,6 +6545,13 @@ dependencies: "@types/react" "*" +"@types/react-test-renderer@>=16.9.0": + version "17.0.1" + resolved "https://registry.npmjs.org/@types/react-test-renderer/-/react-test-renderer-17.0.1.tgz#3120f7d1c157fba9df0118dae20cb0297ee0e06b" + integrity sha512-3Fi2O6Zzq/f3QR9dRnlnHso9bMl7weKCviFmfF6B4LS1Uat6Hkm15k0ZAQuDz+UBq6B3+g+NM6IT2nr5QgPzCw== + dependencies: + "@types/react" "*" + "@types/react-text-truncate@^0.14.0": version "0.14.0" resolved "https://registry.npmjs.org/@types/react-text-truncate/-/react-text-truncate-0.14.0.tgz#588bbabbc7f2a13815e805f3a48942db73fe65fe" @@ -6562,6 +6588,15 @@ dependencies: csstype "^2.2.0" +"@types/react@>=16.9.0": + version "17.0.3" + resolved "https://registry.npmjs.org/@types/react/-/react-17.0.3.tgz#ba6e215368501ac3826951eef2904574c262cc79" + integrity sha512-wYOUxIgs2HZZ0ACNiIayItyluADNbONl7kt8lkLjVK8IitMH5QMyAh75Fwhmo37r1m7L2JaFj03sIfxBVDvRAg== + dependencies: + "@types/prop-types" "*" + "@types/scheduler" "*" + csstype "^3.0.2" + "@types/reactcss@*": version "1.2.3" resolved "https://registry.npmjs.org/@types/reactcss/-/reactcss-1.2.3.tgz#af28ae11bbb277978b99d04d1eedfd068ca71834" @@ -6643,6 +6678,11 @@ "@types/node" "*" rollup "^0.63.4" +"@types/scheduler@*": + version "0.16.1" + resolved "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.1.tgz#18845205e86ff0038517aab7a18a62a6b9f71275" + integrity sha512-EaCxbanVeyxDRTQBkdLb3Bvl/HK7PBK6UJjsSixB0iHKoWxE5uu2Q/DgtpOhPIojN0Zl1whvOd7PoHs2P0s5eA== + "@types/semver@^6.0.0": version "6.2.1" resolved "https://registry.npmjs.org/@types/semver/-/semver-6.2.1.tgz#a236185670a7860f1597cf73bea2e16d001461ba" @@ -13254,6 +13294,11 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" +filter-console@^0.1.1: + version "0.1.1" + resolved "https://registry.npmjs.org/filter-console/-/filter-console-0.1.1.tgz#6242be28982bba7415bcc6db74a79f4a294fa67c" + integrity sha512-zrXoV1Uaz52DqPs+qEwNJWJFAWZpYJ47UNmpN9q4j+/EYsz85uV0DC9k8tRND5kYmoVzL0W+Y75q4Rg8sRJCdg== + filter-obj@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/filter-obj/-/filter-obj-1.1.0.tgz#9b311112bc6c6127a16e016c6c5d7f19e0805c5b" @@ -21909,6 +21954,13 @@ react-draggable@^4.0.3: classnames "^2.2.5" prop-types "^15.6.0" +react-error-boundary@^3.1.0: + version "3.1.1" + resolved "https://registry.npmjs.org/react-error-boundary/-/react-error-boundary-3.1.1.tgz#932c5ca5cbab8ec4fe37fd7b415aa5c3a47597e7" + integrity sha512-W3xCd9zXnanqrTUeViceufD3mIW8Ut29BUD+S2f0eO2XCOU8b6UrJfY46RDGe5lxCJzfe4j0yvIfh0RbTZhKJw== + dependencies: + "@babel/runtime" "^7.12.5" + react-error-overlay@^6.0.7, react-error-overlay@^6.0.9: version "6.0.9" resolved "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz#3c743010c9359608c375ecd6bc76f35d93995b0a" From acb4c01baf9927c3eb7a9ad005ac64559b1e9d39 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Tue, 20 Apr 2021 14:15:07 +0200 Subject: [PATCH 052/485] Create Dialog component with tests Signed-off-by: Erik Engervall --- .../src/cards/createRc/CreateRc.tsx | 37 +++++++--------- .../src/cards/patchRc/PatchBody.tsx | 37 +++++++--------- .../src/cards/promoteRc/PromoteRcBody.tsx | 23 +++++----- .../src/components/Dialog.test.tsx | 42 +++++++++++++++++++ .../src/components/Dialog.tsx | 38 +++++++++++++++++ .../components/LinearProgressWithLabel.tsx | 2 +- 6 files changed, 123 insertions(+), 56 deletions(-) create mode 100644 plugins/github-release-manager/src/components/Dialog.test.tsx create mode 100644 plugins/github-release-manager/src/components/Dialog.tsx diff --git a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx index f3c55693dc..8ba80a9aee 100644 --- a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx +++ b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx @@ -18,8 +18,6 @@ import React, { useState, useEffect } from 'react'; import { Alert } from '@material-ui/lab'; import { Button, - Dialog, - DialogTitle, FormControl, InputLabel, MenuItem, @@ -27,23 +25,22 @@ import { Typography, } from '@material-ui/core'; -import { ComponentConfigCreateRc } from '../../types/types'; -import { useCreateRc } from './sideEffects/useCreateRc'; -import { Differ } from '../../components/Differ'; -import { getRcGitHubInfo } from './getRcGitHubInfo'; -import { InfoCardPlus } from '../../components/InfoCardPlus'; -import { SEMVER_PARTS } from '../../constants/constants'; -import { TEST_IDS } from '../../test-helpers/test-ids'; -import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; -import { useProjectContext } from '../../contexts/ProjectContext'; -import { useStyles } from '../../styles/styles'; import { GetBranchResult, GetLatestReleaseResult, GetRepositoryResult, } from '../../api/PluginApiClient'; -import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; -import { LinearProgressWithLabel } from '../../components/LinearProgressWithLabel'; +import { ComponentConfigCreateRc } from '../../types/types'; +import { Dialog } from '../../components/Dialog'; +import { Differ } from '../../components/Differ'; +import { getRcGitHubInfo } from './getRcGitHubInfo'; +import { InfoCardPlus } from '../../components/InfoCardPlus'; +import { SEMVER_PARTS } from '../../constants/constants'; +import { TEST_IDS } from '../../test-helpers/test-ids'; +import { useCreateRc } from './sideEffects/useCreateRc'; +import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; +import { useProjectContext } from '../../contexts/ProjectContext'; +import { useStyles } from '../../styles/styles'; interface CreateRcProps { defaultBranch: GetRepositoryResult['defaultBranch']; @@ -85,13 +82,11 @@ export const CreateRc = ({ }); if (responseSteps.length > 0) { return ( - - Create Release Candidate - - - - - + ); } diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx index cd001c5110..ce0b3acd1c 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx @@ -20,8 +20,6 @@ import { Alert, AlertTitle } from '@material-ui/lab'; import { Button, Checkbox, - Dialog, - DialogTitle, IconButton, Link, List, @@ -35,23 +33,22 @@ import { import FileCopyIcon from '@material-ui/icons/FileCopy'; import OpenInNewIcon from '@material-ui/icons/OpenInNew'; -import { CalverTagParts } from '../../helpers/tagParts/getCalverTagParts'; -import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; -import { ComponentConfigPatch } from '../../types/types'; -import { Differ } from '../../components/Differ'; -import { usePatch } from './sideEffects/usePatch'; -import { SemverTagParts } from '../../helpers/tagParts/getSemverTagParts'; -import { TEST_IDS } from '../../test-helpers/test-ids'; -import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; -import { useProjectContext } from '../../contexts/ProjectContext'; -import { useStyles } from '../../styles/styles'; import { GetBranchResult, GetLatestReleaseResult, } from '../../api/PluginApiClient'; +import { CalverTagParts } from '../../helpers/tagParts/getCalverTagParts'; +import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; +import { ComponentConfigPatch } from '../../types/types'; +import { Dialog } from '../../components/Dialog'; +import { Differ } from '../../components/Differ'; import { GitHubReleaseManagerError } from '../../errors/GitHubReleaseManagerError'; -import { LinearProgressWithLabel } from '../../components/LinearProgressWithLabel'; -import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; +import { SemverTagParts } from '../../helpers/tagParts/getSemverTagParts'; +import { TEST_IDS } from '../../test-helpers/test-ids'; +import { usePatch } from './sideEffects/usePatch'; +import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; +import { useProjectContext } from '../../contexts/ProjectContext'; +import { useStyles } from '../../styles/styles'; interface PatchBodyProps { bumpedTag: string; @@ -104,13 +101,11 @@ export const PatchBody = ({ }); if (responseSteps.length > 0) { return ( - - Patch Release Candidate - - - - - + ); } diff --git a/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx b/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx index 274d40e6dd..a3b2ef0f68 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx +++ b/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx @@ -15,18 +15,17 @@ */ import React from 'react'; -import { Button, Dialog, DialogTitle, Typography } from '@material-ui/core'; +import { Button, Typography } from '@material-ui/core'; -import { Differ } from '../../components/Differ'; import { ComponentConfigPromoteRc } from '../../types/types'; -import { usePromoteRc } from './sideEffects/usePromoteRc'; +import { Dialog } from '../../components/Dialog'; +import { Differ } from '../../components/Differ'; +import { GetLatestReleaseResult } from '../../api/PluginApiClient'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; import { useProjectContext } from '../../contexts/ProjectContext'; +import { usePromoteRc } from './sideEffects/usePromoteRc'; import { useStyles } from '../../styles/styles'; -import { GetLatestReleaseResult } from '../../api/PluginApiClient'; -import { ResponseStepList } from '../../components/ResponseStepList/ResponseStepList'; -import { LinearProgressWithLabel } from '../../components/LinearProgressWithLabel'; interface PromoteRcBodyProps { rcRelease: NonNullable; @@ -49,13 +48,11 @@ export const PromoteRcBody = ({ rcRelease, successCb }: PromoteRcBodyProps) => { if (responseSteps.length > 0) { return ( - - Promote Release Candidate - - - - - + ); } diff --git a/plugins/github-release-manager/src/components/Dialog.test.tsx b/plugins/github-release-manager/src/components/Dialog.test.tsx new file mode 100644 index 0000000000..cffd24a0bd --- /dev/null +++ b/plugins/github-release-manager/src/components/Dialog.test.tsx @@ -0,0 +1,42 @@ +/* + * 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 React from 'react'; +import { render } from '@testing-library/react'; + +import { Dialog } from './Dialog'; + +jest.mock('../contexts/RefetchContext', () => ({ + useRefetchContext: () => jest.fn(), +})); + +describe('Dialog', () => { + it('should render Dialog', () => { + const mockTitle = 'mock_dialog_title'; + const mockResponseStepMessage = 'banana'; + + const { baseElement } = render( + , + ); + + expect(baseElement.innerHTML).toMatch(mockTitle); + expect(baseElement.innerHTML).toMatch(mockResponseStepMessage); + }); +}); diff --git a/plugins/github-release-manager/src/components/Dialog.tsx b/plugins/github-release-manager/src/components/Dialog.tsx new file mode 100644 index 0000000000..2a393edcf3 --- /dev/null +++ b/plugins/github-release-manager/src/components/Dialog.tsx @@ -0,0 +1,38 @@ +/* + * 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 React from 'react'; +import { DialogTitle, Dialog as MaterialDialog } from '@material-ui/core'; + +import { LinearProgressWithLabel } from './LinearProgressWithLabel'; +import { ResponseStep } from '../types/types'; +import { ResponseStepList } from './ResponseStepList/ResponseStepList'; + +interface DialogProps { + progress: number; + responseSteps: ResponseStep[]; + title: string; +} + +export const Dialog = ({ progress, responseSteps, title }: DialogProps) => ( + + {title} + + + + + +); diff --git a/plugins/github-release-manager/src/components/LinearProgressWithLabel.tsx b/plugins/github-release-manager/src/components/LinearProgressWithLabel.tsx index 9b0a0ec1f9..0ed8216a3d 100644 --- a/plugins/github-release-manager/src/components/LinearProgressWithLabel.tsx +++ b/plugins/github-release-manager/src/components/LinearProgressWithLabel.tsx @@ -26,7 +26,7 @@ export function LinearProgressWithLabel( props: LinearProgressProps & { value: number }, ) { return ( - + From 7812b6ac3cfdd3964c23c0c225ac762c91e7c622 Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Tue, 20 Apr 2021 11:21:38 +0200 Subject: [PATCH 053/485] Add new shortcut plugin Signed-off-by: Marcus Eide --- packages/app/package.json | 1 + packages/app/src/components/Root/Root.tsx | 3 + packages/app/src/plugins.ts | 2 + plugins/shortcuts/.eslintrc.js | 3 + plugins/shortcuts/README.md | 13 ++ plugins/shortcuts/dev/index.tsx | 26 ++++ plugins/shortcuts/package.json | 51 +++++++ plugins/shortcuts/src/AddShortcut.tsx | 121 +++++++++++++++ plugins/shortcuts/src/EditShortcut.tsx | 134 +++++++++++++++++ plugins/shortcuts/src/ShortcutForm.tsx | 140 ++++++++++++++++++ plugins/shortcuts/src/ShortcutIcon.tsx | 47 ++++++ plugins/shortcuts/src/ShortcutItem.tsx | 98 ++++++++++++ plugins/shortcuts/src/Shortcuts.tsx | 66 +++++++++ .../shortcuts/src/api/LocalStoredShortcuts.ts | 97 ++++++++++++ plugins/shortcuts/src/api/ShortcutApi.ts | 55 +++++++ plugins/shortcuts/src/api/index.ts | 19 +++ plugins/shortcuts/src/index.ts | 18 +++ plugins/shortcuts/src/plugin.test.ts | 22 +++ plugins/shortcuts/src/plugin.ts | 44 ++++++ plugins/shortcuts/src/setupTests.ts | 17 +++ plugins/shortcuts/src/types.ts | 26 ++++ yarn.lock | 8 +- 22 files changed, 1010 insertions(+), 1 deletion(-) create mode 100644 plugins/shortcuts/.eslintrc.js create mode 100644 plugins/shortcuts/README.md create mode 100644 plugins/shortcuts/dev/index.tsx create mode 100644 plugins/shortcuts/package.json create mode 100644 plugins/shortcuts/src/AddShortcut.tsx create mode 100644 plugins/shortcuts/src/EditShortcut.tsx create mode 100644 plugins/shortcuts/src/ShortcutForm.tsx create mode 100644 plugins/shortcuts/src/ShortcutIcon.tsx create mode 100644 plugins/shortcuts/src/ShortcutItem.tsx create mode 100644 plugins/shortcuts/src/Shortcuts.tsx create mode 100644 plugins/shortcuts/src/api/LocalStoredShortcuts.ts create mode 100644 plugins/shortcuts/src/api/ShortcutApi.ts create mode 100644 plugins/shortcuts/src/api/index.ts create mode 100644 plugins/shortcuts/src/index.ts create mode 100644 plugins/shortcuts/src/plugin.test.ts create mode 100644 plugins/shortcuts/src/plugin.ts create mode 100644 plugins/shortcuts/src/setupTests.ts create mode 100644 plugins/shortcuts/src/types.ts diff --git a/packages/app/package.json b/packages/app/package.json index 4d2dbe660a..f052d27109 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -31,6 +31,7 @@ "@backstage/plugin-scaffolder": "^0.9.0", "@backstage/plugin-search": "^0.3.4", "@backstage/plugin-sentry": "^0.3.8", + "@backstage/plugin-shortcuts": "^0.1.1", "@backstage/plugin-tech-radar": "^0.3.9", "@backstage/plugin-techdocs": "^0.7.2", "@backstage/plugin-todo": "^0.1.0", diff --git a/packages/app/src/components/Root/Root.tsx b/packages/app/src/components/Root/Root.tsx index 454c0d2e84..9c62ec0b4d 100644 --- a/packages/app/src/components/Root/Root.tsx +++ b/packages/app/src/components/Root/Root.tsx @@ -39,6 +39,7 @@ import { NavLink } from 'react-router-dom'; import { GraphiQLIcon } from '@backstage/plugin-graphiql'; import { Settings as SidebarSettings } from '@backstage/plugin-user-settings'; import { SidebarSearch } from '@backstage/plugin-search'; +import { Shortcuts } from '@backstage/plugin-shortcuts'; const useSidebarLogoStyles = makeStyles({ root: { @@ -91,6 +92,8 @@ export const Root = ({ children }: PropsWithChildren<{}>) => ( + + diff --git a/packages/app/src/plugins.ts b/packages/app/src/plugins.ts index 7dbea5b995..9ea887ac27 100644 --- a/packages/app/src/plugins.ts +++ b/packages/app/src/plugins.ts @@ -17,3 +17,5 @@ // TODO(Rugvip): This plugin is currently not part of the app element tree, // ideally we have an API for the context menu that permits that. export { badgesPlugin } from '@backstage/plugin-badges'; +export { githubDeploymentsPlugin } from '@backstage/plugin-github-deployments'; +export { shortcutsPlugin } from '@backstage/plugin-shortcuts'; diff --git a/plugins/shortcuts/.eslintrc.js b/plugins/shortcuts/.eslintrc.js new file mode 100644 index 0000000000..13573efa9c --- /dev/null +++ b/plugins/shortcuts/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + extends: [require.resolve('@backstage/cli/config/eslint')], +}; diff --git a/plugins/shortcuts/README.md b/plugins/shortcuts/README.md new file mode 100644 index 0000000000..423f03948c --- /dev/null +++ b/plugins/shortcuts/README.md @@ -0,0 +1,13 @@ +# shortcuts + +Welcome to the shortcuts plugin! + +_This plugin was created through the Backstage CLI_ + +## Getting started + +Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn start` in the root directory, and then navigating to [/shortcuts](http://localhost:3000/shortcuts). + +You can also serve the plugin in isolation by running `yarn start` in the plugin directory. +This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads. +It is only meant for local development, and the setup for it can be found inside the [/dev](./dev) directory. diff --git a/plugins/shortcuts/dev/index.tsx b/plugins/shortcuts/dev/index.tsx new file mode 100644 index 0000000000..0da3a90054 --- /dev/null +++ b/plugins/shortcuts/dev/index.tsx @@ -0,0 +1,26 @@ +/* + * 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 React from 'react'; +import { createDevApp } from '@backstage/dev-utils'; +import { shortcutsPlugin, Shortcuts } from '../src/plugin'; + +createDevApp() + .registerPlugin(shortcutsPlugin) + .addPage({ + element: , + title: 'Root Page', + }) + .render(); diff --git a/plugins/shortcuts/package.json b/plugins/shortcuts/package.json new file mode 100644 index 0000000000..32fb41ab78 --- /dev/null +++ b/plugins/shortcuts/package.json @@ -0,0 +1,51 @@ +{ + "name": "@backstage/plugin-shortcuts", + "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/core": "^0.7.5", + "@backstage/theme": "^0.2.5", + "@material-ui/core": "^4.11.0", + "@material-ui/icons": "^4.9.1", + "@material-ui/lab": "4.0.0-alpha.45", + "react": "^16.13.1", + "react-dom": "^16.13.1", + "react-hook-form": "^7.1.1", + "react-router": "6.0.0-beta.0", + "react-use": "^15.3.3", + "uuid": "^8.3.2", + "zen-observable": "^0.8.15" + }, + "devDependencies": { + "@backstage/cli": "^0.6.8", + "@backstage/dev-utils": "^0.1.13", + "@backstage/test-utils": "^0.1.10", + "@testing-library/jest-dom": "^5.10.1", + "@testing-library/react": "^11.2.5", + "@testing-library/user-event": "^12.0.7", + "@types/jest": "^26.0.7", + "@types/node": "^14.14.32", + "cross-fetch": "^3.0.6", + "msw": "^0.21.2" + }, + "files": [ + "dist" + ] +} diff --git a/plugins/shortcuts/src/AddShortcut.tsx b/plugins/shortcuts/src/AddShortcut.tsx new file mode 100644 index 0000000000..ab845c63a8 --- /dev/null +++ b/plugins/shortcuts/src/AddShortcut.tsx @@ -0,0 +1,121 @@ +/* + * 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 React, { useState } from 'react'; +import { useLocation } from 'react-router'; +import { SubmitHandler } from 'react-hook-form'; +import { alertApiRef, useApi } from '@backstage/core'; +import { + Button, + Card, + CardHeader, + makeStyles, + Popover, +} from '@material-ui/core'; +import { ShortcutForm } from './ShortcutForm'; +import { FormValues, Shortcut } from './types'; +import { ShortcutApi } from './api'; + +const useStyles = makeStyles(theme => ({ + card: { + width: 400, + }, + header: { + marginBottom: theme.spacing(1), + }, + button: { + marginTop: theme.spacing(1), + }, +})); + +type Props = { + onClose: () => void; + anchorEl?: Element; + api: ShortcutApi; +}; + +export const AddShortcut = ({ onClose, anchorEl, api }: Props) => { + const classes = useStyles(); + const alertApi = useApi(alertApiRef); + const { pathname } = useLocation(); + const [formValues, setFormValues] = useState(); + const open = Boolean(anchorEl); + + const handleSave: SubmitHandler = async ({ url, title }) => { + const shortcut: Omit = { url, title }; + + try { + await api.add(shortcut); + alertApi.post({ + message: 'Successfully added shortcut', + severity: 'success', + }); + } catch (error) { + alertApi.post({ + message: `Could not add shortcut: ${error.message}`, + severity: 'error', + }); + } + + onClose(); + }; + + const handlePaste = () => { + setFormValues({ url: pathname, title: document.title }); + }; + + const handleClose = () => { + setFormValues(undefined); + onClose(); + }; + + return ( + + + + Paste Current Url + + } + /> + + + + ); +}; diff --git a/plugins/shortcuts/src/EditShortcut.tsx b/plugins/shortcuts/src/EditShortcut.tsx new file mode 100644 index 0000000000..9220c9a73e --- /dev/null +++ b/plugins/shortcuts/src/EditShortcut.tsx @@ -0,0 +1,134 @@ +/* + * 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 React from 'react'; +import { SubmitHandler } from 'react-hook-form'; +import { alertApiRef, useApi } from '@backstage/core'; +import { + Button, + Card, + CardHeader, + makeStyles, + Popover, +} from '@material-ui/core'; +import { ShortcutForm } from './ShortcutForm'; +import { FormValues, Shortcut } from './types'; +import DeleteIcon from '@material-ui/icons/Delete'; +import { ShortcutApi } from './api'; + +const useStyles = makeStyles(theme => ({ + card: { + width: 400, + }, + header: { + marginBottom: theme.spacing(1), + }, + button: { + marginTop: theme.spacing(1), + }, +})); + +type Props = { + shortcut: Shortcut; + onClose: () => void; + anchorEl?: Element; + api: ShortcutApi; +}; + +export const EditShortcut = ({ shortcut, onClose, anchorEl, api }: Props) => { + const classes = useStyles(); + const alertApi = useApi(alertApiRef); + const open = Boolean(anchorEl); + + const handleSave: SubmitHandler = async ({ url, title }) => { + const newShortcut: Shortcut = { + ...shortcut, + url, + title, + }; + + try { + await api.update(newShortcut); + alertApi.post({ + message: 'Successfully updated shortcut', + severity: 'success', + }); + } catch (error) { + alertApi.post({ + message: `Could not update shortcut: ${error.message}`, + severity: 'error', + }); + } + + onClose(); + }; + + const handleRemove = async () => { + try { + await api.remove(shortcut); + alertApi.post({ + message: 'Successfully deleted shortcut', + severity: 'success', + }); + } catch (error) { + alertApi.post({ + message: `Could not delete shortcut: ${error.message}`, + severity: 'error', + }); + } + }; + + const handleClose = () => { + onClose(); + }; + + return ( + + + } + onClick={handleRemove} + > + Remove + + } + /> + + + + ); +}; diff --git a/plugins/shortcuts/src/ShortcutForm.tsx b/plugins/shortcuts/src/ShortcutForm.tsx new file mode 100644 index 0000000000..6d6e0679c3 --- /dev/null +++ b/plugins/shortcuts/src/ShortcutForm.tsx @@ -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. + */ + +import React, { useEffect } from 'react'; +import { useForm, SubmitHandler, Controller } from 'react-hook-form'; +import { + Button, + CardActions, + CardContent, + makeStyles, + TextField, +} from '@material-ui/core'; +import { FormValues } from './types'; + +const useStyles = makeStyles(theme => ({ + field: { + marginBottom: theme.spacing(2), + }, + actionRoot: { + paddingLeft: theme.spacing(2), + paddingBottom: theme.spacing(3), + justifyContent: 'flex-start', + }, +})); + +type Props = { + formValues?: FormValues; + onSave: SubmitHandler; + onClose: () => void; +}; + +export const ShortcutForm = ({ formValues, onSave, onClose }: Props) => { + const classes = useStyles(); + + const { + handleSubmit, + reset, + control, + formState: { errors }, + } = useForm({ + mode: 'onChange', + defaultValues: { + url: formValues?.url ?? '', + title: formValues?.title ?? '', + }, + }); + + useEffect(() => { + reset(formValues); + }, [reset, formValues]); + + return ( + <> + + ( + + )} + /> + ( + + )} + /> + + + + + + + ); +}; diff --git a/plugins/shortcuts/src/ShortcutIcon.tsx b/plugins/shortcuts/src/ShortcutIcon.tsx new file mode 100644 index 0000000000..c737596647 --- /dev/null +++ b/plugins/shortcuts/src/ShortcutIcon.tsx @@ -0,0 +1,47 @@ +/* + * 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 React from 'react'; + +type Props = { + text: string; + color: string; +}; + +export const ShortcutIcon = ({ text, color }: Props) => { + const size = 28; + return ( + + + + {text} + + + ); +}; diff --git a/plugins/shortcuts/src/ShortcutItem.tsx b/plugins/shortcuts/src/ShortcutItem.tsx new file mode 100644 index 0000000000..a52194828c --- /dev/null +++ b/plugins/shortcuts/src/ShortcutItem.tsx @@ -0,0 +1,98 @@ +/* + * 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 React, { useState } from 'react'; +import { SidebarItem } from '@backstage/core'; +import { IconButton, makeStyles } from '@material-ui/core'; +import EditIcon from '@material-ui/icons/Edit'; +import { ShortcutIcon } from './ShortcutIcon'; +import { EditShortcut } from './EditShortcut'; +import { ShortcutApi } from './api'; +import { Shortcut } from './types'; + +const useStyles = makeStyles({ + icon: { + color: 'white', + fontSize: 16, + }, +}); + +const getIconText = (title: string) => + title.split(' ').length === 1 + ? // If there's only one word, keep the first two characters + title[0].toUpperCase() + title[1].toLowerCase() + : // If there's more than one word, take the first character of the first two words + title + .replace(/\W+/g, ' ') + .split(' ') + .map(s => s[0]) + .join('') + .slice(0, 2) + .toUpperCase(); + +type Props = { + shortcut: Shortcut; + api: ShortcutApi; +}; + +export const ShortcutItem = ({ shortcut, api }: Props) => { + const classes = useStyles(); + const [displayEdit, setDisplayEdit] = useState(false); + const [anchorEl, setAnchorEl] = React.useState(); + + const handleClick = (event: React.MouseEvent) => { + event.preventDefault(); + setAnchorEl(event.currentTarget); + }; + + const handleClose = () => { + setAnchorEl(undefined); + setDisplayEdit(false); + }; + + const handleMouseEnter = () => { + setDisplayEdit(true); + }; + + const handleMouseLeave = () => { + setDisplayEdit(false); + }; + + const text = getIconText(shortcut.title); + const color = api.getColor(shortcut.url); + + return ( +
+ } + > + {displayEdit && ( + + + + )} + + +
+ ); +}; diff --git a/plugins/shortcuts/src/Shortcuts.tsx b/plugins/shortcuts/src/Shortcuts.tsx new file mode 100644 index 0000000000..4d65861bd9 --- /dev/null +++ b/plugins/shortcuts/src/Shortcuts.tsx @@ -0,0 +1,66 @@ +/* + * 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 React, { useMemo } from 'react'; +import { useObservable } from 'react-use'; +import { Progress, SidebarItem, useApi } from '@backstage/core'; +import PlayListAddIcon from '@material-ui/icons/PlaylistAdd'; +import { ShortcutItem } from './ShortcutItem'; +import { AddShortcut } from './AddShortcut'; +import { shortcutsApiRef } from './api'; + +export const Shortcuts = () => { + const shortcutApi = useApi(shortcutsApiRef); + const shortcuts = useObservable( + useMemo(() => shortcutApi.observe(), [shortcutApi]), + ); + const [anchorEl, setAnchorEl] = React.useState(); + const loading = Boolean(!shortcuts); + + const handleClick = (event: React.MouseEvent) => { + setAnchorEl(event.currentTarget); + }; + + const handleClose = () => { + setAnchorEl(undefined); + }; + + return ( + <> + + + {loading ? ( + + ) : ( + shortcuts?.map(shortcut => ( + + )) + )} + + ); +}; diff --git a/plugins/shortcuts/src/api/LocalStoredShortcuts.ts b/plugins/shortcuts/src/api/LocalStoredShortcuts.ts new file mode 100644 index 0000000000..2f84c0cf76 --- /dev/null +++ b/plugins/shortcuts/src/api/LocalStoredShortcuts.ts @@ -0,0 +1,97 @@ +/* + * 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 { StorageApi } from '@backstage/core'; +import { pageTheme } from '@backstage/theme'; +import ObservableImpl from 'zen-observable'; +import { v4 as uuid } from 'uuid'; +import { ShortcutApi } from './ShortcutApi'; +import { Shortcut } from '../types'; + +/** + * Implementation of the ShortcutApi that uses the StorageApi to store shortcuts. + */ +export class LocalStoredShortcuts implements ShortcutApi { + constructor(private readonly storageApi: StorageApi) {} + + observe() { + return this.observable; + } + + async add(shortcut: Omit) { + const shortcuts = this.get(); + shortcuts.push({ ...shortcut, id: uuid() }); + + await this.storageApi.set('items', shortcuts); + this.notify(); + } + + async remove(shortcut: Shortcut) { + const shortcuts = this.get().filter(s => s.id !== shortcut.id); + + await this.storageApi.set('items', shortcuts); + this.notify(); + } + + async update(shortcut: Shortcut) { + const shortcuts = this.get().filter(s => s.id !== shortcut.id); + shortcuts.push(shortcut); + + await this.storageApi.set('items', shortcuts); + this.notify(); + } + + getColor(url: string) { + const type = url.split('/')[1]; + const theme = + this.THEME_MAP[type] ?? + (Object.keys(pageTheme).includes(type) ? type : 'tool'); + + return pageTheme[theme].colors[0]; + } + + private subscribers = new Set< + ZenObservable.SubscriptionObserver + >(); + + private readonly observable = new ObservableImpl(subscriber => { + subscriber.next(this.get()); + this.subscribers.add(subscriber); + + return () => { + this.subscribers.delete(subscriber); + }; + }); + + private readonly THEME_MAP: Record = { + catalog: 'home', + docs: 'documentation', + }; + + private get() { + return ( + (this.storageApi.get('items') as Shortcut[])?.sort((a, b) => + a.id >= b.id ? 1 : -1, + ) ?? [] + ); + } + + private notify() { + for (const subscription of this.subscribers) { + subscription.next(this.get()); + } + } +} diff --git a/plugins/shortcuts/src/api/ShortcutApi.ts b/plugins/shortcuts/src/api/ShortcutApi.ts new file mode 100644 index 0000000000..b2b1f772e5 --- /dev/null +++ b/plugins/shortcuts/src/api/ShortcutApi.ts @@ -0,0 +1,55 @@ +/* + * 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 Observable from 'zen-observable'; +import { createApiRef } from '@backstage/core'; +import { Shortcut } from '../types'; + +export const shortcutsApiRef = createApiRef({ + id: 'plugin.shortcuts.api', + description: 'API to handle shortcuts in a Backstage Sidebar', +}); + +export interface ShortcutApi { + /** + * Returns an Observable that will subscribe to changes. + */ + observe(): Observable; + + /** + * Generates a unique id for the shortcut and then saves it. + */ + add(shortcut: Omit): Promise; + + /** + * Removes the shortcut. + */ + remove(shortcut: Shortcut): Promise; + + /** + * Finds an existing shortcut that matches the ID of the + * supplied shortcut and updates its values. + */ + update(shortcut: Shortcut): Promise; + + /** + * Each shortcut should get a color for its icon based on the url. + * + * Preferably using some abstraction between the url and the actual + * color value. + */ + getColor(url: string): string; +} diff --git a/plugins/shortcuts/src/api/index.ts b/plugins/shortcuts/src/api/index.ts new file mode 100644 index 0000000000..4705702cbe --- /dev/null +++ b/plugins/shortcuts/src/api/index.ts @@ -0,0 +1,19 @@ +/* + * 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. + */ + +export { LocalStoredShortcuts } from './LocalStoredShortcuts'; +export { shortcutsApiRef } from './ShortcutApi'; +export type { ShortcutApi } from './ShortcutApi'; diff --git a/plugins/shortcuts/src/index.ts b/plugins/shortcuts/src/index.ts new file mode 100644 index 0000000000..851178710f --- /dev/null +++ b/plugins/shortcuts/src/index.ts @@ -0,0 +1,18 @@ +/* + * 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. + */ +export { shortcutsPlugin, Shortcuts } from './plugin'; +export * from './api'; +export * from './types'; diff --git a/plugins/shortcuts/src/plugin.test.ts b/plugins/shortcuts/src/plugin.test.ts new file mode 100644 index 0000000000..885b4e226e --- /dev/null +++ b/plugins/shortcuts/src/plugin.test.ts @@ -0,0 +1,22 @@ +/* + * 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 { shortcutsPlugin } from './plugin'; + +describe('shortcuts', () => { + it('should export plugin', () => { + expect(shortcutsPlugin).toBeDefined(); + }); +}); diff --git a/plugins/shortcuts/src/plugin.ts b/plugins/shortcuts/src/plugin.ts new file mode 100644 index 0000000000..d33af76f33 --- /dev/null +++ b/plugins/shortcuts/src/plugin.ts @@ -0,0 +1,44 @@ +/* + * 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 { + createApiFactory, + createComponentExtension, + createPlugin, + errorApiRef, + WebStorage, +} from '@backstage/core'; +import { shortcutsApiRef, LocalStoredShortcuts } from './api'; + +export const shortcutsPlugin = createPlugin({ + id: 'shortcuts', + apis: [ + createApiFactory({ + api: shortcutsApiRef, + deps: { errorApi: errorApiRef }, + factory: ({ errorApi }) => + new LocalStoredShortcuts( + WebStorage.create({ namespace: '@backstage/shortcuts', errorApi }), + ), + }), + ], +}); + +export const Shortcuts = shortcutsPlugin.provide( + createComponentExtension({ + component: { lazy: () => import('./Shortcuts').then(m => m.Shortcuts) }, + }), +); diff --git a/plugins/shortcuts/src/setupTests.ts b/plugins/shortcuts/src/setupTests.ts new file mode 100644 index 0000000000..0cec5b395d --- /dev/null +++ b/plugins/shortcuts/src/setupTests.ts @@ -0,0 +1,17 @@ +/* + * 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 '@testing-library/jest-dom'; +import 'cross-fetch/polyfill'; diff --git a/plugins/shortcuts/src/types.ts b/plugins/shortcuts/src/types.ts new file mode 100644 index 0000000000..33c52f4766 --- /dev/null +++ b/plugins/shortcuts/src/types.ts @@ -0,0 +1,26 @@ +/* + * 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. + */ + +export type Shortcut = { + id: string; + url: string; + title: string; +}; + +export type FormValues = { + url: string; + title: string; +}; diff --git a/yarn.lock b/yarn.lock index 000b4b55ed..f56a6931ea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18569,6 +18569,7 @@ minipass-fetch@^1.3.0, minipass-fetch@^1.3.2: resolved "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-1.3.3.tgz#34c7cea038c817a8658461bf35174551dce17a0a" integrity sha512-akCrLDWfbdAWkMLBxJEeWTdNsjML+dt5YgOI4gJ53vuO0vrmYQkUPxa6j6V65s9CcePIr2SSWqjT2EcrNseryQ== dependencies: + encoding "^0.1.12" minipass "^3.1.0" minipass-sized "^1.0.3" minizlib "^2.0.0" @@ -21943,6 +21944,11 @@ react-hook-form@^6.15.4, react-hook-form@^6.6.0: resolved "https://registry.npmjs.org/react-hook-form/-/react-hook-form-6.15.4.tgz#328003e1ccc096cd158899ffe7e3b33735a9b024" integrity sha512-K+Sw33DtTMengs8OdqFJI3glzNl1wBzSefD/ksQw/hJf9CnOHQAU6qy82eOrh0IRNt2G53sjr7qnnw1JDjvx1w== +react-hook-form@^7.1.1: + version "7.2.1" + resolved "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.2.1.tgz#99b3540dd2314499df12e9a53c70587ad63a806c" + integrity sha512-QopAubhVofqQrwlWLr9aK0DF8tNU8fnU8sJIlw1Tb3tGkEvP9yeaA+cx1hlxYni8xBswtHruL1WcDEa6CYQDow== + react-hot-loader@^4.12.21: version "4.13.0" resolved "https://registry.npmjs.org/react-hot-loader/-/react-hot-loader-4.13.0.tgz#c27e9408581c2a678f5316e69c061b226dc6a202" @@ -26095,7 +26101,7 @@ uuid@^7.0.3: resolved "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz#c5c9f2c8cf25dc0a372c4df1441c41f5bd0c680b" integrity sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg== -uuid@^8.0.0, uuid@^8.2.0, uuid@^8.3.0: +uuid@^8.0.0, uuid@^8.2.0, uuid@^8.3.0, uuid@^8.3.2: version "8.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== From c2c55e88488b4699c839e99ff6fce84bd1eb9b7e Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Tue, 20 Apr 2021 15:03:48 +0200 Subject: [PATCH 054/485] Add alertApi to mockApis Signed-off-by: Marcus Eide --- packages/test-utils/src/testUtils/mockApis.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/test-utils/src/testUtils/mockApis.ts b/packages/test-utils/src/testUtils/mockApis.ts index e05a8e6cac..0fe9a30926 100644 --- a/packages/test-utils/src/testUtils/mockApis.ts +++ b/packages/test-utils/src/testUtils/mockApis.ts @@ -18,10 +18,13 @@ import { storageApiRef, errorApiRef, createApiFactory, + AlertApiForwarder, + alertApiRef, } from '@backstage/core-api'; import { MockErrorApi, MockStorageApi } from './apis'; export const mockApis = [ createApiFactory(errorApiRef, new MockErrorApi()), createApiFactory(storageApiRef, MockStorageApi.create()), + createApiFactory(alertApiRef, new AlertApiForwarder()), ]; From 87d9b1170e1747ded9c65093ab97e96d9ab93f0d Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Tue, 20 Apr 2021 15:05:25 +0200 Subject: [PATCH 055/485] Add tests Signed-off-by: Marcus Eide --- plugins/shortcuts/src/AddShortcut.test.tsx | 113 +++++++++++++++ plugins/shortcuts/src/EditShortcut.test.tsx | 130 ++++++++++++++++++ plugins/shortcuts/src/ShortcutForm.test.tsx | 73 ++++++++++ plugins/shortcuts/src/ShortcutItem.test.tsx | 128 +++++++++++++++++ plugins/shortcuts/src/Shortcuts.test.tsx | 42 ++++++ .../src/api/LocalStoredShortcuts.test.ts | 82 +++++++++++ 6 files changed, 568 insertions(+) create mode 100644 plugins/shortcuts/src/AddShortcut.test.tsx create mode 100644 plugins/shortcuts/src/EditShortcut.test.tsx create mode 100644 plugins/shortcuts/src/ShortcutForm.test.tsx create mode 100644 plugins/shortcuts/src/ShortcutItem.test.tsx create mode 100644 plugins/shortcuts/src/Shortcuts.test.tsx create mode 100644 plugins/shortcuts/src/api/LocalStoredShortcuts.test.ts diff --git a/plugins/shortcuts/src/AddShortcut.test.tsx b/plugins/shortcuts/src/AddShortcut.test.tsx new file mode 100644 index 0000000000..690bb2c59e --- /dev/null +++ b/plugins/shortcuts/src/AddShortcut.test.tsx @@ -0,0 +1,113 @@ +/* + * 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 React from 'react'; +import { render, screen, fireEvent, waitFor } from '@testing-library/react'; +import { AddShortcut } from './AddShortcut'; +import { LocalStoredShortcuts } from './api'; +import { MockStorageApi, wrapInTestApp } from '@backstage/test-utils'; +import { AlertDisplay } from '@backstage/core'; + +describe('AddShortcut', () => { + const api = new LocalStoredShortcuts(MockStorageApi.create()); + + const props = { + onClose: jest.fn(), + anchorEl: document.createElement('div'), + api, + }; + + beforeEach(() => { + jest.clearAllMocks(); + document.title = 'some document title'; + }); + + it('displays the title', async () => { + render(wrapInTestApp()); + + await waitFor(() => { + expect(screen.getByText('Add Shortcut')).toBeInTheDocument(); + }); + }); + + it('closes the popup', async () => { + render(wrapInTestApp()); + + fireEvent.click(screen.getByText('Cancel')); + await waitFor(() => { + expect(props.onClose).toHaveBeenCalledTimes(1); + }); + }); + + it('saves the input', async () => { + const spy = jest.spyOn(api, 'add'); + + render(wrapInTestApp()); + + const urlInput = screen.getByPlaceholderText('Enter a URL'); + const titleInput = screen.getByPlaceholderText('Enter a display name'); + fireEvent.change(urlInput, { target: { value: '/some-url' } }); + fireEvent.change(titleInput, { target: { value: 'some title' } }); + + fireEvent.click(screen.getByText('Save')); + await waitFor(() => { + expect(spy).toBeCalledWith({ + title: 'some title', + url: '/some-url', + }); + }); + }); + + it('pastes the values', async () => { + const spy = jest.spyOn(api, 'add'); + + render( + wrapInTestApp(, { + routeEntries: ['/some-initial-url'], + }), + ); + + fireEvent.click(screen.getByText('Paste Current Url')); + fireEvent.click(screen.getByText('Save')); + await waitFor(() => { + expect(spy).toBeCalledWith({ + title: 'some document title', + url: '/some-initial-url', + }); + }); + }); + + it('displays errors', async () => { + jest.spyOn(api, 'add').mockRejectedValueOnce(new Error('some add error')); + + render( + wrapInTestApp( + <> + + + , + ), + ); + + fireEvent.click(screen.getByText('Paste Current Url')); + fireEvent.click(screen.getByText('Save')); + await waitFor(() => { + expect( + screen.getByText('Could not add shortcut: some add error'), + ).toBeInTheDocument(); + }); + }); +}); diff --git a/plugins/shortcuts/src/EditShortcut.test.tsx b/plugins/shortcuts/src/EditShortcut.test.tsx new file mode 100644 index 0000000000..bf2396e194 --- /dev/null +++ b/plugins/shortcuts/src/EditShortcut.test.tsx @@ -0,0 +1,130 @@ +/* + * 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 React from 'react'; +import { render, screen, fireEvent, waitFor } from '@testing-library/react'; +import { EditShortcut } from './EditShortcut'; +import { Shortcut } from './types'; +import { LocalStoredShortcuts } from './api'; +import { MockStorageApi, wrapInTestApp } from '@backstage/test-utils'; +import { AlertDisplay } from '@backstage/core'; + +describe('EditShortcut', () => { + const shortcut: Shortcut = { + id: 'id', + url: '/some-url', + title: 'some title', + }; + const api = new LocalStoredShortcuts(MockStorageApi.create()); + + const props = { + onClose: jest.fn(), + anchorEl: document.createElement('div'), + shortcut, + api, + }; + + beforeEach(() => { + jest.clearAllMocks(); + }); + + it('displays the title', async () => { + render(wrapInTestApp()); + + await waitFor(() => { + expect(screen.getByText('Edit Shortcut')).toBeInTheDocument(); + }); + }); + + it('closes the popup', async () => { + render(wrapInTestApp()); + + fireEvent.click(screen.getByText('Cancel')); + await waitFor(() => { + expect(props.onClose).toHaveBeenCalledTimes(1); + }); + }); + + it('updates the shortcut', async () => { + const spy = jest.spyOn(api, 'update'); + + render(wrapInTestApp()); + + const urlInput = screen.getByPlaceholderText('Enter a URL'); + const titleInput = screen.getByPlaceholderText('Enter a display name'); + fireEvent.change(urlInput, { target: { value: '/some-new-url' } }); + fireEvent.change(titleInput, { target: { value: 'some new title' } }); + + fireEvent.click(screen.getByText('Save')); + await waitFor(() => { + expect(spy).toBeCalledWith({ + id: 'id', + title: 'some new title', + url: '/some-new-url', + }); + expect(props.onClose).toHaveBeenCalledTimes(1); + }); + }); + + it('removes the shortcut', async () => { + const spy = jest.spyOn(api, 'remove'); + + render(wrapInTestApp()); + + fireEvent.click(screen.getByText('Remove')); + await waitFor(() => { + expect(spy).toBeCalledWith({ + id: 'id', + title: 'some title', + url: '/some-url', + }); + }); + }); + + it('displays errors', async () => { + jest + .spyOn(api, 'update') + .mockRejectedValueOnce(new Error('some update error')); + + jest + .spyOn(api, 'remove') + .mockRejectedValueOnce(new Error('some remove error')); + + render( + wrapInTestApp( + <> + + + , + ), + ); + + fireEvent.click(screen.getByText('Save')); + await waitFor(() => { + expect( + screen.getByText('Could not update shortcut: some update error'), + ).toBeInTheDocument(); + }); + fireEvent.click(screen.getByTestId('error-button-close')); + + fireEvent.click(screen.getByText('Remove')); + await waitFor(() => { + expect( + screen.getByText('Could not delete shortcut: some remove error'), + ).toBeInTheDocument(); + }); + }); +}); diff --git a/plugins/shortcuts/src/ShortcutForm.test.tsx b/plugins/shortcuts/src/ShortcutForm.test.tsx new file mode 100644 index 0000000000..4586c484d0 --- /dev/null +++ b/plugins/shortcuts/src/ShortcutForm.test.tsx @@ -0,0 +1,73 @@ +/* + * 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 React from 'react'; +import { render, screen, fireEvent, waitFor } from '@testing-library/react'; +import { ShortcutForm } from './ShortcutForm'; +import { wrapInTestApp } from '@backstage/test-utils'; + +describe('ShortcutForm', () => { + const props = { + onSave: jest.fn(), + onClose: jest.fn(), + }; + + it('displays validation messages', async () => { + render(wrapInTestApp()); + + const urlInput = screen.getByPlaceholderText('Enter a URL'); + const titleInput = screen.getByPlaceholderText('Enter a display name'); + fireEvent.change(urlInput, { target: { value: 'url' } }); + fireEvent.change(titleInput, { target: { value: 't' } }); + + fireEvent.click(screen.getByText('Save')); + await waitFor(() => { + expect( + screen.getByText('Must be a relative URL (starts with a /)'), + ).toBeInTheDocument(); + expect( + screen.getByText('Must be at least 2 characters'), + ).toBeInTheDocument(); + }); + }); + + it('calls the save handler', async () => { + render( + wrapInTestApp( + , + ), + ); + + fireEvent.click(screen.getByText('Save')); + await waitFor(() => { + expect(props.onSave).toHaveBeenCalledWith( + expect.objectContaining({ title: 'some title', url: '/some-url' }), + expect.anything(), + ); + }); + }); + + it('calls the close handler', async () => { + render(wrapInTestApp()); + + fireEvent.click(screen.getByText('Cancel')); + await waitFor(() => { + expect(props.onClose).toHaveBeenCalled(); + }); + }); +}); diff --git a/plugins/shortcuts/src/ShortcutItem.test.tsx b/plugins/shortcuts/src/ShortcutItem.test.tsx new file mode 100644 index 0000000000..219771909d --- /dev/null +++ b/plugins/shortcuts/src/ShortcutItem.test.tsx @@ -0,0 +1,128 @@ +/* + * 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 React from 'react'; +import { render, screen, fireEvent, waitFor } from '@testing-library/react'; +import { ShortcutItem } from './ShortcutItem'; +import { Shortcut } from './types'; +import { SidebarContext } from '@backstage/core'; +import { LocalStoredShortcuts } from './api'; +import { MockStorageApi, wrapInTestApp } from '@backstage/test-utils'; +import { pageTheme } from '@backstage/theme'; + +describe('ShortcutItem', () => { + const shortcut: Shortcut = { + id: 'id', + url: '/some-url', + title: 'some title', + }; + const api = new LocalStoredShortcuts(MockStorageApi.create()); + + it('displays the shortcut', async () => { + render( + wrapInTestApp( + + + , + ), + ); + await waitFor(() => { + expect(screen.getByText('ST')).toBeInTheDocument(); + expect(screen.getByText('some title')).toBeInTheDocument(); + }); + }); + + it('calculates the shortcut text correctly', async () => { + const shortcut1: Shortcut = { + id: 'id1', + url: '/some-url', + title: 'onetitle', + }; + const shortcut2: Shortcut = { + id: 'id2', + url: '/some-url', + title: 'two title', + }; + const shortcut3: Shortcut = { + id: 'id3', + url: '/some-url', + title: 'more | title words', + }; + + const { rerender } = render( + wrapInTestApp(), + ); + + await waitFor(() => { + expect(screen.getByText('On')).toBeInTheDocument(); + }); + + rerender(wrapInTestApp()); + await waitFor(() => { + expect(screen.getByText('TT')).toBeInTheDocument(); + }); + + rerender(wrapInTestApp()); + await waitFor(() => { + expect(screen.getByText('MT')).toBeInTheDocument(); + }); + }); + + it('displays the edit icon on hover', async () => { + render( + wrapInTestApp( + + + , + ), + ); + + fireEvent.mouseOver(screen.getByText('ST')); + await waitFor(() => { + expect(screen.getByTestId('edit')).toBeInTheDocument(); + }); + + fireEvent.mouseOut(screen.getByText('ST')); + await waitFor(() => { + expect(screen.queryByTestId('edit')).not.toBeInTheDocument(); + }); + }); + + it('gets the color based on the theme', async () => { + const { rerender } = render( + wrapInTestApp(), + ); + + await waitFor(() => { + expect(document.querySelector('circle')?.getAttribute('fill')).toEqual( + pageTheme.tool.colors[0], + ); + }); + + const newShortcut: Shortcut = { + id: 'id', + url: '/catalog', + title: 'some title', + }; + rerender(wrapInTestApp()); + + await waitFor(() => { + expect(document.querySelector('circle')?.getAttribute('fill')).toEqual( + pageTheme.home.colors[0], + ); + }); + }); +}); diff --git a/plugins/shortcuts/src/Shortcuts.test.tsx b/plugins/shortcuts/src/Shortcuts.test.tsx new file mode 100644 index 0000000000..088a3705d9 --- /dev/null +++ b/plugins/shortcuts/src/Shortcuts.test.tsx @@ -0,0 +1,42 @@ +/* + * 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 React from 'react'; +import { SidebarContext, ApiProvider, ApiRegistry } from '@backstage/core'; +import { wrapInTestApp, MockStorageApi } from '@backstage/test-utils'; +import { render, screen, waitFor } from '@testing-library/react'; +import { Shortcuts } from './Shortcuts'; +import { LocalStoredShortcuts, shortcutsApiRef } from './api'; + +const apis = ApiRegistry.from([ + [shortcutsApiRef, new LocalStoredShortcuts(MockStorageApi.create())], +]); + +describe('Shortcuts', () => { + it('displays an add button', async () => { + render( + wrapInTestApp( + + + + + , + ), + ); + await waitFor(() => !screen.queryByTestId('progress')); + expect(screen.getByText('Add Shortcuts')).toBeInTheDocument(); + }); +}); diff --git a/plugins/shortcuts/src/api/LocalStoredShortcuts.test.ts b/plugins/shortcuts/src/api/LocalStoredShortcuts.test.ts new file mode 100644 index 0000000000..6fd45d73e5 --- /dev/null +++ b/plugins/shortcuts/src/api/LocalStoredShortcuts.test.ts @@ -0,0 +1,82 @@ +/* + * 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 { MockStorageApi } from '@backstage/test-utils'; +import { pageTheme } from '@backstage/theme'; +import { Shortcut } from '../types'; +import { LocalStoredShortcuts } from './LocalStoredShortcuts'; +import { ShortcutApi } from './ShortcutApi'; + +describe('LocalStoredShortcuts', () => { + // eslint-disable-next-line jest/no-done-callback + it('should observe shortcuts', async done => { + const shortcutApi: ShortcutApi = new LocalStoredShortcuts( + MockStorageApi.create(), + ); + const shortcut: Shortcut = { id: 'id', title: 'title', url: '/url' }; + + await shortcutApi.add(shortcut); + shortcutApi.observe().subscribe(data => { + expect(data).toEqual( + expect.arrayContaining([{ ...shortcut, id: expect.anything() }]), + ); + done(); + }); + }); + + it('should add shortcuts with ids', async () => { + const storageApi = MockStorageApi.create(); + const shortcutApi: ShortcutApi = new LocalStoredShortcuts(storageApi); + const shortcut: Omit = { title: 'title', url: '/url' }; + const spy = jest.spyOn(storageApi, 'set'); + + await shortcutApi.add(shortcut); + expect(spy).toHaveBeenCalledWith( + 'items', + expect.objectContaining([{ ...shortcut, id: expect.anything() }]), + ); + }); + + it('should update shortcuts', async () => { + const storageApi = MockStorageApi.create(); + const shortcutApi: ShortcutApi = new LocalStoredShortcuts(storageApi); + const shortcut: Shortcut = { id: 'someid', title: 'title', url: '/url' }; + const spy = jest.spyOn(storageApi, 'set'); + + await shortcutApi.update(shortcut); + expect(spy).toHaveBeenCalledWith( + 'items', + expect.objectContaining([shortcut]), + ); + }); + + it('should remove shortcuts', async () => { + const storageApi = MockStorageApi.create(); + const shortcutApi: ShortcutApi = new LocalStoredShortcuts(storageApi); + const shortcut: Shortcut = { id: 'someid', title: 'title', url: '/url' }; + const spy = jest.spyOn(storageApi, 'set'); + + await shortcutApi.remove(shortcut); + expect(spy).toHaveBeenCalledWith('items', []); + }); + + it('should get a color', () => { + const storageApi = MockStorageApi.create(); + const shortcutApi: ShortcutApi = new LocalStoredShortcuts(storageApi); + + expect(shortcutApi.getColor('/catalog')).toEqual(pageTheme.home.colors[0]); + }); +}); From c6ba5560f8bea18821ea9fa94abb9eb7505c7be1 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Tue, 20 Apr 2021 15:27:04 +0200 Subject: [PATCH 056/485] Move useRefetchContext to Dialog Signed-off-by: Erik Engervall --- .../src/components/Dialog.tsx | 37 +++++++++++++++---- .../ResponseStepList.test.tsx | 4 -- .../ResponseStepList/ResponseStepList.tsx | 15 +------- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/plugins/github-release-manager/src/components/Dialog.tsx b/plugins/github-release-manager/src/components/Dialog.tsx index 2a393edcf3..5460bc041b 100644 --- a/plugins/github-release-manager/src/components/Dialog.tsx +++ b/plugins/github-release-manager/src/components/Dialog.tsx @@ -15,11 +15,17 @@ */ import React from 'react'; -import { DialogTitle, Dialog as MaterialDialog } from '@material-ui/core'; +import { + Button, + Dialog as MaterialDialog, + DialogActions, + DialogTitle, +} from '@material-ui/core'; import { LinearProgressWithLabel } from './LinearProgressWithLabel'; import { ResponseStep } from '../types/types'; import { ResponseStepList } from './ResponseStepList/ResponseStepList'; +import { useRefetchContext } from '../contexts/RefetchContext'; interface DialogProps { progress: number; @@ -27,12 +33,27 @@ interface DialogProps { title: string; } -export const Dialog = ({ progress, responseSteps, title }: DialogProps) => ( - - {title} +export const Dialog = ({ progress, responseSteps, title }: DialogProps) => { + const { setRefetchTrigger } = useRefetchContext(); - + return ( + + {title} - - -); + + + + + + + + + ); +}; diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.test.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.test.tsx index 21f6c6925e..67fcf634a3 100644 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.test.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.test.tsx @@ -20,10 +20,6 @@ import { render } from '@testing-library/react'; import { ResponseStepList } from './ResponseStepList'; import { TEST_IDS } from '../../test-helpers/test-ids'; -jest.mock('../../contexts/RefetchContext', () => ({ - useRefetchContext: () => jest.fn(), -})); - describe('ResponseStepList', () => { it('should render loading state when loading', () => { const { getByTestId } = render( diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx index e703f08d34..082fb99517 100644 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx @@ -15,13 +15,12 @@ */ import React, { PropsWithChildren } from 'react'; -import { Button, DialogActions, DialogContent, List } from '@material-ui/core'; +import { DialogContent, List } from '@material-ui/core'; import { CenteredCircularProgress } from '../CenteredCircularProgress'; import { ResponseStep } from '../../types/types'; import { ResponseStepListItem } from './ResponseStepListItem'; import { TEST_IDS } from '../../test-helpers/test-ids'; -import { useRefetchContext } from '../../contexts/RefetchContext'; interface ResponseStepListProps { responseSteps: (ResponseStep | undefined)[]; @@ -38,8 +37,6 @@ export const ResponseStepList = ({ denseList = false, children, }: PropsWithChildren) => { - const { setRefetchTrigger } = useRefetchContext(); - return ( <> {loading || responseSteps.length === 0 ? ( @@ -72,16 +69,6 @@ export const ResponseStepList = ({ {children} - - - )} From 725d09af25d43c5ebcaac6ceff92da1f5b5da40d Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Tue, 20 Apr 2021 15:39:59 +0200 Subject: [PATCH 057/485] Align @testing-library/react-hooks version with others' Signed-off-by: Erik Engervall --- plugins/github-release-manager/package.json | 2 +- yarn.lock | 52 --------------------- 2 files changed, 1 insertion(+), 53 deletions(-) diff --git a/plugins/github-release-manager/package.json b/plugins/github-release-manager/package.json index cd32f0c105..c73941ec54 100644 --- a/plugins/github-release-manager/package.json +++ b/plugins/github-release-manager/package.json @@ -39,7 +39,7 @@ "@backstage/dev-utils": "^0.1.13", "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", - "@testing-library/react-hooks": "^5.1.1", + "@testing-library/react-hooks": "^3.4.2", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^12.0.7", "@types/jest": "^26.0.7", diff --git a/yarn.lock b/yarn.lock index 45a75c49f6..ef3a66bb24 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5550,18 +5550,6 @@ "@babel/runtime" "^7.5.4" "@types/testing-library__react-hooks" "^3.4.0" -"@testing-library/react-hooks@^5.1.1": - version "5.1.1" - resolved "https://registry.npmjs.org/@testing-library/react-hooks/-/react-hooks-5.1.1.tgz#1fbaae8a4e8a4a7f97b176c23e1e890c41bbbfa5" - integrity sha512-52D2XnpelFDefnWpy/V6z2qGNj8JLIvW5DjYtelMvFXdEyWiykSaI7IXHwFy4ICoqXJDmmwHAiFRiFboub/U5g== - dependencies: - "@babel/runtime" "^7.12.5" - "@types/react" ">=16.9.0" - "@types/react-dom" ">=16.9.0" - "@types/react-test-renderer" ">=16.9.0" - filter-console "^0.1.1" - react-error-boundary "^3.1.0" - "@testing-library/react@^11.2.5": version "11.2.6" resolved "https://registry.npmjs.org/@testing-library/react/-/react-11.2.6.tgz#586a23adc63615985d85be0c903f374dab19200b" @@ -6495,13 +6483,6 @@ "@types/webpack" "*" "@types/webpack-dev-server" "*" -"@types/react-dom@>=16.9.0": - version "17.0.3" - resolved "https://registry.npmjs.org/@types/react-dom/-/react-dom-17.0.3.tgz#7fdf37b8af9d6d40127137865bb3fff8871d7ee1" - integrity sha512-4NnJbCeWE+8YBzupn/YrJxZ8VnjcJq5iR1laqQ1vkpQgBiA7bwk0Rp24fxsdNinzJY2U+HHS4dJJDPdoMjdJ7w== - dependencies: - "@types/react" "*" - "@types/react-dom@^16.9.8": version "16.9.8" resolved "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.9.8.tgz#fe4c1e11dfc67155733dfa6aa65108b4971cb423" @@ -6545,13 +6526,6 @@ dependencies: "@types/react" "*" -"@types/react-test-renderer@>=16.9.0": - version "17.0.1" - resolved "https://registry.npmjs.org/@types/react-test-renderer/-/react-test-renderer-17.0.1.tgz#3120f7d1c157fba9df0118dae20cb0297ee0e06b" - integrity sha512-3Fi2O6Zzq/f3QR9dRnlnHso9bMl7weKCviFmfF6B4LS1Uat6Hkm15k0ZAQuDz+UBq6B3+g+NM6IT2nr5QgPzCw== - dependencies: - "@types/react" "*" - "@types/react-text-truncate@^0.14.0": version "0.14.0" resolved "https://registry.npmjs.org/@types/react-text-truncate/-/react-text-truncate-0.14.0.tgz#588bbabbc7f2a13815e805f3a48942db73fe65fe" @@ -6588,15 +6562,6 @@ dependencies: csstype "^2.2.0" -"@types/react@>=16.9.0": - version "17.0.3" - resolved "https://registry.npmjs.org/@types/react/-/react-17.0.3.tgz#ba6e215368501ac3826951eef2904574c262cc79" - integrity sha512-wYOUxIgs2HZZ0ACNiIayItyluADNbONl7kt8lkLjVK8IitMH5QMyAh75Fwhmo37r1m7L2JaFj03sIfxBVDvRAg== - dependencies: - "@types/prop-types" "*" - "@types/scheduler" "*" - csstype "^3.0.2" - "@types/reactcss@*": version "1.2.3" resolved "https://registry.npmjs.org/@types/reactcss/-/reactcss-1.2.3.tgz#af28ae11bbb277978b99d04d1eedfd068ca71834" @@ -6678,11 +6643,6 @@ "@types/node" "*" rollup "^0.63.4" -"@types/scheduler@*": - version "0.16.1" - resolved "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.1.tgz#18845205e86ff0038517aab7a18a62a6b9f71275" - integrity sha512-EaCxbanVeyxDRTQBkdLb3Bvl/HK7PBK6UJjsSixB0iHKoWxE5uu2Q/DgtpOhPIojN0Zl1whvOd7PoHs2P0s5eA== - "@types/semver@^6.0.0": version "6.2.1" resolved "https://registry.npmjs.org/@types/semver/-/semver-6.2.1.tgz#a236185670a7860f1597cf73bea2e16d001461ba" @@ -13294,11 +13254,6 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" -filter-console@^0.1.1: - version "0.1.1" - resolved "https://registry.npmjs.org/filter-console/-/filter-console-0.1.1.tgz#6242be28982bba7415bcc6db74a79f4a294fa67c" - integrity sha512-zrXoV1Uaz52DqPs+qEwNJWJFAWZpYJ47UNmpN9q4j+/EYsz85uV0DC9k8tRND5kYmoVzL0W+Y75q4Rg8sRJCdg== - filter-obj@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/filter-obj/-/filter-obj-1.1.0.tgz#9b311112bc6c6127a16e016c6c5d7f19e0805c5b" @@ -21954,13 +21909,6 @@ react-draggable@^4.0.3: classnames "^2.2.5" prop-types "^15.6.0" -react-error-boundary@^3.1.0: - version "3.1.1" - resolved "https://registry.npmjs.org/react-error-boundary/-/react-error-boundary-3.1.1.tgz#932c5ca5cbab8ec4fe37fd7b415aa5c3a47597e7" - integrity sha512-W3xCd9zXnanqrTUeViceufD3mIW8Ut29BUD+S2f0eO2XCOU8b6UrJfY46RDGe5lxCJzfe4j0yvIfh0RbTZhKJw== - dependencies: - "@babel/runtime" "^7.12.5" - react-error-overlay@^6.0.7, react-error-overlay@^6.0.9: version "6.0.9" resolved "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz#3c743010c9359608c375ecd6bc76f35d93995b0a" From f9a100f39c924aeb92664e15356e6dfa600ae407 Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Tue, 20 Apr 2021 16:32:51 +0200 Subject: [PATCH 058/485] Remove unintentional export in plugins.ts Signed-off-by: Marcus Eide --- packages/app/src/plugins.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/app/src/plugins.ts b/packages/app/src/plugins.ts index 9ea887ac27..e02e30e5d9 100644 --- a/packages/app/src/plugins.ts +++ b/packages/app/src/plugins.ts @@ -17,5 +17,4 @@ // TODO(Rugvip): This plugin is currently not part of the app element tree, // ideally we have an API for the context menu that permits that. export { badgesPlugin } from '@backstage/plugin-badges'; -export { githubDeploymentsPlugin } from '@backstage/plugin-github-deployments'; export { shortcutsPlugin } from '@backstage/plugin-shortcuts'; From cba751d5045184514342cfa21aef8f00d3e32c63 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Tue, 20 Apr 2021 19:04:22 +0200 Subject: [PATCH 059/485] Prettifying Signed-off-by: Erik Engervall --- .../src/GitHubReleaseManager.tsx | 2 +- .../src/api/PluginApiClient.ts | 2 +- .../src/cards/Cards.tsx | 22 +++--- .../cards/{patchRc => Patch}/Patch.test.tsx | 0 .../src/cards/{patchRc => Patch}/Patch.tsx | 0 .../{patchRc => Patch}/PatchBody.test.tsx | 4 +- .../cards/{patchRc => Patch}/PatchBody.tsx | 16 ++-- .../hooks}/usePatch.test.ts | 0 .../sideEffects => Patch/hooks}/usePatch.ts | 15 ++-- .../PromoteRc.test.tsx | 10 ++- .../PromoteRc.tsx | 13 +-- .../PromoteRcBody.test.tsx | 2 +- .../PromoteRcBody.tsx | 9 ++- .../hooks}/usePromoteRc.test.ts | 0 .../hooks}/usePromoteRc.ts | 13 ++- .../Owner.test.tsx | 0 .../Owner.tsx | 2 +- .../Repo.test.tsx | 0 .../{projectForm => RepoDetailsForm}/Repo.tsx | 12 +-- .../RepoDetailsForm.tsx | 0 .../VersioningStrategy.test.tsx | 0 .../VersioningStrategy.tsx | 2 +- .../styles.ts | 0 .../src/cards/createRc/CreateRc.test.tsx | 21 ++--- .../src/cards/createRc/CreateRc.tsx | 18 ++--- .../{ => helpers}/getRcGitHubInfo.test.ts | 4 +- .../createRc/{ => helpers}/getRcGitHubInfo.ts | 10 +-- .../useCreateRc.test.tsx | 1 + .../{sideEffects => hooks}/useCreateRc.ts | 15 ++-- .../components/LinearProgressWithLabel.tsx | 40 ---------- .../LinearProgressWithLabel.tsx | 79 +++++++++++++++++++ .../ResponseStepDialog.test.tsx} | 10 +-- .../ResponseStepDialog.tsx} | 41 +++++++--- .../ResponseStepList.test.tsx | 0 .../ResponseStepList.tsx | 0 .../ResponseStepListItem.test.tsx | 2 +- .../ResponseStepListItem.tsx | 2 +- .../useGetGitHubBatchInfo.ts} | 44 +++++++---- .../src/hooks/useResponseSteps.ts | 36 ++++----- .../src/test-helpers/test-helpers.ts | 6 +- .../github-release-manager/src/types/types.ts | 7 ++ 41 files changed, 282 insertions(+), 178 deletions(-) rename plugins/github-release-manager/src/cards/{patchRc => Patch}/Patch.test.tsx (100%) rename plugins/github-release-manager/src/cards/{patchRc => Patch}/Patch.tsx (100%) rename plugins/github-release-manager/src/cards/{patchRc => Patch}/PatchBody.test.tsx (98%) rename plugins/github-release-manager/src/cards/{patchRc => Patch}/PatchBody.tsx (94%) rename plugins/github-release-manager/src/cards/{patchRc/sideEffects => Patch/hooks}/usePatch.test.ts (100%) rename plugins/github-release-manager/src/cards/{patchRc/sideEffects => Patch/hooks}/usePatch.ts (97%) rename plugins/github-release-manager/src/cards/{promoteRc => PromoteReleaseCandidate}/PromoteRc.test.tsx (83%) rename plugins/github-release-manager/src/cards/{promoteRc => PromoteReleaseCandidate}/PromoteRc.tsx (93%) rename plugins/github-release-manager/src/cards/{promoteRc => PromoteReleaseCandidate}/PromoteRcBody.test.tsx (96%) rename plugins/github-release-manager/src/cards/{promoteRc => PromoteReleaseCandidate}/PromoteRcBody.tsx (89%) rename plugins/github-release-manager/src/cards/{promoteRc/sideEffects => PromoteReleaseCandidate/hooks}/usePromoteRc.test.ts (100%) rename plugins/github-release-manager/src/cards/{promoteRc/sideEffects => PromoteReleaseCandidate/hooks}/usePromoteRc.ts (92%) rename plugins/github-release-manager/src/cards/{projectForm => RepoDetailsForm}/Owner.test.tsx (100%) rename plugins/github-release-manager/src/cards/{projectForm => RepoDetailsForm}/Owner.tsx (100%) rename plugins/github-release-manager/src/cards/{projectForm => RepoDetailsForm}/Repo.test.tsx (100%) rename plugins/github-release-manager/src/cards/{projectForm => RepoDetailsForm}/Repo.tsx (100%) rename plugins/github-release-manager/src/cards/{projectForm => RepoDetailsForm}/RepoDetailsForm.tsx (100%) rename plugins/github-release-manager/src/cards/{projectForm => RepoDetailsForm}/VersioningStrategy.test.tsx (100%) rename plugins/github-release-manager/src/cards/{projectForm => RepoDetailsForm}/VersioningStrategy.tsx (100%) rename plugins/github-release-manager/src/cards/{projectForm => RepoDetailsForm}/styles.ts (100%) rename plugins/github-release-manager/src/cards/createRc/{ => helpers}/getRcGitHubInfo.test.ts (98%) rename plugins/github-release-manager/src/cards/createRc/{ => helpers}/getRcGitHubInfo.ts (82%) rename plugins/github-release-manager/src/cards/createRc/{sideEffects => hooks}/useCreateRc.test.tsx (99%) rename plugins/github-release-manager/src/cards/createRc/{sideEffects => hooks}/useCreateRc.ts (95%) delete mode 100644 plugins/github-release-manager/src/components/LinearProgressWithLabel.tsx create mode 100644 plugins/github-release-manager/src/components/ResponseStepDialog/LinearProgressWithLabel.tsx rename plugins/github-release-manager/src/components/{Dialog.test.tsx => ResponseStepDialog/ResponseStepDialog.test.tsx} (83%) rename plugins/github-release-manager/src/components/{Dialog.tsx => ResponseStepDialog/ResponseStepDialog.tsx} (57%) rename plugins/github-release-manager/src/components/{ResponseStepList => ResponseStepDialog}/ResponseStepList.test.tsx (100%) rename plugins/github-release-manager/src/components/{ResponseStepList => ResponseStepDialog}/ResponseStepList.tsx (100%) rename plugins/github-release-manager/src/components/{ResponseStepList => ResponseStepDialog}/ResponseStepListItem.test.tsx (100%) rename plugins/github-release-manager/src/components/{ResponseStepList => ResponseStepDialog}/ResponseStepListItem.tsx (100%) rename plugins/github-release-manager/src/{sideEffects/getGitHubBatchInfo.ts => hooks/useGetGitHubBatchInfo.ts} (55%) diff --git a/plugins/github-release-manager/src/GitHubReleaseManager.tsx b/plugins/github-release-manager/src/GitHubReleaseManager.tsx index 1160016a66..64b7ebb028 100644 --- a/plugins/github-release-manager/src/GitHubReleaseManager.tsx +++ b/plugins/github-release-manager/src/GitHubReleaseManager.tsx @@ -32,7 +32,7 @@ import { InfoCardPlus } from './components/InfoCardPlus'; import { isProjectValid } from './helpers/isProjectValid'; import { PluginApiClientContext } from './contexts/PluginApiClientContext'; import { ProjectContext, Project } from './contexts/ProjectContext'; -import { RepoDetailsForm } from './cards/projectForm/RepoDetailsForm'; +import { RepoDetailsForm } from './cards/RepoDetailsForm/RepoDetailsForm'; import { useQueryHandler } from './hooks/useQueryHandler'; import { useStyles } from './styles/styles'; diff --git a/plugins/github-release-manager/src/api/PluginApiClient.ts b/plugins/github-release-manager/src/api/PluginApiClient.ts index 9c6b840989..276951b598 100644 --- a/plugins/github-release-manager/src/api/PluginApiClient.ts +++ b/plugins/github-release-manager/src/api/PluginApiClient.ts @@ -20,7 +20,7 @@ import { readGitHubIntegrationConfigs } from '@backstage/integration'; import { CalverTagParts } from '../helpers/tagParts/getCalverTagParts'; import { DISABLE_CACHE } from '../constants/constants'; -import { getRcGitHubInfo } from '../cards/createRc/getRcGitHubInfo'; +import { getRcGitHubInfo } from '../cards/CreateRc/helpers/getRcGitHubInfo'; import { Project } from '../contexts/ProjectContext'; import { SemverTagParts } from '../helpers/tagParts/getSemverTagParts'; diff --git a/plugins/github-release-manager/src/cards/Cards.tsx b/plugins/github-release-manager/src/cards/Cards.tsx index 5773717cd8..5fbb7fb1f7 100644 --- a/plugins/github-release-manager/src/cards/Cards.tsx +++ b/plugins/github-release-manager/src/cards/Cards.tsx @@ -15,18 +15,17 @@ */ import React, { useState } from 'react'; -import { useAsync } from 'react-use'; import { ErrorBoundary } from '@backstage/core'; import { Alert } from '@material-ui/lab'; import { CenteredCircularProgress } from '../components/CenteredCircularProgress'; -import { CreateRc } from './createRc/CreateRc'; -import { getGitHubBatchInfo } from '../sideEffects/getGitHubBatchInfo'; +import { CreateRc } from './CreateRc/CreateRc'; import { GitHubReleaseManagerProps } from '../GitHubReleaseManager'; -import { Info } from './info/Info'; -import { Patch } from './patchRc/Patch'; -import { PromoteRc } from './promoteRc/PromoteRc'; +import { Info } from './Info/Info'; +import { Patch } from './Patch/Patch'; +import { PromoteReleaseCandidate } from './PromoteReleaseCandidate/PromoteRc'; import { RefetchContext } from '../contexts/RefetchContext'; +import { useGetGitHubBatchInfo } from '../hooks/useGetGitHubBatchInfo'; import { usePluginApiClientContext } from '../contexts/PluginApiClientContext'; import { useProjectContext } from '../contexts/ProjectContext'; import { useVersioningStrategyMatchesRepoTags } from '../hooks/useVersioningStrategyMatchesRepoTags'; @@ -39,10 +38,11 @@ export function Cards({ const pluginApiClient = usePluginApiClientContext(); const project = useProjectContext(); const [refetchTrigger, setRefetchTrigger] = useState(0); - const gitHubBatchInfo = useAsync( - getGitHubBatchInfo({ project, pluginApiClient }), - [project, refetchTrigger], - ); + const { gitHubBatchInfo } = useGetGitHubBatchInfo({ + pluginApiClient, + project, + refetchTrigger, + }); const { versioningStrategyMatches } = useVersioningStrategyMatchesRepoTags({ latestReleaseTagName: gitHubBatchInfo.value?.latestRelease?.tagName, @@ -111,7 +111,7 @@ export function Cards({ )} {!components?.promoteRc?.omit && ( - diff --git a/plugins/github-release-manager/src/cards/patchRc/Patch.test.tsx b/plugins/github-release-manager/src/cards/Patch/Patch.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/patchRc/Patch.test.tsx rename to plugins/github-release-manager/src/cards/Patch/Patch.test.tsx diff --git a/plugins/github-release-manager/src/cards/patchRc/Patch.tsx b/plugins/github-release-manager/src/cards/Patch/Patch.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/patchRc/Patch.tsx rename to plugins/github-release-manager/src/cards/Patch/Patch.tsx diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx b/plugins/github-release-manager/src/cards/Patch/PatchBody.test.tsx similarity index 98% rename from plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx rename to plugins/github-release-manager/src/cards/Patch/PatchBody.test.tsx index f9a8babb5d..2d8025bd3f 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.test.tsx +++ b/plugins/github-release-manager/src/cards/Patch/PatchBody.test.tsx @@ -21,8 +21,8 @@ import { mockApiClient, mockBumpedTag, mockCalverProject, - mockReleaseCandidateCalver, mockReleaseBranch, + mockReleaseCandidateCalver, mockReleaseVersionCalver, mockTagParts, } from '../../test-helpers/test-helpers'; @@ -33,7 +33,7 @@ jest.mock('../../contexts/PluginApiClientContext', () => ({ jest.mock('../../contexts/ProjectContext', () => ({ useProjectContext: jest.fn(() => mockCalverProject), })); -jest.mock('./sideEffects/usePatch', () => ({ +jest.mock('./hooks/usePatch', () => ({ usePatch: () => ({ run: jest.fn(), responseSteps: [], diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx b/plugins/github-release-manager/src/cards/Patch/PatchBody.tsx similarity index 94% rename from plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx rename to plugins/github-release-manager/src/cards/Patch/PatchBody.tsx index ce0b3acd1c..6f112cf013 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx +++ b/plugins/github-release-manager/src/cards/Patch/PatchBody.tsx @@ -40,12 +40,12 @@ import { import { CalverTagParts } from '../../helpers/tagParts/getCalverTagParts'; import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; import { ComponentConfigPatch } from '../../types/types'; -import { Dialog } from '../../components/Dialog'; import { Differ } from '../../components/Differ'; import { GitHubReleaseManagerError } from '../../errors/GitHubReleaseManagerError'; +import { ResponseStepDialog } from '../../components/ResponseStepDialog/ResponseStepDialog'; import { SemverTagParts } from '../../helpers/tagParts/getSemverTagParts'; import { TEST_IDS } from '../../test-helpers/test-ids'; -import { usePatch } from './sideEffects/usePatch'; +import { usePatch } from './hooks/usePatch'; import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; import { useProjectContext } from '../../contexts/ProjectContext'; import { useStyles } from '../../styles/styles'; @@ -91,7 +91,7 @@ export const PatchBody = ({ }; }); - const { run, responseSteps, progress } = usePatch({ + const { progress, responseSteps, run, runInvoked } = usePatch({ bumpedTag, latestRelease, pluginApiClient, @@ -101,7 +101,7 @@ export const PatchBody = ({ }); if (responseSteps.length > 0) { return ( - 0 || commitExistsOnReleaseBranch || hasNoParent + runInvoked || commitExistsOnReleaseBranch || hasNoParent } role={undefined} dense @@ -238,7 +238,11 @@ export const PatchBody = ({ { const repoPath = pluginApiClient.getRepoPath({ owner: project.owner, diff --git a/plugins/github-release-manager/src/cards/patchRc/sideEffects/usePatch.test.ts b/plugins/github-release-manager/src/cards/Patch/hooks/usePatch.test.ts similarity index 100% rename from plugins/github-release-manager/src/cards/patchRc/sideEffects/usePatch.test.ts rename to plugins/github-release-manager/src/cards/Patch/hooks/usePatch.test.ts diff --git a/plugins/github-release-manager/src/cards/patchRc/sideEffects/usePatch.ts b/plugins/github-release-manager/src/cards/Patch/hooks/usePatch.ts similarity index 97% rename from plugins/github-release-manager/src/cards/patchRc/sideEffects/usePatch.ts rename to plugins/github-release-manager/src/cards/Patch/hooks/usePatch.ts index 92eae6defc..af7e890ca9 100644 --- a/plugins/github-release-manager/src/cards/patchRc/sideEffects/usePatch.ts +++ b/plugins/github-release-manager/src/cards/Patch/hooks/usePatch.ts @@ -17,13 +17,13 @@ import { useEffect, useState } from 'react'; import { useAsync, useAsyncFn } from 'react-use'; -import { ComponentConfigPatch } from '../../../types/types'; -import { CalverTagParts } from '../../../helpers/tagParts/getCalverTagParts'; import { GetLatestReleaseResult, GetRecentCommitsResultSingle, IPluginApiClient, } from '../../../api/PluginApiClient'; +import { CalverTagParts } from '../../../helpers/tagParts/getCalverTagParts'; +import { ComponentConfigPatch, CardHook } from '../../../types/types'; import { Project } from '../../../contexts/ProjectContext'; import { SemverTagParts } from '../../../helpers/tagParts/getSemverTagParts'; import { useResponseSteps } from '../../../hooks/useResponseSteps'; @@ -45,7 +45,7 @@ export function usePatch({ project, tagParts, successCb, -}: Patch) { +}: Patch): CardHook { const { responseSteps, addStepToResponseSteps, @@ -345,8 +345,13 @@ export function usePatch({ }, [TOTAL_STEPS, responseSteps.length]); return { - run, - responseSteps, progress, + responseSteps, + run, + runInvoked: Boolean( + releaseBranchRes.loading || + releaseBranchRes.value || + releaseBranchRes.error, + ), }; } diff --git a/plugins/github-release-manager/src/cards/promoteRc/PromoteRc.test.tsx b/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRc.test.tsx similarity index 83% rename from plugins/github-release-manager/src/cards/promoteRc/PromoteRc.test.tsx rename to plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRc.test.tsx index f4e7c1fb41..e917c295d6 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/PromoteRc.test.tsx +++ b/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRc.test.tsx @@ -29,11 +29,13 @@ jest.mock('./PromoteRcBody', () => ({ ), })); -import { PromoteRc } from './PromoteRc'; +import { PromoteReleaseCandidate } from './PromoteRc'; describe('PromoteRc', () => { it('return early if no latest release present', () => { - const { getByTestId } = render(); + const { getByTestId } = render( + , + ); expect( getByTestId(TEST_IDS.components.noLatestRelease), @@ -42,7 +44,7 @@ describe('PromoteRc', () => { it('should display not-rc warning', () => { const { getByTestId } = render( - , + , ); expect(getByTestId(TEST_IDS.promoteRc.notRcWarning)).toBeInTheDocument(); @@ -50,7 +52,7 @@ describe('PromoteRc', () => { it('should display PromoteRcBody', () => { const { getByTestId } = render( - , + , ); expect( diff --git a/plugins/github-release-manager/src/cards/promoteRc/PromoteRc.tsx b/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRc.tsx similarity index 93% rename from plugins/github-release-manager/src/cards/promoteRc/PromoteRc.tsx rename to plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRc.tsx index 42ceb1ff47..56b506bcab 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/PromoteRc.tsx +++ b/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRc.tsx @@ -18,20 +18,23 @@ import React from 'react'; import { Alert, AlertTitle } from '@material-ui/lab'; import { Typography } from '@material-ui/core'; +import { ComponentConfigPromoteRc } from '../../types/types'; +import { GetLatestReleaseResult } from '../../api/PluginApiClient'; import { InfoCardPlus } from '../../components/InfoCardPlus'; import { NoLatestRelease } from '../../components/NoLatestRelease'; -import { ComponentConfigPromoteRc } from '../../types/types'; import { PromoteRcBody } from './PromoteRcBody'; -import { useStyles } from '../../styles/styles'; import { TEST_IDS } from '../../test-helpers/test-ids'; -import { GetLatestReleaseResult } from '../../api/PluginApiClient'; +import { useStyles } from '../../styles/styles'; -interface PromoteRcProps { +interface PromoteReleaseCandidateProps { latestRelease: GetLatestReleaseResult; successCb?: ComponentConfigPromoteRc['successCb']; } -export const PromoteRc = ({ latestRelease, successCb }: PromoteRcProps) => { +export const PromoteReleaseCandidate = ({ + latestRelease, + successCb, +}: PromoteReleaseCandidateProps) => { const classes = useStyles(); function Body() { diff --git a/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.test.tsx b/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRcBody.test.tsx similarity index 96% rename from plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.test.tsx rename to plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRcBody.test.tsx index ca6cce1811..573e85bf10 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.test.tsx +++ b/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRcBody.test.tsx @@ -30,7 +30,7 @@ jest.mock('../../contexts/PluginApiClientContext', () => ({ jest.mock('../../contexts/ProjectContext', () => ({ useProjectContext: jest.fn(() => mockCalverProject), })); -jest.mock('./sideEffects/usePromoteRc', () => ({ +jest.mock('./hooks/usePromoteRc', () => ({ usePromoteRc: () => ({ run: jest.fn(), responseSteps: [], diff --git a/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx b/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRcBody.tsx similarity index 89% rename from plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx rename to plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRcBody.tsx index a3b2ef0f68..88d1ccbf79 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/PromoteRcBody.tsx +++ b/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRcBody.tsx @@ -18,13 +18,13 @@ import React from 'react'; import { Button, Typography } from '@material-ui/core'; import { ComponentConfigPromoteRc } from '../../types/types'; -import { Dialog } from '../../components/Dialog'; import { Differ } from '../../components/Differ'; import { GetLatestReleaseResult } from '../../api/PluginApiClient'; +import { ResponseStepDialog } from '../../components/ResponseStepDialog/ResponseStepDialog'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; import { useProjectContext } from '../../contexts/ProjectContext'; -import { usePromoteRc } from './sideEffects/usePromoteRc'; +import { usePromoteRc } from './hooks/usePromoteRc'; import { useStyles } from '../../styles/styles'; interface PromoteRcBodyProps { @@ -38,7 +38,7 @@ export const PromoteRcBody = ({ rcRelease, successCb }: PromoteRcBodyProps) => { const classes = useStyles(); const releaseVersion = rcRelease.tagName.replace('rc-', 'version-'); - const { run, responseSteps, progress } = usePromoteRc({ + const { progress, responseSteps, run, runInvoked } = usePromoteRc({ pluginApiClient, project, rcRelease, @@ -48,7 +48,7 @@ export const PromoteRcBody = ({ rcRelease, successCb }: PromoteRcBodyProps) => { if (responseSteps.length > 0) { return ( - { data-testid={TEST_IDS.promoteRc.cta} variant="contained" color="primary" + disabled={runInvoked} onClick={() => run()} > Promote Release Candidate diff --git a/plugins/github-release-manager/src/cards/promoteRc/sideEffects/usePromoteRc.test.ts b/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/hooks/usePromoteRc.test.ts similarity index 100% rename from plugins/github-release-manager/src/cards/promoteRc/sideEffects/usePromoteRc.test.ts rename to plugins/github-release-manager/src/cards/PromoteReleaseCandidate/hooks/usePromoteRc.test.ts diff --git a/plugins/github-release-manager/src/cards/promoteRc/sideEffects/usePromoteRc.ts b/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/hooks/usePromoteRc.ts similarity index 92% rename from plugins/github-release-manager/src/cards/promoteRc/sideEffects/usePromoteRc.ts rename to plugins/github-release-manager/src/cards/PromoteReleaseCandidate/hooks/usePromoteRc.ts index b882b0bdcf..abcab2f480 100644 --- a/plugins/github-release-manager/src/cards/promoteRc/sideEffects/usePromoteRc.ts +++ b/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/hooks/usePromoteRc.ts @@ -17,11 +17,11 @@ import { useState, useEffect } from 'react'; import { useAsync, useAsyncFn } from 'react-use'; -import { ComponentConfigPromoteRc } from '../../../types/types'; import { GetLatestReleaseResult, IPluginApiClient, } from '../../../api/PluginApiClient'; +import { CardHook, ComponentConfigPromoteRc } from '../../../types/types'; import { Project } from '../../../contexts/ProjectContext'; import { useResponseSteps } from '../../../hooks/useResponseSteps'; @@ -39,7 +39,7 @@ export function usePromoteRc({ rcRelease, releaseVersion, successCb, -}: PromoteRc) { +}: PromoteRc): CardHook { const { responseSteps, addStepToResponseSteps, @@ -105,8 +105,13 @@ export function usePromoteRc({ }, [TOTAL_STEPS, responseSteps.length]); return { - run, - responseSteps, progress, + responseSteps, + run, + runInvoked: Boolean( + promotedReleaseRes.loading || + promotedReleaseRes.value || + promotedReleaseRes.error, + ), }; } diff --git a/plugins/github-release-manager/src/cards/projectForm/Owner.test.tsx b/plugins/github-release-manager/src/cards/RepoDetailsForm/Owner.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/projectForm/Owner.test.tsx rename to plugins/github-release-manager/src/cards/RepoDetailsForm/Owner.test.tsx diff --git a/plugins/github-release-manager/src/cards/projectForm/Owner.tsx b/plugins/github-release-manager/src/cards/RepoDetailsForm/Owner.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/projectForm/Owner.tsx rename to plugins/github-release-manager/src/cards/RepoDetailsForm/Owner.tsx index 8f67038697..4c040cac4f 100644 --- a/plugins/github-release-manager/src/cards/projectForm/Owner.tsx +++ b/plugins/github-release-manager/src/cards/RepoDetailsForm/Owner.tsx @@ -26,11 +26,11 @@ import { } from '@material-ui/core'; import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; +import { TEST_IDS } from '../../test-helpers/test-ids'; import { useFormClasses } from './styles'; import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; import { useProjectContext } from '../../contexts/ProjectContext'; import { useQueryHandler } from '../../hooks/useQueryHandler'; -import { TEST_IDS } from '../../test-helpers/test-ids'; export function Owner({ username }: { username: string }) { const project = useProjectContext(); diff --git a/plugins/github-release-manager/src/cards/projectForm/Repo.test.tsx b/plugins/github-release-manager/src/cards/RepoDetailsForm/Repo.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/projectForm/Repo.test.tsx rename to plugins/github-release-manager/src/cards/RepoDetailsForm/Repo.test.tsx diff --git a/plugins/github-release-manager/src/cards/projectForm/Repo.tsx b/plugins/github-release-manager/src/cards/RepoDetailsForm/Repo.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/projectForm/Repo.tsx rename to plugins/github-release-manager/src/cards/RepoDetailsForm/Repo.tsx index 4c7b995c44..57a339ab81 100644 --- a/plugins/github-release-manager/src/cards/projectForm/Repo.tsx +++ b/plugins/github-release-manager/src/cards/RepoDetailsForm/Repo.tsx @@ -19,18 +19,18 @@ import { useAsync } from 'react-use'; import { useNavigate } from 'react-router'; import { FormControl, - InputLabel, - Select, - MenuItem, FormHelperText, + InputLabel, + MenuItem, + Select, } from '@material-ui/core'; -import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; -import { useFormClasses } from './styles'; import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; +import { TEST_IDS } from '../../test-helpers/test-ids'; +import { useFormClasses } from './styles'; +import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; import { useProjectContext } from '../../contexts/ProjectContext'; import { useQueryHandler } from '../../hooks/useQueryHandler'; -import { TEST_IDS } from '../../test-helpers/test-ids'; export function Repo() { const pluginApiClient = usePluginApiClientContext(); diff --git a/plugins/github-release-manager/src/cards/projectForm/RepoDetailsForm.tsx b/plugins/github-release-manager/src/cards/RepoDetailsForm/RepoDetailsForm.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/projectForm/RepoDetailsForm.tsx rename to plugins/github-release-manager/src/cards/RepoDetailsForm/RepoDetailsForm.tsx diff --git a/plugins/github-release-manager/src/cards/projectForm/VersioningStrategy.test.tsx b/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/projectForm/VersioningStrategy.test.tsx rename to plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.test.tsx diff --git a/plugins/github-release-manager/src/cards/projectForm/VersioningStrategy.tsx b/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/projectForm/VersioningStrategy.tsx rename to plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.tsx index ebbee5b419..b1d4c594cf 100644 --- a/plugins/github-release-manager/src/cards/projectForm/VersioningStrategy.tsx +++ b/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.tsx @@ -24,9 +24,9 @@ import { RadioGroup, } from '@material-ui/core'; +import { TEST_IDS } from '../../test-helpers/test-ids'; import { useProjectContext } from '../../contexts/ProjectContext'; import { useQueryHandler } from '../../hooks/useQueryHandler'; -import { TEST_IDS } from '../../test-helpers/test-ids'; export function VersioningStrategy() { const navigate = useNavigate(); diff --git a/plugins/github-release-manager/src/cards/projectForm/styles.ts b/plugins/github-release-manager/src/cards/RepoDetailsForm/styles.ts similarity index 100% rename from plugins/github-release-manager/src/cards/projectForm/styles.ts rename to plugins/github-release-manager/src/cards/RepoDetailsForm/styles.ts diff --git a/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx b/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx index fa83f39592..4363d12c98 100644 --- a/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx +++ b/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx @@ -21,28 +21,31 @@ import { mockApiClient, mockCalverProject, mockNextGitHubInfo, - mockReleaseCandidateCalver, mockReleaseBranch, + mockReleaseCandidateCalver, mockReleaseVersionCalver, mockSemverProject, } from '../../test-helpers/test-helpers'; import { TEST_IDS } from '../../test-helpers/test-ids'; +import { useCreateRc } from './hooks/useCreateRc'; jest.mock('../../contexts/PluginApiClientContext', () => ({ - usePluginApiClientContext: jest.fn(() => mockApiClient), + usePluginApiClientContext: () => mockApiClient, })); jest.mock('../../contexts/ProjectContext', () => ({ useProjectContext: jest.fn(() => mockCalverProject), })); -jest.mock('./getRcGitHubInfo', () => ({ +jest.mock('./helpers/getRcGitHubInfo', () => ({ getRcGitHubInfo: () => mockNextGitHubInfo, })); -jest.mock('./sideEffects/useCreateRc', () => ({ - useCreateRc: () => ({ - run: jest.fn(), - responseSteps: [], - progress: 0, - }), +jest.mock('./hooks/useCreateRc', () => ({ + useCreateRc: () => + ({ + run: jest.fn(), + responseSteps: [], + progress: 0, + runLoading: false, + } as ReturnType), })); import { useProjectContext } from '../../contexts/ProjectContext'; diff --git a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx index 8ba80a9aee..f2ca2d7e5f 100644 --- a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx +++ b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx @@ -31,13 +31,13 @@ import { GetRepositoryResult, } from '../../api/PluginApiClient'; import { ComponentConfigCreateRc } from '../../types/types'; -import { Dialog } from '../../components/Dialog'; import { Differ } from '../../components/Differ'; -import { getRcGitHubInfo } from './getRcGitHubInfo'; +import { getRcGitHubInfo } from './helpers/getRcGitHubInfo'; import { InfoCardPlus } from '../../components/InfoCardPlus'; +import { ResponseStepDialog } from '../../components/ResponseStepDialog/ResponseStepDialog'; import { SEMVER_PARTS } from '../../constants/constants'; import { TEST_IDS } from '../../test-helpers/test-ids'; -import { useCreateRc } from './sideEffects/useCreateRc'; +import { useCreateRc } from './hooks/useCreateRc'; import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; import { useProjectContext } from '../../contexts/ProjectContext'; import { useStyles } from '../../styles/styles'; @@ -72,7 +72,7 @@ export const CreateRc = ({ ); }, [semverBumpLevel, setNextGitHubInfo, latestRelease, project]); - const { run, responseSteps, progress } = useCreateRc({ + const { progress, responseSteps, run, runInvoked } = useCreateRc({ defaultBranch, latestRelease, nextGitHubInfo, @@ -82,7 +82,7 @@ export const CreateRc = ({ }); if (responseSteps.length > 0) { return ( - { - await run(); - }} + onClick={() => run()} > - Create RC + Create Release Candidate ); } diff --git a/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.test.ts b/plugins/github-release-manager/src/cards/createRc/helpers/getRcGitHubInfo.test.ts similarity index 98% rename from plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.test.ts rename to plugins/github-release-manager/src/cards/createRc/helpers/getRcGitHubInfo.test.ts index 6b1feca055..1e41ea0d38 100644 --- a/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.test.ts +++ b/plugins/github-release-manager/src/cards/createRc/helpers/getRcGitHubInfo.test.ts @@ -17,11 +17,11 @@ import { DateTime } from 'luxon'; import { - mockSemverProject, mockCalverProject, mockReleaseVersionCalver, mockReleaseVersionSemver, -} from '../../test-helpers/test-helpers'; + mockSemverProject, +} from '../../../test-helpers/test-helpers'; import { getRcGitHubInfo } from './getRcGitHubInfo'; describe('getRcGitHubInfo', () => { diff --git a/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.ts b/plugins/github-release-manager/src/cards/createRc/helpers/getRcGitHubInfo.ts similarity index 82% rename from plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.ts rename to plugins/github-release-manager/src/cards/createRc/helpers/getRcGitHubInfo.ts index d7e63740c2..74407fb749 100644 --- a/plugins/github-release-manager/src/cards/createRc/getRcGitHubInfo.ts +++ b/plugins/github-release-manager/src/cards/createRc/helpers/getRcGitHubInfo.ts @@ -16,11 +16,11 @@ import { DateTime } from 'luxon'; -import { getBumpedSemverTagParts } from '../../helpers/getBumpedTag'; -import { GetLatestReleaseResult } from '../../api/PluginApiClient'; -import { getSemverTagParts } from '../../helpers/tagParts/getSemverTagParts'; -import { Project } from '../../contexts/ProjectContext'; -import { SEMVER_PARTS } from '../../constants/constants'; +import { getBumpedSemverTagParts } from '../../../helpers/getBumpedTag'; +import { GetLatestReleaseResult } from '../../../api/PluginApiClient'; +import { getSemverTagParts } from '../../../helpers/tagParts/getSemverTagParts'; +import { Project } from '../../../contexts/ProjectContext'; +import { SEMVER_PARTS } from '../../../constants/constants'; export const getRcGitHubInfo = ({ project, diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.test.tsx b/plugins/github-release-manager/src/cards/createRc/hooks/useCreateRc.test.tsx similarity index 99% rename from plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.test.tsx rename to plugins/github-release-manager/src/cards/createRc/hooks/useCreateRc.test.tsx index b0ce35a3ec..dd47ec086a 100644 --- a/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.test.tsx +++ b/plugins/github-release-manager/src/cards/createRc/hooks/useCreateRc.test.tsx @@ -94,6 +94,7 @@ describe('useCreateRc', () => { }, ], "run": [Function], + "runLoading": false, } `); }); diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.ts b/plugins/github-release-manager/src/cards/createRc/hooks/useCreateRc.ts similarity index 95% rename from plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.ts rename to plugins/github-release-manager/src/cards/createRc/hooks/useCreateRc.ts index eb11e25702..2cd18cb4ab 100644 --- a/plugins/github-release-manager/src/cards/createRc/sideEffects/useCreateRc.ts +++ b/plugins/github-release-manager/src/cards/createRc/hooks/useCreateRc.ts @@ -17,15 +17,15 @@ import { useEffect, useState } from 'react'; import { useAsync, useAsyncFn } from 'react-use'; -import { getRcGitHubInfo } from '../getRcGitHubInfo'; -import { ComponentConfigCreateRc } from '../../../types/types'; import { GetLatestReleaseResult, GetRepositoryResult, IPluginApiClient, } from '../../../api/PluginApiClient'; -import { Project } from '../../../contexts/ProjectContext'; +import { CardHook, ComponentConfigCreateRc } from '../../../types/types'; +import { getRcGitHubInfo } from '../helpers/getRcGitHubInfo'; import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; +import { Project } from '../../../contexts/ProjectContext'; import { useResponseSteps } from '../../../hooks/useResponseSteps'; interface CreateRC { @@ -44,7 +44,7 @@ export function useCreateRc({ pluginApiClient, project, successCb, -}: CreateRC) { +}: CreateRC): CardHook { const { responseSteps, addStepToResponseSteps, @@ -211,8 +211,11 @@ export function useCreateRc({ }, [TOTAL_STEPS, responseSteps.length]); return { - run, - responseSteps, progress, + responseSteps, + run, + runInvoked: Boolean( + latestCommitRes.loading || latestCommitRes.value || latestCommitRes.error, + ), }; } diff --git a/plugins/github-release-manager/src/components/LinearProgressWithLabel.tsx b/plugins/github-release-manager/src/components/LinearProgressWithLabel.tsx deleted file mode 100644 index 0ed8216a3d..0000000000 --- a/plugins/github-release-manager/src/components/LinearProgressWithLabel.tsx +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 React from 'react'; -import { - Box, - LinearProgress, - LinearProgressProps, - Typography, -} from '@material-ui/core'; - -export function LinearProgressWithLabel( - props: LinearProgressProps & { value: number }, -) { - return ( - - - - - - {`${Math.round( - props.value, - )}%`} - - - ); -} diff --git a/plugins/github-release-manager/src/components/ResponseStepDialog/LinearProgressWithLabel.tsx b/plugins/github-release-manager/src/components/ResponseStepDialog/LinearProgressWithLabel.tsx new file mode 100644 index 0000000000..a5091021e7 --- /dev/null +++ b/plugins/github-release-manager/src/components/ResponseStepDialog/LinearProgressWithLabel.tsx @@ -0,0 +1,79 @@ +/* + * 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 React from 'react'; +import { Box, LinearProgress, Typography } from '@material-ui/core'; + +import { ResponseStep } from '../../types/types'; + +const STATUSES = { + FAILURE: 'FAILURE', + ONGOING: 'ONGOING', + SUCCESS: 'SUCCESS', +} as const; + +export function LinearProgressWithLabel(props: { + progress: number; + responseSteps: ResponseStep[]; +}) { + const roundedValue = Math.ceil(props.progress); + const progress = roundedValue < 100 ? roundedValue : 100; + + const failure = props.responseSteps.some( + responseStep => responseStep.icon === 'failure', + ); + + let status: keyof typeof STATUSES = STATUSES.ONGOING; + if (!failure && progress === 100) status = STATUSES.SUCCESS; + if (failure) status = STATUSES.FAILURE; + + const CompletionEmoji = () => { + if (status === STATUSES.ONGOING) return null; + if (status === STATUSES.FAILURE) return {' 🔥 '}; + return {' 🚀 '}; + }; + + return ( + + + + + + + + + {`${progress}%`} + + + + + ); +} diff --git a/plugins/github-release-manager/src/components/Dialog.test.tsx b/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.test.tsx similarity index 83% rename from plugins/github-release-manager/src/components/Dialog.test.tsx rename to plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.test.tsx index cffd24a0bd..5f1c90c8cf 100644 --- a/plugins/github-release-manager/src/components/Dialog.test.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.test.tsx @@ -17,19 +17,19 @@ import React from 'react'; import { render } from '@testing-library/react'; -import { Dialog } from './Dialog'; +import { ResponseStepDialog } from './ResponseStepDialog'; -jest.mock('../contexts/RefetchContext', () => ({ +jest.mock('../../contexts/RefetchContext', () => ({ useRefetchContext: () => jest.fn(), })); -describe('Dialog', () => { - it('should render Dialog', () => { +describe('ResponseStepDialog', () => { + it('should render ResponseStepDialog', () => { const mockTitle = 'mock_dialog_title'; const mockResponseStepMessage = 'banana'; const { baseElement } = render( - { +const Transition = forwardRef(function Transition( + props: { children?: React.ReactElement } & TransitionProps, + ref: Ref, +) { + return ; +}); + +export const ResponseStepDialog = ({ + progress, + responseSteps, + title, +}: DialogProps) => { const { setRefetchTrigger } = useRefetchContext(); return ( - + {title} - + - + diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.test.tsx b/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepList.test.tsx similarity index 100% rename from plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.test.tsx rename to plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepList.test.tsx diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx b/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepList.tsx similarity index 100% rename from plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx rename to plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepList.tsx diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.test.tsx b/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepListItem.test.tsx similarity index 100% rename from plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.test.tsx rename to plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepListItem.test.tsx index c549ef4f11..f0f185073a 100644 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.test.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepListItem.test.tsx @@ -17,8 +17,8 @@ import React from 'react'; import { render } from '@testing-library/react'; -import { TEST_IDS } from '../../test-helpers/test-ids'; import { ResponseStepListItem } from './ResponseStepListItem'; +import { TEST_IDS } from '../../test-helpers/test-ids'; describe('ResponseStepListItem', () => { it('should render', () => { diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx b/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepListItem.tsx similarity index 100% rename from plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx rename to plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepListItem.tsx index 08ac005c8d..e1c80691ed 100644 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepListItem.tsx @@ -28,8 +28,8 @@ import ErrorOutlineIcon from '@material-ui/icons/ErrorOutline'; import FiberManualRecordIcon from '@material-ui/icons/FiberManualRecord'; import OpenInNewIcon from '@material-ui/icons/OpenInNew'; -import { TEST_IDS } from '../../test-helpers/test-ids'; import { ResponseStep } from '../../types/types'; +import { TEST_IDS } from '../../test-helpers/test-ids'; interface ResponseStepListItemProps { responseStep: ResponseStep; diff --git a/plugins/github-release-manager/src/sideEffects/getGitHubBatchInfo.ts b/plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.ts similarity index 55% rename from plugins/github-release-manager/src/sideEffects/getGitHubBatchInfo.ts rename to plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.ts index 0a95a7cb5c..5cf5115116 100644 --- a/plugins/github-release-manager/src/sideEffects/getGitHubBatchInfo.ts +++ b/plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.ts @@ -14,39 +14,49 @@ * limitations under the License. */ +import { useAsync } from 'react-use'; + import { IPluginApiClient } from '../api/PluginApiClient'; import { Project } from '../contexts/ProjectContext'; interface GetGitHubBatchInfo { project: Project; pluginApiClient: IPluginApiClient; + refetchTrigger: number; } -export const getGitHubBatchInfo = ({ +export const useGetGitHubBatchInfo = ({ project, pluginApiClient, -}: GetGitHubBatchInfo) => async () => { - const [repository, latestRelease] = await Promise.all([ - pluginApiClient.getRepository({ ...project }), - pluginApiClient.getLatestRelease({ ...project }), - ]); + refetchTrigger, +}: GetGitHubBatchInfo) => { + const gitHubBatchInfo = useAsync(async () => { + const [repository, latestRelease] = await Promise.all([ + pluginApiClient.getRepository({ ...project }), + pluginApiClient.getLatestRelease({ ...project }), + ]); + + if (latestRelease === null) { + return { + latestRelease, + releaseBranch: null, + repository, + }; + } + + const releaseBranch = await pluginApiClient.getBranch({ + ...project, + branchName: latestRelease.targetCommitish, + }); - if (latestRelease === null) { return { latestRelease, - releaseBranch: null, + releaseBranch, repository, }; - } - - const releaseBranch = await pluginApiClient.getBranch({ - ...project, - branchName: latestRelease.targetCommitish, - }); + }, [project, refetchTrigger]); return { - latestRelease, - releaseBranch, - repository, + gitHubBatchInfo, }; }; diff --git a/plugins/github-release-manager/src/hooks/useResponseSteps.ts b/plugins/github-release-manager/src/hooks/useResponseSteps.ts index dae2612df1..298d8dc11f 100644 --- a/plugins/github-release-manager/src/hooks/useResponseSteps.ts +++ b/plugins/github-release-manager/src/hooks/useResponseSteps.ts @@ -18,37 +18,37 @@ import { useState } from 'react'; import { ResponseStep } from '../types/types'; +const RESPONSE_STEP_FAILURE_ABORT: ResponseStep = { + message: 'Skipped due to error in previous step', + icon: 'failure', +}; + export function useResponseSteps() { const [responseSteps, setResponseSteps] = useState([]); - function abortIfError(error?: Error) { - const RESPONSE_STEP_SKIP = { - responseStep: { - message: 'Skipped due to error in previous step', - icon: 'failure', - } as ResponseStep, - }; + const addStepToResponseSteps = (responseStep: ResponseStep) => { + setResponseSteps([...responseSteps, responseStep]); + }; + const abortIfError = (error?: Error) => { if (error) { - setResponseSteps([...responseSteps, RESPONSE_STEP_SKIP.responseStep]); + addStepToResponseSteps(RESPONSE_STEP_FAILURE_ABORT); throw error; } - } + }; - function asyncCatcher(error: Error): never { + const asyncCatcher = (error?: Error): never => { const responseStepError: ResponseStep = { - message: 'Something went wrong ❌', - secondaryMessage: `Error message: ${error.message}`, + message: 'Something went wrong 🔥', + secondaryMessage: `Error message: ${ + error?.message ? error.message : 'unknown' + }`, icon: 'failure', }; - setResponseSteps([...responseSteps, responseStepError]); + addStepToResponseSteps(responseStepError); throw error; - } - - function addStepToResponseSteps(responseStep: ResponseStep) { - setResponseSteps([...responseSteps, responseStep]); - } + }; return { responseSteps, diff --git a/plugins/github-release-manager/src/test-helpers/test-helpers.ts b/plugins/github-release-manager/src/test-helpers/test-helpers.ts index 19e3c57184..f13e5c1c04 100644 --- a/plugins/github-release-manager/src/test-helpers/test-helpers.ts +++ b/plugins/github-release-manager/src/test-helpers/test-helpers.ts @@ -14,15 +14,15 @@ * limitations under the License. */ -import { CalverTagParts } from '../helpers/tagParts/getCalverTagParts'; -import { getRcGitHubInfo } from '../cards/createRc/getRcGitHubInfo'; -import { Project } from '../contexts/ProjectContext'; import { GetBranchResult, GetLatestReleaseResult, GetRecentCommitsResultSingle, IPluginApiClient, } from '../api/PluginApiClient'; +import { CalverTagParts } from '../helpers/tagParts/getCalverTagParts'; +import { getRcGitHubInfo } from '../cards/CreateRc/helpers/getRcGitHubInfo'; +import { Project } from '../contexts/ProjectContext'; const mockOwner = 'mock_owner'; const mockRepo = 'mock_repo'; diff --git a/plugins/github-release-manager/src/types/types.ts b/plugins/github-release-manager/src/types/types.ts index 8687150d7e..c888c7e539 100644 --- a/plugins/github-release-manager/src/types/types.ts +++ b/plugins/github-release-manager/src/types/types.ts @@ -54,3 +54,10 @@ export interface ResponseStep { link?: string; icon?: 'success' | 'failure'; } + +export interface CardHook { + progress: number; + responseSteps: ResponseStep[]; + run: (args: RunArgs) => Promise; + runInvoked: boolean; +} From 6d3fe015fe33b2a906048694021b19c2087ef5dd Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Tue, 20 Apr 2021 19:24:29 +0200 Subject: [PATCH 060/485] Fix tests & add tests for Cards Signed-off-by: Erik Engervall --- .../src/cards/Cards.test.tsx | 53 +++++++++++++++++++ .../src/cards/Patch/hooks/usePatch.test.ts | 1 + .../hooks/usePromoteRc.test.ts | 1 + .../src/cards/createRc/CreateRc.test.tsx | 2 +- .../cards/createRc/hooks/useCreateRc.test.tsx | 2 +- .../src/hooks/useGetGitHubBatchInfo.ts | 2 +- .../src/test-helpers/test-helpers.ts | 8 ++- 7 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 plugins/github-release-manager/src/cards/Cards.test.tsx diff --git a/plugins/github-release-manager/src/cards/Cards.test.tsx b/plugins/github-release-manager/src/cards/Cards.test.tsx new file mode 100644 index 0000000000..2a67a9f62c --- /dev/null +++ b/plugins/github-release-manager/src/cards/Cards.test.tsx @@ -0,0 +1,53 @@ +/* + * 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 React from 'react'; +import { render, act, waitFor } from '@testing-library/react'; + +import { mockApiClient, mockCalverProject } from '../test-helpers/test-helpers'; +import { TEST_IDS } from '../test-helpers/test-ids'; + +jest.mock('../contexts/PluginApiClientContext', () => ({ + usePluginApiClientContext: () => mockApiClient, +})); +jest.mock('../contexts/ProjectContext', () => ({ + useProjectContext: jest.fn(() => mockCalverProject), +})); + +import { Cards } from './Cards'; + +describe('Cards', () => { + it('should render info', async () => { + const { getByTestId } = render( + , + ); + + await act(async () => { + await waitFor(() => getByTestId(TEST_IDS.info.info)); + }); + + expect(getByTestId(TEST_IDS.info.info).innerHTML).toMatchInlineSnapshot( + `"
Terminology

GitHub: The source control system where releases reside in a practical sense. Read more about GitHub releases. (Note that this plugin works just as well with GitHub Enterprise.)

Release Candidate: A GitHub prerelease intended primarily for internal testing

Release Version: A GitHub release intended for end users

"`, + ); + }); +}); diff --git a/plugins/github-release-manager/src/cards/Patch/hooks/usePatch.test.ts b/plugins/github-release-manager/src/cards/Patch/hooks/usePatch.test.ts index ff280ed181..a7b6b2b58d 100644 --- a/plugins/github-release-manager/src/cards/Patch/hooks/usePatch.test.ts +++ b/plugins/github-release-manager/src/cards/Patch/hooks/usePatch.test.ts @@ -113,6 +113,7 @@ describe('patch', () => { }, ], "run": [Function], + "runInvoked": true, } `); }); diff --git a/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/hooks/usePromoteRc.test.ts b/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/hooks/usePromoteRc.test.ts index a055e4acd8..4803f2a551 100644 --- a/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/hooks/usePromoteRc.test.ts +++ b/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/hooks/usePromoteRc.test.ts @@ -76,6 +76,7 @@ describe('usePromoteRc', () => { }, ], "run": [Function], + "runInvoked": true, } `); }); diff --git a/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx b/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx index 4363d12c98..f4aaaa29ee 100644 --- a/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx +++ b/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx @@ -44,7 +44,7 @@ jest.mock('./hooks/useCreateRc', () => ({ run: jest.fn(), responseSteps: [], progress: 0, - runLoading: false, + runInvoked: false, } as ReturnType), })); diff --git a/plugins/github-release-manager/src/cards/createRc/hooks/useCreateRc.test.tsx b/plugins/github-release-manager/src/cards/createRc/hooks/useCreateRc.test.tsx index dd47ec086a..e4549b5cb8 100644 --- a/plugins/github-release-manager/src/cards/createRc/hooks/useCreateRc.test.tsx +++ b/plugins/github-release-manager/src/cards/createRc/hooks/useCreateRc.test.tsx @@ -94,7 +94,7 @@ describe('useCreateRc', () => { }, ], "run": [Function], - "runLoading": false, + "runInvoked": true, } `); }); diff --git a/plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.ts b/plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.ts index 5cf5115116..e09d165871 100644 --- a/plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.ts +++ b/plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.ts @@ -36,7 +36,7 @@ export const useGetGitHubBatchInfo = ({ pluginApiClient.getLatestRelease({ ...project }), ]); - if (latestRelease === null) { + if (!latestRelease) { return { latestRelease, releaseBranch: null, diff --git a/plugins/github-release-manager/src/test-helpers/test-helpers.ts b/plugins/github-release-manager/src/test-helpers/test-helpers.ts index f13e5c1c04..e138512971 100644 --- a/plugins/github-release-manager/src/test-helpers/test-helpers.ts +++ b/plugins/github-release-manager/src/test-helpers/test-helpers.ts @@ -158,9 +158,13 @@ export const mockApiClient: IPluginApiClient = { createMockRecentCommit({ sha: 'mock_sha_recent_commits_2' }), ]), - getLatestRelease: jest.fn(), + getLatestRelease: jest.fn(async () => createMockRelease()), - getRepository: jest.fn(), + getRepository: jest.fn(async () => ({ + pushPermissions: true, + defaultBranch: mockDefaultBranch, + name: mockRepo, + })), getLatestCommit: jest.fn(async () => ({ sha: 'latestCommit.sha', From 8cbf2a2b5d09296c10ab710c7f63676ea2369fa2 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Tue, 20 Apr 2021 21:56:01 +0200 Subject: [PATCH 061/485] Refactor helper Signed-off-by: Erik Engervall --- .../github-release-manager/src/api/PluginApiClient.ts | 2 +- .../src/cards/createRc/CreateRc.test.tsx | 2 +- .../src/cards/createRc/CreateRc.tsx | 2 +- .../src/cards/createRc/hooks/useCreateRc.ts | 2 +- .../createRc => }/helpers/getRcGitHubInfo.test.ts | 2 +- .../{cards/createRc => }/helpers/getRcGitHubInfo.ts | 10 +++++----- .../src/test-helpers/test-helpers.ts | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) rename plugins/github-release-manager/src/{cards/createRc => }/helpers/getRcGitHubInfo.test.ts (98%) rename plugins/github-release-manager/src/{cards/createRc => }/helpers/getRcGitHubInfo.ts (82%) diff --git a/plugins/github-release-manager/src/api/PluginApiClient.ts b/plugins/github-release-manager/src/api/PluginApiClient.ts index 276951b598..8efaacb4b8 100644 --- a/plugins/github-release-manager/src/api/PluginApiClient.ts +++ b/plugins/github-release-manager/src/api/PluginApiClient.ts @@ -20,7 +20,7 @@ import { readGitHubIntegrationConfigs } from '@backstage/integration'; import { CalverTagParts } from '../helpers/tagParts/getCalverTagParts'; import { DISABLE_CACHE } from '../constants/constants'; -import { getRcGitHubInfo } from '../cards/CreateRc/helpers/getRcGitHubInfo'; +import { getRcGitHubInfo } from '../helpers/getRcGitHubInfo'; import { Project } from '../contexts/ProjectContext'; import { SemverTagParts } from '../helpers/tagParts/getSemverTagParts'; diff --git a/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx b/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx index f4aaaa29ee..461f04a65d 100644 --- a/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx +++ b/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx @@ -35,7 +35,7 @@ jest.mock('../../contexts/PluginApiClientContext', () => ({ jest.mock('../../contexts/ProjectContext', () => ({ useProjectContext: jest.fn(() => mockCalverProject), })); -jest.mock('./helpers/getRcGitHubInfo', () => ({ +jest.mock('../../helpers/getRcGitHubInfo', () => ({ getRcGitHubInfo: () => mockNextGitHubInfo, })); jest.mock('./hooks/useCreateRc', () => ({ diff --git a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx index f2ca2d7e5f..63715d236d 100644 --- a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx +++ b/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx @@ -32,7 +32,7 @@ import { } from '../../api/PluginApiClient'; import { ComponentConfigCreateRc } from '../../types/types'; import { Differ } from '../../components/Differ'; -import { getRcGitHubInfo } from './helpers/getRcGitHubInfo'; +import { getRcGitHubInfo } from '../../helpers/getRcGitHubInfo'; import { InfoCardPlus } from '../../components/InfoCardPlus'; import { ResponseStepDialog } from '../../components/ResponseStepDialog/ResponseStepDialog'; import { SEMVER_PARTS } from '../../constants/constants'; diff --git a/plugins/github-release-manager/src/cards/createRc/hooks/useCreateRc.ts b/plugins/github-release-manager/src/cards/createRc/hooks/useCreateRc.ts index 2cd18cb4ab..b0b0c98dca 100644 --- a/plugins/github-release-manager/src/cards/createRc/hooks/useCreateRc.ts +++ b/plugins/github-release-manager/src/cards/createRc/hooks/useCreateRc.ts @@ -23,7 +23,7 @@ import { IPluginApiClient, } from '../../../api/PluginApiClient'; import { CardHook, ComponentConfigCreateRc } from '../../../types/types'; -import { getRcGitHubInfo } from '../helpers/getRcGitHubInfo'; +import { getRcGitHubInfo } from '../../../helpers/getRcGitHubInfo'; import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; import { Project } from '../../../contexts/ProjectContext'; import { useResponseSteps } from '../../../hooks/useResponseSteps'; diff --git a/plugins/github-release-manager/src/cards/createRc/helpers/getRcGitHubInfo.test.ts b/plugins/github-release-manager/src/helpers/getRcGitHubInfo.test.ts similarity index 98% rename from plugins/github-release-manager/src/cards/createRc/helpers/getRcGitHubInfo.test.ts rename to plugins/github-release-manager/src/helpers/getRcGitHubInfo.test.ts index 1e41ea0d38..51ad5fc122 100644 --- a/plugins/github-release-manager/src/cards/createRc/helpers/getRcGitHubInfo.test.ts +++ b/plugins/github-release-manager/src/helpers/getRcGitHubInfo.test.ts @@ -21,7 +21,7 @@ import { mockReleaseVersionCalver, mockReleaseVersionSemver, mockSemverProject, -} from '../../../test-helpers/test-helpers'; +} from '../test-helpers/test-helpers'; import { getRcGitHubInfo } from './getRcGitHubInfo'; describe('getRcGitHubInfo', () => { diff --git a/plugins/github-release-manager/src/cards/createRc/helpers/getRcGitHubInfo.ts b/plugins/github-release-manager/src/helpers/getRcGitHubInfo.ts similarity index 82% rename from plugins/github-release-manager/src/cards/createRc/helpers/getRcGitHubInfo.ts rename to plugins/github-release-manager/src/helpers/getRcGitHubInfo.ts index 74407fb749..18043033c9 100644 --- a/plugins/github-release-manager/src/cards/createRc/helpers/getRcGitHubInfo.ts +++ b/plugins/github-release-manager/src/helpers/getRcGitHubInfo.ts @@ -16,11 +16,11 @@ import { DateTime } from 'luxon'; -import { getBumpedSemverTagParts } from '../../../helpers/getBumpedTag'; -import { GetLatestReleaseResult } from '../../../api/PluginApiClient'; -import { getSemverTagParts } from '../../../helpers/tagParts/getSemverTagParts'; -import { Project } from '../../../contexts/ProjectContext'; -import { SEMVER_PARTS } from '../../../constants/constants'; +import { getBumpedSemverTagParts } from './getBumpedTag'; +import { GetLatestReleaseResult } from '../api/PluginApiClient'; +import { getSemverTagParts } from './tagParts/getSemverTagParts'; +import { Project } from '../contexts/ProjectContext'; +import { SEMVER_PARTS } from '../constants/constants'; export const getRcGitHubInfo = ({ project, diff --git a/plugins/github-release-manager/src/test-helpers/test-helpers.ts b/plugins/github-release-manager/src/test-helpers/test-helpers.ts index e138512971..3daa449376 100644 --- a/plugins/github-release-manager/src/test-helpers/test-helpers.ts +++ b/plugins/github-release-manager/src/test-helpers/test-helpers.ts @@ -21,8 +21,8 @@ import { IPluginApiClient, } from '../api/PluginApiClient'; import { CalverTagParts } from '../helpers/tagParts/getCalverTagParts'; -import { getRcGitHubInfo } from '../cards/CreateRc/helpers/getRcGitHubInfo'; import { Project } from '../contexts/ProjectContext'; +import { getRcGitHubInfo } from '../helpers/getRcGitHubInfo'; const mockOwner = 'mock_owner'; const mockRepo = 'mock_repo'; From 4c1fdb36ca1bc7638205797c93c8e141b8d6a783 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Tue, 20 Apr 2021 22:01:14 +0200 Subject: [PATCH 062/485] Intermediary commit Signed-off-by: Erik Engervall --- plugins/github-release-manager/src/cards/Cards.tsx | 4 ++-- .../cards/{createRc => _CreateRc}/CreateRc.test.tsx | 0 .../src/cards/{createRc => _CreateRc}/CreateRc.tsx | 0 .../hooks/useCreateRc.test.tsx | 0 .../{createRc => _CreateRc}/hooks/useCreateRc.ts | 0 .../src/cards/{info => _Info}/Info.test.tsx | 0 .../src/cards/{info => _Info}/Info.tsx | 0 .../src/cards/{info => _Info}/flow.png | Bin 8 files changed, 2 insertions(+), 2 deletions(-) rename plugins/github-release-manager/src/cards/{createRc => _CreateRc}/CreateRc.test.tsx (100%) rename plugins/github-release-manager/src/cards/{createRc => _CreateRc}/CreateRc.tsx (100%) rename plugins/github-release-manager/src/cards/{createRc => _CreateRc}/hooks/useCreateRc.test.tsx (100%) rename plugins/github-release-manager/src/cards/{createRc => _CreateRc}/hooks/useCreateRc.ts (100%) rename plugins/github-release-manager/src/cards/{info => _Info}/Info.test.tsx (100%) rename plugins/github-release-manager/src/cards/{info => _Info}/Info.tsx (100%) rename plugins/github-release-manager/src/cards/{info => _Info}/flow.png (100%) diff --git a/plugins/github-release-manager/src/cards/Cards.tsx b/plugins/github-release-manager/src/cards/Cards.tsx index 5fbb7fb1f7..ffe86e1b5b 100644 --- a/plugins/github-release-manager/src/cards/Cards.tsx +++ b/plugins/github-release-manager/src/cards/Cards.tsx @@ -19,9 +19,9 @@ import { ErrorBoundary } from '@backstage/core'; import { Alert } from '@material-ui/lab'; import { CenteredCircularProgress } from '../components/CenteredCircularProgress'; -import { CreateRc } from './CreateRc/CreateRc'; +import { CreateRc } from './_CreateRc/CreateRc'; import { GitHubReleaseManagerProps } from '../GitHubReleaseManager'; -import { Info } from './Info/Info'; +import { Info } from './_Info/Info'; import { Patch } from './Patch/Patch'; import { PromoteReleaseCandidate } from './PromoteReleaseCandidate/PromoteRc'; import { RefetchContext } from '../contexts/RefetchContext'; diff --git a/plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx b/plugins/github-release-manager/src/cards/_CreateRc/CreateRc.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/createRc/CreateRc.test.tsx rename to plugins/github-release-manager/src/cards/_CreateRc/CreateRc.test.tsx diff --git a/plugins/github-release-manager/src/cards/createRc/CreateRc.tsx b/plugins/github-release-manager/src/cards/_CreateRc/CreateRc.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/createRc/CreateRc.tsx rename to plugins/github-release-manager/src/cards/_CreateRc/CreateRc.tsx diff --git a/plugins/github-release-manager/src/cards/createRc/hooks/useCreateRc.test.tsx b/plugins/github-release-manager/src/cards/_CreateRc/hooks/useCreateRc.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/createRc/hooks/useCreateRc.test.tsx rename to plugins/github-release-manager/src/cards/_CreateRc/hooks/useCreateRc.test.tsx diff --git a/plugins/github-release-manager/src/cards/createRc/hooks/useCreateRc.ts b/plugins/github-release-manager/src/cards/_CreateRc/hooks/useCreateRc.ts similarity index 100% rename from plugins/github-release-manager/src/cards/createRc/hooks/useCreateRc.ts rename to plugins/github-release-manager/src/cards/_CreateRc/hooks/useCreateRc.ts diff --git a/plugins/github-release-manager/src/cards/info/Info.test.tsx b/plugins/github-release-manager/src/cards/_Info/Info.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/info/Info.test.tsx rename to plugins/github-release-manager/src/cards/_Info/Info.test.tsx diff --git a/plugins/github-release-manager/src/cards/info/Info.tsx b/plugins/github-release-manager/src/cards/_Info/Info.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/info/Info.tsx rename to plugins/github-release-manager/src/cards/_Info/Info.tsx diff --git a/plugins/github-release-manager/src/cards/info/flow.png b/plugins/github-release-manager/src/cards/_Info/flow.png similarity index 100% rename from plugins/github-release-manager/src/cards/info/flow.png rename to plugins/github-release-manager/src/cards/_Info/flow.png From c6efd515aec86fb989211966eb1fc439898fddaa Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Tue, 20 Apr 2021 22:01:48 +0200 Subject: [PATCH 063/485] Folder rename fix Signed-off-by: Erik Engervall --- plugins/github-release-manager/src/cards/Cards.tsx | 4 ++-- .../cards/{_CreateRc => CreateRc}/CreateRc.test.tsx | 0 .../src/cards/{_CreateRc => CreateRc}/CreateRc.tsx | 0 .../hooks/useCreateRc.test.tsx | 0 .../{_CreateRc => CreateRc}/hooks/useCreateRc.ts | 0 .../src/cards/{_Info => Info}/Info.test.tsx | 0 .../src/cards/{_Info => Info}/Info.tsx | 0 .../src/cards/{_Info => Info}/flow.png | Bin 8 files changed, 2 insertions(+), 2 deletions(-) rename plugins/github-release-manager/src/cards/{_CreateRc => CreateRc}/CreateRc.test.tsx (100%) rename plugins/github-release-manager/src/cards/{_CreateRc => CreateRc}/CreateRc.tsx (100%) rename plugins/github-release-manager/src/cards/{_CreateRc => CreateRc}/hooks/useCreateRc.test.tsx (100%) rename plugins/github-release-manager/src/cards/{_CreateRc => CreateRc}/hooks/useCreateRc.ts (100%) rename plugins/github-release-manager/src/cards/{_Info => Info}/Info.test.tsx (100%) rename plugins/github-release-manager/src/cards/{_Info => Info}/Info.tsx (100%) rename plugins/github-release-manager/src/cards/{_Info => Info}/flow.png (100%) diff --git a/plugins/github-release-manager/src/cards/Cards.tsx b/plugins/github-release-manager/src/cards/Cards.tsx index ffe86e1b5b..5fbb7fb1f7 100644 --- a/plugins/github-release-manager/src/cards/Cards.tsx +++ b/plugins/github-release-manager/src/cards/Cards.tsx @@ -19,9 +19,9 @@ import { ErrorBoundary } from '@backstage/core'; import { Alert } from '@material-ui/lab'; import { CenteredCircularProgress } from '../components/CenteredCircularProgress'; -import { CreateRc } from './_CreateRc/CreateRc'; +import { CreateRc } from './CreateRc/CreateRc'; import { GitHubReleaseManagerProps } from '../GitHubReleaseManager'; -import { Info } from './_Info/Info'; +import { Info } from './Info/Info'; import { Patch } from './Patch/Patch'; import { PromoteReleaseCandidate } from './PromoteReleaseCandidate/PromoteRc'; import { RefetchContext } from '../contexts/RefetchContext'; diff --git a/plugins/github-release-manager/src/cards/_CreateRc/CreateRc.test.tsx b/plugins/github-release-manager/src/cards/CreateRc/CreateRc.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/_CreateRc/CreateRc.test.tsx rename to plugins/github-release-manager/src/cards/CreateRc/CreateRc.test.tsx diff --git a/plugins/github-release-manager/src/cards/_CreateRc/CreateRc.tsx b/plugins/github-release-manager/src/cards/CreateRc/CreateRc.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/_CreateRc/CreateRc.tsx rename to plugins/github-release-manager/src/cards/CreateRc/CreateRc.tsx diff --git a/plugins/github-release-manager/src/cards/_CreateRc/hooks/useCreateRc.test.tsx b/plugins/github-release-manager/src/cards/CreateRc/hooks/useCreateRc.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/_CreateRc/hooks/useCreateRc.test.tsx rename to plugins/github-release-manager/src/cards/CreateRc/hooks/useCreateRc.test.tsx diff --git a/plugins/github-release-manager/src/cards/_CreateRc/hooks/useCreateRc.ts b/plugins/github-release-manager/src/cards/CreateRc/hooks/useCreateRc.ts similarity index 100% rename from plugins/github-release-manager/src/cards/_CreateRc/hooks/useCreateRc.ts rename to plugins/github-release-manager/src/cards/CreateRc/hooks/useCreateRc.ts diff --git a/plugins/github-release-manager/src/cards/_Info/Info.test.tsx b/plugins/github-release-manager/src/cards/Info/Info.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/_Info/Info.test.tsx rename to plugins/github-release-manager/src/cards/Info/Info.test.tsx diff --git a/plugins/github-release-manager/src/cards/_Info/Info.tsx b/plugins/github-release-manager/src/cards/Info/Info.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/_Info/Info.tsx rename to plugins/github-release-manager/src/cards/Info/Info.tsx diff --git a/plugins/github-release-manager/src/cards/_Info/flow.png b/plugins/github-release-manager/src/cards/Info/flow.png similarity index 100% rename from plugins/github-release-manager/src/cards/_Info/flow.png rename to plugins/github-release-manager/src/cards/Info/flow.png From 88c9eac54dcc0447e969ed1d412d7088aee923b6 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Tue, 20 Apr 2021 22:04:02 +0200 Subject: [PATCH 064/485] PromoteRc component rename Signed-off-by: Erik Engervall --- .../src/cards/Cards.test.tsx | 53 +++++++++++++++++-- .../src/cards/Cards.tsx | 4 +- .../PromoteRc.test.tsx | 10 ++-- .../PromoteRc.tsx | 7 +-- .../PromoteRcBody.test.tsx | 0 .../PromoteRcBody.tsx | 0 .../hooks/usePromoteRc.test.ts | 0 .../hooks/usePromoteRc.ts | 0 8 files changed, 58 insertions(+), 16 deletions(-) rename plugins/github-release-manager/src/cards/{PromoteReleaseCandidate => PromoteRc}/PromoteRc.test.tsx (83%) rename plugins/github-release-manager/src/cards/{PromoteReleaseCandidate => PromoteRc}/PromoteRc.tsx (93%) rename plugins/github-release-manager/src/cards/{PromoteReleaseCandidate => PromoteRc}/PromoteRcBody.test.tsx (100%) rename plugins/github-release-manager/src/cards/{PromoteReleaseCandidate => PromoteRc}/PromoteRcBody.tsx (100%) rename plugins/github-release-manager/src/cards/{PromoteReleaseCandidate => PromoteRc}/hooks/usePromoteRc.test.ts (100%) rename plugins/github-release-manager/src/cards/{PromoteReleaseCandidate => PromoteRc}/hooks/usePromoteRc.ts (100%) diff --git a/plugins/github-release-manager/src/cards/Cards.test.tsx b/plugins/github-release-manager/src/cards/Cards.test.tsx index 2a67a9f62c..dfb5491842 100644 --- a/plugins/github-release-manager/src/cards/Cards.test.tsx +++ b/plugins/github-release-manager/src/cards/Cards.test.tsx @@ -46,8 +46,55 @@ describe('Cards', () => { await waitFor(() => getByTestId(TEST_IDS.info.info)); }); - expect(getByTestId(TEST_IDS.info.info).innerHTML).toMatchInlineSnapshot( - `"
Terminology

GitHub: The source control system where releases reside in a practical sense. Read more about GitHub releases. (Note that this plugin works just as well with GitHub Enterprise.)

Release Candidate: A GitHub prerelease intended primarily for internal testing

Release Version: A GitHub release intended for end users

"`, - ); + expect(getByTestId(TEST_IDS.info.info)).toMatchInlineSnapshot(` +
+
+ Terminology +
+

+ + GitHub + + : The source control system where releases reside in a practical sense. Read more about + + + GitHub releases + + . (Note that this plugin works just as well with GitHub Enterprise.) +

+

+ + Release Candidate + + : A GitHub + + prerelease + + + intended primarily for internal testing +

+

+ + Release Version + + : A GitHub release intended for end users +

+
+ `); }); }); diff --git a/plugins/github-release-manager/src/cards/Cards.tsx b/plugins/github-release-manager/src/cards/Cards.tsx index 5fbb7fb1f7..3463ffa2e3 100644 --- a/plugins/github-release-manager/src/cards/Cards.tsx +++ b/plugins/github-release-manager/src/cards/Cards.tsx @@ -23,7 +23,7 @@ import { CreateRc } from './CreateRc/CreateRc'; import { GitHubReleaseManagerProps } from '../GitHubReleaseManager'; import { Info } from './Info/Info'; import { Patch } from './Patch/Patch'; -import { PromoteReleaseCandidate } from './PromoteReleaseCandidate/PromoteRc'; +import { PromoteRc } from './PromoteRc/PromoteRc'; import { RefetchContext } from '../contexts/RefetchContext'; import { useGetGitHubBatchInfo } from '../hooks/useGetGitHubBatchInfo'; import { usePluginApiClientContext } from '../contexts/PluginApiClientContext'; @@ -111,7 +111,7 @@ export function Cards({ )} {!components?.promoteRc?.omit && ( - diff --git a/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRc.test.tsx b/plugins/github-release-manager/src/cards/PromoteRc/PromoteRc.test.tsx similarity index 83% rename from plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRc.test.tsx rename to plugins/github-release-manager/src/cards/PromoteRc/PromoteRc.test.tsx index e917c295d6..f4e7c1fb41 100644 --- a/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRc.test.tsx +++ b/plugins/github-release-manager/src/cards/PromoteRc/PromoteRc.test.tsx @@ -29,13 +29,11 @@ jest.mock('./PromoteRcBody', () => ({ ), })); -import { PromoteReleaseCandidate } from './PromoteRc'; +import { PromoteRc } from './PromoteRc'; describe('PromoteRc', () => { it('return early if no latest release present', () => { - const { getByTestId } = render( - , - ); + const { getByTestId } = render(); expect( getByTestId(TEST_IDS.components.noLatestRelease), @@ -44,7 +42,7 @@ describe('PromoteRc', () => { it('should display not-rc warning', () => { const { getByTestId } = render( - , + , ); expect(getByTestId(TEST_IDS.promoteRc.notRcWarning)).toBeInTheDocument(); @@ -52,7 +50,7 @@ describe('PromoteRc', () => { it('should display PromoteRcBody', () => { const { getByTestId } = render( - , + , ); expect( diff --git a/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRc.tsx b/plugins/github-release-manager/src/cards/PromoteRc/PromoteRc.tsx similarity index 93% rename from plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRc.tsx rename to plugins/github-release-manager/src/cards/PromoteRc/PromoteRc.tsx index 56b506bcab..5d2783bcfd 100644 --- a/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRc.tsx +++ b/plugins/github-release-manager/src/cards/PromoteRc/PromoteRc.tsx @@ -26,15 +26,12 @@ import { PromoteRcBody } from './PromoteRcBody'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { useStyles } from '../../styles/styles'; -interface PromoteReleaseCandidateProps { +interface PromoteRcProps { latestRelease: GetLatestReleaseResult; successCb?: ComponentConfigPromoteRc['successCb']; } -export const PromoteReleaseCandidate = ({ - latestRelease, - successCb, -}: PromoteReleaseCandidateProps) => { +export const PromoteRc = ({ latestRelease, successCb }: PromoteRcProps) => { const classes = useStyles(); function Body() { diff --git a/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRcBody.test.tsx b/plugins/github-release-manager/src/cards/PromoteRc/PromoteRcBody.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRcBody.test.tsx rename to plugins/github-release-manager/src/cards/PromoteRc/PromoteRcBody.test.tsx diff --git a/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRcBody.tsx b/plugins/github-release-manager/src/cards/PromoteRc/PromoteRcBody.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/PromoteReleaseCandidate/PromoteRcBody.tsx rename to plugins/github-release-manager/src/cards/PromoteRc/PromoteRcBody.tsx diff --git a/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/hooks/usePromoteRc.test.ts b/plugins/github-release-manager/src/cards/PromoteRc/hooks/usePromoteRc.test.ts similarity index 100% rename from plugins/github-release-manager/src/cards/PromoteReleaseCandidate/hooks/usePromoteRc.test.ts rename to plugins/github-release-manager/src/cards/PromoteRc/hooks/usePromoteRc.test.ts diff --git a/plugins/github-release-manager/src/cards/PromoteReleaseCandidate/hooks/usePromoteRc.ts b/plugins/github-release-manager/src/cards/PromoteRc/hooks/usePromoteRc.ts similarity index 100% rename from plugins/github-release-manager/src/cards/PromoteReleaseCandidate/hooks/usePromoteRc.ts rename to plugins/github-release-manager/src/cards/PromoteRc/hooks/usePromoteRc.ts From fefc545508579d81cbe52b09aad1705d2a9ab218 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Tue, 20 Apr 2021 22:16:47 +0200 Subject: [PATCH 065/485] Create tests for useGetGitHubBatchInfo Signed-off-by: Erik Engervall --- .../src/hooks/useGetGitHubBatchInfo.test.ts | 102 ++++++++++++++++++ .../src/hooks/useGetGitHubBatchInfo.ts | 2 +- plugins/github-release-manager/src/plugin.ts | 5 +- 3 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.test.ts diff --git a/plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.test.ts b/plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.test.ts new file mode 100644 index 0000000000..54ecfa866a --- /dev/null +++ b/plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.test.ts @@ -0,0 +1,102 @@ +/* + * 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 { renderHook, act } from '@testing-library/react-hooks'; +import { waitFor } from '@testing-library/react'; + +import { mockApiClient, mockSemverProject } from '../test-helpers/test-helpers'; +import { useGetGitHubBatchInfo } from './useGetGitHubBatchInfo'; + +describe('useGetGitHubBatchInfo', () => { + it('should handle repositories with releases', async () => { + const { result } = renderHook(() => + useGetGitHubBatchInfo({ + pluginApiClient: mockApiClient, + project: mockSemverProject, + refetchTrigger: 1337, + }), + ); + + await act(async () => { + await waitFor(() => result.current.gitHubBatchInfo !== undefined); + }); + + expect(result.current.gitHubBatchInfo).toMatchInlineSnapshot(` + Object { + "loading": false, + "value": Object { + "latestRelease": Object { + "htmlUrl": "mock_release_html_url", + "id": 1, + "prerelease": false, + "tagName": "rc-2020.01.01_1", + "targetCommitish": "rc/1.2.3", + }, + "releaseBranch": Object { + "commit": Object { + "commit": Object { + "tree": Object { + "sha": "mock_branch_commit_commit_tree_sha", + }, + }, + "sha": "mock_branch_commit_sha", + }, + "links": Object { + "html": "mock_branch_links_html", + }, + "name": "rc/1.2.3", + }, + "repository": Object { + "defaultBranch": "mock_defaultBranch", + "name": "mock_repo", + "pushPermissions": true, + }, + }, + } + `); + }); + + it('should handle repositories without any releases', async () => { + (mockApiClient.getLatestRelease as jest.Mock).mockResolvedValueOnce(null); + + const { result } = renderHook(() => + useGetGitHubBatchInfo({ + pluginApiClient: mockApiClient, + project: mockSemverProject, + refetchTrigger: 1337, + }), + ); + + await act(async () => { + await waitFor(() => result.current.gitHubBatchInfo !== undefined); + }); + + expect(result.current.gitHubBatchInfo).toMatchInlineSnapshot(` + Object { + "loading": false, + "value": Object { + "latestRelease": null, + "releaseBranch": null, + "repository": Object { + "defaultBranch": "mock_defaultBranch", + "name": "mock_repo", + "pushPermissions": true, + }, + }, + } + `); + }); +}); diff --git a/plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.ts b/plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.ts index e09d165871..5cf5115116 100644 --- a/plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.ts +++ b/plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.ts @@ -36,7 +36,7 @@ export const useGetGitHubBatchInfo = ({ pluginApiClient.getLatestRelease({ ...project }), ]); - if (!latestRelease) { + if (latestRelease === null) { return { latestRelease, releaseBranch: null, diff --git a/plugins/github-release-manager/src/plugin.ts b/plugins/github-release-manager/src/plugin.ts index c0c6f4fda9..9c01c1e959 100644 --- a/plugins/github-release-manager/src/plugin.ts +++ b/plugins/github-release-manager/src/plugin.ts @@ -41,7 +41,10 @@ export const gitHubReleaseManagerPlugin = createPlugin({ githubAuthApi: githubAuthApiRef, }, factory: ({ configApi, githubAuthApi }) => { - return new PluginApiClient({ configApi, githubAuthApi }); + return new PluginApiClient({ + configApi, + githubAuthApi, + }); }, }), ], From 8e0d7cd52ea28ff93e231a49e7efd921dc9ad832 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Tue, 20 Apr 2021 22:36:13 +0200 Subject: [PATCH 066/485] Add tests for useResponseSteps Signed-off-by: Erik Engervall --- .../src/hooks/useResponseSteps.test.ts | 143 ++++++++++++++++++ .../src/hooks/useResponseSteps.ts | 16 +- 2 files changed, 151 insertions(+), 8 deletions(-) create mode 100644 plugins/github-release-manager/src/hooks/useResponseSteps.test.ts diff --git a/plugins/github-release-manager/src/hooks/useResponseSteps.test.ts b/plugins/github-release-manager/src/hooks/useResponseSteps.test.ts new file mode 100644 index 0000000000..4460487f06 --- /dev/null +++ b/plugins/github-release-manager/src/hooks/useResponseSteps.test.ts @@ -0,0 +1,143 @@ +/* + * 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 { renderHook, act } from '@testing-library/react-hooks'; + +import { useResponseSteps } from './useResponseSteps'; + +describe('useResponseSteps', () => { + it('should export expected variables', () => { + const { result } = renderHook(() => useResponseSteps()); + + expect(result.current).toMatchInlineSnapshot(` + Object { + "abortIfError": [Function], + "addStepToResponseSteps": [Function], + "asyncCatcher": [Function], + "responseSteps": Array [], + } + `); + }); + + describe('addStepToResponseSteps', () => { + it('should add responseSteps to state', async () => { + const { result } = renderHook(() => useResponseSteps()); + + expect(result.current.responseSteps).toMatchInlineSnapshot(`Array []`); + + act(() => { + result.current.addStepToResponseSteps({ + message: 'totally added a messaage ✌🏼', + }); + }); + + expect(result.current.responseSteps).toMatchInlineSnapshot(` + Array [ + Object { + "message": "totally added a messaage ✌🏼", + }, + ] + `); + }); + }); + + describe('asyncCatcher', () => { + it('should catch Errors and add as failure step, then throw', async () => { + const { result } = renderHook(() => useResponseSteps()); + + expect(result.current.responseSteps).toMatchInlineSnapshot(`Array []`); + + await act(async () => { + await new Promise((_, reject) => reject(new Error(':('))) + .catch(result.current.asyncCatcher) + .catch( + () => void 0, // swallow + ); + }); + + expect(result.current.responseSteps).toMatchInlineSnapshot(` + Array [ + Object { + "icon": "failure", + "message": "Something went wrong 🔥", + "secondaryMessage": "Error message: :(", + }, + ] + `); + }); + + it('should catch unknown Errors and add as failure step, then throw', async () => { + const { result } = renderHook(() => useResponseSteps()); + + expect(result.current.responseSteps).toMatchInlineSnapshot(`Array []`); + + await act(async () => { + await new Promise((_, reject) => reject()) + .catch(result.current.asyncCatcher) + .catch( + () => void 0, // swallow + ); + }); + + expect(result.current.responseSteps).toMatchInlineSnapshot(` + Array [ + Object { + "icon": "failure", + "message": "Something went wrong 🔥", + "secondaryMessage": "Error message: unknown", + }, + ] + `); + }); + }); + + describe('abortIfError', () => { + it('should throw if Error and add a failure step', async () => { + const { result } = renderHook(() => useResponseSteps()); + + expect(result.current.responseSteps).toMatchInlineSnapshot(`Array []`); + + act(() => { + try { + result.current.abortIfError(new Error('Das kaboom')); + } catch (error) { + // + } + }); + + expect(result.current.responseSteps).toMatchInlineSnapshot(` + Array [ + Object { + "icon": "failure", + "message": "Skipped due to error in previous step", + }, + ] + `); + }); + + it('should do nothing if not Error', async () => { + const { result } = renderHook(() => useResponseSteps()); + + expect(result.current.responseSteps).toMatchInlineSnapshot(`Array []`); + + act(() => { + result.current.abortIfError(undefined); + }); + + expect(result.current.responseSteps).toMatchInlineSnapshot(`Array []`); + }); + }); +}); diff --git a/plugins/github-release-manager/src/hooks/useResponseSteps.ts b/plugins/github-release-manager/src/hooks/useResponseSteps.ts index 298d8dc11f..e20587d078 100644 --- a/plugins/github-release-manager/src/hooks/useResponseSteps.ts +++ b/plugins/github-release-manager/src/hooks/useResponseSteps.ts @@ -30,14 +30,7 @@ export function useResponseSteps() { setResponseSteps([...responseSteps, responseStep]); }; - const abortIfError = (error?: Error) => { - if (error) { - addStepToResponseSteps(RESPONSE_STEP_FAILURE_ABORT); - throw error; - } - }; - - const asyncCatcher = (error?: Error): never => { + const asyncCatcher = (error: Error): never => { const responseStepError: ResponseStep = { message: 'Something went wrong 🔥', secondaryMessage: `Error message: ${ @@ -50,6 +43,13 @@ export function useResponseSteps() { throw error; }; + const abortIfError = (error?: Error) => { + if (error) { + addStepToResponseSteps(RESPONSE_STEP_FAILURE_ABORT); + throw error; + } + }; + return { responseSteps, addStepToResponseSteps, From 421563440800c08204af333cea107fe6a70aa20f Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Wed, 21 Apr 2021 09:17:34 +0200 Subject: [PATCH 067/485] Dependencies Signed-off-by: Marcus Eide --- plugins/shortcuts/package.json | 2 +- yarn.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/shortcuts/package.json b/plugins/shortcuts/package.json index 32fb41ab78..99e824e835 100644 --- a/plugins/shortcuts/package.json +++ b/plugins/shortcuts/package.json @@ -24,7 +24,6 @@ "@backstage/theme": "^0.2.5", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", - "@material-ui/lab": "4.0.0-alpha.45", "react": "^16.13.1", "react-dom": "^16.13.1", "react-hook-form": "^7.1.1", @@ -42,6 +41,7 @@ "@testing-library/user-event": "^12.0.7", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", + "@types/zen-observable": "^0.8.2", "cross-fetch": "^3.0.6", "msw": "^0.21.2" }, diff --git a/yarn.lock b/yarn.lock index f56a6931ea..3c563eee9e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6937,7 +6937,7 @@ resolved "https://registry.npmjs.org/@types/yup/-/yup-0.29.8.tgz#83db15735987db9fe5a38772a0fb9500e3c5bf39" integrity sha512-MBSp62AjB1KrSOI3gX9GekddXU5YYQAVA93+aSl78biBqoSzxg876aQY2KJK5Gnfbpqq7O2cadVX5kPAtBqIXw== -"@types/zen-observable@^0.8.0": +"@types/zen-observable@^0.8.0", "@types/zen-observable@^0.8.2": version "0.8.2" resolved "https://registry.npmjs.org/@types/zen-observable/-/zen-observable-0.8.2.tgz#808c9fa7e4517274ed555fa158f2de4b4f468e71" integrity sha512-HrCIVMLjE1MOozVoD86622S7aunluLb2PJdPfb3nYiEtohm8mIB/vyv0Fd37AdeMFrTUQXEunw78YloMA3Qilg== From e05f09698c2210d763d98860d5267c8b51d4e648 Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Wed, 21 Apr 2021 10:00:15 +0200 Subject: [PATCH 068/485] Update alert messages Signed-off-by: Marcus Eide --- plugins/shortcuts/src/AddShortcut.test.tsx | 4 ++-- plugins/shortcuts/src/AddShortcut.tsx | 4 ++-- plugins/shortcuts/src/EditShortcut.tsx | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/shortcuts/src/AddShortcut.test.tsx b/plugins/shortcuts/src/AddShortcut.test.tsx index 690bb2c59e..cee5d8cf28 100644 --- a/plugins/shortcuts/src/AddShortcut.test.tsx +++ b/plugins/shortcuts/src/AddShortcut.test.tsx @@ -80,7 +80,7 @@ describe('AddShortcut', () => { }), ); - fireEvent.click(screen.getByText('Paste Current Url')); + fireEvent.click(screen.getByText('Use current page')); fireEvent.click(screen.getByText('Save')); await waitFor(() => { expect(spy).toBeCalledWith({ @@ -102,7 +102,7 @@ describe('AddShortcut', () => { ), ); - fireEvent.click(screen.getByText('Paste Current Url')); + fireEvent.click(screen.getByText('Use current page')); fireEvent.click(screen.getByText('Save')); await waitFor(() => { expect( diff --git a/plugins/shortcuts/src/AddShortcut.tsx b/plugins/shortcuts/src/AddShortcut.tsx index ab845c63a8..74a0653b4c 100644 --- a/plugins/shortcuts/src/AddShortcut.tsx +++ b/plugins/shortcuts/src/AddShortcut.tsx @@ -60,7 +60,7 @@ export const AddShortcut = ({ onClose, anchorEl, api }: Props) => { try { await api.add(shortcut); alertApi.post({ - message: 'Successfully added shortcut', + message: `Added shortcut '${title}' to your sidebar`, severity: 'success', }); } catch (error) { @@ -106,7 +106,7 @@ export const AddShortcut = ({ onClose, anchorEl, api }: Props) => { color="primary" onClick={handlePaste} > - Paste Current Url + Use current page } /> diff --git a/plugins/shortcuts/src/EditShortcut.tsx b/plugins/shortcuts/src/EditShortcut.tsx index 9220c9a73e..8b98406703 100644 --- a/plugins/shortcuts/src/EditShortcut.tsx +++ b/plugins/shortcuts/src/EditShortcut.tsx @@ -63,7 +63,7 @@ export const EditShortcut = ({ shortcut, onClose, anchorEl, api }: Props) => { try { await api.update(newShortcut); alertApi.post({ - message: 'Successfully updated shortcut', + message: `Updated shortcut '${title}'`, severity: 'success', }); } catch (error) { @@ -80,7 +80,7 @@ export const EditShortcut = ({ shortcut, onClose, anchorEl, api }: Props) => { try { await api.remove(shortcut); alertApi.post({ - message: 'Successfully deleted shortcut', + message: `Removed shortcut '${shortcut.title}' from your sidebar`, severity: 'success', }); } catch (error) { From 325d8da1645a7579b4ae3dad74e4bad651e5c3f0 Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Wed, 21 Apr 2021 10:21:33 +0200 Subject: [PATCH 069/485] Rename observe() to shortcut Signed-off-by: Marcus Eide --- plugins/shortcuts/src/Shortcuts.tsx | 2 +- plugins/shortcuts/src/api/LocalStoredShortcuts.test.ts | 2 +- plugins/shortcuts/src/api/LocalStoredShortcuts.ts | 2 +- plugins/shortcuts/src/api/ShortcutApi.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/shortcuts/src/Shortcuts.tsx b/plugins/shortcuts/src/Shortcuts.tsx index 4d65861bd9..0e8804cd39 100644 --- a/plugins/shortcuts/src/Shortcuts.tsx +++ b/plugins/shortcuts/src/Shortcuts.tsx @@ -25,7 +25,7 @@ import { shortcutsApiRef } from './api'; export const Shortcuts = () => { const shortcutApi = useApi(shortcutsApiRef); const shortcuts = useObservable( - useMemo(() => shortcutApi.observe(), [shortcutApi]), + useMemo(() => shortcutApi.shortcut$(), [shortcutApi]), ); const [anchorEl, setAnchorEl] = React.useState(); const loading = Boolean(!shortcuts); diff --git a/plugins/shortcuts/src/api/LocalStoredShortcuts.test.ts b/plugins/shortcuts/src/api/LocalStoredShortcuts.test.ts index 6fd45d73e5..94f63f846a 100644 --- a/plugins/shortcuts/src/api/LocalStoredShortcuts.test.ts +++ b/plugins/shortcuts/src/api/LocalStoredShortcuts.test.ts @@ -29,7 +29,7 @@ describe('LocalStoredShortcuts', () => { const shortcut: Shortcut = { id: 'id', title: 'title', url: '/url' }; await shortcutApi.add(shortcut); - shortcutApi.observe().subscribe(data => { + shortcutApi.shortcut$().subscribe(data => { expect(data).toEqual( expect.arrayContaining([{ ...shortcut, id: expect.anything() }]), ); diff --git a/plugins/shortcuts/src/api/LocalStoredShortcuts.ts b/plugins/shortcuts/src/api/LocalStoredShortcuts.ts index 2f84c0cf76..c606fb5f9a 100644 --- a/plugins/shortcuts/src/api/LocalStoredShortcuts.ts +++ b/plugins/shortcuts/src/api/LocalStoredShortcuts.ts @@ -27,7 +27,7 @@ import { Shortcut } from '../types'; export class LocalStoredShortcuts implements ShortcutApi { constructor(private readonly storageApi: StorageApi) {} - observe() { + shortcut$() { return this.observable; } diff --git a/plugins/shortcuts/src/api/ShortcutApi.ts b/plugins/shortcuts/src/api/ShortcutApi.ts index b2b1f772e5..bd6eb0f196 100644 --- a/plugins/shortcuts/src/api/ShortcutApi.ts +++ b/plugins/shortcuts/src/api/ShortcutApi.ts @@ -27,7 +27,7 @@ export interface ShortcutApi { /** * Returns an Observable that will subscribe to changes. */ - observe(): Observable; + shortcut$(): Observable; /** * Generates a unique id for the shortcut and then saves it. From 59b42ece0f37e6ff412d8ff5118111758879895a Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Wed, 21 Apr 2021 11:08:43 +0200 Subject: [PATCH 070/485] Revert accidental app-config.yaml push Signed-off-by: Erik Engervall --- app-config.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app-config.yaml b/app-config.yaml index 2af191c56a..ac59874878 100644 --- a/app-config.yaml +++ b/app-config.yaml @@ -125,12 +125,12 @@ integrations: - host: github.com token: ${GITHUB_TOKEN} ### Example for how to add your GitHub Enterprise instance using the API: - - host: ghe.spotify.net - apiBaseUrl: https://ghe.spotify.net/api/v3 - token: ${GHE_TOKEN} + # - host: ghe.example.net + # apiBaseUrl: https://ghe.example.net/api/v3 + # token: ${GHE_TOKEN} ### Example for how to add your GitHub Enterprise instance using raw HTTP fetches (token is optional): - # - host: ghe.spotify.net - # rawBaseUrl: https://ghe.spotify.net/raw + # - host: ghe.example.net + # rawBaseUrl: https://ghe.example.net/raw # token: ${GHE_TOKEN} gitlab: - host: gitlab.com @@ -165,8 +165,8 @@ catalog: - target: https://github.com token: ${GITHUB_TOKEN} #### Example for how to add your GitHub Enterprise instance using the API: - # - target: https://ghe.spotify.net - # apiBaseUrl: https://ghe.spotify.net/api + # - target: https://ghe.example.net + # apiBaseUrl: https://ghe.example.net/api # token: ${GHE_TOKEN} ldapOrg: ### Example for how to add your enterprise LDAP server From 55dce861535d58dba8670f64ec8559f0346a7a1c Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Wed, 21 Apr 2021 13:54:41 +0200 Subject: [PATCH 071/485] Keep wordboundary when getting the icon text Signed-off-by: Marcus Eide --- plugins/shortcuts/src/ShortcutItem.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/shortcuts/src/ShortcutItem.tsx b/plugins/shortcuts/src/ShortcutItem.tsx index a52194828c..3aec4bb3b4 100644 --- a/plugins/shortcuts/src/ShortcutItem.tsx +++ b/plugins/shortcuts/src/ShortcutItem.tsx @@ -36,7 +36,7 @@ const getIconText = (title: string) => title[0].toUpperCase() + title[1].toLowerCase() : // If there's more than one word, take the first character of the first two words title - .replace(/\W+/g, ' ') + .replace(/\B\W/g, '') .split(' ') .map(s => s[0]) .join('') From 303d548d745ce57076585905e67aabae419145e9 Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Wed, 21 Apr 2021 13:57:49 +0200 Subject: [PATCH 072/485] Use all available vertical space in the sidebar and overflow with scroll if needed Signed-off-by: Marcus Eide --- plugins/shortcuts/src/Shortcuts.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/shortcuts/src/Shortcuts.tsx b/plugins/shortcuts/src/Shortcuts.tsx index 0e8804cd39..2c49245e76 100644 --- a/plugins/shortcuts/src/Shortcuts.tsx +++ b/plugins/shortcuts/src/Shortcuts.tsx @@ -17,12 +17,21 @@ import React, { useMemo } from 'react'; import { useObservable } from 'react-use'; import { Progress, SidebarItem, useApi } from '@backstage/core'; +import { makeStyles } from '@material-ui/core'; import PlayListAddIcon from '@material-ui/icons/PlaylistAdd'; import { ShortcutItem } from './ShortcutItem'; import { AddShortcut } from './AddShortcut'; import { shortcutsApiRef } from './api'; +const useStyles = makeStyles({ + root: { + flex: '1 1 auto', + overflow: 'scroll', + }, +}); + export const Shortcuts = () => { + const classes = useStyles(); const shortcutApi = useApi(shortcutsApiRef); const shortcuts = useObservable( useMemo(() => shortcutApi.shortcut$(), [shortcutApi]), @@ -39,7 +48,7 @@ export const Shortcuts = () => { }; return ( - <> +
{ /> )) )} - +
); }; From aac78e0a7bbc0b0a8a83be7c322bf2bc77790d63 Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Wed, 21 Apr 2021 14:37:40 +0200 Subject: [PATCH 073/485] Sort on title Signed-off-by: Marcus Eide --- plugins/shortcuts/src/api/LocalStoredShortcuts.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/shortcuts/src/api/LocalStoredShortcuts.ts b/plugins/shortcuts/src/api/LocalStoredShortcuts.ts index c606fb5f9a..377f8e9190 100644 --- a/plugins/shortcuts/src/api/LocalStoredShortcuts.ts +++ b/plugins/shortcuts/src/api/LocalStoredShortcuts.ts @@ -84,7 +84,7 @@ export class LocalStoredShortcuts implements ShortcutApi { private get() { return ( (this.storageApi.get('items') as Shortcut[])?.sort((a, b) => - a.id >= b.id ? 1 : -1, + a.title >= b.title ? 1 : -1, ) ?? [] ); } From a097131d0d739355dee5883a5ead2ab7daea57d5 Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Wed, 21 Apr 2021 15:28:08 +0200 Subject: [PATCH 074/485] Use Observable from @backstage/core Signed-off-by: Marcus Eide --- plugins/shortcuts/package.json | 1 - plugins/shortcuts/src/api/ShortcutApi.ts | 3 +-- yarn.lock | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/shortcuts/package.json b/plugins/shortcuts/package.json index 99e824e835..5795dcd922 100644 --- a/plugins/shortcuts/package.json +++ b/plugins/shortcuts/package.json @@ -41,7 +41,6 @@ "@testing-library/user-event": "^12.0.7", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", - "@types/zen-observable": "^0.8.2", "cross-fetch": "^3.0.6", "msw": "^0.21.2" }, diff --git a/plugins/shortcuts/src/api/ShortcutApi.ts b/plugins/shortcuts/src/api/ShortcutApi.ts index bd6eb0f196..826988d01f 100644 --- a/plugins/shortcuts/src/api/ShortcutApi.ts +++ b/plugins/shortcuts/src/api/ShortcutApi.ts @@ -14,8 +14,7 @@ * limitations under the License. */ -import Observable from 'zen-observable'; -import { createApiRef } from '@backstage/core'; +import { createApiRef, Observable } from '@backstage/core'; import { Shortcut } from '../types'; export const shortcutsApiRef = createApiRef({ diff --git a/yarn.lock b/yarn.lock index 3c563eee9e..f56a6931ea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6937,7 +6937,7 @@ resolved "https://registry.npmjs.org/@types/yup/-/yup-0.29.8.tgz#83db15735987db9fe5a38772a0fb9500e3c5bf39" integrity sha512-MBSp62AjB1KrSOI3gX9GekddXU5YYQAVA93+aSl78biBqoSzxg876aQY2KJK5Gnfbpqq7O2cadVX5kPAtBqIXw== -"@types/zen-observable@^0.8.0", "@types/zen-observable@^0.8.2": +"@types/zen-observable@^0.8.0": version "0.8.2" resolved "https://registry.npmjs.org/@types/zen-observable/-/zen-observable-0.8.2.tgz#808c9fa7e4517274ed555fa158f2de4b4f468e71" integrity sha512-HrCIVMLjE1MOozVoD86622S7aunluLb2PJdPfb3nYiEtohm8mIB/vyv0Fd37AdeMFrTUQXEunw78YloMA3Qilg== From 947e45cefd04b06d7dead488f651925a19014a8e Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Wed, 21 Apr 2021 16:04:51 +0200 Subject: [PATCH 075/485] Add back @types/zen-observable Signed-off-by: Marcus Eide --- plugins/shortcuts/package.json | 1 + yarn.lock | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/shortcuts/package.json b/plugins/shortcuts/package.json index 5795dcd922..bcac92fcb0 100644 --- a/plugins/shortcuts/package.json +++ b/plugins/shortcuts/package.json @@ -24,6 +24,7 @@ "@backstage/theme": "^0.2.5", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", + "@types/zen-observable": "^0.8.2", "react": "^16.13.1", "react-dom": "^16.13.1", "react-hook-form": "^7.1.1", diff --git a/yarn.lock b/yarn.lock index f56a6931ea..3c563eee9e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6937,7 +6937,7 @@ resolved "https://registry.npmjs.org/@types/yup/-/yup-0.29.8.tgz#83db15735987db9fe5a38772a0fb9500e3c5bf39" integrity sha512-MBSp62AjB1KrSOI3gX9GekddXU5YYQAVA93+aSl78biBqoSzxg876aQY2KJK5Gnfbpqq7O2cadVX5kPAtBqIXw== -"@types/zen-observable@^0.8.0": +"@types/zen-observable@^0.8.0", "@types/zen-observable@^0.8.2": version "0.8.2" resolved "https://registry.npmjs.org/@types/zen-observable/-/zen-observable-0.8.2.tgz#808c9fa7e4517274ed555fa158f2de4b4f468e71" integrity sha512-HrCIVMLjE1MOozVoD86622S7aunluLb2PJdPfb3nYiEtohm8mIB/vyv0Fd37AdeMFrTUQXEunw78YloMA3Qilg== From 881e22c2cd2a73f02eb8611c1c2596e7cf82f4f3 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Wed, 21 Apr 2021 17:33:49 +0200 Subject: [PATCH 076/485] Add tests for test-ids & createResponseStepError Signed-off-by: Erik Engervall --- .../helpers/createResponseStepError.test.ts | 31 +++++++ .../src/test-helpers/test-helpers.test.ts | 2 +- .../src/test-helpers/test-ids.test.ts | 88 +++++++++++++++++++ 3 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 plugins/github-release-manager/src/helpers/createResponseStepError.test.ts create mode 100644 plugins/github-release-manager/src/test-helpers/test-ids.test.ts diff --git a/plugins/github-release-manager/src/helpers/createResponseStepError.test.ts b/plugins/github-release-manager/src/helpers/createResponseStepError.test.ts new file mode 100644 index 0000000000..b6069f2fd6 --- /dev/null +++ b/plugins/github-release-manager/src/helpers/createResponseStepError.test.ts @@ -0,0 +1,31 @@ +/* + * 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 { createResponseStepError } from './createResponseStepError'; + +describe('createResponseStepError', () => { + it('should work', () => { + const result = createResponseStepError(new Error('banana')); + + expect(result).toMatchInlineSnapshot(` + Object { + "icon": "failure", + "message": "Something went wrong ❌", + "secondaryMessage": "Error message: banana", + } + `); + }); +}); diff --git a/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts b/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts index fb2735182e..e6765a05ed 100644 --- a/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts +++ b/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts @@ -17,7 +17,7 @@ import * as testHelpers from './test-helpers'; describe('testHelpers', () => { - it('should match snapshot', () => { + it('should export the correct things', () => { expect(testHelpers).toMatchInlineSnapshot(` Object { "mockApiClient": Object { diff --git a/plugins/github-release-manager/src/test-helpers/test-ids.test.ts b/plugins/github-release-manager/src/test-helpers/test-ids.test.ts new file mode 100644 index 0000000000..2c1195b52e --- /dev/null +++ b/plugins/github-release-manager/src/test-helpers/test-ids.test.ts @@ -0,0 +1,88 @@ +/* + * 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 * as testIds from './test-ids'; + +describe('test-ids', () => { + it('should export the correct things', () => { + expect(testIds).toMatchInlineSnapshot(` + Object { + "TEST_IDS": Object { + "components": Object { + "circularProgress": "grm--circular-progress", + "differ": Object { + "current": "grm--differ-current", + "icons": Object { + "branch": "grm--differ--icons--branch", + "github": "grm--differ--icons--github", + "slack": "grm--differ--icons--slack", + "tag": "grm--differ--icons--tag", + "versioning": "grm--differ--icons--versioning", + }, + "next": "grm--differ-next", + }, + "divider": "grm--divider", + "noLatestRelease": "grm--no-latest-release", + "noReleaseBranch": "grm--no-release-branch", + "responseStepListDialogContent": "grm--response-step-list--dialog-content", + "responseStepListItem": "grm--response-step-list-item", + "responseStepListItemIconDefault": "grm--response-step-list-item--item-icon--default", + "responseStepListItemIconFailure": "grm--response-step-list-item--item-icon--failure", + "responseStepListItemIconLink": "grm--response-step-list-item--item-icon--link", + "responseStepListItemIconSuccess": "grm--response-step-list-item--item-icon--success", + }, + "createRc": Object { + "cta": "grm--create-rc--cta", + "semverSelect": "grm--create-rc--semver-select", + }, + "form": Object { + "owner": Object { + "empty": "grm--form--owner--empty", + "error": "grm--form--owner--error", + "loading": "grm--form--owner--loading", + "select": "grm--form--owner--select", + }, + "repo": Object { + "empty": "grm--form--repo--empty", + "error": "grm--form--repo--error", + "loading": "grm--form--repo--loading", + "select": "grm--form--repo--select", + }, + "versioningStrategy": Object { + "radioGroup": "grm--form--versioning-strategy--radio-group", + }, + }, + "info": Object { + "info": "grm--info", + "infoCardPlus": "grm--info-card-plus", + }, + "patch": Object { + "body": "grm--patch-body", + "error": "grm--patch-body--error", + "loading": "grm--patch-body--loading", + "notPrerelease": "grm--patch-body--not-prerelease--info", + }, + "promoteRc": Object { + "cta": "grm--promote-rc-body--cta", + "mockedPromoteRcBody": "grm-mocked-promote-rc-body", + "notRcWarning": "grm--promote-rc--not-rc-warning", + "promoteRc": "grm--promote-rc", + }, + }, + } + `); + }); +}); From 99cabc5865e7396322b2c8507c2d58590a09ac4a Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Wed, 21 Apr 2021 17:54:13 +0200 Subject: [PATCH 077/485] Improve test coverage Signed-off-by: Erik Engervall --- .../src/cards/CreateRc/CreateRc.test.tsx | 4 +- .../cards/CreateRc/hooks/useCreateRc.test.tsx | 10 +-- .../src/cards/Patch/hooks/usePatch.test.ts | 4 +- .../tagParts/getCalverTagParts.test.ts | 71 +++++++++++++++++++ .../tagParts/getSemverTagParts.test.ts | 63 ++++++++++++++++ .../src/hooks/useGetGitHubBatchInfo.test.ts | 2 +- .../src/test-helpers/test-helpers.test.ts | 16 ++++- .../src/test-helpers/test-helpers.ts | 62 ++++++++++++---- 8 files changed, 205 insertions(+), 27 deletions(-) create mode 100644 plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.test.ts create mode 100644 plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.test.ts diff --git a/plugins/github-release-manager/src/cards/CreateRc/CreateRc.test.tsx b/plugins/github-release-manager/src/cards/CreateRc/CreateRc.test.tsx index 461f04a65d..084754ce06 100644 --- a/plugins/github-release-manager/src/cards/CreateRc/CreateRc.test.tsx +++ b/plugins/github-release-manager/src/cards/CreateRc/CreateRc.test.tsx @@ -20,7 +20,7 @@ import { render } from '@testing-library/react'; import { mockApiClient, mockCalverProject, - mockNextGitHubInfo, + mockNextGitHubInfoSemver, mockReleaseBranch, mockReleaseCandidateCalver, mockReleaseVersionCalver, @@ -36,7 +36,7 @@ jest.mock('../../contexts/ProjectContext', () => ({ useProjectContext: jest.fn(() => mockCalverProject), })); jest.mock('../../helpers/getRcGitHubInfo', () => ({ - getRcGitHubInfo: () => mockNextGitHubInfo, + getRcGitHubInfo: () => mockNextGitHubInfoSemver, })); jest.mock('./hooks/useCreateRc', () => ({ useCreateRc: () => diff --git a/plugins/github-release-manager/src/cards/CreateRc/hooks/useCreateRc.test.tsx b/plugins/github-release-manager/src/cards/CreateRc/hooks/useCreateRc.test.tsx index e4549b5cb8..8da92a4f0e 100644 --- a/plugins/github-release-manager/src/cards/CreateRc/hooks/useCreateRc.test.tsx +++ b/plugins/github-release-manager/src/cards/CreateRc/hooks/useCreateRc.test.tsx @@ -21,7 +21,7 @@ import { mockApiClient, mockCalverProject, mockDefaultBranch, - mockNextGitHubInfo, + mockNextGitHubInfoCalver, mockReleaseVersionCalver, } from '../../../test-helpers/test-helpers'; import { useCreateRc } from './useCreateRc'; @@ -34,7 +34,7 @@ describe('useCreateRc', () => { useCreateRc({ defaultBranch: mockDefaultBranch, latestRelease: mockReleaseVersionCalver, - nextGitHubInfo: mockNextGitHubInfo, + nextGitHubInfo: mockNextGitHubInfoCalver, pluginApiClient: mockApiClient, project: mockCalverProject, }), @@ -53,7 +53,7 @@ describe('useCreateRc', () => { useCreateRc({ defaultBranch: mockDefaultBranch, latestRelease: mockReleaseVersionCalver, - nextGitHubInfo: mockNextGitHubInfo, + nextGitHubInfo: mockNextGitHubInfoCalver, pluginApiClient: mockApiClient, project: mockCalverProject, successCb: jest.fn(), @@ -81,12 +81,12 @@ describe('useCreateRc', () => { Object { "link": "mock_compareCommits_html_url", "message": "Fetched commit comparison", - "secondaryMessage": "rc/1.2.3...rc/1.2.3", + "secondaryMessage": "rc/2020.01.01_1...rc/2020.01.01_1", }, Object { "link": "mock_createRelease_html_url", "message": "Created Release Candidate \\"mock_createRelease_name\\"", - "secondaryMessage": "with tag \\"rc-1.2.3\\"", + "secondaryMessage": "with tag \\"rc-2020.01.01_1\\"", }, Object { "icon": "success", diff --git a/plugins/github-release-manager/src/cards/Patch/hooks/usePatch.test.ts b/plugins/github-release-manager/src/cards/Patch/hooks/usePatch.test.ts index a7b6b2b58d..240d39292c 100644 --- a/plugins/github-release-manager/src/cards/Patch/hooks/usePatch.test.ts +++ b/plugins/github-release-manager/src/cards/Patch/hooks/usePatch.test.ts @@ -80,11 +80,11 @@ describe('patch', () => { "secondaryMessage": "with message \\"mock_commit_message\\"", }, Object { - "message": "Forced branch \\"rc/1.2.3\\" to temporary commit \\"mock_commit_sha\\"", + "message": "Forced branch \\"rc/2020.01.01_1\\" to temporary commit \\"mock_commit_sha\\"", }, Object { "link": "mock_merge_html_url", - "message": "Merged temporary commit into \\"rc/1.2.3\\"", + "message": "Merged temporary commit into \\"rc/2020.01.01_1\\"", "secondaryMessage": "with message \\"mock_merge_commit_message\\"", }, Object { diff --git a/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.test.ts b/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.test.ts new file mode 100644 index 0000000000..238abe720a --- /dev/null +++ b/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.test.ts @@ -0,0 +1,71 @@ +/* + * 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 { + mockReleaseVersionCalver, + mockReleaseCandidateCalver, +} from '../../test-helpers/test-helpers'; +import { getCalverTagParts } from './getCalverTagParts'; + +describe('getCalverTagParts', () => { + it('should return tagParts for RC tag', () => { + const result = getCalverTagParts(mockReleaseCandidateCalver.tagName); + + expect(result).toMatchInlineSnapshot(` + Object { + "calver": "2020.01.01", + "patch": 1, + "prefix": "rc", + } + `); + }); + + it('should return tagParts for Version tag', () => { + const result = getCalverTagParts(mockReleaseVersionCalver.tagName); + + expect(result).toMatchInlineSnapshot(` + Object { + "calver": "2020.01.01", + "patch": 1, + "prefix": "version", + } + `); + }); + + it('should return null for invalid prefix', () => { + expect(() => + getCalverTagParts('invalid-2020.01.01_1'), + ).toThrowErrorMatchingInlineSnapshot(`"Invalid calver tag"`); + }); + + it('should return null for invalid calver (missing padded zero)', () => { + expect(() => + getCalverTagParts('rc-2020.1.01_1'), + ).toThrowErrorMatchingInlineSnapshot(`"Invalid calver tag"`); + }); + + it('should return null for invalid calver (missing day)', () => { + expect(() => + getCalverTagParts('rc-2020.01_1'), + ).toThrowErrorMatchingInlineSnapshot(`"Invalid calver tag"`); + }); + + it('should return null for invalid patch (letter instead of number)', () => { + expect(() => + getCalverTagParts('rc-2020.01.01_a'), + ).toThrowErrorMatchingInlineSnapshot(`"Invalid calver tag"`); + }); +}); diff --git a/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.test.ts b/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.test.ts new file mode 100644 index 0000000000..9977ab7add --- /dev/null +++ b/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.test.ts @@ -0,0 +1,63 @@ +/* + * 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 { + mockReleaseCandidateSemver, + mockReleaseVersionSemver, +} from '../../test-helpers/test-helpers'; +import { getSemverTagParts } from './getSemverTagParts'; + +describe('getSemverTagParts', () => { + it('should return tagParts for RC tag', () => + expect(getSemverTagParts(mockReleaseCandidateSemver.tagName)) + .toMatchInlineSnapshot(` + Object { + "major": 1, + "minor": 2, + "patch": 3, + "prefix": "rc", + } + `)); + + it('should return tagParts for Version tag', () => + expect(getSemverTagParts(mockReleaseVersionSemver.tagName)) + .toMatchInlineSnapshot(` + Object { + "major": 1, + "minor": 2, + "patch": 3, + "prefix": "version", + } + `)); + + it('should throw for invalid prefix', () => { + expect(() => + getSemverTagParts('invalid-1.2.3'), + ).toThrowErrorMatchingInlineSnapshot(`"Invalid semver tag"`); + }); + + it('should throw for invalid semver (missing patch)', () => { + expect(() => + getSemverTagParts('rc-1.2'), + ).toThrowErrorMatchingInlineSnapshot(`"Invalid semver tag"`); + }); + + it('should throw for invalid semver (founds calver)', () => { + expect(() => + getSemverTagParts('rc-1337.01.01_1'), + ).toThrowErrorMatchingInlineSnapshot(`"Invalid semver tag, found calver"`); + }); +}); diff --git a/plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.test.ts b/plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.test.ts index 54ecfa866a..7d45fd111a 100644 --- a/plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.test.ts +++ b/plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.test.ts @@ -43,7 +43,7 @@ describe('useGetGitHubBatchInfo', () => { "id": 1, "prerelease": false, "tagName": "rc-2020.01.01_1", - "targetCommitish": "rc/1.2.3", + "targetCommitish": "rc/2020.01.01_1", }, "releaseBranch": Object { "commit": Object { diff --git a/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts b/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts index e6765a05ed..8dfa3e6fd5 100644 --- a/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts +++ b/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts @@ -58,7 +58,12 @@ describe('testHelpers', () => { "versioningStrategy": "calver", }, "mockDefaultBranch": "mock_defaultBranch", - "mockNextGitHubInfo": Object { + "mockNextGitHubInfoCalver": Object { + "rcBranch": "rc/2020.01.01_1", + "rcReleaseTag": "rc-2020.01.01_1", + "releaseName": "Version 2020.01.01_1", + }, + "mockNextGitHubInfoSemver": Object { "rcBranch": "rc/1.2.3", "rcReleaseTag": "rc-1.2.3", "releaseName": "Version 1.2.3", @@ -82,6 +87,13 @@ describe('testHelpers', () => { "id": 1, "prerelease": true, "tagName": "rc-2020.01.01_1", + "targetCommitish": "rc/2020.01.01_1", + }, + "mockReleaseCandidateSemver": Object { + "htmlUrl": "mock_release_html_url", + "id": 1, + "prerelease": true, + "tagName": "rc-1.2.3", "targetCommitish": "rc/1.2.3", }, "mockReleaseVersionCalver": Object { @@ -89,7 +101,7 @@ describe('testHelpers', () => { "id": 1, "prerelease": false, "tagName": "version-2020.01.01_1", - "targetCommitish": "rc/1.2.3", + "targetCommitish": "rc/2020.01.01_1", }, "mockReleaseVersionSemver": Object { "htmlUrl": "mock_release_html_url", diff --git a/plugins/github-release-manager/src/test-helpers/test-helpers.ts b/plugins/github-release-manager/src/test-helpers/test-helpers.ts index 3daa449376..735bcd7d48 100644 --- a/plugins/github-release-manager/src/test-helpers/test-helpers.ts +++ b/plugins/github-release-manager/src/test-helpers/test-helpers.ts @@ -27,6 +27,18 @@ import { getRcGitHubInfo } from '../helpers/getRcGitHubInfo'; const mockOwner = 'mock_owner'; const mockRepo = 'mock_repo'; +const A_CALVER_VERSION = '2020.01.01_1'; +const MOCK_RELEASE_NAME_CALVER = `Version ${A_CALVER_VERSION}`; +const MOCK_RELEASE_BRANCH_NAME_CALVER = `rc/${A_CALVER_VERSION}`; +const MOCK_RELEASE_CANDIDATE_TAG_NAME_CALVER = `rc-${A_CALVER_VERSION}`; +const MOCK_RELEASE_VERSION_TAG_NAME_CALVER = `version-${A_CALVER_VERSION}`; + +const A_SEMVER_VERSION = '1.2.3'; +const MOCK_RELEASE_NAME_SEMVER = `Version ${A_SEMVER_VERSION}`; +const MOCK_RELEASE_BRANCH_NAME_SEMVER = `rc/${A_SEMVER_VERSION}`; +const MOCK_RELEASE_CANDIDATE_TAG_NAME_SEMVER = `rc-${A_SEMVER_VERSION}`; +const MOCK_RELEASE_VERSION_TAG_NAME_SEMVER = `version-${A_SEMVER_VERSION}`; + export const mockSemverProject: Project = { owner: mockOwner, repo: mockRepo, @@ -47,10 +59,16 @@ export const mockSearchSemver = `?versioningStrategy=${mockSemverProject.version export const mockDefaultBranch = 'mock_defaultBranch'; -export const mockNextGitHubInfo: ReturnType = { - rcBranch: 'rc/1.2.3', - rcReleaseTag: 'rc-1.2.3', - releaseName: 'Version 1.2.3', +export const mockNextGitHubInfoSemver: ReturnType = { + rcBranch: MOCK_RELEASE_BRANCH_NAME_SEMVER, + rcReleaseTag: MOCK_RELEASE_CANDIDATE_TAG_NAME_SEMVER, + releaseName: MOCK_RELEASE_NAME_SEMVER, +}; + +export const mockNextGitHubInfoCalver: ReturnType = { + rcBranch: MOCK_RELEASE_BRANCH_NAME_CALVER, + rcReleaseTag: MOCK_RELEASE_CANDIDATE_TAG_NAME_CALVER, + releaseName: MOCK_RELEASE_NAME_CALVER, }; export const mockTagParts = { @@ -74,24 +92,32 @@ const createMockRelease = ({ id: 1, htmlUrl: 'mock_release_html_url', prerelease, - tagName: 'rc-2020.01.01_1', - targetCommitish: 'rc/1.2.3', + tagName: MOCK_RELEASE_CANDIDATE_TAG_NAME_CALVER, + targetCommitish: MOCK_RELEASE_BRANCH_NAME_CALVER, ...rest, }); + export const mockReleaseCandidateCalver = createMockRelease({ prerelease: true, - tagName: 'rc-2020.01.01_1', - targetCommitish: 'rc/1.2.3', + tagName: MOCK_RELEASE_CANDIDATE_TAG_NAME_CALVER, + targetCommitish: MOCK_RELEASE_BRANCH_NAME_CALVER, }); + export const mockReleaseVersionCalver = createMockRelease({ prerelease: false, - tagName: 'version-2020.01.01_1', - targetCommitish: 'rc/1.2.3', + tagName: MOCK_RELEASE_VERSION_TAG_NAME_CALVER, + targetCommitish: MOCK_RELEASE_BRANCH_NAME_CALVER, +}); + +export const mockReleaseCandidateSemver = createMockRelease({ + prerelease: true, + tagName: MOCK_RELEASE_CANDIDATE_TAG_NAME_SEMVER, + targetCommitish: MOCK_RELEASE_BRANCH_NAME_SEMVER, }); export const mockReleaseVersionSemver = createMockRelease({ prerelease: false, - tagName: 'version-1.2.3', - targetCommitish: 'rc/1.2.3', + tagName: MOCK_RELEASE_VERSION_TAG_NAME_SEMVER, + targetCommitish: MOCK_RELEASE_BRANCH_NAME_SEMVER, }); /** @@ -100,12 +126,18 @@ export const mockReleaseVersionSemver = createMockRelease({ const createMockBranch = ({ ...rest }: Partial = {}): GetBranchResult => ({ - name: 'rc/1.2.3', + name: MOCK_RELEASE_BRANCH_NAME_SEMVER, commit: { sha: 'mock_branch_commit_sha', - commit: { tree: { sha: 'mock_branch_commit_commit_tree_sha' } }, + commit: { + tree: { + sha: 'mock_branch_commit_commit_tree_sha', + }, + }, + }, + links: { + html: 'mock_branch_links_html', }, - links: { html: 'mock_branch_links_html' }, ...rest, }); export const mockReleaseBranch = createMockBranch(); From 278dcdd92bf8c3c022e45d8ed589563fb21d5597 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Wed, 21 Apr 2021 18:00:15 +0200 Subject: [PATCH 078/485] Simplify getTagParts.test.ts now that there's module specific tests in place Signed-off-by: Erik Engervall --- .../src/helpers/tagParts/getTagParts.test.ts | 106 +++--------------- 1 file changed, 18 insertions(+), 88 deletions(-) diff --git a/plugins/github-release-manager/src/helpers/tagParts/getTagParts.test.ts b/plugins/github-release-manager/src/helpers/tagParts/getTagParts.test.ts index 91a753dbe3..fc1ab1479b 100644 --- a/plugins/github-release-manager/src/helpers/tagParts/getTagParts.test.ts +++ b/plugins/github-release-manager/src/helpers/tagParts/getTagParts.test.ts @@ -18,104 +18,34 @@ import { mockCalverProject, mockSemverProject, } from '../../test-helpers/test-helpers'; + +jest.mock('./getCalverTagParts', () => ({ + getCalverTagParts: jest.fn(), +})); +jest.mock('./getSemverTagParts', () => ({ + getSemverTagParts: jest.fn(), +})); + +import { getCalverTagParts } from './getCalverTagParts'; +import { getSemverTagParts } from './getSemverTagParts'; import { getTagParts } from './getTagParts'; describe('getTagParts', () => { + beforeEach(jest.resetAllMocks); + describe('calver', () => { - it('should return tagParts for RC tag', () => - expect( - getTagParts({ project: mockCalverProject, tag: 'rc-2020.01.01_1' }), - ).toMatchInlineSnapshot(` - Object { - "calver": "2020.01.01", - "patch": 1, - "prefix": "rc", - } - `)); + it('should call getCalverTagParts for calver projects', () => { + getTagParts({ project: mockCalverProject, tag: 'banana' }); - it('should return tagParts for Version tag', () => - expect( - getTagParts({ - project: mockCalverProject, - tag: 'version-2020.01.01_1', - }), - ).toMatchInlineSnapshot(` - Object { - "calver": "2020.01.01", - "patch": 1, - "prefix": "version", - } - `)); - - it('should return null for invalid prefix', () => { - expect(() => - getTagParts({ - project: mockCalverProject, - tag: 'invalid-2020.01.01_1', - }), - ).toThrowErrorMatchingInlineSnapshot(`"Invalid calver tag"`); - }); - - it('should return null for invalid calver (missing padded zero)', () => { - expect(() => - getTagParts({ project: mockCalverProject, tag: 'rc-2020.1.01_1' }), - ).toThrowErrorMatchingInlineSnapshot(`"Invalid calver tag"`); - }); - - it('should return null for invalid calver (missing day)', () => { - expect(() => - getTagParts({ project: mockCalverProject, tag: 'rc-2020.01_1' }), - ).toThrowErrorMatchingInlineSnapshot(`"Invalid calver tag"`); - }); - - it('should return null for invalid patch (letter instead of number)', () => { - expect(() => - getTagParts({ project: mockCalverProject, tag: 'rc-2020.01.01_a' }), - ).toThrowErrorMatchingInlineSnapshot(`"Invalid calver tag"`); + expect(getCalverTagParts).toHaveBeenCalledTimes(1); }); }); describe('semver', () => { - it('should return tagParts for RC tag', () => - expect(getTagParts({ project: mockSemverProject, tag: 'rc-1.2.3' })) - .toMatchInlineSnapshot(` - Object { - "major": 1, - "minor": 2, - "patch": 3, - "prefix": "rc", - } - `)); + it('should call getSemverTagParts for calver projects', () => { + getTagParts({ project: mockSemverProject, tag: 'banana' }); - it('should return tagParts for Version tag', () => - expect(getTagParts({ project: mockSemverProject, tag: 'version-1.2.3' })) - .toMatchInlineSnapshot(` - Object { - "major": 1, - "minor": 2, - "patch": 3, - "prefix": "version", - } - `)); - - it('should throw for invalid prefix', () => { - expect(() => - getTagParts({ project: mockSemverProject, tag: 'invalid-1.2.3' }), - ).toThrowErrorMatchingInlineSnapshot(`"Invalid semver tag"`); - }); - - it('should throw for invalid semver (missing patch)', () => { - expect(() => - getTagParts({ project: mockSemverProject, tag: 'rc-1.2' }), - ).toThrowErrorMatchingInlineSnapshot(`"Invalid semver tag"`); - }); - - it('should throw for invalid semver (founds calver)', () => { - expect(() => - getTagParts({ project: mockSemverProject, tag: 'rc-1337.01.01_1' }), - ).toThrowErrorMatchingInlineSnapshot( - `"Invalid semver tag, found calver"`, - ); + expect(getSemverTagParts).toHaveBeenCalledTimes(1); }); }); }); From 06c408cffd10dbccfe0b18e721f12d3442abf64e Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Wed, 21 Apr 2021 18:11:11 +0200 Subject: [PATCH 079/485] Remove unused component NoReleaseBranch & improve tests for NoLatestRelease Signed-off-by: Erik Engervall --- .../src/cards/Cards.tsx | 8 ++++- .../src/components/NoLatestRelease.test.tsx | 35 ++++++++++++++++--- .../src/components/NoReleaseBranch.test.tsx | 31 ---------------- .../src/components/NoReleaseBranch.tsx | 35 ------------------- .../src/test-helpers/test-ids.test.ts | 1 - .../src/test-helpers/test-ids.ts | 1 - 6 files changed, 37 insertions(+), 74 deletions(-) delete mode 100644 plugins/github-release-manager/src/components/NoReleaseBranch.test.tsx delete mode 100644 plugins/github-release-manager/src/components/NoReleaseBranch.tsx diff --git a/plugins/github-release-manager/src/cards/Cards.tsx b/plugins/github-release-manager/src/cards/Cards.tsx index 3463ffa2e3..22d7a8e884 100644 --- a/plugins/github-release-manager/src/cards/Cards.tsx +++ b/plugins/github-release-manager/src/cards/Cards.tsx @@ -90,7 +90,13 @@ export function Cards({ {!gitHubBatchInfo.value.latestRelease && ( - This repository has not releases yet + This repository doesn't have any releases yet + + )} + + {!gitHubBatchInfo.value.releaseBranch && ( + + This repository doesn't have any release branches )} diff --git a/plugins/github-release-manager/src/components/NoLatestRelease.test.tsx b/plugins/github-release-manager/src/components/NoLatestRelease.test.tsx index 779412ec25..1c2ea3ffa3 100644 --- a/plugins/github-release-manager/src/components/NoLatestRelease.test.tsx +++ b/plugins/github-release-manager/src/components/NoLatestRelease.test.tsx @@ -17,15 +17,40 @@ import React from 'react'; import { render } from '@testing-library/react'; -import { TEST_IDS } from '../test-helpers/test-ids'; import { NoLatestRelease } from './NoLatestRelease'; describe('NoLatestRelease', () => { it('render NoLatestRelease', () => { - const { getByTestId } = render(); + const { container } = render(); - expect( - getByTestId(TEST_IDS.components.noLatestRelease), - ).toBeInTheDocument(); + expect(container).toMatchInlineSnapshot(` +
+ +
+ `); }); }); diff --git a/plugins/github-release-manager/src/components/NoReleaseBranch.test.tsx b/plugins/github-release-manager/src/components/NoReleaseBranch.test.tsx deleted file mode 100644 index 6e31be3caa..0000000000 --- a/plugins/github-release-manager/src/components/NoReleaseBranch.test.tsx +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 React from 'react'; -import { render } from '@testing-library/react'; - -import { TEST_IDS } from '../test-helpers/test-ids'; -import { NoReleaseBranch } from './NoReleaseBranch'; - -describe('NoReleaseBranch', () => { - it('render NoReleaseBranch', () => { - const { getByTestId } = render(); - - expect( - getByTestId(TEST_IDS.components.noReleaseBranch), - ).toBeInTheDocument(); - }); -}); diff --git a/plugins/github-release-manager/src/components/NoReleaseBranch.tsx b/plugins/github-release-manager/src/components/NoReleaseBranch.tsx deleted file mode 100644 index 66c7f61ec0..0000000000 --- a/plugins/github-release-manager/src/components/NoReleaseBranch.tsx +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 React from 'react'; -import { Alert } from '@material-ui/lab'; - -import { useStyles } from '../styles/styles'; -import { TEST_IDS } from '../test-helpers/test-ids'; - -export const NoReleaseBranch = () => { - const classes = useStyles(); - - return ( - - Unable to find any Release Branch - - ); -}; diff --git a/plugins/github-release-manager/src/test-helpers/test-ids.test.ts b/plugins/github-release-manager/src/test-helpers/test-ids.test.ts index 2c1195b52e..091f2ccb90 100644 --- a/plugins/github-release-manager/src/test-helpers/test-ids.test.ts +++ b/plugins/github-release-manager/src/test-helpers/test-ids.test.ts @@ -36,7 +36,6 @@ describe('test-ids', () => { }, "divider": "grm--divider", "noLatestRelease": "grm--no-latest-release", - "noReleaseBranch": "grm--no-release-branch", "responseStepListDialogContent": "grm--response-step-list--dialog-content", "responseStepListItem": "grm--response-step-list-item", "responseStepListItemIconDefault": "grm--response-step-list-item--item-icon--default", diff --git a/plugins/github-release-manager/src/test-helpers/test-ids.ts b/plugins/github-release-manager/src/test-helpers/test-ids.ts index 52a426c9b8..e7d3240a8b 100644 --- a/plugins/github-release-manager/src/test-helpers/test-ids.ts +++ b/plugins/github-release-manager/src/test-helpers/test-ids.ts @@ -55,7 +55,6 @@ export const TEST_IDS = { components: { divider: 'grm--divider', noLatestRelease: 'grm--no-latest-release', - noReleaseBranch: 'grm--no-release-branch', circularProgress: 'grm--circular-progress', responseStepListDialogContent: 'grm--response-step-list--dialog-content', responseStepListItem: 'grm--response-step-list-item', From aa81eaf7e1d7718de1ca6bd57c14dfef65c63df9 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Wed, 21 Apr 2021 18:19:30 +0200 Subject: [PATCH 080/485] Fix VersioningStrategy bug Signed-off-by: Erik Engervall --- .../src/cards/RepoDetailsForm/VersioningStrategy.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.tsx b/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.tsx index b1d4c594cf..b03b22fd3f 100644 --- a/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.tsx +++ b/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.tsx @@ -27,6 +27,7 @@ import { import { TEST_IDS } from '../../test-helpers/test-ids'; import { useProjectContext } from '../../contexts/ProjectContext'; import { useQueryHandler } from '../../hooks/useQueryHandler'; +import { VERSIONING_STRATEGIES } from '../../constants/constants'; export function VersioningStrategy() { const navigate = useNavigate(); @@ -59,9 +60,9 @@ export function VersioningStrategy() { aria-label="calendar-strategy" name="calendar-strategy" value={project.versioningStrategy} - defaultValue="semver" + defaultValue={VERSIONING_STRATEGIES.semver} onChange={event => { - const queryParams = getQueryParamsWithUpdates({ + const { queryParams } = getQueryParamsWithUpdates({ updates: [{ key: 'versioningStrategy', value: event.target.value }], }); @@ -69,12 +70,12 @@ export function VersioningStrategy() { }} > } label="Semantic versioning" /> } label="Calendar versioning" /> From fe0faf6b7a0bb325994b9c2be8a76323595544b7 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Wed, 21 Apr 2021 18:20:01 +0200 Subject: [PATCH 081/485] Create VERSIONING_STRATEGIES constant Signed-off-by: Erik Engervall --- plugins/github-release-manager/src/constants/constants.ts | 8 ++++++++ .../github-release-manager/src/contexts/ProjectContext.ts | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/github-release-manager/src/constants/constants.ts b/plugins/github-release-manager/src/constants/constants.ts index c60cc117cf..195a4b80af 100644 --- a/plugins/github-release-manager/src/constants/constants.ts +++ b/plugins/github-release-manager/src/constants/constants.ts @@ -29,3 +29,11 @@ export const DISABLE_CACHE = { 'If-None-Match': '', }, } as const; + +export const VERSIONING_STRATEGIES: { + semver: 'semver'; + calver: 'calver'; +} = { + semver: 'semver', + calver: 'calver', +} as const; diff --git a/plugins/github-release-manager/src/contexts/ProjectContext.ts b/plugins/github-release-manager/src/contexts/ProjectContext.ts index 75bf6db28d..d115c469fa 100644 --- a/plugins/github-release-manager/src/contexts/ProjectContext.ts +++ b/plugins/github-release-manager/src/contexts/ProjectContext.ts @@ -16,6 +16,7 @@ import { createContext, useContext } from 'react'; +import { VERSIONING_STRATEGIES } from '../constants/constants'; import { GitHubReleaseManagerError } from '../errors/GitHubReleaseManagerError'; export interface Project { @@ -39,7 +40,7 @@ export interface Project { * * Default: false */ - versioningStrategy: 'calver' | 'semver'; + versioningStrategy: keyof typeof VERSIONING_STRATEGIES; /** * Project props was provided via props * From cd996e7a0d2a55e2cef0701aed7e88c7aec7e838 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Wed, 21 Apr 2021 20:52:47 +0200 Subject: [PATCH 082/485] Correct FormLabel label for VersioningStrategy Signed-off-by: Erik Engervall --- .../src/cards/RepoDetailsForm/VersioningStrategy.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.tsx b/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.tsx index b03b22fd3f..29db87b0c4 100644 --- a/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.tsx +++ b/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.tsx @@ -54,13 +54,13 @@ export function VersioningStrategy() { required disabled={project.isProvidedViaProps} > - Calendar strategy + Versioning strategy + { const { queryParams } = getQueryParamsWithUpdates({ updates: [{ key: 'versioningStrategy', value: event.target.value }], @@ -74,6 +74,7 @@ export function VersioningStrategy() { control={} label="Semantic versioning" /> + } From 13906def32e628f2e640cc337e38c6af082b4daa Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Wed, 21 Apr 2021 20:53:41 +0200 Subject: [PATCH 083/485] Improve test coverage for VersioningStrategy & add VERSIONING_STRATEGIES to constants.test.ts Signed-off-by: Erik Engervall --- .../VersioningStrategy.test.tsx | 35 +++++++++++++------ .../src/constants/constants.test.ts | 4 +++ 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.test.tsx b/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.test.tsx index 9790fba23a..bc27ea4ce1 100644 --- a/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.test.tsx +++ b/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.test.tsx @@ -15,22 +15,23 @@ */ import React from 'react'; -import { render } from '@testing-library/react'; +import { render, fireEvent } from '@testing-library/react'; import { - mockCalverProject, + mockSemverProject, mockSearchCalver, } from '../../test-helpers/test-helpers'; -import { TEST_IDS } from '../../test-helpers/test-ids'; + +const mockNavigate = jest.fn(); jest.mock('react-router', () => ({ - useNavigate: jest.fn(), + useNavigate: () => mockNavigate, useLocation: jest.fn(() => ({ search: mockSearchCalver, })), })); jest.mock('../../contexts/ProjectContext', () => ({ - useProjectContext: jest.fn(() => mockCalverProject), + useProjectContext: jest.fn(() => mockSemverProject), })); import { VersioningStrategy } from './VersioningStrategy'; @@ -38,11 +39,25 @@ import { VersioningStrategy } from './VersioningStrategy'; describe('Repo', () => { beforeEach(jest.clearAllMocks); - it('should render radio group', async () => { - const { getByTestId } = render(); + it('should render radio group with default values and handle changes', async () => { + const { getByLabelText } = render(); - expect( - getByTestId(TEST_IDS.form.versioningStrategy.radioGroup), - ).toBeInTheDocument(); + const radio1 = getByLabelText('Semantic versioning'); + const radio2 = getByLabelText('Calendar versioning'); + + expect(radio1).toBeChecked(); + expect(radio2).not.toBeChecked(); + + fireEvent.click(radio2); + expect(mockNavigate.mock.calls).toMatchInlineSnapshot(` + Array [ + Array [ + "?versioningStrategy=calver&owner=mock_owner&repo=mock_repo", + Object { + "replace": true, + }, + ], + ] + `); }); }); diff --git a/plugins/github-release-manager/src/constants/constants.test.ts b/plugins/github-release-manager/src/constants/constants.test.ts index 3441221821..cf2b7d7548 100644 --- a/plugins/github-release-manager/src/constants/constants.test.ts +++ b/plugins/github-release-manager/src/constants/constants.test.ts @@ -30,6 +30,10 @@ describe('constants', () => { "minor": "minor", "patch": "patch", }, + "VERSIONING_STRATEGIES": Object { + "calver": "calver", + "semver": "semver", + }, } `); }); From f402ee00e1570dd0d255c51a3a2008a1e7aed874 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Wed, 21 Apr 2021 21:13:22 +0200 Subject: [PATCH 084/485] Revert accidental app-config.yaml push Signed-off-by: Erik Engervall --- app-config.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/app-config.yaml b/app-config.yaml index 3b94faa3f9..ac59874878 100644 --- a/app-config.yaml +++ b/app-config.yaml @@ -124,9 +124,6 @@ integrations: github: - host: github.com token: ${GITHUB_TOKEN} - - host: ghe.spotify.net - apiBaseUrl: https://ghe.spotify.net/api/v3 - token: ${GHE_TOKEN} ### Example for how to add your GitHub Enterprise instance using the API: # - host: ghe.example.net # apiBaseUrl: https://ghe.example.net/api/v3 From 3e1761460b8df444e636440b17d2db18cab6ada4 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Wed, 21 Apr 2021 21:30:53 +0200 Subject: [PATCH 085/485] Add tests for PluginApiClient & githubReleaseManagerApiRef Signed-off-by: Erik Engervall --- .../src/api/PluginApiClient.test.ts | 63 +++++++++++++++++++ .../src/api/serviceApiRef.test.ts | 32 ++++++++++ 2 files changed, 95 insertions(+) create mode 100644 plugins/github-release-manager/src/api/PluginApiClient.test.ts create mode 100644 plugins/github-release-manager/src/api/serviceApiRef.test.ts diff --git a/plugins/github-release-manager/src/api/PluginApiClient.test.ts b/plugins/github-release-manager/src/api/PluginApiClient.test.ts new file mode 100644 index 0000000000..e9db190eef --- /dev/null +++ b/plugins/github-release-manager/src/api/PluginApiClient.test.ts @@ -0,0 +1,63 @@ +/* + * 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 { OAuthApi } from '@backstage/core'; + +import { PluginApiClient } from './PluginApiClient'; + +jest.mock('@backstage/integration', () => ({ + readGitHubIntegrationConfigs: jest.fn(() => []), +})); + +describe('PluginApiClient', () => { + it('should return the default plugin api client', () => { + const configApi = { + getOptionalConfigArray: jest.fn(), + } as any; + const githubAuthApi: OAuthApi = { + getAccessToken: jest.fn(), + }; + const pluginApiClient = new PluginApiClient({ configApi, githubAuthApi }); + + expect(pluginApiClient).toMatchInlineSnapshot(` + PluginApiClient { + "baseUrl": "https://api.github.com", + "createRc": Object { + "createRef": [Function], + "createRelease": [Function], + "getComparison": [Function], + }, + "githubAuthApi": Object { + "getAccessToken": [MockFunction], + }, + "host": "github.com", + "patch": Object { + "createCherryPickCommit": [Function], + "createReference": [Function], + "createTagObject": [Function], + "createTempCommit": [Function], + "forceBranchHeadToTempCommit": [Function], + "merge": [Function], + "replaceTempCommit": [Function], + "updateRelease": [Function], + }, + "promoteRc": Object { + "promoteRelease": [Function], + }, + } + `); + }); +}); diff --git a/plugins/github-release-manager/src/api/serviceApiRef.test.ts b/plugins/github-release-manager/src/api/serviceApiRef.test.ts new file mode 100644 index 0000000000..7dc22deb29 --- /dev/null +++ b/plugins/github-release-manager/src/api/serviceApiRef.test.ts @@ -0,0 +1,32 @@ +/* + * 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 { githubReleaseManagerApiRef } from './serviceApiRef'; + +describe('githubReleaseManagerApiRef', () => { + it('should work', () => { + const result = githubReleaseManagerApiRef; + + expect(result).toMatchInlineSnapshot(` + ApiRefImpl { + "config": Object { + "description": "Used by the GitHub Release Manager plugin to make requests", + "id": "plugin.github-release-manager.service", + }, + } + `); + }); +}); From 1925246f848448a2c52c50fbfb0365a3919fef2f Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Wed, 21 Apr 2021 21:51:52 +0200 Subject: [PATCH 086/485] Improve tests for Cards and Info Signed-off-by: Erik Engervall --- .../src/cards/Cards.test.tsx | 2 +- .../src/cards/Info/Info.test.tsx | 51 +++++++++++++++++-- 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/plugins/github-release-manager/src/cards/Cards.test.tsx b/plugins/github-release-manager/src/cards/Cards.test.tsx index dfb5491842..8be47b4d59 100644 --- a/plugins/github-release-manager/src/cards/Cards.test.tsx +++ b/plugins/github-release-manager/src/cards/Cards.test.tsx @@ -30,7 +30,7 @@ jest.mock('../contexts/ProjectContext', () => ({ import { Cards } from './Cards'; describe('Cards', () => { - it('should render info', async () => { + it('should omit cards omitted via configuration', async () => { const { getByTestId } = render( ({ useProjectContext: jest.fn(() => mockCalverProject), @@ -30,11 +30,52 @@ jest.mock('../../contexts/ProjectContext', () => ({ import { Info } from './Info'; describe('Info', () => { - it('should return early if no latestRelease exists', () => { - const { getByTestId } = render( - , + it('should return early if no latestRelease exists', async () => { + const { findByText } = render( + , ); - expect(getByTestId(TEST_IDS.info.info)).toBeInTheDocument(); + expect(await findByText(mockReleaseBranch.name)).toMatchInlineSnapshot(` + + rc/1.2.3 + + `); + + expect( + await findByText(`${mockCalverProject.owner}/${mockCalverProject.repo}`), + ).toMatchInlineSnapshot(` + + mock_owner/mock_repo + + `); + + expect(await findByText(mockCalverProject.versioningStrategy)) + .toMatchInlineSnapshot(` + + calver + + `); + + expect(await findByText(mockReleaseCandidateCalver.tagName)) + .toMatchInlineSnapshot(` + + rc-2020.01.01_1 + + `); }); }); From a32d221ab85197e23cfda1edc78c6d961e3a3801 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Wed, 21 Apr 2021 22:19:06 +0200 Subject: [PATCH 087/485] Add tests for LinearProgressWithLabel & a test id for it Signed-off-by: Erik Engervall --- .../LinearProgressWithLabel.test.tsx | 104 ++++++++++++++++++ .../LinearProgressWithLabel.tsx | 20 +++- .../src/test-helpers/test-ids.test.ts | 1 + .../src/test-helpers/test-ids.ts | 1 + 4 files changed, 123 insertions(+), 3 deletions(-) create mode 100644 plugins/github-release-manager/src/components/ResponseStepDialog/LinearProgressWithLabel.test.tsx diff --git a/plugins/github-release-manager/src/components/ResponseStepDialog/LinearProgressWithLabel.test.tsx b/plugins/github-release-manager/src/components/ResponseStepDialog/LinearProgressWithLabel.test.tsx new file mode 100644 index 0000000000..a043758209 --- /dev/null +++ b/plugins/github-release-manager/src/components/ResponseStepDialog/LinearProgressWithLabel.test.tsx @@ -0,0 +1,104 @@ +/* + * 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 React from 'react'; +import { render } from '@testing-library/react'; + +import { LinearProgressWithLabel, testables } from './LinearProgressWithLabel'; +import { TEST_IDS } from '../../test-helpers/test-ids'; + +const { ICONS } = testables; + +describe('LinearProgressWithLabel', () => { + it('should render 50% progress without CompletionEmoji', () => { + const progress = 50; + + const { container, getByTestId } = render( + , + ); + + expect( + getByTestId(TEST_IDS.components.linearProgressWithLabel).getAttribute( + 'style', + ), + ).toContain(`font-size: 141%`); + expect(container.innerHTML).toContain(`${progress}%`); + expect(container.innerHTML).not.toContain(ICONS.SUCCESS); + expect(container.innerHTML).not.toContain(ICONS.FAILURE); + }); + + it('should render 100% progress with CompletionEmoji for success', () => { + const progress = 100; + + const { container, getByTestId } = render( + , + ); + + expect( + getByTestId(TEST_IDS.components.linearProgressWithLabel).getAttribute( + 'style', + ), + ).toContain(`font-size: 157%`); + expect(container.innerHTML).toContain(`${progress}%`); + expect(container.innerHTML).toContain(ICONS.SUCCESS); + expect(container.innerHTML).not.toContain(ICONS.FAILURE); + }); + + it('should render 100% progress with CompletionEmoji for failure if at least one failed response step is present', () => { + const progress = 100; + + const { container } = render( + , + ); + + expect(container.innerHTML).toContain(`${progress}%`); + expect(container.innerHTML).toContain(ICONS.FAILURE); + expect(container.innerHTML).not.toContain(ICONS.SUCCESS); + }); + + it('should round > 100 progress to 100', () => { + const progress = 101; + + const { container } = render( + , + ); + + expect(container.innerHTML).toContain('100%'); + expect(container.innerHTML).toContain(ICONS.SUCCESS); + expect(container.innerHTML).not.toContain(ICONS.FAILURE); + expect(container.innerHTML).not.toContain(`${progress}%`); + }); +}); diff --git a/plugins/github-release-manager/src/components/ResponseStepDialog/LinearProgressWithLabel.tsx b/plugins/github-release-manager/src/components/ResponseStepDialog/LinearProgressWithLabel.tsx index a5091021e7..62d14e771e 100644 --- a/plugins/github-release-manager/src/components/ResponseStepDialog/LinearProgressWithLabel.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepDialog/LinearProgressWithLabel.tsx @@ -18,6 +18,7 @@ import React from 'react'; import { Box, LinearProgress, Typography } from '@material-ui/core'; import { ResponseStep } from '../../types/types'; +import { TEST_IDS } from '../../test-helpers/test-ids'; const STATUSES = { FAILURE: 'FAILURE', @@ -25,6 +26,13 @@ const STATUSES = { SUCCESS: 'SUCCESS', } as const; +const ICONS = { + SUCCESS: '🚀', + FAILURE: '🔥', +}; + +const getFontSize = (progress: number) => 125 + Math.ceil(progress / Math.PI); + export function LinearProgressWithLabel(props: { progress: number; responseSteps: ResponseStep[]; @@ -42,8 +50,8 @@ export function LinearProgressWithLabel(props: { const CompletionEmoji = () => { if (status === STATUSES.ONGOING) return null; - if (status === STATUSES.FAILURE) return {' 🔥 '}; - return {' 🚀 '}; + if (status === STATUSES.FAILURE) return {` ${ICONS.FAILURE} `}; + return {` ${ICONS.SUCCESS} `}; }; return ( @@ -61,12 +69,14 @@ export function LinearProgressWithLabel(props: { @@ -77,3 +87,7 @@ export function LinearProgressWithLabel(props: { ); } + +export const testables = { + ICONS, +}; diff --git a/plugins/github-release-manager/src/test-helpers/test-ids.test.ts b/plugins/github-release-manager/src/test-helpers/test-ids.test.ts index 091f2ccb90..5adcebc3d9 100644 --- a/plugins/github-release-manager/src/test-helpers/test-ids.test.ts +++ b/plugins/github-release-manager/src/test-helpers/test-ids.test.ts @@ -35,6 +35,7 @@ describe('test-ids', () => { "next": "grm--differ-next", }, "divider": "grm--divider", + "linearProgressWithLabel": "grm--linear-progress-with-label", "noLatestRelease": "grm--no-latest-release", "responseStepListDialogContent": "grm--response-step-list--dialog-content", "responseStepListItem": "grm--response-step-list-item", diff --git a/plugins/github-release-manager/src/test-helpers/test-ids.ts b/plugins/github-release-manager/src/test-helpers/test-ids.ts index e7d3240a8b..1beb6aec10 100644 --- a/plugins/github-release-manager/src/test-helpers/test-ids.ts +++ b/plugins/github-release-manager/src/test-helpers/test-ids.ts @@ -77,5 +77,6 @@ export const TEST_IDS = { versioning: 'grm--differ--icons--versioning', }, }, + linearProgressWithLabel: 'grm--linear-progress-with-label', }, }; From 15067b0566f6f81cf9253e978a104909a05d4ca0 Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Thu, 22 Apr 2021 09:53:55 +0200 Subject: [PATCH 088/485] Add back @material-ui/lab to pass diff check Signed-off-by: Marcus Eide --- plugins/shortcuts/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/shortcuts/package.json b/plugins/shortcuts/package.json index bcac92fcb0..b3d8d7f4c1 100644 --- a/plugins/shortcuts/package.json +++ b/plugins/shortcuts/package.json @@ -24,6 +24,7 @@ "@backstage/theme": "^0.2.5", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", + "@material-ui/lab": "4.0.0-alpha.45", "@types/zen-observable": "^0.8.2", "react": "^16.13.1", "react-dom": "^16.13.1", From f8eb7cacc7c130a3e3a1df5e5efed29ca018eea5 Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Thu, 22 Apr 2021 10:33:40 +0200 Subject: [PATCH 089/485] Provide implementation of the api in the app instead Signed-off-by: Marcus Eide --- packages/app/src/apis.ts | 14 ++++++++++++++ plugins/shortcuts/src/plugin.ts | 19 +------------------ 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/packages/app/src/apis.ts b/packages/app/src/apis.ts index ccc576e727..6e643193db 100644 --- a/packages/app/src/apis.ts +++ b/packages/app/src/apis.ts @@ -20,6 +20,7 @@ import { createApiFactory, errorApiRef, githubAuthApiRef, + WebStorage, } from '@backstage/core'; import { ScmIntegrationsApi, @@ -33,6 +34,10 @@ import { graphQlBrowseApiRef, GraphQLEndpoints, } from '@backstage/plugin-graphiql'; +import { + LocalStoredShortcuts, + shortcutsApiRef, +} from '@backstage/plugin-shortcuts'; export const apis: AnyApiFactory[] = [ createApiFactory({ @@ -61,4 +66,13 @@ export const apis: AnyApiFactory[] = [ }), createApiFactory(costInsightsApiRef, new ExampleCostInsightsClient()), + + createApiFactory({ + api: shortcutsApiRef, + deps: { errorApi: errorApiRef }, + factory: ({ errorApi }) => + new LocalStoredShortcuts( + WebStorage.create({ namespace: '@backstage/shortcuts', errorApi }), + ), + }), ]; diff --git a/plugins/shortcuts/src/plugin.ts b/plugins/shortcuts/src/plugin.ts index d33af76f33..b81062505a 100644 --- a/plugins/shortcuts/src/plugin.ts +++ b/plugins/shortcuts/src/plugin.ts @@ -14,27 +14,10 @@ * limitations under the License. */ -import { - createApiFactory, - createComponentExtension, - createPlugin, - errorApiRef, - WebStorage, -} from '@backstage/core'; -import { shortcutsApiRef, LocalStoredShortcuts } from './api'; +import { createComponentExtension, createPlugin } from '@backstage/core'; export const shortcutsPlugin = createPlugin({ id: 'shortcuts', - apis: [ - createApiFactory({ - api: shortcutsApiRef, - deps: { errorApi: errorApiRef }, - factory: ({ errorApi }) => - new LocalStoredShortcuts( - WebStorage.create({ namespace: '@backstage/shortcuts', errorApi }), - ), - }), - ], }); export const Shortcuts = shortcutsPlugin.provide( From e15241ea1d8f392bee2c9ff7161e21fdb55d28f1 Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Thu, 22 Apr 2021 10:40:10 +0200 Subject: [PATCH 090/485] Update README Signed-off-by: Marcus Eide --- plugins/shortcuts/README.md | 40 ++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/plugins/shortcuts/README.md b/plugins/shortcuts/README.md index 423f03948c..2848ece0e8 100644 --- a/plugins/shortcuts/README.md +++ b/plugins/shortcuts/README.md @@ -1,13 +1,39 @@ # shortcuts -Welcome to the shortcuts plugin! +`shortcuts-plugin` allows a user to have easy access to pages within a Backstage app by storing them as "shortcuts" in the Sidebar. -_This plugin was created through the Backstage CLI_ +## Usage -## Getting started +Add the `` component within your ``: -Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn start` in the root directory, and then navigating to [/shortcuts](http://localhost:3000/shortcuts). +```ts +import { Shortcuts } from '@backstage/plugin-shortcuts'; -You can also serve the plugin in isolation by running `yarn start` in the plugin directory. -This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads. -It is only meant for local development, and the setup for it can be found inside the [/dev](./dev) directory. + + {/* ... */} + + + +; +``` + +The plugin exports a `shortcutApiRef` and an implementation of the `ShortcutApi` that uses `localStorage` for storage, that you can use to get started quickly. To use it add it to your app's `apis.ts`: + +```ts +import { + LocalStoredShortcuts, + shortcutsApiRef, +} from '@backstage/plugin-shortcuts'; + +export const apis = [ + // ... + createApiFactory({ + api: shortcutsApiRef, + deps: { errorApi: errorApiRef }, + factory: ({ errorApi }) => + new LocalStoredShortcuts( + WebStorage.create({ namespace: '@backstage/shortcuts', errorApi }), + ), + }), +]; +``` From 491af9430a865a24a931d13a083f6b160f1d31a0 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 22 Apr 2021 13:33:43 +0200 Subject: [PATCH 091/485] Return objects from contexts to simplify naming Signed-off-by: Erik Engervall --- .../src/GitHubReleaseManager.tsx | 4 ++-- .../src/cards/Cards.test.tsx | 8 ++++++-- .../github-release-manager/src/cards/Cards.tsx | 4 ++-- .../src/cards/CreateRc/CreateRc.test.tsx | 12 +++++++++--- .../src/cards/CreateRc/CreateRc.tsx | 4 ++-- .../src/cards/Info/Info.test.tsx | 4 +++- .../src/cards/Info/Info.tsx | 3 +-- .../src/cards/Patch/Patch.test.tsx | 4 +++- .../src/cards/Patch/Patch.tsx | 2 +- .../src/cards/Patch/PatchBody.test.tsx | 8 ++++++-- .../src/cards/Patch/PatchBody.tsx | 4 ++-- .../src/cards/PromoteRc/PromoteRcBody.test.tsx | 8 ++++++-- .../src/cards/PromoteRc/PromoteRcBody.tsx | 4 ++-- .../src/cards/RepoDetailsForm/Owner.test.tsx | 15 +++++++++------ .../src/cards/RepoDetailsForm/Owner.tsx | 4 ++-- .../src/cards/RepoDetailsForm/Repo.test.tsx | 15 +++++++++------ .../src/cards/RepoDetailsForm/Repo.tsx | 4 ++-- .../RepoDetailsForm/VersioningStrategy.test.tsx | 4 +++- .../cards/RepoDetailsForm/VersioningStrategy.tsx | 2 +- .../src/contexts/PluginApiClientContext.ts | 8 +++++--- .../src/contexts/ProjectContext.ts | 10 +++++++--- .../src/contexts/RefetchContext.ts | 13 +++++++------ 22 files changed, 90 insertions(+), 54 deletions(-) diff --git a/plugins/github-release-manager/src/GitHubReleaseManager.tsx b/plugins/github-release-manager/src/GitHubReleaseManager.tsx index 64b7ebb028..ff77e8bbe4 100644 --- a/plugins/github-release-manager/src/GitHubReleaseManager.tsx +++ b/plugins/github-release-manager/src/GitHubReleaseManager.tsx @@ -81,8 +81,8 @@ export function GitHubReleaseManager(props: GitHubReleaseManagerProps) { } return ( - - + +
diff --git a/plugins/github-release-manager/src/cards/Cards.test.tsx b/plugins/github-release-manager/src/cards/Cards.test.tsx index 8be47b4d59..8546c09cef 100644 --- a/plugins/github-release-manager/src/cards/Cards.test.tsx +++ b/plugins/github-release-manager/src/cards/Cards.test.tsx @@ -21,10 +21,14 @@ import { mockApiClient, mockCalverProject } from '../test-helpers/test-helpers'; import { TEST_IDS } from '../test-helpers/test-ids'; jest.mock('../contexts/PluginApiClientContext', () => ({ - usePluginApiClientContext: () => mockApiClient, + usePluginApiClientContext: () => ({ + pluginApiClient: mockApiClient, + }), })); jest.mock('../contexts/ProjectContext', () => ({ - useProjectContext: jest.fn(() => mockCalverProject), + useProjectContext: () => ({ + project: mockCalverProject, + }), })); import { Cards } from './Cards'; diff --git a/plugins/github-release-manager/src/cards/Cards.tsx b/plugins/github-release-manager/src/cards/Cards.tsx index 22d7a8e884..0b4149212e 100644 --- a/plugins/github-release-manager/src/cards/Cards.tsx +++ b/plugins/github-release-manager/src/cards/Cards.tsx @@ -35,8 +35,8 @@ export function Cards({ }: { components: GitHubReleaseManagerProps['components']; }) { - const pluginApiClient = usePluginApiClientContext(); - const project = useProjectContext(); + const { pluginApiClient } = usePluginApiClientContext(); + const { project } = useProjectContext(); const [refetchTrigger, setRefetchTrigger] = useState(0); const { gitHubBatchInfo } = useGetGitHubBatchInfo({ pluginApiClient, diff --git a/plugins/github-release-manager/src/cards/CreateRc/CreateRc.test.tsx b/plugins/github-release-manager/src/cards/CreateRc/CreateRc.test.tsx index 084754ce06..98bf4903ac 100644 --- a/plugins/github-release-manager/src/cards/CreateRc/CreateRc.test.tsx +++ b/plugins/github-release-manager/src/cards/CreateRc/CreateRc.test.tsx @@ -30,10 +30,14 @@ import { TEST_IDS } from '../../test-helpers/test-ids'; import { useCreateRc } from './hooks/useCreateRc'; jest.mock('../../contexts/PluginApiClientContext', () => ({ - usePluginApiClientContext: () => mockApiClient, + usePluginApiClientContext: () => ({ + pluginApiClient: mockApiClient, + }), })); jest.mock('../../contexts/ProjectContext', () => ({ - useProjectContext: jest.fn(() => mockCalverProject), + useProjectContext: jest.fn(() => ({ + project: mockCalverProject, + })), })); jest.mock('../../helpers/getRcGitHubInfo', () => ({ getRcGitHubInfo: () => mockNextGitHubInfoSemver, @@ -65,7 +69,9 @@ describe('CreateRc', () => { }); it('should display select element for semver', () => { - (useProjectContext as jest.Mock).mockReturnValue(mockSemverProject); + (useProjectContext as jest.Mock).mockReturnValue({ + project: mockSemverProject, + }); const { getByTestId } = render( { - const pluginApiClient = usePluginApiClientContext(); - const project = useProjectContext(); + const { pluginApiClient } = usePluginApiClientContext(); + const { project } = useProjectContext(); const classes = useStyles(); const [semverBumpLevel, setSemverBumpLevel] = useState<'major' | 'minor'>( diff --git a/plugins/github-release-manager/src/cards/Info/Info.test.tsx b/plugins/github-release-manager/src/cards/Info/Info.test.tsx index 4656c4a4e0..2ca2b45576 100644 --- a/plugins/github-release-manager/src/cards/Info/Info.test.tsx +++ b/plugins/github-release-manager/src/cards/Info/Info.test.tsx @@ -24,7 +24,9 @@ import { } from '../../test-helpers/test-helpers'; jest.mock('../../contexts/ProjectContext', () => ({ - useProjectContext: jest.fn(() => mockCalverProject), + useProjectContext: () => ({ + project: mockCalverProject, + }), })); import { Info } from './Info'; diff --git a/plugins/github-release-manager/src/cards/Info/Info.tsx b/plugins/github-release-manager/src/cards/Info/Info.tsx index 5830046bad..72a61a38e6 100644 --- a/plugins/github-release-manager/src/cards/Info/Info.tsx +++ b/plugins/github-release-manager/src/cards/Info/Info.tsx @@ -34,8 +34,7 @@ interface InfoCardProps { } export const Info = ({ releaseBranch, latestRelease }: InfoCardProps) => { - const project = useProjectContext(); - + const { project } = useProjectContext(); const classes = useStyles(); return ( diff --git a/plugins/github-release-manager/src/cards/Patch/Patch.test.tsx b/plugins/github-release-manager/src/cards/Patch/Patch.test.tsx index a9ac2d31a5..2f7f170d9f 100644 --- a/plugins/github-release-manager/src/cards/Patch/Patch.test.tsx +++ b/plugins/github-release-manager/src/cards/Patch/Patch.test.tsx @@ -24,7 +24,9 @@ import { import { TEST_IDS } from '../../test-helpers/test-ids'; jest.mock('../../contexts/ProjectContext', () => ({ - useProjectContext: jest.fn(() => mockCalverProject), + useProjectContext: () => ({ + project: mockCalverProject, + }), })); import { Patch } from './Patch'; diff --git a/plugins/github-release-manager/src/cards/Patch/Patch.tsx b/plugins/github-release-manager/src/cards/Patch/Patch.tsx index 2f184277a1..dc3ca1c5b8 100644 --- a/plugins/github-release-manager/src/cards/Patch/Patch.tsx +++ b/plugins/github-release-manager/src/cards/Patch/Patch.tsx @@ -40,7 +40,7 @@ export const Patch = ({ releaseBranch, successCb, }: PatchProps) => { - const project = useProjectContext(); + const { project } = useProjectContext(); const classes = useStyles(); function Body() { diff --git a/plugins/github-release-manager/src/cards/Patch/PatchBody.test.tsx b/plugins/github-release-manager/src/cards/Patch/PatchBody.test.tsx index 2d8025bd3f..be9ea1ce45 100644 --- a/plugins/github-release-manager/src/cards/Patch/PatchBody.test.tsx +++ b/plugins/github-release-manager/src/cards/Patch/PatchBody.test.tsx @@ -28,10 +28,14 @@ import { } from '../../test-helpers/test-helpers'; jest.mock('../../contexts/PluginApiClientContext', () => ({ - usePluginApiClientContext: jest.fn(() => mockApiClient), + usePluginApiClientContext: () => ({ + pluginApiClient: mockApiClient, + }), })); jest.mock('../../contexts/ProjectContext', () => ({ - useProjectContext: jest.fn(() => mockCalverProject), + useProjectContext: () => ({ + project: mockCalverProject, + }), })); jest.mock('./hooks/usePatch', () => ({ usePatch: () => ({ diff --git a/plugins/github-release-manager/src/cards/Patch/PatchBody.tsx b/plugins/github-release-manager/src/cards/Patch/PatchBody.tsx index 6f112cf013..ec7b6ab1f3 100644 --- a/plugins/github-release-manager/src/cards/Patch/PatchBody.tsx +++ b/plugins/github-release-manager/src/cards/Patch/PatchBody.tsx @@ -65,8 +65,8 @@ export const PatchBody = ({ successCb, tagParts, }: PatchBodyProps) => { - const pluginApiClient = usePluginApiClientContext(); - const project = useProjectContext(); + const { pluginApiClient } = usePluginApiClientContext(); + const { project } = useProjectContext(); const [checkedCommitIndex, setCheckedCommitIndex] = useState(-1); const githubDataResponse = useAsync(async () => { diff --git a/plugins/github-release-manager/src/cards/PromoteRc/PromoteRcBody.test.tsx b/plugins/github-release-manager/src/cards/PromoteRc/PromoteRcBody.test.tsx index 573e85bf10..51724a1e22 100644 --- a/plugins/github-release-manager/src/cards/PromoteRc/PromoteRcBody.test.tsx +++ b/plugins/github-release-manager/src/cards/PromoteRc/PromoteRcBody.test.tsx @@ -25,10 +25,14 @@ import { import { TEST_IDS } from '../../test-helpers/test-ids'; jest.mock('../../contexts/PluginApiClientContext', () => ({ - usePluginApiClientContext: jest.fn(() => mockApiClient), + usePluginApiClientContext: () => ({ + pluginApiClient: mockApiClient, + }), })); jest.mock('../../contexts/ProjectContext', () => ({ - useProjectContext: jest.fn(() => mockCalverProject), + useProjectContext: () => ({ + project: mockCalverProject, + }), })); jest.mock('./hooks/usePromoteRc', () => ({ usePromoteRc: () => ({ diff --git a/plugins/github-release-manager/src/cards/PromoteRc/PromoteRcBody.tsx b/plugins/github-release-manager/src/cards/PromoteRc/PromoteRcBody.tsx index 88d1ccbf79..bfdfd1a976 100644 --- a/plugins/github-release-manager/src/cards/PromoteRc/PromoteRcBody.tsx +++ b/plugins/github-release-manager/src/cards/PromoteRc/PromoteRcBody.tsx @@ -33,8 +33,8 @@ interface PromoteRcBodyProps { } export const PromoteRcBody = ({ rcRelease, successCb }: PromoteRcBodyProps) => { - const pluginApiClient = usePluginApiClientContext(); - const project = useProjectContext(); + const { pluginApiClient } = usePluginApiClientContext(); + const { project } = useProjectContext(); const classes = useStyles(); const releaseVersion = rcRelease.tagName.replace('rc-', 'version-'); diff --git a/plugins/github-release-manager/src/cards/RepoDetailsForm/Owner.test.tsx b/plugins/github-release-manager/src/cards/RepoDetailsForm/Owner.test.tsx index e673c39c59..da95f5fa50 100644 --- a/plugins/github-release-manager/src/cards/RepoDetailsForm/Owner.test.tsx +++ b/plugins/github-release-manager/src/cards/RepoDetailsForm/Owner.test.tsx @@ -31,10 +31,14 @@ jest.mock('react-router', () => ({ })), })); jest.mock('../../contexts/PluginApiClientContext', () => ({ - usePluginApiClientContext: jest.fn(() => mockApiClient), + usePluginApiClientContext: () => ({ + pluginApiClient: mockApiClient, + }), })); jest.mock('../../contexts/ProjectContext', () => ({ - useProjectContext: jest.fn(() => mockCalverProject), + useProjectContext: jest.fn(() => ({ + project: mockCalverProject, + })), })); import { useProjectContext } from '../../contexts/ProjectContext'; @@ -55,10 +59,9 @@ describe('Owner', () => { }); it('should render select for empty owners', async () => { - (useProjectContext as jest.Mock).mockImplementation(() => ({ - ...mockCalverProject, - owner: '', - })); + (useProjectContext as jest.Mock).mockReturnValue({ + project: { ...mockCalverProject, owner: '' }, + }); const { getAllByTestId, getByTestId } = render( , diff --git a/plugins/github-release-manager/src/cards/RepoDetailsForm/Owner.tsx b/plugins/github-release-manager/src/cards/RepoDetailsForm/Owner.tsx index 4c040cac4f..3cd2be6f7e 100644 --- a/plugins/github-release-manager/src/cards/RepoDetailsForm/Owner.tsx +++ b/plugins/github-release-manager/src/cards/RepoDetailsForm/Owner.tsx @@ -33,10 +33,10 @@ import { useProjectContext } from '../../contexts/ProjectContext'; import { useQueryHandler } from '../../hooks/useQueryHandler'; export function Owner({ username }: { username: string }) { - const project = useProjectContext(); + const { pluginApiClient } = usePluginApiClientContext(); + const { project } = useProjectContext(); const formClasses = useFormClasses(); const navigate = useNavigate(); - const pluginApiClient = usePluginApiClientContext(); const { getQueryParamsWithUpdates } = useQueryHandler(); const { loading, error, value } = useAsync(() => pluginApiClient.getOwners()); diff --git a/plugins/github-release-manager/src/cards/RepoDetailsForm/Repo.test.tsx b/plugins/github-release-manager/src/cards/RepoDetailsForm/Repo.test.tsx index a5b7fca25a..ab6c98ea5f 100644 --- a/plugins/github-release-manager/src/cards/RepoDetailsForm/Repo.test.tsx +++ b/plugins/github-release-manager/src/cards/RepoDetailsForm/Repo.test.tsx @@ -31,10 +31,14 @@ jest.mock('react-router', () => ({ })), })); jest.mock('../../contexts/PluginApiClientContext', () => ({ - usePluginApiClientContext: jest.fn(() => mockApiClient), + usePluginApiClientContext: () => ({ + pluginApiClient: mockApiClient, + }), })); jest.mock('../../contexts/ProjectContext', () => ({ - useProjectContext: jest.fn(() => mockCalverProject), + useProjectContext: jest.fn(() => ({ + project: mockCalverProject, + })), })); import { useProjectContext } from '../../contexts/ProjectContext'; @@ -53,10 +57,9 @@ describe('Repo', () => { }); it('should render select for empty repo', async () => { - (useProjectContext as jest.Mock).mockImplementation(() => ({ - ...mockCalverProject, - repo: '', - })); + (useProjectContext as jest.Mock).mockReturnValue({ + project: { ...mockCalverProject, repo: '' }, + }); const { getAllByTestId, getByTestId } = render(); diff --git a/plugins/github-release-manager/src/cards/RepoDetailsForm/Repo.tsx b/plugins/github-release-manager/src/cards/RepoDetailsForm/Repo.tsx index 57a339ab81..cb08a651cb 100644 --- a/plugins/github-release-manager/src/cards/RepoDetailsForm/Repo.tsx +++ b/plugins/github-release-manager/src/cards/RepoDetailsForm/Repo.tsx @@ -33,8 +33,8 @@ import { useProjectContext } from '../../contexts/ProjectContext'; import { useQueryHandler } from '../../hooks/useQueryHandler'; export function Repo() { - const pluginApiClient = usePluginApiClientContext(); - const project = useProjectContext(); + const { pluginApiClient } = usePluginApiClientContext(); + const { project } = useProjectContext(); const navigate = useNavigate(); const formClasses = useFormClasses(); const { getQueryParamsWithUpdates } = useQueryHandler(); diff --git a/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.test.tsx b/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.test.tsx index bc27ea4ce1..4d36b26ed6 100644 --- a/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.test.tsx +++ b/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.test.tsx @@ -31,7 +31,9 @@ jest.mock('react-router', () => ({ })), })); jest.mock('../../contexts/ProjectContext', () => ({ - useProjectContext: jest.fn(() => mockSemverProject), + useProjectContext: () => ({ + project: mockSemverProject, + }), })); import { VersioningStrategy } from './VersioningStrategy'; diff --git a/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.tsx b/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.tsx index 29db87b0c4..67ca47f566 100644 --- a/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.tsx +++ b/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.tsx @@ -31,7 +31,7 @@ import { VERSIONING_STRATEGIES } from '../../constants/constants'; export function VersioningStrategy() { const navigate = useNavigate(); - const project = useProjectContext(); + const { project } = useProjectContext(); const { getParsedQuery, getQueryParamsWithUpdates } = useQueryHandler(); useEffect(() => { diff --git a/plugins/github-release-manager/src/contexts/PluginApiClientContext.ts b/plugins/github-release-manager/src/contexts/PluginApiClientContext.ts index 1954321644..2d4c9f27ac 100644 --- a/plugins/github-release-manager/src/contexts/PluginApiClientContext.ts +++ b/plugins/github-release-manager/src/contexts/PluginApiClientContext.ts @@ -20,15 +20,17 @@ import { IPluginApiClient } from '../api/PluginApiClient'; import { GitHubReleaseManagerError } from '../errors/GitHubReleaseManagerError'; export const PluginApiClientContext = createContext< - IPluginApiClient | undefined + { pluginApiClient: IPluginApiClient } | undefined >(undefined); export const usePluginApiClientContext = () => { - const pluginApiClient = useContext(PluginApiClientContext); + const { pluginApiClient } = useContext(PluginApiClientContext) ?? {}; if (!pluginApiClient) { throw new GitHubReleaseManagerError('pluginApiClient not found'); } - return pluginApiClient; + return { + pluginApiClient, + }; }; diff --git a/plugins/github-release-manager/src/contexts/ProjectContext.ts b/plugins/github-release-manager/src/contexts/ProjectContext.ts index d115c469fa..bd8e78c53b 100644 --- a/plugins/github-release-manager/src/contexts/ProjectContext.ts +++ b/plugins/github-release-manager/src/contexts/ProjectContext.ts @@ -49,14 +49,18 @@ export interface Project { isProvidedViaProps: boolean; } -export const ProjectContext = createContext(undefined); +export const ProjectContext = createContext<{ project: Project } | undefined>( + undefined, +); export const useProjectContext = () => { - const project = useContext(ProjectContext); + const { project } = useContext(ProjectContext) ?? {}; if (!project) { throw new GitHubReleaseManagerError('project not found'); } - return project; + return { + project, + }; }; diff --git a/plugins/github-release-manager/src/contexts/RefetchContext.ts b/plugins/github-release-manager/src/contexts/RefetchContext.ts index 4b9d82a17e..344df3d9a5 100644 --- a/plugins/github-release-manager/src/contexts/RefetchContext.ts +++ b/plugins/github-release-manager/src/contexts/RefetchContext.ts @@ -18,12 +18,13 @@ import { createContext, useContext } from 'react'; import { GitHubReleaseManagerError } from '../errors/GitHubReleaseManagerError'; -export interface Refetch { - refetchTrigger: number; - setRefetchTrigger: React.Dispatch>; -} - -export const RefetchContext = createContext(undefined); +export const RefetchContext = createContext< + | { + refetchTrigger: number; + setRefetchTrigger: React.Dispatch>; + } + | undefined +>(undefined); export const useRefetchContext = () => { const refetch = useContext(RefetchContext); From 57d8ea02374f256715bc071df6385a6786db3432 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 22 Apr 2021 14:32:58 +0200 Subject: [PATCH 092/485] Add condition for displaying current & separator Signed-off-by: Erik Engervall --- .../src/components/Differ.test.tsx | 4 ++-- .../src/components/Differ.tsx | 17 ++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/plugins/github-release-manager/src/components/Differ.test.tsx b/plugins/github-release-manager/src/components/Differ.test.tsx index cb625c4118..b35773f1f5 100644 --- a/plugins/github-release-manager/src/components/Differ.test.tsx +++ b/plugins/github-release-manager/src/components/Differ.test.tsx @@ -30,11 +30,11 @@ describe('Differ', () => { const { getByTestId, queryByTestId } = render(); const icon = getByTestId(TEST_IDS.components.differ.icons.branch); - const current = getByTestId(TEST_IDS.components.differ.current); + const current = queryByTestId(TEST_IDS.components.differ.current); const next = queryByTestId(TEST_IDS.components.differ.next); expect(icon).toBeInTheDocument(); - expect(current.innerHTML).toMatchInlineSnapshot(`"None"`); + expect(current).toMatchInlineSnapshot(`null`); expect(next).not.toBeInTheDocument(); }); diff --git a/plugins/github-release-manager/src/components/Differ.tsx b/plugins/github-release-manager/src/components/Differ.tsx index 047b1fbd7e..d4eda688a6 100644 --- a/plugins/github-release-manager/src/components/Differ.tsx +++ b/plugins/github-release-manager/src/components/Differ.tsx @@ -40,14 +40,17 @@ export const Differ = ({ current, next, icon }: DifferProps) => { )} - - {current ?? 'None'} - + {!!current && ( + + {current ?? 'None'} + + )} + + {current && next && {' → '}} - {next && {' → '}} {next && ( Date: Thu, 22 Apr 2021 15:16:05 +0200 Subject: [PATCH 093/485] Disable refresh button in ResponseStepDialog while requests are ongoing Signed-off-by: Erik Engervall --- .../src/components/ResponseStepDialog/ResponseStepDialog.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.tsx b/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.tsx index ba3de2d77a..89714b7bf0 100644 --- a/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.tsx @@ -69,6 +69,7 @@ export const ResponseStepDialog = ({ - ); - } - return ( - - - Create Release Candidate - - + {project.versioningStrategy === 'semver' && latestRelease && !conflictingPreRelease && ( @@ -182,9 +151,50 @@ export const CreateRc = ({
)} - + {conflictingPreRelease || tagAlreadyExists ? ( + <> + {conflictingPreRelease && ( + + The most recent release is already a Release Candidate + + )} - - + {tagAlreadyExists && ( + + There's already a tag named{' '} + {nextGitHubInfo.rcReleaseTag} + + )} + + ) : ( +
+ + + + + + + +
+ )} + + + ); }; diff --git a/plugins/github-release-manager/src/cards/CreateRc/hooks/useCreateRc.ts b/plugins/github-release-manager/src/cards/CreateRc/hooks/useCreateRc.ts index b0b0c98dca..2b1b0b688c 100644 --- a/plugins/github-release-manager/src/cards/CreateRc/hooks/useCreateRc.ts +++ b/plugins/github-release-manager/src/cards/CreateRc/hooks/useCreateRc.ts @@ -45,6 +45,16 @@ export function useCreateRc({ project, successCb, }: CreateRC): CardHook { + if (nextGitHubInfo.error) { + throw new GitHubReleaseManagerError( + `Unexpected error: ${ + nextGitHubInfo.error.title + ? `${nextGitHubInfo.error.title} (${nextGitHubInfo.error.subtitle})` + : nextGitHubInfo.error.subtitle + }`, + ); + } + const { responseSteps, addStepToResponseSteps, @@ -162,7 +172,9 @@ export function useCreateRc({ .createRelease({ owner: project.owner, repo: project.repo, - nextGitHubInfo: nextGitHubInfo, + rcReleaseTag: nextGitHubInfo.rcReleaseTag, + releaseName: nextGitHubInfo.releaseName, + rcBranch: nextGitHubInfo.rcBranch, releaseBody: getComparisonRes.value.releaseBody, }) .catch(asyncCatcher); diff --git a/plugins/github-release-manager/src/cards/Patch/Patch.tsx b/plugins/github-release-manager/src/cards/Patch/Patch.tsx index dc3ca1c5b8..d01a366ffb 100644 --- a/plugins/github-release-manager/src/cards/Patch/Patch.tsx +++ b/plugins/github-release-manager/src/cards/Patch/Patch.tsx @@ -16,6 +16,7 @@ import React from 'react'; import { Typography } from '@material-ui/core'; +import { Alert, AlertTitle } from '@material-ui/lab'; import { GetBranchResult, @@ -40,42 +41,59 @@ export const Patch = ({ releaseBranch, successCb, }: PatchProps) => { - const { project } = useProjectContext(); const classes = useStyles(); - function Body() { - if (latestRelease === null) { - return ; - } - - if (releaseBranch === null) { - return ; - } - - const { bumpedTag, tagParts } = getBumpedTag({ - project, - tag: latestRelease.tagName, - bumpLevel: 'patch', - }); - - return ( - - ); - } - return ( Patch Release {latestRelease?.prerelease ? 'Candidate' : 'Version'} - + ); }; + +function BodyWrapper({ latestRelease, releaseBranch, successCb }: PatchProps) { + const { project } = useProjectContext(); + + if (latestRelease === null) { + return ; + } + + if (releaseBranch === null) { + return ; + } + + const bumpedTag = getBumpedTag({ + project, + tag: latestRelease.tagName, + bumpLevel: 'patch', + }); + + if (bumpedTag.error !== undefined) { + return ( + + {bumpedTag.error.title && ( + {bumpedTag.error.title} + )} + + {bumpedTag.error.subtitle} + + ); + } + + return ( + + ); +} diff --git a/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.tsx b/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.tsx index 89714b7bf0..d504ffec70 100644 --- a/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.tsx @@ -14,20 +14,19 @@ * limitations under the License. */ -import React, { forwardRef, Ref } from 'react'; +import React from 'react'; import { Button, Dialog as MaterialDialog, DialogActions, DialogTitle, - Slide, } from '@material-ui/core'; -import { TransitionProps } from '@material-ui/core/transitions'; import RefreshIcon from '@material-ui/icons/Refresh'; import { LinearProgressWithLabel } from './LinearProgressWithLabel'; import { ResponseStep } from '../../types/types'; import { ResponseStepList } from './ResponseStepList'; +import { Transition } from '../Transition'; import { useRefetchContext } from '../../contexts/RefetchContext'; interface DialogProps { @@ -36,13 +35,6 @@ interface DialogProps { title: string; } -const Transition = forwardRef(function Transition( - props: { children?: React.ReactElement } & TransitionProps, - ref: Ref, -) { - return ; -}); - export const ResponseStepDialog = ({ progress, responseSteps, diff --git a/plugins/github-release-manager/src/components/Transition.tsx b/plugins/github-release-manager/src/components/Transition.tsx new file mode 100644 index 0000000000..0c54e0f851 --- /dev/null +++ b/plugins/github-release-manager/src/components/Transition.tsx @@ -0,0 +1,26 @@ +/* + * 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 React, { forwardRef, Ref } from 'react'; +import { Slide } from '@material-ui/core'; +import { TransitionProps } from '@material-ui/core/transitions'; + +export const Transition = forwardRef(function Transition( + props: { children?: React.ReactElement } & TransitionProps, + ref: Ref, +) { + return ; +}); diff --git a/plugins/github-release-manager/src/helpers/getBumpedTag.test.ts b/plugins/github-release-manager/src/helpers/getBumpedTag.test.ts index 1fd7cd2ecf..27023f653f 100644 --- a/plugins/github-release-manager/src/helpers/getBumpedTag.test.ts +++ b/plugins/github-release-manager/src/helpers/getBumpedTag.test.ts @@ -32,6 +32,7 @@ describe('getBumpedTag', () => { expect(result).toMatchInlineSnapshot(` Object { "bumpedTag": "rc-2020.01.01_2", + "error": undefined, "tagParts": Object { "calver": "2020.01.01", "patch": 2, @@ -51,6 +52,7 @@ describe('getBumpedTag', () => { expect(result).toMatchInlineSnapshot(` Object { "bumpedTag": "rc-2020.01.01_2", + "error": undefined, "tagParts": Object { "calver": "2020.01.01", "patch": 2, @@ -72,6 +74,7 @@ describe('getBumpedTag', () => { expect(result).toMatchInlineSnapshot(` Object { "bumpedTag": "rc-1.2.4", + "error": undefined, "tagParts": Object { "major": 1, "minor": 2, @@ -92,6 +95,7 @@ describe('getBumpedTag', () => { expect(result).toMatchInlineSnapshot(` Object { "bumpedTag": "rc-1.3.0", + "error": undefined, "tagParts": Object { "major": 1, "minor": 3, @@ -112,6 +116,7 @@ describe('getBumpedTag', () => { expect(result).toMatchInlineSnapshot(` Object { "bumpedTag": "rc-2.0.0", + "error": undefined, "tagParts": Object { "major": 2, "minor": 0, @@ -122,4 +127,23 @@ describe('getBumpedTag', () => { `); }); }); + + describe('errors', () => { + it('should propagate errors for invalid tags', () => { + const result = getBumpedTag({ + project: mockCalverProject, + tag: '😬', + bumpLevel: 'patch', + }); + + expect(result).toMatchInlineSnapshot(` + Object { + "error": Object { + "subtitle": "Expected calver matching \\"/(rc|version)-([0-9]{4}\\\\.[0-9]{2}\\\\.[0-9]{2})_([0-9]+)/\\", found \\"😬\\"", + "title": "Invalid tag", + }, + } + `); + }); + }); }); diff --git a/plugins/github-release-manager/src/helpers/getBumpedTag.ts b/plugins/github-release-manager/src/helpers/getBumpedTag.ts index 5409f7d2b3..f8b976b01f 100644 --- a/plugins/github-release-manager/src/helpers/getBumpedTag.ts +++ b/plugins/github-release-manager/src/helpers/getBumpedTag.ts @@ -32,11 +32,17 @@ export function getBumpedTag({ }) { const tagParts = getTagParts({ project, tag }); - if (isCalverTagParts(project, tagParts)) { - return getPatchedCalverTag(tagParts); + if (tagParts.error !== undefined) { + return { + error: tagParts.error, + }; } - return getBumpedSemverTag(tagParts, bumpLevel); + if (isCalverTagParts(project, tagParts.tagParts)) { + return getPatchedCalverTag(tagParts.tagParts); + } + + return getBumpedSemverTag(tagParts.tagParts, bumpLevel); } function getPatchedCalverTag(tagParts: CalverTagParts) { @@ -49,6 +55,7 @@ function getPatchedCalverTag(tagParts: CalverTagParts) { return { bumpedTag, tagParts: bumpedTagParts, + error: undefined, }; } @@ -63,6 +70,7 @@ function getBumpedSemverTag( return { bumpedTag, tagParts: bumpedTagParts, + error: undefined, }; } diff --git a/plugins/github-release-manager/src/helpers/getRcGitHubInfo.ts b/plugins/github-release-manager/src/helpers/getRcGitHubInfo.ts index 18043033c9..70935a0dd3 100644 --- a/plugins/github-release-manager/src/helpers/getRcGitHubInfo.ts +++ b/plugins/github-release-manager/src/helpers/getRcGitHubInfo.ts @@ -49,8 +49,17 @@ export const getRcGitHubInfo = ({ }; } - const tagParts = getSemverTagParts(latestRelease.tagName); - const { bumpedTagParts } = getBumpedSemverTagParts(tagParts, semverBumpLevel); + const semverTagParts = getSemverTagParts(latestRelease.tagName); + if (semverTagParts.error !== undefined) { + return { + error: semverTagParts.error, + }; + } + + const { bumpedTagParts } = getBumpedSemverTagParts( + semverTagParts.tagParts, + semverBumpLevel, + ); const bumpedTag = `${bumpedTagParts.major}.${bumpedTagParts.minor}.${bumpedTagParts.patch}`; diff --git a/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.test.ts b/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.test.ts index 238abe720a..c74438b63a 100644 --- a/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.test.ts +++ b/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.test.ts @@ -21,51 +21,87 @@ import { import { getCalverTagParts } from './getCalverTagParts'; describe('getCalverTagParts', () => { - it('should return tagParts for RC tag', () => { - const result = getCalverTagParts(mockReleaseCandidateCalver.tagName); + describe('happy path', () => { + it('should return tagParts for RC tag', () => { + const result = getCalverTagParts(mockReleaseCandidateCalver.tagName); - expect(result).toMatchInlineSnapshot(` + expect(result).toMatchInlineSnapshot(` + Object { + "tagParts": Object { + "calver": "2020.01.01", + "patch": 1, + "prefix": "rc", + }, + } + `); + }); + + it('should return tagParts for Version tag', () => { + const result = getCalverTagParts(mockReleaseVersionCalver.tagName); + + expect(result).toMatchInlineSnapshot(` + Object { + "tagParts": Object { + "calver": "2020.01.01", + "patch": 1, + "prefix": "version", + }, + } + `); + }); + }); + + describe('invalid calver tags', () => { + it('should return error for invalid prefix', () => { + const result = getCalverTagParts('invalid-2020.01.01_1'); + + expect(result).toMatchInlineSnapshot(` Object { - "calver": "2020.01.01", - "patch": 1, - "prefix": "rc", + "error": Object { + "subtitle": "Expected calver matching \\"/(rc|version)-([0-9]{4}\\\\.[0-9]{2}\\\\.[0-9]{2})_([0-9]+)/\\", found \\"invalid-2020.01.01_1\\"", + "title": "Invalid tag", + }, } `); - }); + }); - it('should return tagParts for Version tag', () => { - const result = getCalverTagParts(mockReleaseVersionCalver.tagName); + it('should return error for invalid calver (missing padded zero)', () => { + const result = getCalverTagParts('rc-2020.1.01_1'); - expect(result).toMatchInlineSnapshot(` + expect(result).toMatchInlineSnapshot(` Object { - "calver": "2020.01.01", - "patch": 1, - "prefix": "version", + "error": Object { + "subtitle": "Expected calver matching \\"/(rc|version)-([0-9]{4}\\\\.[0-9]{2}\\\\.[0-9]{2})_([0-9]+)/\\", found \\"rc-2020.1.01_1\\"", + "title": "Invalid tag", + }, } `); - }); + }); - it('should return null for invalid prefix', () => { - expect(() => - getCalverTagParts('invalid-2020.01.01_1'), - ).toThrowErrorMatchingInlineSnapshot(`"Invalid calver tag"`); - }); + it('should return error for invalid calver (missing day)', () => { + const result = getCalverTagParts('rc-2020.01_1'); - it('should return null for invalid calver (missing padded zero)', () => { - expect(() => - getCalverTagParts('rc-2020.1.01_1'), - ).toThrowErrorMatchingInlineSnapshot(`"Invalid calver tag"`); - }); + expect(result).toMatchInlineSnapshot(` + Object { + "error": Object { + "subtitle": "Expected calver matching \\"/(rc|version)-([0-9]{4}\\\\.[0-9]{2}\\\\.[0-9]{2})_([0-9]+)/\\", found \\"rc-2020.01_1\\"", + "title": "Invalid tag", + }, + } + `); + }); - it('should return null for invalid calver (missing day)', () => { - expect(() => - getCalverTagParts('rc-2020.01_1'), - ).toThrowErrorMatchingInlineSnapshot(`"Invalid calver tag"`); - }); + it('should return error for invalid patch (letter instead of number)', () => { + const result = getCalverTagParts('rc-2020.01.01_a'); - it('should return null for invalid patch (letter instead of number)', () => { - expect(() => - getCalverTagParts('rc-2020.01.01_a'), - ).toThrowErrorMatchingInlineSnapshot(`"Invalid calver tag"`); + expect(result).toMatchInlineSnapshot(` + Object { + "error": Object { + "subtitle": "Expected calver matching \\"/(rc|version)-([0-9]{4}\\\\.[0-9]{2}\\\\.[0-9]{2})_([0-9]+)/\\", found \\"rc-2020.01.01_a\\"", + "title": "Invalid tag", + }, + } + `); + }); }); }); diff --git a/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.ts b/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.ts index 0fdd31444e..09f3b3e3d5 100644 --- a/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.ts +++ b/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { GitHubReleaseManagerError } from '../../errors/GitHubReleaseManagerError'; +import { AlertError } from '../../types/types'; export type CalverTagParts = { prefix: string; @@ -25,17 +25,26 @@ export type CalverTagParts = { export const calverRegexp = /(rc|version)-([0-9]{4}\.[0-9]{2}\.[0-9]{2})_([0-9]+)/; export function getCalverTagParts(tag: string) { - const result = tag.match(calverRegexp); + const match = tag.match(calverRegexp); - if (result === null || result.length < 4) { - throw new GitHubReleaseManagerError('Invalid calver tag'); + if (match === null || match.length < 4) { + const error: AlertError = { + title: 'Invalid tag', + subtitle: `Expected calver matching "${calverRegexp}", found "${tag}"`, + }; + + return { + error, + }; } const tagParts: CalverTagParts = { - prefix: result[1], - calver: result[2], - patch: parseInt(result[3], 10), + prefix: match[1], + calver: match[2], + patch: parseInt(match[3], 10), }; - return tagParts; + return { + tagParts, + }; } diff --git a/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.test.ts b/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.test.ts index 9977ab7add..4a5e218eaf 100644 --- a/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.test.ts +++ b/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.test.ts @@ -21,43 +21,80 @@ import { import { getSemverTagParts } from './getSemverTagParts'; describe('getSemverTagParts', () => { - it('should return tagParts for RC tag', () => - expect(getSemverTagParts(mockReleaseCandidateSemver.tagName)) - .toMatchInlineSnapshot(` - Object { - "major": 1, - "minor": 2, - "patch": 3, - "prefix": "rc", - } - `)); + describe('happy path', () => { + it('should return tagParts for RC tag', () => { + const semverTagParts = getSemverTagParts( + mockReleaseCandidateSemver.tagName, + ); - it('should return tagParts for Version tag', () => - expect(getSemverTagParts(mockReleaseVersionSemver.tagName)) - .toMatchInlineSnapshot(` - Object { - "major": 1, - "minor": 2, - "patch": 3, - "prefix": "version", - } - `)); + expect(semverTagParts).toMatchInlineSnapshot(` + Object { + "tagParts": Object { + "major": 1, + "minor": 2, + "patch": 3, + "prefix": "rc", + }, + } + `); + }); - it('should throw for invalid prefix', () => { - expect(() => - getSemverTagParts('invalid-1.2.3'), - ).toThrowErrorMatchingInlineSnapshot(`"Invalid semver tag"`); + it('should return tagParts for Version tag', () => { + const semverTagParts = getSemverTagParts( + mockReleaseVersionSemver.tagName, + ); + + expect(semverTagParts).toMatchInlineSnapshot(` + Object { + "tagParts": Object { + "major": 1, + "minor": 2, + "patch": 3, + "prefix": "version", + }, + } + `); + }); }); - it('should throw for invalid semver (missing patch)', () => { - expect(() => - getSemverTagParts('rc-1.2'), - ).toThrowErrorMatchingInlineSnapshot(`"Invalid semver tag"`); - }); + describe('invalid semver tags', () => { + it('should return error for invalid prefix', () => { + const semverTagParts = getSemverTagParts('invalid-1.2.3'); - it('should throw for invalid semver (founds calver)', () => { - expect(() => - getSemverTagParts('rc-1337.01.01_1'), - ).toThrowErrorMatchingInlineSnapshot(`"Invalid semver tag, found calver"`); + expect(semverTagParts).toMatchInlineSnapshot(` + Object { + "error": Object { + "subtitle": "Expected semver matching \\"/(rc|version)-([0-9]+)\\\\.([0-9]+)\\\\.([0-9]+)/\\", found \\"invalid-1.2.3\\"", + "title": "Invalid tag", + }, + } + `); + }); + + it('should return error for invalid semver (missing patch)', () => { + const semverTagParts = getSemverTagParts('rc-1.2'); + + expect(semverTagParts).toMatchInlineSnapshot(` + Object { + "error": Object { + "subtitle": "Expected semver matching \\"/(rc|version)-([0-9]+)\\\\.([0-9]+)\\\\.([0-9]+)/\\", found \\"rc-1.2\\"", + "title": "Invalid tag", + }, + } + `); + }); + + it('should return error for invalid semver (founds calver)', () => { + const semverTagParts = getSemverTagParts('rc-1337.01.01_1'); + + expect(semverTagParts).toMatchInlineSnapshot(` + Object { + "error": Object { + "subtitle": "Expected semver matching \\"/(rc|version)-([0-9]+)\\\\.([0-9]+)\\\\.([0-9]+)/\\", found calver \\"rc-1337.01.01_1\\"", + "title": "Invalid tag", + }, + } + `); + }); }); }); diff --git a/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.ts b/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.ts index 018dedcee0..8f5d53f488 100644 --- a/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.ts +++ b/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { GitHubReleaseManagerError } from '../../errors/GitHubReleaseManagerError'; +import { AlertError } from '../../types/types'; import { calverRegexp } from './getCalverTagParts'; export type SemverTagParts = { @@ -24,23 +24,41 @@ export type SemverTagParts = { patch: number; }; -export function getSemverTagParts(tag: string) { - const result = tag.match(/(rc|version)-([0-9]+)\.([0-9]+)\.([0-9]+)/); +export const semverRegexp = /(rc|version)-([0-9]+)\.([0-9]+)\.([0-9]+)/; - if (result === null || result.length < 4) { - throw new GitHubReleaseManagerError('Invalid semver tag'); +export function getSemverTagParts(tag: string) { + const match = tag.match(semverRegexp); + + if (match === null || match.length < 4) { + const error: AlertError = { + title: 'Invalid tag', + subtitle: `Expected semver matching "${semverRegexp}", found "${tag}"`, + }; + + return { + error, + }; } if (tag.match(calverRegexp)) { - throw new GitHubReleaseManagerError('Invalid semver tag, found calver'); + const error: AlertError = { + title: 'Invalid tag', + subtitle: `Expected semver matching "${semverRegexp}", found calver "${tag}"`, + }; + + return { + error, + }; } const tagParts: SemverTagParts = { - prefix: result[1], - major: parseInt(result[2], 10), - minor: parseInt(result[3], 10), - patch: parseInt(result[4], 10), + prefix: match[1], + major: parseInt(match[2], 10), + minor: parseInt(match[3], 10), + patch: parseInt(match[4], 10), }; - return tagParts; + return { + tagParts, + }; } diff --git a/plugins/github-release-manager/src/helpers/tagParts/validateTagName.ts b/plugins/github-release-manager/src/helpers/tagParts/validateTagName.ts new file mode 100644 index 0000000000..e7d6124c81 --- /dev/null +++ b/plugins/github-release-manager/src/helpers/tagParts/validateTagName.ts @@ -0,0 +1,47 @@ +/* + * 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 { getCalverTagParts } from './getCalverTagParts'; +import { getSemverTagParts } from './getSemverTagParts'; +import { Project } from '../../contexts/ProjectContext'; + +export const validateTagName = ({ + project, + tagName, +}: { + project: Project; + tagName?: string; +}) => { + if (!tagName) { + return { + tagNameError: null, + }; + } + + if (project.versioningStrategy === 'calver') { + const { error } = getCalverTagParts(tagName); + + return { + tagNameError: error, + }; + } + + const { error } = getSemverTagParts(tagName); + + return { + tagNameError: error, + }; +}; diff --git a/plugins/github-release-manager/src/helpers/tagParts/validateTagParts.test.ts b/plugins/github-release-manager/src/helpers/tagParts/validateTagParts.test.ts new file mode 100644 index 0000000000..cf0147db40 --- /dev/null +++ b/plugins/github-release-manager/src/helpers/tagParts/validateTagParts.test.ts @@ -0,0 +1,120 @@ +/* + * 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 { + mockCalverProject, + mockReleaseCandidateCalver, + mockReleaseCandidateSemver, + mockSemverProject, +} from '../../test-helpers/test-helpers'; +import { validateTagName } from './validateTagName'; + +describe('validateTagName', () => { + describe('valid tags', () => { + it('should not return any error for valid semver project', () => { + const result = validateTagName({ + project: mockSemverProject, + tagName: mockReleaseCandidateSemver.tagName, + }); + + expect(result).toMatchInlineSnapshot(` + Object { + "tagNameError": undefined, + } + `); + }); + + it('should not return any error for semver project without any releases (i.e. no tagName)', () => { + const result = validateTagName({ + project: mockSemverProject, + }); + + expect(result).toMatchInlineSnapshot(` + Object { + "tagNameError": null, + } + `); + }); + }); + + describe('mismatching tags', () => { + it('should return error for semver project and calver tag', () => { + const result = validateTagName({ + project: mockSemverProject, + tagName: mockReleaseCandidateCalver.tagName, + }); + + expect(result).toMatchInlineSnapshot(` + Object { + "tagNameError": Object { + "subtitle": "Expected semver matching \\"/(rc|version)-([0-9]+)\\\\.([0-9]+)\\\\.([0-9]+)/\\", found calver \\"rc-2020.01.01_1\\"", + "title": "Invalid tag", + }, + } + `); + }); + + it('should return error for calver project and semver tag', () => { + const result = validateTagName({ + project: mockCalverProject, + tagName: mockReleaseCandidateSemver.tagName, + }); + + expect(result).toMatchInlineSnapshot(` + Object { + "tagNameError": Object { + "subtitle": "Expected calver matching \\"/(rc|version)-([0-9]{4}\\\\.[0-9]{2}\\\\.[0-9]{2})_([0-9]+)/\\", found \\"rc-1.2.3\\"", + "title": "Invalid tag", + }, + } + `); + }); + }); + + describe('invalid tags', () => { + it('should return error for semver project and totally invalid tag', () => { + const result = validateTagName({ + project: mockSemverProject, + tagName: 'this-is-so-invalid', + }); + + expect(result).toMatchInlineSnapshot(` + Object { + "tagNameError": Object { + "subtitle": "Expected semver matching \\"/(rc|version)-([0-9]+)\\\\.([0-9]+)\\\\.([0-9]+)/\\", found \\"this-is-so-invalid\\"", + "title": "Invalid tag", + }, + } + `); + }); + + it('should return error for calver project and totally invalid tag', () => { + const result = validateTagName({ + project: mockCalverProject, + tagName: 'this-is-so-invalid', + }); + + expect(result).toMatchInlineSnapshot(` + Object { + "tagNameError": Object { + "subtitle": "Expected calver matching \\"/(rc|version)-([0-9]{4}\\\\.[0-9]{2}\\\\.[0-9]{2})_([0-9]+)/\\", found \\"this-is-so-invalid\\"", + "title": "Invalid tag", + }, + } + `); + }); + }); +}); diff --git a/plugins/github-release-manager/src/hooks/useVersioningStrategyMatchesRepoTags.ts b/plugins/github-release-manager/src/hooks/useVersioningStrategyMatchesRepoTags.ts index 321b5d4b83..032a5280a1 100644 --- a/plugins/github-release-manager/src/hooks/useVersioningStrategyMatchesRepoTags.ts +++ b/plugins/github-release-manager/src/hooks/useVersioningStrategyMatchesRepoTags.ts @@ -35,13 +35,9 @@ export const useVersioningStrategyMatchesRepoTags = ({ setVersioningStrategyMatches(false); if (latestReleaseTagName) { - try { - if (project.repo === repositoryName) { - getTagParts({ project, tag: latestReleaseTagName }); - setVersioningStrategyMatches(true); - } - } catch (error) { - setVersioningStrategyMatches(false); + if (project.repo === repositoryName) { + const { error } = getTagParts({ project, tag: latestReleaseTagName }); + setVersioningStrategyMatches(error === undefined); } } }, [latestReleaseTagName, project, repositoryName]); diff --git a/plugins/github-release-manager/src/types/types.ts b/plugins/github-release-manager/src/types/types.ts index c888c7e539..ece840fa5f 100644 --- a/plugins/github-release-manager/src/types/types.ts +++ b/plugins/github-release-manager/src/types/types.ts @@ -61,3 +61,8 @@ export interface CardHook { run: (args: RunArgs) => Promise; runInvoked: boolean; } + +export interface AlertError { + title?: string; + subtitle: string; +} From 5f8bae8779ff340b3fea54015e54f40a72d63677 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Fri, 23 Apr 2021 00:12:28 +0200 Subject: [PATCH 102/485] Rename Cards to Features Signed-off-by: Erik Engervall --- plugins/github-release-manager/README.md | 2 +- .../src/GitHubReleaseManager.tsx | 8 ++++-- .../src/components/InfoCardPlus.test.tsx | 2 +- .../src/components/InfoCardPlus.tsx | 6 ++-- .../CreateRc/CreateRc.test.tsx | 0 .../{cards => features}/CreateRc/CreateRc.tsx | 0 .../CreateRc/hooks/useCreateRc.test.tsx | 0 .../CreateRc/hooks/useCreateRc.ts | 0 .../Features.test.tsx} | 22 +++++++++++--- .../Cards.tsx => features/Features.tsx} | 2 +- .../{cards => features}/Info/Info.test.tsx | 0 .../src/{cards => features}/Info/Info.tsx | 27 ++++++++++++------ .../src/{cards => features}/Info/flow.png | Bin .../{cards => features}/Patch/Patch.test.tsx | 0 .../src/{cards => features}/Patch/Patch.tsx | 0 .../Patch/PatchBody.test.tsx | 0 .../{cards => features}/Patch/PatchBody.tsx | 0 .../Patch/hooks/usePatch.test.ts | 0 .../Patch/hooks/usePatch.ts | 0 .../PromoteRc/PromoteRc.test.tsx | 0 .../PromoteRc/PromoteRc.tsx | 0 .../PromoteRc/PromoteRcBody.test.tsx | 0 .../PromoteRc/PromoteRcBody.tsx | 0 .../PromoteRc/hooks/usePromoteRc.test.ts | 0 .../PromoteRc/hooks/usePromoteRc.ts | 0 .../RepoDetailsForm/Owner.test.tsx | 0 .../RepoDetailsForm/Owner.tsx | 0 .../RepoDetailsForm/Repo.test.tsx | 0 .../RepoDetailsForm/Repo.tsx | 0 .../RepoDetailsForm/RepoDetailsForm.tsx | 0 .../VersioningStrategy.test.tsx | 0 .../RepoDetailsForm/VersioningStrategy.tsx | 0 .../RepoDetailsForm/styles.ts | 0 .../src/test-helpers/test-ids.test.ts | 2 +- .../src/test-helpers/test-ids.ts | 2 +- 35 files changed, 50 insertions(+), 23 deletions(-) rename plugins/github-release-manager/src/{cards => features}/CreateRc/CreateRc.test.tsx (100%) rename plugins/github-release-manager/src/{cards => features}/CreateRc/CreateRc.tsx (100%) rename plugins/github-release-manager/src/{cards => features}/CreateRc/hooks/useCreateRc.test.tsx (100%) rename plugins/github-release-manager/src/{cards => features}/CreateRc/hooks/useCreateRc.ts (100%) rename plugins/github-release-manager/src/{cards/Cards.test.tsx => features/Features.test.tsx} (84%) rename plugins/github-release-manager/src/{cards/Cards.tsx => features/Features.tsx} (99%) rename plugins/github-release-manager/src/{cards => features}/Info/Info.test.tsx (100%) rename plugins/github-release-manager/src/{cards => features}/Info/Info.tsx (88%) rename plugins/github-release-manager/src/{cards => features}/Info/flow.png (100%) rename plugins/github-release-manager/src/{cards => features}/Patch/Patch.test.tsx (100%) rename plugins/github-release-manager/src/{cards => features}/Patch/Patch.tsx (100%) rename plugins/github-release-manager/src/{cards => features}/Patch/PatchBody.test.tsx (100%) rename plugins/github-release-manager/src/{cards => features}/Patch/PatchBody.tsx (100%) rename plugins/github-release-manager/src/{cards => features}/Patch/hooks/usePatch.test.ts (100%) rename plugins/github-release-manager/src/{cards => features}/Patch/hooks/usePatch.ts (100%) rename plugins/github-release-manager/src/{cards => features}/PromoteRc/PromoteRc.test.tsx (100%) rename plugins/github-release-manager/src/{cards => features}/PromoteRc/PromoteRc.tsx (100%) rename plugins/github-release-manager/src/{cards => features}/PromoteRc/PromoteRcBody.test.tsx (100%) rename plugins/github-release-manager/src/{cards => features}/PromoteRc/PromoteRcBody.tsx (100%) rename plugins/github-release-manager/src/{cards => features}/PromoteRc/hooks/usePromoteRc.test.ts (100%) rename plugins/github-release-manager/src/{cards => features}/PromoteRc/hooks/usePromoteRc.ts (100%) rename plugins/github-release-manager/src/{cards => features}/RepoDetailsForm/Owner.test.tsx (100%) rename plugins/github-release-manager/src/{cards => features}/RepoDetailsForm/Owner.tsx (100%) rename plugins/github-release-manager/src/{cards => features}/RepoDetailsForm/Repo.test.tsx (100%) rename plugins/github-release-manager/src/{cards => features}/RepoDetailsForm/Repo.tsx (100%) rename plugins/github-release-manager/src/{cards => features}/RepoDetailsForm/RepoDetailsForm.tsx (100%) rename plugins/github-release-manager/src/{cards => features}/RepoDetailsForm/VersioningStrategy.test.tsx (100%) rename plugins/github-release-manager/src/{cards => features}/RepoDetailsForm/VersioningStrategy.tsx (100%) rename plugins/github-release-manager/src/{cards => features}/RepoDetailsForm/styles.ts (100%) diff --git a/plugins/github-release-manager/README.md b/plugins/github-release-manager/README.md index 43c842bc26..2a99912576 100644 --- a/plugins/github-release-manager/README.md +++ b/plugins/github-release-manager/README.md @@ -10,7 +10,7 @@ What `GRM` does is manage your **[releases](https://docs.github.com/en/github/ad `GRM` is built with industry standards in mind and the flow is as follows: -![](./src/cards/info/flow.png) +![](./src/features/Info/flow.png) > **GitHub**: The source control system where releases reside in a practical sense. Read more about [GitHub releases](https://docs.github.com/en/github/administering-a-repository/managing-releases-in-a-repository). (Note that this plugin works just as well with GitHub Enterprise.) > diff --git a/plugins/github-release-manager/src/GitHubReleaseManager.tsx b/plugins/github-release-manager/src/GitHubReleaseManager.tsx index ff77e8bbe4..348d4a0578 100644 --- a/plugins/github-release-manager/src/GitHubReleaseManager.tsx +++ b/plugins/github-release-manager/src/GitHubReleaseManager.tsx @@ -25,14 +25,14 @@ import { ComponentConfigPatch, ComponentConfigPromoteRc, } from './types/types'; -import { Cards } from './cards/Cards'; +import { Features } from './features/Features'; import { CenteredCircularProgress } from './components/CenteredCircularProgress'; import { githubReleaseManagerApiRef } from './api/serviceApiRef'; import { InfoCardPlus } from './components/InfoCardPlus'; import { isProjectValid } from './helpers/isProjectValid'; import { PluginApiClientContext } from './contexts/PluginApiClientContext'; import { ProjectContext, Project } from './contexts/ProjectContext'; -import { RepoDetailsForm } from './cards/RepoDetailsForm/RepoDetailsForm'; +import { RepoDetailsForm } from './features/RepoDetailsForm/RepoDetailsForm'; import { useQueryHandler } from './hooks/useQueryHandler'; import { useStyles } from './styles/styles'; @@ -90,7 +90,9 @@ export function GitHubReleaseManager(props: GitHubReleaseManagerProps) { - {isProjectValid(project) && } + {isProjectValid(project) && ( + + )}
diff --git a/plugins/github-release-manager/src/components/InfoCardPlus.test.tsx b/plugins/github-release-manager/src/components/InfoCardPlus.test.tsx index efd30b67da..01ed7aa4e8 100644 --- a/plugins/github-release-manager/src/components/InfoCardPlus.test.tsx +++ b/plugins/github-release-manager/src/components/InfoCardPlus.test.tsx @@ -24,6 +24,6 @@ describe('InfoCardPlus', () => { it('render InfoCardPlus', () => { const { getByTestId } = render(); - expect(getByTestId(TEST_IDS.info.infoCardPlus)).toBeInTheDocument(); + expect(getByTestId(TEST_IDS.info.infoFeaturePlus)).toBeInTheDocument(); }); }); diff --git a/plugins/github-release-manager/src/components/InfoCardPlus.tsx b/plugins/github-release-manager/src/components/InfoCardPlus.tsx index 38e3c5f388..fe2da57402 100644 --- a/plugins/github-release-manager/src/components/InfoCardPlus.tsx +++ b/plugins/github-release-manager/src/components/InfoCardPlus.tsx @@ -21,7 +21,7 @@ import { makeStyles } from '@material-ui/core'; import { TEST_IDS } from '../test-helpers/test-ids'; const useStyles = makeStyles(() => ({ - card: { + feature: { marginBottom: '3em', }, })); @@ -32,9 +32,9 @@ export const InfoCardPlus = ({ children }: { children?: React.ReactNode }) => { return (
- {children} + {children}
); }; diff --git a/plugins/github-release-manager/src/cards/CreateRc/CreateRc.test.tsx b/plugins/github-release-manager/src/features/CreateRc/CreateRc.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/CreateRc/CreateRc.test.tsx rename to plugins/github-release-manager/src/features/CreateRc/CreateRc.test.tsx diff --git a/plugins/github-release-manager/src/cards/CreateRc/CreateRc.tsx b/plugins/github-release-manager/src/features/CreateRc/CreateRc.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/CreateRc/CreateRc.tsx rename to plugins/github-release-manager/src/features/CreateRc/CreateRc.tsx diff --git a/plugins/github-release-manager/src/cards/CreateRc/hooks/useCreateRc.test.tsx b/plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/CreateRc/hooks/useCreateRc.test.tsx rename to plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.test.tsx diff --git a/plugins/github-release-manager/src/cards/CreateRc/hooks/useCreateRc.ts b/plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.ts similarity index 100% rename from plugins/github-release-manager/src/cards/CreateRc/hooks/useCreateRc.ts rename to plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.ts diff --git a/plugins/github-release-manager/src/cards/Cards.test.tsx b/plugins/github-release-manager/src/features/Features.test.tsx similarity index 84% rename from plugins/github-release-manager/src/cards/Cards.test.tsx rename to plugins/github-release-manager/src/features/Features.test.tsx index 8546c09cef..fd81b276cf 100644 --- a/plugins/github-release-manager/src/cards/Cards.test.tsx +++ b/plugins/github-release-manager/src/features/Features.test.tsx @@ -31,12 +31,12 @@ jest.mock('../contexts/ProjectContext', () => ({ }), })); -import { Cards } from './Cards'; +import { Features } from './Features'; -describe('Cards', () => { - it('should omit cards omitted via configuration', async () => { +describe('Features', () => { + it('should omit features omitted via configuration', async () => { const { getByTestId } = render( - { : A GitHub release intended for end users

+ `); }); diff --git a/plugins/github-release-manager/src/cards/Cards.tsx b/plugins/github-release-manager/src/features/Features.tsx similarity index 99% rename from plugins/github-release-manager/src/cards/Cards.tsx rename to plugins/github-release-manager/src/features/Features.tsx index e47181ba4a..673c9f5696 100644 --- a/plugins/github-release-manager/src/cards/Cards.tsx +++ b/plugins/github-release-manager/src/features/Features.tsx @@ -31,7 +31,7 @@ import { useProjectContext } from '../contexts/ProjectContext'; import { useVersioningStrategyMatchesRepoTags } from '../hooks/useVersioningStrategyMatchesRepoTags'; import { validateTagName } from '../helpers/tagParts/validateTagName'; -export function Cards({ +export function Features({ components, }: { components: GitHubReleaseManagerProps['components']; diff --git a/plugins/github-release-manager/src/cards/Info/Info.test.tsx b/plugins/github-release-manager/src/features/Info/Info.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/Info/Info.test.tsx rename to plugins/github-release-manager/src/features/Info/Info.test.tsx diff --git a/plugins/github-release-manager/src/cards/Info/Info.tsx b/plugins/github-release-manager/src/features/Info/Info.tsx similarity index 88% rename from plugins/github-release-manager/src/cards/Info/Info.tsx rename to plugins/github-release-manager/src/features/Info/Info.tsx index 72a61a38e6..ff431930d8 100644 --- a/plugins/github-release-manager/src/cards/Info/Info.tsx +++ b/plugins/github-release-manager/src/features/Info/Info.tsx @@ -14,19 +14,20 @@ * limitations under the License. */ -import React from 'react'; -import { Link, Typography } from '@material-ui/core'; +import React, { useState } from 'react'; +import { Link, Typography, Button } from '@material-ui/core'; -import { Differ } from '../../components/Differ'; -import { InfoCardPlus } from '../../components/InfoCardPlus'; -import { TEST_IDS } from '../../test-helpers/test-ids'; -import { useProjectContext } from '../../contexts/ProjectContext'; -import { useStyles } from '../../styles/styles'; -import flowImage from './flow.png'; import { GetBranchResult, GetLatestReleaseResult, } from '../../api/PluginApiClient'; +import { Differ } from '../../components/Differ'; +import { InfoCardPlus } from '../../components/InfoCardPlus'; +import { Stats } from '../../components/Stats/Stats'; +import { TEST_IDS } from '../../test-helpers/test-ids'; +import { useProjectContext } from '../../contexts/ProjectContext'; +import { useStyles } from '../../styles/styles'; +import flowImage from './flow.png'; interface InfoCardProps { releaseBranch: GetBranchResult | null; @@ -36,6 +37,7 @@ interface InfoCardProps { export const Info = ({ releaseBranch, latestRelease }: InfoCardProps) => { const { project } = useProjectContext(); const classes = useStyles(); + const [showStats, setShowStats] = useState(false); return ( @@ -63,6 +65,15 @@ export const Info = ({ releaseBranch, latestRelease }: InfoCardProps) => { Release Version: A GitHub release intended for end users + + + {showStats && }
diff --git a/plugins/github-release-manager/src/cards/Info/flow.png b/plugins/github-release-manager/src/features/Info/flow.png similarity index 100% rename from plugins/github-release-manager/src/cards/Info/flow.png rename to plugins/github-release-manager/src/features/Info/flow.png diff --git a/plugins/github-release-manager/src/cards/Patch/Patch.test.tsx b/plugins/github-release-manager/src/features/Patch/Patch.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/Patch/Patch.test.tsx rename to plugins/github-release-manager/src/features/Patch/Patch.test.tsx diff --git a/plugins/github-release-manager/src/cards/Patch/Patch.tsx b/plugins/github-release-manager/src/features/Patch/Patch.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/Patch/Patch.tsx rename to plugins/github-release-manager/src/features/Patch/Patch.tsx diff --git a/plugins/github-release-manager/src/cards/Patch/PatchBody.test.tsx b/plugins/github-release-manager/src/features/Patch/PatchBody.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/Patch/PatchBody.test.tsx rename to plugins/github-release-manager/src/features/Patch/PatchBody.test.tsx diff --git a/plugins/github-release-manager/src/cards/Patch/PatchBody.tsx b/plugins/github-release-manager/src/features/Patch/PatchBody.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/Patch/PatchBody.tsx rename to plugins/github-release-manager/src/features/Patch/PatchBody.tsx diff --git a/plugins/github-release-manager/src/cards/Patch/hooks/usePatch.test.ts b/plugins/github-release-manager/src/features/Patch/hooks/usePatch.test.ts similarity index 100% rename from plugins/github-release-manager/src/cards/Patch/hooks/usePatch.test.ts rename to plugins/github-release-manager/src/features/Patch/hooks/usePatch.test.ts diff --git a/plugins/github-release-manager/src/cards/Patch/hooks/usePatch.ts b/plugins/github-release-manager/src/features/Patch/hooks/usePatch.ts similarity index 100% rename from plugins/github-release-manager/src/cards/Patch/hooks/usePatch.ts rename to plugins/github-release-manager/src/features/Patch/hooks/usePatch.ts diff --git a/plugins/github-release-manager/src/cards/PromoteRc/PromoteRc.test.tsx b/plugins/github-release-manager/src/features/PromoteRc/PromoteRc.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/PromoteRc/PromoteRc.test.tsx rename to plugins/github-release-manager/src/features/PromoteRc/PromoteRc.test.tsx diff --git a/plugins/github-release-manager/src/cards/PromoteRc/PromoteRc.tsx b/plugins/github-release-manager/src/features/PromoteRc/PromoteRc.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/PromoteRc/PromoteRc.tsx rename to plugins/github-release-manager/src/features/PromoteRc/PromoteRc.tsx diff --git a/plugins/github-release-manager/src/cards/PromoteRc/PromoteRcBody.test.tsx b/plugins/github-release-manager/src/features/PromoteRc/PromoteRcBody.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/PromoteRc/PromoteRcBody.test.tsx rename to plugins/github-release-manager/src/features/PromoteRc/PromoteRcBody.test.tsx diff --git a/plugins/github-release-manager/src/cards/PromoteRc/PromoteRcBody.tsx b/plugins/github-release-manager/src/features/PromoteRc/PromoteRcBody.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/PromoteRc/PromoteRcBody.tsx rename to plugins/github-release-manager/src/features/PromoteRc/PromoteRcBody.tsx diff --git a/plugins/github-release-manager/src/cards/PromoteRc/hooks/usePromoteRc.test.ts b/plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.test.ts similarity index 100% rename from plugins/github-release-manager/src/cards/PromoteRc/hooks/usePromoteRc.test.ts rename to plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.test.ts diff --git a/plugins/github-release-manager/src/cards/PromoteRc/hooks/usePromoteRc.ts b/plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts similarity index 100% rename from plugins/github-release-manager/src/cards/PromoteRc/hooks/usePromoteRc.ts rename to plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts diff --git a/plugins/github-release-manager/src/cards/RepoDetailsForm/Owner.test.tsx b/plugins/github-release-manager/src/features/RepoDetailsForm/Owner.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/RepoDetailsForm/Owner.test.tsx rename to plugins/github-release-manager/src/features/RepoDetailsForm/Owner.test.tsx diff --git a/plugins/github-release-manager/src/cards/RepoDetailsForm/Owner.tsx b/plugins/github-release-manager/src/features/RepoDetailsForm/Owner.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/RepoDetailsForm/Owner.tsx rename to plugins/github-release-manager/src/features/RepoDetailsForm/Owner.tsx diff --git a/plugins/github-release-manager/src/cards/RepoDetailsForm/Repo.test.tsx b/plugins/github-release-manager/src/features/RepoDetailsForm/Repo.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/RepoDetailsForm/Repo.test.tsx rename to plugins/github-release-manager/src/features/RepoDetailsForm/Repo.test.tsx diff --git a/plugins/github-release-manager/src/cards/RepoDetailsForm/Repo.tsx b/plugins/github-release-manager/src/features/RepoDetailsForm/Repo.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/RepoDetailsForm/Repo.tsx rename to plugins/github-release-manager/src/features/RepoDetailsForm/Repo.tsx diff --git a/plugins/github-release-manager/src/cards/RepoDetailsForm/RepoDetailsForm.tsx b/plugins/github-release-manager/src/features/RepoDetailsForm/RepoDetailsForm.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/RepoDetailsForm/RepoDetailsForm.tsx rename to plugins/github-release-manager/src/features/RepoDetailsForm/RepoDetailsForm.tsx diff --git a/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.test.tsx b/plugins/github-release-manager/src/features/RepoDetailsForm/VersioningStrategy.test.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.test.tsx rename to plugins/github-release-manager/src/features/RepoDetailsForm/VersioningStrategy.test.tsx diff --git a/plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.tsx b/plugins/github-release-manager/src/features/RepoDetailsForm/VersioningStrategy.tsx similarity index 100% rename from plugins/github-release-manager/src/cards/RepoDetailsForm/VersioningStrategy.tsx rename to plugins/github-release-manager/src/features/RepoDetailsForm/VersioningStrategy.tsx diff --git a/plugins/github-release-manager/src/cards/RepoDetailsForm/styles.ts b/plugins/github-release-manager/src/features/RepoDetailsForm/styles.ts similarity index 100% rename from plugins/github-release-manager/src/cards/RepoDetailsForm/styles.ts rename to plugins/github-release-manager/src/features/RepoDetailsForm/styles.ts diff --git a/plugins/github-release-manager/src/test-helpers/test-ids.test.ts b/plugins/github-release-manager/src/test-helpers/test-ids.test.ts index 5adcebc3d9..199a7a5745 100644 --- a/plugins/github-release-manager/src/test-helpers/test-ids.test.ts +++ b/plugins/github-release-manager/src/test-helpers/test-ids.test.ts @@ -67,7 +67,7 @@ describe('test-ids', () => { }, "info": Object { "info": "grm--info", - "infoCardPlus": "grm--info-card-plus", + "infoFeaturePlus": "grm--info-feature-plus", }, "patch": Object { "body": "grm--patch-body", diff --git a/plugins/github-release-manager/src/test-helpers/test-ids.ts b/plugins/github-release-manager/src/test-helpers/test-ids.ts index 1beb6aec10..a5b38e93a1 100644 --- a/plugins/github-release-manager/src/test-helpers/test-ids.ts +++ b/plugins/github-release-manager/src/test-helpers/test-ids.ts @@ -17,7 +17,7 @@ export const TEST_IDS = { info: { info: 'grm--info', - infoCardPlus: 'grm--info-card-plus', + infoFeaturePlus: 'grm--info-feature-plus', }, createRc: { cta: 'grm--create-rc--cta', From c33462b440f1ae80443886244cc596f156c7d1b0 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Fri, 23 Apr 2021 00:28:53 +0200 Subject: [PATCH 103/485] Introduce Stats Feature Create two new API calls, getAllTags & getAllReleases Rename "components" prop to more suitable "features" Signed-off-by: Erik Engervall --- plugins/github-release-manager/README.md | 2 +- .../src/GitHubReleaseManager.tsx | 7 +- .../src/api/PluginApiClient.test.ts | 4 + .../src/api/PluginApiClient.ts | 63 ++++++ .../src/features/Features.test.tsx | 16 +- .../src/features/Features.tsx | 19 +- .../src/features/Info/Info.tsx | 49 +++-- .../src/features/Stats/DialogBody.tsx | 194 ++++++++++++++++++ .../src/features/Stats/DialogTitle.tsx | 65 ++++++ .../src/features/Stats/Row.tsx | 131 ++++++++++++ .../src/features/Stats/Stats.tsx | 66 ++++++ .../src/features/Stats/Warn.tsx | 56 +++++ .../src/features/Stats/getMappedReleases.tsx | 74 +++++++ .../src/features/Stats/getSummary.tsx | 45 ++++ .../src/features/Stats/getTags.tsx | 75 +++++++ .../src/features/Stats/hooks/useGetStats.ts | 47 +++++ .../src/test-helpers/test-helpers.test.ts | 4 + .../src/test-helpers/test-helpers.ts | 10 + 18 files changed, 880 insertions(+), 47 deletions(-) create mode 100644 plugins/github-release-manager/src/features/Stats/DialogBody.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/DialogTitle.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/Row.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/Stats.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/Warn.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/getMappedReleases.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/getSummary.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/getTags.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/hooks/useGetStats.ts diff --git a/plugins/github-release-manager/README.md b/plugins/github-release-manager/README.md index 2a99912576..86efc0c069 100644 --- a/plugins/github-release-manager/README.md +++ b/plugins/github-release-manager/README.md @@ -54,6 +54,6 @@ The plugin exports a single full-page extension `GitHubReleaseManagerPage`, whic The plugin is configurable either via props or the select elements on the page. -If project configuration is provided via props, the select elements are disabled. It is also possible to omit components from the page via props, as well as attaching callbacks for successful executions. +If project configuration is provided via props, the select elements are disabled. It is also possible to omit features from the page via props, as well as attaching callbacks for successful executions. See the plugin's dev folder (`dev/index.tsx`) to see some examples. diff --git a/plugins/github-release-manager/src/GitHubReleaseManager.tsx b/plugins/github-release-manager/src/GitHubReleaseManager.tsx index 348d4a0578..f0156af06c 100644 --- a/plugins/github-release-manager/src/GitHubReleaseManager.tsx +++ b/plugins/github-release-manager/src/GitHubReleaseManager.tsx @@ -38,8 +38,9 @@ import { useStyles } from './styles/styles'; export interface GitHubReleaseManagerProps { project?: Omit; - components?: { + features?: { info?: Pick, 'omit'>; + stats?: Pick, 'omit'>; createRc?: ComponentConfigCreateRc; promoteRc?: ComponentConfigPromoteRc; patch?: ComponentConfigPatch; @@ -90,9 +91,7 @@ export function GitHubReleaseManager(props: GitHubReleaseManagerProps) { - {isProjectValid(project) && ( - - )} + {isProjectValid(project) && }
diff --git a/plugins/github-release-manager/src/api/PluginApiClient.test.ts b/plugins/github-release-manager/src/api/PluginApiClient.test.ts index e9db190eef..998e8bc4e8 100644 --- a/plugins/github-release-manager/src/api/PluginApiClient.test.ts +++ b/plugins/github-release-manager/src/api/PluginApiClient.test.ts @@ -57,6 +57,10 @@ describe('PluginApiClient', () => { "promoteRc": Object { "promoteRelease": [Function], }, + "stats": Object { + "getAllReleases": [Function], + "getAllTags": [Function], + }, } `); }); diff --git a/plugins/github-release-manager/src/api/PluginApiClient.ts b/plugins/github-release-manager/src/api/PluginApiClient.ts index e9f8e89f33..31996f8882 100644 --- a/plugins/github-release-manager/src/api/PluginApiClient.ts +++ b/plugins/github-release-manager/src/api/PluginApiClient.ts @@ -562,6 +562,43 @@ ${selectedPatchCommit.commit.message}`, }; }, }; + + stats = { + getAllTags: async ({ owner, repo }: OwnerRepo) => { + const { octokit } = await this.getOctokit(); + + const tags = await octokit.paginate(octokit.repos.listTags, { + owner, + repo, + per_page: 100, + ...DISABLE_CACHE, + }); + + return tags.map(tag => ({ + tagName: tag.name, + })); + }, + + getAllReleases: async ({ owner, repo }: OwnerRepo) => { + const { octokit } = await this.getOctokit(); + + const releases = await octokit.paginate(octokit.repos.listReleases, { + owner, + repo, + per_page: 100, + ...DISABLE_CACHE, + }); + + return releases.map(release => ({ + release, + id: release.id, + name: release.name, + tagName: release.tag_name, + createdAt: release.published_at, + htmlUrl: release.html_url, + })); + }, + }; } type UnboxPromise> = T extends Promise @@ -623,6 +660,28 @@ type GetRecentCommits = ( export type GetRecentCommitsResult = UnboxReturnedPromise; export type GetRecentCommitsResultSingle = UnboxArray; +type GetAllTags = ( + args: OwnerRepo, +) => Promise< + Array<{ + tagName: string; + }> +>; +export type GetAllTagsResult = UnboxReturnedPromise; + +type GetAllReleases = ( + args: OwnerRepo, +) => Promise< + Array<{ + id: number; + name: string | null; + tagName: string; + createdAt: string | null; + htmlUrl: string; + }> +>; +export type GetAllReleasesResult = UnboxReturnedPromise; + type GetLatestRelease = ( args: OwnerRepo, ) => Promise<{ @@ -858,4 +917,8 @@ export interface IPluginApiClient { promoteRc: { promoteRelease: PromoteRelease; }; + stats: { + getAllTags: GetAllTags; + getAllReleases: GetAllReleases; + }; } diff --git a/plugins/github-release-manager/src/features/Features.test.tsx b/plugins/github-release-manager/src/features/Features.test.tsx index fd81b276cf..bccca0e283 100644 --- a/plugins/github-release-manager/src/features/Features.test.tsx +++ b/plugins/github-release-manager/src/features/Features.test.tsx @@ -52,8 +52,8 @@ describe('Features', () => { expect(getByTestId(TEST_IDS.info.info)).toMatchInlineSnapshot(`
{ : A GitHub release intended for end users

-
`); }); diff --git a/plugins/github-release-manager/src/features/Features.tsx b/plugins/github-release-manager/src/features/Features.tsx index 673c9f5696..5d3e2a7151 100644 --- a/plugins/github-release-manager/src/features/Features.tsx +++ b/plugins/github-release-manager/src/features/Features.tsx @@ -32,9 +32,9 @@ import { useVersioningStrategyMatchesRepoTags } from '../hooks/useVersioningStra import { validateTagName } from '../helpers/tagParts/validateTagName'; export function Features({ - components, + features, }: { - components: GitHubReleaseManagerProps['components']; + features: GitHubReleaseManagerProps['features']; }) { const { pluginApiClient } = usePluginApiClientContext(); const { project } = useProjectContext(); @@ -114,34 +114,35 @@ export function Features({ )} - {!components?.info?.omit && ( + {!features?.info?.omit && ( )} - {!components?.createRc?.omit && ( + {!features?.createRc?.omit && ( )} - {!components?.promoteRc?.omit && ( + {!features?.promoteRc?.omit && ( )} - {!components?.patch?.omit && ( + {!features?.patch?.omit && ( )} diff --git a/plugins/github-release-manager/src/features/Info/Info.tsx b/plugins/github-release-manager/src/features/Info/Info.tsx index ff431930d8..063c66adee 100644 --- a/plugins/github-release-manager/src/features/Info/Info.tsx +++ b/plugins/github-release-manager/src/features/Info/Info.tsx @@ -15,7 +15,8 @@ */ import React, { useState } from 'react'; -import { Link, Typography, Button } from '@material-ui/core'; +import { Link, Typography, Button, Box } from '@material-ui/core'; +import BarChartIcon from '@material-ui/icons/BarChart'; import { GetBranchResult, @@ -23,7 +24,7 @@ import { } from '../../api/PluginApiClient'; import { Differ } from '../../components/Differ'; import { InfoCardPlus } from '../../components/InfoCardPlus'; -import { Stats } from '../../components/Stats/Stats'; +import { Stats } from '../Stats/Stats'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { useProjectContext } from '../../contexts/ProjectContext'; import { useStyles } from '../../styles/styles'; @@ -32,16 +33,21 @@ import flowImage from './flow.png'; interface InfoCardProps { releaseBranch: GetBranchResult | null; latestRelease: GetLatestReleaseResult; + statsEnabled: boolean; } -export const Info = ({ releaseBranch, latestRelease }: InfoCardProps) => { +export const Info = ({ + releaseBranch, + latestRelease, + statsEnabled, +}: InfoCardProps) => { const { project } = useProjectContext(); const classes = useStyles(); const [showStats, setShowStats] = useState(false); return ( -
+ Terminology @@ -65,18 +71,9 @@ export const Info = ({ releaseBranch, latestRelease }: InfoCardProps) => { Release Version: A GitHub release intended for end users + - - {showStats && } -
- -
+ Flow @@ -90,9 +87,9 @@ export const Info = ({ releaseBranch, latestRelease }: InfoCardProps) => { flow -
+ -
+ Details @@ -113,7 +110,23 @@ export const Info = ({ releaseBranch, latestRelease }: InfoCardProps) => { Latest release: -
+ + + {statsEnabled && ( + + + + {showStats && } + + )}
); }; diff --git a/plugins/github-release-manager/src/features/Stats/DialogBody.tsx b/plugins/github-release-manager/src/features/Stats/DialogBody.tsx new file mode 100644 index 0000000000..3c2f884417 --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/DialogBody.tsx @@ -0,0 +1,194 @@ +/* + * 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 React from 'react'; +import { Alert } from '@material-ui/lab'; +import { + Box, + makeStyles, + Paper, + Table, + TableBody, + TableCell, + TableContainer, + TableHead, + TableRow, + Typography, +} from '@material-ui/core'; + +import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; +import { getMappedReleases } from './getMappedReleases'; +import { getSummary } from './getSummary'; +import { getTags } from './getTags'; +import { Row } from './Row'; +import { useGetStats } from './hooks/useGetStats'; +import { useProjectContext } from '../../contexts/ProjectContext'; +import { Warn } from './Warn'; + +const useStyles = makeStyles({ + table: { + minWidth: 650, + }, +}); + +export function DialogBody() { + const classes = useStyles(); + const { stats } = useGetStats(); + const { project } = useProjectContext(); + + if (stats.error) { + return ( + Unexpected error: {stats.error.message} + ); + } + + if (stats.loading) { + return ; + } + + if (!stats.value) { + return Couldn't find any stats :(; + } + + const { allReleases, allTags } = stats.value; + const mappedReleases = getMappedReleases({ allReleases, project }); + const tags = getTags({ allTags, project, mappedReleases }); + const summary = getSummary({ mappedReleases }); + const shouldWarn = + tags.unmappable.length > 0 || + tags.unmatched.length > 0 || + mappedReleases.unmatched.length > 0; + + if (shouldWarn) { + // eslint-disable-next-line no-console + console.log("⚠️ Here's a summary of unmapped/unmatched tags/releases", { + unmappableTags: tags.unmappable, + unmatchableTags: tags.unmatched, + unmatchableReleases: mappedReleases.unmatched, + }); + } + + const getDecimalNumber = (n: number) => { + if (isNaN(n)) { + return 0; + } + + if (n.toString().includes('.')) { + return n.toFixed(2); + } + + return n; + }; + + return ( + <> + + + Summary + + Total releases: {summary.totalReleases} + + + + + Release Candidate + + Release Candidate patches: {summary.totalCandidatePatches} + + + + Release Candidate patches per release:{' '} + {getDecimalNumber( + summary.totalCandidatePatches / summary.totalReleases, + )} + + + + + Release Version + + Release Version patches: {summary.totalVersionPatches} + + + + Release Version patches per release:{' '} + {getDecimalNumber( + summary.totalVersionPatches / summary.totalReleases, + )} + + + + + Total + + Patches:{' '} + {summary.totalCandidatePatches + summary.totalVersionPatches} + + + + Patches per release:{' '} + {getDecimalNumber( + (summary.totalCandidatePatches + summary.totalVersionPatches) / + summary.totalReleases, + )} + + + + + + + + + + Release + Created at + # candidate patches + # release patches + + + + + {Object.entries(mappedReleases.releases).map( + ([baseVersion, mappedRelease], index) => { + return ( + + ); + }, + )} + +
+
+ + + {shouldWarn && ( + + )} + + + ); +} diff --git a/plugins/github-release-manager/src/features/Stats/DialogTitle.tsx b/plugins/github-release-manager/src/features/Stats/DialogTitle.tsx new file mode 100644 index 0000000000..92e8d0d588 --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/DialogTitle.tsx @@ -0,0 +1,65 @@ +/* + * 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 React from 'react'; +import { + createStyles, + IconButton, + Theme, + Typography, + withStyles, + WithStyles, +} from '@material-ui/core'; +import CloseIcon from '@material-ui/icons/Close'; +import MuiDialogTitle from '@material-ui/core/DialogTitle'; + +import { Stats } from './Stats'; + +interface DialogTitleProps extends WithStyles { + children: React.ReactNode; + setShowStats: React.ComponentProps['setShowStats']; +} + +const styles = (theme: Theme) => + createStyles({ + root: { + margin: 0, + padding: theme.spacing(2), + }, + closeButton: { + position: 'absolute', + right: theme.spacing(1), + top: theme.spacing(1), + color: theme.palette.grey[500], + }, + }); + +export const DialogTitle = withStyles(styles)((props: DialogTitleProps) => { + const { children, classes, setShowStats, ...other } = props; + + return ( + + {children} + setShowStats(false)} + > + + + + ); +}); diff --git a/plugins/github-release-manager/src/features/Stats/Row.tsx b/plugins/github-release-manager/src/features/Stats/Row.tsx new file mode 100644 index 0000000000..ea95f8e5c2 --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/Row.tsx @@ -0,0 +1,131 @@ +/* + * 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 React, { useState } from 'react'; +import { DateTime } from 'luxon'; +import { + Box, + Collapse, + IconButton, + Link, + makeStyles, + TableCell, + TableRow, + Typography, +} from '@material-ui/core'; +import KeyboardArrowDownIcon from '@material-ui/icons/KeyboardArrowDown'; +import KeyboardArrowUpIcon from '@material-ui/icons/KeyboardArrowUp'; + +import { getMappedReleases } from './getMappedReleases'; + +const useRowStyles = makeStyles({ + root: { + '& > *': { + borderBottom: 'unset', + }, + }, +}); + +interface RowProps { + baseVersion: string; + mappedRelease: ReturnType['releases']['0']; +} + +export function Row({ baseVersion, mappedRelease }: RowProps) { + const [open, setOpen] = useState(false); + const classes = useRowStyles(); + const versions = mappedRelease.versions.reverse(); + const candidates = mappedRelease.candidates.reverse(); + const isPrerelease = versions.length === 0; + + return ( + + + + setOpen(!open)} + > + {open ? : } + + + + + + {baseVersion} + {isPrerelease ? ' (prerelease)' : ''} + + + + + {mappedRelease.createdAt + ? DateTime.fromISO(mappedRelease.createdAt) + .setLocale('sv-SE') + .toFormat('yyyy-MM-dd') + : '-'} + + + {candidates.length} + + {Math.max(0, versions.length - 1)} + + + + + + +
+ {!isPrerelease && ( + + {versions.map(version => ( + + {version} + + ))} + + )} + + {!isPrerelease && ( + + {' 🚀 '} + + )} + + + {candidates.map(candidate => ( + + {candidate} + + ))} + +
+
+
+
+
+
+ ); +} diff --git a/plugins/github-release-manager/src/features/Stats/Stats.tsx b/plugins/github-release-manager/src/features/Stats/Stats.tsx new file mode 100644 index 0000000000..e590c0a320 --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/Stats.tsx @@ -0,0 +1,66 @@ +/* + * 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 React from 'react'; +import { Button, Dialog, Theme, withStyles } from '@material-ui/core'; +import CloseIcon from '@material-ui/icons/Close'; +import MuiDialogActions from '@material-ui/core/DialogActions'; +import MuiDialogContent from '@material-ui/core/DialogContent'; + +import { DialogBody } from './DialogBody'; +import { DialogTitle } from './DialogTitle'; +import { Transition } from '../../components/Transition'; + +const DialogContent = withStyles((theme: Theme) => ({ + root: { + padding: theme.spacing(2), + }, +}))(MuiDialogContent); + +const DialogActions = withStyles((theme: Theme) => ({ + root: { + margin: 0, + padding: theme.spacing(1), + }, +}))(MuiDialogActions); + +interface StatsProps { + setShowStats: React.Dispatch>; +} + +export function Stats({ setShowStats }: StatsProps) { + return ( + + Stats + + + + + + + + + + ); +} diff --git a/plugins/github-release-manager/src/features/Stats/Warn.tsx b/plugins/github-release-manager/src/features/Stats/Warn.tsx new file mode 100644 index 0000000000..ecae90426d --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/Warn.tsx @@ -0,0 +1,56 @@ +/* + * 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 React from 'react'; +import { Alert } from '@material-ui/lab'; + +import { getMappedReleases } from './getMappedReleases'; +import { getTags } from './getTags'; +import { Project } from '../../contexts/ProjectContext'; + +interface WarnProps { + tags: ReturnType; + mappedReleases: ReturnType; + project: Project; +} + +export const Warn = ({ tags, mappedReleases, project }: WarnProps) => { + return ( + + {tags.unmappable.length > 0 && ( +
+ Failed to map {tags.unmappable.length} tags to + releases +
+ )} + + {tags.unmatched.length > 0 && ( +
+ Failed to match {tags.unmatched.length} tags to{' '} + {project.versioningStrategy} +
+ )} + + {mappedReleases.unmatched.length > 0 && ( +
+ Failed to match {mappedReleases.unmatched.length}{' '} + releases to {project.versioningStrategy} +
+ )} +
See full output in the console
+
+ ); +}; diff --git a/plugins/github-release-manager/src/features/Stats/getMappedReleases.tsx b/plugins/github-release-manager/src/features/Stats/getMappedReleases.tsx new file mode 100644 index 0000000000..52a6204589 --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/getMappedReleases.tsx @@ -0,0 +1,74 @@ +/* + * 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 { calverRegexp } from '../../helpers/tagParts/getCalverTagParts'; +import { GetAllReleasesResult } from '../../api/PluginApiClient'; +import { Project } from '../../contexts/ProjectContext'; +import { semverRegexp } from '../../helpers/tagParts/getSemverTagParts'; + +export function getMappedReleases({ + allReleases, + project, +}: { + allReleases: GetAllReleasesResult; + project: Project; +}) { + return allReleases.reduce( + ( + acc: { + unmatched: string[]; + releases: { + [baseVersion: string]: { + createdAt: string | null; + candidates: string[]; + versions: string[]; + htmlUrl: string; + }; + }; + }, + release, + ) => { + const match = + project.versioningStrategy === 'semver' + ? release.tagName.match(semverRegexp) + : release.tagName.match(calverRegexp); + + if (!match) { + acc.unmatched.push(release.tagName); + return acc; + } + + const prefix = match[1]; + const baseVersion = + project.versioningStrategy === 'semver' + ? `${match[2]}.${match[3]}` + : match[2]; + + if (!acc.releases[baseVersion]) { + acc.releases[baseVersion] = { + createdAt: release.createdAt, + candidates: prefix === 'rc' ? [release.tagName] : [], + versions: prefix === 'version' ? [release.tagName] : [], + htmlUrl: release.htmlUrl, + }; + return acc; + } + + return acc; + }, + { unmatched: [], releases: {} }, + ); +} diff --git a/plugins/github-release-manager/src/features/Stats/getSummary.tsx b/plugins/github-release-manager/src/features/Stats/getSummary.tsx new file mode 100644 index 0000000000..f90758987b --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/getSummary.tsx @@ -0,0 +1,45 @@ +/* + * 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 { getMappedReleases } from './getMappedReleases'; + +export function getSummary({ + mappedReleases, +}: { + mappedReleases: ReturnType; +}) { + return Object.entries(mappedReleases.releases).reduce( + ( + acc: { + totalReleases: number; + totalCandidatePatches: number; + totalVersionPatches: number; + }, + [_baseVersion, mappedRelease], + ) => { + acc.totalReleases += 1; + acc.totalCandidatePatches += mappedRelease.candidates.length - 1; + acc.totalVersionPatches += mappedRelease.versions.length - 1; + + return acc; + }, + { + totalReleases: 0, + totalCandidatePatches: 0, + totalVersionPatches: 0, + }, + ); +} diff --git a/plugins/github-release-manager/src/features/Stats/getTags.tsx b/plugins/github-release-manager/src/features/Stats/getTags.tsx new file mode 100644 index 0000000000..4ad38cec17 --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/getTags.tsx @@ -0,0 +1,75 @@ +/* + * 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 { calverRegexp } from '../../helpers/tagParts/getCalverTagParts'; +import { GetAllTagsResult } from '../../api/PluginApiClient'; +import { getMappedReleases } from './getMappedReleases'; +import { Project } from '../../contexts/ProjectContext'; +import { semverRegexp } from '../../helpers/tagParts/getSemverTagParts'; + +export function getTags({ + allTags, + project, + mappedReleases, +}: { + allTags: GetAllTagsResult; + project: Project; + mappedReleases: ReturnType; +}) { + return allTags.reduce( + (acc: { unmatched: string[]; unmappable: string[] }, tag) => { + const match = + project.versioningStrategy === 'semver' + ? tag.tagName.match(semverRegexp) + : tag.tagName.match(calverRegexp); + + if (!match) { + acc.unmatched.push(tag.tagName); + return acc; + } + + const prefix = match[1]; + const baseVersion = + project.versioningStrategy === 'semver' + ? `${match[2]}.${match[3]}` + : match[2]; + + if (!mappedReleases.releases[baseVersion]) { + acc.unmappable.push(tag.tagName); + return acc; + } + + if ( + prefix === 'rc' && + !mappedReleases.releases[baseVersion].candidates.includes(tag.tagName) + ) { + mappedReleases.releases[baseVersion].candidates.push(tag.tagName); + return acc; + } + + if ( + prefix === 'version' && + !mappedReleases.releases[baseVersion].versions.includes(tag.tagName) + ) { + mappedReleases.releases[baseVersion].versions.push(tag.tagName); + return acc; + } + + return acc; + }, + { unmatched: [], unmappable: [] }, + ); +} diff --git a/plugins/github-release-manager/src/features/Stats/hooks/useGetStats.ts b/plugins/github-release-manager/src/features/Stats/hooks/useGetStats.ts new file mode 100644 index 0000000000..f918be0c97 --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/hooks/useGetStats.ts @@ -0,0 +1,47 @@ +/* + * 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 { useAsync } from 'react-use'; + +import { usePluginApiClientContext } from '../../../contexts/PluginApiClientContext'; +import { useProjectContext } from '../../../contexts/ProjectContext'; + +export const useGetStats = () => { + const { pluginApiClient } = usePluginApiClientContext(); + const { project } = useProjectContext(); + + const stats = useAsync(async () => { + const [allReleases, allTags] = await Promise.all([ + pluginApiClient.stats.getAllReleases({ + owner: project.owner, + repo: project.repo, + }), + pluginApiClient.stats.getAllTags({ + owner: project.owner, + repo: project.repo, + }), + ]); + + return { + allReleases, + allTags, + }; + }, [project]); + + return { + stats, + }; +}; diff --git a/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts b/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts index 8dfa3e6fd5..fbd3b690b4 100644 --- a/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts +++ b/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts @@ -49,6 +49,10 @@ describe('testHelpers', () => { "promoteRc": Object { "promoteRelease": [MockFunction], }, + "stats": Object { + "getAllReleases": [MockFunction], + "getAllTags": [MockFunction], + }, }, "mockBumpedTag": "rc-2020.01.01_1337", "mockCalverProject": Object { diff --git a/plugins/github-release-manager/src/test-helpers/test-helpers.ts b/plugins/github-release-manager/src/test-helpers/test-helpers.ts index 735bcd7d48..fc7a5f5c5b 100644 --- a/plugins/github-release-manager/src/test-helpers/test-helpers.ts +++ b/plugins/github-release-manager/src/test-helpers/test-helpers.ts @@ -278,4 +278,14 @@ export const mockApiClient: IPluginApiClient = { htmlUrl: 'mock_release_html_url', })), }, + + stats: { + getAllTags: jest.fn(async () => { + throw new Error('Not implemented'); + }), + + getAllReleases: jest.fn(async () => { + throw new Error('Not implemented'); + }), + }, }; From 4101cecb42ba7581e822089390b49fe5ab1a441e Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Fri, 23 Apr 2021 00:30:47 +0200 Subject: [PATCH 104/485] Minor adjustments for "components" -> "features" renaming Signed-off-by: Erik Engervall --- plugins/github-release-manager/dev/index.tsx | 4 ++-- plugins/github-release-manager/src/features/Features.test.tsx | 2 +- .../github-release-manager/src/features/Info/Info.test.tsx | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/github-release-manager/dev/index.tsx b/plugins/github-release-manager/dev/index.tsx index bca24d56a4..31a6a9a563 100644 --- a/plugins/github-release-manager/dev/index.tsx +++ b/plugins/github-release-manager/dev/index.tsx @@ -74,7 +74,7 @@ createDevApp() Dev notes - Each components can be omitted + Each feature can be omitted Success callbacks can also be added @@ -84,7 +84,7 @@ createDevApp() repo: 'playground-semver', versioningStrategy: 'semver', }} - components={{ + features={{ createRc: { successCb: ({ comparisonUrl, diff --git a/plugins/github-release-manager/src/features/Features.test.tsx b/plugins/github-release-manager/src/features/Features.test.tsx index bccca0e283..d53f542cef 100644 --- a/plugins/github-release-manager/src/features/Features.test.tsx +++ b/plugins/github-release-manager/src/features/Features.test.tsx @@ -37,7 +37,7 @@ describe('Features', () => { it('should omit features omitted via configuration', async () => { const { getByTestId } = render( { , ); From 5e65ce14ff0a649f292e0d061bf2dd8ccfae08d7 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Fri, 23 Apr 2021 00:44:28 +0200 Subject: [PATCH 105/485] Improve coverage of plugin.test.ts Signed-off-by: Erik Engervall --- plugins/github-release-manager/src/plugin.test.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/github-release-manager/src/plugin.test.ts b/plugins/github-release-manager/src/plugin.test.ts index a13dda5688..60ab101d11 100644 --- a/plugins/github-release-manager/src/plugin.test.ts +++ b/plugins/github-release-manager/src/plugin.test.ts @@ -14,10 +14,16 @@ * limitations under the License. */ -import { gitHubReleaseManagerPlugin } from './plugin'; +import * as plugin from './plugin'; describe('github-release-manager', () => { - it('should export plugin', () => { - expect(gitHubReleaseManagerPlugin).toBeDefined(); + it('should export plugin & friends', () => { + expect(Object.keys(plugin)).toMatchInlineSnapshot(` + Array [ + "githubReleaseManagerApiRef", + "gitHubReleaseManagerPlugin", + "GitHubReleaseManagerPage", + ] + `); }); }); From c865a349e4b7e5a74cd34847890fa9b4535a4898 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Fri, 23 Apr 2021 00:51:23 +0200 Subject: [PATCH 106/485] Move usePluginApiClientContext & useProjectContext into hooks where applicable Signed-off-by: Erik Engervall --- .../src/features/CreateRc/CreateRc.test.tsx | 6 ------ .../src/features/CreateRc/CreateRc.tsx | 3 --- .../CreateRc/hooks/useCreateRc.test.tsx | 8 ++++++-- .../src/features/CreateRc/hooks/useCreateRc.ts | 6 +++--- .../src/features/Patch/PatchBody.tsx | 1 - .../src/features/Patch/hooks/usePatch.test.ts | 8 ++++++-- .../src/features/Patch/hooks/usePatch.ts | 5 ++--- .../features/PromoteRc/PromoteRcBody.test.tsx | 16 +--------------- .../src/features/PromoteRc/PromoteRcBody.tsx | 6 ------ .../PromoteRc/hooks/usePromoteRc.test.ts | 17 ++++++++++++----- .../features/PromoteRc/hooks/usePromoteRc.ts | 14 +++++--------- 11 files changed, 35 insertions(+), 55 deletions(-) diff --git a/plugins/github-release-manager/src/features/CreateRc/CreateRc.test.tsx b/plugins/github-release-manager/src/features/CreateRc/CreateRc.test.tsx index 98bf4903ac..3c4a324b25 100644 --- a/plugins/github-release-manager/src/features/CreateRc/CreateRc.test.tsx +++ b/plugins/github-release-manager/src/features/CreateRc/CreateRc.test.tsx @@ -18,7 +18,6 @@ import React from 'react'; import { render } from '@testing-library/react'; import { - mockApiClient, mockCalverProject, mockNextGitHubInfoSemver, mockReleaseBranch, @@ -29,11 +28,6 @@ import { import { TEST_IDS } from '../../test-helpers/test-ids'; import { useCreateRc } from './hooks/useCreateRc'; -jest.mock('../../contexts/PluginApiClientContext', () => ({ - usePluginApiClientContext: () => ({ - pluginApiClient: mockApiClient, - }), -})); jest.mock('../../contexts/ProjectContext', () => ({ useProjectContext: jest.fn(() => ({ project: mockCalverProject, diff --git a/plugins/github-release-manager/src/features/CreateRc/CreateRc.tsx b/plugins/github-release-manager/src/features/CreateRc/CreateRc.tsx index a3c3d33a26..ec3faeea83 100644 --- a/plugins/github-release-manager/src/features/CreateRc/CreateRc.tsx +++ b/plugins/github-release-manager/src/features/CreateRc/CreateRc.tsx @@ -38,7 +38,6 @@ import { ResponseStepDialog } from '../../components/ResponseStepDialog/Response import { SEMVER_PARTS } from '../../constants/constants'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { useCreateRc } from './hooks/useCreateRc'; -import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; import { useProjectContext } from '../../contexts/ProjectContext'; import { useStyles } from '../../styles/styles'; @@ -67,7 +66,6 @@ export const CreateRc = ({ releaseBranch, successCb, }: CreateRcProps) => { - const { pluginApiClient } = usePluginApiClientContext(); const { project } = useProjectContext(); const classes = useStyles(); @@ -88,7 +86,6 @@ export const CreateRc = ({ defaultBranch, latestRelease, nextGitHubInfo, - pluginApiClient, project, successCb, }); diff --git a/plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.test.tsx b/plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.test.tsx index 8da92a4f0e..cf4fa0f5ed 100644 --- a/plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.test.tsx +++ b/plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.test.tsx @@ -26,6 +26,12 @@ import { } from '../../../test-helpers/test-helpers'; import { useCreateRc } from './useCreateRc'; +jest.mock('../../../contexts/PluginApiClientContext', () => ({ + usePluginApiClientContext: () => ({ + pluginApiClient: mockApiClient, + }), +})); + describe('useCreateRc', () => { beforeEach(jest.clearAllMocks); @@ -35,7 +41,6 @@ describe('useCreateRc', () => { defaultBranch: mockDefaultBranch, latestRelease: mockReleaseVersionCalver, nextGitHubInfo: mockNextGitHubInfoCalver, - pluginApiClient: mockApiClient, project: mockCalverProject, }), ); @@ -54,7 +59,6 @@ describe('useCreateRc', () => { defaultBranch: mockDefaultBranch, latestRelease: mockReleaseVersionCalver, nextGitHubInfo: mockNextGitHubInfoCalver, - pluginApiClient: mockApiClient, project: mockCalverProject, successCb: jest.fn(), }), diff --git a/plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.ts b/plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.ts index 2b1b0b688c..30d5a8894f 100644 --- a/plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.ts +++ b/plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.ts @@ -20,19 +20,18 @@ import { useAsync, useAsyncFn } from 'react-use'; import { GetLatestReleaseResult, GetRepositoryResult, - IPluginApiClient, } from '../../../api/PluginApiClient'; import { CardHook, ComponentConfigCreateRc } from '../../../types/types'; import { getRcGitHubInfo } from '../../../helpers/getRcGitHubInfo'; import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; import { Project } from '../../../contexts/ProjectContext'; import { useResponseSteps } from '../../../hooks/useResponseSteps'; +import { usePluginApiClientContext } from '../../../contexts/PluginApiClientContext'; interface CreateRC { defaultBranch: GetRepositoryResult['defaultBranch']; latestRelease: GetLatestReleaseResult; nextGitHubInfo: ReturnType; - pluginApiClient: IPluginApiClient; project: Project; successCb?: ComponentConfigCreateRc['successCb']; } @@ -41,10 +40,11 @@ export function useCreateRc({ defaultBranch, latestRelease, nextGitHubInfo, - pluginApiClient, project, successCb, }: CreateRC): CardHook { + const { pluginApiClient } = usePluginApiClientContext(); + if (nextGitHubInfo.error) { throw new GitHubReleaseManagerError( `Unexpected error: ${ diff --git a/plugins/github-release-manager/src/features/Patch/PatchBody.tsx b/plugins/github-release-manager/src/features/Patch/PatchBody.tsx index ec7b6ab1f3..7c99e66f9e 100644 --- a/plugins/github-release-manager/src/features/Patch/PatchBody.tsx +++ b/plugins/github-release-manager/src/features/Patch/PatchBody.tsx @@ -94,7 +94,6 @@ export const PatchBody = ({ const { progress, responseSteps, run, runInvoked } = usePatch({ bumpedTag, latestRelease, - pluginApiClient, project, tagParts, successCb, diff --git a/plugins/github-release-manager/src/features/Patch/hooks/usePatch.test.ts b/plugins/github-release-manager/src/features/Patch/hooks/usePatch.test.ts index 240d39292c..be25b84809 100644 --- a/plugins/github-release-manager/src/features/Patch/hooks/usePatch.test.ts +++ b/plugins/github-release-manager/src/features/Patch/hooks/usePatch.test.ts @@ -27,6 +27,12 @@ import { } from '../../../test-helpers/test-helpers'; import { usePatch } from './usePatch'; +jest.mock('../../../contexts/PluginApiClientContext', () => ({ + usePluginApiClientContext: () => ({ + pluginApiClient: mockApiClient, + }), +})); + describe('patch', () => { beforeEach(jest.clearAllMocks); @@ -35,7 +41,6 @@ describe('patch', () => { usePatch({ bumpedTag: mockBumpedTag, latestRelease: mockReleaseVersionCalver, - pluginApiClient: mockApiClient, project: mockCalverProject, tagParts: mockTagParts, }), @@ -54,7 +59,6 @@ describe('patch', () => { usePatch({ bumpedTag: mockBumpedTag, latestRelease: mockReleaseVersionCalver, - pluginApiClient: mockApiClient, project: mockCalverProject, tagParts: mockTagParts, successCb: jest.fn(), diff --git a/plugins/github-release-manager/src/features/Patch/hooks/usePatch.ts b/plugins/github-release-manager/src/features/Patch/hooks/usePatch.ts index af7e890ca9..06001f1771 100644 --- a/plugins/github-release-manager/src/features/Patch/hooks/usePatch.ts +++ b/plugins/github-release-manager/src/features/Patch/hooks/usePatch.ts @@ -20,18 +20,17 @@ import { useAsync, useAsyncFn } from 'react-use'; import { GetLatestReleaseResult, GetRecentCommitsResultSingle, - IPluginApiClient, } from '../../../api/PluginApiClient'; import { CalverTagParts } from '../../../helpers/tagParts/getCalverTagParts'; import { ComponentConfigPatch, CardHook } from '../../../types/types'; import { Project } from '../../../contexts/ProjectContext'; import { SemverTagParts } from '../../../helpers/tagParts/getSemverTagParts'; +import { usePluginApiClientContext } from '../../../contexts/PluginApiClientContext'; import { useResponseSteps } from '../../../hooks/useResponseSteps'; interface Patch { bumpedTag: string; latestRelease: NonNullable; - pluginApiClient: IPluginApiClient; project: Project; tagParts: NonNullable; successCb?: ComponentConfigPatch['successCb']; @@ -41,11 +40,11 @@ interface Patch { export function usePatch({ bumpedTag, latestRelease, - pluginApiClient, project, tagParts, successCb, }: Patch): CardHook { + const { pluginApiClient } = usePluginApiClientContext(); const { responseSteps, addStepToResponseSteps, diff --git a/plugins/github-release-manager/src/features/PromoteRc/PromoteRcBody.test.tsx b/plugins/github-release-manager/src/features/PromoteRc/PromoteRcBody.test.tsx index 51724a1e22..2d67832587 100644 --- a/plugins/github-release-manager/src/features/PromoteRc/PromoteRcBody.test.tsx +++ b/plugins/github-release-manager/src/features/PromoteRc/PromoteRcBody.test.tsx @@ -17,23 +17,9 @@ import React from 'react'; import { render } from '@testing-library/react'; -import { - mockApiClient, - mockCalverProject, - mockReleaseCandidateCalver, -} from '../../test-helpers/test-helpers'; +import { mockReleaseCandidateCalver } from '../../test-helpers/test-helpers'; import { TEST_IDS } from '../../test-helpers/test-ids'; -jest.mock('../../contexts/PluginApiClientContext', () => ({ - usePluginApiClientContext: () => ({ - pluginApiClient: mockApiClient, - }), -})); -jest.mock('../../contexts/ProjectContext', () => ({ - useProjectContext: () => ({ - project: mockCalverProject, - }), -})); jest.mock('./hooks/usePromoteRc', () => ({ usePromoteRc: () => ({ run: jest.fn(), diff --git a/plugins/github-release-manager/src/features/PromoteRc/PromoteRcBody.tsx b/plugins/github-release-manager/src/features/PromoteRc/PromoteRcBody.tsx index bfdfd1a976..5dfe4b13aa 100644 --- a/plugins/github-release-manager/src/features/PromoteRc/PromoteRcBody.tsx +++ b/plugins/github-release-manager/src/features/PromoteRc/PromoteRcBody.tsx @@ -22,8 +22,6 @@ import { Differ } from '../../components/Differ'; import { GetLatestReleaseResult } from '../../api/PluginApiClient'; import { ResponseStepDialog } from '../../components/ResponseStepDialog/ResponseStepDialog'; import { TEST_IDS } from '../../test-helpers/test-ids'; -import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; -import { useProjectContext } from '../../contexts/ProjectContext'; import { usePromoteRc } from './hooks/usePromoteRc'; import { useStyles } from '../../styles/styles'; @@ -33,14 +31,10 @@ interface PromoteRcBodyProps { } export const PromoteRcBody = ({ rcRelease, successCb }: PromoteRcBodyProps) => { - const { pluginApiClient } = usePluginApiClientContext(); - const { project } = useProjectContext(); const classes = useStyles(); const releaseVersion = rcRelease.tagName.replace('rc-', 'version-'); const { progress, responseSteps, run, runInvoked } = usePromoteRc({ - pluginApiClient, - project, rcRelease, releaseVersion, successCb, diff --git a/plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.test.ts b/plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.test.ts index 4803f2a551..4b7149ba7b 100644 --- a/plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.test.ts +++ b/plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.test.ts @@ -19,19 +19,28 @@ import { waitFor } from '@testing-library/react'; import { mockApiClient, + mockCalverProject, mockReleaseCandidateCalver, - mockSemverProject, } from '../../../test-helpers/test-helpers'; import { usePromoteRc } from './usePromoteRc'; +jest.mock('../../../contexts/PluginApiClientContext', () => ({ + usePluginApiClientContext: () => ({ + pluginApiClient: mockApiClient, + }), +})); +jest.mock('../../../contexts/ProjectContext', () => ({ + useProjectContext: () => ({ + project: mockCalverProject, + }), +})); + describe('usePromoteRc', () => { beforeEach(jest.clearAllMocks); it('should return the expected responseSteps and progress', async () => { const { result } = renderHook(() => usePromoteRc({ - pluginApiClient: mockApiClient, - project: mockSemverProject, rcRelease: mockReleaseCandidateCalver, releaseVersion: 'version-1.2.3', }), @@ -48,8 +57,6 @@ describe('usePromoteRc', () => { it('should return the expected responseSteps and progress (with successCb)', async () => { const { result } = renderHook(() => usePromoteRc({ - pluginApiClient: mockApiClient, - project: mockSemverProject, rcRelease: mockReleaseCandidateCalver, releaseVersion: 'version-1.2.3', successCb: jest.fn(), diff --git a/plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts b/plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts index abcab2f480..4d1a9e4037 100644 --- a/plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts +++ b/plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts @@ -17,29 +17,25 @@ import { useState, useEffect } from 'react'; import { useAsync, useAsyncFn } from 'react-use'; -import { - GetLatestReleaseResult, - IPluginApiClient, -} from '../../../api/PluginApiClient'; +import { GetLatestReleaseResult } from '../../../api/PluginApiClient'; import { CardHook, ComponentConfigPromoteRc } from '../../../types/types'; -import { Project } from '../../../contexts/ProjectContext'; +import { useProjectContext } from '../../../contexts/ProjectContext'; +import { usePluginApiClientContext } from '../../../contexts/PluginApiClientContext'; import { useResponseSteps } from '../../../hooks/useResponseSteps'; interface PromoteRc { - pluginApiClient: IPluginApiClient; - project: Project; rcRelease: NonNullable; releaseVersion: string; successCb?: ComponentConfigPromoteRc['successCb']; } export function usePromoteRc({ - pluginApiClient, - project, rcRelease, releaseVersion, successCb, }: PromoteRc): CardHook { + const { pluginApiClient } = usePluginApiClientContext(); + const { project } = useProjectContext(); const { responseSteps, addStepToResponseSteps, From 10c95472459038a23b6c031acfd8b8cbcd26cb82 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Fri, 23 Apr 2021 02:55:10 +0200 Subject: [PATCH 107/485] Create getCommit hook When opening row, calculate diff in days from creating RC to being done with the Release Version Signed-off-by: Erik Engervall --- .../src/api/PluginApiClient.test.ts | 1 + .../src/api/PluginApiClient.ts | 82 +++++--- .../src/features/Stats/DialogBody.tsx | 81 +------- .../src/features/Stats/Row.tsx | 186 +++++++++++++----- .../src/features/Stats/Summary.tsx | 89 +++++++++ .../src/features/Stats/Warn.tsx | 4 +- .../Stats/helpers/getDecimalNumber.tsx | 27 +++ .../Stats/{ => helpers}/getMappedReleases.tsx | 24 ++- .../Stats/{ => helpers}/getSummary.tsx | 0 .../features/Stats/{ => helpers}/getTags.tsx | 46 +++-- .../src/features/Stats/hooks/useGetCommit.ts | 37 ++++ .../src/test-helpers/test-helpers.test.ts | 1 + .../src/test-helpers/test-helpers.ts | 4 + 13 files changed, 414 insertions(+), 168 deletions(-) create mode 100644 plugins/github-release-manager/src/features/Stats/Summary.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/helpers/getDecimalNumber.tsx rename plugins/github-release-manager/src/features/Stats/{ => helpers}/getMappedReleases.tsx (71%) rename plugins/github-release-manager/src/features/Stats/{ => helpers}/getSummary.tsx (100%) rename plugins/github-release-manager/src/features/Stats/{ => helpers}/getTags.tsx (58%) create mode 100644 plugins/github-release-manager/src/features/Stats/hooks/useGetCommit.ts diff --git a/plugins/github-release-manager/src/api/PluginApiClient.test.ts b/plugins/github-release-manager/src/api/PluginApiClient.test.ts index 998e8bc4e8..867974b80b 100644 --- a/plugins/github-release-manager/src/api/PluginApiClient.test.ts +++ b/plugins/github-release-manager/src/api/PluginApiClient.test.ts @@ -60,6 +60,7 @@ describe('PluginApiClient', () => { "stats": Object { "getAllReleases": [Function], "getAllTags": [Function], + "getCommit": [Function], }, } `); diff --git a/plugins/github-release-manager/src/api/PluginApiClient.ts b/plugins/github-release-manager/src/api/PluginApiClient.ts index 31996f8882..033e074bcf 100644 --- a/plugins/github-release-manager/src/api/PluginApiClient.ts +++ b/plugins/github-release-manager/src/api/PluginApiClient.ts @@ -576,6 +576,7 @@ ${selectedPatchCommit.commit.message}`, return tags.map(tag => ({ tagName: tag.name, + sha: tag.commit.sha, })); }, @@ -598,6 +599,20 @@ ${selectedPatchCommit.commit.message}`, htmlUrl: release.html_url, })); }, + + getCommit: async ({ owner, repo, ref }: { ref: string } & OwnerRepo) => { + const { octokit } = await this.getOctokit(); + + const { data: commit } = await octokit.repos.getCommit({ + owner, + repo, + ref, + }); + + return { + createdAt: commit.commit.committer?.date, + }; + }, }; } @@ -660,28 +675,6 @@ type GetRecentCommits = ( export type GetRecentCommitsResult = UnboxReturnedPromise; export type GetRecentCommitsResultSingle = UnboxArray; -type GetAllTags = ( - args: OwnerRepo, -) => Promise< - Array<{ - tagName: string; - }> ->; -export type GetAllTagsResult = UnboxReturnedPromise; - -type GetAllReleases = ( - args: OwnerRepo, -) => Promise< - Array<{ - id: number; - name: string | null; - tagName: string; - createdAt: string | null; - htmlUrl: string; - }> ->; -export type GetAllReleasesResult = UnboxReturnedPromise; - type GetLatestRelease = ( args: OwnerRepo, ) => Promise<{ @@ -736,6 +729,9 @@ type GetBranch = ( }>; export type GetBranchResult = UnboxReturnedPromise; +/** + * CreateRc + */ type CreateRef = ( args: { mostRecentSha: string; @@ -771,6 +767,9 @@ type CreateRelease = ( }>; export type CreateReleaseResult = UnboxReturnedPromise; +/** + * Patch + */ type CreateTempCommit = ( args: { tagParts: SemverTagParts | CalverTagParts; @@ -876,6 +875,9 @@ type UpdateRelease = ( }>; export type UpdateReleaseResult = UnboxReturnedPromise; +/** + * PromoteRc + */ type PromoteRelease = ( args: { releaseId: NonNullable['id']; @@ -888,6 +890,41 @@ type PromoteRelease = ( }>; export type PromoteReleaseResult = UnboxReturnedPromise; +/** + * Stats + */ +type GetAllTags = ( + args: OwnerRepo, +) => Promise< + Array<{ + tagName: string; + sha: string; + }> +>; +export type GetAllTagsResult = UnboxReturnedPromise; + +type GetAllReleases = ( + args: OwnerRepo, +) => Promise< + Array<{ + id: number; + name: string | null; + tagName: string; + createdAt: string | null; + htmlUrl: string; + }> +>; +export type GetAllReleasesResult = UnboxReturnedPromise; + +type GetCommit = ( + args: { + ref: string; + } & OwnerRepo, +) => Promise<{ + createdAt: string | undefined; +}>; +export type GetCommitResult = UnboxReturnedPromise; + export interface IPluginApiClient { getHost: GetHost; getRepoPath: GetRepoPath; @@ -920,5 +957,6 @@ export interface IPluginApiClient { stats: { getAllTags: GetAllTags; getAllReleases: GetAllReleases; + getCommit: GetCommit; }; } diff --git a/plugins/github-release-manager/src/features/Stats/DialogBody.tsx b/plugins/github-release-manager/src/features/Stats/DialogBody.tsx index 3c2f884417..d8b406e04b 100644 --- a/plugins/github-release-manager/src/features/Stats/DialogBody.tsx +++ b/plugins/github-release-manager/src/features/Stats/DialogBody.tsx @@ -26,17 +26,17 @@ import { TableContainer, TableHead, TableRow, - Typography, } from '@material-ui/core'; import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; -import { getMappedReleases } from './getMappedReleases'; -import { getSummary } from './getSummary'; -import { getTags } from './getTags'; +import { getMappedReleases } from './helpers/getMappedReleases'; +import { getSummary } from './helpers/getSummary'; +import { getTags } from './helpers/getTags'; import { Row } from './Row'; import { useGetStats } from './hooks/useGetStats'; import { useProjectContext } from '../../contexts/ProjectContext'; import { Warn } from './Warn'; +import { Summary } from './Summary'; const useStyles = makeStyles({ table: { @@ -81,80 +81,9 @@ export function DialogBody() { }); } - const getDecimalNumber = (n: number) => { - if (isNaN(n)) { - return 0; - } - - if (n.toString().includes('.')) { - return n.toFixed(2); - } - - return n; - }; - return ( <> - - - Summary - - Total releases: {summary.totalReleases} - - - - - Release Candidate - - Release Candidate patches: {summary.totalCandidatePatches} - - - - Release Candidate patches per release:{' '} - {getDecimalNumber( - summary.totalCandidatePatches / summary.totalReleases, - )} - - - - - Release Version - - Release Version patches: {summary.totalVersionPatches} - - - - Release Version patches per release:{' '} - {getDecimalNumber( - summary.totalVersionPatches / summary.totalReleases, - )} - - - - - Total - - Patches:{' '} - {summary.totalCandidatePatches + summary.totalVersionPatches} - - - - Patches per release:{' '} - {getDecimalNumber( - (summary.totalCandidatePatches + summary.totalVersionPatches) / - summary.totalReleases, - )} - - - + diff --git a/plugins/github-release-manager/src/features/Stats/Row.tsx b/plugins/github-release-manager/src/features/Stats/Row.tsx index ea95f8e5c2..53ad5751da 100644 --- a/plugins/github-release-manager/src/features/Stats/Row.tsx +++ b/plugins/github-release-manager/src/features/Stats/Row.tsx @@ -15,7 +15,7 @@ */ import React, { useState } from 'react'; -import { DateTime } from 'luxon'; +import { DateTime, DurationObject } from 'luxon'; import { Box, Collapse, @@ -29,7 +29,9 @@ import { import KeyboardArrowDownIcon from '@material-ui/icons/KeyboardArrowDown'; import KeyboardArrowUpIcon from '@material-ui/icons/KeyboardArrowUp'; -import { getMappedReleases } from './getMappedReleases'; +import { getMappedReleases } from './helpers/getMappedReleases'; +import { useGetCommit } from './hooks/useGetCommit'; +import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; const useRowStyles = makeStyles({ root: { @@ -47,9 +49,6 @@ interface RowProps { export function Row({ baseVersion, mappedRelease }: RowProps) { const [open, setOpen] = useState(false); const classes = useRowStyles(); - const versions = mappedRelease.versions.reverse(); - const candidates = mappedRelease.candidates.reverse(); - const isPrerelease = versions.length === 0; return ( @@ -67,7 +66,7 @@ export function Row({ baseVersion, mappedRelease }: RowProps) { {baseVersion} - {isPrerelease ? ' (prerelease)' : ''} + {mappedRelease.versions.length === 0 ? ' (prerelease)' : ''} @@ -79,53 +78,152 @@ export function Row({ baseVersion, mappedRelease }: RowProps) { : '-'} - {candidates.length} + {mappedRelease.candidates.length} - {Math.max(0, versions.length - 1)} + {Math.max(0, mappedRelease.versions.length - 1)} - -
- {!isPrerelease && ( - - {versions.map(version => ( - - {version} - - ))} - - )} - - {!isPrerelease && ( - - {' 🚀 '} - - )} - - - {candidates.map(candidate => ( - - {candidate} - - ))} - -
-
+
); } + +function CollapsedEl({ + mappedRelease, +}: { + mappedRelease: ReturnType['releases']['0']; +}) { + const reversedCandidates = [...mappedRelease.candidates].reverse(); + + const { commit: releaseCut } = useGetCommit({ + ref: reversedCandidates[0]?.sha, + }); + const { commit: releaseComplete } = useGetCommit({ + ref: mappedRelease.versions[0]?.sha, + }); + + console.log('*** releaseCut > ', releaseCut.value); // eslint-disable-line no-console + console.log('*** releaseComplete > ', releaseComplete.value); // eslint-disable-line no-console + + let diff = { days: -1 } as DurationObject; + if (releaseCut.value?.createdAt && releaseComplete.value?.createdAt) { + diff = DateTime.fromISO(releaseComplete.value.createdAt) + .diff(DateTime.fromISO(releaseCut.value.createdAt), ['days', 'hours']) + .toObject(); + } + + return ( + + + {mappedRelease.versions.length > 0 && ( + + {mappedRelease.versions.map(version => ( + + {version.tagName} + + ))} + + )} + + {mappedRelease.versions.length > 0 && ( + + {' 🚀 '} + + )} + + + {mappedRelease.candidates.map(candidate => ( + + {candidate.tagName} + + ))} + + + + + {releaseComplete.loading ? ( + + ) : ( + <> + + Release completed{' '} + {releaseComplete.value?.createdAt && + DateTime.fromISO(releaseComplete.value.createdAt) + .setLocale('sv-SE') + .toFormat('yyyy-MM-dd')} + + + + + Release time: {diff.days} days + + + + + RC created{' '} + {releaseCut.value?.createdAt && + DateTime.fromISO(releaseCut.value.createdAt) + .setLocale('sv-SE') + .toFormat('yyyy-MM-dd')} + + + )} + + + ); +} diff --git a/plugins/github-release-manager/src/features/Stats/Summary.tsx b/plugins/github-release-manager/src/features/Stats/Summary.tsx new file mode 100644 index 0000000000..d5cedaeaae --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/Summary.tsx @@ -0,0 +1,89 @@ +/* + * 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 React from 'react'; +import { Box, Paper, Typography } from '@material-ui/core'; + +import { getDecimalNumber } from './helpers/getDecimalNumber'; +import { getSummary } from './helpers/getSummary'; + +interface SummaryProps { + summary: ReturnType; +} + +export function Summary({ summary }: SummaryProps) { + return ( + + + Summary + + Total releases: {summary.totalReleases} + + + + + Release Candidate + + Release Candidate patches: {summary.totalCandidatePatches} + + + + Release Candidate patches per release:{' '} + {getDecimalNumber( + summary.totalCandidatePatches / summary.totalReleases, + )} + + + + + Release Version + + Release Version patches: {summary.totalVersionPatches} + + + + Release Version patches per release:{' '} + {getDecimalNumber( + summary.totalVersionPatches / summary.totalReleases, + )} + + + + + Total + + Patches: {summary.totalCandidatePatches + summary.totalVersionPatches} + + + + Patches per release:{' '} + {getDecimalNumber( + (summary.totalCandidatePatches + summary.totalVersionPatches) / + summary.totalReleases, + )} + + + + ); +} diff --git a/plugins/github-release-manager/src/features/Stats/Warn.tsx b/plugins/github-release-manager/src/features/Stats/Warn.tsx index ecae90426d..b3cb813dfb 100644 --- a/plugins/github-release-manager/src/features/Stats/Warn.tsx +++ b/plugins/github-release-manager/src/features/Stats/Warn.tsx @@ -17,8 +17,8 @@ import React from 'react'; import { Alert } from '@material-ui/lab'; -import { getMappedReleases } from './getMappedReleases'; -import { getTags } from './getTags'; +import { getMappedReleases } from './helpers/getMappedReleases'; +import { getTags } from './helpers/getTags'; import { Project } from '../../contexts/ProjectContext'; interface WarnProps { diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getDecimalNumber.tsx b/plugins/github-release-manager/src/features/Stats/helpers/getDecimalNumber.tsx new file mode 100644 index 0000000000..590d95a757 --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/helpers/getDecimalNumber.tsx @@ -0,0 +1,27 @@ +/* + * 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. + */ + +export function getDecimalNumber(n: number) { + if (isNaN(n)) { + return 0; + } + + if (n.toString().includes('.')) { + return n.toFixed(2); + } + + return n; +} diff --git a/plugins/github-release-manager/src/features/Stats/getMappedReleases.tsx b/plugins/github-release-manager/src/features/Stats/helpers/getMappedReleases.tsx similarity index 71% rename from plugins/github-release-manager/src/features/Stats/getMappedReleases.tsx rename to plugins/github-release-manager/src/features/Stats/helpers/getMappedReleases.tsx index 52a6204589..af573343e5 100644 --- a/plugins/github-release-manager/src/features/Stats/getMappedReleases.tsx +++ b/plugins/github-release-manager/src/features/Stats/helpers/getMappedReleases.tsx @@ -14,10 +14,10 @@ * limitations under the License. */ -import { calverRegexp } from '../../helpers/tagParts/getCalverTagParts'; -import { GetAllReleasesResult } from '../../api/PluginApiClient'; -import { Project } from '../../contexts/ProjectContext'; -import { semverRegexp } from '../../helpers/tagParts/getSemverTagParts'; +import { calverRegexp } from '../../../helpers/tagParts/getCalverTagParts'; +import { GetAllReleasesResult } from '../../../api/PluginApiClient'; +import { Project } from '../../../contexts/ProjectContext'; +import { semverRegexp } from '../../../helpers/tagParts/getSemverTagParts'; export function getMappedReleases({ allReleases, @@ -33,8 +33,14 @@ export function getMappedReleases({ releases: { [baseVersion: string]: { createdAt: string | null; - candidates: string[]; - versions: string[]; + candidates: { + tagName: string; + sha: string; + }[]; + versions: { + tagName: string; + sha: string; + }[]; htmlUrl: string; }; }; @@ -60,8 +66,10 @@ export function getMappedReleases({ if (!acc.releases[baseVersion]) { acc.releases[baseVersion] = { createdAt: release.createdAt, - candidates: prefix === 'rc' ? [release.tagName] : [], - versions: prefix === 'version' ? [release.tagName] : [], + candidates: + prefix === 'rc' ? [{ tagName: release.tagName, sha: '' }] : [], + versions: + prefix === 'version' ? [{ tagName: release.tagName, sha: '' }] : [], htmlUrl: release.htmlUrl, }; return acc; diff --git a/plugins/github-release-manager/src/features/Stats/getSummary.tsx b/plugins/github-release-manager/src/features/Stats/helpers/getSummary.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/getSummary.tsx rename to plugins/github-release-manager/src/features/Stats/helpers/getSummary.tsx diff --git a/plugins/github-release-manager/src/features/Stats/getTags.tsx b/plugins/github-release-manager/src/features/Stats/helpers/getTags.tsx similarity index 58% rename from plugins/github-release-manager/src/features/Stats/getTags.tsx rename to plugins/github-release-manager/src/features/Stats/helpers/getTags.tsx index 4ad38cec17..82d0a6b587 100644 --- a/plugins/github-release-manager/src/features/Stats/getTags.tsx +++ b/plugins/github-release-manager/src/features/Stats/helpers/getTags.tsx @@ -14,11 +14,11 @@ * limitations under the License. */ -import { calverRegexp } from '../../helpers/tagParts/getCalverTagParts'; -import { GetAllTagsResult } from '../../api/PluginApiClient'; +import { calverRegexp } from '../../../helpers/tagParts/getCalverTagParts'; +import { GetAllTagsResult } from '../../../api/PluginApiClient'; import { getMappedReleases } from './getMappedReleases'; -import { Project } from '../../contexts/ProjectContext'; -import { semverRegexp } from '../../helpers/tagParts/getSemverTagParts'; +import { Project } from '../../../contexts/ProjectContext'; +import { semverRegexp } from '../../../helpers/tagParts/getSemverTagParts'; export function getTags({ allTags, @@ -52,20 +52,34 @@ export function getTags({ return acc; } - if ( - prefix === 'rc' && - !mappedReleases.releases[baseVersion].candidates.includes(tag.tagName) - ) { - mappedReleases.releases[baseVersion].candidates.push(tag.tagName); - return acc; + if (prefix === 'rc') { + const existingEntry = mappedReleases.releases[ + baseVersion + ].candidates.find(({ tagName }) => tagName === tag.tagName); + + if (existingEntry) { + existingEntry.sha = tag.sha; + } else { + mappedReleases.releases[baseVersion].candidates.push({ + tagName: tag.tagName, + sha: tag.sha, + }); + } } - if ( - prefix === 'version' && - !mappedReleases.releases[baseVersion].versions.includes(tag.tagName) - ) { - mappedReleases.releases[baseVersion].versions.push(tag.tagName); - return acc; + if (prefix === 'version') { + const existingEntry = mappedReleases.releases[ + baseVersion + ].versions.find(({ tagName }) => tagName === tag.tagName); + + if (existingEntry) { + existingEntry.sha = tag.sha; + } else { + mappedReleases.releases[baseVersion].versions.push({ + tagName: tag.tagName, + sha: tag.sha, + }); + } } return acc; diff --git a/plugins/github-release-manager/src/features/Stats/hooks/useGetCommit.ts b/plugins/github-release-manager/src/features/Stats/hooks/useGetCommit.ts new file mode 100644 index 0000000000..d19aa30331 --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/hooks/useGetCommit.ts @@ -0,0 +1,37 @@ +/* + * 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 { useAsync } from 'react-use'; + +import { usePluginApiClientContext } from '../../../contexts/PluginApiClientContext'; +import { useProjectContext } from '../../../contexts/ProjectContext'; + +export const useGetCommit = ({ ref }: { ref: string }) => { + const { pluginApiClient } = usePluginApiClientContext(); + const { project } = useProjectContext(); + + const commit = useAsync(() => + pluginApiClient.stats.getCommit({ + owner: project.owner, + repo: project.repo, + ref, + }), + ); + + return { + commit, + }; +}; diff --git a/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts b/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts index fbd3b690b4..89553b3e24 100644 --- a/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts +++ b/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts @@ -52,6 +52,7 @@ describe('testHelpers', () => { "stats": Object { "getAllReleases": [MockFunction], "getAllTags": [MockFunction], + "getCommit": [MockFunction], }, }, "mockBumpedTag": "rc-2020.01.01_1337", diff --git a/plugins/github-release-manager/src/test-helpers/test-helpers.ts b/plugins/github-release-manager/src/test-helpers/test-helpers.ts index fc7a5f5c5b..629bdb4031 100644 --- a/plugins/github-release-manager/src/test-helpers/test-helpers.ts +++ b/plugins/github-release-manager/src/test-helpers/test-helpers.ts @@ -287,5 +287,9 @@ export const mockApiClient: IPluginApiClient = { getAllReleases: jest.fn(async () => { throw new Error('Not implemented'); }), + + getCommit: jest.fn(async () => { + throw new Error('Not implemented'); + }), }, }; From e3c318ded1c1e54fbed019f09534f103806fec94 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Fri, 23 Apr 2021 14:39:22 +0200 Subject: [PATCH 108/485] Stats: Create individual component for Row children Stats: Improve names for helpers Signed-off-by: Erik Engervall --- .../src/features/Stats/DialogBody.tsx | 38 +-- .../src/features/Stats/Row.tsx | 229 ------------------ .../src/features/Stats/Row/Row.tsx | 96 ++++++++ .../Stats/Row/RowCollapsed/ReleaseTagList.tsx | 71 ++++++ .../Stats/Row/RowCollapsed/ReleaseTime.tsx | 139 +++++++++++ .../Stats/Row/RowCollapsed/RowCollapsed.tsx | 45 ++++ .../src/features/Stats/Warn.tsx | 22 +- .../Stats/helpers/getMappedReleases.tsx | 82 ------- .../Stats/helpers/getReleasesWithTags.tsx | 101 ++++++++ .../src/features/Stats/helpers/getSummary.tsx | 8 +- .../src/features/Stats/helpers/getTags.tsx | 89 ------- .../features/Stats/helpers/mapReleases.tsx | 89 +++++++ 12 files changed, 577 insertions(+), 432 deletions(-) delete mode 100644 plugins/github-release-manager/src/features/Stats/Row.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/Row/Row.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTagList.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/RowCollapsed.tsx delete mode 100644 plugins/github-release-manager/src/features/Stats/helpers/getMappedReleases.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/helpers/getReleasesWithTags.tsx delete mode 100644 plugins/github-release-manager/src/features/Stats/helpers/getTags.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/helpers/mapReleases.tsx diff --git a/plugins/github-release-manager/src/features/Stats/DialogBody.tsx b/plugins/github-release-manager/src/features/Stats/DialogBody.tsx index d8b406e04b..4248cdc1e8 100644 --- a/plugins/github-release-manager/src/features/Stats/DialogBody.tsx +++ b/plugins/github-release-manager/src/features/Stats/DialogBody.tsx @@ -29,14 +29,14 @@ import { } from '@material-ui/core'; import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; -import { getMappedReleases } from './helpers/getMappedReleases'; +import { getMappedReleases } from './helpers/mapReleases'; +import { getReleasesWithTags } from './helpers/getReleasesWithTags'; import { getSummary } from './helpers/getSummary'; -import { getTags } from './helpers/getTags'; -import { Row } from './Row'; +import { Row } from './Row/Row'; +import { Summary } from './Summary'; import { useGetStats } from './hooks/useGetStats'; import { useProjectContext } from '../../contexts/ProjectContext'; import { Warn } from './Warn'; -import { Summary } from './Summary'; const useStyles = makeStyles({ table: { @@ -64,20 +64,24 @@ export function DialogBody() { } const { allReleases, allTags } = stats.value; - const mappedReleases = getMappedReleases({ allReleases, project }); - const tags = getTags({ allTags, project, mappedReleases }); - const summary = getSummary({ mappedReleases }); + const { mappedReleases } = getMappedReleases({ allReleases, project }); + const { releasesWithTags } = getReleasesWithTags({ + mappedReleases, + allTags, + project, + }); + const summary = getSummary({ releasesWithTags }); const shouldWarn = - tags.unmappable.length > 0 || - tags.unmatched.length > 0 || - mappedReleases.unmatched.length > 0; + releasesWithTags.unmappableTags.length > 0 || + releasesWithTags.unmatchedTags.length > 0 || + releasesWithTags.unmatched.length > 0; if (shouldWarn) { // eslint-disable-next-line no-console console.log("⚠️ Here's a summary of unmapped/unmatched tags/releases", { - unmappableTags: tags.unmappable, - unmatchableTags: tags.unmatched, - unmatchableReleases: mappedReleases.unmatched, + unmappableTags: releasesWithTags.unmappableTags, + unmatchedTags: releasesWithTags.unmatchedTags, + unmatchedReleases: releasesWithTags.unmatched, }); } @@ -98,13 +102,13 @@ export function DialogBody() { - {Object.entries(mappedReleases.releases).map( - ([baseVersion, mappedRelease], index) => { + {Object.entries(releasesWithTags.releases).map( + ([baseVersion, releaseWithTags], index) => { return ( ); }, @@ -115,7 +119,7 @@ export function DialogBody() { {shouldWarn && ( - + )} diff --git a/plugins/github-release-manager/src/features/Stats/Row.tsx b/plugins/github-release-manager/src/features/Stats/Row.tsx deleted file mode 100644 index 53ad5751da..0000000000 --- a/plugins/github-release-manager/src/features/Stats/Row.tsx +++ /dev/null @@ -1,229 +0,0 @@ -/* - * 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 React, { useState } from 'react'; -import { DateTime, DurationObject } from 'luxon'; -import { - Box, - Collapse, - IconButton, - Link, - makeStyles, - TableCell, - TableRow, - Typography, -} from '@material-ui/core'; -import KeyboardArrowDownIcon from '@material-ui/icons/KeyboardArrowDown'; -import KeyboardArrowUpIcon from '@material-ui/icons/KeyboardArrowUp'; - -import { getMappedReleases } from './helpers/getMappedReleases'; -import { useGetCommit } from './hooks/useGetCommit'; -import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; - -const useRowStyles = makeStyles({ - root: { - '& > *': { - borderBottom: 'unset', - }, - }, -}); - -interface RowProps { - baseVersion: string; - mappedRelease: ReturnType['releases']['0']; -} - -export function Row({ baseVersion, mappedRelease }: RowProps) { - const [open, setOpen] = useState(false); - const classes = useRowStyles(); - - return ( - - - - setOpen(!open)} - > - {open ? : } - - - - - - {baseVersion} - {mappedRelease.versions.length === 0 ? ' (prerelease)' : ''} - - - - - {mappedRelease.createdAt - ? DateTime.fromISO(mappedRelease.createdAt) - .setLocale('sv-SE') - .toFormat('yyyy-MM-dd') - : '-'} - - - {mappedRelease.candidates.length} - - {Math.max(0, mappedRelease.versions.length - 1)} - - - - - - - - - - - ); -} - -function CollapsedEl({ - mappedRelease, -}: { - mappedRelease: ReturnType['releases']['0']; -}) { - const reversedCandidates = [...mappedRelease.candidates].reverse(); - - const { commit: releaseCut } = useGetCommit({ - ref: reversedCandidates[0]?.sha, - }); - const { commit: releaseComplete } = useGetCommit({ - ref: mappedRelease.versions[0]?.sha, - }); - - console.log('*** releaseCut > ', releaseCut.value); // eslint-disable-line no-console - console.log('*** releaseComplete > ', releaseComplete.value); // eslint-disable-line no-console - - let diff = { days: -1 } as DurationObject; - if (releaseCut.value?.createdAt && releaseComplete.value?.createdAt) { - diff = DateTime.fromISO(releaseComplete.value.createdAt) - .diff(DateTime.fromISO(releaseCut.value.createdAt), ['days', 'hours']) - .toObject(); - } - - return ( - - - {mappedRelease.versions.length > 0 && ( - - {mappedRelease.versions.map(version => ( - - {version.tagName} - - ))} - - )} - - {mappedRelease.versions.length > 0 && ( - - {' 🚀 '} - - )} - - - {mappedRelease.candidates.map(candidate => ( - - {candidate.tagName} - - ))} - - - - - {releaseComplete.loading ? ( - - ) : ( - <> - - Release completed{' '} - {releaseComplete.value?.createdAt && - DateTime.fromISO(releaseComplete.value.createdAt) - .setLocale('sv-SE') - .toFormat('yyyy-MM-dd')} - - - - - Release time: {diff.days} days - - - - - RC created{' '} - {releaseCut.value?.createdAt && - DateTime.fromISO(releaseCut.value.createdAt) - .setLocale('sv-SE') - .toFormat('yyyy-MM-dd')} - - - )} - - - ); -} diff --git a/plugins/github-release-manager/src/features/Stats/Row/Row.tsx b/plugins/github-release-manager/src/features/Stats/Row/Row.tsx new file mode 100644 index 0000000000..199aa74fdc --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/Row/Row.tsx @@ -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 React, { useState } from 'react'; +import { DateTime } from 'luxon'; +import { + Collapse, + IconButton, + Link, + makeStyles, + TableCell, + TableRow, +} from '@material-ui/core'; +import KeyboardArrowDownIcon from '@material-ui/icons/KeyboardArrowDown'; +import KeyboardArrowUpIcon from '@material-ui/icons/KeyboardArrowUp'; + +import { getReleasesWithTags } from '../helpers/getReleasesWithTags'; +import { RowCollapsed } from './RowCollapsed/RowCollapsed'; + +const useRowStyles = makeStyles({ + root: { + '& > *': { + borderBottom: 'unset', + }, + }, +}); + +interface RowProps { + baseVersion: string; + releaseWithTags: ReturnType< + typeof getReleasesWithTags + >['releasesWithTags']['releases']['0']; +} + +export function Row({ baseVersion, releaseWithTags }: RowProps) { + const [open, setOpen] = useState(false); + const classes = useRowStyles(); + + return ( + + + + setOpen(!open)} + > + {open ? : } + + + + + + {baseVersion} + {releaseWithTags.versions.length === 0 ? ' (prerelease)' : ''} + + + + + {releaseWithTags.createdAt + ? DateTime.fromISO(releaseWithTags.createdAt) + .setLocale('sv-SE') + .toFormat('yyyy-MM-dd') + : '-'} + + + {releaseWithTags.candidates.length} + + + {Math.max(0, releaseWithTags.versions.length - 1)} + + + + + + + + + + + + ); +} diff --git a/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTagList.tsx b/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTagList.tsx new file mode 100644 index 0000000000..3047c310f1 --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTagList.tsx @@ -0,0 +1,71 @@ +/* + * 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 React from 'react'; +import { Box, Typography } from '@material-ui/core'; + +import { getReleasesWithTags } from '../../helpers/getReleasesWithTags'; + +export function ReleaseTagList({ + releaseWithTags, +}: { + releaseWithTags: ReturnType< + typeof getReleasesWithTags + >['releasesWithTags']['releases']['0']; +}) { + return ( + + {releaseWithTags.versions.length > 0 && ( + + {releaseWithTags.versions.map(version => ( + + {version.tagName} + + ))} + + )} + + {releaseWithTags.versions.length > 0 && ( + + {' 🚀 '} + + )} + + + {releaseWithTags.candidates.map(candidate => ( + + {candidate.tagName} + + ))} + + + ); +} diff --git a/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx b/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx new file mode 100644 index 0000000000..b8cc25fd12 --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx @@ -0,0 +1,139 @@ +/* + * 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 React from 'react'; +import { Box, Typography } from '@material-ui/core'; +import { DateTime } from 'luxon'; + +import { CenteredCircularProgress } from '../../../../components/CenteredCircularProgress'; +import { getReleasesWithTags } from '../../helpers/getReleasesWithTags'; +import { useGetCommit } from '../../hooks/useGetCommit'; +import { Alert } from '@material-ui/lab'; + +interface ReleaseTimeProps { + releaseWithTags: ReturnType< + typeof getReleasesWithTags + >['releasesWithTags']['releases']['0']; +} + +export function ReleaseTime({ releaseWithTags }: ReleaseTimeProps) { + const reversedCandidates = [...releaseWithTags.candidates].reverse(); + + const firstCandidateSha = reversedCandidates[0]?.sha; + const { commit: releaseCut } = useGetCommit({ ref: firstCandidateSha }); + + const mostRecentVersionSha = releaseWithTags.versions[0]?.sha; + const { commit: releaseComplete } = useGetCommit({ + ref: mostRecentVersionSha, + }); + + if (releaseCut.loading || releaseComplete.loading) { + return ( + + + + ); + } + + if (releaseCut.error) { + return ( + + Failed to fetch the first Release Candidate commit ( + {releaseCut.error.message}) + + ); + } + + if (releaseComplete.error) { + return ( + + Failed to fetch the final Release Version Commit ( + {releaseComplete.error.message}) + + ); + } + + const diff = + releaseCut.value?.createdAt && releaseComplete.value?.createdAt + ? DateTime.fromISO(releaseComplete.value.createdAt) + .diff(DateTime.fromISO(releaseCut.value.createdAt), ['days', 'hours']) + .toObject() + : { days: -1 }; + + return ( + + + + Release completed{' '} + {releaseComplete.value?.createdAt && + DateTime.fromISO(releaseComplete.value.createdAt) + .setLocale('sv-SE') + .toFormat('yyyy-MM-dd')} + + + + + + Release time: {diff.days} days + + + + + + Release Candidate created{' '} + {releaseCut.value?.createdAt && + DateTime.fromISO(releaseCut.value.createdAt) + .setLocale('sv-SE') + .toFormat('yyyy-MM-dd')} + + + + ); +} + +function Wrapper({ children }: { children: React.ReactNode }) { + return ( + + {children} + + ); +} diff --git a/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/RowCollapsed.tsx b/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/RowCollapsed.tsx new file mode 100644 index 0000000000..a17707a62c --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/RowCollapsed.tsx @@ -0,0 +1,45 @@ +/* + * 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 React from 'react'; +import { Box } from '@material-ui/core'; + +import { getReleasesWithTags } from '../../helpers/getReleasesWithTags'; +import { ReleaseTime } from './ReleaseTime'; +import { ReleaseTagList } from './ReleaseTagList'; + +interface RowCollapsedProps { + releaseWithTags: ReturnType< + typeof getReleasesWithTags + >['releasesWithTags']['releases']['0']; +} + +export function RowCollapsed({ releaseWithTags }: RowCollapsedProps) { + return ( + + + + + + ); +} diff --git a/plugins/github-release-manager/src/features/Stats/Warn.tsx b/plugins/github-release-manager/src/features/Stats/Warn.tsx index b3cb813dfb..a86ac2cf1b 100644 --- a/plugins/github-release-manager/src/features/Stats/Warn.tsx +++ b/plugins/github-release-manager/src/features/Stats/Warn.tsx @@ -17,36 +17,36 @@ import React from 'react'; import { Alert } from '@material-ui/lab'; -import { getMappedReleases } from './helpers/getMappedReleases'; -import { getTags } from './helpers/getTags'; +import { getReleasesWithTags } from './helpers/getReleasesWithTags'; import { Project } from '../../contexts/ProjectContext'; interface WarnProps { - tags: ReturnType; - mappedReleases: ReturnType; + releasesWithTags: ReturnType['releasesWithTags']; project: Project; } -export const Warn = ({ tags, mappedReleases, project }: WarnProps) => { +export const Warn = ({ releasesWithTags, project }: WarnProps) => { return ( - {tags.unmappable.length > 0 && ( + {releasesWithTags.unmappableTags.length > 0 && (
- Failed to map {tags.unmappable.length} tags to + Failed to map{' '} + {releasesWithTags.unmappableTags.length} tags to releases
)} - {tags.unmatched.length > 0 && ( + {releasesWithTags.unmatchedTags.length > 0 && (
- Failed to match {tags.unmatched.length} tags to{' '} + Failed to match{' '} + {releasesWithTags.unmatchedTags.length} tags to{' '} {project.versioningStrategy}
)} - {mappedReleases.unmatched.length > 0 && ( + {releasesWithTags.unmatched.length > 0 && (
- Failed to match {mappedReleases.unmatched.length}{' '} + Failed to match {releasesWithTags.unmatched.length}{' '} releases to {project.versioningStrategy}
)} diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getMappedReleases.tsx b/plugins/github-release-manager/src/features/Stats/helpers/getMappedReleases.tsx deleted file mode 100644 index af573343e5..0000000000 --- a/plugins/github-release-manager/src/features/Stats/helpers/getMappedReleases.tsx +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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 { calverRegexp } from '../../../helpers/tagParts/getCalverTagParts'; -import { GetAllReleasesResult } from '../../../api/PluginApiClient'; -import { Project } from '../../../contexts/ProjectContext'; -import { semverRegexp } from '../../../helpers/tagParts/getSemverTagParts'; - -export function getMappedReleases({ - allReleases, - project, -}: { - allReleases: GetAllReleasesResult; - project: Project; -}) { - return allReleases.reduce( - ( - acc: { - unmatched: string[]; - releases: { - [baseVersion: string]: { - createdAt: string | null; - candidates: { - tagName: string; - sha: string; - }[]; - versions: { - tagName: string; - sha: string; - }[]; - htmlUrl: string; - }; - }; - }, - release, - ) => { - const match = - project.versioningStrategy === 'semver' - ? release.tagName.match(semverRegexp) - : release.tagName.match(calverRegexp); - - if (!match) { - acc.unmatched.push(release.tagName); - return acc; - } - - const prefix = match[1]; - const baseVersion = - project.versioningStrategy === 'semver' - ? `${match[2]}.${match[3]}` - : match[2]; - - if (!acc.releases[baseVersion]) { - acc.releases[baseVersion] = { - createdAt: release.createdAt, - candidates: - prefix === 'rc' ? [{ tagName: release.tagName, sha: '' }] : [], - versions: - prefix === 'version' ? [{ tagName: release.tagName, sha: '' }] : [], - htmlUrl: release.htmlUrl, - }; - return acc; - } - - return acc; - }, - { unmatched: [], releases: {} }, - ); -} diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getReleasesWithTags.tsx b/plugins/github-release-manager/src/features/Stats/helpers/getReleasesWithTags.tsx new file mode 100644 index 0000000000..1c41f78288 --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/helpers/getReleasesWithTags.tsx @@ -0,0 +1,101 @@ +/* + * 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 { calverRegexp } from '../../../helpers/tagParts/getCalverTagParts'; +import { GetAllTagsResult } from '../../../api/PluginApiClient'; +import { getMappedReleases } from './mapReleases'; +import { Project } from '../../../contexts/ProjectContext'; +import { semverRegexp } from '../../../helpers/tagParts/getSemverTagParts'; + +export function getReleasesWithTags({ + allTags, + project, + mappedReleases, +}: { + allTags: GetAllTagsResult; + project: Project; + mappedReleases: ReturnType['mappedReleases']; +}) { + return { + releasesWithTags: allTags.reduce( + ( + acc: ReturnType['mappedReleases'] & { + unmatchedTags: string[]; + unmappableTags: string[]; + }, + tag, + ) => { + const match = + project.versioningStrategy === 'semver' + ? tag.tagName.match(semverRegexp) + : tag.tagName.match(calverRegexp); + + if (!match) { + acc.unmatchedTags.push(tag.tagName); + return acc; + } + + const prefix = match[1]; + const baseVersion = + project.versioningStrategy === 'semver' + ? `${match[2]}.${match[3]}` + : match[2]; + + if (!acc.releases[baseVersion]) { + acc.unmappableTags.push(tag.tagName); + return acc; + } + + if (prefix === 'rc') { + const existingEntry = acc.releases[baseVersion].candidates.find( + ({ tagName }) => tagName === tag.tagName, + ); + + if (existingEntry) { + existingEntry.sha = tag.sha; + } else { + acc.releases[baseVersion].candidates.push({ + tagName: tag.tagName, + sha: tag.sha, + }); + } + } + + if (prefix === 'version') { + const existingEntry = acc.releases[baseVersion].versions.find( + ({ tagName }) => tagName === tag.tagName, + ); + + if (existingEntry) { + existingEntry.sha = tag.sha; + } else { + acc.releases[baseVersion].versions.push({ + tagName: tag.tagName, + sha: tag.sha, + }); + } + } + + return acc; + }, + { + ...mappedReleases, + unmatchedTags: [], + unmappableTags: [], + }, + ), + }; +} diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getSummary.tsx b/plugins/github-release-manager/src/features/Stats/helpers/getSummary.tsx index f90758987b..b898469c8a 100644 --- a/plugins/github-release-manager/src/features/Stats/helpers/getSummary.tsx +++ b/plugins/github-release-manager/src/features/Stats/helpers/getSummary.tsx @@ -14,14 +14,14 @@ * limitations under the License. */ -import { getMappedReleases } from './getMappedReleases'; +import { getReleasesWithTags } from './getReleasesWithTags'; export function getSummary({ - mappedReleases, + releasesWithTags, }: { - mappedReleases: ReturnType; + releasesWithTags: ReturnType['releasesWithTags']; }) { - return Object.entries(mappedReleases.releases).reduce( + return Object.entries(releasesWithTags.releases).reduce( ( acc: { totalReleases: number; diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getTags.tsx b/plugins/github-release-manager/src/features/Stats/helpers/getTags.tsx deleted file mode 100644 index 82d0a6b587..0000000000 --- a/plugins/github-release-manager/src/features/Stats/helpers/getTags.tsx +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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 { calverRegexp } from '../../../helpers/tagParts/getCalverTagParts'; -import { GetAllTagsResult } from '../../../api/PluginApiClient'; -import { getMappedReleases } from './getMappedReleases'; -import { Project } from '../../../contexts/ProjectContext'; -import { semverRegexp } from '../../../helpers/tagParts/getSemverTagParts'; - -export function getTags({ - allTags, - project, - mappedReleases, -}: { - allTags: GetAllTagsResult; - project: Project; - mappedReleases: ReturnType; -}) { - return allTags.reduce( - (acc: { unmatched: string[]; unmappable: string[] }, tag) => { - const match = - project.versioningStrategy === 'semver' - ? tag.tagName.match(semverRegexp) - : tag.tagName.match(calverRegexp); - - if (!match) { - acc.unmatched.push(tag.tagName); - return acc; - } - - const prefix = match[1]; - const baseVersion = - project.versioningStrategy === 'semver' - ? `${match[2]}.${match[3]}` - : match[2]; - - if (!mappedReleases.releases[baseVersion]) { - acc.unmappable.push(tag.tagName); - return acc; - } - - if (prefix === 'rc') { - const existingEntry = mappedReleases.releases[ - baseVersion - ].candidates.find(({ tagName }) => tagName === tag.tagName); - - if (existingEntry) { - existingEntry.sha = tag.sha; - } else { - mappedReleases.releases[baseVersion].candidates.push({ - tagName: tag.tagName, - sha: tag.sha, - }); - } - } - - if (prefix === 'version') { - const existingEntry = mappedReleases.releases[ - baseVersion - ].versions.find(({ tagName }) => tagName === tag.tagName); - - if (existingEntry) { - existingEntry.sha = tag.sha; - } else { - mappedReleases.releases[baseVersion].versions.push({ - tagName: tag.tagName, - sha: tag.sha, - }); - } - } - - return acc; - }, - { unmatched: [], unmappable: [] }, - ); -} diff --git a/plugins/github-release-manager/src/features/Stats/helpers/mapReleases.tsx b/plugins/github-release-manager/src/features/Stats/helpers/mapReleases.tsx new file mode 100644 index 0000000000..d1103d5e71 --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/helpers/mapReleases.tsx @@ -0,0 +1,89 @@ +/* + * 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 { calverRegexp } from '../../../helpers/tagParts/getCalverTagParts'; +import { GetAllReleasesResult } from '../../../api/PluginApiClient'; +import { Project } from '../../../contexts/ProjectContext'; +import { semverRegexp } from '../../../helpers/tagParts/getSemverTagParts'; + +export function getMappedReleases({ + allReleases, + project, +}: { + allReleases: GetAllReleasesResult; + project: Project; +}) { + return { + mappedReleases: allReleases.reduce( + ( + acc: { + unmatched: string[]; + releases: { + [baseVersion: string]: { + createdAt: string | null; + candidates: { + tagName: string; + sha: string; + }[]; + versions: { + tagName: string; + sha: string; + }[]; + htmlUrl: string; + }; + }; + }, + release, + ) => { + const match = + project.versioningStrategy === 'semver' + ? release.tagName.match(semverRegexp) + : release.tagName.match(calverRegexp); + + if (!match) { + acc.unmatched.push(release.tagName); + return acc; + } + + const prefix = match[1]; + const baseVersion = + project.versioningStrategy === 'semver' + ? `${match[2]}.${match[3]}` + : match[2]; + + if (!acc.releases[baseVersion]) { + acc.releases[baseVersion] = { + createdAt: release.createdAt, + candidates: + prefix === 'rc' ? [{ tagName: release.tagName, sha: '' }] : [], + versions: + prefix === 'version' + ? [{ tagName: release.tagName, sha: '' }] + : [], + htmlUrl: release.htmlUrl, + }; + return acc; + } + + return acc; + }, + { + unmatched: [], + releases: {}, + }, + ), + }; +} From 23769512a393445391f020b676ee5941ffbedcd6 Mon Sep 17 00:00:00 2001 From: Dominik Henneke Date: Fri, 23 Apr 2021 15:03:30 +0200 Subject: [PATCH 109/485] Support anyOf schemas in the scaffolder template Signed-off-by: Dominik Henneke --- .changeset/tough-planes-jump.md | 5 + .../MultistepJsonForm/schema.test.ts | 120 ++++++++++++++++++ .../components/MultistepJsonForm/schema.ts | 35 +++-- 3 files changed, 146 insertions(+), 14 deletions(-) create mode 100644 .changeset/tough-planes-jump.md diff --git a/.changeset/tough-planes-jump.md b/.changeset/tough-planes-jump.md new file mode 100644 index 0000000000..a30315e9e4 --- /dev/null +++ b/.changeset/tough-planes-jump.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder': patch +--- + +Support anyOf schemas in the scaffolder template diff --git a/plugins/scaffolder/src/components/MultistepJsonForm/schema.test.ts b/plugins/scaffolder/src/components/MultistepJsonForm/schema.test.ts index b83725c2bb..edfde0ea90 100644 --- a/plugins/scaffolder/src/components/MultistepJsonForm/schema.test.ts +++ b/plugins/scaffolder/src/components/MultistepJsonForm/schema.test.ts @@ -70,4 +70,124 @@ describe('transformSchemaToProps', () => { uiSchema: expectedUiSchema, }); }); + + it('transforms schema with anyOf fields', () => { + const inputSchema = { + type: 'object', + anyOf: [ + { + properties: { + field3: { + type: 'string', + default: 'Value 1', + 'ui:readonly': true, + }, + }, + }, + { + properties: { + field3: { + type: 'string', + default: 'Value 2', + 'ui:readonly': true, + }, + }, + }, + ], + properties: { + field1: { + type: 'object', + anyOf: [ + { + properties: { + field3: { + type: 'string', + default: 'Value 1', + 'ui:readonly': true, + }, + }, + }, + { + properties: { + field3: { + type: 'string', + default: 'Value 2', + 'ui:readonly': true, + }, + }, + }, + ], + }, + field2: { + type: 'string', + 'ui:derp': 'xerp', + }, + }, + }; + const expectedSchema = { + type: 'object', + anyOf: [ + { + properties: { + field3: { + type: 'string', + default: 'Value 1', + }, + }, + }, + { + properties: { + field3: { + type: 'string', + default: 'Value 2', + }, + }, + }, + ], + properties: { + field1: { + type: 'object', + anyOf: [ + { + properties: { + field3: { + type: 'string', + default: 'Value 1', + }, + }, + }, + { + properties: { + field3: { + type: 'string', + default: 'Value 2', + }, + }, + }, + ], + }, + field2: { + type: 'string', + }, + }, + }; + const expectedUiSchema = { + field3: { + 'ui:readonly': true, + }, + field1: { + field3: { + 'ui:readonly': true, + }, + }, + field2: { + 'ui:derp': 'xerp', + }, + }; + + expect(transformSchemaToProps(inputSchema)).toEqual({ + schema: expectedSchema, + uiSchema: expectedUiSchema, + }); + }); }); diff --git a/plugins/scaffolder/src/components/MultistepJsonForm/schema.ts b/plugins/scaffolder/src/components/MultistepJsonForm/schema.ts index e591589bd8..c189bbf1a7 100644 --- a/plugins/scaffolder/src/components/MultistepJsonForm/schema.ts +++ b/plugins/scaffolder/src/components/MultistepJsonForm/schema.ts @@ -26,7 +26,7 @@ function extractUiSchema(schema: JsonObject, uiSchema: JsonObject) { return; } - const { properties } = schema; + const { properties, anyOf } = schema; for (const propName in schema) { if (!schema.hasOwnProperty(propName)) { @@ -39,22 +39,29 @@ function extractUiSchema(schema: JsonObject, uiSchema: JsonObject) { } } - if (!isObject(properties)) { - return; + if (isObject(properties)) { + for (const propName in properties) { + if (!properties.hasOwnProperty(propName)) { + continue; + } + + const schemaNode = properties[propName]; + if (!isObject(schemaNode)) { + continue; + } + const innerUiSchema = {}; + uiSchema[propName] = innerUiSchema; + extractUiSchema(schemaNode, innerUiSchema); + } } - for (const propName in properties) { - if (!properties.hasOwnProperty(propName)) { - continue; + if (Array.isArray(anyOf)) { + for (const schemaNode of anyOf) { + if (!isObject(schemaNode)) { + continue; + } + extractUiSchema(schemaNode, uiSchema); } - - const schemaNode = properties[propName]; - if (!isObject(schemaNode)) { - continue; - } - const innerUiSchema = {}; - uiSchema[propName] = innerUiSchema; - extractUiSchema(schemaNode, innerUiSchema); } } From 6f015b7689694bdbe2e90709b93b675cc66d9715 Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 23 Apr 2021 19:38:51 +0200 Subject: [PATCH 110/485] e2e: added read tree tests to add github, gitlab and azure read URLs Signed-off-by: blam --- cypress/cypress.json | 2 +- cypress/src/integration/integrations.ts | 64 +++++++++++++++++-------- 2 files changed, 46 insertions(+), 20 deletions(-) diff --git a/cypress/cypress.json b/cypress/cypress.json index 59f7516c47..ebbbe59901 100644 --- a/cypress/cypress.json +++ b/cypress/cypress.json @@ -1,5 +1,5 @@ { - "baseUrl": "http://localhost:3000", + "baseUrl": "http://localhost:7000", "integrationFolder": "./src/integration", "supportFile": "./src/support", "fixturesFolder": "./src/fixures", diff --git a/cypress/src/integration/integrations.ts b/cypress/src/integration/integrations.ts index 839159d34e..5ee077502a 100644 --- a/cypress/src/integration/integrations.ts +++ b/cypress/src/integration/integrations.ts @@ -18,33 +18,59 @@ import 'os'; describe('Integrations', () => { describe('ReadTree', () => { - // it('should work for azure', () => { - // cy.loginAsGuest(); - - // cy.visit('/catalog-import'); - - // cy.get('input[name=url]').type( - // 'https://dev.azure.com/backstage-verification/_git/test-repo?path=%2Fnested%2F*', - // ); - - // cy.contains('Analyze').click(); - // }); - it('should work for github', () => { cy.loginAsGuest(); - cy.visit('/catalog-import'); - - cy.get('input[name=url]').type( - 'https://github.com/backstage-verification/test-repo', - ); - cy.request('/api/catalog/locations', { + cy.request('POST', '/api/catalog/locations', { target: 'https://github.com/backstage-verification/test-repo/blob/main/**/*', type: 'url', }); - cy.contains('Analyze').click(); + cy.visit('/catalog'); + cy.contains('All').click(); + cy.get('table').should('contain', 'github-repo'); + cy.get('table').should('contain', 'github-repo-nested'); + }); + + // it('should work for azure', () => { + // cy.loginAsGuest(); + + // cy.request('POST', '/api/catalog/locations', { + // target: + // 'https://dev.azure.com/backstage-verification/_git/test-repo?path=*', + // type: 'url', + // }); + // }); + + it('should work for gitlab', () => { + cy.loginAsGuest(); + + cy.request('POST', '/api/catalog/locations', { + target: + 'https://gitlab.com/backstage-verification/test-repo/-/tree/master/**/*', + type: 'url', + }); + + cy.visit('/catalog'); + cy.contains('All').click(); + cy.get('table').should('contain', 'gitlab-repo'); + cy.get('table').should('contain', 'gitlab-repo-nested'); + }); + + it('should work for bitbucket', () => { + cy.loginAsGuest(); + + cy.request('POST', '/api/catalog/locations', { + target: + 'https://bitbucket.org/backstage-verification/test-repo/src/master/**/*', + type: 'url', + }); + + cy.visit('/catalog'); + cy.contains('All').click(); + cy.get('table').should('contain', 'bitbucket-repo'); + cy.get('table').should('contain', 'bitbucket-repo-nested'); }); }); }); From e0c9ed759d9e6ef12ce8b04a1fe53ae77b4796f0 Mon Sep 17 00:00:00 2001 From: Phil Kuang Date: Fri, 23 Apr 2021 16:18:07 -0400 Subject: [PATCH 111/485] feat(EntityLayout): add 'if' prop to Route component Signed-off-by: Phil Kuang --- .changeset/small-ways-hunt.md | 6 ++ .../core/src/components/TabbedLayout/index.ts | 1 + plugins/catalog/package.json | 1 + .../EntityLayout/EntityLayout.test.tsx | 35 ++++++++++ .../components/EntityLayout/EntityLayout.tsx | 67 +++++++++++++++++-- 5 files changed, 105 insertions(+), 5 deletions(-) create mode 100644 .changeset/small-ways-hunt.md diff --git a/.changeset/small-ways-hunt.md b/.changeset/small-ways-hunt.md new file mode 100644 index 0000000000..f0b8dc88cc --- /dev/null +++ b/.changeset/small-ways-hunt.md @@ -0,0 +1,6 @@ +--- +'@backstage/core': patch +'@backstage/plugin-catalog': patch +--- + +Add `if` prop to `EntityLayout.Route` to conditionally render tabs diff --git a/packages/core/src/components/TabbedLayout/index.ts b/packages/core/src/components/TabbedLayout/index.ts index 744b56959e..fe72b199ec 100644 --- a/packages/core/src/components/TabbedLayout/index.ts +++ b/packages/core/src/components/TabbedLayout/index.ts @@ -14,3 +14,4 @@ * limitations under the License. */ export { TabbedLayout } from './TabbedLayout'; +export { RoutedTabs } from './RoutedTabs'; diff --git a/plugins/catalog/package.json b/plugins/catalog/package.json index b6b306c260..d87ca5b7d9 100644 --- a/plugins/catalog/package.json +++ b/plugins/catalog/package.json @@ -33,6 +33,7 @@ "@backstage/catalog-client": "^0.3.10", "@backstage/catalog-model": "^0.7.7", "@backstage/core": "^0.7.6", + "@backstage/core-api": "^0.2.17", "@backstage/errors": "^0.1.1", "@backstage/integration": "^0.5.1", "@backstage/integration-react": "^0.1.1", diff --git a/plugins/catalog/src/components/EntityLayout/EntityLayout.test.tsx b/plugins/catalog/src/components/EntityLayout/EntityLayout.test.tsx index 7356ccc27b..c5b51b8334 100644 --- a/plugins/catalog/src/components/EntityLayout/EntityLayout.test.tsx +++ b/plugins/catalog/src/components/EntityLayout/EntityLayout.test.tsx @@ -101,4 +101,39 @@ describe('EntityLayout', () => { expect(rendered.getByText('tabbed-test-title-2')).toBeInTheDocument(); expect(rendered.queryByText('tabbed-test-content-2')).toBeInTheDocument(); }); + + it('should conditionally render tabs', async () => { + const shouldRenderTab = (e: Entity) => e.metadata.name === 'my-entity'; + const shouldNotRenderTab = (e: Entity) => e.metadata.name === 'some-entity'; + + const rendered = await renderInTestApp( + + + + +
tabbed-test-content
+
+ +
tabbed-test-content-2
+
+ +
tabbed-test-content-3
+
+
+
+
, + ); + + expect(rendered.queryByText('tabbed-test-title')).toBeInTheDocument(); + expect(rendered.queryByText('tabbed-test-title-2')).not.toBeInTheDocument(); + expect(rendered.queryByText('tabbed-test-title-3')).toBeInTheDocument(); + }); }); diff --git a/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx b/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx index 6a9fa38e73..e3a8a89b71 100644 --- a/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx +++ b/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx @@ -26,7 +26,7 @@ import { IconComponent, Page, Progress, - TabbedLayout, + RoutedTabs, } from '@backstage/core'; import { EntityContext, @@ -34,14 +34,70 @@ import { getEntityRelations, useEntityCompoundName, } from '@backstage/plugin-catalog-react'; -import { Box } from '@material-ui/core'; +import { attachComponentData } from '@backstage/core-api'; +import { Box, TabProps } from '@material-ui/core'; import { Alert } from '@material-ui/lab'; -import { default as React, useContext, useState } from 'react'; +import { + default as React, + Children, + Fragment, + isValidElement, + useContext, + useState, +} from 'react'; import { useNavigate } from 'react-router'; import { EntityContextMenu } from '../EntityContextMenu/EntityContextMenu'; import { FavouriteEntity } from '../FavouriteEntity/FavouriteEntity'; import { UnregisterEntityDialog } from '../UnregisterEntityDialog/UnregisterEntityDialog'; +type SubRoute = { + path: string; + title: string; + children: JSX.Element; + if?: (entity: Entity) => boolean; + tabProps?: TabProps; +}; + +const Route: (props: SubRoute) => null = () => null; + +// This causes all mount points that are discovered within this route to use the path of the route itself +attachComponentData(Route, 'core.gatherMountPoints', true); + +function createSubRoutesFromChildren( + childrenProps: React.ReactNode, + entity: Entity | undefined, +): SubRoute[] { + // Directly comparing child.type with Route will not work with in + // combination with react-hot-loader in storybook + // https://github.com/gaearon/react-hot-loader/issues/304 + const routeType = ( + +
+ + ).type; + + return Children.toArray(childrenProps).flatMap(child => { + if (!isValidElement(child)) { + return []; + } + + if (child.type === Fragment) { + return createSubRoutesFromChildren(child.props.children, entity); + } + + if (child.type !== routeType) { + throw new Error('Child of EntityLayout must be an EntityLayout.Route'); + } + + const { path, title, children, if: condition, tabProps } = child.props; + if (condition && entity && !condition(entity)) { + return []; + } + + return [{ path, title, children, tabProps }]; + }); +} + const EntityLayoutTitle = ({ entity, title, @@ -139,6 +195,7 @@ export const EntityLayout = ({ const { kind, namespace, name } = useEntityCompoundName(); const { entity, loading, error } = useContext(EntityContext); + const routes = createSubRoutesFromChildren(children, entity); const { headerTitle, headerType } = headerProps( kind, namespace, @@ -175,7 +232,7 @@ export const EntityLayout = ({ {loading && } - {entity && {children}} + {entity && } {error && ( @@ -192,4 +249,4 @@ export const EntityLayout = ({ ); }; -EntityLayout.Route = TabbedLayout.Route; +EntityLayout.Route = Route; From c5bd6be684268917377b235373b8db80c2223c0d Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Sun, 25 Apr 2021 17:59:01 +0200 Subject: [PATCH 112/485] Create additional stats for Stats component Add button for fetching and calculating average release times Signed-off-by: Erik Engervall --- plugins/github-release-manager/package.json | 2 + .../src/api/PluginApiClient.ts | 1 - .../src/features/Stats/DialogBody.tsx | 47 +++--- .../Stats/Info/InDepth/AverageReleaseTime.tsx | 49 ++++++ .../features/Stats/Info/InDepth/InDepth.tsx | 132 ++++++++++++++++ .../Stats/Info/InDepth/LongestReleaseTime.tsx | 43 ++++++ .../src/features/Stats/Info/Info.tsx | 41 +++++ .../src/features/Stats/Info/Summary.tsx | 108 +++++++++++++ .../helpers/getReleaseCommitPairs.test.tsx | 109 +++++++++++++ .../Info/helpers/getReleaseCommitPairs.tsx | 65 ++++++++ .../Stats/Info/hooks/useGetReleaseTimes.tsx | 127 +++++++++++++++ .../src/features/Stats/Row/Row.tsx | 28 ++-- .../Stats/Row/RowCollapsed/ReleaseTagList.tsx | 16 +- .../Stats/Row/RowCollapsed/ReleaseTime.tsx | 39 ++--- .../Stats/Row/RowCollapsed/RowCollapsed.tsx | 14 +- .../src/features/Stats/Summary.tsx | 89 ----------- .../src/features/Stats/Warn.tsx | 36 ++--- .../Stats/contexts/ReleaseStatsContext.tsx | 64 ++++++++ .../Stats/helpers/getDecimalNumber.test.tsx | 43 ++++++ .../Stats/helpers/getDecimalNumber.tsx | 4 +- .../Stats/helpers/getMappedReleases.test.tsx | 71 +++++++++ ...{mapReleases.tsx => getMappedReleases.tsx} | 51 +++--- .../Stats/helpers/getReleaseStats.test.tsx | 124 +++++++++++++++ .../Stats/helpers/getReleaseStats.tsx | 81 ++++++++++ .../Stats/helpers/getReleasesWithTags.tsx | 101 ------------ .../Stats/helpers/getSummary.test.tsx | 34 ++++ .../src/features/Stats/helpers/getSummary.tsx | 55 +++---- .../src/features/Stats/hooks/useGetCommit.ts | 15 +- .../src/test-helpers/stats.ts | 70 +++++++++ .../src/test-helpers/test-helpers.test.ts | 146 ------------------ .../src/test-helpers/test-helpers.ts | 27 ++-- .../src/test-helpers/test-ids.test.ts | 88 ----------- 32 files changed, 1319 insertions(+), 601 deletions(-) create mode 100644 plugins/github-release-manager/src/features/Stats/Info/InDepth/AverageReleaseTime.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/Info/InDepth/InDepth.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/Info/InDepth/LongestReleaseTime.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/Info/Info.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/Info/Summary.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.test.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx delete mode 100644 plugins/github-release-manager/src/features/Stats/Summary.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/contexts/ReleaseStatsContext.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/helpers/getDecimalNumber.test.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/helpers/getMappedReleases.test.tsx rename plugins/github-release-manager/src/features/Stats/helpers/{mapReleases.tsx => getMappedReleases.tsx} (68%) create mode 100644 plugins/github-release-manager/src/features/Stats/helpers/getReleaseStats.test.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/helpers/getReleaseStats.tsx delete mode 100644 plugins/github-release-manager/src/features/Stats/helpers/getReleasesWithTags.tsx create mode 100644 plugins/github-release-manager/src/features/Stats/helpers/getSummary.test.tsx create mode 100644 plugins/github-release-manager/src/test-helpers/stats.ts delete mode 100644 plugins/github-release-manager/src/test-helpers/test-helpers.test.ts delete mode 100644 plugins/github-release-manager/src/test-helpers/test-ids.test.ts diff --git a/plugins/github-release-manager/package.json b/plugins/github-release-manager/package.json index c73941ec54..be544bc1fb 100644 --- a/plugins/github-release-manager/package.json +++ b/plugins/github-release-manager/package.json @@ -23,6 +23,7 @@ "@backstage/core": "^0.7.5", "@backstage/integration": "^0.5.1", "@backstage/theme": "^0.2.5", + "recharts": "^1.8.5", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.45", @@ -39,6 +40,7 @@ "@backstage/dev-utils": "^0.1.13", "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", + "@types/recharts": "^1.8.15", "@testing-library/react-hooks": "^3.4.2", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^12.0.7", diff --git a/plugins/github-release-manager/src/api/PluginApiClient.ts b/plugins/github-release-manager/src/api/PluginApiClient.ts index 033e074bcf..52764c6613 100644 --- a/plugins/github-release-manager/src/api/PluginApiClient.ts +++ b/plugins/github-release-manager/src/api/PluginApiClient.ts @@ -591,7 +591,6 @@ ${selectedPatchCommit.commit.message}`, }); return releases.map(release => ({ - release, id: release.id, name: release.name, tagName: release.tag_name, diff --git a/plugins/github-release-manager/src/features/Stats/DialogBody.tsx b/plugins/github-release-manager/src/features/Stats/DialogBody.tsx index 4248cdc1e8..8de40d6ac9 100644 --- a/plugins/github-release-manager/src/features/Stats/DialogBody.tsx +++ b/plugins/github-release-manager/src/features/Stats/DialogBody.tsx @@ -19,7 +19,6 @@ import { Alert } from '@material-ui/lab'; import { Box, makeStyles, - Paper, Table, TableBody, TableCell, @@ -29,11 +28,11 @@ import { } from '@material-ui/core'; import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; -import { getMappedReleases } from './helpers/mapReleases'; -import { getReleasesWithTags } from './helpers/getReleasesWithTags'; -import { getSummary } from './helpers/getSummary'; +import { getMappedReleases } from './helpers/getMappedReleases'; +import { getReleaseStats } from './helpers/getReleaseStats'; +import { Info } from './Info/Info'; +import { ReleaseStatsContext } from './contexts/ReleaseStatsContext'; import { Row } from './Row/Row'; -import { Summary } from './Summary'; import { useGetStats } from './hooks/useGetStats'; import { useProjectContext } from '../../contexts/ProjectContext'; import { Warn } from './Warn'; @@ -65,31 +64,31 @@ export function DialogBody() { const { allReleases, allTags } = stats.value; const { mappedReleases } = getMappedReleases({ allReleases, project }); - const { releasesWithTags } = getReleasesWithTags({ + const { releaseStats } = getReleaseStats({ mappedReleases, allTags, project, }); - const summary = getSummary({ releasesWithTags }); + const shouldWarn = - releasesWithTags.unmappableTags.length > 0 || - releasesWithTags.unmatchedTags.length > 0 || - releasesWithTags.unmatched.length > 0; + releaseStats.unmappableTags.length > 0 || + releaseStats.unmatchedTags.length > 0 || + releaseStats.unmatchedReleases.length > 0; if (shouldWarn) { // eslint-disable-next-line no-console console.log("⚠️ Here's a summary of unmapped/unmatched tags/releases", { - unmappableTags: releasesWithTags.unmappableTags, - unmatchedTags: releasesWithTags.unmatchedTags, - unmatchedReleases: releasesWithTags.unmatched, + unmatchedReleases: releaseStats.unmatchedReleases, + unmatchedTags: releaseStats.unmatchedTags, + unmappableTags: releaseStats.unmappableTags, }); } return ( - <> - + + - +
@@ -102,26 +101,22 @@ export function DialogBody() { - {Object.entries(releasesWithTags.releases).map( - ([baseVersion, releaseWithTags], index) => { + {Object.entries(releaseStats.releases).map( + ([baseVersion, releaseStat], index) => { return ( ); }, )}
-
- - {shouldWarn && ( - - )} - - + {shouldWarn && } + + ); } diff --git a/plugins/github-release-manager/src/features/Stats/Info/InDepth/AverageReleaseTime.tsx b/plugins/github-release-manager/src/features/Stats/Info/InDepth/AverageReleaseTime.tsx new file mode 100644 index 0000000000..659956ddb1 --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/Info/InDepth/AverageReleaseTime.tsx @@ -0,0 +1,49 @@ +/* + * 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 React from 'react'; + +import { getDecimalNumber } from '../../helpers/getDecimalNumber'; +import { useGetReleaseTimes } from '../hooks/useGetReleaseTimes'; + +export function AverageReleaseTime({ + averageReleaseTime, +}: { + averageReleaseTime: ReturnType< + typeof useGetReleaseTimes + >['averageReleaseTime']; +}) { + if (averageReleaseTime.length === 0) { + return <>-; + } + + const average = averageReleaseTime.reduce( + (acc, { daysWithHours }) => { + acc.daysWithHours += daysWithHours / averageReleaseTime.length; + return acc; + }, + { daysWithHours: 0 }, + ); + + const days = Math.floor(average.daysWithHours); + const hours = getDecimalNumber((average.daysWithHours - days) * 24, 1); + + return ( + <> + {days} days {hours} hours + + ); +} diff --git a/plugins/github-release-manager/src/features/Stats/Info/InDepth/InDepth.tsx b/plugins/github-release-manager/src/features/Stats/Info/InDepth/InDepth.tsx new file mode 100644 index 0000000000..9fbd2bc925 --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/Info/InDepth/InDepth.tsx @@ -0,0 +1,132 @@ +/* + * 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 React from 'react'; +import { + Box, + Button, + Tooltip as MaterialTooltip, + Typography, +} from '@material-ui/core'; +import { BarChart, Bar, XAxis, YAxis, Legend, Tooltip } from 'recharts'; + +import { AverageReleaseTime } from './AverageReleaseTime'; +import { LinearProgressWithLabel } from '../../../../components/ResponseStepDialog/LinearProgressWithLabel'; +import { LongestReleaseTime } from './LongestReleaseTime'; +import { useGetReleaseTimes } from '../hooks/useGetReleaseTimes'; +import { useReleaseStatsContext } from '../../contexts/ReleaseStatsContext'; + +export function InDepth() { + const { releaseStats } = useReleaseStatsContext(); + const { + averageReleaseTime, + progress, + releaseCommitPairs, + run, + } = useGetReleaseTimes(); + + const skipped = + Object.keys(releaseStats.releases).length - releaseCommitPairs.length; + + return ( + + + In-depth + + + + + + Release time + + + Release time is derived by comparing{' '} + createdAt of the commits belonging to the first and last + tag of each release. Releases without patches will have tags + pointing towards the same commit and will thus be omitted. This + project will omit {skipped} out of the total{' '} + {Object.keys(releaseStats.releases).length} releases. + + + + + + + In numbers + + + Average release time:{' '} + + + + + Longest release:{' '} + + + + + + {progress === 0 && ( + + + + )} + + + + + + 0 + ? averageReleaseTime + : [{ version: 'x.y.z', days: 0 }] + } + margin={{ top: 5, right: 30, left: 20, bottom: 5 }} + layout="vertical" + > + + + + + + + + {progress > 0 && progress < 100 && ( + + + + )} + + + ); +} diff --git a/plugins/github-release-manager/src/features/Stats/Info/InDepth/LongestReleaseTime.tsx b/plugins/github-release-manager/src/features/Stats/Info/InDepth/LongestReleaseTime.tsx new file mode 100644 index 0000000000..7fd5dbd572 --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/Info/InDepth/LongestReleaseTime.tsx @@ -0,0 +1,43 @@ +/* + * 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 React from 'react'; + +import { getDecimalNumber } from '../../helpers/getDecimalNumber'; +import { useGetReleaseTimes } from '../hooks/useGetReleaseTimes'; + +export function LongestReleaseTime({ + averageReleaseTime, +}: { + averageReleaseTime: ReturnType< + typeof useGetReleaseTimes + >['averageReleaseTime']; +}) { + if (averageReleaseTime.length === 0) { + return <>-; + } + + const longestRelease = [...averageReleaseTime].sort( + (a, b) => b.daysWithHours - a.daysWithHours, + )[0]; + + return ( + <> + {longestRelease.version} ({longestRelease.days} days{' '} + {getDecimalNumber(longestRelease.hours, 1)} hours ) + + ); +} diff --git a/plugins/github-release-manager/src/features/Stats/Info/Info.tsx b/plugins/github-release-manager/src/features/Stats/Info/Info.tsx new file mode 100644 index 0000000000..1c21f66e2c --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/Info/Info.tsx @@ -0,0 +1,41 @@ +/* + * 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 React from 'react'; +import { Paper } from '@material-ui/core'; + +import { InDepth } from './InDepth/InDepth'; +import { Summary } from './Summary'; + +export function Info() { + return ( + + + + + + ); +} diff --git a/plugins/github-release-manager/src/features/Stats/Info/Summary.tsx b/plugins/github-release-manager/src/features/Stats/Info/Summary.tsx new file mode 100644 index 0000000000..ff872dfffc --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/Info/Summary.tsx @@ -0,0 +1,108 @@ +/* + * 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 React from 'react'; +import { + Box, + makeStyles, + Table, + TableBody, + TableCell, + TableContainer, + TableHead, + TableRow, + Typography, +} from '@material-ui/core'; + +import { getDecimalNumber } from '../helpers/getDecimalNumber'; +import { getSummary } from '../helpers/getSummary'; +import { useReleaseStatsContext } from '../contexts/ReleaseStatsContext'; + +const useStyles = makeStyles({ + table: { + minWidth: 650, + }, +}); + +export function Summary() { + const { releaseStats } = useReleaseStatsContext(); + const { summary } = getSummary({ releaseStats }); + const classes = useStyles(); + + return ( + + Summary + + + Total releases: {summary.totalReleases} + + + + + + + + Patches + Patches per release + + + + + + + Release Candidate + + {summary.totalCandidatePatches} + + {getDecimalNumber( + summary.totalCandidatePatches / summary.totalReleases, + )} + + + + + + Release Version + + {summary.totalVersionPatches} + + {getDecimalNumber( + summary.totalVersionPatches / summary.totalReleases, + )} + + + + + + Total + + + {summary.totalCandidatePatches + summary.totalVersionPatches} + + + {getDecimalNumber( + (summary.totalCandidatePatches + + summary.totalVersionPatches) / + summary.totalReleases, + )} + + + +
+
+
+ ); +} diff --git a/plugins/github-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.test.tsx b/plugins/github-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.test.tsx new file mode 100644 index 0000000000..3d9fb9449c --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.test.tsx @@ -0,0 +1,109 @@ +/* + * 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 { getReleaseCommitPairs } from './getReleaseCommitPairs'; + +describe('getReleaseCommitPairs', () => { + it('should work', () => { + const nonPublishedRelease = { + baseVersion: '1.0', + createdAt: '2021-01-01T10:11:12Z', + htmlUrl: 'html_url', + candidates: [ + { + tagName: 'rc-1.0.0', + sha: 'sha-1.0.0', + }, + { + tagName: 'rc-1.0.1', + sha: 'sha-1.0.1', + }, + ], + versions: [], + }; + + const releaseWithoutPatches = { + baseVersion: '2.0', + createdAt: '2021-01-01T10:11:12Z', + htmlUrl: 'html_url', + candidates: [ + { + tagName: 'rc-2.0.0', + sha: 'sha-2.0.0', + }, + ], + versions: [ + { + tagName: 'version-2.0.0', + sha: 'sha-2.0.0', + }, + ], + }; + + const releaseWithPatches = { + baseVersion: '3.0', + createdAt: '2021-01-01T10:11:12Z', + htmlUrl: 'html_url', + candidates: [ + { + tagName: 'rc-3.0.1', + sha: 'sha-3.0.1', + }, + { + tagName: 'rc-3.0.0', + sha: 'sha-3.0.0', + }, + ], + versions: [ + { + tagName: 'version-3.0.1', + sha: 'sha-3.0.1', + }, + ], + }; + + const result = getReleaseCommitPairs({ + releaseStats: { + releases: { + nonPublishedRelease, // Should be omitted + releaseWithoutPatches, // Should be omitted + releaseWithPatches, + }, + unmatchedReleases: [], + unmappableTags: [], + unmatchedTags: [], + }, + }); + + expect(result).toMatchInlineSnapshot(` + Object { + "releaseCommitPairs": Array [ + Object { + "baseVersion": "3.0", + "endCommit": Object { + "sha": "sha-3.0.1", + "tagName": "version-3.0.1", + }, + "startCommit": Object { + "sha": "sha-3.0.0", + "tagName": "rc-3.0.0", + }, + }, + ], + } + `); + }); +}); diff --git a/plugins/github-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.tsx b/plugins/github-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.tsx new file mode 100644 index 0000000000..e55d97078e --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.tsx @@ -0,0 +1,65 @@ +/* + * 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 { ReleaseCommitPairs } from '../hooks/useGetReleaseTimes'; +import { ReleaseStats } from '../../contexts/ReleaseStatsContext'; + +export function getReleaseCommitPairs({ + releaseStats, +}: { + releaseStats: ReleaseStats; +}) { + const releaseCommitPairs = Object.values(releaseStats.releases).reduce( + (acc: ReleaseCommitPairs, release) => { + const startTag = [...release.candidates].reverse()[0]; + const endTag = release.versions[0]; + + // Missing Release Candidate for unknown reason + if (!startTag?.sha) { + return acc; + } + + // Missing Release Version (likely prerelease) + if (!endTag?.sha) { + return acc; + } + + // First RC tag is pointing towards the same commit as the most + // recent Version tag, meaning there haven't been any patches + // and we thus cannot determine and difference in time + if (startTag?.sha === endTag?.sha) { + return acc; + } + + return acc.concat({ + baseVersion: release.baseVersion, + startCommit: { + tagName: startTag.tagName, + sha: startTag.sha, + }, + endCommit: { + tagName: endTag.tagName, + sha: endTag.sha, + }, + }); + }, + [], + ); + + return { + releaseCommitPairs, + }; +} diff --git a/plugins/github-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx b/plugins/github-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx new file mode 100644 index 0000000000..2909763a8f --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx @@ -0,0 +1,127 @@ +/* + * 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 { useEffect, useState } from 'react'; +import { useAsync, useAsyncFn } from 'react-use'; +import { DateTime } from 'luxon'; + +import { getReleaseCommitPairs } from '../helpers/getReleaseCommitPairs'; +import { usePluginApiClientContext } from '../../../../contexts/PluginApiClientContext'; +import { useProjectContext } from '../../../../contexts/ProjectContext'; +import { useReleaseStatsContext } from '../../contexts/ReleaseStatsContext'; + +export type ReleaseCommitPairs = Array<{ + baseVersion: string; + startCommit: { + tagName: string; + sha: string; + }; + endCommit: { + tagName: string; + sha: string; + }; +}>; + +type ReleaseTime = { + version: string; + daysWithHours: number; + days: number; + hours: number; + startCommitCreatedAt?: string; + endCommitCreatedAt?: string; +}; + +export function useGetReleaseTimes() { + const { pluginApiClient } = usePluginApiClientContext(); + const { project } = useProjectContext(); + const { releaseStats } = useReleaseStatsContext(); + const [averageReleaseTime, setAverageReleaseTime] = useState( + [], + ); + const [progress, setProgress] = useState(0); + const { releaseCommitPairs } = getReleaseCommitPairs({ releaseStats }); + + const [fnRes, run] = useAsyncFn(() => { + setProgress(0); + return getAndSetReleaseTime(0); + }); + + useAsync(async () => { + if (averageReleaseTime.length === 0) return; + if (releaseCommitPairs.length === averageReleaseTime.length) return; + + await getAndSetReleaseTime(averageReleaseTime.length); + }, [fnRes.value, averageReleaseTime]); + + useEffect(() => { + const unboundedProgress = Math.round( + (averageReleaseTime.length / releaseCommitPairs.length) * 100, + ); + const boundedProgress = unboundedProgress > 100 ? 100 : unboundedProgress; + + setProgress(boundedProgress); + }, [averageReleaseTime.length, releaseCommitPairs.length]); + + async function getAndSetReleaseTime(index: number) { + const { baseVersion, startCommit, endCommit } = releaseCommitPairs[index]; + + const [ + { createdAt: startCommitCreatedAt }, + { createdAt: endCommitCreatedAt }, + ] = await Promise.all([ + pluginApiClient.stats.getCommit({ + owner: project.owner, + repo: project.repo, + ref: startCommit.sha, + }), + pluginApiClient.stats.getCommit({ + owner: project.owner, + repo: project.repo, + ref: endCommit.sha, + }), + ]); + + const releaseTime: ReleaseTime = { + version: baseVersion, + daysWithHours: 0, + days: 0, + hours: 0, + startCommitCreatedAt, + endCommitCreatedAt, + }; + + if (startCommitCreatedAt && endCommitCreatedAt) { + const { days: luxDays = 0, hours: luxHours = 0 } = DateTime.fromISO( + endCommitCreatedAt, + ) + .diff(DateTime.fromISO(startCommitCreatedAt), ['days', 'hours']) + .toObject(); + + releaseTime.daysWithHours = luxDays + luxHours / 24; + releaseTime.days = luxDays; + releaseTime.hours = luxHours; + } + + setAverageReleaseTime([...averageReleaseTime, releaseTime]); + } + + return { + releaseCommitPairs, + averageReleaseTime, + progress, + run, + }; +} diff --git a/plugins/github-release-manager/src/features/Stats/Row/Row.tsx b/plugins/github-release-manager/src/features/Stats/Row/Row.tsx index 199aa74fdc..95ec244e78 100644 --- a/plugins/github-release-manager/src/features/Stats/Row/Row.tsx +++ b/plugins/github-release-manager/src/features/Stats/Row/Row.tsx @@ -27,7 +27,7 @@ import { import KeyboardArrowDownIcon from '@material-ui/icons/KeyboardArrowDown'; import KeyboardArrowUpIcon from '@material-ui/icons/KeyboardArrowUp'; -import { getReleasesWithTags } from '../helpers/getReleasesWithTags'; +import { ReleaseStats } from '../contexts/ReleaseStatsContext'; import { RowCollapsed } from './RowCollapsed/RowCollapsed'; const useRowStyles = makeStyles({ @@ -40,17 +40,15 @@ const useRowStyles = makeStyles({ interface RowProps { baseVersion: string; - releaseWithTags: ReturnType< - typeof getReleasesWithTags - >['releasesWithTags']['releases']['0']; + releaseStat: ReleaseStats['releases']['0']; } -export function Row({ baseVersion, releaseWithTags }: RowProps) { +export function Row({ baseVersion, releaseStat }: RowProps) { const [open, setOpen] = useState(false); const classes = useRowStyles(); return ( - + <> - + {baseVersion} - {releaseWithTags.versions.length === 0 ? ' (prerelease)' : ''} + {releaseStat.versions.length === 0 ? ' (prerelease)' : ''} - {releaseWithTags.createdAt - ? DateTime.fromISO(releaseWithTags.createdAt) + {releaseStat.createdAt + ? DateTime.fromISO(releaseStat.createdAt) .setLocale('sv-SE') .toFormat('yyyy-MM-dd') : '-'} - {releaseWithTags.candidates.length} + {releaseStat.candidates.length} - - {Math.max(0, releaseWithTags.versions.length - 1)} - + {Math.max(0, releaseStat.versions.length - 1)} - + - + ); } diff --git a/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTagList.tsx b/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTagList.tsx index 3047c310f1..e07b74a171 100644 --- a/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTagList.tsx +++ b/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTagList.tsx @@ -17,14 +17,12 @@ import React from 'react'; import { Box, Typography } from '@material-ui/core'; -import { getReleasesWithTags } from '../../helpers/getReleasesWithTags'; +import { ReleaseStats } from '../../contexts/ReleaseStatsContext'; export function ReleaseTagList({ - releaseWithTags, + releaseStat, }: { - releaseWithTags: ReturnType< - typeof getReleasesWithTags - >['releasesWithTags']['releases']['0']; + releaseStat: ReleaseStats['releases']['0']; }) { return ( - {releaseWithTags.versions.length > 0 && ( + {releaseStat.versions.length > 0 && ( - {releaseWithTags.versions.map(version => ( + {releaseStat.versions.map(version => ( {version.tagName} @@ -46,7 +44,7 @@ export function ReleaseTagList({ )} - {releaseWithTags.versions.length > 0 && ( + {releaseStat.versions.length > 0 && ( - {releaseWithTags.candidates.map(candidate => ( + {releaseStat.candidates.map(candidate => ( {candidate.tagName} diff --git a/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx b/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx index b8cc25fd12..7f19ec1df9 100644 --- a/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx +++ b/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx @@ -15,27 +15,23 @@ */ import React from 'react'; -import { Box, Typography } from '@material-ui/core'; import { DateTime } from 'luxon'; - -import { CenteredCircularProgress } from '../../../../components/CenteredCircularProgress'; -import { getReleasesWithTags } from '../../helpers/getReleasesWithTags'; -import { useGetCommit } from '../../hooks/useGetCommit'; +import { Box, Typography } from '@material-ui/core'; import { Alert } from '@material-ui/lab'; +import { CenteredCircularProgress } from '../../../../components/CenteredCircularProgress'; +import { ReleaseStats } from '../../contexts/ReleaseStatsContext'; +import { useGetCommit } from '../../hooks/useGetCommit'; + interface ReleaseTimeProps { - releaseWithTags: ReturnType< - typeof getReleasesWithTags - >['releasesWithTags']['releases']['0']; + releaseStat: ReleaseStats['releases']['0']; } -export function ReleaseTime({ releaseWithTags }: ReleaseTimeProps) { - const reversedCandidates = [...releaseWithTags.candidates].reverse(); - - const firstCandidateSha = reversedCandidates[0]?.sha; +export function ReleaseTime({ releaseStat }: ReleaseTimeProps) { + const firstCandidateSha = [...releaseStat.candidates].reverse()[0]?.sha; const { commit: releaseCut } = useGetCommit({ ref: firstCandidateSha }); - const mostRecentVersionSha = releaseWithTags.versions[0]?.sha; + const mostRecentVersionSha = releaseStat.versions[0]?.sha; const { commit: releaseComplete } = useGetCommit({ ref: mostRecentVersionSha, }); @@ -57,15 +53,6 @@ export function ReleaseTime({ releaseWithTags }: ReleaseTimeProps) { ); } - if (releaseComplete.error) { - return ( - - Failed to fetch the final Release Version Commit ( - {releaseComplete.error.message}) - - ); - } - const diff = releaseCut.value?.createdAt && releaseComplete.value?.createdAt ? DateTime.fromISO(releaseComplete.value.createdAt) @@ -83,7 +70,7 @@ export function ReleaseTime({ releaseWithTags }: ReleaseTimeProps) { }} > - Release completed{' '} + {releaseStat.versions.length === 0 ? '-' : 'Release completed '} {releaseComplete.value?.createdAt && DateTime.fromISO(releaseComplete.value.createdAt) .setLocale('sv-SE') @@ -99,7 +86,11 @@ export function ReleaseTime({ releaseWithTags }: ReleaseTimeProps) { }} > - Release time: {diff.days} days + {diff.days === -1 ? ( + <>Ongoing: {diff.days} days + ) : ( + <>Completed in: {diff.days} days + )} diff --git a/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/RowCollapsed.tsx b/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/RowCollapsed.tsx index a17707a62c..101954e49d 100644 --- a/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/RowCollapsed.tsx +++ b/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/RowCollapsed.tsx @@ -16,17 +16,15 @@ import React from 'react'; import { Box } from '@material-ui/core'; -import { getReleasesWithTags } from '../../helpers/getReleasesWithTags'; -import { ReleaseTime } from './ReleaseTime'; +import { ReleaseStats } from '../../contexts/ReleaseStatsContext'; import { ReleaseTagList } from './ReleaseTagList'; +import { ReleaseTime } from './ReleaseTime'; interface RowCollapsedProps { - releaseWithTags: ReturnType< - typeof getReleasesWithTags - >['releasesWithTags']['releases']['0']; + releaseStat: ReleaseStats['releases']['0']; } -export function RowCollapsed({ releaseWithTags }: RowCollapsedProps) { +export function RowCollapsed({ releaseStat }: RowCollapsedProps) { return ( - + - + ); } diff --git a/plugins/github-release-manager/src/features/Stats/Summary.tsx b/plugins/github-release-manager/src/features/Stats/Summary.tsx deleted file mode 100644 index d5cedaeaae..0000000000 --- a/plugins/github-release-manager/src/features/Stats/Summary.tsx +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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 React from 'react'; -import { Box, Paper, Typography } from '@material-ui/core'; - -import { getDecimalNumber } from './helpers/getDecimalNumber'; -import { getSummary } from './helpers/getSummary'; - -interface SummaryProps { - summary: ReturnType; -} - -export function Summary({ summary }: SummaryProps) { - return ( - - - Summary - - Total releases: {summary.totalReleases} - - - - - Release Candidate - - Release Candidate patches: {summary.totalCandidatePatches} - - - - Release Candidate patches per release:{' '} - {getDecimalNumber( - summary.totalCandidatePatches / summary.totalReleases, - )} - - - - - Release Version - - Release Version patches: {summary.totalVersionPatches} - - - - Release Version patches per release:{' '} - {getDecimalNumber( - summary.totalVersionPatches / summary.totalReleases, - )} - - - - - Total - - Patches: {summary.totalCandidatePatches + summary.totalVersionPatches} - - - - Patches per release:{' '} - {getDecimalNumber( - (summary.totalCandidatePatches + summary.totalVersionPatches) / - summary.totalReleases, - )} - - - - ); -} diff --git a/plugins/github-release-manager/src/features/Stats/Warn.tsx b/plugins/github-release-manager/src/features/Stats/Warn.tsx index a86ac2cf1b..93c2cc4154 100644 --- a/plugins/github-release-manager/src/features/Stats/Warn.tsx +++ b/plugins/github-release-manager/src/features/Stats/Warn.tsx @@ -17,39 +17,37 @@ import React from 'react'; import { Alert } from '@material-ui/lab'; -import { getReleasesWithTags } from './helpers/getReleasesWithTags'; -import { Project } from '../../contexts/ProjectContext'; +import { useProjectContext } from '../../contexts/ProjectContext'; +import { useReleaseStatsContext } from './contexts/ReleaseStatsContext'; -interface WarnProps { - releasesWithTags: ReturnType['releasesWithTags']; - project: Project; -} +export const Warn = () => { + const { releaseStats } = useReleaseStatsContext(); + const { project } = useProjectContext(); -export const Warn = ({ releasesWithTags, project }: WarnProps) => { return ( - {releasesWithTags.unmappableTags.length > 0 && ( + {releaseStats.unmappableTags.length > 0 && (
- Failed to map{' '} - {releasesWithTags.unmappableTags.length} tags to - releases + Failed to map {releaseStats.unmappableTags.length}{' '} + tags to releases
)} - {releasesWithTags.unmatchedTags.length > 0 && ( + {releaseStats.unmatchedTags.length > 0 && ( +
+ Failed to match {releaseStats.unmatchedTags.length}{' '} + tags to {project.versioningStrategy} +
+ )} + + {releaseStats.unmatchedReleases.length > 0 && (
Failed to match{' '} - {releasesWithTags.unmatchedTags.length} tags to{' '} + {releaseStats.unmatchedReleases.length} releases to{' '} {project.versioningStrategy}
)} - {releasesWithTags.unmatched.length > 0 && ( -
- Failed to match {releasesWithTags.unmatched.length}{' '} - releases to {project.versioningStrategy} -
- )}
See full output in the console
); diff --git a/plugins/github-release-manager/src/features/Stats/contexts/ReleaseStatsContext.tsx b/plugins/github-release-manager/src/features/Stats/contexts/ReleaseStatsContext.tsx new file mode 100644 index 0000000000..be0d68e2e5 --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/contexts/ReleaseStatsContext.tsx @@ -0,0 +1,64 @@ +/* + * 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 { createContext, useContext } from 'react'; + +import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; + +export interface ReleaseStats { + unmappableTags: string[]; + unmatchedTags: string[]; + unmatchedReleases: string[]; + releases: { + [baseVersion: string]: { + baseVersion: string; + createdAt: string | null; + htmlUrl: string; + + /** + * Ordered from new to old + */ + candidates: { + tagName: string; + sha: string; + }[]; + + /** + * Ordered from new to old + */ + versions: { + tagName: string; + sha: string; + }[]; + }; + }; +} + +export const ReleaseStatsContext = createContext< + { releaseStats: ReleaseStats } | undefined +>(undefined); + +export const useReleaseStatsContext = () => { + const { releaseStats } = useContext(ReleaseStatsContext) ?? {}; + + if (!releaseStats) { + throw new GitHubReleaseManagerError('releaseStats not found'); + } + + return { + releaseStats, + }; +}; diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getDecimalNumber.test.tsx b/plugins/github-release-manager/src/features/Stats/helpers/getDecimalNumber.test.tsx new file mode 100644 index 0000000000..b4b1a1df4c --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/helpers/getDecimalNumber.test.tsx @@ -0,0 +1,43 @@ +/* + * 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 { getDecimalNumber } from './getDecimalNumber'; + +describe('getDecimalNumber', () => { + it('should handle NaN', () => { + const result = getDecimalNumber(NaN); + + expect(result).toEqual(0); + }); + + it('should only handle decimals', () => { + const result = getDecimalNumber(1); + + expect(result).toEqual(1); + }); + + it('should get decimal number with default decimals = 2', () => { + const result = getDecimalNumber(1 / 3); + + expect(result).toMatchInlineSnapshot(`0.33`); + }); + + it('should get decimal number for decimals = 1', () => { + const result = getDecimalNumber(1 / 3, 1); + + expect(result).toMatchInlineSnapshot(`0.3`); + }); +}); diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getDecimalNumber.tsx b/plugins/github-release-manager/src/features/Stats/helpers/getDecimalNumber.tsx index 590d95a757..ab4a83fa79 100644 --- a/plugins/github-release-manager/src/features/Stats/helpers/getDecimalNumber.tsx +++ b/plugins/github-release-manager/src/features/Stats/helpers/getDecimalNumber.tsx @@ -14,13 +14,13 @@ * limitations under the License. */ -export function getDecimalNumber(n: number) { +export function getDecimalNumber(n: number, decimals = 2) { if (isNaN(n)) { return 0; } if (n.toString().includes('.')) { - return n.toFixed(2); + return parseFloat(n.toFixed(decimals)); } return n; diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getMappedReleases.test.tsx b/plugins/github-release-manager/src/features/Stats/helpers/getMappedReleases.test.tsx new file mode 100644 index 0000000000..5bea396d5c --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/helpers/getMappedReleases.test.tsx @@ -0,0 +1,71 @@ +/* + * 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 { getMappedReleases } from './getMappedReleases'; +import { mockSemverProject } from '../../../test-helpers/test-helpers'; + +describe('getMappedReleases', () => { + it('should get mapped releases', () => { + const createRelease = (tagName: string) => ({ + createdAt: '2021-01-01T10:11:12Z', + htmlUrl: 'html_url', + id: 1, + name: 'name', + tagName, + }); + + const result = getMappedReleases({ + project: mockSemverProject, + allReleases: [createRelease('rc-1.0.0'), createRelease('rc-1.1.0')], + }); + + expect(result).toMatchInlineSnapshot(` + Object { + "mappedReleases": Object { + "releases": Object { + "1.0": Object { + "baseVersion": "1.0", + "candidates": Array [ + Object { + "sha": "", + "tagName": "rc-1.0.0", + }, + ], + "createdAt": "2021-01-01T10:11:12Z", + "htmlUrl": "html_url", + "versions": Array [], + }, + "1.1": Object { + "baseVersion": "1.1", + "candidates": Array [ + Object { + "sha": "", + "tagName": "rc-1.1.0", + }, + ], + "createdAt": "2021-01-01T10:11:12Z", + "htmlUrl": "html_url", + "versions": Array [], + }, + }, + "unmappableTags": Array [], + "unmatchedReleases": Array [], + "unmatchedTags": Array [], + }, + } + `); + }); +}); diff --git a/plugins/github-release-manager/src/features/Stats/helpers/mapReleases.tsx b/plugins/github-release-manager/src/features/Stats/helpers/getMappedReleases.tsx similarity index 68% rename from plugins/github-release-manager/src/features/Stats/helpers/mapReleases.tsx rename to plugins/github-release-manager/src/features/Stats/helpers/getMappedReleases.tsx index d1103d5e71..55382100ac 100644 --- a/plugins/github-release-manager/src/features/Stats/helpers/mapReleases.tsx +++ b/plugins/github-release-manager/src/features/Stats/helpers/getMappedReleases.tsx @@ -17,6 +17,7 @@ import { calverRegexp } from '../../../helpers/tagParts/getCalverTagParts'; import { GetAllReleasesResult } from '../../../api/PluginApiClient'; import { Project } from '../../../contexts/ProjectContext'; +import { ReleaseStats } from '../contexts/ReleaseStatsContext'; import { semverRegexp } from '../../../helpers/tagParts/getSemverTagParts'; export function getMappedReleases({ @@ -28,61 +29,47 @@ export function getMappedReleases({ }) { return { mappedReleases: allReleases.reduce( - ( - acc: { - unmatched: string[]; - releases: { - [baseVersion: string]: { - createdAt: string | null; - candidates: { - tagName: string; - sha: string; - }[]; - versions: { - tagName: string; - sha: string; - }[]; - htmlUrl: string; - }; - }; - }, - release, - ) => { + (acc: ReleaseStats, release) => { const match = project.versioningStrategy === 'semver' ? release.tagName.match(semverRegexp) : release.tagName.match(calverRegexp); if (!match) { - acc.unmatched.push(release.tagName); + acc.unmatchedReleases.push(release.tagName); return acc; } - const prefix = match[1]; + const prefix = match[1] as 'rc' | 'version'; const baseVersion = project.versioningStrategy === 'semver' ? `${match[2]}.${match[3]}` : match[2]; if (!acc.releases[baseVersion]) { - acc.releases[baseVersion] = { - createdAt: release.createdAt, - candidates: - prefix === 'rc' ? [{ tagName: release.tagName, sha: '' }] : [], - versions: - prefix === 'version' - ? [{ tagName: release.tagName, sha: '' }] - : [], - htmlUrl: release.htmlUrl, + const releaseEntry = { + tagName: release.tagName, + sha: '', }; + + acc.releases[baseVersion] = { + baseVersion, + createdAt: release.createdAt, + htmlUrl: release.htmlUrl, + candidates: prefix === 'rc' ? [releaseEntry] : [], + versions: prefix === 'version' ? [releaseEntry] : [], + }; + return acc; } return acc; }, { - unmatched: [], releases: {}, + unmappableTags: [], + unmatchedReleases: [], + unmatchedTags: [], }, ), }; diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getReleaseStats.test.tsx b/plugins/github-release-manager/src/features/Stats/helpers/getReleaseStats.test.tsx new file mode 100644 index 0000000000..3b59cc4c46 --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/helpers/getReleaseStats.test.tsx @@ -0,0 +1,124 @@ +/* + * 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 { getReleaseStats } from './getReleaseStats'; +import { mockSemverProject } from '../../../test-helpers/test-helpers'; + +describe('getReleaseStats', () => { + it('should get releases with tags', () => { + const result = getReleaseStats({ + project: mockSemverProject, + mappedReleases: { + releases: { + '1.0': { + baseVersion: '1.0', + createdAt: '2021-01-01T10:11:12Z', + htmlUrl: 'html_url', + candidates: [ + { + tagName: 'rc-1.0.0', + sha: '', + }, + ], + versions: [], + }, + '1.1': { + baseVersion: '1.1', + createdAt: '2021-01-01T10:11:12Z', + htmlUrl: 'html_url', + candidates: [ + { + tagName: 'rc-1.1.0', + sha: '', + }, + ], + versions: [], + }, + }, + unmappableTags: [], + unmatchedReleases: [], + unmatchedTags: [], + }, + allTags: [ + { sha: 'sha', tagName: 'rc-1.0.0' }, + { sha: 'sha', tagName: 'rc-1.0.1' }, + { sha: 'sha', tagName: 'rc-1.0.2' }, + { sha: 'sha', tagName: 'version-1.0.2' }, + { sha: 'sha', tagName: 'rc-1.1.1' }, + + { sha: 'unmatchable', tagName: 'rc-1/2/3' }, + { sha: 'unmappable', tagName: 'rc-123.123.123' }, + ], + }); + + expect(result).toMatchInlineSnapshot(` + Object { + "releaseStats": Object { + "releases": Object { + "1.0": Object { + "baseVersion": "1.0", + "candidates": Array [ + Object { + "sha": "sha", + "tagName": "rc-1.0.0", + }, + Object { + "sha": "sha", + "tagName": "rc-1.0.1", + }, + Object { + "sha": "sha", + "tagName": "rc-1.0.2", + }, + ], + "createdAt": "2021-01-01T10:11:12Z", + "htmlUrl": "html_url", + "versions": Array [ + Object { + "sha": "sha", + "tagName": "version-1.0.2", + }, + ], + }, + "1.1": Object { + "baseVersion": "1.1", + "candidates": Array [ + Object { + "sha": "", + "tagName": "rc-1.1.0", + }, + Object { + "sha": "sha", + "tagName": "rc-1.1.1", + }, + ], + "createdAt": "2021-01-01T10:11:12Z", + "htmlUrl": "html_url", + "versions": Array [], + }, + }, + "unmappableTags": Array [ + "rc-123.123.123", + ], + "unmatchedReleases": Array [], + "unmatchedTags": Array [ + "rc-1/2/3", + ], + }, + } + `); + }); +}); diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getReleaseStats.tsx b/plugins/github-release-manager/src/features/Stats/helpers/getReleaseStats.tsx new file mode 100644 index 0000000000..9b77cc1223 --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/helpers/getReleaseStats.tsx @@ -0,0 +1,81 @@ +/* + * 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 { calverRegexp } from '../../../helpers/tagParts/getCalverTagParts'; +import { GetAllTagsResult } from '../../../api/PluginApiClient'; +import { Project } from '../../../contexts/ProjectContext'; +import { ReleaseStats } from '../contexts/ReleaseStatsContext'; +import { semverRegexp } from '../../../helpers/tagParts/getSemverTagParts'; + +export function getReleaseStats({ + allTags, + project, + mappedReleases, +}: { + allTags: GetAllTagsResult; + project: Project; + mappedReleases: ReleaseStats; +}) { + const releaseStats = allTags.reduce( + (acc: ReleaseStats, tag) => { + const match = + project.versioningStrategy === 'semver' + ? tag.tagName.match(semverRegexp) + : tag.tagName.match(calverRegexp); + + if (!match) { + acc.unmatchedTags.push(tag.tagName); + return acc; + } + + const prefix = match[1] as 'rc' | 'version'; + const baseVersion = + project.versioningStrategy === 'semver' + ? `${match[2]}.${match[3]}` // major.minor + : match[2]; // yyyy.MM.dd + + const release = acc.releases[baseVersion]; + + if (!release) { + acc.unmappableTags.push(tag.tagName); + return acc; + } + + const dest = release[prefix === 'rc' ? 'candidates' : 'versions']; + const releaseToEnrich = dest.find( + ({ tagName }) => tagName === tag.tagName, + ); + + if (releaseToEnrich) { + releaseToEnrich.sha = tag.sha; + } else { + dest.push({ + tagName: tag.tagName, + sha: tag.sha, + }); + } + + return acc; + }, + { + ...mappedReleases, + }, + ); + + return { + releaseStats, + }; +} diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getReleasesWithTags.tsx b/plugins/github-release-manager/src/features/Stats/helpers/getReleasesWithTags.tsx deleted file mode 100644 index 1c41f78288..0000000000 --- a/plugins/github-release-manager/src/features/Stats/helpers/getReleasesWithTags.tsx +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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 { calverRegexp } from '../../../helpers/tagParts/getCalverTagParts'; -import { GetAllTagsResult } from '../../../api/PluginApiClient'; -import { getMappedReleases } from './mapReleases'; -import { Project } from '../../../contexts/ProjectContext'; -import { semverRegexp } from '../../../helpers/tagParts/getSemverTagParts'; - -export function getReleasesWithTags({ - allTags, - project, - mappedReleases, -}: { - allTags: GetAllTagsResult; - project: Project; - mappedReleases: ReturnType['mappedReleases']; -}) { - return { - releasesWithTags: allTags.reduce( - ( - acc: ReturnType['mappedReleases'] & { - unmatchedTags: string[]; - unmappableTags: string[]; - }, - tag, - ) => { - const match = - project.versioningStrategy === 'semver' - ? tag.tagName.match(semverRegexp) - : tag.tagName.match(calverRegexp); - - if (!match) { - acc.unmatchedTags.push(tag.tagName); - return acc; - } - - const prefix = match[1]; - const baseVersion = - project.versioningStrategy === 'semver' - ? `${match[2]}.${match[3]}` - : match[2]; - - if (!acc.releases[baseVersion]) { - acc.unmappableTags.push(tag.tagName); - return acc; - } - - if (prefix === 'rc') { - const existingEntry = acc.releases[baseVersion].candidates.find( - ({ tagName }) => tagName === tag.tagName, - ); - - if (existingEntry) { - existingEntry.sha = tag.sha; - } else { - acc.releases[baseVersion].candidates.push({ - tagName: tag.tagName, - sha: tag.sha, - }); - } - } - - if (prefix === 'version') { - const existingEntry = acc.releases[baseVersion].versions.find( - ({ tagName }) => tagName === tag.tagName, - ); - - if (existingEntry) { - existingEntry.sha = tag.sha; - } else { - acc.releases[baseVersion].versions.push({ - tagName: tag.tagName, - sha: tag.sha, - }); - } - } - - return acc; - }, - { - ...mappedReleases, - unmatchedTags: [], - unmappableTags: [], - }, - ), - }; -} diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getSummary.test.tsx b/plugins/github-release-manager/src/features/Stats/helpers/getSummary.test.tsx new file mode 100644 index 0000000000..be6052c2a0 --- /dev/null +++ b/plugins/github-release-manager/src/features/Stats/helpers/getSummary.test.tsx @@ -0,0 +1,34 @@ +/* + * 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 { getSummary } from './getSummary'; +import { mockReleaseStats } from '../../../test-helpers/stats'; + +describe('getSummary', () => { + it('should get summary', () => { + const result = getSummary({ releaseStats: mockReleaseStats }); + + expect(result).toMatchInlineSnapshot(` + Object { + "summary": Object { + "totalCandidatePatches": 3, + "totalReleases": 2, + "totalVersionPatches": 1, + }, + } + `); + }); +}); diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getSummary.tsx b/plugins/github-release-manager/src/features/Stats/helpers/getSummary.tsx index b898469c8a..e42c5c7379 100644 --- a/plugins/github-release-manager/src/features/Stats/helpers/getSummary.tsx +++ b/plugins/github-release-manager/src/features/Stats/helpers/getSummary.tsx @@ -14,32 +14,35 @@ * limitations under the License. */ -import { getReleasesWithTags } from './getReleasesWithTags'; +import { ReleaseStats } from '../contexts/ReleaseStatsContext'; -export function getSummary({ - releasesWithTags, -}: { - releasesWithTags: ReturnType['releasesWithTags']; -}) { - return Object.entries(releasesWithTags.releases).reduce( - ( - acc: { - totalReleases: number; - totalCandidatePatches: number; - totalVersionPatches: number; +export function getSummary({ releaseStats }: { releaseStats: ReleaseStats }) { + return { + summary: Object.entries(releaseStats.releases).reduce( + ( + acc: { + totalReleases: number; + totalCandidatePatches: number; + totalVersionPatches: number; + }, + [_baseVersion, mappedRelease], + ) => { + const candidatePatches = + Object.keys(mappedRelease.candidates).length - 1; + const versionPatches = Object.keys(mappedRelease.versions).length - 1; + + acc.totalReleases += 1; + acc.totalCandidatePatches += + candidatePatches >= 0 ? candidatePatches : 0; + acc.totalVersionPatches += versionPatches >= 0 ? versionPatches : 0; + + return acc; }, - [_baseVersion, mappedRelease], - ) => { - acc.totalReleases += 1; - acc.totalCandidatePatches += mappedRelease.candidates.length - 1; - acc.totalVersionPatches += mappedRelease.versions.length - 1; - - return acc; - }, - { - totalReleases: 0, - totalCandidatePatches: 0, - totalVersionPatches: 0, - }, - ); + { + totalReleases: 0, + totalCandidatePatches: 0, + totalVersionPatches: 0, + }, + ), + }; } diff --git a/plugins/github-release-manager/src/features/Stats/hooks/useGetCommit.ts b/plugins/github-release-manager/src/features/Stats/hooks/useGetCommit.ts index d19aa30331..95db493774 100644 --- a/plugins/github-release-manager/src/features/Stats/hooks/useGetCommit.ts +++ b/plugins/github-release-manager/src/features/Stats/hooks/useGetCommit.ts @@ -16,20 +16,25 @@ import { useAsync } from 'react-use'; +import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; import { usePluginApiClientContext } from '../../../contexts/PluginApiClientContext'; import { useProjectContext } from '../../../contexts/ProjectContext'; -export const useGetCommit = ({ ref }: { ref: string }) => { +export const useGetCommit = ({ ref }: { ref?: string }) => { const { pluginApiClient } = usePluginApiClientContext(); const { project } = useProjectContext(); - const commit = useAsync(() => - pluginApiClient.stats.getCommit({ + const commit = useAsync(async () => { + if (!ref) { + throw new GitHubReleaseManagerError('Missing ref to get commit'); + } + + return pluginApiClient.stats.getCommit({ owner: project.owner, repo: project.repo, ref, - }), - ); + }); + }); return { commit, diff --git a/plugins/github-release-manager/src/test-helpers/stats.ts b/plugins/github-release-manager/src/test-helpers/stats.ts new file mode 100644 index 0000000000..22b3b83d1e --- /dev/null +++ b/plugins/github-release-manager/src/test-helpers/stats.ts @@ -0,0 +1,70 @@ +/* + * 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 { ReleaseStats } from '../features/Stats/contexts/ReleaseStatsContext'; + +export const mockReleaseStats: ReleaseStats = { + releases: { + '1.0': { + baseVersion: '1.0', + createdAt: '2021-01-01T10:11:12Z', + htmlUrl: 'html_url', + candidates: [ + { + tagName: 'rc-1.0.1', + sha: 'sha-1.0.1', + }, + { + tagName: 'rc-1.0.0', + sha: 'sha-1.0.0', + }, + ], + versions: [], + }, + '1.1': { + baseVersion: '1.1', + createdAt: '2021-01-01T10:11:12Z', + htmlUrl: 'html_url', + candidates: [ + { + tagName: 'rc-1.1.2', + sha: 'sha-1.1.2', + }, + { + tagName: 'rc-1.1.1', + sha: 'sha-1.1.1', + }, + { + tagName: 'rc-1.1.0', + sha: 'sha-1.1.0', + }, + ], + versions: [ + { + tagName: 'version-1.1.3', + sha: 'sha-1.1.3', + }, + { + tagName: 'version-1.1.2', + sha: 'sha-1.1.2', + }, + ], + }, + }, + unmappableTags: [], + unmatchedReleases: [], + unmatchedTags: [], +}; diff --git a/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts b/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts deleted file mode 100644 index 89553b3e24..0000000000 --- a/plugins/github-release-manager/src/test-helpers/test-helpers.test.ts +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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 * as testHelpers from './test-helpers'; - -describe('testHelpers', () => { - it('should export the correct things', () => { - expect(testHelpers).toMatchInlineSnapshot(` - Object { - "mockApiClient": Object { - "createRc": Object { - "createRef": [MockFunction], - "createRelease": [MockFunction], - "getComparison": [MockFunction], - }, - "getBranch": [MockFunction], - "getHost": [MockFunction], - "getLatestCommit": [MockFunction], - "getLatestRelease": [MockFunction], - "getOwners": [MockFunction], - "getRecentCommits": [MockFunction], - "getRepoPath": [MockFunction], - "getRepositories": [MockFunction], - "getRepository": [MockFunction], - "getUsername": [MockFunction], - "patch": Object { - "createCherryPickCommit": [MockFunction], - "createReference": [MockFunction], - "createTagObject": [MockFunction], - "createTempCommit": [MockFunction], - "forceBranchHeadToTempCommit": [MockFunction], - "merge": [MockFunction], - "replaceTempCommit": [MockFunction], - "updateRelease": [MockFunction], - }, - "promoteRc": Object { - "promoteRelease": [MockFunction], - }, - "stats": Object { - "getAllReleases": [MockFunction], - "getAllTags": [MockFunction], - "getCommit": [MockFunction], - }, - }, - "mockBumpedTag": "rc-2020.01.01_1337", - "mockCalverProject": Object { - "isProvidedViaProps": false, - "owner": "mock_owner", - "repo": "mock_repo", - "versioningStrategy": "calver", - }, - "mockDefaultBranch": "mock_defaultBranch", - "mockNextGitHubInfoCalver": Object { - "rcBranch": "rc/2020.01.01_1", - "rcReleaseTag": "rc-2020.01.01_1", - "releaseName": "Version 2020.01.01_1", - }, - "mockNextGitHubInfoSemver": Object { - "rcBranch": "rc/1.2.3", - "rcReleaseTag": "rc-1.2.3", - "releaseName": "Version 1.2.3", - }, - "mockReleaseBranch": Object { - "commit": Object { - "commit": Object { - "tree": Object { - "sha": "mock_branch_commit_commit_tree_sha", - }, - }, - "sha": "mock_branch_commit_sha", - }, - "links": Object { - "html": "mock_branch_links_html", - }, - "name": "rc/1.2.3", - }, - "mockReleaseCandidateCalver": Object { - "htmlUrl": "mock_release_html_url", - "id": 1, - "prerelease": true, - "tagName": "rc-2020.01.01_1", - "targetCommitish": "rc/2020.01.01_1", - }, - "mockReleaseCandidateSemver": Object { - "htmlUrl": "mock_release_html_url", - "id": 1, - "prerelease": true, - "tagName": "rc-1.2.3", - "targetCommitish": "rc/1.2.3", - }, - "mockReleaseVersionCalver": Object { - "htmlUrl": "mock_release_html_url", - "id": 1, - "prerelease": false, - "tagName": "version-2020.01.01_1", - "targetCommitish": "rc/2020.01.01_1", - }, - "mockReleaseVersionSemver": Object { - "htmlUrl": "mock_release_html_url", - "id": 1, - "prerelease": false, - "tagName": "version-1.2.3", - "targetCommitish": "rc/1.2.3", - }, - "mockSearchCalver": "?versioningStrategy=calver&owner=mock_owner&repo=mock_repo", - "mockSearchSemver": "?versioningStrategy=semver&owner=mock_owner&repo=mock_repo", - "mockSelectedPatchCommit": Object { - "author": Object { - "htmlUrl": "author_html_url", - "login": "author_login", - }, - "commit": Object { - "message": "commit_message", - }, - "firstParentSha": "mock_first_parent_sha", - "htmlUrl": "mock_htmlUrl", - "sha": "mock_sha_selected_patch_commit", - }, - "mockSemverProject": Object { - "isProvidedViaProps": false, - "owner": "mock_owner", - "repo": "mock_repo", - "versioningStrategy": "semver", - }, - "mockTagParts": Object { - "calver": "2020.01.01", - "patch": 1, - "prefix": "rc", - }, - } - `); - }); -}); diff --git a/plugins/github-release-manager/src/test-helpers/test-helpers.ts b/plugins/github-release-manager/src/test-helpers/test-helpers.ts index 629bdb4031..68bd9c7e3b 100644 --- a/plugins/github-release-manager/src/test-helpers/test-helpers.ts +++ b/plugins/github-release-manager/src/test-helpers/test-helpers.ts @@ -280,16 +280,25 @@ export const mockApiClient: IPluginApiClient = { }, stats: { - getAllTags: jest.fn(async () => { - throw new Error('Not implemented'); - }), + getAllTags: jest.fn(async () => [ + { + tagName: MOCK_RELEASE_CANDIDATE_TAG_NAME_CALVER, + sha: 'mock_sha', + }, + ]), - getAllReleases: jest.fn(async () => { - throw new Error('Not implemented'); - }), + getAllReleases: jest.fn(async () => [ + { + id: 1, + name: 'mock_release_name', + tagName: 'mock_release_tag_name', + createdAt: 'mock_release_published_at', + htmlUrl: 'mock_release_html_url', + }, + ]), - getCommit: jest.fn(async () => { - throw new Error('Not implemented'); - }), + getCommit: jest.fn(async () => ({ + createdAt: '2021-01-01T10:11:12Z', + })), }, }; diff --git a/plugins/github-release-manager/src/test-helpers/test-ids.test.ts b/plugins/github-release-manager/src/test-helpers/test-ids.test.ts deleted file mode 100644 index 199a7a5745..0000000000 --- a/plugins/github-release-manager/src/test-helpers/test-ids.test.ts +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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 * as testIds from './test-ids'; - -describe('test-ids', () => { - it('should export the correct things', () => { - expect(testIds).toMatchInlineSnapshot(` - Object { - "TEST_IDS": Object { - "components": Object { - "circularProgress": "grm--circular-progress", - "differ": Object { - "current": "grm--differ-current", - "icons": Object { - "branch": "grm--differ--icons--branch", - "github": "grm--differ--icons--github", - "slack": "grm--differ--icons--slack", - "tag": "grm--differ--icons--tag", - "versioning": "grm--differ--icons--versioning", - }, - "next": "grm--differ-next", - }, - "divider": "grm--divider", - "linearProgressWithLabel": "grm--linear-progress-with-label", - "noLatestRelease": "grm--no-latest-release", - "responseStepListDialogContent": "grm--response-step-list--dialog-content", - "responseStepListItem": "grm--response-step-list-item", - "responseStepListItemIconDefault": "grm--response-step-list-item--item-icon--default", - "responseStepListItemIconFailure": "grm--response-step-list-item--item-icon--failure", - "responseStepListItemIconLink": "grm--response-step-list-item--item-icon--link", - "responseStepListItemIconSuccess": "grm--response-step-list-item--item-icon--success", - }, - "createRc": Object { - "cta": "grm--create-rc--cta", - "semverSelect": "grm--create-rc--semver-select", - }, - "form": Object { - "owner": Object { - "empty": "grm--form--owner--empty", - "error": "grm--form--owner--error", - "loading": "grm--form--owner--loading", - "select": "grm--form--owner--select", - }, - "repo": Object { - "empty": "grm--form--repo--empty", - "error": "grm--form--repo--error", - "loading": "grm--form--repo--loading", - "select": "grm--form--repo--select", - }, - "versioningStrategy": Object { - "radioGroup": "grm--form--versioning-strategy--radio-group", - }, - }, - "info": Object { - "info": "grm--info", - "infoFeaturePlus": "grm--info-feature-plus", - }, - "patch": Object { - "body": "grm--patch-body", - "error": "grm--patch-body--error", - "loading": "grm--patch-body--loading", - "notPrerelease": "grm--patch-body--not-prerelease--info", - }, - "promoteRc": Object { - "cta": "grm--promote-rc-body--cta", - "mockedPromoteRcBody": "grm-mocked-promote-rc-body", - "notRcWarning": "grm--promote-rc--not-rc-warning", - "promoteRc": "grm--promote-rc", - }, - }, - } - `); - }); -}); From 43db3d6892115eded93b3e5a655889658554c0a6 Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Fri, 23 Apr 2021 19:02:01 +0200 Subject: [PATCH 113/485] [docker] Fix error in docker build Before: ``` Step 7/8 : RUN tar xzf bundle.tar.gz && rm bundle.tar.gz ---> Running in 91107ee4a847 tar (child): bundle.tar.gz: Cannot open: No such file or directory tar (child): Error is not recoverable: exiting now tar: Child returned status 2 tar: Error is not recoverable: exiting now ``` Signed-off-by: Martina Iglesias Fernandez --- packages/backend/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/Dockerfile b/packages/backend/Dockerfile index 02aab45609..31231a3a4a 100644 --- a/packages/backend/Dockerfile +++ b/packages/backend/Dockerfile @@ -22,7 +22,7 @@ RUN tar xzf skeleton.tar.gz && rm skeleton.tar.gz RUN yarn install --frozen-lockfile --production --network-timeout 300000 && rm -rf "$(yarn cache dir)" # Then copy the rest of the backend bundle, along with any other files we might want. -ADD packages/backend/dist/bundle.tar.gz app-config.yaml ./ +COPY packages/backend/dist/bundle.tar.gz app-config.yaml ./ RUN tar xzf bundle.tar.gz && rm bundle.tar.gz CMD ["node", "packages/backend", "--config", "app-config.yaml"] From a3f090b2f391d47c9a36e8aeb53041798a9e02ac Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Wed, 21 Apr 2021 19:58:02 +0200 Subject: [PATCH 114/485] catalog-backend: WIP EntityProvider mutation interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: blam Signed-off-by: Patrik Oldsberg --- .../next/DefaultCatalogProcessingEngine.ts | 15 ++-- .../src/next/DefaultLocationStore.ts | 68 ++++++++++--------- .../src/next/NextCatalogBuilder.ts | 3 +- plugins/catalog-backend/src/next/types.ts | 21 +++--- 4 files changed, 55 insertions(+), 52 deletions(-) diff --git a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts index 934ab3a1cc..b423b61041 100644 --- a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts +++ b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts @@ -19,6 +19,8 @@ import { CatalogProcessingEngine, EntityProvider, EntityMessage, + EntityProviderConnection, + EntityProviderMutation, ProcessingStateManager, CatalogProcessingOrchestrator, } from './types'; @@ -27,8 +29,13 @@ import { Logger } from 'winston'; import { stringifyEntityRef } from '@backstage/catalog-model'; import { Stitcher } from './Stitcher'; +class Connection implements EntityProviderConnection { + constructor(private readonly stateManager: ProcessingStateManager) {} + + async applyMutation(mutation: EntityProviderMutation): Promise {} +} + export class DefaultCatalogProcessingEngine implements CatalogProcessingEngine { - private subscriptions: Subscription[] = []; private running: boolean = false; constructor( @@ -41,11 +48,7 @@ export class DefaultCatalogProcessingEngine implements CatalogProcessingEngine { async start() { for (const provider of this.entityProviders) { - const id = 'databaseProvider'; - const subscription = provider - .entityChange$() - .subscribe({ next: m => this.onNext(id, m) }); - this.subscriptions.push(subscription); + provider.connect(new Connection(this.stateManager)); } this.running = true; diff --git a/plugins/catalog-backend/src/next/DefaultLocationStore.ts b/plugins/catalog-backend/src/next/DefaultLocationStore.ts index b21fe9da02..a6b4adcca4 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationStore.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationStore.ts @@ -16,24 +16,29 @@ import { LocationSpec, Location } from '@backstage/catalog-model'; import { Database } from '../database'; -import { LocationStore } from './types'; +import { + LocationStore, + EntityProvider, + EntityProviderConnection, +} from './types'; import { v4 as uuidv4 } from 'uuid'; +import { locationSpecToLocationEntity } from './util'; import { ConflictError } from '@backstage/errors'; -import { Observable } from '@backstage/core'; -import ObservableImpl from 'zen-observable'; export type LocationMessage = | { all: Location[] } | { added: Location[]; removed: Location[] }; -export class DefaultLocationStore implements LocationStore { - private subscribers = new Set< - ZenObservable.SubscriptionObserver - >(); +export class DefaultLocationStore implements LocationStore, EntityProvider { + private _connection: EntityProviderConnection | undefined; constructor(private readonly db: Database) {} createLocation(spec: LocationSpec): Promise { + if (!this.connection) { + throw new Error('location store is not initialized'); + } + return this.db.transaction(async tx => { // TODO: id should really be type and target combined and not a uuid. @@ -55,7 +60,11 @@ export class DefaultLocationStore implements LocationStore { target: spec.target, }); - this.notifyAddition(location); + await this.connection.applyMutation({ + type: 'delta', + added: [locationSpecToLocationEntity(location)], + removed: [], + }); return location; }); @@ -75,40 +84,33 @@ export class DefaultLocationStore implements LocationStore { } deleteLocation(id: string): Promise { + if (!this.connection) { + throw new Error('location store is not initialized'); + } + return this.db.transaction(async tx => { const location = await this.db.location(id); if (!location) { throw new ConflictError(`No location found with id: ${id}`); } await this.db.removeLocation(tx, id); - this.notifyDeletion(location); - }); - } - - private notifyAddition(location: Location) { - for (const subscriber of this.subscribers) { - subscriber.next({ - added: [location], - removed: [], - }); - } - } - - private notifyDeletion(location: Location) { - for (const subscriber of this.subscribers) { - subscriber.next({ + await this.connection.applyMutation({ + type: 'delta', added: [], - removed: [location], + removed: [locationSpecToLocationEntity(location)], }); - } + }); } - location$(): Observable { - return new ObservableImpl(subscriber => { - this.subscribers.add(subscriber); - return () => { - this.subscribers.delete(subscriber); - }; - }); + private get connection(): EntityProviderConnection { + if (!this._connection) { + throw new Error('location store is not initialized'); + } + + return this._connection; + } + + async connect(connection: EntityProviderConnection): Promise { + this._connection = connection; } } diff --git a/plugins/catalog-backend/src/next/NextCatalogBuilder.ts b/plugins/catalog-backend/src/next/NextCatalogBuilder.ts index c3e0a6bd9c..1796847164 100644 --- a/plugins/catalog-backend/src/next/NextCatalogBuilder.ts +++ b/plugins/catalog-backend/src/next/NextCatalogBuilder.ts @@ -272,11 +272,10 @@ export class NextCatalogBuilder { const entitiesCatalog = new NextEntitiesCatalog(dbClient); const locationStore = new DefaultLocationStore(db); - const dbLocationProvider = new DatabaseLocationProvider(locationStore); const stitcher = new Stitcher(dbClient, logger); const processingEngine = new DefaultCatalogProcessingEngine( logger, - [dbLocationProvider], // entityproviders + [locationStore], // entityproviders stateManager, orchestrator, stitcher, diff --git a/plugins/catalog-backend/src/next/types.ts b/plugins/catalog-backend/src/next/types.ts index 0aeb290224..c3854d631f 100644 --- a/plugins/catalog-backend/src/next/types.ts +++ b/plugins/catalog-backend/src/next/types.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { Entity, EntityName, @@ -21,7 +22,6 @@ import { EntityRelationSpec, } from '@backstage/catalog-model'; import { JsonObject } from '@backstage/config'; -import { Observable } from '@backstage/core'; // << nooo export interface LocationEntity { apiVersion: 'backstage.io/v1alpha1'; @@ -45,20 +45,11 @@ export interface LocationService { deleteLocation(id: string): Promise; } -export type EntityMessage = - | { all: Entity[] } - | { added: Entity[]; removed: EntityName[] }; - export interface LocationStore { - // extends EntityProvider createLocation(spec: LocationSpec): Promise; listLocations(): Promise; getLocation(id: string): Promise; deleteLocation(id: string): Promise; - - location$(): Observable< - { all: Location[] } | { added: Location[]; removed: Location[] } - >; } export interface CatalogProcessingEngine { @@ -66,8 +57,16 @@ export interface CatalogProcessingEngine { stop(): Promise; } +export type EntityProviderMutation = + | { type: 'full'; entities: Iterable } + | { type: 'delta'; added: Iterable; removed: Iterable }; + +export interface EntityProviderConnection { + applyMutation(mutation: EntityProviderMutation): Promise; +} + export interface EntityProvider { - entityChange$(): Observable; + connect(connection: EntityProviderConnection): Promise; } export type EntityProcessingRequest = { From 92a4a4832beccc622f83473328555f03d094bba7 Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 22 Apr 2021 19:41:40 +0200 Subject: [PATCH 115/485] chore: worked on some more of the new catalog migration with fixing deps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Patrik Oldsberg Co-authored-by: Johan Haals Co-authored-by: Fredrik Adelöw Signed-off-by: blam --- .../20210302150147_refresh_state.js | 33 ++-- .../next/DefaultCatalogProcessingEngine.ts | 38 +++- .../src/next/DefaultLocationStore.ts | 4 - .../src/next/DefaultProcessingStateManager.ts | 13 +- .../src/next/database/DatabaseManager.ts | 114 +++++++++++ .../DefaultProcessingDatabase.test.ts | 31 +++ .../database/DefaultProcessingDatabase.ts | 180 +++++++++++++++++- .../src/next/database/types.ts | 17 ++ plugins/catalog-backend/src/next/types.ts | 21 +- 9 files changed, 405 insertions(+), 46 deletions(-) create mode 100644 plugins/catalog-backend/src/next/database/DatabaseManager.ts create mode 100644 plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts diff --git a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js index 6abab6270b..14c75b2530 100644 --- a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js +++ b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js @@ -59,13 +59,14 @@ exports.up = async function up(knex) { .notNullable() .comment('JSON array containing all errors related to entity'); table - .dateTime('next_update_at') + .dateTime('next_update_at') // TOOD: timezone or change to epoch-millis or similar .notNullable() .comment('Timestamp of when entity should be updated'); table - .dateTime('last_discovery_at') + .dateTime('last_discovery_at') // TOOD: timezone or change to epoch-millis or similar .notNullable() .comment('The last timestamp of which this entity was discovered'); + table.index('entity_id', 'refresh_state_entity_id_idx'); table.index('entity_ref', 'refresh_state_entity_ref_idx'); table.index('next_update_at', 'refresh_state_next_update_at_idx'); }); @@ -94,38 +95,35 @@ exports.up = async function up(knex) { 'Holds edges between refresh state rows. Every time when an entity is processed and emits another entity, an edge will be stored to represent that fact. This is used to detect orphans and ultimately deletions.', ); table - .text('source_special_key') + .text('source_key') .nullable() .comment( 'When the reference source is not an entity, this is an opaque identifier for that source.', ); table - .text('source_entity_id') + .text('source_entity_ref') .nullable() - .references('entity_id') + .references('entity_ref') .inTable('refresh_state') .onDelete('CASCADE') .comment( - 'When the reference source is an entity, this is the ID of the source entity.', + 'When the reference source is an entity, this is the EntityRef of the source entity.', ); table - .text('target_entity_id') + .text('target_entity_ref') .notNullable() - .references('entity_id') + .references('entity_ref') .inTable('refresh_state') .onDelete('CASCADE') - .comment('The ID of the target entity.'); + .comment('The EntityRef of the target entity.'); + table.index('source_key', 'refresh_state_references_source_key_idx'); table.index( - 'source_special_key', - 'refresh_state_references_source_special_key_idx', + 'source_entity_ref', + 'refresh_state_references_source_entity_ref_idx', ); table.index( - 'source_entity_id', - 'refresh_state_references_source_entity_id_idx', - ); - table.index( - 'target_entity_id', - 'refresh_state_references_target_entity_id_idx', + 'target_entity_ref', + 'refresh_state_references_target_entity_ref_idx', ); }); @@ -165,6 +163,7 @@ exports.down = async function down(knex) { table.dropIndex([], 'refresh_state_references_target_entity_id_idx'); }); await knex.schema.alterTable('refresh_state', table => { + table.dropIndex([], 'refresh_state_entity_id_idx'); table.dropIndex([], 'refresh_state_entity_ref_idx'); table.dropIndex([], 'refresh_state_next_update_at_idx'); }); diff --git a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts index b423b61041..7f49bf832d 100644 --- a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts +++ b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts @@ -30,9 +30,31 @@ import { stringifyEntityRef } from '@backstage/catalog-model'; import { Stitcher } from './Stitcher'; class Connection implements EntityProviderConnection { - constructor(private readonly stateManager: ProcessingStateManager) {} + constructor( + private readonly config: { + stateManager: ProcessingStateManager; + id: string; + }, + ) {} - async applyMutation(mutation: EntityProviderMutation): Promise {} + async applyMutation(mutation: EntityProviderMutation): Promise { + if (mutation.type === 'full') { + await this.config.stateManager.replaceProcessingItems({ + id: this.config.id, + type: 'full', + items: mutation.entities, + }); + + return; + } + + await this.config.stateManager.replaceProcessingItems({ + id: this.config.id, + type: 'delta', + added: mutation.added, + removed: mutation.removed, + }); + } } export class DefaultCatalogProcessingEngine implements CatalogProcessingEngine { @@ -48,7 +70,9 @@ export class DefaultCatalogProcessingEngine implements CatalogProcessingEngine { async start() { for (const provider of this.entityProviders) { - provider.connect(new Connection(this.stateManager)); + // TODO: this ID should be some form of identifier for the EntityProvider + const id = 'databaseProvider'; + provider.connect(new Connection({ stateManager: this.stateManager, id })); } this.running = true; @@ -57,12 +81,12 @@ export class DefaultCatalogProcessingEngine implements CatalogProcessingEngine { const { id, entity, - state: intialState, + state: initialState, } = await this.stateManager.getNextProcessingItem(); const result = await this.orchestrator.process({ entity, - state: intialState, + state: initialState, }); for (const error of result.errors) { @@ -95,10 +119,6 @@ export class DefaultCatalogProcessingEngine implements CatalogProcessingEngine { async stop() { this.running = false; - - for (const subscription of this.subscriptions) { - subscription.unsubscribe(); - } } private async onNext(id: string, message: EntityMessage) { diff --git a/plugins/catalog-backend/src/next/DefaultLocationStore.ts b/plugins/catalog-backend/src/next/DefaultLocationStore.ts index a6b4adcca4..dff424b1a9 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationStore.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationStore.ts @@ -35,10 +35,6 @@ export class DefaultLocationStore implements LocationStore, EntityProvider { constructor(private readonly db: Database) {} createLocation(spec: LocationSpec): Promise { - if (!this.connection) { - throw new Error('location store is not initialized'); - } - return this.db.transaction(async tx => { // TODO: id should really be type and target combined and not a uuid. diff --git a/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts b/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts index 91090bc139..d2765c3101 100644 --- a/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts +++ b/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts @@ -17,14 +17,23 @@ import { ProcessingDatabase, RefreshStateItem } from './database/types'; import { AddProcessingItemRequest, - ProccessingItem, + ProcessingItem, ProcessingItemResult, ProcessingStateManager, + ReplaceProcessingItemsRequest, } from './types'; export class DefaultProcessingStateManager implements ProcessingStateManager { constructor(private readonly db: ProcessingDatabase) {} + replaceProcessingItems( + request: ReplaceProcessingItemsRequest, + ): Promise { + return this.db.transaction(async tx => { + await this.db.replaceUnprocessedEntities(tx, request); + }); + } + async setProcessingItemResult(result: ProcessingItemResult) { return this.db.transaction(async tx => { await this.db.updateProcessedEntity(tx, { @@ -44,7 +53,7 @@ export class DefaultProcessingStateManager implements ProcessingStateManager { }); } - async getNextProcessingItem(): Promise { + async getNextProcessingItem(): Promise { const entities = await new Promise(resolve => this.popFromQueue(resolve), ); diff --git a/plugins/catalog-backend/src/next/database/DatabaseManager.ts b/plugins/catalog-backend/src/next/database/DatabaseManager.ts new file mode 100644 index 0000000000..4c9e45950f --- /dev/null +++ b/plugins/catalog-backend/src/next/database/DatabaseManager.ts @@ -0,0 +1,114 @@ +/* + * Copyright 2020 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 { getVoidLogger, resolvePackagePath } from '@backstage/backend-common'; +import knexFactory, { Knex } from 'knex'; +import { v4 as uuidv4 } from 'uuid'; +import { Logger } from 'winston'; +import { CommonDatabase } from '../../database/CommonDatabase'; +import { Database } from '../../database/types'; +import fs from 'fs-extra'; + +export type CreateDatabaseOptions = { + logger: Logger; +}; + +const defaultOptions: CreateDatabaseOptions = { + logger: getVoidLogger(), +}; + +export class DatabaseManager { + public static async createDatabase( + knex: Knex, + options: Partial = {}, + ): Promise { + const allMigrations = resolvePackagePath( + '@backstage/plugin-catalog-backend', + 'migrations', + ); + + const migrationsDir = resolvePackagePath( + '@backstage/plugin-catalog-backend', + 'migrationsv2', + ); + await fs.copy(allMigrations, migrationsDir); + + await knex.migrate.latest({ + directory: migrationsDir, + }); + const { logger } = { ...defaultOptions, ...options }; + return new CommonDatabase(knex, logger); + } + + public static async createInMemoryDatabase(): Promise { + const knex = await this.createInMemoryDatabaseConnection(); + return await this.createDatabase(knex); + } + + public static async createInMemoryDatabaseConnection(): Promise { + const knex = knexFactory({ + client: 'sqlite3', + connection: ':memory:', + useNullAsDefault: true, + }); + + knex.client.pool.on('createSuccess', (_eventId: any, resource: any) => { + resource.run('PRAGMA foreign_keys = ON', () => {}); + }); + + return knex; + } + + public static async createTestDatabase(): Promise { + const knex = await this.createTestDatabaseConnection(); + return await this.createDatabase(knex); + } + + public static async createTestDatabaseConnection(): Promise { + const config: Knex.Config = { + /* + client: 'pg', + connection: { + host: 'localhost', + user: 'postgres', + password: 'postgres', + }, + */ + client: 'sqlite3', + connection: ':memory:', + useNullAsDefault: true, + }; + + let knex = knexFactory(config); + if (typeof config.connection !== 'string') { + const tempDbName = `d${uuidv4().replace(/-/g, '')}`; + await knex.raw(`CREATE DATABASE ${tempDbName};`); + knex = knexFactory({ + ...config, + connection: { + ...config.connection, + database: tempDbName, + }, + }); + } + + knex.client.pool.on('createSuccess', (_eventId: any, resource: any) => { + resource.run('PRAGMA foreign_keys = ON', () => {}); + }); + + return knex; + } +} diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts new file mode 100644 index 0000000000..fd2e9e6750 --- /dev/null +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts @@ -0,0 +1,31 @@ +/* + * 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 { DefaultProcessingDatabase } from './DefaultProcessingDatabase'; +import { DatabaseManager } from './DatabaseManager'; +import { Knex } from 'knex'; + +describe('Default Processing Database', () => { + let db: Knex | undefined; + + beforeEach(async () => { + db = await DatabaseManager.createTestDatabaseConnection(); + await DatabaseManager.createDatabase(db); + }); + + it('should write some stuff', async () => { + await db('refresh_state_referencess').select(); + }); +}); diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts index cf2d4e121c..b799bd6284 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts @@ -15,6 +15,7 @@ */ import { ConflictError, NotFoundError } from '@backstage/errors'; +import { stringifyEntityRef, Entity } from '@backstage/catalog-model'; import { Knex } from 'knex'; import { Transaction } from '../../database'; import lodash from 'lodash'; @@ -24,20 +25,21 @@ import { AddUnprocessedEntitiesOptions, UpdateProcessedEntityOptions, GetProcessableEntitiesResult, + ReplaceUnprocessedEntitiesOptions, } from './types'; import type { Logger } from 'winston'; -import { Entity, stringifyEntityRef } from '@backstage/catalog-model'; + import { v4 as uuid } from 'uuid'; export type DbRefreshStateRow = { entity_id: string; entity_ref: string; unprocessed_entity: string; - processed_entity: string; - cache: string; + processed_entity?: string; + cache?: string; next_update_at: string; last_discovery_at: string; // remove? - errors: string; + errors?: string; }; export type DbRelationsRow = { @@ -47,10 +49,10 @@ export type DbRelationsRow = { type: string; }; -export type DbRefreshStateReferences = { - source_special_key?: string; - source_entity_id?: string; - target_entity_id: string; +export type DbRefreshStateReferencesRow = { + source_key?: string; + source_entity_ref?: string; + target_entity_ref: string; }; // The number of items that are sent per batch to the database layer, when @@ -128,6 +130,164 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { ); } + async replaceUnprocessedEntities( + txOpaque: Transaction, + options: ReplaceUnprocessedEntitiesOptions, + ): Promise { + const tx = txOpaque as Knex.Transaction; + const entityIds = new Array(); + + if (options.type === 'full') { + const oldRefs = await tx( + 'refresh_state_references', + ) + .where({ source_key: options.sourceKey }) + .select('target_entity_ref') + .then(rows => rows.map(r => r.target_entity_ref)); + + const items = options.items.map(entity => ({ + entity, + ref: stringifyEntityRef(entity), + id: uuid(), + })); + + const oldRefsSet = new Set(oldRefs); + const newRefsSet = new Set(items.map(item => item.ref)); + const toAdd = items.filter(item => !oldRefsSet.has(item.ref)); + const toRemove = oldRefs.filter(ref => !newRefsSet.has(ref)); + + if (toRemove.length) { + // TODO(freben): Batch split, to not hit variable limits? + + // get all refs where source = any of the toRemove + // delete all state rows matching any of the toRemove + // revisit the targets of all of those refs + // verify if they have references, otherwise delete from refresh_state + + const current = [...toRemove]; + while (true) { + + tx.withRecursive('r', function refs() { + return tx.select({ }) + .from({ r1: 'refresh_state_references' }) + .where({ source_key: options.sourceKey }) + .whereIn('target_entity_ref', toRemove) + .unionAll(function recurse() { + return tx.select({ }) + .from({ r2: 'refresh_state_references' }) + .whereNotExists() + }) + }) + .select().from('refs'); + + const nextLayerToRemove = await tx( + 'refresh_state_references', + ) + .whereIn('source_entity_ref', toRemove) + .leftOuterJoin('refresh_state_references AS b', function f() { + + }) + + .whereNotNull('b.source_target_ref') + .select('target_entity_ref'); + + await tx('refresh_state') + .whereIn('entity_ref', toRemove) + .delete(); + + const refsThatStillHaveASourcePointingAtThe = await tx( + 'refresh_state_references', + ) + .whereIn('target_entity_ref', nextLayerTargetRefs) + .groupBy('target_entity_ref') + .select('target_entity_ref'); + + } + + + + + if (toAdd.length) { + const state: Knex.DbRecord[] = toAdd.map(item => ({ + entity_id: item.id, + entity_ref: item.ref, + unprocessed_entity: JSON.stringify(item.entity), + errors: '', + next_update_at: tx.fn.now(), + last_discovery_at: tx.fn.now(), + })); + const stateReferences: DbRefreshStateReferencesRow[] = toAdd.map( + item => ({ + source_key: options.sourceKey, + target_entity_ref: item.ref, + }), + ); + // TODO(freben): Concurrency? If we did these one by one, a .onConflict().merge would have made sense + await tx.batchInsert('refresh_state', state, BATCH_SIZE); + await tx.batchInsert('refresh_state_references', stateReferences, BATCH_SIZE); + } + + + for (const entity of options.items) { + const entityRef = stringifyEntityRef(entity); + await tx('refresh_state') + .insert({ + entity_id: uuid(), + entity_ref: entityRef, + unprocessed_entity: JSON.stringify(entity), + errors: '', + next_update_at: tx.fn.now(), + last_discovery_at: tx.fn.now(), + }) + .onConflict('entity_ref') + .merge(['unprocessed_entity', 'last_discovery_at']); + + const [{ entity_id: entityId }] = await tx( + 'refresh_state', + ).where({ entity_ref: entityRef }); + entityIds.push(entityId); + } + const referenceRows: DbRefreshStateReferencesRow[] = entityIds.map( + entityId => ({ + source_key: options.sourceKey, + target_entityRef: entityRef, + }), + ); + await tx.batchInsert( + 'refresh_state_references', + referenceRows, + BATCH_SIZE, + ); + return; + } + + for (const entity of options.removed) { + const entityRef = stringifyEntityRef(entity); + const [result] = await tx('refresh_state') + .where({ entity_ref: entityRef }) + .select('entity_id'); + + if (!result) { + this.logger.info( + `Unable to delete entity '${entityRef}', entity does not exist in refresh state`, + ); + continue; + } + + const referenceResults = await tx( + 'refresh_state_references', + ) + // todo correct key? + .where({ source_entity_id: result.entity_id }) + .select(); + + await tx('refresh_state_references') + // todo correct key? + .where({ source_entity_id: result.entity_id }) + .delete(); + } + } + async addUnprocessedEntities( txOpaque: Transaction, options: AddUnprocessedEntitiesOptions, @@ -160,11 +320,11 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { ? { source_special_key: options.id } : { source_entity_id: options.id }; // copied from update refs - await tx('refresh_state_references') + await tx('refresh_state_references') .where(key) .delete(); - const referenceRows: DbRefreshStateReferences[] = entityIds.map( + const referenceRows: DbRefreshStateReferencesRow[] = entityIds.map( entityId => ({ ...key, target_entity_id: entityId, diff --git a/plugins/catalog-backend/src/next/database/types.ts b/plugins/catalog-backend/src/next/database/types.ts index 22e9e90c8e..b926676887 100644 --- a/plugins/catalog-backend/src/next/database/types.ts +++ b/plugins/catalog-backend/src/next/database/types.ts @@ -50,6 +50,19 @@ export type GetProcessableEntitiesResult = { items: RefreshStateItem[]; }; +export type ReplaceUnprocessedEntitiesOptions = + | { + sourceKey: string; + items: Entity[]; + type: 'full'; + } + | { + sourceKey: string; + added: Entity[]; + removed: Entity[]; + type: 'delta'; + }; + export interface ProcessingDatabase { transaction(fn: (tx: Transaction) => Promise): Promise; @@ -58,6 +71,10 @@ export interface ProcessingDatabase { options: AddUnprocessedEntitiesOptions, ): Promise; + replaceUnprocessedEntities( + txOpaque: Transaction, + options: ReplaceUnprocessedEntitiesOptions, + ): Promise; getProcessableEntities( txOpaque: Transaction, request: { processBatchSize: number }, diff --git a/plugins/catalog-backend/src/next/types.ts b/plugins/catalog-backend/src/next/types.ts index c3854d631f..f8b4de1c41 100644 --- a/plugins/catalog-backend/src/next/types.ts +++ b/plugins/catalog-backend/src/next/types.ts @@ -58,8 +58,8 @@ export interface CatalogProcessingEngine { } export type EntityProviderMutation = - | { type: 'full'; entities: Iterable } - | { type: 'delta'; added: Iterable; removed: Iterable }; + | { type: 'full'; entities: Entity[] } + | { type: 'delta'; added: Entity[]; removed: Entity[] }; export interface EntityProviderConnection { applyMutation(mutation: EntityProviderMutation): Promise; @@ -108,14 +108,27 @@ export type AddProcessingItemRequest = { entities: Entity[]; }; -export type ProccessingItem = { +export type ProcessingItem = { id: string; entity: Entity; state: Map; }; +export type ReplaceProcessingItemsRequest = + | { + id: string; + items: Entity[]; + type: 'full'; + } + | { + id: string; + added: Entity[]; + removed: Entity[]; + type: 'delta'; + }; export interface ProcessingStateManager { setProcessingItemResult(result: ProcessingItemResult): Promise; - getNextProcessingItem(): Promise; + getNextProcessingItem(): Promise; addProcessingItems(request: AddProcessingItemRequest): Promise; + replaceProcessingItems(request: ReplaceProcessingItemsRequest): Promise; } From f62db5992f7b9ba66dbcb291a9d88ab1264aca07 Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 23 Apr 2021 15:05:04 +0200 Subject: [PATCH 116/485] feat: added support for full sync replace with an awesome sql statement courtesy of @freben MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: Johan Haals Signed-off-by: blam --- .../20210302150147_refresh_state.js | 3 + .../DefaultProcessingDatabase.test.ts | 271 +++++++++++++++++- .../database/DefaultProcessingDatabase.ts | 220 +++++++------- 3 files changed, 390 insertions(+), 104 deletions(-) diff --git a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js index 14c75b2530..2afeda02c0 100644 --- a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js +++ b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js @@ -94,6 +94,9 @@ exports.up = async function up(knex) { table.comment( 'Holds edges between refresh state rows. Every time when an entity is processed and emits another entity, an edge will be stored to represent that fact. This is used to detect orphans and ultimately deletions.', ); + table + .increments('id') + .comment('Primary key to distinguish unique lines from each other'); table .text('source_key') .nullable() diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts index fd2e9e6750..ee04a2baf8 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts @@ -16,16 +16,283 @@ // import { DefaultProcessingDatabase } from './DefaultProcessingDatabase'; import { DatabaseManager } from './DatabaseManager'; import { Knex } from 'knex'; +import { + DbRefreshStateReferencesRow, + DbRefreshStateRow, + DefaultProcessingDatabase, +} from './DefaultProcessingDatabase'; + +import { Entity } from '@backstage/catalog-model'; +import * as uuid from 'uuid'; +import { getVoidLogger } from '@backstage/backend-common'; describe('Default Processing Database', () => { let db: Knex | undefined; + let processingDatabase: DefaultProcessingDatabase | undefined; + + const logger = getVoidLogger(); beforeEach(async () => { db = await DatabaseManager.createTestDatabaseConnection(); await DatabaseManager.createDatabase(db); + + processingDatabase = new DefaultProcessingDatabase(db!, logger); }); - it('should write some stuff', async () => { - await db('refresh_state_referencess').select(); + describe('replaceUnprocessedEntities', () => { + const insertRefRow = async (ref: DbRefreshStateReferencesRow) => { + return db!( + 'refresh_state_references', + ).insert(ref); + }; + + const insertRefreshStateRow = async (ref: DbRefreshStateRow) => { + await db!('refresh_state').insert(ref); + }; + + const createLocations = async (entityRefs: string[]) => { + for (const ref of entityRefs) { + await insertRefreshStateRow({ + entity_id: uuid.v4(), + entity_ref: ref, + unprocessed_entity: '{}', + processed_entity: '{}', + errors: '', + next_update_at: 'now()', + last_discovery_at: 'now()', + }); + } + }; + + it('replaces all existing state correctly for simple dependency chains', async () => { + /* + config -> location:default/root -> location:default/root-1 -> location:default/root-2 + database -> location:default/second -> location:default/root-2 + */ + await createLocations([ + 'location:default/root', + 'location:default/root-1', + 'location:default/root-2', + 'location:default/second', + ]); + + await insertRefRow({ + source_key: 'config', + target_entity_ref: 'location:default/root', + }); + + await insertRefRow({ + source_key: 'database', + target_entity_ref: 'location:default/second', + }); + + await insertRefRow({ + source_entity_ref: 'location:default/root', + target_entity_ref: 'location:default/root-1', + }); + + await insertRefRow({ + source_entity_ref: 'location:default/root-1', + target_entity_ref: 'location:default/root-2', + }); + + await insertRefRow({ + source_entity_ref: 'location:default/second', + target_entity_ref: 'location:default/root-2', + }); + + await processingDatabase!.transaction(async tx => { + await processingDatabase!.replaceUnprocessedEntities(tx, { + type: 'full', + sourceKey: 'config', + items: [ + { + apiVersion: '1.0.0', + metadata: { + name: 'new-root', + }, + kind: 'Location', + } as Entity, + ], + }); + }); + + const currentRefreshState = await db!( + 'refresh_state', + ).select(); + + const currentRefRowState = await db!( + 'refresh_state_references', + ).select(); + + for (const ref of ['location:default/root', 'location:default/root-1']) { + expect(currentRefreshState.some(t => t.entity_ref === ref)).toBeFalsy(); + } + + expect( + currentRefreshState.some( + t => t.entity_ref === 'location:default/new-root', + ), + ).toBeTruthy(); + + expect( + currentRefRowState.some( + t => + t.source_entity_ref === 'location:default/root' && + t.target_entity_ref === 'location:default/root-1', + ), + ).toBeFalsy(); + + expect( + currentRefRowState.some( + t => + t.source_entity_ref === 'location:default/root-1' && + t.target_entity_ref === 'location:default/root-2', + ), + ).toBeFalsy(); + + expect( + currentRefRowState.some( + t => + t.target_entity_ref === 'location:default/root-1' && + t.source_key === 'config', + ), + ).toBeFalsy(); + + expect( + currentRefRowState.some( + t => + t.target_entity_ref === 'location:default/new-root' && + t.source_key === 'config', + ), + ).toBeTruthy(); + }); + + it('should work for more complex chains', async () => { + /* + config -> location:default/root -> location:default/root-1 -> location:default/root-2 + config -> location:default/root -> location:default/root-1a -> location:default/root-2 + */ + await createLocations([ + 'location:default/root', + 'location:default/root-1', + 'location:default/root-2', + 'location:default/root-1a', + ]); + + await insertRefRow({ + source_key: 'config', + target_entity_ref: 'location:default/root', + }); + + await insertRefRow({ + source_entity_ref: 'location:default/root', + target_entity_ref: 'location:default/root-1', + }); + + await insertRefRow({ + source_entity_ref: 'location:default/root', + target_entity_ref: 'location:default/root-1a', + }); + + await insertRefRow({ + source_entity_ref: 'location:default/root-1', + target_entity_ref: 'location:default/root-2', + }); + + await insertRefRow({ + source_entity_ref: 'location:default/root-1a', + target_entity_ref: 'location:default/root-2', + }); + + await processingDatabase!.transaction(async tx => { + await processingDatabase!.replaceUnprocessedEntities(tx, { + type: 'full', + sourceKey: 'config', + items: [ + { + apiVersion: '1.0.0', + metadata: { + name: 'new-root', + }, + kind: 'Location', + } as Entity, + ], + }); + }); + + const currentRefreshState = await db!( + 'refresh_state', + ).select(); + + const currentRefRowState = await db!( + 'refresh_state_references', + ).select(); + + const deletedRefs = [ + 'location:default/root', + 'location:default/root-1', + 'location:default/root-1a', + 'location:default/root-2', + ]; + + for (const ref of deletedRefs) { + expect(currentRefreshState.some(t => t.entity_ref === ref)).toBeFalsy(); + } + + expect( + currentRefreshState.some( + t => t.entity_ref === 'location:default/new-root', + ), + ).toBeTruthy(); + + expect( + currentRefRowState.some( + t => + t.source_key === 'config' && + t.target_entity_ref === 'location:default/new-root', + ), + ).toBeTruthy(); + + expect( + currentRefRowState.some( + t => + t.source_key === 'config' && + t.target_entity_ref === 'location:default/root', + ), + ).toBeFalsy(); + + expect( + currentRefRowState.some( + t => + t.source_entity_ref === 'location:default/root' && + t.target_entity_ref === 'location:default/root-1', + ), + ).toBeFalsy(); + + expect( + currentRefRowState.some( + t => + t.source_entity_ref === 'location:default/root' && + t.target_entity_ref === 'location:default/root-1a', + ), + ).toBeFalsy(); + + expect( + currentRefRowState.some( + t => + t.source_entity_ref === 'location:default/root-1' && + t.target_entity_ref === 'location:default/root-2', + ), + ).toBeFalsy(); + + expect( + currentRefRowState.some( + t => + t.source_entity_ref === 'location:default/root-1a' && + t.target_entity_ref === 'location:default/root-2', + ), + ).toBeFalsy(); + }); }); }); diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts index b799bd6284..f0c5443651 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts @@ -135,7 +135,6 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { options: ReplaceUnprocessedEntitiesOptions, ): Promise { const tx = txOpaque as Knex.Transaction; - const entityIds = new Array(); if (options.type === 'full') { const oldRefs = await tx( @@ -158,55 +157,95 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { if (toRemove.length) { // TODO(freben): Batch split, to not hit variable limits? - - // get all refs where source = any of the toRemove - // delete all state rows matching any of the toRemove - // revisit the targets of all of those refs - // verify if they have references, otherwise delete from refresh_state - - const current = [...toRemove]; - while (true) { - - tx.withRecursive('r', function refs() { - return tx.select({ }) - .from({ r1: 'refresh_state_references' }) - .where({ source_key: options.sourceKey }) - .whereIn('target_entity_ref', toRemove) - .unionAll(function recurse() { - return tx.select({ }) - .from({ r2: 'refresh_state_references' }) - .whereNotExists() - }) + /* + WITH RECURSIVE + -- All the refs that can be reached from each individual root + root_reach(id, entity_ref) AS ( + -- Start with all roots + SELECT id, target_entity_ref + FROM refresh_state_references + WHERE source_key IS NOT NULL + UNION + -- For each match, select all children + SELECT root_reach.id, target_entity_ref + FROM refresh_state_references, root_reach + WHERE source_entity_ref = root_reach.entity_ref + ) + -- Start out with our own matching row (see the WHERE that + -- matches on source_key and target_entity_ref below) + SELECT us.entity_ref + FROM refresh_state_references + -- Expand the entire tree that emanates from that row + JOIN root_reach AS us + ON us.id = refresh_state_references.id + -- Expand with all roots that target the same node but + -- aren't ourselves + LEFT OUTER JOIN root_reach AS them + ON them.entity_ref = us.entity_ref + AND them.id != us.id + -- Keep only the matches that had no other rooots + WHERE refresh_state_references.source_key = "R1" + AND refresh_state_references.target_entity_ref = "A" + AND them.id IS NULL; + */ + const removedCount = await tx('refresh_state') + .whereIn('entity_ref', function orphanedEntityRefs(orphans) { + return ( + orphans + // All the refs that can be reached from each individual root + .withRecursive('root_reach', function rootReach(outer) { + // Start with all roots + return outer + .select({ id: 'id', entity_ref: 'target_entity_ref' }) + .from('refresh_state_references') + .whereNotNull('source_key') + .union(function recurse(inner) { + return ( + inner + // For each match, select all children + .select({ + id: 'root_reach.id', + entity_ref: + 'refresh_state_references.target_entity_ref', + }) + .from('refresh_state_references') + .crossJoin('root_reach', { + 'root_reach.entity_ref': + 'refresh_state_references.source_entity_ref', + }) + ); + }); + }) + .select('us.entity_ref') + // Start out with our own matching row + .from('refresh_state_references') + .where('source_key', options.sourceKey) + .whereIn('target_entity_ref', toRemove) + // Expand the entire tree that emanates from that row + .leftJoin({ us: 'root_reach' }, function us() { + this.on('us.id', '=', 'refresh_state_references.id'); + }) + // Expand with all roots that target the same node but aren't ourselves + .leftOuterJoin({ them: 'root_reach' }, function them() { + this.on('them.entity_ref', '=', 'us.entity_ref'); + this.andOn('them.id', '!=', 'us.id'); + }) + // Keep only the matches that had no other rooots + .whereNull('them.id') + ); }) - .select().from('refs'); + .delete(); - const nextLayerToRemove = await tx( - 'refresh_state_references', - ) - .whereIn('source_entity_ref', toRemove) - .leftOuterJoin('refresh_state_references AS b', function f() { - - }) - - .whereNotNull('b.source_target_ref') - .select('target_entity_ref'); - - await tx('refresh_state') - .whereIn('entity_ref', toRemove) - .delete(); - - const refsThatStillHaveASourcePointingAtThe = await tx( - 'refresh_state_references', - ) - .whereIn('target_entity_ref', nextLayerTargetRefs) - .groupBy('target_entity_ref') - .select('target_entity_ref'); + await tx('refresh_state_references') + .where('source_key', '=', options.sourceKey) + .whereIn('target_entity_ref', toRemove) + .delete(); + console.log( + `REMOVED, ${removedCount} entities: ${JSON.stringify(toRemove)}`, + ); } - - - if (toAdd.length) { const state: Knex.DbRecord[] = toAdd.map(item => ({ entity_id: item.id, @@ -224,67 +263,44 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { ); // TODO(freben): Concurrency? If we did these one by one, a .onConflict().merge would have made sense await tx.batchInsert('refresh_state', state, BATCH_SIZE); - await tx.batchInsert('refresh_state_references', stateReferences, BATCH_SIZE); - } - - - for (const entity of options.items) { - const entityRef = stringifyEntityRef(entity); - await tx('refresh_state') - .insert({ - entity_id: uuid(), - entity_ref: entityRef, - unprocessed_entity: JSON.stringify(entity), - errors: '', - next_update_at: tx.fn.now(), - last_discovery_at: tx.fn.now(), - }) - .onConflict('entity_ref') - .merge(['unprocessed_entity', 'last_discovery_at']); - - const [{ entity_id: entityId }] = await tx( - 'refresh_state', - ).where({ entity_ref: entityRef }); - entityIds.push(entityId); - } - const referenceRows: DbRefreshStateReferencesRow[] = entityIds.map( - entityId => ({ - source_key: options.sourceKey, - target_entityRef: entityRef, - }), - ); - await tx.batchInsert( - 'refresh_state_references', - referenceRows, - BATCH_SIZE, - ); - return; - } - - for (const entity of options.removed) { - const entityRef = stringifyEntityRef(entity); - const [result] = await tx('refresh_state') - .where({ entity_ref: entityRef }) - .select('entity_id'); - - if (!result) { - this.logger.info( - `Unable to delete entity '${entityRef}', entity does not exist in refresh state`, + await tx.batchInsert( + 'refresh_state_references', + stateReferences, + BATCH_SIZE, ); - continue; } - const referenceResults = await tx( - 'refresh_state_references', - ) - // todo correct key? - .where({ source_entity_id: result.entity_id }) - .select(); + // for (const entity of options.items) { + // const entityRef = stringifyEntityRef(entity); + // await tx('refresh_state') + // .insert({ + // entity_id: uuid(), + // entity_ref: entityRef, + // unprocessed_entity: JSON.stringify(entity), + // errors: '', + // next_update_at: tx.fn.now(), + // last_discovery_at: tx.fn.now(), + // }) + // .onConflict('entity_ref') + // .merge(['unprocessed_entity', 'last_discovery_at']); - await tx('refresh_state_references') - // todo correct key? - .where({ source_entity_id: result.entity_id }) - .delete(); + // const [{ entity_id: entityId }] = await tx( + // 'refresh_state', + // ).where({ entity_ref: entityRef }); + // entityIds.push(entityId); + // } + // const referenceRows: DbRefreshStateReferencesRow[] = entityIds.map( + // entityId => ({ + // source_key: options.sourceKey, + // target_entityRef: entityRef, + // }), + // ); + // await tx.batchInsert( + // 'refresh_state_references', + // referenceRows, + // BATCH_SIZE, + // ); + // return; } } From 6e545108e7418ee0bd9f57678f59f1a14e27f9be Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 23 Apr 2021 16:01:36 +0200 Subject: [PATCH 117/485] feat: support delta and full sync with the same code and simplify things MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: Johan Haals Signed-off-by: blam --- .../DefaultProcessingDatabase.test.ts | 89 +++++++ .../database/DefaultProcessingDatabase.ts | 242 ++++++++---------- 2 files changed, 201 insertions(+), 130 deletions(-) diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts index ee04a2baf8..c4784c081d 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts @@ -294,5 +294,94 @@ describe('Default Processing Database', () => { ), ).toBeFalsy(); }); + + it('should add new locations using the delta options', async () => { + await processingDatabase!.transaction(async tx => { + await processingDatabase!.replaceUnprocessedEntities(tx, { + type: 'delta', + sourceKey: 'lols', + removed: [], + added: [ + { + apiVersion: '1.0.0', + metadata: { + name: 'new-root', + }, + kind: 'Location', + } as Entity, + ], + }); + }); + + const currentRefreshState = await db!( + 'refresh_state', + ).select(); + + const currentRefRowState = await db!( + 'refresh_state_references', + ).select(); + + expect( + currentRefreshState.some( + t => t.entity_ref === 'location:default/new-root', + ), + ).toBeTruthy(); + + expect( + currentRefRowState.some( + t => + t.source_key === 'lols' && + t.target_entity_ref === 'location:default/new-root', + ), + ).toBeTruthy(); + }); + + it('should remove old locations using the delta options', async () => { + await createLocations(['location:default/new-root']); + + await insertRefRow({ + source_key: 'lols', + target_entity_ref: 'location:default/new-root', + }); + + await processingDatabase!.transaction(async tx => { + await processingDatabase!.replaceUnprocessedEntities(tx, { + type: 'delta', + sourceKey: 'lols', + added: [], + removed: [ + { + apiVersion: '1.0.0', + metadata: { + name: 'new-root', + }, + kind: 'Location', + } as Entity, + ], + }); + }); + + const currentRefreshState = await db!( + 'refresh_state', + ).select(); + + const currentRefRowState = await db!( + 'refresh_state_references', + ).select(); + + expect( + currentRefreshState.some( + t => t.entity_ref === 'location:default/new-root', + ), + ).toBeFalsy(); + + expect( + currentRefRowState.some( + t => + t.source_key === 'lols' && + t.target_entity_ref === 'location:default/new-root', + ), + ).toBeFalsy(); + }); }); }); diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts index f0c5443651..a80325d469 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts @@ -130,34 +130,48 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { ); } + private async createDelta( + tx: Knex.Transaction, + options: ReplaceUnprocessedEntitiesOptions, + ): Promise<{ toAdd: Entity[]; toRemove: string[] }> { + if (options.type === 'delta') { + return { + toAdd: options.added, + toRemove: options.removed.map(e => stringifyEntityRef(e)), + }; + } + + const oldRefs = await tx( + 'refresh_state_references', + ) + .where({ source_key: options.sourceKey }) + .select('target_entity_ref') + .then(rows => rows.map(r => r.target_entity_ref)); + + const items = options.items.map(entity => ({ + entity, + ref: stringifyEntityRef(entity), + })); + + const oldRefsSet = new Set(oldRefs); + const newRefsSet = new Set(items.map(item => item.ref)); + const toAdd = items.filter(item => !oldRefsSet.has(item.ref)); + const toRemove = oldRefs.filter(ref => !newRefsSet.has(ref)); + + return { toAdd: toAdd.map(({ entity }) => entity), toRemove }; + } + async replaceUnprocessedEntities( txOpaque: Transaction, options: ReplaceUnprocessedEntitiesOptions, ): Promise { const tx = txOpaque as Knex.Transaction; - if (options.type === 'full') { - const oldRefs = await tx( - 'refresh_state_references', - ) - .where({ source_key: options.sourceKey }) - .select('target_entity_ref') - .then(rows => rows.map(r => r.target_entity_ref)); + const { toAdd, toRemove } = await this.createDelta(tx, options); - const items = options.items.map(entity => ({ - entity, - ref: stringifyEntityRef(entity), - id: uuid(), - })); - - const oldRefsSet = new Set(oldRefs); - const newRefsSet = new Set(items.map(item => item.ref)); - const toAdd = items.filter(item => !oldRefsSet.has(item.ref)); - const toRemove = oldRefs.filter(ref => !newRefsSet.has(ref)); - - if (toRemove.length) { - // TODO(freben): Batch split, to not hit variable limits? - /* + if (toRemove.length) { + // TODO(freben): Batch split, to not hit variable limits? + /* WITH RECURSIVE -- All the refs that can be reached from each individual root root_reach(id, entity_ref) AS ( @@ -188,119 +202,87 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { AND refresh_state_references.target_entity_ref = "A" AND them.id IS NULL; */ - const removedCount = await tx('refresh_state') - .whereIn('entity_ref', function orphanedEntityRefs(orphans) { - return ( - orphans - // All the refs that can be reached from each individual root - .withRecursive('root_reach', function rootReach(outer) { - // Start with all roots - return outer - .select({ id: 'id', entity_ref: 'target_entity_ref' }) - .from('refresh_state_references') - .whereNotNull('source_key') - .union(function recurse(inner) { - return ( - inner - // For each match, select all children - .select({ - id: 'root_reach.id', - entity_ref: - 'refresh_state_references.target_entity_ref', - }) - .from('refresh_state_references') - .crossJoin('root_reach', { - 'root_reach.entity_ref': - 'refresh_state_references.source_entity_ref', - }) - ); - }); - }) - .select('us.entity_ref') - // Start out with our own matching row - .from('refresh_state_references') - .where('source_key', options.sourceKey) - .whereIn('target_entity_ref', toRemove) - // Expand the entire tree that emanates from that row - .leftJoin({ us: 'root_reach' }, function us() { - this.on('us.id', '=', 'refresh_state_references.id'); - }) - // Expand with all roots that target the same node but aren't ourselves - .leftOuterJoin({ them: 'root_reach' }, function them() { - this.on('them.entity_ref', '=', 'us.entity_ref'); - this.andOn('them.id', '!=', 'us.id'); - }) - // Keep only the matches that had no other rooots - .whereNull('them.id') - ); - }) - .delete(); + const removedCount = await tx('refresh_state') + .whereIn('entity_ref', function orphanedEntityRefs(orphans) { + return ( + orphans + // All the refs that can be reached from each individual root + .withRecursive('root_reach', function rootReach(outer) { + // Start with all roots + return outer + .select({ id: 'id', entity_ref: 'target_entity_ref' }) + .from('refresh_state_references') + .whereNotNull('source_key') + .union(function recurse(inner) { + return ( + inner + // For each match, select all children + .select({ + id: 'root_reach.id', + entity_ref: + 'refresh_state_references.target_entity_ref', + }) + .from('refresh_state_references') + .crossJoin('root_reach', { + 'root_reach.entity_ref': + 'refresh_state_references.source_entity_ref', + }) + ); + }); + }) + .select('us.entity_ref') + // Start out with our own matching row + .from('refresh_state_references') + .where('source_key', options.sourceKey) + .whereIn('target_entity_ref', toRemove) + // Expand the entire tree that emanates from that row + .leftJoin({ us: 'root_reach' }, function us() { + this.on('us.id', '=', 'refresh_state_references.id'); + }) + // Expand with all roots that target the same node but aren't ourselves + .leftOuterJoin({ them: 'root_reach' }, function them() { + this.on('them.entity_ref', '=', 'us.entity_ref'); + this.andOn('them.id', '!=', 'us.id'); + }) + // Keep only the matches that had no other rooots + .whereNull('them.id') + ); + }) + .delete(); - await tx('refresh_state_references') - .where('source_key', '=', options.sourceKey) - .whereIn('target_entity_ref', toRemove) - .delete(); + await tx('refresh_state_references') + .where('source_key', '=', options.sourceKey) + .whereIn('target_entity_ref', toRemove) + .delete(); - console.log( - `REMOVED, ${removedCount} entities: ${JSON.stringify(toRemove)}`, - ); - } + this.logger.debug( + `removed, ${removedCount} entities: ${JSON.stringify(toRemove)}`, + ); + } - if (toAdd.length) { - const state: Knex.DbRecord[] = toAdd.map(item => ({ - entity_id: item.id, - entity_ref: item.ref, - unprocessed_entity: JSON.stringify(item.entity), - errors: '', - next_update_at: tx.fn.now(), - last_discovery_at: tx.fn.now(), - })); - const stateReferences: DbRefreshStateReferencesRow[] = toAdd.map( - item => ({ - source_key: options.sourceKey, - target_entity_ref: item.ref, - }), - ); - // TODO(freben): Concurrency? If we did these one by one, a .onConflict().merge would have made sense - await tx.batchInsert('refresh_state', state, BATCH_SIZE); - await tx.batchInsert( - 'refresh_state_references', - stateReferences, - BATCH_SIZE, - ); - } + if (toAdd.length) { + const state: Knex.DbRecord[] = toAdd.map(entity => ({ + entity_id: uuid(), + entity_ref: stringifyEntityRef(entity), + unprocessed_entity: JSON.stringify(entity), + errors: '', + next_update_at: tx.fn.now(), + last_discovery_at: tx.fn.now(), + })); - // for (const entity of options.items) { - // const entityRef = stringifyEntityRef(entity); - // await tx('refresh_state') - // .insert({ - // entity_id: uuid(), - // entity_ref: entityRef, - // unprocessed_entity: JSON.stringify(entity), - // errors: '', - // next_update_at: tx.fn.now(), - // last_discovery_at: tx.fn.now(), - // }) - // .onConflict('entity_ref') - // .merge(['unprocessed_entity', 'last_discovery_at']); - - // const [{ entity_id: entityId }] = await tx( - // 'refresh_state', - // ).where({ entity_ref: entityRef }); - // entityIds.push(entityId); - // } - // const referenceRows: DbRefreshStateReferencesRow[] = entityIds.map( - // entityId => ({ - // source_key: options.sourceKey, - // target_entityRef: entityRef, - // }), - // ); - // await tx.batchInsert( - // 'refresh_state_references', - // referenceRows, - // BATCH_SIZE, - // ); - // return; + const stateReferences: DbRefreshStateReferencesRow[] = toAdd.map( + entity => ({ + source_key: options.sourceKey, + target_entity_ref: stringifyEntityRef(entity), + }), + ); + // TODO(freben): Concurrency? If we did these one by one, a .onConflict().merge would have made sense + await tx.batchInsert('refresh_state', state, BATCH_SIZE); + await tx.batchInsert( + 'refresh_state_references', + stateReferences, + BATCH_SIZE, + ); } } From b8e80eab23b8e4aadd79b75de16a42839c6e4c45 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 26 Apr 2021 10:14:45 +0200 Subject: [PATCH 118/485] catalog-backend: Remove obervables Signed-off-by: Johan Haals --- plugins/catalog-backend/package.json | 4 +- .../src/next/DatabaseLocationProvider.ts | 71 ------------------- .../next/DefaultCatalogProcessingEngine.ts | 27 +------ .../src/next/DefaultLocationStore.ts | 4 -- plugins/catalog-backend/src/next/types.ts | 5 +- 5 files changed, 5 insertions(+), 106 deletions(-) delete mode 100644 plugins/catalog-backend/src/next/DatabaseLocationProvider.ts diff --git a/plugins/catalog-backend/package.json b/plugins/catalog-backend/package.json index 9afb537637..5f70ec60e1 100644 --- a/plugins/catalog-backend/package.json +++ b/plugins/catalog-backend/package.json @@ -33,7 +33,6 @@ "@backstage/backend-common": "^0.6.3", "@backstage/catalog-model": "^0.7.7", "@backstage/config": "^0.1.4", - "@backstage/core": "^0.7.6", "@backstage/errors": "^0.1.1", "@backstage/integration": "^0.5.1", "@backstage/plugin-search-backend-node": "^0.1.3", @@ -61,8 +60,7 @@ "winston": "^3.2.1", "yaml": "^1.9.2", "yn": "^4.0.0", - "yup": "^0.29.3", - "zen-observable": "^0.8.15" + "yup": "^0.29.3" }, "devDependencies": { "@backstage/cli": "^0.6.9", diff --git a/plugins/catalog-backend/src/next/DatabaseLocationProvider.ts b/plugins/catalog-backend/src/next/DatabaseLocationProvider.ts deleted file mode 100644 index eaf5a78556..0000000000 --- a/plugins/catalog-backend/src/next/DatabaseLocationProvider.ts +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 { Observable } from '@backstage/core'; -import { ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model'; -import { EntityProvider, LocationStore, EntityMessage } from './types'; -import ObservableImpl from 'zen-observable'; -import { - locationSpecToLocationEntity, - locationSpecToMetadataName, -} from './util'; - -export class DatabaseLocationProvider implements EntityProvider { - private subscribers = new Set< - ZenObservable.SubscriptionObserver - >(); - - constructor(private readonly store: LocationStore) { - store.location$().subscribe({ - next: locations => { - if ('all' in locations) { - this.notify({ - all: locations.all.map(l => locationSpecToLocationEntity(l)), - }); - } else { - this.notify({ - added: locations.added.map(l => locationSpecToLocationEntity(l)), - removed: locations.removed.map(l => ({ - kind: 'Location', - namespace: ENTITY_DEFAULT_NAMESPACE, - name: locationSpecToMetadataName(l), - })), - }); - } - }, - }); - } - - private notify(message: EntityMessage) { - for (const subscriber of this.subscribers) { - subscriber.next(message); - } - } - - entityChange$(): Observable { - return new ObservableImpl(subscriber => { - this.store.listLocations().then(locations => { - subscriber.next({ - all: locations.map(l => locationSpecToLocationEntity(l)), - }); - this.subscribers.add(subscriber); - }); - return () => { - this.subscribers.delete(subscriber); - }; - }); - } -} diff --git a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts index 7f49bf832d..b71b2c1045 100644 --- a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts +++ b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts @@ -14,11 +14,9 @@ * limitations under the License. */ -import { Subscription } from '@backstage/core'; import { CatalogProcessingEngine, EntityProvider, - EntityMessage, EntityProviderConnection, EntityProviderMutation, ProcessingStateManager, @@ -40,7 +38,7 @@ class Connection implements EntityProviderConnection { async applyMutation(mutation: EntityProviderMutation): Promise { if (mutation.type === 'full') { await this.config.stateManager.replaceProcessingItems({ - id: this.config.id, + sourceKey: this.config.id, type: 'full', items: mutation.entities, }); @@ -49,7 +47,7 @@ class Connection implements EntityProviderConnection { } await this.config.stateManager.replaceProcessingItems({ - id: this.config.id, + sourceKey: this.config.id, type: 'delta', added: mutation.added, removed: mutation.removed, @@ -120,25 +118,4 @@ export class DefaultCatalogProcessingEngine implements CatalogProcessingEngine { async stop() { this.running = false; } - - private async onNext(id: string, message: EntityMessage) { - if ('all' in message) { - // TODO unhandled rejection - await this.stateManager.addProcessingItems({ - id, - type: 'provider', - entities: message.all, - }); - } - - if ('added' in message) { - await this.stateManager.addProcessingItems({ - id, - type: 'provider', - entities: message.added, - }); - - // TODO deletions of message.removed - } - } } diff --git a/plugins/catalog-backend/src/next/DefaultLocationStore.ts b/plugins/catalog-backend/src/next/DefaultLocationStore.ts index dff424b1a9..21206f0a7b 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationStore.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationStore.ts @@ -25,10 +25,6 @@ import { v4 as uuidv4 } from 'uuid'; import { locationSpecToLocationEntity } from './util'; import { ConflictError } from '@backstage/errors'; -export type LocationMessage = - | { all: Location[] } - | { added: Location[]; removed: Location[] }; - export class DefaultLocationStore implements LocationStore, EntityProvider { private _connection: EntityProviderConnection | undefined; diff --git a/plugins/catalog-backend/src/next/types.ts b/plugins/catalog-backend/src/next/types.ts index f8b4de1c41..a39ab9a8ff 100644 --- a/plugins/catalog-backend/src/next/types.ts +++ b/plugins/catalog-backend/src/next/types.ts @@ -16,7 +16,6 @@ import { Entity, - EntityName, LocationSpec, Location, EntityRelationSpec, @@ -116,12 +115,12 @@ export type ProcessingItem = { export type ReplaceProcessingItemsRequest = | { - id: string; + sourceKey: string; items: Entity[]; type: 'full'; } | { - id: string; + sourceKey: string; added: Entity[]; removed: Entity[]; type: 'delta'; From 464863419888171a95d805f3d51cc44bd8950de8 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 26 Apr 2021 13:56:32 +0200 Subject: [PATCH 119/485] Refactor deferredEntities processing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: Ben Lambert Signed-off-by: Johan Haals --- .../src/next/DefaultLocationStore.ts | 8 + .../src/next/DefaultProcessingStateManager.ts | 39 ++- .../src/next/NextCatalogBuilder.ts | 1 - plugins/catalog-backend/src/next/Stitcher.ts | 4 +- .../DefaultProcessingDatabase.test.ts | 83 ++++-- .../database/DefaultProcessingDatabase.ts | 236 ++++++++++-------- .../src/next/database/types.ts | 7 +- 7 files changed, 222 insertions(+), 156 deletions(-) diff --git a/plugins/catalog-backend/src/next/DefaultLocationStore.ts b/plugins/catalog-backend/src/next/DefaultLocationStore.ts index 21206f0a7b..40870cff7b 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationStore.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationStore.ts @@ -104,5 +104,13 @@ export class DefaultLocationStore implements LocationStore, EntityProvider { async connect(connection: EntityProviderConnection): Promise { this._connection = connection; + const locations = await this.db.locations(); + const entities = locations.map(location => { + return locationSpecToLocationEntity(location); + }); + await this.connection.applyMutation({ + type: 'full', + entities, + }); } } diff --git a/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts b/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts index d2765c3101..0003b7a7cf 100644 --- a/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts +++ b/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts @@ -49,35 +49,28 @@ export class DefaultProcessingStateManager implements ProcessingStateManager { async addProcessingItems(request: AddProcessingItemRequest) { return this.db.transaction(async tx => { - await this.db.addUnprocessedEntities(tx, request); + // await this.db.addUnprocessedEntities(tx, request); }); } async getNextProcessingItem(): Promise { - const entities = await new Promise(resolve => - this.popFromQueue(resolve), - ); - const { id, state, unprocessedEntity } = entities[0]; - return { - id, - entity: unprocessedEntity, - state, - }; - } - - async popFromQueue(resolve: (rows: RefreshStateItem[]) => void) { - const entities = await this.db.transaction(async tx => { - return this.db.getProcessableEntities(tx, { - processBatchSize: 1, + for (;;) { + const { items } = await this.db.transaction(async tx => { + return this.db.getProcessableEntities(tx, { + processBatchSize: 1, + }); }); - }); - // No entities require refresh, wait and try again. - if (!entities.items.length) { - setTimeout(() => this.popFromQueue(resolve), 1000); - return; + if (items.length) { + const { id, state, unprocessedEntity } = items[0]; + return { + id, + entity: unprocessedEntity, + state, + }; + } + + await new Promise(resolve => setTimeout(resolve, 1000)); } - - resolve(entities.items); } } diff --git a/plugins/catalog-backend/src/next/NextCatalogBuilder.ts b/plugins/catalog-backend/src/next/NextCatalogBuilder.ts index 1796847164..d720bd331a 100644 --- a/plugins/catalog-backend/src/next/NextCatalogBuilder.ts +++ b/plugins/catalog-backend/src/next/NextCatalogBuilder.ts @@ -67,7 +67,6 @@ import { LocationAnalyzer } from '../ingestion/types'; import { DefaultCatalogProcessingEngine } from './DefaultCatalogProcessingEngine'; import { DefaultCatalogProcessingOrchestrator } from './DefaultCatalogProcessingOrchestrator'; import { DefaultProcessingDatabase } from './database/DefaultProcessingDatabase'; -import { DatabaseLocationProvider } from '../next/DatabaseLocationProvider'; import { DefaultLocationStore } from './DefaultLocationStore'; import { DefaultProcessingStateManager } from './DefaultProcessingStateManager'; import { CatalogProcessingEngine } from '../next/types'; diff --git a/plugins/catalog-backend/src/next/Stitcher.ts b/plugins/catalog-backend/src/next/Stitcher.ts index 3e5e3ac24b..f53b7c6fad 100644 --- a/plugins/catalog-backend/src/next/Stitcher.ts +++ b/plugins/catalog-backend/src/next/Stitcher.ts @@ -76,8 +76,8 @@ export class Stitcher { const [reference_count_result] = await tx( 'refresh_state_references', ) - .where({ target_entity_id: entity.metadata.uid }) - .count({ reference_count: 'target_entity_id' }); + .where({ target_entity_ref: entityRef }) + .count({ reference_count: 'target_entity_ref' }); if (Number(reference_count_result.reference_count) === 0) { this.logger.debug(`${entityRef} is orphan`); diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts index c4784c081d..14990a2a79 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts @@ -27,27 +27,26 @@ import * as uuid from 'uuid'; import { getVoidLogger } from '@backstage/backend-common'; describe('Default Processing Database', () => { - let db: Knex | undefined; - let processingDatabase: DefaultProcessingDatabase | undefined; - + let db: Knex; + let processingDatabase: DefaultProcessingDatabase; const logger = getVoidLogger(); beforeEach(async () => { db = await DatabaseManager.createTestDatabaseConnection(); await DatabaseManager.createDatabase(db); - processingDatabase = new DefaultProcessingDatabase(db!, logger); + processingDatabase = new DefaultProcessingDatabase(db, logger); }); describe('replaceUnprocessedEntities', () => { const insertRefRow = async (ref: DbRefreshStateReferencesRow) => { - return db!( - 'refresh_state_references', - ).insert(ref); + return db('refresh_state_references').insert( + ref, + ); }; const insertRefreshStateRow = async (ref: DbRefreshStateRow) => { - await db!('refresh_state').insert(ref); + await db('refresh_state').insert(ref); }; const createLocations = async (entityRefs: string[]) => { @@ -101,8 +100,8 @@ describe('Default Processing Database', () => { target_entity_ref: 'location:default/root-2', }); - await processingDatabase!.transaction(async tx => { - await processingDatabase!.replaceUnprocessedEntities(tx, { + await processingDatabase.transaction(async tx => { + await processingDatabase.replaceUnprocessedEntities(tx, { type: 'full', sourceKey: 'config', items: [ @@ -117,11 +116,11 @@ describe('Default Processing Database', () => { }); }); - const currentRefreshState = await db!( + const currentRefreshState = await db( 'refresh_state', ).select(); - const currentRefRowState = await db!( + const currentRefRowState = await db( 'refresh_state_references', ).select(); @@ -205,8 +204,8 @@ describe('Default Processing Database', () => { target_entity_ref: 'location:default/root-2', }); - await processingDatabase!.transaction(async tx => { - await processingDatabase!.replaceUnprocessedEntities(tx, { + await processingDatabase.transaction(async tx => { + await processingDatabase.replaceUnprocessedEntities(tx, { type: 'full', sourceKey: 'config', items: [ @@ -221,11 +220,11 @@ describe('Default Processing Database', () => { }); }); - const currentRefreshState = await db!( + const currentRefreshState = await db( 'refresh_state', ).select(); - const currentRefRowState = await db!( + const currentRefRowState = await db( 'refresh_state_references', ).select(); @@ -296,8 +295,8 @@ describe('Default Processing Database', () => { }); it('should add new locations using the delta options', async () => { - await processingDatabase!.transaction(async tx => { - await processingDatabase!.replaceUnprocessedEntities(tx, { + await processingDatabase.transaction(async tx => { + await processingDatabase.replaceUnprocessedEntities(tx, { type: 'delta', sourceKey: 'lols', removed: [], @@ -313,11 +312,11 @@ describe('Default Processing Database', () => { }); }); - const currentRefreshState = await db!( + const currentRefreshState = await db( 'refresh_state', ).select(); - const currentRefRowState = await db!( + const currentRefRowState = await db( 'refresh_state_references', ).select(); @@ -336,6 +335,42 @@ describe('Default Processing Database', () => { ).toBeTruthy(); }); + it('should not remove locations that are referenced elsewhere', async () => { + /* + config-1 -> location:default/root + config-2 -> location:default/root + */ + await createLocations(['location:default/root']); + + await insertRefRow({ + source_key: 'config-1', + target_entity_ref: 'location:default/root', + }); + await insertRefRow({ + source_key: 'config-2', + target_entity_ref: 'location:default/root', + }); + + await processingDatabase.transaction(async tx => { + await processingDatabase.replaceUnprocessedEntities(tx, { + type: 'full', + sourceKey: 'config-1', + items: [], + }); + }); + + const currentRefRowState = await db( + 'refresh_state_references', + ).select(); + + expect(currentRefRowState).toEqual({ + source_key: 'config-2', + target_entity_ref: 'location:default/root', + }); + + // TODO: assert that root wasn't removed + }); + it('should remove old locations using the delta options', async () => { await createLocations(['location:default/new-root']); @@ -344,8 +379,8 @@ describe('Default Processing Database', () => { target_entity_ref: 'location:default/new-root', }); - await processingDatabase!.transaction(async tx => { - await processingDatabase!.replaceUnprocessedEntities(tx, { + await processingDatabase.transaction(async tx => { + await processingDatabase.replaceUnprocessedEntities(tx, { type: 'delta', sourceKey: 'lols', added: [], @@ -361,11 +396,11 @@ describe('Default Processing Database', () => { }); }); - const currentRefreshState = await db!( + const currentRefreshState = await db( 'refresh_state', ).select(); - const currentRefRowState = await db!( + const currentRefRowState = await db( 'refresh_state_references', ).select(); diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts index a80325d469..dc5e6036f5 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts @@ -26,10 +26,12 @@ import { UpdateProcessedEntityOptions, GetProcessableEntitiesResult, ReplaceUnprocessedEntitiesOptions, + RefreshStateItem, } from './types'; import type { Logger } from 'winston'; import { v4 as uuid } from 'uuid'; +import { JsonObject } from '@backstage/config'; export type DbRefreshStateRow = { entity_id: string; @@ -88,7 +90,6 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { errors, }) .where('entity_id', id); - if (refreshResult === 0) { throw new NotFoundError(`Processing state not found for ${id}`); } @@ -96,8 +97,7 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { // Schedule all deferred entities for future processing. await this.addUnprocessedEntities(tx, { entities: deferredEntities, - id, - type: 'entity', + entityRef: stringifyEntityRef(processedEntity), }); // Update fragments @@ -172,80 +172,104 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { if (toRemove.length) { // TODO(freben): Batch split, to not hit variable limits? /* - WITH RECURSIVE - -- All the refs that can be reached from each individual root - root_reach(id, entity_ref) AS ( - -- Start with all roots - SELECT id, target_entity_ref - FROM refresh_state_references - WHERE source_key IS NOT NULL - UNION - -- For each match, select all children - SELECT root_reach.id, target_entity_ref - FROM refresh_state_references, root_reach - WHERE source_entity_ref = root_reach.entity_ref - ) - -- Start out with our own matching row (see the WHERE that - -- matches on source_key and target_entity_ref below) - SELECT us.entity_ref - FROM refresh_state_references - -- Expand the entire tree that emanates from that row - JOIN root_reach AS us - ON us.id = refresh_state_references.id - -- Expand with all roots that target the same node but - -- aren't ourselves - LEFT OUTER JOIN root_reach AS them - ON them.entity_ref = us.entity_ref - AND them.id != us.id - -- Keep only the matches that had no other rooots - WHERE refresh_state_references.source_key = "R1" - AND refresh_state_references.target_entity_ref = "A" - AND them.id IS NULL; - */ + WITH RECURSIVE + -- All the nodes that can be reached downwards from our root + descendants(root_id, entity_ref) AS ( + SELECT id, target_entity_ref + FROM refresh_state_references + WHERE source_key = "R1" AND target_entity_ref = "A" + UNION + SELECT descendants.root_id, target_entity_ref + FROM descendants + JOIN refresh_state_references ON source_entity_ref = descendants.entity_ref + ), + -- All the nodes that can be reached upwards from the descendants + ancestors(root_id, via_entity_ref, to_entity_ref) AS ( + SELECT NULL, entity_ref, entity_ref + FROM descendants + UNION + SELECT + CASE WHEN source_key IS NOT NULL THEN id ELSE NULL END, + source_entity_ref, + ancestors.to_entity_ref + FROM ancestors + JOIN refresh_state_references ON target_entity_ref = ancestors.via_entity_ref + ) + -- Start out with all of the descendants + SELECT descendants.entity_ref + FROM descendants + -- Expand with all ancestors that point to those, but aren't the current root + LEFT OUTER JOIN ancestors + ON ancestors.to_entity_ref = descendants.entity_ref + AND ancestors.root_id IS NOT NULL + AND ancestors.root_id != descendants.root_id + -- Exclude all lines that had such a foreign ancestor + WHERE ancestors.root_id IS NULL; + */ const removedCount = await tx('refresh_state') .whereIn('entity_ref', function orphanedEntityRefs(orphans) { return ( orphans - // All the refs that can be reached from each individual root - .withRecursive('root_reach', function rootReach(outer) { - // Start with all roots + // All the nodes that can be reached downwards from our root + .withRecursive('descendants', function descendants(outer) { return outer - .select({ id: 'id', entity_ref: 'target_entity_ref' }) + .select({ root_id: 'id', entity_ref: 'target_entity_ref' }) .from('refresh_state_references') - .whereNotNull('source_key') - .union(function recurse(inner) { - return ( - inner - // For each match, select all children - .select({ - id: 'root_reach.id', - entity_ref: - 'refresh_state_references.target_entity_ref', - }) - .from('refresh_state_references') - .crossJoin('root_reach', { - 'root_reach.entity_ref': - 'refresh_state_references.source_entity_ref', - }) - ); + .where('source_key', options.sourceKey) + .whereIn('target_entity_ref', toRemove) + .union(function recursive(inner) { + return inner + .select({ + root_id: 'descendants.root_id', + entity_ref: + 'refresh_state_references.target_entity_ref', + }) + .from('descendants') + .join('refresh_state_references', { + 'descendants.entity_ref': + 'refresh_state_references.source_entity_ref', + }); }); }) - .select('us.entity_ref') - // Start out with our own matching row - .from('refresh_state_references') - .where('source_key', options.sourceKey) - .whereIn('target_entity_ref', toRemove) - // Expand the entire tree that emanates from that row - .leftJoin({ us: 'root_reach' }, function us() { - this.on('us.id', '=', 'refresh_state_references.id'); + // All the nodes that can be reached upwards from the descendants + .withRecursive('ancestors', function ancestors(outer) { + return outer + .select({ + root_id: tx.raw('NULL', []), + via_entity_ref: 'entity_ref', + to_entity_ref: 'entity_ref', + }) + .from('descendants') + .union(function recursive(inner) { + return inner + .select({ + root_id: tx.raw( + 'CASE WHEN source_key IS NOT NULL THEN id ELSE NULL END', + [], + ), + via_entity_ref: 'source_entity_ref', + to_entity_ref: 'ancestors.to_entity_ref', + }) + .from('ancestors') + .join('refresh_state_references', { + target_entity_ref: 'ancestors.via_entity_ref', + }); + }); }) - // Expand with all roots that target the same node but aren't ourselves - .leftOuterJoin({ them: 'root_reach' }, function them() { - this.on('them.entity_ref', '=', 'us.entity_ref'); - this.andOn('them.id', '!=', 'us.id'); + // Start out with all of the descendants + .select('descendants.entity_ref') + .from('descendants') + // Expand with all ancestors that point to those, but aren't the current root + .leftOuterJoin('ancestors', function keepaliveRoots() { + this.on( + 'ancestors.to_entity_ref', + '=', + 'descendants.entity_ref', + ); + this.andOnNotNull('ancestors.root_id'); + this.andOn('ancestors.root_id', '!=', 'descendants.root_id'); }) - // Keep only the matches that had no other rooots - .whereNull('them.id') + .whereNull('ancestors.root_id') ); }) .delete(); @@ -291,44 +315,45 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { options: AddUnprocessedEntitiesOptions, ): Promise { const tx = txOpaque as Knex.Transaction; - const entityIds = new Array(); - for (const entity of options.entities) { - const entityRef = stringifyEntityRef(entity); - await tx('refresh_state') - .insert({ + const stateRows = options.entities.map( + entity => + ({ entity_id: uuid(), - entity_ref: entityRef, + entity_ref: stringifyEntityRef(entity), unprocessed_entity: JSON.stringify(entity), errors: '', next_update_at: tx.fn.now(), last_discovery_at: tx.fn.now(), - }) + } as Knex.DbRecord), + ); + const stateReferenceRows = stateRows.map( + stateRow => + ({ + source_entity_ref: options.entityRef, + target_entity_ref: stateRow.entity_ref, + } as Knex.DbRecord), + ); + + // Upsert all of the unprocessed entities into the refresh_state table, by + // their entity ref. + // TODO(freben): Can this be batched somehow? + for (const row of stateRows) { + await tx('refresh_state') + .insert(row) .onConflict('entity_ref') .merge(['unprocessed_entity', 'last_discovery_at']); - - const [{ entity_id: entityId }] = await tx( - 'refresh_state', - ).where({ entity_ref: entityRef }); - entityIds.push(entityId); } - const key = - options.type === 'provider' - ? { source_special_key: options.id } - : { source_entity_id: options.id }; - // copied from update refs + // Replace all references for the originating entity before creating new ones await tx('refresh_state_references') - .where(key) + .where({ source_entity_ref: options.entityRef }) .delete(); - - const referenceRows: DbRefreshStateReferencesRow[] = entityIds.map( - entityId => ({ - ...key, - target_entity_id: entityId, - }), + await tx.batchInsert( + 'refresh_state_references', + stateReferenceRows, + BATCH_SIZE, ); - await tx.batchInsert('refresh_state_references', referenceRows, BATCH_SIZE); } async getProcessableEntities( @@ -356,16 +381,23 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { }); return { - items: items.map(i => ({ - id: i.entity_id, - entityRef: i.entity_ref, - unprocessedEntity: JSON.parse(i.unprocessed_entity) as Entity, - processedEntity: JSON.parse(i.processed_entity) as Entity, - nextUpdateAt: i.next_update_at, - lastDiscoveryAt: i.last_discovery_at, - state: JSON.parse(i.cache), - errors: i.errors, - })), + items: items.map( + i => + ({ + id: i.entity_id, + entityRef: i.entity_ref, + unprocessedEntity: JSON.parse(i.unprocessed_entity) as Entity, + processedEntity: i.processed_entity + ? (JSON.parse(i.processed_entity) as Entity) + : undefined, + nextUpdateAt: i.next_update_at, + lastDiscoveryAt: i.last_discovery_at, + state: i.cache + ? JSON.parse(i.cache) + : new Map(), + errors: i.errors, + } as RefreshStateItem), + ), }; } diff --git a/plugins/catalog-backend/src/next/database/types.ts b/plugins/catalog-backend/src/next/database/types.ts index b926676887..d7a1dcd20b 100644 --- a/plugins/catalog-backend/src/next/database/types.ts +++ b/plugins/catalog-backend/src/next/database/types.ts @@ -19,8 +19,7 @@ import { JsonObject } from '@backstage/config'; import { Transaction } from '../../database/types'; export type AddUnprocessedEntitiesOptions = { - type: 'entity' | 'provider'; - id: string; + entityRef: string; entities: Entity[]; }; @@ -39,11 +38,11 @@ export type RefreshStateItem = { id: string; entityRef: string; unprocessedEntity: Entity; - processedEntity: Entity; + processedEntity?: Entity; nextUpdateAt: string; lastDiscoveryAt: string; // remove? state: Map; - errors: string; + errors?: string; }; export type GetProcessableEntitiesResult = { From f22ac8403507761e188e28ae25bb49433c694d2d Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 26 Apr 2021 14:02:41 +0200 Subject: [PATCH 120/485] Remove addProcessingItems MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: Ben Lambert Co-authored-by: Patrik Oldsberg Signed-off-by: Johan Haals --- plugins/catalog-backend/src/next/Stitcher.ts | 4 ++-- plugins/catalog-backend/src/next/types.ts | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/plugins/catalog-backend/src/next/Stitcher.ts b/plugins/catalog-backend/src/next/Stitcher.ts index f53b7c6fad..57f5ae9167 100644 --- a/plugins/catalog-backend/src/next/Stitcher.ts +++ b/plugins/catalog-backend/src/next/Stitcher.ts @@ -19,7 +19,7 @@ import { Logger } from 'winston'; import { Transaction } from '../database'; import { ConflictError } from '@backstage/errors'; import { - DbRefreshStateReferences, + DbRefreshStateReferencesRow, DbRefreshStateRow, DbRelationsRow, } from './database/DefaultProcessingDatabase'; @@ -73,7 +73,7 @@ export class Stitcher { return; } - const [reference_count_result] = await tx( + const [reference_count_result] = await tx( 'refresh_state_references', ) .where({ target_entity_ref: entityRef }) diff --git a/plugins/catalog-backend/src/next/types.ts b/plugins/catalog-backend/src/next/types.ts index a39ab9a8ff..ef3bab797b 100644 --- a/plugins/catalog-backend/src/next/types.ts +++ b/plugins/catalog-backend/src/next/types.ts @@ -101,12 +101,6 @@ export type ProcessingItemResult = { deferredEntities: Entity[]; }; -export type AddProcessingItemRequest = { - type: 'entity' | 'provider'; - id: string; - entities: Entity[]; -}; - export type ProcessingItem = { id: string; entity: Entity; @@ -128,6 +122,5 @@ export type ReplaceProcessingItemsRequest = export interface ProcessingStateManager { setProcessingItemResult(result: ProcessingItemResult): Promise; getNextProcessingItem(): Promise; - addProcessingItems(request: AddProcessingItemRequest): Promise; replaceProcessingItems(request: ReplaceProcessingItemsRequest): Promise; } From d77f5fea4406de005f25d052a90423f494d8bfcb Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 26 Apr 2021 14:12:57 +0200 Subject: [PATCH 121/485] Add moar tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: Ben Lambert Co-authored-by: Patrik Oldsberg Signed-off-by: Johan Haals --- .../DefaultProcessingDatabase.test.ts | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts index 14990a2a79..f67b8603db 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts @@ -359,16 +359,26 @@ describe('Default Processing Database', () => { }); }); + const currentRefreshState = await db( + 'refresh_state', + ).select(); + const currentRefRowState = await db( 'refresh_state_references', ).select(); - expect(currentRefRowState).toEqual({ - source_key: 'config-2', - target_entity_ref: 'location:default/root', - }); + expect(currentRefRowState).toEqual([ + expect.objectContaining({ + source_key: 'config-2', + target_entity_ref: 'location:default/root', + }), + ]); - // TODO: assert that root wasn't removed + expect(currentRefreshState).toEqual([ + expect.objectContaining({ + entity_ref: 'location:default/root', + }), + ]); }); it('should remove old locations using the delta options', async () => { From c1156a4b4748dfe9661ca9727e11184065d35d87 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 26 Apr 2021 14:15:29 +0200 Subject: [PATCH 122/485] Remove dead code Signed-off-by: Johan Haals --- .../src/next/DefaultProcessingStateManager.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts b/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts index 0003b7a7cf..9c1d20ae9c 100644 --- a/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts +++ b/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts @@ -14,9 +14,8 @@ * limitations under the License. */ -import { ProcessingDatabase, RefreshStateItem } from './database/types'; +import { ProcessingDatabase } from './database/types'; import { - AddProcessingItemRequest, ProcessingItem, ProcessingItemResult, ProcessingStateManager, @@ -47,12 +46,6 @@ export class DefaultProcessingStateManager implements ProcessingStateManager { }); } - async addProcessingItems(request: AddProcessingItemRequest) { - return this.db.transaction(async tx => { - // await this.db.addUnprocessedEntities(tx, request); - }); - } - async getNextProcessingItem(): Promise { for (;;) { const { items } = await this.db.transaction(async tx => { From 656e1d82b281f4f3a9518e27d1bfe014393c2c91 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 26 Apr 2021 15:38:31 +0200 Subject: [PATCH 123/485] Add all migration files to migrationsv2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: Ben Lambert Co-authored-by: Patrik Oldsberg Signed-off-by: Johan Haals --- .../migrationsv2/20200511113813_init.js | 133 ++++++++++ ...0200520140700_location_update_log_table.js | 43 ++++ ...7114117_location_update_log_latest_view.js | 45 ++++ .../migrationsv2/20200702153613_entities.js | 236 ++++++++++++++++++ ..._location_update_log_latest_deduplicate.js | 44 ++++ ...904_location_update_log_duplication_fix.js | 87 +++++++ .../20200807120600_entitySearch.js | 41 +++ .../20200809202832_add_bootstrap_location.js | 42 ++++ .../20200923104503_case_insensitivity.js | 32 +++ .../20201005122705_add_entity_full_name.js | 60 +++++ .../20201006130744_entity_data_column.js | 66 +++++ ...6203131_entity_remove_redundant_columns.js | 50 ++++ .../20201007201501_index_entity_search.js | 37 +++ .../20201019130742_add_relations_table.js | 54 ++++ .../20201123205611_relations_table_uniq.js | 93 +++++++ .../migrationsv2/20201210185851_fk_index.js | 45 ++++ .../20201230103504_update_log_varchar.js | 73 ++++++ .../20210209121210_locations_fk_index.js | 45 ++++ .../src/next/database/DatabaseManager.ts | 15 -- 19 files changed, 1226 insertions(+), 15 deletions(-) create mode 100644 plugins/catalog-backend/migrationsv2/20200511113813_init.js create mode 100644 plugins/catalog-backend/migrationsv2/20200520140700_location_update_log_table.js create mode 100644 plugins/catalog-backend/migrationsv2/20200527114117_location_update_log_latest_view.js create mode 100644 plugins/catalog-backend/migrationsv2/20200702153613_entities.js create mode 100644 plugins/catalog-backend/migrationsv2/20200721115244_location_update_log_latest_deduplicate.js create mode 100644 plugins/catalog-backend/migrationsv2/20200805163904_location_update_log_duplication_fix.js create mode 100644 plugins/catalog-backend/migrationsv2/20200807120600_entitySearch.js create mode 100644 plugins/catalog-backend/migrationsv2/20200809202832_add_bootstrap_location.js create mode 100644 plugins/catalog-backend/migrationsv2/20200923104503_case_insensitivity.js create mode 100644 plugins/catalog-backend/migrationsv2/20201005122705_add_entity_full_name.js create mode 100644 plugins/catalog-backend/migrationsv2/20201006130744_entity_data_column.js create mode 100644 plugins/catalog-backend/migrationsv2/20201006203131_entity_remove_redundant_columns.js create mode 100644 plugins/catalog-backend/migrationsv2/20201007201501_index_entity_search.js create mode 100644 plugins/catalog-backend/migrationsv2/20201019130742_add_relations_table.js create mode 100644 plugins/catalog-backend/migrationsv2/20201123205611_relations_table_uniq.js create mode 100644 plugins/catalog-backend/migrationsv2/20201210185851_fk_index.js create mode 100644 plugins/catalog-backend/migrationsv2/20201230103504_update_log_varchar.js create mode 100644 plugins/catalog-backend/migrationsv2/20210209121210_locations_fk_index.js diff --git a/plugins/catalog-backend/migrationsv2/20200511113813_init.js b/plugins/catalog-backend/migrationsv2/20200511113813_init.js new file mode 100644 index 0000000000..7f3d75e35c --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20200511113813_init.js @@ -0,0 +1,133 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + return ( + knex.schema + // + // locations + // + .createTable('locations', table => { + table.comment( + 'Registered locations that shall be contiuously scanned for catalog item updates', + ); + table + .uuid('id') + .primary() + .notNullable() + .comment('Auto-generated ID of the location'); + table.string('type').notNullable().comment('The type of location'); + table + .string('target') + .notNullable() + .comment('The actual target of the location'); + }) + // + // entities + // + .createTable('entities', table => { + table.comment('All entities currently stored in the catalog'); + table.uuid('id').primary().comment('Auto-generated ID of the entity'); + table + .uuid('location_id') + .references('id') + .inTable('locations') + .nullable() + .comment('The location that originated the entity'); + table + .string('etag') + .notNullable() + .comment( + 'An opaque string that changes for each update operation to any part of the entity, including metadata.', + ); + table + .string('generation') + .notNullable() + .unsigned() + .comment( + 'A positive nonzero number that indicates the current generation of data for this entity; the value is incremented each time the spec changes.', + ); + table + .string('api_version') + .notNullable() + .comment('The apiVersion field of the entity'); + table + .string('kind') + .notNullable() + .comment('The kind field of the entity'); + table + .string('name') + .nullable() + .comment('The metadata.name field of the entity'); + table + .string('namespace') + .nullable() + .comment('The metadata.namespace field of the entity'); + table + .string('metadata') + .notNullable() + .comment('The entire metadata JSON blob of the entity'); + table + .string('spec') + .nullable() + .comment('The entire spec JSON blob of the entity'); + }) + .alterTable('entities', table => { + // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#objectmeta-v1-meta + table.unique(['kind', 'name', 'namespace'], 'entities_unique_name'); + }) + // + // entities_search + // + .createTable('entities_search', table => { + table.comment( + 'Flattened key-values from the entities, used for quick filtering', + ); + table + .uuid('entity_id') + .references('id') + .inTable('entities') + .onDelete('CASCADE') + .comment('The entity that matches this key/value'); + table + .string('key') + .notNullable() + .comment('A key that occurs in the entity'); + table + .string('value') + .nullable() + .comment('The corresponding value to match on'); + }) + ); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + return knex.schema + .dropTable('entities_search') + .alterTable('entities', table => { + table.dropUnique([], 'entities_unique_name'); + }) + .dropTable('entities') + .dropTable('locations'); +}; diff --git a/plugins/catalog-backend/migrationsv2/20200520140700_location_update_log_table.js b/plugins/catalog-backend/migrationsv2/20200520140700_location_update_log_table.js new file mode 100644 index 0000000000..d8093fc9b4 --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20200520140700_location_update_log_table.js @@ -0,0 +1,43 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + return knex.schema.createTable('location_update_log', table => { + table.uuid('id').primary(); + table.enum('status', ['success', 'fail']).notNullable(); + table.dateTime('created_at').defaultTo(knex.fn.now()).notNullable(); + table.string('message'); + table + .uuid('location_id') + .references('id') + .inTable('locations') + .onUpdate('CASCADE') + .onDelete('CASCADE'); + table.string('entity_name').nullable(); + }); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + return knex.schema.dropTableIfExists('location_update_log'); +}; diff --git a/plugins/catalog-backend/migrationsv2/20200527114117_location_update_log_latest_view.js b/plugins/catalog-backend/migrationsv2/20200527114117_location_update_log_latest_view.js new file mode 100644 index 0000000000..a0f0f33a65 --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20200527114117_location_update_log_latest_view.js @@ -0,0 +1,45 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + // Get list sorted by created_at timestamp in descending order + // Grouped by location_id + return knex.schema.raw(` + CREATE VIEW location_update_log_latest AS + SELECT t1.* FROM location_update_log t1 + JOIN + ( + SELECT location_id, MAX(created_at) AS MAXDATE + FROM location_update_log + GROUP BY location_id + ) t2 + ON t1.location_id = t2.location_id + AND t1.created_at = t2.MAXDATE + ORDER BY created_at DESC; + `); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + return knex.schema.raw(`DROP VIEW location_update_log_latest;`); +}; diff --git a/plugins/catalog-backend/migrationsv2/20200702153613_entities.js b/plugins/catalog-backend/migrationsv2/20200702153613_entities.js new file mode 100644 index 0000000000..0f1c204f9b --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20200702153613_entities.js @@ -0,0 +1,236 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + // SQLite does not support FK and PK + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('entities_search', table => { + table.dropForeign(['entity_id']); + }); + await knex.schema.alterTable('entities', table => { + table.dropPrimary('entities_pkey'); + }); + } + await knex.schema.alterTable('entities', table => { + table.dropUnique([], 'entities_unique_name'); + }); + // Setup temporary tables + await knex.schema.renameTable('entities_search', 'tmp_entities_search'); + await knex.schema.renameTable('entities', 'tmp_entities'); + + // + // entities + // + await knex.schema + .createTable('entities', table => { + table.comment('All entities currently stored in the catalog'); + table.uuid('id').primary().comment('Auto-generated ID of the entity'); + table + .uuid('location_id') + .references('id') + .inTable('locations') + .nullable() + .comment('The location that originated the entity'); + table + .string('etag') + .notNullable() + .comment( + 'An opaque string that changes for each update operation to any part of the entity, including metadata.', + ); + table + .string('generation') + .notNullable() + .unsigned() + .comment( + 'A positive nonzero number that indicates the current generation of data for this entity; the value is incremented each time the spec changes.', + ); + table + .string('api_version') + .notNullable() + .comment('The apiVersion field of the entity'); + table + .string('kind') + .notNullable() + .comment('The kind field of the entity'); + table + .string('name') + .nullable() + .comment('The metadata.name field of the entity'); + table + .string('namespace') + .nullable() + .comment('The metadata.namespace field of the entity'); + table + .text('metadata') + .notNullable() + .comment('The entire metadata JSON blob of the entity'); + table + .text('spec') + .nullable() + .comment('The entire spec JSON blob of the entity'); + }) + .alterTable('entities', table => { + // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#objectmeta-v1-meta + table.unique(['kind', 'name', 'namespace'], 'entities_unique_name'); + }); + + await knex.schema.raw(`INSERT INTO entities SELECT * FROM tmp_entities`); + + // + // entities_search + // + await knex.schema.createTable('entities_search', table => { + table.comment( + 'Flattened key-values from the entities, used for quick filtering', + ); + table + .uuid('entity_id') + .references('id') + .inTable('entities') + .onDelete('CASCADE') + .comment('The entity that matches this key/value'); + table + .string('key') + .notNullable() + .comment('A key that occurs in the entity'); + table + .string('value') + .nullable() + .comment('The corresponding value to match on'); + }); + await knex.schema.raw( + `INSERT INTO entities_search SELECT * FROM tmp_entities_search`, + ); + + // Clean up + await knex.schema.dropTable('tmp_entities'); + return knex.schema.dropTable('tmp_entities_search'); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + // SQLite does not support FK and PK + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('entities_search', table => { + table.dropForeign(['entity_id']); + }); + await knex.schema.alterTable('entities', table => { + table.dropPrimary('entities_pkey'); + }); + } + await knex.schema.alterTable('entities', table => { + table.dropUnique([], 'entities_unique_name'); + }); + + // Setup temporary tables + await knex.schema.renameTable('entities_search', 'tmp_entities_search'); + await knex.schema.renameTable('entities', 'tmp_entities'); + + // + // entities + // + await knex.schema + .createTable('entities', table => { + table.comment('All entities currently stored in the catalog'); + table.uuid('id').primary().comment('Auto-generated ID of the entity'); + table + .uuid('location_id') + .references('id') + .inTable('locations') + .nullable() + .comment('The location that originated the entity'); + table + .string('etag') + .notNullable() + .comment( + 'An opaque string that changes for each update operation to any part of the entity, including metadata.', + ); + table + .string('generation') + .notNullable() + .unsigned() + .comment( + 'A positive nonzero number that indicates the current generation of data for this entity; the value is incremented each time the spec changes.', + ); + table + .string('api_version') + .notNullable() + .comment('The apiVersion field of the entity'); + table + .string('kind') + .notNullable() + .comment('The kind field of the entity'); + table + .string('name') + .nullable() + .comment('The metadata.name field of the entity'); + table + .string('namespace') + .nullable() + .comment('The metadata.namespace field of the entity'); + table + .string('metadata') + .notNullable() + .comment('The entire metadata JSON blob of the entity'); + table + .string('spec') + .nullable() + .comment('The entire spec JSON blob of the entity'); + }) + .alterTable('entities', table => { + // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#objectmeta-v1-meta + table.unique(['kind', 'name', 'namespace'], 'entities_unique_name'); + }); + + await knex.schema.raw(`INSERT INTO entities SELECT * FROM tmp_entities`); + + // + // entities_search + // + await knex.schema.createTable('entities_search', table => { + table.comment( + 'Flattened key-values from the entities, used for quick filtering', + ); + table + .uuid('entity_id') + .references('id') + .inTable('entities') + .onDelete('CASCADE') + .comment('The entity that matches this key/value'); + table + .string('key') + .notNullable() + .comment('A key that occurs in the entity'); + table + .string('value') + .nullable() + .comment('The corresponding value to match on'); + }); + await knex.schema.raw( + `INSERT INTO entities_search SELECT * FROM tmp_entities_search`, + ); + + // Clean up + await knex.schema.dropTable('tmp_entities'); + return knex.schema.dropTable('tmp_entities_search'); +}; diff --git a/plugins/catalog-backend/migrationsv2/20200721115244_location_update_log_latest_deduplicate.js b/plugins/catalog-backend/migrationsv2/20200721115244_location_update_log_latest_deduplicate.js new file mode 100644 index 0000000000..87b41a80fc --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20200721115244_location_update_log_latest_deduplicate.js @@ -0,0 +1,44 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = function up(knex) { + return knex.schema.raw(`DROP VIEW location_update_log_latest;`).raw(` + CREATE VIEW location_update_log_latest AS + SELECT t1.* FROM location_update_log t1 + JOIN + ( + SELECT location_id, MAX(created_at) AS MAXDATE + FROM location_update_log + GROUP BY location_id + ) t2 + ON t1.location_id = t2.location_id + AND t1.created_at = t2.MAXDATE + GROUP BY t1.location_id, t1.id + ORDER BY created_at DESC; +`); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = function down(knex) { + knex.schema.raw(`DROP VIEW location_update_log_latest;`); +}; diff --git a/plugins/catalog-backend/migrationsv2/20200805163904_location_update_log_duplication_fix.js b/plugins/catalog-backend/migrationsv2/20200805163904_location_update_log_duplication_fix.js new file mode 100644 index 0000000000..de2b194cff --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20200805163904_location_update_log_duplication_fix.js @@ -0,0 +1,87 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = function up(knex) { + return knex.schema + .raw('DROP VIEW location_update_log_latest;') + .dropTable('location_update_log') + .createTable('location_update_log', table => { + table.bigIncrements('id').primary(); // instead of uuid, so we can MAX it + table.enum('status', ['success', 'fail']).notNullable(); + table.dateTime('created_at').defaultTo(knex.fn.now()).notNullable(); + table.string('message'); + table + .uuid('location_id') + .references('id') + .inTable('locations') + .onUpdate('CASCADE') + .onDelete('CASCADE'); + table.string('entity_name').nullable(); + }).raw(` + CREATE VIEW location_update_log_latest AS + SELECT t1.* FROM location_update_log t1 + JOIN + ( + SELECT location_id, MAX(id) AS MAXID + FROM location_update_log + GROUP BY location_id + ) t2 + ON t1.location_id = t2.location_id + AND t1.id = t2.MAXID + GROUP BY t1.location_id, t1.id + ORDER BY created_at DESC; + `); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = function down(knex) { + return knex.schema + .raw('DROP VIEW location_update_log_latest;') + .dropTable('location_update_log') + .createTable('location_update_log', table => { + table.uuid('id').primary(); + table.enum('status', ['success', 'fail']).notNullable(); + table.dateTime('created_at').defaultTo(knex.fn.now()).notNullable(); + table.string('message'); + table + .uuid('location_id') + .references('id') + .inTable('locations') + .onUpdate('CASCADE') + .onDelete('CASCADE'); + table.string('entity_name').nullable(); + }).raw(` + CREATE VIEW location_update_log_latest AS + SELECT t1.* FROM location_update_log t1 + JOIN + ( + SELECT location_id, MAX(created_at) AS MAXDATE + FROM location_update_log + GROUP BY location_id + ) t2 + ON t1.location_id = t2.location_id + AND t1.created_at = t2.MAXDATE + GROUP BY t1.location_id, t1.id + ORDER BY created_at DESC; + `); +}; diff --git a/plugins/catalog-backend/migrationsv2/20200807120600_entitySearch.js b/plugins/catalog-backend/migrationsv2/20200807120600_entitySearch.js new file mode 100644 index 0000000000..45226e53b4 --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20200807120600_entitySearch.js @@ -0,0 +1,41 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + // Sqlite does not support alter column. + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('entities_search', table => { + table.text('value').nullable().alter(); + }); + } +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + // Sqlite does not support alter column. + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('entities_search', table => { + table.string('value').nullable().alter(); + }); + } +}; diff --git a/plugins/catalog-backend/migrationsv2/20200809202832_add_bootstrap_location.js b/plugins/catalog-backend/migrationsv2/20200809202832_add_bootstrap_location.js new file mode 100644 index 0000000000..a90813fe85 --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20200809202832_add_bootstrap_location.js @@ -0,0 +1,42 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + // Adds a single 'bootstrap' location that can be used to trigger work in processors. + // This is primarily here to fulfill foreign key constraints. + await knex('locations').insert({ + id: require('uuid').v4(), + type: 'bootstrap', + target: 'bootstrap', + }); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + await knex('locations') + .where({ + type: 'bootstrap', + target: 'bootstrap', + }) + .del(); +}; diff --git a/plugins/catalog-backend/migrationsv2/20200923104503_case_insensitivity.js b/plugins/catalog-backend/migrationsv2/20200923104503_case_insensitivity.js new file mode 100644 index 0000000000..ea5ba9e58d --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20200923104503_case_insensitivity.js @@ -0,0 +1,32 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + await knex('entities') + .where({ namespace: null }) + .update({ namespace: 'default' }); + await knex('entities_search').update({ + key: knex.raw('LOWER(key)'), + value: knex.raw('LOWER(value)'), + }); +}; + +exports.down = async function down() {}; diff --git a/plugins/catalog-backend/migrationsv2/20201005122705_add_entity_full_name.js b/plugins/catalog-backend/migrationsv2/20201005122705_add_entity_full_name.js new file mode 100644 index 0000000000..aae1861658 --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20201005122705_add_entity_full_name.js @@ -0,0 +1,60 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + await knex.schema.alterTable('entities', table => { + table.text('full_name').nullable(); + }); + + await knex('entities').update({ + full_name: knex.raw( + "LOWER(kind) || ':' || LOWER(COALESCE(namespace, 'default')) || '/' || LOWER(name)", + ), + }); + + // SQLite does not support alter column + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('entities', table => { + table.text('full_name').notNullable().alter(); + }); + } + + await knex.schema.alterTable('entities', table => { + // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#objectmeta-v1-meta + table.unique(['full_name'], 'entities_unique_full_name'); + table.dropUnique([], 'entities_unique_name'); + }); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + await knex.schema.alterTable('entities', table => { + // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#objectmeta-v1-meta + table.dropUnique([], 'entities_unique_full_name'); + table.unique(['kind', 'namespace', 'name'], 'entities_unique_name'); + }); + + await knex.schema.alterTable('entities_search', table => { + table.dropColumn('full_name'); + }); +}; diff --git a/plugins/catalog-backend/migrationsv2/20201006130744_entity_data_column.js b/plugins/catalog-backend/migrationsv2/20201006130744_entity_data_column.js new file mode 100644 index 0000000000..a8964efbf6 --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20201006130744_entity_data_column.js @@ -0,0 +1,66 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + await knex.schema.alterTable('entities', table => { + table + .text('data') + .nullable() + .comment('The entire JSON data blob of the entity'); + }); + + await knex('entities').update({ + // apiVersion and kind should not contain any JSON unsafe chars, and both + // metadata and spec are already valid serialized JSON + data: knex.raw( + `'{"apiVersion":"' || api_version || '","kind":"' || kind || '","metadata":' || metadata || COALESCE(',"spec":' || spec, '') || '}'`, + ), + }); + + await knex.schema.alterTable('entities', table => { + table.dropColumn('metadata'); + table.dropColumn('spec'); + }); + + // SQLite does not support ALTER COLUMN. + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('entities', table => { + table.text('data').notNullable().alter(); + }); + } +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + await knex.schema.alterTable('entities', table => { + table + .text('metadata') + .notNullable() + .comment('The entire metadata JSON blob of the entity'); + table + .text('spec') + .nullable() + .comment('The entire spec JSON blob of the entity'); + table.dropColumn('data'); + }); +}; diff --git a/plugins/catalog-backend/migrationsv2/20201006203131_entity_remove_redundant_columns.js b/plugins/catalog-backend/migrationsv2/20201006203131_entity_remove_redundant_columns.js new file mode 100644 index 0000000000..f40df5f73e --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20201006203131_entity_remove_redundant_columns.js @@ -0,0 +1,50 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + await knex.schema.alterTable('entities', table => { + table.dropColumn('api_version'); + table.dropColumn('kind'); + table.dropColumn('name'); + table.dropColumn('namespace'); + }); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + await knex.schema.alterTable('entities', table => { + table + .string('api_version') + .notNullable() + .comment('The apiVersion field of the entity'); + table.string('kind').notNullable().comment('The kind field of the entity'); + table + .string('name') + .nullable() + .comment('The metadata.name field of the entity'); + table + .string('namespace') + .nullable() + .comment('The metadata.namespace field of the entity'); + }); +}; diff --git a/plugins/catalog-backend/migrationsv2/20201007201501_index_entity_search.js b/plugins/catalog-backend/migrationsv2/20201007201501_index_entity_search.js new file mode 100644 index 0000000000..77bf0529eb --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20201007201501_index_entity_search.js @@ -0,0 +1,37 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + await knex.schema.alterTable('entities_search', table => { + table.index(['key'], 'entities_search_key'); + table.index(['value'], 'entities_search_value'); + }); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + await knex.schema.alterTable('entities_search', table => { + table.dropIndex('', 'entities_search_key'); + table.dropIndex('', 'entities_search_value'); + }); +}; diff --git a/plugins/catalog-backend/migrationsv2/20201019130742_add_relations_table.js b/plugins/catalog-backend/migrationsv2/20201019130742_add_relations_table.js new file mode 100644 index 0000000000..85e729f814 --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20201019130742_add_relations_table.js @@ -0,0 +1,54 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + await knex.schema.createTable('entities_relations', table => { + table.comment('All relations between entities in the catalog'); + table + .uuid('originating_entity_id') + .references('id') + .inTable('entities') + .onDelete('CASCADE') + .notNullable() + .comment('The entity that provided the relation'); + table + .string('source_full_name') + .notNullable() + .comment('The full name of the source entity of the relation'); + table + .string('type') + .notNullable() + .comment('The type of the relation between the entities'); + table + .string('target_full_name') + .notNullable() + .comment('The full name of the target entity of the relation'); + + table.primary(['source_full_name', 'type', 'target_full_name']); + }); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + await knex.schema.dropTable('entities_relations'); +}; diff --git a/plugins/catalog-backend/migrationsv2/20201123205611_relations_table_uniq.js b/plugins/catalog-backend/migrationsv2/20201123205611_relations_table_uniq.js new file mode 100644 index 0000000000..9e8198b5eb --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20201123205611_relations_table_uniq.js @@ -0,0 +1,93 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + if (knex.client.config.client === 'sqlite3') { + // sqlite doesn't support dropPrimary so we recreate it properly instead + await knex.schema.dropTable('entities_relations'); + await knex.schema.createTable('entities_relations', table => { + table.comment('All relations between entities in the catalog'); + table + .uuid('originating_entity_id') + .references('id') + .inTable('entities') + .onDelete('CASCADE') + .notNullable() + .comment('The entity that provided the relation'); + table + .string('source_full_name') + .notNullable() + .comment('The full name of the source entity of the relation'); + table + .string('type') + .notNullable() + .comment('The type of the relation between the entities'); + table + .string('target_full_name') + .notNullable() + .comment('The full name of the target entity of the relation'); + table.index('source_full_name', 'source_full_name_idx'); + }); + } else { + await knex.schema.alterTable('entities_relations', table => { + table.dropPrimary(); + table.index('source_full_name', 'source_full_name_idx'); + }); + } +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + if (knex.client.config.client === 'sqlite3') { + await knex.schema.dropTable('entities_relations'); + await knex.schema.createTable('entities_relations', table => { + table.comment('All relations between entities in the catalog'); + table + .uuid('originating_entity_id') + .references('id') + .inTable('entities') + .onDelete('CASCADE') + .notNullable() + .comment('The entity that provided the relation'); + table + .string('source_full_name') + .notNullable() + .comment('The full name of the source entity of the relation'); + table + .string('type') + .notNullable() + .comment('The type of the relation between the entities'); + table + .string('target_full_name') + .notNullable() + .comment('The full name of the target entity of the relation'); + + table.primary(['source_full_name', 'type', 'target_full_name']); + }); + } else { + await knex.schema.alterTable('entities_relations', table => { + table.dropIndex([], 'source_full_name_idx'); + table.primary(['source_full_name', 'type', 'target_full_name']); + }); + } +}; diff --git a/plugins/catalog-backend/migrationsv2/20201210185851_fk_index.js b/plugins/catalog-backend/migrationsv2/20201210185851_fk_index.js new file mode 100644 index 0000000000..abb26cd5fc --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20201210185851_fk_index.js @@ -0,0 +1,45 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('entities_relations', table => { + table.index('originating_entity_id', 'originating_entity_id_idx'); + }); + await knex.schema.alterTable('entities_search', table => { + table.index('entity_id', 'entity_id_idx'); + }); + } +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('entities_relations', table => { + table.dropIndex([], 'originating_entity_id_idx'); + }); + await knex.schema.alterTable('entities_relations', table => { + table.dropIndex([], 'entity_id_idx'); + }); + } +}; diff --git a/plugins/catalog-backend/migrationsv2/20201230103504_update_log_varchar.js b/plugins/catalog-backend/migrationsv2/20201230103504_update_log_varchar.js new file mode 100644 index 0000000000..d924b0414a --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20201230103504_update_log_varchar.js @@ -0,0 +1,73 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + if (knex.client.config.client !== 'sqlite3') { + // We actually just want to widen columns, but can't do that while a + // view is dependent on them - so we just reconstruct it exactly as it was + await knex.schema + .raw('DROP VIEW location_update_log_latest;') + .alterTable('location_update_log', table => { + table.text('message').alter(); + table.text('entity_name').nullable().alter(); + }).raw(` + CREATE VIEW location_update_log_latest AS + SELECT t1.* FROM location_update_log t1 + JOIN + ( + SELECT location_id, MAX(id) AS MAXID + FROM location_update_log + GROUP BY location_id + ) t2 + ON t1.location_id = t2.location_id + AND t1.id = t2.MAXID + GROUP BY t1.location_id, t1.id + ORDER BY created_at DESC; + `); + } +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + if (knex.client.config.client !== 'sqlite3') { + await knex.schema + .raw('DROP VIEW location_update_log_latest;') + .alterTable('location_update_log', table => { + table.string('message').alter(); + table.string('entity_name').nullable().alter(); + }).raw(` + CREATE VIEW location_update_log_latest AS + SELECT t1.* FROM location_update_log t1 + JOIN + ( + SELECT location_id, MAX(id) AS MAXID + FROM location_update_log + GROUP BY location_id + ) t2 + ON t1.location_id = t2.location_id + AND t1.id = t2.MAXID + GROUP BY t1.location_id, t1.id + ORDER BY created_at DESC; + `); + } +}; diff --git a/plugins/catalog-backend/migrationsv2/20210209121210_locations_fk_index.js b/plugins/catalog-backend/migrationsv2/20210209121210_locations_fk_index.js new file mode 100644 index 0000000000..ccfb1faffb --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20210209121210_locations_fk_index.js @@ -0,0 +1,45 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('entities', table => { + table.index('location_id', 'entity_location_id_idx'); + }); + await knex.schema.alterTable('location_update_log', table => { + table.index('location_id', 'update_log_location_id_idx'); + }); + } +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('entities', table => { + table.dropIndex([], 'entity_location_id_idx'); + }); + await knex.schema.alterTable('location_update_log', table => { + table.dropIndex([], 'update_log_location_id_idx'); + }); + } +}; diff --git a/plugins/catalog-backend/src/next/database/DatabaseManager.ts b/plugins/catalog-backend/src/next/database/DatabaseManager.ts index 4c9e45950f..f660f73ecb 100644 --- a/plugins/catalog-backend/src/next/database/DatabaseManager.ts +++ b/plugins/catalog-backend/src/next/database/DatabaseManager.ts @@ -20,7 +20,6 @@ import { v4 as uuidv4 } from 'uuid'; import { Logger } from 'winston'; import { CommonDatabase } from '../../database/CommonDatabase'; import { Database } from '../../database/types'; -import fs from 'fs-extra'; export type CreateDatabaseOptions = { logger: Logger; @@ -35,16 +34,10 @@ export class DatabaseManager { knex: Knex, options: Partial = {}, ): Promise { - const allMigrations = resolvePackagePath( - '@backstage/plugin-catalog-backend', - 'migrations', - ); - const migrationsDir = resolvePackagePath( '@backstage/plugin-catalog-backend', 'migrationsv2', ); - await fs.copy(allMigrations, migrationsDir); await knex.migrate.latest({ directory: migrationsDir, @@ -79,14 +72,6 @@ export class DatabaseManager { public static async createTestDatabaseConnection(): Promise { const config: Knex.Config = { - /* - client: 'pg', - connection: { - host: 'localhost', - user: 'postgres', - password: 'postgres', - }, - */ client: 'sqlite3', connection: ':memory:', useNullAsDefault: true, From fae7eb02965c17534168b0c85580ea5367e05477 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 26 Apr 2021 15:43:22 +0200 Subject: [PATCH 124/485] Add configLocationProvider and provider identifiers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: Ben Lambert Co-authored-by: Patrik Oldsberg Signed-off-by: Johan Haals --- .../src/next/ConfigLocationProvider.ts | 49 +++++++++++++++++++ .../next/DefaultCatalogProcessingEngine.ts | 9 ++-- .../src/next/DefaultLocationStore.ts | 4 ++ .../src/next/NextCatalogBuilder.ts | 7 +-- plugins/catalog-backend/src/next/types.ts | 1 + 5 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 plugins/catalog-backend/src/next/ConfigLocationProvider.ts diff --git a/plugins/catalog-backend/src/next/ConfigLocationProvider.ts b/plugins/catalog-backend/src/next/ConfigLocationProvider.ts new file mode 100644 index 0000000000..5b93fcfd98 --- /dev/null +++ b/plugins/catalog-backend/src/next/ConfigLocationProvider.ts @@ -0,0 +1,49 @@ +/* + * 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 { EntityProviderConnection, EntityProvider } from './types'; +import path from 'path'; +import { Config } from '@backstage/config'; +import { locationSpecToLocationEntity } from './util'; + +export class ConfigLocationProvider implements EntityProvider { + private connection: EntityProviderConnection | undefined; + + constructor(private readonly config: Config) {} + + getProviderName(): string { + return 'ConfigLocationProvider'; + } + + async connect(connection: EntityProviderConnection): Promise { + this.connection = connection; + + const locationConfigs = + this.config.getOptionalConfigArray('catalog.locations') ?? []; + + const entities = locationConfigs.map(location => + locationSpecToLocationEntity({ + type: location.getString('type'), + target: path.resolve(location.getString('target')), + }), + ); + + await this.connection.applyMutation({ + type: 'full', + entities, + }); + } +} diff --git a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts index b71b2c1045..1934b0aea7 100644 --- a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts +++ b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts @@ -68,9 +68,12 @@ export class DefaultCatalogProcessingEngine implements CatalogProcessingEngine { async start() { for (const provider of this.entityProviders) { - // TODO: this ID should be some form of identifier for the EntityProvider - const id = 'databaseProvider'; - provider.connect(new Connection({ stateManager: this.stateManager, id })); + provider.connect( + new Connection({ + stateManager: this.stateManager, + id: provider.getProviderName(), + }), + ); } this.running = true; diff --git a/plugins/catalog-backend/src/next/DefaultLocationStore.ts b/plugins/catalog-backend/src/next/DefaultLocationStore.ts index 40870cff7b..a56e5d1585 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationStore.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationStore.ts @@ -30,6 +30,10 @@ export class DefaultLocationStore implements LocationStore, EntityProvider { constructor(private readonly db: Database) {} + getProviderName(): string { + return 'DefaultLocationStore'; + } + createLocation(spec: LocationSpec): Promise { return this.db.transaction(async tx => { // TODO: id should really be type and target combined and not a uuid. diff --git a/plugins/catalog-backend/src/next/NextCatalogBuilder.ts b/plugins/catalog-backend/src/next/NextCatalogBuilder.ts index d720bd331a..0699a13f58 100644 --- a/plugins/catalog-backend/src/next/NextCatalogBuilder.ts +++ b/plugins/catalog-backend/src/next/NextCatalogBuilder.ts @@ -50,6 +50,7 @@ import { GithubDiscoveryProcessor, GithubOrgReaderProcessor, LdapOrgReaderProcessor, + LocationEntityProcessor, MicrosoftGraphOrgReaderProcessor, PlaceholderProcessor, PlaceholderResolver, @@ -73,6 +74,7 @@ import { CatalogProcessingEngine } from '../next/types'; import { NextEntitiesCatalog } from './NextEntitiesCatalog'; import { Stitcher } from './Stitcher'; import { CommonDatabase } from '../database/CommonDatabase'; +import { ConfigLocationProvider } from './ConfigLocationProvider'; export type CatalogEnvironment = { logger: Logger; @@ -272,9 +274,10 @@ export class NextCatalogBuilder { const locationStore = new DefaultLocationStore(db); const stitcher = new Stitcher(dbClient, logger); + const configLocationProvider = new ConfigLocationProvider(config); const processingEngine = new DefaultCatalogProcessingEngine( logger, - [locationStore], // entityproviders + [locationStore, configLocationProvider], stateManager, orchestrator, stitcher, @@ -322,7 +325,6 @@ export class NextCatalogBuilder { // These are always there no matter what const processors: CatalogProcessor[] = [ - StaticLocationProcessor.fromConfig(config), new PlaceholderProcessor({ resolvers: placeholderResolvers, reader }), new BuiltinKindsEntityProcessor(), ]; @@ -338,7 +340,6 @@ export class NextCatalogBuilder { MicrosoftGraphOrgReaderProcessor.fromConfig(config, { logger }), new UrlReaderProcessor({ reader, logger }), CodeOwnersProcessor.fromConfig(config, { logger, reader }), - // new LocationEntityProcessor({ integrations }), new AnnotateLocationEntityProcessor({ integrations }), ); } diff --git a/plugins/catalog-backend/src/next/types.ts b/plugins/catalog-backend/src/next/types.ts index ef3bab797b..e0616fb336 100644 --- a/plugins/catalog-backend/src/next/types.ts +++ b/plugins/catalog-backend/src/next/types.ts @@ -65,6 +65,7 @@ export interface EntityProviderConnection { } export interface EntityProvider { + getProviderName(): string; connect(connection: EntityProviderConnection): Promise; } From e00ba124546a742639973fd26edb39635dff5351 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 26 Apr 2021 16:53:44 +0200 Subject: [PATCH 125/485] chore: remove unused imports Signed-off-by: Johan Haals --- plugins/catalog-backend/src/next/NextCatalogBuilder.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/catalog-backend/src/next/NextCatalogBuilder.ts b/plugins/catalog-backend/src/next/NextCatalogBuilder.ts index 0699a13f58..24b763a098 100644 --- a/plugins/catalog-backend/src/next/NextCatalogBuilder.ts +++ b/plugins/catalog-backend/src/next/NextCatalogBuilder.ts @@ -50,11 +50,9 @@ import { GithubDiscoveryProcessor, GithubOrgReaderProcessor, LdapOrgReaderProcessor, - LocationEntityProcessor, MicrosoftGraphOrgReaderProcessor, PlaceholderProcessor, PlaceholderResolver, - StaticLocationProcessor, UrlReaderProcessor, } from '../ingestion'; import { RepoLocationAnalyzer } from '../ingestion/LocationAnalyzer'; From b74e3e1efc3739304e37435a58ea3f0f16478bfe Mon Sep 17 00:00:00 2001 From: Victor Perera Date: Mon, 26 Apr 2021 18:53:11 -0500 Subject: [PATCH 126/485] Enable starred templates on scaffolder Signed-off-by: Victor Perera --- .../FavouriteTemplate/FavouriteTemplate.tsx | 67 +++++++++++++++++++ .../ScaffolderPage/ScaffolderPage.tsx | 1 + .../components/TemplateCard/TemplateCard.tsx | 10 ++- 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 plugins/scaffolder/src/components/FavouriteTemplate/FavouriteTemplate.tsx diff --git a/plugins/scaffolder/src/components/FavouriteTemplate/FavouriteTemplate.tsx b/plugins/scaffolder/src/components/FavouriteTemplate/FavouriteTemplate.tsx new file mode 100644 index 0000000000..99f6c21a1d --- /dev/null +++ b/plugins/scaffolder/src/components/FavouriteTemplate/FavouriteTemplate.tsx @@ -0,0 +1,67 @@ +/* + * Copyright 2020 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 React, { ComponentProps } from 'react'; +import { useStarredEntities } from '@backstage/plugin-catalog-react'; +import { IconButton, makeStyles, Tooltip, withStyles } from '@material-ui/core'; +import StarBorder from '@material-ui/icons/StarBorder'; +import Star from '@material-ui/icons/Star'; +import { Entity } from '@backstage/catalog-model'; + +type Props = ComponentProps & { entity: Entity }; + +const YellowStar = withStyles({ + root: { + color: '#f3ba37', + }, +})(Star); + +const useStyles = makeStyles(theme => ({ + starButton: { + position: 'absolute', + top: theme.spacing(0.5), + right: theme.spacing(0.5), + padding: '0.25rem', + }, +})); + +export const favouriteTemplateTooltip = (isStarred: boolean) => + isStarred ? 'Remove from favorites' : 'Add to favorites'; + +export const favouriteTemplateIcon = (isStarred: boolean) => + isStarred ? : ; + +/** + * IconButton for showing if a current entity is starred and adding/removing it from the favourite entities + * @param props MaterialUI IconButton props extended by required `entity` prop + */ +export const FavouriteTemplate = (props: Props) => { + const classes = useStyles(); + const { toggleStarredEntity, isStarredEntity } = useStarredEntities(); + const isStarred = isStarredEntity(props.entity); + return ( + toggleStarredEntity(props.entity)} + > + + {favouriteTemplateIcon(isStarred)} + + + ); +}; diff --git a/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx b/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx index 68bf588d01..00b13853ec 100644 --- a/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx +++ b/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx @@ -61,6 +61,7 @@ const getTemplateCardProps = ( type: template.spec.type ?? '', description: template.metadata.description ?? '-', tags: (template.metadata?.tags as string[]) ?? [], + entityTemplate: template, }; }; diff --git a/plugins/scaffolder/src/components/TemplateCard/TemplateCard.tsx b/plugins/scaffolder/src/components/TemplateCard/TemplateCard.tsx index 2ba83fdaae..2e9cfe6470 100644 --- a/plugins/scaffolder/src/components/TemplateCard/TemplateCard.tsx +++ b/plugins/scaffolder/src/components/TemplateCard/TemplateCard.tsx @@ -28,8 +28,13 @@ import { import React from 'react'; import { generatePath } from 'react-router'; import { rootRouteRef } from '../../routes'; +import { Entity } from '@backstage/catalog-model'; +import { FavouriteTemplate } from '../FavouriteTemplate/FavouriteTemplate'; const useStyles = makeStyles({ + cardHeader: { + position: 'relative', + }, title: { backgroundImage: ({ backgroundImage }: any) => backgroundImage, }, @@ -48,6 +53,7 @@ export type TemplateCardProps = { title: string; type: string; name: string; + entityTemplate: Entity; }; export const TemplateCard = ({ @@ -56,6 +62,7 @@ export const TemplateCard = ({ title, type, name, + entityTemplate, }: TemplateCardProps) => { const backstageTheme = useTheme(); const rootLink = useRouteRef(rootRouteRef); @@ -69,7 +76,8 @@ export const TemplateCard = ({ return ( - + + Date: Mon, 26 Apr 2021 19:00:57 -0500 Subject: [PATCH 127/485] Adding Changeset Signed-off-by: Victor Perera --- .changeset/long-ladybugs-promise.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/long-ladybugs-promise.md diff --git a/.changeset/long-ladybugs-promise.md b/.changeset/long-ladybugs-promise.md new file mode 100644 index 0000000000..7d683650c3 --- /dev/null +++ b/.changeset/long-ladybugs-promise.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder': patch +--- + +Enable starred templates on Scaffolder frontend From 4c42ecca2d106c80f358655b7e0863be463049c6 Mon Sep 17 00:00:00 2001 From: Andrew Shirley Date: Mon, 19 Apr 2021 16:31:30 +0100 Subject: [PATCH 128/485] Wrap EmptyState in a Card This prevents it overflowing onto subsequent content Signed-off-by: Andrew Shirley --- .changeset/empty-lizards-doubt.md | 5 +++ .../Cards/RecentWorkflowRunsCard.tsx | 43 ++++++++++++------- 2 files changed, 33 insertions(+), 15 deletions(-) create mode 100644 .changeset/empty-lizards-doubt.md diff --git a/.changeset/empty-lizards-doubt.md b/.changeset/empty-lizards-doubt.md new file mode 100644 index 0000000000..cfe1e128fc --- /dev/null +++ b/.changeset/empty-lizards-doubt.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-github-actions': patch +--- + +Wrap EmptyState in Card diff --git a/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx b/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx index 1126c2a2a0..a3605abb7e 100644 --- a/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx +++ b/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx @@ -25,7 +25,14 @@ import { } from '@backstage/core'; import { readGitHubIntegrationConfigs } from '@backstage/integration'; import { useEntity } from '@backstage/plugin-catalog-react'; -import { Button, Link } from '@material-ui/core'; +import { + Button, + Card, + CardContent, + CardHeader, + Divider, + Link, +} from '@material-ui/core'; import React, { useEffect } from 'react'; import { generatePath, Link as RouterLink } from 'react-router-dom'; import { GITHUB_ACTIONS_ANNOTATION } from '../useProjectName'; @@ -75,20 +82,26 @@ export const RecentWorkflowRunsCard = ({ const githubHost = hostname || 'github.com'; return !runs.length ? ( - - Create new Workflow - - } - /> + + + + + + Create new Workflow + + } + /> + + ) : ( Date: Mon, 26 Apr 2021 17:31:43 +0100 Subject: [PATCH 129/485] Use InfoCard not Card Signed-off-by: Andrew Shirley --- .../Cards/RecentWorkflowRunsCard.tsx | 45 +++++++------------ 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx b/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx index a3605abb7e..97428088fc 100644 --- a/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx +++ b/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx @@ -25,14 +25,7 @@ import { } from '@backstage/core'; import { readGitHubIntegrationConfigs } from '@backstage/integration'; import { useEntity } from '@backstage/plugin-catalog-react'; -import { - Button, - Card, - CardContent, - CardHeader, - Divider, - Link, -} from '@material-ui/core'; +import { Button, Link } from '@material-ui/core'; import React, { useEffect } from 'react'; import { generatePath, Link as RouterLink } from 'react-router-dom'; import { GITHUB_ACTIONS_ANNOTATION } from '../useProjectName'; @@ -82,26 +75,22 @@ export const RecentWorkflowRunsCard = ({ const githubHost = hostname || 'github.com'; return !runs.length ? ( - - - - - - Create new Workflow - - } - /> - - + + + Create new Workflow + + } + /> + ) : ( Date: Mon, 26 Apr 2021 18:04:06 +0100 Subject: [PATCH 130/485] Eliminate EmptyState usage Signed-off-by: Andrew Shirley --- .../Cards/RecentWorkflowRunsCard.tsx | 89 +++++++++---------- 1 file changed, 43 insertions(+), 46 deletions(-) diff --git a/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx b/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx index 97428088fc..f0366e5590 100644 --- a/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx +++ b/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx @@ -16,21 +16,21 @@ import { Entity } from '@backstage/catalog-model'; import { configApiRef, - EmptyState, errorApiRef, InfoCard, InfoCardVariants, + Link, Table, useApi, } from '@backstage/core'; import { readGitHubIntegrationConfigs } from '@backstage/integration'; import { useEntity } from '@backstage/plugin-catalog-react'; -import { Button, Link } from '@material-ui/core'; import React, { useEffect } from 'react'; import { generatePath, Link as RouterLink } from 'react-router-dom'; import { GITHUB_ACTIONS_ANNOTATION } from '../useProjectName'; import { useWorkflowRuns } from '../useWorkflowRuns'; import { WorkflowRunStatus } from '../WorkflowRunStatus'; +import { Typography } from '@material-ui/core'; const firstLine = (message: string): string => message.split('\n')[0]; @@ -74,56 +74,53 @@ export const RecentWorkflowRunsCard = ({ const githubHost = hostname || 'github.com'; - return !runs.length ? ( - - - Create new Workflow - - } - /> - - ) : ( + return ( - ( - - {firstLine(data.message)} - - ), - }, - { title: 'Branch', field: 'source.branchName' }, - { title: 'Status', field: 'status', render: WorkflowRunStatus }, - ]} - data={runs} - /> + {!runs.length ? ( +
+ + This component has GitHub Actions enabled, but no workflows were + found. + + + + Create a new workflow + + +
+ ) : ( +
( + + {firstLine(data.message)} + + ), + }, + { title: 'Branch', field: 'source.branchName' }, + { title: 'Status', field: 'status', render: WorkflowRunStatus }, + ]} + data={runs} + /> + )} ); }; From 6c38f5e92031b5574e20d8da28ffeedd89608177 Mon Sep 17 00:00:00 2001 From: Brian Fox Date: Tue, 27 Apr 2021 10:55:57 +0200 Subject: [PATCH 131/485] tests(proxy-backend): align tests with default backend configuration The pathPrefix is not suffixed with `/` by default as noted at https://github.com/backstage/backstage/blob/df897a6126d1641d111b015c527cc8d40c47bd06/packages/backend-common/src/discovery/types.ts#L47 and seen in the implementation at https://github.com/backstage/backstage/blob/df897a6126d1641d111b015c527cc8d40c47bd06/packages/backend-common/src/discovery/SingleHostDiscovery.ts#L81. Currently the tests work in the opposite way - the pathPrefix is suffixed by / whereas the routes are **not** prefixed by /. This commit brings the tests in line with the default configuration prior to any further work. Signed-off-by: Brian Fox --- .../proxy-backend/src/service/router.test.ts | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/plugins/proxy-backend/src/service/router.test.ts b/plugins/proxy-backend/src/service/router.test.ts index 6c47043602..3a0a25f164 100644 --- a/plugins/proxy-backend/src/service/router.test.ts +++ b/plugins/proxy-backend/src/service/router.test.ts @@ -60,7 +60,7 @@ describe('buildMiddleware', () => { }); it('accepts strings', async () => { - buildMiddleware('/api/', logger, 'test', 'http://mocked'); + buildMiddleware('/proxy', logger, '/test', 'http://mocked'); expect(createProxyMiddleware).toHaveBeenCalledTimes(1); @@ -74,13 +74,13 @@ describe('buildMiddleware', () => { expect(filter('', { method: 'PATCH', headers: {} })).toBe(true); expect(filter('', { method: 'DELETE', headers: {} })).toBe(true); - expect(fullConfig.pathRewrite).toEqual({ '^/api/test/': '/' }); + expect(fullConfig.pathRewrite).toEqual({ '^/proxy/test/': '/' }); expect(fullConfig.changeOrigin).toBe(true); expect(fullConfig.logProvider!(logger)).toBe(logger); }); it('limits allowedMethods', async () => { - buildMiddleware('/api/', logger, 'test', { + buildMiddleware('/proxy', logger, '/test', { target: 'http://mocked', allowedMethods: ['GET', 'DELETE'], }); @@ -97,13 +97,13 @@ describe('buildMiddleware', () => { expect(filter('', { method: 'PATCH', headers: {} })).toBe(false); expect(filter('', { method: 'DELETE', headers: {} })).toBe(true); - expect(fullConfig.pathRewrite).toEqual({ '^/api/test/': '/' }); + expect(fullConfig.pathRewrite).toEqual({ '^/proxy/test/': '/' }); expect(fullConfig.changeOrigin).toBe(true); expect(fullConfig.logProvider!(logger)).toBe(logger); }); it('permits default headers', async () => { - buildMiddleware('/api/', logger, 'test', { + buildMiddleware('/proxy', logger, '/test', { target: 'http://mocked', }); @@ -143,7 +143,7 @@ describe('buildMiddleware', () => { }); it('permits default and configured headers', async () => { - buildMiddleware('/api/', logger, 'test', { + buildMiddleware('/proxy', logger, '/test', { target: 'http://mocked', headers: { Authorization: 'my-token', @@ -176,7 +176,7 @@ describe('buildMiddleware', () => { }); it('permits configured headers', async () => { - buildMiddleware('/api/', logger, 'test', { + buildMiddleware('/proxy', logger, '/test', { target: 'http://mocked', allowedHeaders: ['authorization', 'cookie'], }); @@ -208,7 +208,7 @@ describe('buildMiddleware', () => { }); it('responds default headers', async () => { - buildMiddleware('/api/', logger, 'test', { + buildMiddleware('/proxy', logger, '/test', { target: 'http://mocked', }); @@ -251,7 +251,7 @@ describe('buildMiddleware', () => { }); it('responds configured headers', async () => { - buildMiddleware('/api/', logger, 'test', { + buildMiddleware('/proxy', logger, '/test', { target: 'http://mocked', allowedHeaders: ['set-cookie'], }); @@ -282,10 +282,10 @@ describe('buildMiddleware', () => { it('rejects malformed target URLs', async () => { expect(() => - buildMiddleware('/api/', logger, 'test', 'backstage.io'), + buildMiddleware('/proxy', logger, '/test', 'backstage.io'), ).toThrowError(/Proxy target is not a valid URL/); expect(() => - buildMiddleware('/api/', logger, 'test', { target: 'backstage.io' }), + buildMiddleware('/proxy', logger, '/test', { target: 'backstage.io' }), ).toThrowError(/Proxy target is not a valid URL/); }); }); From cdb3426e56f49dd5dffba3c35eea383a416b1bf1 Mon Sep 17 00:00:00 2001 From: Brian Fox Date: Tue, 27 Apr 2021 12:38:31 +0200 Subject: [PATCH 132/485] fix(proxy-backend): prefix routes with `/` if not present in config This commit ensures that the default `pathRewrite` configuration for a proxy element is more resilient to the combination of whether: - `route` is prefixed with `/` - `pathPrefix` on the plugin is suffixed with `/` (which at present it will never be - see comments). Signed-off-by: Brian Fox --- .changeset/thick-cobras-switch.md | 5 +++ docs/plugins/proxying.md | 11 ++--- .../proxy-backend/src/service/router.test.ts | 42 ++++++++++++++++++- plugins/proxy-backend/src/service/router.ts | 16 ++++++- 4 files changed, 67 insertions(+), 7 deletions(-) create mode 100644 .changeset/thick-cobras-switch.md diff --git a/.changeset/thick-cobras-switch.md b/.changeset/thick-cobras-switch.md new file mode 100644 index 0000000000..002c724421 --- /dev/null +++ b/.changeset/thick-cobras-switch.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-proxy-backend': patch +--- + +Prefix proxy routes with `/` if not present in configuration diff --git a/docs/plugins/proxying.md b/docs/plugins/proxying.md index 50c56af7a6..3e20e37cad 100644 --- a/docs/plugins/proxying.md +++ b/docs/plugins/proxying.md @@ -36,7 +36,7 @@ Example: ```yaml # in app-config.yaml proxy: - '/simple-example': http://simple.example.com:8080 + simple-example: http://simple.example.com:8080 '/larger-example/v1': target: http://larger.example.com:8080/svc.v1 headers: @@ -46,10 +46,11 @@ proxy: ``` Each key under the proxy configuration entry is a route to match, below the -prefix that the proxy plugin is mounted on. It must start with a slash. For -example, if the backend mounts the proxy plugin as `/proxy`, the above -configuration will lead to the proxy acting on backend requests to -`/api/proxy/simple-example/...` and `/api/proxy/larger-example/v1/...`. +prefix that the proxy plugin is mounted on. If it does not start with a slash, +one will be prefixed automatically. For example, if the backend mounts the proxy +plugin as `/proxy`, the above configuration will lead to the proxy acting on +backend requests to `/api/proxy/simple-example/...` and +`/api/proxy/larger-example/v1/...`. The value inside each route is either a simple URL string, or an object on the format accepted by diff --git a/plugins/proxy-backend/src/service/router.test.ts b/plugins/proxy-backend/src/service/router.test.ts index 3a0a25f164..571de96ac4 100644 --- a/plugins/proxy-backend/src/service/router.test.ts +++ b/plugins/proxy-backend/src/service/router.test.ts @@ -59,7 +59,7 @@ describe('buildMiddleware', () => { mockCreateProxyMiddleware.mockClear(); }); - it('accepts strings', async () => { + it('accepts strings prefixed by /', async () => { buildMiddleware('/proxy', logger, '/test', 'http://mocked'); expect(createProxyMiddleware).toHaveBeenCalledTimes(1); @@ -79,6 +79,46 @@ describe('buildMiddleware', () => { expect(fullConfig.logProvider!(logger)).toBe(logger); }); + it('accepts routes not prefixed with / when path is not suffixed with /', async () => { + buildMiddleware('/proxy', logger, 'test', 'http://mocked'); + + expect(createProxyMiddleware).toHaveBeenCalledTimes(1); + + const [filter, fullConfig] = mockCreateProxyMiddleware.mock.calls[0] as [ + (pathname: string, req: Partial) => boolean, + ProxyMiddlewareConfig, + ]; + expect(filter('', { method: 'GET', headers: {} })).toBe(true); + expect(filter('', { method: 'POST', headers: {} })).toBe(true); + expect(filter('', { method: 'PUT', headers: {} })).toBe(true); + expect(filter('', { method: 'PATCH', headers: {} })).toBe(true); + expect(filter('', { method: 'DELETE', headers: {} })).toBe(true); + + expect(fullConfig.pathRewrite).toEqual({ '^/proxy/test/': '/' }); + expect(fullConfig.changeOrigin).toBe(true); + expect(fullConfig.logProvider!(logger)).toBe(logger); + }); + + it('accepts routes prefixed with / when path is suffixed with /', async () => { + buildMiddleware('/proxy/', logger, '/test', 'http://mocked'); + + expect(createProxyMiddleware).toHaveBeenCalledTimes(1); + + const [filter, fullConfig] = mockCreateProxyMiddleware.mock.calls[0] as [ + (pathname: string, req: Partial) => boolean, + ProxyMiddlewareConfig, + ]; + expect(filter('', { method: 'GET', headers: {} })).toBe(true); + expect(filter('', { method: 'POST', headers: {} })).toBe(true); + expect(filter('', { method: 'PUT', headers: {} })).toBe(true); + expect(filter('', { method: 'PATCH', headers: {} })).toBe(true); + expect(filter('', { method: 'DELETE', headers: {} })).toBe(true); + + expect(fullConfig.pathRewrite).toEqual({ '^/proxy/test/': '/' }); + expect(fullConfig.changeOrigin).toBe(true); + expect(fullConfig.logProvider!(logger)).toBe(logger); + }); + it('limits allowedMethods', async () => { buildMiddleware('/proxy', logger, '/test', { target: 'http://mocked', diff --git a/plugins/proxy-backend/src/service/router.ts b/plugins/proxy-backend/src/service/router.ts index 5c306de966..71ed82c23b 100644 --- a/plugins/proxy-backend/src/service/router.ts +++ b/plugins/proxy-backend/src/service/router.ts @@ -77,10 +77,24 @@ export function buildMiddleware( `Proxy target is not a valid URL: ${fullConfig.target ?? ''}`, ); } + // Default is to do a path rewrite that strips out the proxy's path prefix // and the rest of the route. if (fullConfig.pathRewrite === undefined) { - const routeWithSlash = route.endsWith('/') ? route : `${route}/`; + let routeWithSlash = route.endsWith('/') ? route : `${route}/`; + + if (!pathPrefix.endsWith('/') && !routeWithSlash.startsWith('/')) { + // Need to insert a / between pathPrefix and routeWithSlash + routeWithSlash = `/${routeWithSlash}`; + } else if (pathPrefix.endsWith('/') && routeWithSlash.startsWith('/')) { + // Never expect this to happen at this point in time as + // pathPrefix is set using `getExternalBaseUrl` which "Returns the + // external HTTP base backend URL for a given plugin, + // **without a trailing slash.**". But in case this changes in future, we + // need to drop a / on either pathPrefix or routeWithSlash + routeWithSlash = routeWithSlash.substring(1); + } + fullConfig.pathRewrite = { [`^${pathPrefix}${routeWithSlash}`]: '/', }; From 8ce7d6e8f81d621c66e069c64cfe67f4e42fed3c Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Tue, 27 Apr 2021 14:16:49 +0200 Subject: [PATCH 133/485] catalog-backend: Add ConfigLocationProvider tests Co-authored-by: Ben Lambert Signed-off-by: Johan Haals --- .../src/next/ConfigLocationProvider.test.ts | 67 +++++++++++++++++++ .../src/next/ConfigLocationProvider.ts | 14 ++-- 2 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 plugins/catalog-backend/src/next/ConfigLocationProvider.test.ts diff --git a/plugins/catalog-backend/src/next/ConfigLocationProvider.test.ts b/plugins/catalog-backend/src/next/ConfigLocationProvider.test.ts new file mode 100644 index 0000000000..9aaba13c48 --- /dev/null +++ b/plugins/catalog-backend/src/next/ConfigLocationProvider.test.ts @@ -0,0 +1,67 @@ +/* + * 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 { ConfigLocationProvider } from './ConfigLocationProvider'; +import { EntityProviderConnection } from './types'; +import { ConfigReader } from '@backstage/config'; +import { resolvePackagePath } from '@backstage/backend-common'; +import path from 'path'; + +describe('Config Location Provider', () => { + it('should apply mutation with the correct paths in the config', async () => { + const mockConfig = new ConfigReader({ + catalog: { + locations: [ + { type: 'file', target: './lols.yaml' }, + { type: 'url', target: 'https://github.com/backstage/backstage' }, + ], + }, + }); + + const mockConnection = ({ + applyMutation: jest.fn(), + } as unknown) as EntityProviderConnection; + const locationProvider = new ConfigLocationProvider(mockConfig); + + await locationProvider.connect(mockConnection); + + expect(mockConnection.applyMutation).toHaveBeenCalledWith({ + type: 'full', + entities: expect.arrayContaining([ + expect.objectContaining({ + spec: { + target: path.join( + resolvePackagePath('@backstage/plugin-catalog-backend'), + './lols.yaml', + ), + type: 'file', + }, + }), + ]), + }); + expect(mockConnection.applyMutation).toHaveBeenCalledWith({ + type: 'full', + entities: expect.arrayContaining([ + expect.objectContaining({ + spec: { + target: 'https://github.com/backstage/backstage', + type: 'url', + }, + }), + ]), + }); + }); +}); diff --git a/plugins/catalog-backend/src/next/ConfigLocationProvider.ts b/plugins/catalog-backend/src/next/ConfigLocationProvider.ts index 5b93fcfd98..8a65487df1 100644 --- a/plugins/catalog-backend/src/next/ConfigLocationProvider.ts +++ b/plugins/catalog-backend/src/next/ConfigLocationProvider.ts @@ -34,12 +34,14 @@ export class ConfigLocationProvider implements EntityProvider { const locationConfigs = this.config.getOptionalConfigArray('catalog.locations') ?? []; - const entities = locationConfigs.map(location => - locationSpecToLocationEntity({ - type: location.getString('type'), - target: path.resolve(location.getString('target')), - }), - ); + const entities = locationConfigs.map(location => { + const type = location.getString('type'); + const target = location.getString('target'); + return locationSpecToLocationEntity({ + type, + target: type === 'file' ? path.resolve(target) : target, + }); + }); await this.connection.applyMutation({ type: 'full', From 6b580d979b4d5aed9f9b167436c8b3a448af58b0 Mon Sep 17 00:00:00 2001 From: jrusso1020 Date: Tue, 27 Apr 2021 09:16:41 -0600 Subject: [PATCH 134/485] addres feedback Signed-off-by: jrusso1020 --- docs/features/software-catalog/descriptor-format.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/features/software-catalog/descriptor-format.md b/docs/features/software-catalog/descriptor-format.md index 2506e2e9c1..0dba11fd62 100644 --- a/docs/features/software-catalog/descriptor-format.md +++ b/docs/features/software-catalog/descriptor-format.md @@ -44,7 +44,7 @@ metadata: name: artist-web description: The place to be, for great artists labels: - backstage.io/custom: ValueStuff + example.com/custom: custom_label_value annotations: example.com/service-discovery: artistweb circleci.com/project-slug: github/example-org/artist-website From 826bcc46b6afebaa915d5d0da0df2803d031e2a3 Mon Sep 17 00:00:00 2001 From: Victor Perera Date: Tue, 27 Apr 2021 10:36:14 -0500 Subject: [PATCH 135/485] Issues/sugestions fixed Signed-off-by: Victor Perera victorcito001@hotmail.com Signed-off-by: Victor Perera --- .../FavouriteTemplate/FavouriteTemplate.tsx | 15 ++++-- .../ScaffolderPage/ScaffolderPage.tsx | 18 +------ .../components/TemplateCard/TemplateCard.tsx | 50 ++++++++++++------- 3 files changed, 46 insertions(+), 37 deletions(-) diff --git a/plugins/scaffolder/src/components/FavouriteTemplate/FavouriteTemplate.tsx b/plugins/scaffolder/src/components/FavouriteTemplate/FavouriteTemplate.tsx index 99f6c21a1d..ae6057beff 100644 --- a/plugins/scaffolder/src/components/FavouriteTemplate/FavouriteTemplate.tsx +++ b/plugins/scaffolder/src/components/FavouriteTemplate/FavouriteTemplate.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ -import React, { ComponentProps } from 'react'; +import React, { ComponentProps, useMemo } from 'react'; import { useStarredEntities } from '@backstage/plugin-catalog-react'; import { IconButton, makeStyles, Tooltip, withStyles } from '@material-ui/core'; import StarBorder from '@material-ui/icons/StarBorder'; @@ -29,6 +29,12 @@ const YellowStar = withStyles({ }, })(Star); +const WhiteBorderStar = withStyles({ + root: { + color: '#ffffff', + }, +})(StarBorder); + const useStyles = makeStyles(theme => ({ starButton: { position: 'absolute', @@ -42,7 +48,7 @@ export const favouriteTemplateTooltip = (isStarred: boolean) => isStarred ? 'Remove from favorites' : 'Add to favorites'; export const favouriteTemplateIcon = (isStarred: boolean) => - isStarred ? : ; + isStarred ? : ; /** * IconButton for showing if a current entity is starred and adding/removing it from the favourite entities @@ -51,7 +57,10 @@ export const favouriteTemplateIcon = (isStarred: boolean) => export const FavouriteTemplate = (props: Props) => { const classes = useStyles(); const { toggleStarredEntity, isStarredEntity } = useStarredEntities(); - const isStarred = isStarredEntity(props.entity); + const isStarred = useMemo(() => isStarredEntity(props.entity), [ + isStarredEntity, + props.entity, + ]); return ( ({ @@ -51,20 +51,6 @@ const useStyles = makeStyles(theme => ({ }, })); -const getTemplateCardProps = ( - template: TemplateEntityV1alpha1, -): TemplateCardProps & { key: string } => { - return { - key: template.metadata.uid!, - name: template.metadata.name, - title: `${(template.metadata.title || template.metadata.name) ?? ''}`, - type: template.spec.type ?? '', - description: template.metadata.description ?? '-', - tags: (template.metadata?.tags as string[]) ?? [], - entityTemplate: template, - }; -}; - export const ScaffolderPageContents = () => { const styles = useStyles(); const { @@ -189,7 +175,7 @@ export const ScaffolderPageContents = () => { {matchingEntities && matchingEntities?.length > 0 && matchingEntities.map(template => ( - + ))} diff --git a/plugins/scaffolder/src/components/TemplateCard/TemplateCard.tsx b/plugins/scaffolder/src/components/TemplateCard/TemplateCard.tsx index 2e9cfe6470..8c64d981ad 100644 --- a/plugins/scaffolder/src/components/TemplateCard/TemplateCard.tsx +++ b/plugins/scaffolder/src/components/TemplateCard/TemplateCard.tsx @@ -28,7 +28,7 @@ import { import React from 'react'; import { generatePath } from 'react-router'; import { rootRouteRef } from '../../routes'; -import { Entity } from '@backstage/catalog-model'; +import { TemplateEntityV1alpha1 } from '@backstage/catalog-model'; import { FavouriteTemplate } from '../FavouriteTemplate/FavouriteTemplate'; const useStyles = makeStyles({ @@ -48,52 +48,66 @@ const useStyles = makeStyles({ }); export type TemplateCardProps = { + template: TemplateEntityV1alpha1; +}; + +type TemplateProps = { description: string; tags: string[]; title: string; type: string; name: string; - entityTemplate: Entity; }; -export const TemplateCard = ({ - description, - tags, - title, - type, - name, - entityTemplate, -}: TemplateCardProps) => { +const getTemplateCardProps = ( + template: TemplateEntityV1alpha1, +): TemplateProps & { key: string } => { + return { + key: template.metadata.uid!, + name: template.metadata.name, + title: `${(template.metadata.title || template.metadata.name) ?? ''}`, + type: template.spec.type ?? '', + description: template.metadata.description ?? '-', + tags: (template.metadata?.tags as string[]) ?? [], + }; +}; + +export const TemplateCard = ({ template }: TemplateCardProps) => { const backstageTheme = useTheme(); const rootLink = useRouteRef(rootRouteRef); + const templateProps = getTemplateCardProps(template); - const themeId = pageTheme[type] ? type : 'other'; + const themeId = pageTheme[templateProps.type] ? templateProps.type : 'other'; const theme = backstageTheme.getPageTheme({ themeId }); const classes = useStyles({ backgroundImage: theme.backgroundImage }); const href = generatePath(`${rootLink()}/templates/:templateName`, { - templateName: name, + templateName: templateProps.name, }); return ( - + - {tags?.map(tag => ( + {templateProps.tags?.map(tag => ( ))} - {description} + {templateProps.description} - From b219821a01c1eee7bf06c989d6db9ff1bdcdf6c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20A=CC=8Ahsberg?= Date: Tue, 27 Apr 2021 15:47:40 +0000 Subject: [PATCH 136/485] Expose BitbucketRepositoryParser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathias Åhsberg --- .changeset/khaki-rice-accept.md | 5 +++++ plugins/catalog-backend/src/ingestion/processors/index.ts | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 .changeset/khaki-rice-accept.md diff --git a/.changeset/khaki-rice-accept.md b/.changeset/khaki-rice-accept.md new file mode 100644 index 0000000000..72f1c635ed --- /dev/null +++ b/.changeset/khaki-rice-accept.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend': patch +--- + +Expose `BitbucketRepositoryParser` introduced in [#5295](https://github.com/backstage/backstage/pull/5295) diff --git a/plugins/catalog-backend/src/ingestion/processors/index.ts b/plugins/catalog-backend/src/ingestion/processors/index.ts index 8aedc8889b..8d1a7967cd 100644 --- a/plugins/catalog-backend/src/ingestion/processors/index.ts +++ b/plugins/catalog-backend/src/ingestion/processors/index.ts @@ -35,3 +35,7 @@ export * from './types'; export { UrlReaderProcessor } from './UrlReaderProcessor'; export { parseEntityYaml } from './util/parse'; export { results }; + +export * from './bitbucket/types'; +export { BitbucketClient } from './bitbucket'; +export type { BitbucketRepositoryParser } from './bitbucket'; From 512889f3ca11f266786b0344900ef71ee432e4b9 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Tue, 27 Apr 2021 18:28:55 +0200 Subject: [PATCH 137/485] WIP tests for DefaultProcessingDatabase Signed-off-by: Johan Haals --- .../DefaultProcessingDatabase.test.ts | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts index f67b8603db..a5c1e56cff 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts @@ -429,4 +429,66 @@ describe('Default Processing Database', () => { ).toBeFalsy(); }); }); + + describe('updateProcessedEntity', () => { + it('should throw if the entity does not exist', async () => { + await processingDatabase.transaction(async tx => { + await expect( + processingDatabase.updateProcessedEntity(tx, { + id: '9', + processedEntity: { + apiVersion: '1.0.0', + metadata: { + name: 'new-root', + }, + kind: 'Location', + } as Entity, + deferredEntities: [], + relations: [], + }), + ).rejects.toThrow('Processing state not found for 9'); + }); + }); + + it('should update a processed entity', async () => { + await db('refresh_state').insert({ + entity_id: '123', + entity_ref: 'Component:default/wacka', + unprocessed_entity: '', + errors: '', + next_update_at: 'now()', + last_discovery_at: 'now()', + }); + + const deferredEntity = { + apiVersion: '1.0.0', + metadata: { + name: 'deferred', + }, + kind: 'Location', + } as Entity; + + await processingDatabase.transaction(async tx => { + await processingDatabase.updateProcessedEntity(tx, { + id: '123', + processedEntity: { + apiVersion: '1.0.0', + metadata: { + name: 'new-root', + }, + kind: 'Location', + } as Entity, + deferredEntities: [deferredEntity], + relations: [], + }); + }); + + console.log( + await db('refresh_state') + .where({ entity_ref: 'deferred' }) + .select(), + ); + expect(1).toBeDefined(); + }); + }); }); From 412f96edc10bccc1ccf0716f63dca1bc0dcd244b Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Tue, 27 Apr 2021 18:30:00 +0200 Subject: [PATCH 138/485] Combine stitiching queries Signed-off-by: Johan Haals --- plugins/catalog-backend/src/next/Stitcher.ts | 118 ++++++++++++++----- 1 file changed, 88 insertions(+), 30 deletions(-) diff --git a/plugins/catalog-backend/src/next/Stitcher.ts b/plugins/catalog-backend/src/next/Stitcher.ts index 57f5ae9167..04a8ab8cfc 100644 --- a/plugins/catalog-backend/src/next/Stitcher.ts +++ b/plugins/catalog-backend/src/next/Stitcher.ts @@ -26,6 +26,14 @@ import { import { Entity, parseEntityRef } from '@backstage/catalog-model'; import { createHash } from 'crypto'; import stableStringify from 'fast-json-stable-stringify'; +import { buildEntitySearch } from '../database/search'; +import { DbEntitiesSearchRow } from '../database/types'; + +// The number of items that are sent per batch to the database layer, when +// doing .batchInsert calls to knex. This needs to be low enough to not cause +// errors in the underlying engine due to exceeding query limits, but large +// enough to get the speed benefits. +const BATCH_SIZE = 50; export type DbFinalEntitiesRow = { entity_id: string; @@ -49,64 +57,114 @@ export class Stitcher { for (const entityRef of entityRefs) { await this.transaction(async txOpaque => { const tx = txOpaque as Knex.Transaction; - const [result] = await tx('refresh_state') - .select('entity_id', 'processed_entity') - .where({ entity_ref: entityRef }); - if (!result) { + const result: Array<{ + entityId: string; + processedEntity?: string; + errors: string; + incomingReferenceCount: string | number; + previousEtag?: string; + relationType?: string; + relationTarget?: string; + }> = await tx + .with('incoming_references', function incomingReferences(builder) { + return builder + .from('refresh_state_references') + .where({ target_entity_ref: entityRef }) + .count({ count: '*' }); + }) + .select({ + entityId: 'refresh_state.entity_id', + processedEntity: 'refresh_state.processed_entity', + errors: 'refresh_state.errors', + incomingReferenceCount: 'incoming_references.count', + previousEtag: 'final_entities.etag', + relationType: 'relations.type', + relationTarget: 'relations.target_entity_ref', + }) + .from('refresh_state') + .leftJoin('incoming_references', {}) + .leftOuterJoin('final_entities', { + 'final_entities.entity_id': 'refresh_state.entity_id', + }) + .leftOuterJoin('relations', { + 'relations.source_entity_ref': 'refresh_state.entity_ref', + }) + .where({ 'refresh_state.entity_ref': entityRef }); + + if (!result.length) { this.logger.debug( `Unable to stitch ${entityRef}, item does not exist in refresh state table`, ); return; - } else if (!result.processed_entity) { + } + + const { + entityId, + processedEntity, + errors, + incomingReferenceCount, + previousEtag, + } = result[0]; + + if (!processedEntity) { this.logger.debug( `Unable to stitch ${entityRef}, the entity has not yet been processed`, ); return; } - const entity: Entity = JSON.parse(result.processed_entity); + const entity = JSON.parse(processedEntity) as Entity; + const isOrphan = Number(incomingReferenceCount) === 0; - const entityId = entity?.metadata?.uid; - if (!entityId) { - this.logger.error(`missing ID in entity ${JSON.stringify(entity)}`); - return; - } - - const [reference_count_result] = await tx( - 'refresh_state_references', - ) - .where({ target_entity_ref: entityRef }) - .count({ reference_count: 'target_entity_ref' }); - - if (Number(reference_count_result.reference_count) === 0) { - this.logger.debug(`${entityRef} is orphan`); + if (isOrphan) { + this.logger.debug(`${entityRef} is an orphan`); entity.metadata.annotations = { ...entity.metadata.annotations, ['backstage.io/orphan']: 'true', }; } - const relationResults = await tx('relations') - .where({ source_entity_ref: entityRef }) - .select(); - - // TODO: entityRef is lower case and should be uppercase in the final result. - entity.relations = relationResults.map(relation => ({ - type: relation.type, - target: parseEntityRef(relation.target_entity_ref), - })); + // TODO: entityRef is lower case and should be uppercase in the final result + entity.relations = result + .filter(row => row.relationType) + .map(row => ({ + type: row.relationType!, + target: parseEntityRef(row.relationTarget!), + })); entity.metadata.generation = 1; + + // If the output entity was actually not changed, just abort const etag = generateEntityEtag(entity); + if (etag === previousEtag) { + console.log(`Skipped stitching of ${entityRef}, no changes`); + return; + } + entity.metadata.etag = etag; + await tx('final_entities') .insert({ - finalized_entity: JSON.stringify(entity), entity_id: entityId, + finalized_entity: JSON.stringify(entity), etag, }) .onConflict('entity_id') .merge(['finalized_entity', 'etag']); + + try { + const entries = buildEntitySearch(entityId, entity); + await tx('search') + .where({ entity_id: entityId }) + .delete(); + await tx.batchInsert('search', entries, BATCH_SIZE); + } catch (e) { + this.logger.debug( + `Failed to write search entries for ${entityId}`, + e, + ); + // intentionally ignored + } }); } } From 20346793a20e32299e88858c636985cd4836236d Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Tue, 27 Apr 2021 18:30:22 +0200 Subject: [PATCH 139/485] Create search table Signed-off-by: Johan Haals --- .../20210302150147_refresh_state.js | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js index 2afeda02c0..755a645894 100644 --- a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js +++ b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js @@ -154,6 +154,28 @@ exports.up = async function up(knex) { table.index('source_entity_ref', 'relations_source_entity_ref_idx'); table.index('originating_entity_id', 'relations_source_entity_id_idx'); }); + + await knex.schema.createTable('search', table => { + table.comment( + 'Flattened key-values from the entities, used for quick filtering', + ); + table + .uuid('entity_id') + .references('entity_id') + .inTable('refresh_state') + .onDelete('CASCADE') + .comment('The entity that matches this key/value'); + table + .string('key') + .notNullable() + .comment('A key that occurs in the entity'); + table + .string('value') + .nullable() + .comment('The corresponding value to match on'); + table.index(['key'], 'search_key_idx'); + table.index(['value'], 'search_value_idx'); + }); }; /** @@ -177,6 +199,12 @@ exports.down = async function down(knex) { table.index('source_entity_ref', 'relations_source_entity_ref_idx'); table.index('originating_entity_id', 'relations_source_entity_id_idx'); }); + await knex.schema.alterTable('search', table => { + table.dropIndex([], 'search_key_idx'); + table.dropIndex([], 'search_value_idx'); + }); + + await knex.schema.dropTable('search'); await knex.schema.dropTable('final_entities'); await knex.schema.dropTable('relations'); await knex.schema.dropTable('references'); From 1a3ce09aee63fa19714f149d73b3985a960fc43c Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 27 Apr 2021 21:23:35 +0200 Subject: [PATCH 140/485] chore(tests): Added some more tests for DefaultLocationStore and fixing migration so it will run properly on PG Signed-off-by: blam --- .../20210302150147_refresh_state.js | 2 +- .../src/next/DefaultLocationStore.test.ts | 146 ++++++++++++++++++ .../src/next/DefaultLocationStore.ts | 26 ++-- 3 files changed, 161 insertions(+), 13 deletions(-) create mode 100644 plugins/catalog-backend/src/next/DefaultLocationStore.test.ts diff --git a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js index 755a645894..bbaf4820cd 100644 --- a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js +++ b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js @@ -160,7 +160,7 @@ exports.up = async function up(knex) { 'Flattened key-values from the entities, used for quick filtering', ); table - .uuid('entity_id') + .text('entity_id') .references('entity_id') .inTable('refresh_state') .onDelete('CASCADE') diff --git a/plugins/catalog-backend/src/next/DefaultLocationStore.test.ts b/plugins/catalog-backend/src/next/DefaultLocationStore.test.ts new file mode 100644 index 0000000000..be20179e9a --- /dev/null +++ b/plugins/catalog-backend/src/next/DefaultLocationStore.test.ts @@ -0,0 +1,146 @@ +/* + * 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 { DatabaseManager } from './database/DatabaseManager'; +import { DefaultLocationStore } from './DefaultLocationStore'; +import { v4 } from 'uuid'; + +describe('Default Location Store', () => { + const createLocationStore = async () => { + const db = await DatabaseManager.createTestDatabase(); + const connection = { applyMutation: jest.fn() }; + const store = new DefaultLocationStore(db); + await store.connect(connection); + return { store, connection }; + }; + + it('should do a full sync with the locations on connect', async () => { + const { connection } = await createLocationStore(); + + expect(connection.applyMutation).toHaveBeenCalledWith({ + type: 'full', + entities: [], + }); + }); + + describe('listLocations', () => { + it('lists empty locations when there is no locations', async () => { + const { store } = await createLocationStore(); + + expect(await store.listLocations()).toEqual([]); + }); + + it('lists locations that are added to the db', async () => { + const { store } = await createLocationStore(); + + await store.createLocation({ + target: + 'https://github.com/backstage/demo/blob/master/catalog-info.yml', + type: 'url', + }); + + const listLocations = await store.listLocations(); + + expect(listLocations).toHaveLength(1); + expect(listLocations).toEqual( + expect.arrayContaining([ + expect.objectContaining({ + target: + 'https://github.com/backstage/demo/blob/master/catalog-info.yml', + type: 'url', + }), + ]), + ); + }); + }); + + describe('createLocation', () => { + it('throws when the location already exists', async () => { + const { store } = await createLocationStore(); + const spec = { + target: + 'https://github.com/backstage/demo/blob/master/catalog-info.yml', + type: 'url', + }; + await store.createLocation(spec); + + await expect(() => store.createLocation(spec)).rejects.toThrow( + new RegExp(`Location ${spec.type}:${spec.target} already exists`), + ); + }); + + it('calls apply mutation when adding a new location', async () => { + const { store, connection } = await createLocationStore(); + + await store.createLocation({ + target: + 'https://github.com/backstage/demo/blob/master/catalog-info.yml', + type: 'url', + }); + + expect(connection.applyMutation).toHaveBeenCalledWith({ + type: 'delta', + removed: [], + added: expect.arrayContaining([ + expect.objectContaining({ + spec: { + target: + 'https://github.com/backstage/demo/blob/master/catalog-info.yml', + type: 'url', + }, + }), + ]), + }); + }); + }); + + describe('deleteLocation', () => { + it('throws if the location does not exist', async () => { + const { store } = await createLocationStore(); + + const id = v4(); + + await expect(() => store.deleteLocation(id)).rejects.toThrow( + new RegExp(`Found no location with ID ${id}`), + ); + }); + + it('calls apply mutation when adding a new location', async () => { + const { store, connection } = await createLocationStore(); + + const location = await store.createLocation({ + target: + 'https://github.com/backstage/demo/blob/master/catalog-info.yml', + type: 'url', + }); + + await store.deleteLocation(location.id); + + expect(connection.applyMutation).toHaveBeenCalledWith({ + type: 'delta', + added: [], + removed: expect.arrayContaining([ + expect.objectContaining({ + spec: { + target: + 'https://github.com/backstage/demo/blob/master/catalog-info.yml', + type: 'url', + }, + }), + ]), + }); + }); + }); +}); diff --git a/plugins/catalog-backend/src/next/DefaultLocationStore.ts b/plugins/catalog-backend/src/next/DefaultLocationStore.ts index a56e5d1585..28db3790b6 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationStore.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationStore.ts @@ -34,10 +34,8 @@ export class DefaultLocationStore implements LocationStore, EntityProvider { return 'DefaultLocationStore'; } - createLocation(spec: LocationSpec): Promise { + async createLocation(spec: LocationSpec): Promise { return this.db.transaction(async tx => { - // TODO: id should really be type and target combined and not a uuid. - // Attempt to find a previous location matching the spec const previousLocations = await this.listLocations(); const previousLocation = previousLocations.some( @@ -50,6 +48,7 @@ export class DefaultLocationStore implements LocationStore, EntityProvider { ); } + // TODO: id should really be type and target combined and not a uuid. const location = await this.db.addLocation(tx, { id: uuidv4(), type: spec.type, @@ -68,11 +67,17 @@ export class DefaultLocationStore implements LocationStore, EntityProvider { async listLocations(): Promise { const dbLocations = await this.db.locations(); - return dbLocations.map(item => ({ - id: item.id, - target: item.target, - type: item.type, - })); + return ( + dbLocations + // TODO(blam): We should create a mutation to remove this location for everyone + // eventually when it's all done and dusted + .filter(({ type }) => type !== 'bootstrap') + .map(item => ({ + id: item.id, + target: item.target, + type: item.type, + })) + ); } getLocation(id: string): Promise { @@ -86,9 +91,6 @@ export class DefaultLocationStore implements LocationStore, EntityProvider { return this.db.transaction(async tx => { const location = await this.db.location(id); - if (!location) { - throw new ConflictError(`No location found with id: ${id}`); - } await this.db.removeLocation(tx, id); await this.connection.applyMutation({ type: 'delta', @@ -108,7 +110,7 @@ export class DefaultLocationStore implements LocationStore, EntityProvider { async connect(connection: EntityProviderConnection): Promise { this._connection = connection; - const locations = await this.db.locations(); + const locations = await this.listLocations(); const entities = locations.map(location => { return locationSpecToLocationEntity(location); }); From 0aff8985d1fd437cd26ded862912e3cdfce61f56 Mon Sep 17 00:00:00 2001 From: azhurbilo Date: Thu, 22 Apr 2021 21:31:42 +0300 Subject: [PATCH 141/485] ability to disable postgres CA mount Signed-off-by: azhurbilo --- contrib/chart/backstage/README.md | 10 ++++++++++ contrib/chart/backstage/templates/_helpers.tpl | 2 +- .../backstage/templates/backend-deployment.yaml | 4 ++-- .../templates/lighthouse-deployment.yaml | 4 ++++ .../postgresql-password-backend-secret.yaml | 15 --------------- contrib/chart/backstage/values.yaml | 2 ++ 6 files changed, 19 insertions(+), 18 deletions(-) diff --git a/contrib/chart/backstage/README.md b/contrib/chart/backstage/README.md index 7d04a2cf1e..40bb2666bc 100644 --- a/contrib/chart/backstage/README.md +++ b/contrib/chart/backstage/README.md @@ -129,6 +129,16 @@ For the CA, create a `configMap` named `--postgres-ca` kubectl create configmap my-company-backstage-postgres-ca --from-file=ca.crt" ``` +or disable CA mount + +```yaml +backend: + postgresCertMountEnabled: false + +lighthouse: + postgresCertMountEnabled: false +``` + > Where the release name contains the chart name "backstage" then only the release name will be used. Now install the helm chart: diff --git a/contrib/chart/backstage/templates/_helpers.tpl b/contrib/chart/backstage/templates/_helpers.tpl index 5d49ba6975..123d4dba5b 100644 --- a/contrib/chart/backstage/templates/_helpers.tpl +++ b/contrib/chart/backstage/templates/_helpers.tpl @@ -214,7 +214,7 @@ Postgres port for the backend {{- .Values.postgresql.service.port }} {{- else if .Values.appConfig.backend.database.connection.port -}} {{- .Values.appConfig.backend.database.connection.port }} -{{ else }} +{{- else -}} 5432 {{- end -}} {{- end -}} diff --git a/contrib/chart/backstage/templates/backend-deployment.yaml b/contrib/chart/backstage/templates/backend-deployment.yaml index 7009a22de0..4059ee3cc9 100644 --- a/contrib/chart/backstage/templates/backend-deployment.yaml +++ b/contrib/chart/backstage/templates/backend-deployment.yaml @@ -49,7 +49,7 @@ spec: name: {{ include "backend.postgresql.passwordSecret" .}} key: postgresql-password volumeMounts: - {{- if .Values.postgresql.enabled }} + {{- if .Values.backend.postgresCertMountEnabled }} - name: postgres-ca mountPath: {{ include "backstage.backend.postgresCaDir" . }} {{- end }} @@ -58,7 +58,7 @@ spec: subPath: {{ include "backstage.appConfigFilename" . }} volumes: - {{- if .Values.postgresql.enabled }} + {{- if .Values.backend.postgresCertMountEnabled }} - name: postgres-ca configMap: name: {{ include "backstage.fullname" . }}-postgres-ca diff --git a/contrib/chart/backstage/templates/lighthouse-deployment.yaml b/contrib/chart/backstage/templates/lighthouse-deployment.yaml index 6104d4e73c..849c48d7a6 100644 --- a/contrib/chart/backstage/templates/lighthouse-deployment.yaml +++ b/contrib/chart/backstage/templates/lighthouse-deployment.yaml @@ -51,14 +51,18 @@ spec: name: {{ include "lighthouse.postgresql.passwordSecret" . }} key: postgresql-password + {{- if .Values.lighthouse.postgresCertMountEnabled }} volumeMounts: - name: postgres-ca mountPath: {{ include "backstage.lighthouse.postgresCaDir" . }} + {{- end }} + {{- if .Values.lighthouse.postgresCertMountEnabled }} volumes: - name: postgres-ca configMap: name: {{ include "backstage.fullname" . }}-postgres-ca + {{- end }} {{- if .Values.global.nodeSelector }} nodeSelector: {{- toYaml .Values.global.nodeSelector | nindent 8 }} diff --git a/contrib/chart/backstage/templates/postgresql-password-backend-secret.yaml b/contrib/chart/backstage/templates/postgresql-password-backend-secret.yaml index e53369adb9..a71cef7b21 100644 --- a/contrib/chart/backstage/templates/postgresql-password-backend-secret.yaml +++ b/contrib/chart/backstage/templates/postgresql-password-backend-secret.yaml @@ -13,18 +13,3 @@ metadata: data: postgresql-password: {{ .Values.appConfig.backend.database.connection.password | b64enc }} {{- end }} -{{- if not .Values.postgresql.enabled }} ---- -apiVersion: v1 -kind: Secret -type: Opaque -metadata: - name: {{ include "lighthouse.postgresql.passwordSecret" . }} - labels: - release: {{ .Release.Name }} - annotations: - "helm.sh/hook": "pre-install,pre-upgrade" - "helm.sh/hook-delete-policy": "before-hook-creation" -data: - postgresql-password: {{ .Values.lighthouse.database.connection.password | b64enc }} -{{- end }} diff --git a/contrib/chart/backstage/values.yaml b/contrib/chart/backstage/values.yaml index e21148b04b..645de91313 100644 --- a/contrib/chart/backstage/values.yaml +++ b/contrib/chart/backstage/values.yaml @@ -28,6 +28,7 @@ backend: pullPolicy: IfNotPresent containerPort: 7000 serviceType: ClusterIP + postgresCertMountEnabled: true resources: requests: memory: 512Mi @@ -43,6 +44,7 @@ lighthouse: pullPolicy: IfNotPresent containerPort: 3003 serviceType: ClusterIP + postgresCertMountEnabled: true resources: requests: memory: 128Mi From 0265764749ed726e6a040593489ecb4726e0911b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Apr 2021 04:19:31 +0000 Subject: [PATCH 142/485] chore(deps): bump eslint-plugin-jest from 24.1.5 to 24.3.6 Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 24.1.5 to 24.3.6. - [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases) - [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v24.1.5...v24.3.6) Signed-off-by: dependabot[bot] --- yarn.lock | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/yarn.lock b/yarn.lock index b21e2a9bf5..230ff83c19 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12518,9 +12518,9 @@ eslint-plugin-import@^2.20.2: tsconfig-paths "^3.9.0" eslint-plugin-jest@^24.1.0: - version "24.1.5" - resolved "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-24.1.5.tgz#1e866a9f0deac587d0a3d5d7cefe99815a580de2" - integrity sha512-FIP3lwC8EzEG+rOs1y96cOJmMVpdFNreoDJv29B5vIupVssRi8zrSY3QadogT0K3h1Y8TMxJ6ZSAzYUmFCp2hg== + version "24.3.6" + resolved "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-24.3.6.tgz#5f0ca019183c3188c5ad3af8e80b41de6c8e9173" + integrity sha512-WOVH4TIaBLIeCX576rLcOgjNXqP+jNlCiEmRgFTfQtJ52DpwnIQKAVGlGPAN7CZ33bW6eNfHD6s8ZbEUTQubJg== dependencies: "@typescript-eslint/experimental-utils" "^4.0.1" @@ -23538,7 +23538,7 @@ semver@7.0.0: resolved "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== -semver@7.x, semver@^7.0.0, semver@^7.1.1, semver@^7.1.3, semver@^7.2.1, semver@^7.3.2, semver@^7.3.4: +semver@7.x, semver@^7.0.0, semver@^7.1.1, semver@^7.1.3, semver@^7.2.1, semver@^7.3.2, semver@^7.3.4, semver@~7.3.0: version "7.3.5" resolved "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== @@ -23555,13 +23555,6 @@ semver@~5.3.0: resolved "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" integrity sha1-myzl094C0XxgEq0yaqa00M9U+U8= -semver@~7.3.0: - version "7.3.5" - resolved "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" - integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== - dependencies: - lru-cache "^6.0.0" - send@0.17.1: version "0.17.1" resolved "https://registry.npmjs.org/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8" From d49c94f2f7c5485da0aedff54ac2b4c5616a5795 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Apr 2021 04:22:54 +0000 Subject: [PATCH 143/485] chore(deps): bump core-js from 3.8.3 to 3.11.0 Bumps [core-js](https://github.com/zloirock/core-js/tree/HEAD/packages/core-js) from 3.8.3 to 3.11.0. - [Release notes](https://github.com/zloirock/core-js/releases) - [Changelog](https://github.com/zloirock/core-js/blob/master/CHANGELOG.md) - [Commits](https://github.com/zloirock/core-js/commits/v3.11.0/packages/core-js) Signed-off-by: dependabot[bot] --- yarn.lock | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/yarn.lock b/yarn.lock index b21e2a9bf5..19aff83248 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10451,9 +10451,9 @@ core-js-pure@^3.0.0, core-js-pure@^3.0.1: integrity sha512-epIhRLkXdgv32xIUFaaAry2wdxZYBi6bgM7cB136dzzXXa+dFyRLTZeLUJxnd8ShrmyVXBub63n2NHo2JAt8Cw== core-js@3, core-js@^3.0.1, core-js@^3.0.4, core-js@^3.5.0, core-js@^3.6.0, core-js@^3.6.5: - version "3.8.3" - resolved "https://registry.npmjs.org/core-js/-/core-js-3.8.3.tgz#c21906e1f14f3689f93abcc6e26883550dd92dd0" - integrity sha512-KPYXeVZYemC2TkNEkX/01I+7yd+nX3KddKwZ1Ww7SKWdI2wQprSgLmrTddT8nw92AjEklTsPBoSdQBhbI1bQ6Q== + version "3.11.0" + resolved "https://registry.npmjs.org/core-js/-/core-js-3.11.0.tgz#05dac6aa70c0a4ad842261f8957b961d36eb8926" + integrity sha512-bd79DPpx+1Ilh9+30aT5O1sgpQd4Ttg8oqkqi51ZzhedMM1omD2e6IOF48Z/DzDCZ2svp49tN/3vneTK6ZBkXw== core-js@^2.4.0, core-js@^2.5.7, core-js@^2.6.10, core-js@^2.6.5: version "2.6.11" @@ -23538,7 +23538,7 @@ semver@7.0.0: resolved "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== -semver@7.x, semver@^7.0.0, semver@^7.1.1, semver@^7.1.3, semver@^7.2.1, semver@^7.3.2, semver@^7.3.4: +semver@7.x, semver@^7.0.0, semver@^7.1.1, semver@^7.1.3, semver@^7.2.1, semver@^7.3.2, semver@^7.3.4, semver@~7.3.0: version "7.3.5" resolved "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== @@ -23555,13 +23555,6 @@ semver@~5.3.0: resolved "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" integrity sha1-myzl094C0XxgEq0yaqa00M9U+U8= -semver@~7.3.0: - version "7.3.5" - resolved "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" - integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== - dependencies: - lru-cache "^6.0.0" - send@0.17.1: version "0.17.1" resolved "https://registry.npmjs.org/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8" From c04403f6195cfebd1e0b99e2525965d149a2a68c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Apr 2021 04:26:55 +0000 Subject: [PATCH 144/485] chore(deps): bump json-schema from 0.2.5 to 0.3.0 Bumps [json-schema](https://github.com/kriszyp/json-schema) from 0.2.5 to 0.3.0. - [Release notes](https://github.com/kriszyp/json-schema/releases) - [Commits](https://github.com/kriszyp/json-schema/compare/v0.2.5...v0.3.0) Signed-off-by: dependabot[bot] --- packages/catalog-model/package.json | 2 +- packages/cli/package.json | 2 +- packages/config-loader/package.json | 2 +- plugins/scaffolder/package.json | 2 +- yarn.lock | 17 +++++------------ 5 files changed, 9 insertions(+), 16 deletions(-) diff --git a/packages/catalog-model/package.json b/packages/catalog-model/package.json index 64550b35d1..941877aec5 100644 --- a/packages/catalog-model/package.json +++ b/packages/catalog-model/package.json @@ -33,7 +33,7 @@ "@types/json-schema": "^7.0.5", "@types/yup": "^0.29.8", "ajv": "^7.0.3", - "json-schema": "^0.2.5", + "json-schema": "^0.3.0", "lodash": "^4.17.15", "uuid": "^8.0.0", "yup": "^0.29.3" diff --git a/packages/cli/package.json b/packages/cli/package.json index cd61193efe..1110efefe6 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -82,7 +82,7 @@ "inquirer": "^7.0.4", "jest": "^26.0.1", "jest-css-modules": "^2.1.0", - "json-schema": "^0.2.5", + "json-schema": "^0.3.0", "lodash": "^4.17.19", "mini-css-extract-plugin": "^0.9.0", "ora": "^5.3.0", diff --git a/packages/config-loader/package.json b/packages/config-loader/package.json index 0a0a76c2d6..55d86314af 100644 --- a/packages/config-loader/package.json +++ b/packages/config-loader/package.json @@ -35,7 +35,7 @@ "@types/json-schema": "^7.0.6", "ajv": "^7.0.3", "fs-extra": "^9.0.0", - "json-schema": "^0.2.5", + "json-schema": "^0.3.0", "json-schema-merge-allof": "^0.7.0", "typescript-json-schema": "^0.49.0", "yaml": "^1.9.2", diff --git a/plugins/scaffolder/package.json b/plugins/scaffolder/package.json index 2b4feecb7b..8af5339a0f 100644 --- a/plugins/scaffolder/package.json +++ b/plugins/scaffolder/package.json @@ -44,7 +44,7 @@ "@rjsf/core": "^2.4.0", "@rjsf/material-ui": "^2.4.0", "classnames": "^2.2.6", - "json-schema": "^0.2.5", + "json-schema": "^0.3.0", "git-url-parse": "^11.4.4", "humanize-duration": "^3.25.1", "immer": "^9.0.1", diff --git a/yarn.lock b/yarn.lock index b21e2a9bf5..6076e21713 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16965,10 +16965,10 @@ json-schema@0.2.3: resolved "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= -json-schema@^0.2.5: - version "0.2.5" - resolved "https://registry.npmjs.org/json-schema/-/json-schema-0.2.5.tgz#97997f50972dd0500214e208c407efa4b5d7063b" - integrity sha512-gWJOWYFrhQ8j7pVm0EM8Slr+EPVq1Phf6lvzvD/WCeqkrx/f2xBI0xOsRRS9xCn3I4vKtP519dvs3TP09r24wQ== +json-schema@^0.3.0: + version "0.3.0" + resolved "https://registry.npmjs.org/json-schema/-/json-schema-0.3.0.tgz#90a9c5054bd065422c00241851ce8d59475b701b" + integrity sha512-TYfxx36xfl52Rf1LU9HyWSLGPdYLL+SQ8/E/0yVyKG8wCCDaSrhPap0vEdlsZWRaS6tnKKLPGiEJGiREVC8kxQ== json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" @@ -23538,7 +23538,7 @@ semver@7.0.0: resolved "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== -semver@7.x, semver@^7.0.0, semver@^7.1.1, semver@^7.1.3, semver@^7.2.1, semver@^7.3.2, semver@^7.3.4: +semver@7.x, semver@^7.0.0, semver@^7.1.1, semver@^7.1.3, semver@^7.2.1, semver@^7.3.2, semver@^7.3.4, semver@~7.3.0: version "7.3.5" resolved "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== @@ -23555,13 +23555,6 @@ semver@~5.3.0: resolved "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" integrity sha1-myzl094C0XxgEq0yaqa00M9U+U8= -semver@~7.3.0: - version "7.3.5" - resolved "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" - integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== - dependencies: - lru-cache "^6.0.0" - send@0.17.1: version "0.17.1" resolved "https://registry.npmjs.org/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8" From da546ce005ab90240a0fec4c2969826e7cfb1d38 Mon Sep 17 00:00:00 2001 From: Oliver Sand Date: Wed, 28 Apr 2021 09:12:15 +0200 Subject: [PATCH 145/485] Support `gridItem` variant for `EntityLinksCard` This makes it similar to other cards. Signed-off-by: Oliver Sand --- .changeset/small-snakes-shake.md | 5 +++++ .../src/components/EntityLinksCard/EntityLinksCard.tsx | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/small-snakes-shake.md diff --git a/.changeset/small-snakes-shake.md b/.changeset/small-snakes-shake.md new file mode 100644 index 0000000000..6db9db3754 --- /dev/null +++ b/.changeset/small-snakes-shake.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog': patch +--- + +Support `gridItem` variant for `EntityLinksCard`. diff --git a/plugins/catalog/src/components/EntityLinksCard/EntityLinksCard.tsx b/plugins/catalog/src/components/EntityLinksCard/EntityLinksCard.tsx index f7e558e285..59de0a4587 100644 --- a/plugins/catalog/src/components/EntityLinksCard/EntityLinksCard.tsx +++ b/plugins/catalog/src/components/EntityLinksCard/EntityLinksCard.tsx @@ -27,9 +27,10 @@ type Props = { /** @deprecated The entity is now grabbed from context instead */ entity?: Entity; cols?: ColumnBreakpoints | number; + variant?: 'gridItem'; }; -export const EntityLinksCard = ({ cols = undefined }: Props) => { +export const EntityLinksCard = ({ cols = undefined, variant }: Props) => { const { entity } = useEntity(); const app = useApp(); @@ -39,7 +40,7 @@ export const EntityLinksCard = ({ cols = undefined }: Props) => { const links = entity?.metadata?.links; return ( - + {!links || links.length === 0 ? ( ) : ( From f7167e9aacd2ec721c1998896f12694c1f7b8917 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Wed, 28 Apr 2021 09:18:35 +0200 Subject: [PATCH 146/485] Update processed entity tests Signed-off-by: Johan Haals --- .../DefaultProcessingDatabase.test.ts | 45 ++++++++++++++----- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts index a5c1e56cff..d76bd74260 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts @@ -19,10 +19,11 @@ import { Knex } from 'knex'; import { DbRefreshStateReferencesRow, DbRefreshStateRow, + DbRelationsRow, DefaultProcessingDatabase, } from './DefaultProcessingDatabase'; -import { Entity } from '@backstage/catalog-model'; +import { Entity, EntityRelationSpec } from '@backstage/catalog-model'; import * as uuid from 'uuid'; import { getVoidLogger } from '@backstage/backend-common'; @@ -452,8 +453,8 @@ describe('Default Processing Database', () => { it('should update a processed entity', async () => { await db('refresh_state').insert({ - entity_id: '123', - entity_ref: 'Component:default/wacka', + entity_id: '321', + entity_ref: 'location:default/new-root', unprocessed_entity: '', errors: '', next_update_at: 'now()', @@ -468,9 +469,23 @@ describe('Default Processing Database', () => { kind: 'Location', } as Entity; + const relation: EntityRelationSpec = { + source: { + kind: 'Component', + namespace: 'Default', + name: 'foo', + }, + target: { + kind: 'Component', + namespace: 'Default', + name: 'foo', + }, + type: 'url', + }; + await processingDatabase.transaction(async tx => { await processingDatabase.updateProcessedEntity(tx, { - id: '123', + id: '321', processedEntity: { apiVersion: '1.0.0', metadata: { @@ -479,16 +494,24 @@ describe('Default Processing Database', () => { kind: 'Location', } as Entity, deferredEntities: [deferredEntity], - relations: [], + relations: [relation], }); }); - console.log( - await db('refresh_state') - .where({ entity_ref: 'deferred' }) - .select(), - ); - expect(1).toBeDefined(); + const deferredResult = await db('refresh_state') + .where({ entity_ref: 'location:default/deferred' }) + .select(); + expect(deferredResult.length).toBe(1); + + const [relations] = await db('relations') + .where({ originating_entity_id: '321' }) + .select(); + expect(relations).toEqual({ + originating_entity_id: '321', + source_entity_ref: 'component:default/foo', + type: 'url', + target_entity_ref: 'component:default/foo', + }); }); }); }); From 17b8da50a959a0c452a457f4207328d8ae1ca98a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 28 Apr 2021 09:18:36 +0200 Subject: [PATCH 147/485] update the stitcher including search MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .../20210302150147_refresh_state.js | 7 +- .../catalog-backend/src/next/Stitcher.test.ts | 205 ++++++++++++++++++ plugins/catalog-backend/src/next/Stitcher.ts | 59 ++--- .../catalog-backend/src/next/search.test.ts | 160 ++++++++++++++ plugins/catalog-backend/src/next/search.ts | 191 ++++++++++++++++ plugins/catalog-backend/src/next/types.ts | 1 + 6 files changed, 592 insertions(+), 31 deletions(-) create mode 100644 plugins/catalog-backend/src/next/Stitcher.test.ts create mode 100644 plugins/catalog-backend/src/next/search.test.ts create mode 100644 plugins/catalog-backend/src/next/search.ts diff --git a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js index bbaf4820cd..4d2c30f194 100644 --- a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js +++ b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js @@ -33,7 +33,6 @@ exports.up = async function up(knex) { ); table .text('entity_ref') - .unique() .notNullable() .comment('A reference to the entity that the refresh state is tied to'); table @@ -59,13 +58,14 @@ exports.up = async function up(knex) { .notNullable() .comment('JSON array containing all errors related to entity'); table - .dateTime('next_update_at') // TOOD: timezone or change to epoch-millis or similar + .dateTime('next_update_at') // TODO: timezone or change to epoch-millis or similar .notNullable() .comment('Timestamp of when entity should be updated'); table - .dateTime('last_discovery_at') // TOOD: timezone or change to epoch-millis or similar + .dateTime('last_discovery_at') // TODO: timezone or change to epoch-millis or similar .notNullable() .comment('The last timestamp of which this entity was discovered'); + table.unique(['entity_ref'], 'refresh_state_entity_ref_uniq'); table.index('entity_id', 'refresh_state_entity_id_idx'); table.index('entity_ref', 'refresh_state_entity_ref_idx'); table.index('next_update_at', 'refresh_state_next_update_at_idx'); @@ -188,6 +188,7 @@ exports.down = async function down(knex) { table.dropIndex([], 'refresh_state_references_target_entity_id_idx'); }); await knex.schema.alterTable('refresh_state', table => { + table.dropUnique([], 'refresh_state_entity_ref_uniq'); table.dropIndex([], 'refresh_state_entity_id_idx'); table.dropIndex([], 'refresh_state_entity_ref_idx'); table.dropIndex([], 'refresh_state_next_update_at_idx'); diff --git a/plugins/catalog-backend/src/next/Stitcher.test.ts b/plugins/catalog-backend/src/next/Stitcher.test.ts new file mode 100644 index 0000000000..327d922c07 --- /dev/null +++ b/plugins/catalog-backend/src/next/Stitcher.test.ts @@ -0,0 +1,205 @@ +/* + * 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 { getVoidLogger } from '@backstage/backend-common'; +import { Knex } from 'knex'; +import { DatabaseManager } from './database/DatabaseManager'; +import { + DbRefreshStateReferencesRow, + DbRefreshStateRow, + DbRelationsRow, +} from './database/DefaultProcessingDatabase'; +import { DbSearchRow } from './search'; +import { DbFinalEntitiesRow, Stitcher } from './Stitcher'; + +describe('Stitcher', () => { + let db: Knex; + const logger = getVoidLogger(); + + beforeEach(async () => { + db = await DatabaseManager.createTestDatabaseConnection(); + await DatabaseManager.createDatabase(db); + }); + + it('runs the happy path', async () => { + const stitcher = new Stitcher(db, logger); + + await db.transaction(async tx => { + await tx('refresh_state').insert([ + { + entity_id: 'my-id', + entity_ref: 'k:ns/n', + unprocessed_entity: JSON.stringify({}), + processed_entity: JSON.stringify({ + apiVersion: 'a', + kind: 'k', + metadata: { + name: 'n', + namespace: 'ns', + }, + spec: { + k: 'v', + }, + }), + errors: '[]', + next_update_at: tx.fn.now(), + last_discovery_at: tx.fn.now(), + }, + ]); + await tx('refresh_state_references').insert([ + { source_key: 'a', target_entity_ref: 'k:ns/n' }, + ]); + await tx('relations').insert([ + { + originating_entity_id: 'my-id', + source_entity_ref: 'k:ns/n', + type: 'looksAt', + target_entity_ref: 'k:ns/other', + }, + ]); + }); + + await stitcher.stitch(new Set(['k:ns/n'])); + + let firstEtag: string; + await db.transaction(async tx => { + const entities = await tx('final_entities'); + + expect(entities.length).toBe(1); + const entity = JSON.parse(entities[0].finalized_entity); + expect(entity).toEqual({ + relations: [ + { + type: 'looksAt', + target: { + kind: 'k', + namespace: 'ns', + name: 'other', + }, + }, + ], + apiVersion: 'a', + kind: 'k', + metadata: { + name: 'n', + namespace: 'ns', + etag: expect.any(String), + generation: 1, + uid: 'my-id', + }, + spec: { + k: 'v', + }, + }); + + firstEtag = entity.metadata.etag; + + const search = await tx('search'); + expect(search).toEqual( + expect.arrayContaining([ + { entity_id: 'my-id', key: 'relations', value: 'looksat:k:ns/other' }, + { entity_id: 'my-id', key: 'apiversion', value: 'a' }, + { entity_id: 'my-id', key: 'kind', value: 'k' }, + { entity_id: 'my-id', key: 'metadata.name', value: 'n' }, + { entity_id: 'my-id', key: 'metadata.namespace', value: 'ns' }, + { entity_id: 'my-id', key: 'metadata.uid', value: 'my-id' }, + { entity_id: 'my-id', key: 'spec.k', value: 'v' }, + ]), + ); + }); + + // Re-stitch without any changes + await stitcher.stitch(new Set(['k:ns/n'])); + + await db.transaction(async tx => { + const entities = await tx('final_entities'); + expect(entities.length).toBe(1); + const entity = JSON.parse(entities[0].finalized_entity); + expect(entities[0].etag).toEqual(firstEtag); + expect(entity.metadata.etag).toEqual(firstEtag); + }); + + // Now add one more relation and re-stitch + await db.transaction(async tx => { + await tx('relations').insert([ + { + originating_entity_id: 'my-id', + source_entity_ref: 'k:ns/n', + type: 'looksAt', + target_entity_ref: 'k:ns/third', + }, + ]); + }); + + await stitcher.stitch(new Set(['k:ns/n'])); + + await db.transaction(async tx => { + const entities = await tx('final_entities'); + + expect(entities.length).toBe(1); + const entity = JSON.parse(entities[0].finalized_entity); + expect(entity).toEqual({ + relations: expect.arrayContaining([ + { + type: 'looksAt', + target: { + kind: 'k', + namespace: 'ns', + name: 'other', + }, + }, + { + type: 'looksAt', + target: { + kind: 'k', + namespace: 'ns', + name: 'third', + }, + }, + ]), + apiVersion: 'a', + kind: 'k', + metadata: { + name: 'n', + namespace: 'ns', + etag: expect.any(String), + generation: 1, + uid: 'my-id', + }, + spec: { + k: 'v', + }, + }); + + expect(entities[0].etag).not.toEqual(firstEtag); + expect(entities[0].etag).toEqual(entity.metadata.etag); + + const search = await tx('search'); + expect(search).toEqual( + expect.arrayContaining([ + { entity_id: 'my-id', key: 'relations', value: 'looksat:k:ns/other' }, + { entity_id: 'my-id', key: 'relations', value: 'looksat:k:ns/third' }, + { entity_id: 'my-id', key: 'apiversion', value: 'a' }, + { entity_id: 'my-id', key: 'kind', value: 'k' }, + { entity_id: 'my-id', key: 'metadata.name', value: 'n' }, + { entity_id: 'my-id', key: 'metadata.namespace', value: 'ns' }, + { entity_id: 'my-id', key: 'metadata.uid', value: 'my-id' }, + { entity_id: 'my-id', key: 'spec.k', value: 'v' }, + ]), + ); + }); + }); +}); diff --git a/plugins/catalog-backend/src/next/Stitcher.ts b/plugins/catalog-backend/src/next/Stitcher.ts index 04a8ab8cfc..cd9220e934 100644 --- a/plugins/catalog-backend/src/next/Stitcher.ts +++ b/plugins/catalog-backend/src/next/Stitcher.ts @@ -14,20 +14,14 @@ * limitations under the License. */ +import { Entity, parseEntityRef } from '@backstage/catalog-model'; +import { ConflictError } from '@backstage/errors'; +import { createHash } from 'crypto'; +import stableStringify from 'fast-json-stable-stringify'; import { Knex } from 'knex'; import { Logger } from 'winston'; import { Transaction } from '../database'; -import { ConflictError } from '@backstage/errors'; -import { - DbRefreshStateReferencesRow, - DbRefreshStateRow, - DbRelationsRow, -} from './database/DefaultProcessingDatabase'; -import { Entity, parseEntityRef } from '@backstage/catalog-model'; -import { createHash } from 'crypto'; -import stableStringify from 'fast-json-stable-stringify'; -import { buildEntitySearch } from '../database/search'; -import { DbEntitiesSearchRow } from '../database/types'; +import { buildEntitySearch, DbSearchRow } from './search'; // The number of items that are sent per batch to the database layer, when // doing .batchInsert calls to knex. This needs to be low enough to not cause @@ -58,6 +52,13 @@ export class Stitcher { await this.transaction(async txOpaque => { const tx = txOpaque as Knex.Transaction; + // Selecting from refresh_state and final_entities should yield exactly + // one row (except in abnormal cases where the stitch was invoked for + // something that didn't exist at all, in which case it's zero rows). + // The join with the temporary incoming_references still gives one row. + // The only result set "expanding" join is the one with relations, so + // the output should be at least one row (if zero or one relations were + // found), or at most the same number of rows as relations. const result: Array<{ entityId: string; processedEntity?: string; @@ -90,8 +91,14 @@ export class Stitcher { .leftOuterJoin('relations', { 'relations.source_entity_ref': 'refresh_state.entity_ref', }) - .where({ 'refresh_state.entity_ref': entityRef }); + .where({ 'refresh_state.entity_ref': entityRef }) + .orderBy('relationType', 'asc') + .orderBy('relationTarget', 'asc'); + // If there were no rows returned, it would mean that there was no + // matching row even in the refresh_state. This can happen for example + // if we emit a relation to something that hasn't been ingested yet. + // It's safe to ignore this stitch attempt in that case. if (!result.length) { this.logger.debug( `Unable to stitch ${entityRef}, item does not exist in refresh state table`, @@ -102,11 +109,15 @@ export class Stitcher { const { entityId, processedEntity, - errors, + // errors, incomingReferenceCount, previousEtag, } = result[0]; + // If there was no processed entity in place, the target hasn't been + // through the processing steps yet. It's safe to ignore this stitch + // attempt in that case, since another stitch will be triggered when + // that processing has finished. if (!processedEntity) { this.logger.debug( `Unable to stitch ${entityRef}, the entity has not yet been processed`, @@ -114,6 +125,7 @@ export class Stitcher { return; } + // Grab the processed entity and stitch all of the relevant data into it const entity = JSON.parse(processedEntity) as Entity; const isOrphan = Number(incomingReferenceCount) === 0; @@ -132,15 +144,16 @@ export class Stitcher { type: row.relationType!, target: parseEntityRef(row.relationTarget!), })); - entity.metadata.generation = 1; // If the output entity was actually not changed, just abort const etag = generateEntityEtag(entity); if (etag === previousEtag) { - console.log(`Skipped stitching of ${entityRef}, no changes`); + this.logger.debug(`Skipped stitching of ${entityRef}, no changes`); return; } + entity.metadata.uid = entityId; + entity.metadata.generation = 1; entity.metadata.etag = etag; await tx('final_entities') @@ -152,19 +165,9 @@ export class Stitcher { .onConflict('entity_id') .merge(['finalized_entity', 'etag']); - try { - const entries = buildEntitySearch(entityId, entity); - await tx('search') - .where({ entity_id: entityId }) - .delete(); - await tx.batchInsert('search', entries, BATCH_SIZE); - } catch (e) { - this.logger.debug( - `Failed to write search entries for ${entityId}`, - e, - ); - // intentionally ignored - } + const searchEntries = buildEntitySearch(entityId, entity); + await tx('search').where({ entity_id: entityId }).delete(); + await tx.batchInsert('search', searchEntries, BATCH_SIZE); }); } } diff --git a/plugins/catalog-backend/src/next/search.test.ts b/plugins/catalog-backend/src/next/search.test.ts new file mode 100644 index 0000000000..be9a98fe69 --- /dev/null +++ b/plugins/catalog-backend/src/next/search.test.ts @@ -0,0 +1,160 @@ +/* + * Copyright 2020 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 { Entity, ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model'; +import { buildEntitySearch, mapToRows, traverse } from './search'; + +describe('search', () => { + describe('traverse', () => { + it('expands lists of strings to several rows', () => { + const input = { a: ['b', 'c', 'd'] }; + const output = traverse(input); + expect(output).toEqual([ + { key: 'a', value: 'b' }, + { key: 'a.b', value: true }, + { key: 'a', value: 'c' }, + { key: 'a.c', value: true }, + { key: 'a', value: 'd' }, + { key: 'a.d', value: true }, + ]); + }); + + it('expands objects', () => { + const input = { a: { b: { c: 'd' }, e: 'f' } }; + const output = traverse(input); + expect(output).toEqual([ + { key: 'a.b.c', value: 'd' }, + { key: 'a.e', value: 'f' }, + ]); + }); + + it('expands list of objects', () => { + const input = { root: { list: [{ a: 1 }, { a: 2 }] } }; + const output = traverse(input); + expect(output).toEqual([ + { key: 'root.list.a', value: 1 }, + { key: 'root.list.a', value: 2 }, + ]); + }); + + it('skips over special keys', () => { + const input = { + state: { x: 1 }, + relations: [{ y: 2 }], + a: 'a', + metadata: { + b: 'b', + name: 'name', + namespace: 'namespace', + uid: 'uid', + etag: 'etag', + generation: 'generation', + c: 'c', + }, + d: 'd', + }; + const output = traverse(input); + expect(output).toEqual([ + { key: 'a', value: 'a' }, + { key: 'metadata.b', value: 'b' }, + { key: 'metadata.c', value: 'c' }, + { key: 'd', value: 'd' }, + ]); + }); + }); + + describe('mapToRows', () => { + it('converts base types to strings or null', () => { + const input = [ + { key: 'a', value: true }, + { key: 'b', value: false }, + { key: 'c', value: 7 }, + { key: 'd', value: 'string' }, + { key: 'e', value: null }, + { key: 'f', value: undefined }, + ]; + const output = mapToRows(input, 'eid'); + expect(output).toEqual([ + { entity_id: 'eid', key: 'a', value: 'true' }, + { entity_id: 'eid', key: 'b', value: 'false' }, + { entity_id: 'eid', key: 'c', value: '7' }, + { entity_id: 'eid', key: 'd', value: 'string' }, + { entity_id: 'eid', key: 'e', value: null }, + { entity_id: 'eid', key: 'f', value: null }, + ]); + }); + + it('emits lowercase version of keys and values', () => { + const input = [{ key: 'fOo', value: 'BaR' }]; + const output = mapToRows(input, 'eid'); + expect(output).toEqual([{ entity_id: 'eid', key: 'foo', value: 'bar' }]); + }); + + it('skips very large values', () => { + const input = [{ key: 'foo', value: 'a'.repeat(10000) }]; + const output = mapToRows(input, 'eid'); + expect(output).toEqual([]); + }); + }); + + describe('buildEntitySearch', () => { + it('adds special keys even if missing', () => { + const input: Entity = { + apiVersion: 'a', + kind: 'b', + metadata: { name: 'n' }, + }; + expect(buildEntitySearch('eid', input)).toEqual([ + { entity_id: 'eid', key: 'apiversion', value: 'a' }, + { entity_id: 'eid', key: 'kind', value: 'b' }, + { entity_id: 'eid', key: 'metadata.name', value: 'n' }, + { entity_id: 'eid', key: 'metadata.namespace', value: null }, + { entity_id: 'eid', key: 'metadata.uid', value: null }, + { + entity_id: 'eid', + key: 'metadata.namespace', + value: ENTITY_DEFAULT_NAMESPACE, + }, + ]); + }); + + it('adds relations', () => { + const input: Entity = { + relations: [ + { type: 't1', target: { kind: 'k', namespace: 'ns', name: 'a' } }, + { type: 't2', target: { kind: 'k', namespace: 'ns', name: 'b' } }, + ], + apiVersion: 'a', + kind: 'b', + metadata: { name: 'n' }, + }; + expect(buildEntitySearch('eid', input)).toEqual([ + { entity_id: 'eid', key: 'apiversion', value: 'a' }, + { entity_id: 'eid', key: 'kind', value: 'b' }, + { entity_id: 'eid', key: 'metadata.name', value: 'n' }, + { entity_id: 'eid', key: 'metadata.namespace', value: null }, + { entity_id: 'eid', key: 'metadata.uid', value: null }, + { + entity_id: 'eid', + key: 'metadata.namespace', + value: ENTITY_DEFAULT_NAMESPACE, + }, + { entity_id: 'eid', key: 'relations', value: 't1:k:ns/a' }, + { entity_id: 'eid', key: 'relations', value: 't2:k:ns/b' }, + ]); + }); + }); +}); diff --git a/plugins/catalog-backend/src/next/search.ts b/plugins/catalog-backend/src/next/search.ts new file mode 100644 index 0000000000..4aa8bae1a8 --- /dev/null +++ b/plugins/catalog-backend/src/next/search.ts @@ -0,0 +1,191 @@ +/* + * Copyright 2020 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 { + Entity, + ENTITY_DEFAULT_NAMESPACE, + stringifyEntityRef, +} from '@backstage/catalog-model'; + +export type DbSearchRow = { + entity_id: string; + key: string; + value: string | null; +}; + +// These are excluded in the generic loop, either because they do not make sense +// to index, or because they are special-case always inserted whether they are +// null or not +const SPECIAL_KEYS = [ + 'state', + 'relations', + 'metadata.name', + 'metadata.namespace', + 'metadata.uid', + 'metadata.etag', + 'metadata.generation', +]; + +// The maximum length allowed for search values. These columns are indexed, and +// database engines do not like to index on massive values. For example, +// postgres will balk after 8191 byte line sizes. +const MAX_VALUE_LENGTH = 200; + +type Kv = { + key: string; + value: unknown; +}; + +// Helper for traversing through a nested structure and outputting a list of +// path->value entries of the leaves. +// +// For example, this yaml structure +// +// a: 1 +// b: +// c: null +// e: [f, g] +// h: +// - i: 1 +// j: k +// - i: 2 +// j: l +// +// will result in +// +// "a", 1 +// "b.c", null +// "b.e": "f" +// "b.e.f": true +// "b.e": "g" +// "b.e.g": true +// "h.i": 1 +// "h.j": "k" +// "h.i": 2 +// "h.j": "l" +export function traverse(root: unknown): Kv[] { + const output: Kv[] = []; + + function visit(path: string, current: unknown) { + if (SPECIAL_KEYS.includes(path)) { + return; + } + + // empty or scalar + if ( + current === undefined || + current === null || + ['string', 'number', 'boolean'].includes(typeof current) + ) { + output.push({ key: path, value: current }); + return; + } + + // unknown + if (typeof current !== 'object') { + return; + } + + // array + if (Array.isArray(current)) { + for (const item of current) { + // NOTE(freben): The reason that these are output in two different ways, + // is to support use cases where you want to express that MORE than one + // tag is present in a list. Since the EntityFilters structure is a + // record, you can't have several entries of the same key. Therefore + // you will have to match on + // + // { "a.b": ["true"], "a.c": ["true"] } + // + // rather than + // + // { "a": ["b", "c"] } + // + // because the latter means EITHER b or c has to be present. + visit(path, item); + if (typeof item === 'string') { + output.push({ key: `${path}.${item}`, value: true }); + } + } + return; + } + + // object + for (const [key, value] of Object.entries(current!)) { + visit(path ? `${path}.${key}` : key, value); + } + } + + visit('', root); + + return output; +} + +// Translates a number of raw data rows to search table rows +export function mapToRows(input: Kv[], entityId: string): DbSearchRow[] { + const result: DbSearchRow[] = []; + + for (const { key: rawKey, value: rawValue } of input) { + const key = rawKey.toLocaleLowerCase('en-US'); + if (rawValue === undefined || rawValue === null) { + result.push({ entity_id: entityId, key, value: null }); + } else { + const value = String(rawValue).toLocaleLowerCase('en-US'); + if (value.length <= MAX_VALUE_LENGTH) { + result.push({ entity_id: entityId, key, value }); + } + } + } + + return result; +} + +/** + * Generates all of the search rows that are relevant for this entity. + * + * @param entityId The uid of the entity + * @param entity The entity + * @returns A list of entity search rows + */ +export function buildEntitySearch( + entityId: string, + entity: Entity, +): DbSearchRow[] { + // Visit the base structure recursively + const raw = traverse(entity); + + // Start with some special keys that are always present because you want to + // be able to easily search for null specifically + raw.push({ key: 'metadata.name', value: entity.metadata.name }); + raw.push({ key: 'metadata.namespace', value: entity.metadata.namespace }); + raw.push({ key: 'metadata.uid', value: entity.metadata.uid }); + + // Namespace not specified has the default value "default", so we want to + // match on that as well + if (!entity.metadata.namespace) { + raw.push({ key: 'metadata.namespace', value: ENTITY_DEFAULT_NAMESPACE }); + } + + // Visit relations + for (const relation of entity.relations ?? []) { + raw.push({ + key: 'relations', + value: `${relation.type}:${stringifyEntityRef(relation.target)}`, + }); + } + + return mapToRows(raw, entityId); +} diff --git a/plugins/catalog-backend/src/next/types.ts b/plugins/catalog-backend/src/next/types.ts index e0616fb336..cc9cc48ad6 100644 --- a/plugins/catalog-backend/src/next/types.ts +++ b/plugins/catalog-backend/src/next/types.ts @@ -120,6 +120,7 @@ export type ReplaceProcessingItemsRequest = removed: Entity[]; type: 'delta'; }; + export interface ProcessingStateManager { setProcessingItemResult(result: ProcessingItemResult): Promise; getNextProcessingItem(): Promise; From bd231a3d63310049c2467fff15670f351cec3e41 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sun, 4 Apr 2021 19:45:23 +0200 Subject: [PATCH 148/485] catalog-backend/next: add Context Signed-off-by: Patrik Oldsberg --- .../src/next/Context/BaseContext.ts | 26 ++++++++++++ .../src/next/Context/ContextWithValue.ts | 40 +++++++++++++++++++ .../src/next/Context/TransactionContext.ts | 40 +++++++++++++++++++ .../catalog-backend/src/next/Context/index.ts | 21 ++++++++++ .../catalog-backend/src/next/Context/types.ts | 23 +++++++++++ 5 files changed, 150 insertions(+) create mode 100644 plugins/catalog-backend/src/next/Context/BaseContext.ts create mode 100644 plugins/catalog-backend/src/next/Context/ContextWithValue.ts create mode 100644 plugins/catalog-backend/src/next/Context/TransactionContext.ts create mode 100644 plugins/catalog-backend/src/next/Context/index.ts create mode 100644 plugins/catalog-backend/src/next/Context/types.ts diff --git a/plugins/catalog-backend/src/next/Context/BaseContext.ts b/plugins/catalog-backend/src/next/Context/BaseContext.ts new file mode 100644 index 0000000000..c9553cffd5 --- /dev/null +++ b/plugins/catalog-backend/src/next/Context/BaseContext.ts @@ -0,0 +1,26 @@ +/* + * 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 { Context, ContextKey } from './types'; + +/** + * A base Context implementation that does not hold any value. + */ +export class BaseContext implements Context { + getContextValue(key: ContextKey): T { + return key.defaultValue; + } +} diff --git a/plugins/catalog-backend/src/next/Context/ContextWithValue.ts b/plugins/catalog-backend/src/next/Context/ContextWithValue.ts new file mode 100644 index 0000000000..8e61e2c6f2 --- /dev/null +++ b/plugins/catalog-backend/src/next/Context/ContextWithValue.ts @@ -0,0 +1,40 @@ +/* + * 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 { BaseContext } from './BaseContext'; +import { Context, ContextKey } from './types'; + +/** + * A Context implementation that holds a single value, optionally extending an existing context. + */ +export class ContextWithValue implements Context { + static create(key: ContextKey, value: unknown, parent?: Context) { + return new ContextWithValue(parent ?? new BaseContext(), key, value); + } + + private constructor( + private readonly parent: Context, + private readonly key: ContextKey, + private readonly value: unknown, + ) {} + + getContextValue(key: ContextKey): T { + if (this.key === key) { + return this.value as T; + } + return this.parent.getContextValue(key); + } +} diff --git a/plugins/catalog-backend/src/next/Context/TransactionContext.ts b/plugins/catalog-backend/src/next/Context/TransactionContext.ts new file mode 100644 index 0000000000..6ac50fbc07 --- /dev/null +++ b/plugins/catalog-backend/src/next/Context/TransactionContext.ts @@ -0,0 +1,40 @@ +/* + * 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 { Context, ContextKey } from './types'; +import { Knex } from 'knex'; +import { ContextWithValue } from './ContextWithValue'; + +const transactionContextKey = new ContextKey( + undefined, +); + +/** + * TransactionContext handles the wrapping of a knex transaction in a Context. + */ +export class TransactionContext { + static create(tx: Knex.Transaction, parent?: Context) { + return ContextWithValue.create(transactionContextKey, tx, parent); + } + + static getTransaction(context: Context): Knex.Transaction { + const transaction = context.getContextValue(transactionContextKey); + if (!transaction) { + throw new Error(`No transaction available in context`); + } + return transaction; + } +} diff --git a/plugins/catalog-backend/src/next/Context/index.ts b/plugins/catalog-backend/src/next/Context/index.ts new file mode 100644 index 0000000000..992f5e89a6 --- /dev/null +++ b/plugins/catalog-backend/src/next/Context/index.ts @@ -0,0 +1,21 @@ +/* + * 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. + */ + +export { BaseContext } from './BaseContext'; +export { ContextWithValue } from './ContextWithValue'; +export { TransactionContext } from './TransactionContext'; +export { ContextKey } from './types'; +export type { Context } from './types'; diff --git a/plugins/catalog-backend/src/next/Context/types.ts b/plugins/catalog-backend/src/next/Context/types.ts new file mode 100644 index 0000000000..0973b83515 --- /dev/null +++ b/plugins/catalog-backend/src/next/Context/types.ts @@ -0,0 +1,23 @@ +/* + * 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. + */ + +export class ContextKey { + constructor(readonly defaultValue: T) {} +} + +export interface Context { + getContextValue(key: ContextKey): T; +} From 065e532aade1047d3d06a0d6a308091e63e6eb06 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Wed, 28 Apr 2021 10:30:03 +0200 Subject: [PATCH 149/485] catalog-backend: tweak Context API Signed-off-by: Patrik Oldsberg --- .../Context/{BaseContext.ts => BackgroundContext.ts} | 2 +- .../src/next/Context/ContextWithValue.ts | 5 ++--- .../{TransactionContext.ts => TransactionValue.ts} | 10 +++++----- plugins/catalog-backend/src/next/Context/index.ts | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) rename plugins/catalog-backend/src/next/Context/{BaseContext.ts => BackgroundContext.ts} (93%) rename plugins/catalog-backend/src/next/Context/{TransactionContext.ts => TransactionValue.ts} (77%) diff --git a/plugins/catalog-backend/src/next/Context/BaseContext.ts b/plugins/catalog-backend/src/next/Context/BackgroundContext.ts similarity index 93% rename from plugins/catalog-backend/src/next/Context/BaseContext.ts rename to plugins/catalog-backend/src/next/Context/BackgroundContext.ts index c9553cffd5..72b9a3b1ed 100644 --- a/plugins/catalog-backend/src/next/Context/BaseContext.ts +++ b/plugins/catalog-backend/src/next/Context/BackgroundContext.ts @@ -19,7 +19,7 @@ import { Context, ContextKey } from './types'; /** * A base Context implementation that does not hold any value. */ -export class BaseContext implements Context { +export class BackgroundContext implements Context { getContextValue(key: ContextKey): T { return key.defaultValue; } diff --git a/plugins/catalog-backend/src/next/Context/ContextWithValue.ts b/plugins/catalog-backend/src/next/Context/ContextWithValue.ts index 8e61e2c6f2..e8f94fd922 100644 --- a/plugins/catalog-backend/src/next/Context/ContextWithValue.ts +++ b/plugins/catalog-backend/src/next/Context/ContextWithValue.ts @@ -14,15 +14,14 @@ * limitations under the License. */ -import { BaseContext } from './BaseContext'; import { Context, ContextKey } from './types'; /** * A Context implementation that holds a single value, optionally extending an existing context. */ export class ContextWithValue implements Context { - static create(key: ContextKey, value: unknown, parent?: Context) { - return new ContextWithValue(parent ?? new BaseContext(), key, value); + static create(parent: Context, key: ContextKey, value: unknown) { + return new ContextWithValue(parent, key, value); } private constructor( diff --git a/plugins/catalog-backend/src/next/Context/TransactionContext.ts b/plugins/catalog-backend/src/next/Context/TransactionValue.ts similarity index 77% rename from plugins/catalog-backend/src/next/Context/TransactionContext.ts rename to plugins/catalog-backend/src/next/Context/TransactionValue.ts index 6ac50fbc07..6959d13a18 100644 --- a/plugins/catalog-backend/src/next/Context/TransactionContext.ts +++ b/plugins/catalog-backend/src/next/Context/TransactionValue.ts @@ -23,14 +23,14 @@ const transactionContextKey = new ContextKey( ); /** - * TransactionContext handles the wrapping of a knex transaction in a Context. + * TransactionValue handles the wrapping of a knex transaction in a Context. */ -export class TransactionContext { - static create(tx: Knex.Transaction, parent?: Context) { - return ContextWithValue.create(transactionContextKey, tx, parent); +export class TransactionValue { + static in(parent: Context, tx: Knex.Transaction) { + return ContextWithValue.create(parent, transactionContextKey, tx); } - static getTransaction(context: Context): Knex.Transaction { + static from(context: Context): Knex.Transaction { const transaction = context.getContextValue(transactionContextKey); if (!transaction) { throw new Error(`No transaction available in context`); diff --git a/plugins/catalog-backend/src/next/Context/index.ts b/plugins/catalog-backend/src/next/Context/index.ts index 992f5e89a6..61dd4a2958 100644 --- a/plugins/catalog-backend/src/next/Context/index.ts +++ b/plugins/catalog-backend/src/next/Context/index.ts @@ -14,8 +14,8 @@ * limitations under the License. */ -export { BaseContext } from './BaseContext'; +export { BackgroundContext } from './BackgroundContext'; export { ContextWithValue } from './ContextWithValue'; -export { TransactionContext } from './TransactionContext'; +export { TransactionValue } from './TransactionValue'; export { ContextKey } from './types'; export type { Context } from './types'; From 213cd261b6ccc691bc457907106ffba32b95a695 Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Fri, 23 Apr 2021 18:51:52 +0200 Subject: [PATCH 150/485] [chart] Update docker image Signed-off-by: Martina Iglesias Fernandez --- contrib/chart/backstage/templates/backend-deployment.yaml | 7 +++++++ contrib/chart/backstage/templates/frontend-deployment.yaml | 2 +- contrib/chart/backstage/values.yaml | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/contrib/chart/backstage/templates/backend-deployment.yaml b/contrib/chart/backstage/templates/backend-deployment.yaml index 144fc93e62..3096fc37ab 100644 --- a/contrib/chart/backstage/templates/backend-deployment.yaml +++ b/contrib/chart/backstage/templates/backend-deployment.yaml @@ -26,6 +26,13 @@ spec: {{- end}} containers: - name: {{ .Chart.Name }}-backend + command: ["node"] + args: + - "packages/backend" + - "--config" + - "app-config.yaml" + - "--config" + - {{ printf "/usr/src/app/%s" (include "backstage.appConfigFilename" .) | quote }} image: {{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag }} imagePullPolicy: {{ .Values.backend.image.pullPolicy }} ports: diff --git a/contrib/chart/backstage/templates/frontend-deployment.yaml b/contrib/chart/backstage/templates/frontend-deployment.yaml index 9c674cc160..56f720e834 100644 --- a/contrib/chart/backstage/templates/frontend-deployment.yaml +++ b/contrib/chart/backstage/templates/frontend-deployment.yaml @@ -1,3 +1,4 @@ +{{- if .Values.frontend.enabled }} apiVersion: apps/v1 kind: Deployment metadata: @@ -46,7 +47,6 @@ spec: {{- if .Values.global.nodeSelector }} nodeSelector: {{- toYaml .Values.global.nodeSelector | nindent 8 }} {{- end }} -{{- if .Values.frontend.enabled }} --- apiVersion: v1 kind: Service diff --git a/contrib/chart/backstage/values.yaml b/contrib/chart/backstage/values.yaml index bd80bc22b6..78eb7cb92a 100644 --- a/contrib/chart/backstage/values.yaml +++ b/contrib/chart/backstage/values.yaml @@ -3,7 +3,7 @@ # Declare variables to be passed into your templates. frontend: - enabled: true + enabled: false replicaCount: 1 image: repository: martinaif/backstage-k8s-demo-frontend @@ -23,7 +23,7 @@ backend: replicaCount: 1 image: repository: martinaif/backstage-k8s-demo-backend - tag: test1 + tag: 20210423T1550 pullPolicy: IfNotPresent containerPort: 7000 resources: From 7e1617ce0e79dbff7f905389a337d5f6f6d2e6d2 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Wed, 21 Apr 2021 19:58:02 +0200 Subject: [PATCH 151/485] catalog-backend: WIP EntityProvider mutation interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: blam Signed-off-by: Patrik Oldsberg --- .../next/DefaultCatalogProcessingEngine.ts | 15 ++-- .../src/next/DefaultLocationStore.ts | 68 ++++++++++--------- .../src/next/NextCatalogBuilder.ts | 3 +- plugins/catalog-backend/src/next/types.ts | 21 +++--- 4 files changed, 55 insertions(+), 52 deletions(-) diff --git a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts index 934ab3a1cc..b423b61041 100644 --- a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts +++ b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts @@ -19,6 +19,8 @@ import { CatalogProcessingEngine, EntityProvider, EntityMessage, + EntityProviderConnection, + EntityProviderMutation, ProcessingStateManager, CatalogProcessingOrchestrator, } from './types'; @@ -27,8 +29,13 @@ import { Logger } from 'winston'; import { stringifyEntityRef } from '@backstage/catalog-model'; import { Stitcher } from './Stitcher'; +class Connection implements EntityProviderConnection { + constructor(private readonly stateManager: ProcessingStateManager) {} + + async applyMutation(mutation: EntityProviderMutation): Promise {} +} + export class DefaultCatalogProcessingEngine implements CatalogProcessingEngine { - private subscriptions: Subscription[] = []; private running: boolean = false; constructor( @@ -41,11 +48,7 @@ export class DefaultCatalogProcessingEngine implements CatalogProcessingEngine { async start() { for (const provider of this.entityProviders) { - const id = 'databaseProvider'; - const subscription = provider - .entityChange$() - .subscribe({ next: m => this.onNext(id, m) }); - this.subscriptions.push(subscription); + provider.connect(new Connection(this.stateManager)); } this.running = true; diff --git a/plugins/catalog-backend/src/next/DefaultLocationStore.ts b/plugins/catalog-backend/src/next/DefaultLocationStore.ts index b21fe9da02..a6b4adcca4 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationStore.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationStore.ts @@ -16,24 +16,29 @@ import { LocationSpec, Location } from '@backstage/catalog-model'; import { Database } from '../database'; -import { LocationStore } from './types'; +import { + LocationStore, + EntityProvider, + EntityProviderConnection, +} from './types'; import { v4 as uuidv4 } from 'uuid'; +import { locationSpecToLocationEntity } from './util'; import { ConflictError } from '@backstage/errors'; -import { Observable } from '@backstage/core'; -import ObservableImpl from 'zen-observable'; export type LocationMessage = | { all: Location[] } | { added: Location[]; removed: Location[] }; -export class DefaultLocationStore implements LocationStore { - private subscribers = new Set< - ZenObservable.SubscriptionObserver - >(); +export class DefaultLocationStore implements LocationStore, EntityProvider { + private _connection: EntityProviderConnection | undefined; constructor(private readonly db: Database) {} createLocation(spec: LocationSpec): Promise { + if (!this.connection) { + throw new Error('location store is not initialized'); + } + return this.db.transaction(async tx => { // TODO: id should really be type and target combined and not a uuid. @@ -55,7 +60,11 @@ export class DefaultLocationStore implements LocationStore { target: spec.target, }); - this.notifyAddition(location); + await this.connection.applyMutation({ + type: 'delta', + added: [locationSpecToLocationEntity(location)], + removed: [], + }); return location; }); @@ -75,40 +84,33 @@ export class DefaultLocationStore implements LocationStore { } deleteLocation(id: string): Promise { + if (!this.connection) { + throw new Error('location store is not initialized'); + } + return this.db.transaction(async tx => { const location = await this.db.location(id); if (!location) { throw new ConflictError(`No location found with id: ${id}`); } await this.db.removeLocation(tx, id); - this.notifyDeletion(location); - }); - } - - private notifyAddition(location: Location) { - for (const subscriber of this.subscribers) { - subscriber.next({ - added: [location], - removed: [], - }); - } - } - - private notifyDeletion(location: Location) { - for (const subscriber of this.subscribers) { - subscriber.next({ + await this.connection.applyMutation({ + type: 'delta', added: [], - removed: [location], + removed: [locationSpecToLocationEntity(location)], }); - } + }); } - location$(): Observable { - return new ObservableImpl(subscriber => { - this.subscribers.add(subscriber); - return () => { - this.subscribers.delete(subscriber); - }; - }); + private get connection(): EntityProviderConnection { + if (!this._connection) { + throw new Error('location store is not initialized'); + } + + return this._connection; + } + + async connect(connection: EntityProviderConnection): Promise { + this._connection = connection; } } diff --git a/plugins/catalog-backend/src/next/NextCatalogBuilder.ts b/plugins/catalog-backend/src/next/NextCatalogBuilder.ts index c3e0a6bd9c..1796847164 100644 --- a/plugins/catalog-backend/src/next/NextCatalogBuilder.ts +++ b/plugins/catalog-backend/src/next/NextCatalogBuilder.ts @@ -272,11 +272,10 @@ export class NextCatalogBuilder { const entitiesCatalog = new NextEntitiesCatalog(dbClient); const locationStore = new DefaultLocationStore(db); - const dbLocationProvider = new DatabaseLocationProvider(locationStore); const stitcher = new Stitcher(dbClient, logger); const processingEngine = new DefaultCatalogProcessingEngine( logger, - [dbLocationProvider], // entityproviders + [locationStore], // entityproviders stateManager, orchestrator, stitcher, diff --git a/plugins/catalog-backend/src/next/types.ts b/plugins/catalog-backend/src/next/types.ts index 0aeb290224..c3854d631f 100644 --- a/plugins/catalog-backend/src/next/types.ts +++ b/plugins/catalog-backend/src/next/types.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { Entity, EntityName, @@ -21,7 +22,6 @@ import { EntityRelationSpec, } from '@backstage/catalog-model'; import { JsonObject } from '@backstage/config'; -import { Observable } from '@backstage/core'; // << nooo export interface LocationEntity { apiVersion: 'backstage.io/v1alpha1'; @@ -45,20 +45,11 @@ export interface LocationService { deleteLocation(id: string): Promise; } -export type EntityMessage = - | { all: Entity[] } - | { added: Entity[]; removed: EntityName[] }; - export interface LocationStore { - // extends EntityProvider createLocation(spec: LocationSpec): Promise; listLocations(): Promise; getLocation(id: string): Promise; deleteLocation(id: string): Promise; - - location$(): Observable< - { all: Location[] } | { added: Location[]; removed: Location[] } - >; } export interface CatalogProcessingEngine { @@ -66,8 +57,16 @@ export interface CatalogProcessingEngine { stop(): Promise; } +export type EntityProviderMutation = + | { type: 'full'; entities: Iterable } + | { type: 'delta'; added: Iterable; removed: Iterable }; + +export interface EntityProviderConnection { + applyMutation(mutation: EntityProviderMutation): Promise; +} + export interface EntityProvider { - entityChange$(): Observable; + connect(connection: EntityProviderConnection): Promise; } export type EntityProcessingRequest = { From d9e5eeb575d316f60924dbd19a0c034cc433d162 Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 22 Apr 2021 19:41:40 +0200 Subject: [PATCH 152/485] chore: worked on some more of the new catalog migration with fixing deps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Patrik Oldsberg Co-authored-by: Johan Haals Co-authored-by: Fredrik Adelöw Signed-off-by: blam --- .../20210302150147_refresh_state.js | 33 ++-- .../next/DefaultCatalogProcessingEngine.ts | 38 +++- .../src/next/DefaultLocationStore.ts | 4 - .../src/next/DefaultProcessingStateManager.ts | 13 +- .../src/next/database/DatabaseManager.ts | 114 +++++++++++ .../DefaultProcessingDatabase.test.ts | 31 +++ .../database/DefaultProcessingDatabase.ts | 180 +++++++++++++++++- .../src/next/database/types.ts | 17 ++ plugins/catalog-backend/src/next/types.ts | 21 +- 9 files changed, 405 insertions(+), 46 deletions(-) create mode 100644 plugins/catalog-backend/src/next/database/DatabaseManager.ts create mode 100644 plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts diff --git a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js index 6abab6270b..14c75b2530 100644 --- a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js +++ b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js @@ -59,13 +59,14 @@ exports.up = async function up(knex) { .notNullable() .comment('JSON array containing all errors related to entity'); table - .dateTime('next_update_at') + .dateTime('next_update_at') // TOOD: timezone or change to epoch-millis or similar .notNullable() .comment('Timestamp of when entity should be updated'); table - .dateTime('last_discovery_at') + .dateTime('last_discovery_at') // TOOD: timezone or change to epoch-millis or similar .notNullable() .comment('The last timestamp of which this entity was discovered'); + table.index('entity_id', 'refresh_state_entity_id_idx'); table.index('entity_ref', 'refresh_state_entity_ref_idx'); table.index('next_update_at', 'refresh_state_next_update_at_idx'); }); @@ -94,38 +95,35 @@ exports.up = async function up(knex) { 'Holds edges between refresh state rows. Every time when an entity is processed and emits another entity, an edge will be stored to represent that fact. This is used to detect orphans and ultimately deletions.', ); table - .text('source_special_key') + .text('source_key') .nullable() .comment( 'When the reference source is not an entity, this is an opaque identifier for that source.', ); table - .text('source_entity_id') + .text('source_entity_ref') .nullable() - .references('entity_id') + .references('entity_ref') .inTable('refresh_state') .onDelete('CASCADE') .comment( - 'When the reference source is an entity, this is the ID of the source entity.', + 'When the reference source is an entity, this is the EntityRef of the source entity.', ); table - .text('target_entity_id') + .text('target_entity_ref') .notNullable() - .references('entity_id') + .references('entity_ref') .inTable('refresh_state') .onDelete('CASCADE') - .comment('The ID of the target entity.'); + .comment('The EntityRef of the target entity.'); + table.index('source_key', 'refresh_state_references_source_key_idx'); table.index( - 'source_special_key', - 'refresh_state_references_source_special_key_idx', + 'source_entity_ref', + 'refresh_state_references_source_entity_ref_idx', ); table.index( - 'source_entity_id', - 'refresh_state_references_source_entity_id_idx', - ); - table.index( - 'target_entity_id', - 'refresh_state_references_target_entity_id_idx', + 'target_entity_ref', + 'refresh_state_references_target_entity_ref_idx', ); }); @@ -165,6 +163,7 @@ exports.down = async function down(knex) { table.dropIndex([], 'refresh_state_references_target_entity_id_idx'); }); await knex.schema.alterTable('refresh_state', table => { + table.dropIndex([], 'refresh_state_entity_id_idx'); table.dropIndex([], 'refresh_state_entity_ref_idx'); table.dropIndex([], 'refresh_state_next_update_at_idx'); }); diff --git a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts index b423b61041..7f49bf832d 100644 --- a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts +++ b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts @@ -30,9 +30,31 @@ import { stringifyEntityRef } from '@backstage/catalog-model'; import { Stitcher } from './Stitcher'; class Connection implements EntityProviderConnection { - constructor(private readonly stateManager: ProcessingStateManager) {} + constructor( + private readonly config: { + stateManager: ProcessingStateManager; + id: string; + }, + ) {} - async applyMutation(mutation: EntityProviderMutation): Promise {} + async applyMutation(mutation: EntityProviderMutation): Promise { + if (mutation.type === 'full') { + await this.config.stateManager.replaceProcessingItems({ + id: this.config.id, + type: 'full', + items: mutation.entities, + }); + + return; + } + + await this.config.stateManager.replaceProcessingItems({ + id: this.config.id, + type: 'delta', + added: mutation.added, + removed: mutation.removed, + }); + } } export class DefaultCatalogProcessingEngine implements CatalogProcessingEngine { @@ -48,7 +70,9 @@ export class DefaultCatalogProcessingEngine implements CatalogProcessingEngine { async start() { for (const provider of this.entityProviders) { - provider.connect(new Connection(this.stateManager)); + // TODO: this ID should be some form of identifier for the EntityProvider + const id = 'databaseProvider'; + provider.connect(new Connection({ stateManager: this.stateManager, id })); } this.running = true; @@ -57,12 +81,12 @@ export class DefaultCatalogProcessingEngine implements CatalogProcessingEngine { const { id, entity, - state: intialState, + state: initialState, } = await this.stateManager.getNextProcessingItem(); const result = await this.orchestrator.process({ entity, - state: intialState, + state: initialState, }); for (const error of result.errors) { @@ -95,10 +119,6 @@ export class DefaultCatalogProcessingEngine implements CatalogProcessingEngine { async stop() { this.running = false; - - for (const subscription of this.subscriptions) { - subscription.unsubscribe(); - } } private async onNext(id: string, message: EntityMessage) { diff --git a/plugins/catalog-backend/src/next/DefaultLocationStore.ts b/plugins/catalog-backend/src/next/DefaultLocationStore.ts index a6b4adcca4..dff424b1a9 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationStore.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationStore.ts @@ -35,10 +35,6 @@ export class DefaultLocationStore implements LocationStore, EntityProvider { constructor(private readonly db: Database) {} createLocation(spec: LocationSpec): Promise { - if (!this.connection) { - throw new Error('location store is not initialized'); - } - return this.db.transaction(async tx => { // TODO: id should really be type and target combined and not a uuid. diff --git a/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts b/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts index 91090bc139..d2765c3101 100644 --- a/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts +++ b/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts @@ -17,14 +17,23 @@ import { ProcessingDatabase, RefreshStateItem } from './database/types'; import { AddProcessingItemRequest, - ProccessingItem, + ProcessingItem, ProcessingItemResult, ProcessingStateManager, + ReplaceProcessingItemsRequest, } from './types'; export class DefaultProcessingStateManager implements ProcessingStateManager { constructor(private readonly db: ProcessingDatabase) {} + replaceProcessingItems( + request: ReplaceProcessingItemsRequest, + ): Promise { + return this.db.transaction(async tx => { + await this.db.replaceUnprocessedEntities(tx, request); + }); + } + async setProcessingItemResult(result: ProcessingItemResult) { return this.db.transaction(async tx => { await this.db.updateProcessedEntity(tx, { @@ -44,7 +53,7 @@ export class DefaultProcessingStateManager implements ProcessingStateManager { }); } - async getNextProcessingItem(): Promise { + async getNextProcessingItem(): Promise { const entities = await new Promise(resolve => this.popFromQueue(resolve), ); diff --git a/plugins/catalog-backend/src/next/database/DatabaseManager.ts b/plugins/catalog-backend/src/next/database/DatabaseManager.ts new file mode 100644 index 0000000000..4c9e45950f --- /dev/null +++ b/plugins/catalog-backend/src/next/database/DatabaseManager.ts @@ -0,0 +1,114 @@ +/* + * Copyright 2020 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 { getVoidLogger, resolvePackagePath } from '@backstage/backend-common'; +import knexFactory, { Knex } from 'knex'; +import { v4 as uuidv4 } from 'uuid'; +import { Logger } from 'winston'; +import { CommonDatabase } from '../../database/CommonDatabase'; +import { Database } from '../../database/types'; +import fs from 'fs-extra'; + +export type CreateDatabaseOptions = { + logger: Logger; +}; + +const defaultOptions: CreateDatabaseOptions = { + logger: getVoidLogger(), +}; + +export class DatabaseManager { + public static async createDatabase( + knex: Knex, + options: Partial = {}, + ): Promise { + const allMigrations = resolvePackagePath( + '@backstage/plugin-catalog-backend', + 'migrations', + ); + + const migrationsDir = resolvePackagePath( + '@backstage/plugin-catalog-backend', + 'migrationsv2', + ); + await fs.copy(allMigrations, migrationsDir); + + await knex.migrate.latest({ + directory: migrationsDir, + }); + const { logger } = { ...defaultOptions, ...options }; + return new CommonDatabase(knex, logger); + } + + public static async createInMemoryDatabase(): Promise { + const knex = await this.createInMemoryDatabaseConnection(); + return await this.createDatabase(knex); + } + + public static async createInMemoryDatabaseConnection(): Promise { + const knex = knexFactory({ + client: 'sqlite3', + connection: ':memory:', + useNullAsDefault: true, + }); + + knex.client.pool.on('createSuccess', (_eventId: any, resource: any) => { + resource.run('PRAGMA foreign_keys = ON', () => {}); + }); + + return knex; + } + + public static async createTestDatabase(): Promise { + const knex = await this.createTestDatabaseConnection(); + return await this.createDatabase(knex); + } + + public static async createTestDatabaseConnection(): Promise { + const config: Knex.Config = { + /* + client: 'pg', + connection: { + host: 'localhost', + user: 'postgres', + password: 'postgres', + }, + */ + client: 'sqlite3', + connection: ':memory:', + useNullAsDefault: true, + }; + + let knex = knexFactory(config); + if (typeof config.connection !== 'string') { + const tempDbName = `d${uuidv4().replace(/-/g, '')}`; + await knex.raw(`CREATE DATABASE ${tempDbName};`); + knex = knexFactory({ + ...config, + connection: { + ...config.connection, + database: tempDbName, + }, + }); + } + + knex.client.pool.on('createSuccess', (_eventId: any, resource: any) => { + resource.run('PRAGMA foreign_keys = ON', () => {}); + }); + + return knex; + } +} diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts new file mode 100644 index 0000000000..fd2e9e6750 --- /dev/null +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts @@ -0,0 +1,31 @@ +/* + * 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 { DefaultProcessingDatabase } from './DefaultProcessingDatabase'; +import { DatabaseManager } from './DatabaseManager'; +import { Knex } from 'knex'; + +describe('Default Processing Database', () => { + let db: Knex | undefined; + + beforeEach(async () => { + db = await DatabaseManager.createTestDatabaseConnection(); + await DatabaseManager.createDatabase(db); + }); + + it('should write some stuff', async () => { + await db('refresh_state_referencess').select(); + }); +}); diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts index cf2d4e121c..b799bd6284 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts @@ -15,6 +15,7 @@ */ import { ConflictError, NotFoundError } from '@backstage/errors'; +import { stringifyEntityRef, Entity } from '@backstage/catalog-model'; import { Knex } from 'knex'; import { Transaction } from '../../database'; import lodash from 'lodash'; @@ -24,20 +25,21 @@ import { AddUnprocessedEntitiesOptions, UpdateProcessedEntityOptions, GetProcessableEntitiesResult, + ReplaceUnprocessedEntitiesOptions, } from './types'; import type { Logger } from 'winston'; -import { Entity, stringifyEntityRef } from '@backstage/catalog-model'; + import { v4 as uuid } from 'uuid'; export type DbRefreshStateRow = { entity_id: string; entity_ref: string; unprocessed_entity: string; - processed_entity: string; - cache: string; + processed_entity?: string; + cache?: string; next_update_at: string; last_discovery_at: string; // remove? - errors: string; + errors?: string; }; export type DbRelationsRow = { @@ -47,10 +49,10 @@ export type DbRelationsRow = { type: string; }; -export type DbRefreshStateReferences = { - source_special_key?: string; - source_entity_id?: string; - target_entity_id: string; +export type DbRefreshStateReferencesRow = { + source_key?: string; + source_entity_ref?: string; + target_entity_ref: string; }; // The number of items that are sent per batch to the database layer, when @@ -128,6 +130,164 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { ); } + async replaceUnprocessedEntities( + txOpaque: Transaction, + options: ReplaceUnprocessedEntitiesOptions, + ): Promise { + const tx = txOpaque as Knex.Transaction; + const entityIds = new Array(); + + if (options.type === 'full') { + const oldRefs = await tx( + 'refresh_state_references', + ) + .where({ source_key: options.sourceKey }) + .select('target_entity_ref') + .then(rows => rows.map(r => r.target_entity_ref)); + + const items = options.items.map(entity => ({ + entity, + ref: stringifyEntityRef(entity), + id: uuid(), + })); + + const oldRefsSet = new Set(oldRefs); + const newRefsSet = new Set(items.map(item => item.ref)); + const toAdd = items.filter(item => !oldRefsSet.has(item.ref)); + const toRemove = oldRefs.filter(ref => !newRefsSet.has(ref)); + + if (toRemove.length) { + // TODO(freben): Batch split, to not hit variable limits? + + // get all refs where source = any of the toRemove + // delete all state rows matching any of the toRemove + // revisit the targets of all of those refs + // verify if they have references, otherwise delete from refresh_state + + const current = [...toRemove]; + while (true) { + + tx.withRecursive('r', function refs() { + return tx.select({ }) + .from({ r1: 'refresh_state_references' }) + .where({ source_key: options.sourceKey }) + .whereIn('target_entity_ref', toRemove) + .unionAll(function recurse() { + return tx.select({ }) + .from({ r2: 'refresh_state_references' }) + .whereNotExists() + }) + }) + .select().from('refs'); + + const nextLayerToRemove = await tx( + 'refresh_state_references', + ) + .whereIn('source_entity_ref', toRemove) + .leftOuterJoin('refresh_state_references AS b', function f() { + + }) + + .whereNotNull('b.source_target_ref') + .select('target_entity_ref'); + + await tx('refresh_state') + .whereIn('entity_ref', toRemove) + .delete(); + + const refsThatStillHaveASourcePointingAtThe = await tx( + 'refresh_state_references', + ) + .whereIn('target_entity_ref', nextLayerTargetRefs) + .groupBy('target_entity_ref') + .select('target_entity_ref'); + + } + + + + + if (toAdd.length) { + const state: Knex.DbRecord[] = toAdd.map(item => ({ + entity_id: item.id, + entity_ref: item.ref, + unprocessed_entity: JSON.stringify(item.entity), + errors: '', + next_update_at: tx.fn.now(), + last_discovery_at: tx.fn.now(), + })); + const stateReferences: DbRefreshStateReferencesRow[] = toAdd.map( + item => ({ + source_key: options.sourceKey, + target_entity_ref: item.ref, + }), + ); + // TODO(freben): Concurrency? If we did these one by one, a .onConflict().merge would have made sense + await tx.batchInsert('refresh_state', state, BATCH_SIZE); + await tx.batchInsert('refresh_state_references', stateReferences, BATCH_SIZE); + } + + + for (const entity of options.items) { + const entityRef = stringifyEntityRef(entity); + await tx('refresh_state') + .insert({ + entity_id: uuid(), + entity_ref: entityRef, + unprocessed_entity: JSON.stringify(entity), + errors: '', + next_update_at: tx.fn.now(), + last_discovery_at: tx.fn.now(), + }) + .onConflict('entity_ref') + .merge(['unprocessed_entity', 'last_discovery_at']); + + const [{ entity_id: entityId }] = await tx( + 'refresh_state', + ).where({ entity_ref: entityRef }); + entityIds.push(entityId); + } + const referenceRows: DbRefreshStateReferencesRow[] = entityIds.map( + entityId => ({ + source_key: options.sourceKey, + target_entityRef: entityRef, + }), + ); + await tx.batchInsert( + 'refresh_state_references', + referenceRows, + BATCH_SIZE, + ); + return; + } + + for (const entity of options.removed) { + const entityRef = stringifyEntityRef(entity); + const [result] = await tx('refresh_state') + .where({ entity_ref: entityRef }) + .select('entity_id'); + + if (!result) { + this.logger.info( + `Unable to delete entity '${entityRef}', entity does not exist in refresh state`, + ); + continue; + } + + const referenceResults = await tx( + 'refresh_state_references', + ) + // todo correct key? + .where({ source_entity_id: result.entity_id }) + .select(); + + await tx('refresh_state_references') + // todo correct key? + .where({ source_entity_id: result.entity_id }) + .delete(); + } + } + async addUnprocessedEntities( txOpaque: Transaction, options: AddUnprocessedEntitiesOptions, @@ -160,11 +320,11 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { ? { source_special_key: options.id } : { source_entity_id: options.id }; // copied from update refs - await tx('refresh_state_references') + await tx('refresh_state_references') .where(key) .delete(); - const referenceRows: DbRefreshStateReferences[] = entityIds.map( + const referenceRows: DbRefreshStateReferencesRow[] = entityIds.map( entityId => ({ ...key, target_entity_id: entityId, diff --git a/plugins/catalog-backend/src/next/database/types.ts b/plugins/catalog-backend/src/next/database/types.ts index 22e9e90c8e..b926676887 100644 --- a/plugins/catalog-backend/src/next/database/types.ts +++ b/plugins/catalog-backend/src/next/database/types.ts @@ -50,6 +50,19 @@ export type GetProcessableEntitiesResult = { items: RefreshStateItem[]; }; +export type ReplaceUnprocessedEntitiesOptions = + | { + sourceKey: string; + items: Entity[]; + type: 'full'; + } + | { + sourceKey: string; + added: Entity[]; + removed: Entity[]; + type: 'delta'; + }; + export interface ProcessingDatabase { transaction(fn: (tx: Transaction) => Promise): Promise; @@ -58,6 +71,10 @@ export interface ProcessingDatabase { options: AddUnprocessedEntitiesOptions, ): Promise; + replaceUnprocessedEntities( + txOpaque: Transaction, + options: ReplaceUnprocessedEntitiesOptions, + ): Promise; getProcessableEntities( txOpaque: Transaction, request: { processBatchSize: number }, diff --git a/plugins/catalog-backend/src/next/types.ts b/plugins/catalog-backend/src/next/types.ts index c3854d631f..f8b4de1c41 100644 --- a/plugins/catalog-backend/src/next/types.ts +++ b/plugins/catalog-backend/src/next/types.ts @@ -58,8 +58,8 @@ export interface CatalogProcessingEngine { } export type EntityProviderMutation = - | { type: 'full'; entities: Iterable } - | { type: 'delta'; added: Iterable; removed: Iterable }; + | { type: 'full'; entities: Entity[] } + | { type: 'delta'; added: Entity[]; removed: Entity[] }; export interface EntityProviderConnection { applyMutation(mutation: EntityProviderMutation): Promise; @@ -108,14 +108,27 @@ export type AddProcessingItemRequest = { entities: Entity[]; }; -export type ProccessingItem = { +export type ProcessingItem = { id: string; entity: Entity; state: Map; }; +export type ReplaceProcessingItemsRequest = + | { + id: string; + items: Entity[]; + type: 'full'; + } + | { + id: string; + added: Entity[]; + removed: Entity[]; + type: 'delta'; + }; export interface ProcessingStateManager { setProcessingItemResult(result: ProcessingItemResult): Promise; - getNextProcessingItem(): Promise; + getNextProcessingItem(): Promise; addProcessingItems(request: AddProcessingItemRequest): Promise; + replaceProcessingItems(request: ReplaceProcessingItemsRequest): Promise; } From 87ff2b455a9390ff9067fea7e01c20d4f984dcfe Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 23 Apr 2021 15:05:04 +0200 Subject: [PATCH 153/485] feat: added support for full sync replace with an awesome sql statement courtesy of @freben MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: Johan Haals Signed-off-by: blam --- .../20210302150147_refresh_state.js | 3 + .../DefaultProcessingDatabase.test.ts | 271 +++++++++++++++++- .../database/DefaultProcessingDatabase.ts | 220 +++++++------- 3 files changed, 390 insertions(+), 104 deletions(-) diff --git a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js index 14c75b2530..2afeda02c0 100644 --- a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js +++ b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js @@ -94,6 +94,9 @@ exports.up = async function up(knex) { table.comment( 'Holds edges between refresh state rows. Every time when an entity is processed and emits another entity, an edge will be stored to represent that fact. This is used to detect orphans and ultimately deletions.', ); + table + .increments('id') + .comment('Primary key to distinguish unique lines from each other'); table .text('source_key') .nullable() diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts index fd2e9e6750..ee04a2baf8 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts @@ -16,16 +16,283 @@ // import { DefaultProcessingDatabase } from './DefaultProcessingDatabase'; import { DatabaseManager } from './DatabaseManager'; import { Knex } from 'knex'; +import { + DbRefreshStateReferencesRow, + DbRefreshStateRow, + DefaultProcessingDatabase, +} from './DefaultProcessingDatabase'; + +import { Entity } from '@backstage/catalog-model'; +import * as uuid from 'uuid'; +import { getVoidLogger } from '@backstage/backend-common'; describe('Default Processing Database', () => { let db: Knex | undefined; + let processingDatabase: DefaultProcessingDatabase | undefined; + + const logger = getVoidLogger(); beforeEach(async () => { db = await DatabaseManager.createTestDatabaseConnection(); await DatabaseManager.createDatabase(db); + + processingDatabase = new DefaultProcessingDatabase(db!, logger); }); - it('should write some stuff', async () => { - await db('refresh_state_referencess').select(); + describe('replaceUnprocessedEntities', () => { + const insertRefRow = async (ref: DbRefreshStateReferencesRow) => { + return db!( + 'refresh_state_references', + ).insert(ref); + }; + + const insertRefreshStateRow = async (ref: DbRefreshStateRow) => { + await db!('refresh_state').insert(ref); + }; + + const createLocations = async (entityRefs: string[]) => { + for (const ref of entityRefs) { + await insertRefreshStateRow({ + entity_id: uuid.v4(), + entity_ref: ref, + unprocessed_entity: '{}', + processed_entity: '{}', + errors: '', + next_update_at: 'now()', + last_discovery_at: 'now()', + }); + } + }; + + it('replaces all existing state correctly for simple dependency chains', async () => { + /* + config -> location:default/root -> location:default/root-1 -> location:default/root-2 + database -> location:default/second -> location:default/root-2 + */ + await createLocations([ + 'location:default/root', + 'location:default/root-1', + 'location:default/root-2', + 'location:default/second', + ]); + + await insertRefRow({ + source_key: 'config', + target_entity_ref: 'location:default/root', + }); + + await insertRefRow({ + source_key: 'database', + target_entity_ref: 'location:default/second', + }); + + await insertRefRow({ + source_entity_ref: 'location:default/root', + target_entity_ref: 'location:default/root-1', + }); + + await insertRefRow({ + source_entity_ref: 'location:default/root-1', + target_entity_ref: 'location:default/root-2', + }); + + await insertRefRow({ + source_entity_ref: 'location:default/second', + target_entity_ref: 'location:default/root-2', + }); + + await processingDatabase!.transaction(async tx => { + await processingDatabase!.replaceUnprocessedEntities(tx, { + type: 'full', + sourceKey: 'config', + items: [ + { + apiVersion: '1.0.0', + metadata: { + name: 'new-root', + }, + kind: 'Location', + } as Entity, + ], + }); + }); + + const currentRefreshState = await db!( + 'refresh_state', + ).select(); + + const currentRefRowState = await db!( + 'refresh_state_references', + ).select(); + + for (const ref of ['location:default/root', 'location:default/root-1']) { + expect(currentRefreshState.some(t => t.entity_ref === ref)).toBeFalsy(); + } + + expect( + currentRefreshState.some( + t => t.entity_ref === 'location:default/new-root', + ), + ).toBeTruthy(); + + expect( + currentRefRowState.some( + t => + t.source_entity_ref === 'location:default/root' && + t.target_entity_ref === 'location:default/root-1', + ), + ).toBeFalsy(); + + expect( + currentRefRowState.some( + t => + t.source_entity_ref === 'location:default/root-1' && + t.target_entity_ref === 'location:default/root-2', + ), + ).toBeFalsy(); + + expect( + currentRefRowState.some( + t => + t.target_entity_ref === 'location:default/root-1' && + t.source_key === 'config', + ), + ).toBeFalsy(); + + expect( + currentRefRowState.some( + t => + t.target_entity_ref === 'location:default/new-root' && + t.source_key === 'config', + ), + ).toBeTruthy(); + }); + + it('should work for more complex chains', async () => { + /* + config -> location:default/root -> location:default/root-1 -> location:default/root-2 + config -> location:default/root -> location:default/root-1a -> location:default/root-2 + */ + await createLocations([ + 'location:default/root', + 'location:default/root-1', + 'location:default/root-2', + 'location:default/root-1a', + ]); + + await insertRefRow({ + source_key: 'config', + target_entity_ref: 'location:default/root', + }); + + await insertRefRow({ + source_entity_ref: 'location:default/root', + target_entity_ref: 'location:default/root-1', + }); + + await insertRefRow({ + source_entity_ref: 'location:default/root', + target_entity_ref: 'location:default/root-1a', + }); + + await insertRefRow({ + source_entity_ref: 'location:default/root-1', + target_entity_ref: 'location:default/root-2', + }); + + await insertRefRow({ + source_entity_ref: 'location:default/root-1a', + target_entity_ref: 'location:default/root-2', + }); + + await processingDatabase!.transaction(async tx => { + await processingDatabase!.replaceUnprocessedEntities(tx, { + type: 'full', + sourceKey: 'config', + items: [ + { + apiVersion: '1.0.0', + metadata: { + name: 'new-root', + }, + kind: 'Location', + } as Entity, + ], + }); + }); + + const currentRefreshState = await db!( + 'refresh_state', + ).select(); + + const currentRefRowState = await db!( + 'refresh_state_references', + ).select(); + + const deletedRefs = [ + 'location:default/root', + 'location:default/root-1', + 'location:default/root-1a', + 'location:default/root-2', + ]; + + for (const ref of deletedRefs) { + expect(currentRefreshState.some(t => t.entity_ref === ref)).toBeFalsy(); + } + + expect( + currentRefreshState.some( + t => t.entity_ref === 'location:default/new-root', + ), + ).toBeTruthy(); + + expect( + currentRefRowState.some( + t => + t.source_key === 'config' && + t.target_entity_ref === 'location:default/new-root', + ), + ).toBeTruthy(); + + expect( + currentRefRowState.some( + t => + t.source_key === 'config' && + t.target_entity_ref === 'location:default/root', + ), + ).toBeFalsy(); + + expect( + currentRefRowState.some( + t => + t.source_entity_ref === 'location:default/root' && + t.target_entity_ref === 'location:default/root-1', + ), + ).toBeFalsy(); + + expect( + currentRefRowState.some( + t => + t.source_entity_ref === 'location:default/root' && + t.target_entity_ref === 'location:default/root-1a', + ), + ).toBeFalsy(); + + expect( + currentRefRowState.some( + t => + t.source_entity_ref === 'location:default/root-1' && + t.target_entity_ref === 'location:default/root-2', + ), + ).toBeFalsy(); + + expect( + currentRefRowState.some( + t => + t.source_entity_ref === 'location:default/root-1a' && + t.target_entity_ref === 'location:default/root-2', + ), + ).toBeFalsy(); + }); }); }); diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts index b799bd6284..f0c5443651 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts @@ -135,7 +135,6 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { options: ReplaceUnprocessedEntitiesOptions, ): Promise { const tx = txOpaque as Knex.Transaction; - const entityIds = new Array(); if (options.type === 'full') { const oldRefs = await tx( @@ -158,55 +157,95 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { if (toRemove.length) { // TODO(freben): Batch split, to not hit variable limits? - - // get all refs where source = any of the toRemove - // delete all state rows matching any of the toRemove - // revisit the targets of all of those refs - // verify if they have references, otherwise delete from refresh_state - - const current = [...toRemove]; - while (true) { - - tx.withRecursive('r', function refs() { - return tx.select({ }) - .from({ r1: 'refresh_state_references' }) - .where({ source_key: options.sourceKey }) - .whereIn('target_entity_ref', toRemove) - .unionAll(function recurse() { - return tx.select({ }) - .from({ r2: 'refresh_state_references' }) - .whereNotExists() - }) + /* + WITH RECURSIVE + -- All the refs that can be reached from each individual root + root_reach(id, entity_ref) AS ( + -- Start with all roots + SELECT id, target_entity_ref + FROM refresh_state_references + WHERE source_key IS NOT NULL + UNION + -- For each match, select all children + SELECT root_reach.id, target_entity_ref + FROM refresh_state_references, root_reach + WHERE source_entity_ref = root_reach.entity_ref + ) + -- Start out with our own matching row (see the WHERE that + -- matches on source_key and target_entity_ref below) + SELECT us.entity_ref + FROM refresh_state_references + -- Expand the entire tree that emanates from that row + JOIN root_reach AS us + ON us.id = refresh_state_references.id + -- Expand with all roots that target the same node but + -- aren't ourselves + LEFT OUTER JOIN root_reach AS them + ON them.entity_ref = us.entity_ref + AND them.id != us.id + -- Keep only the matches that had no other rooots + WHERE refresh_state_references.source_key = "R1" + AND refresh_state_references.target_entity_ref = "A" + AND them.id IS NULL; + */ + const removedCount = await tx('refresh_state') + .whereIn('entity_ref', function orphanedEntityRefs(orphans) { + return ( + orphans + // All the refs that can be reached from each individual root + .withRecursive('root_reach', function rootReach(outer) { + // Start with all roots + return outer + .select({ id: 'id', entity_ref: 'target_entity_ref' }) + .from('refresh_state_references') + .whereNotNull('source_key') + .union(function recurse(inner) { + return ( + inner + // For each match, select all children + .select({ + id: 'root_reach.id', + entity_ref: + 'refresh_state_references.target_entity_ref', + }) + .from('refresh_state_references') + .crossJoin('root_reach', { + 'root_reach.entity_ref': + 'refresh_state_references.source_entity_ref', + }) + ); + }); + }) + .select('us.entity_ref') + // Start out with our own matching row + .from('refresh_state_references') + .where('source_key', options.sourceKey) + .whereIn('target_entity_ref', toRemove) + // Expand the entire tree that emanates from that row + .leftJoin({ us: 'root_reach' }, function us() { + this.on('us.id', '=', 'refresh_state_references.id'); + }) + // Expand with all roots that target the same node but aren't ourselves + .leftOuterJoin({ them: 'root_reach' }, function them() { + this.on('them.entity_ref', '=', 'us.entity_ref'); + this.andOn('them.id', '!=', 'us.id'); + }) + // Keep only the matches that had no other rooots + .whereNull('them.id') + ); }) - .select().from('refs'); + .delete(); - const nextLayerToRemove = await tx( - 'refresh_state_references', - ) - .whereIn('source_entity_ref', toRemove) - .leftOuterJoin('refresh_state_references AS b', function f() { - - }) - - .whereNotNull('b.source_target_ref') - .select('target_entity_ref'); - - await tx('refresh_state') - .whereIn('entity_ref', toRemove) - .delete(); - - const refsThatStillHaveASourcePointingAtThe = await tx( - 'refresh_state_references', - ) - .whereIn('target_entity_ref', nextLayerTargetRefs) - .groupBy('target_entity_ref') - .select('target_entity_ref'); + await tx('refresh_state_references') + .where('source_key', '=', options.sourceKey) + .whereIn('target_entity_ref', toRemove) + .delete(); + console.log( + `REMOVED, ${removedCount} entities: ${JSON.stringify(toRemove)}`, + ); } - - - if (toAdd.length) { const state: Knex.DbRecord[] = toAdd.map(item => ({ entity_id: item.id, @@ -224,67 +263,44 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { ); // TODO(freben): Concurrency? If we did these one by one, a .onConflict().merge would have made sense await tx.batchInsert('refresh_state', state, BATCH_SIZE); - await tx.batchInsert('refresh_state_references', stateReferences, BATCH_SIZE); - } - - - for (const entity of options.items) { - const entityRef = stringifyEntityRef(entity); - await tx('refresh_state') - .insert({ - entity_id: uuid(), - entity_ref: entityRef, - unprocessed_entity: JSON.stringify(entity), - errors: '', - next_update_at: tx.fn.now(), - last_discovery_at: tx.fn.now(), - }) - .onConflict('entity_ref') - .merge(['unprocessed_entity', 'last_discovery_at']); - - const [{ entity_id: entityId }] = await tx( - 'refresh_state', - ).where({ entity_ref: entityRef }); - entityIds.push(entityId); - } - const referenceRows: DbRefreshStateReferencesRow[] = entityIds.map( - entityId => ({ - source_key: options.sourceKey, - target_entityRef: entityRef, - }), - ); - await tx.batchInsert( - 'refresh_state_references', - referenceRows, - BATCH_SIZE, - ); - return; - } - - for (const entity of options.removed) { - const entityRef = stringifyEntityRef(entity); - const [result] = await tx('refresh_state') - .where({ entity_ref: entityRef }) - .select('entity_id'); - - if (!result) { - this.logger.info( - `Unable to delete entity '${entityRef}', entity does not exist in refresh state`, + await tx.batchInsert( + 'refresh_state_references', + stateReferences, + BATCH_SIZE, ); - continue; } - const referenceResults = await tx( - 'refresh_state_references', - ) - // todo correct key? - .where({ source_entity_id: result.entity_id }) - .select(); + // for (const entity of options.items) { + // const entityRef = stringifyEntityRef(entity); + // await tx('refresh_state') + // .insert({ + // entity_id: uuid(), + // entity_ref: entityRef, + // unprocessed_entity: JSON.stringify(entity), + // errors: '', + // next_update_at: tx.fn.now(), + // last_discovery_at: tx.fn.now(), + // }) + // .onConflict('entity_ref') + // .merge(['unprocessed_entity', 'last_discovery_at']); - await tx('refresh_state_references') - // todo correct key? - .where({ source_entity_id: result.entity_id }) - .delete(); + // const [{ entity_id: entityId }] = await tx( + // 'refresh_state', + // ).where({ entity_ref: entityRef }); + // entityIds.push(entityId); + // } + // const referenceRows: DbRefreshStateReferencesRow[] = entityIds.map( + // entityId => ({ + // source_key: options.sourceKey, + // target_entityRef: entityRef, + // }), + // ); + // await tx.batchInsert( + // 'refresh_state_references', + // referenceRows, + // BATCH_SIZE, + // ); + // return; } } From 3f6c50a5291775994b0f90890f286b0018f74a7e Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 23 Apr 2021 16:01:36 +0200 Subject: [PATCH 154/485] feat: support delta and full sync with the same code and simplify things MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: Johan Haals Signed-off-by: blam --- .../DefaultProcessingDatabase.test.ts | 89 +++++++ .../database/DefaultProcessingDatabase.ts | 242 ++++++++---------- 2 files changed, 201 insertions(+), 130 deletions(-) diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts index ee04a2baf8..c4784c081d 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts @@ -294,5 +294,94 @@ describe('Default Processing Database', () => { ), ).toBeFalsy(); }); + + it('should add new locations using the delta options', async () => { + await processingDatabase!.transaction(async tx => { + await processingDatabase!.replaceUnprocessedEntities(tx, { + type: 'delta', + sourceKey: 'lols', + removed: [], + added: [ + { + apiVersion: '1.0.0', + metadata: { + name: 'new-root', + }, + kind: 'Location', + } as Entity, + ], + }); + }); + + const currentRefreshState = await db!( + 'refresh_state', + ).select(); + + const currentRefRowState = await db!( + 'refresh_state_references', + ).select(); + + expect( + currentRefreshState.some( + t => t.entity_ref === 'location:default/new-root', + ), + ).toBeTruthy(); + + expect( + currentRefRowState.some( + t => + t.source_key === 'lols' && + t.target_entity_ref === 'location:default/new-root', + ), + ).toBeTruthy(); + }); + + it('should remove old locations using the delta options', async () => { + await createLocations(['location:default/new-root']); + + await insertRefRow({ + source_key: 'lols', + target_entity_ref: 'location:default/new-root', + }); + + await processingDatabase!.transaction(async tx => { + await processingDatabase!.replaceUnprocessedEntities(tx, { + type: 'delta', + sourceKey: 'lols', + added: [], + removed: [ + { + apiVersion: '1.0.0', + metadata: { + name: 'new-root', + }, + kind: 'Location', + } as Entity, + ], + }); + }); + + const currentRefreshState = await db!( + 'refresh_state', + ).select(); + + const currentRefRowState = await db!( + 'refresh_state_references', + ).select(); + + expect( + currentRefreshState.some( + t => t.entity_ref === 'location:default/new-root', + ), + ).toBeFalsy(); + + expect( + currentRefRowState.some( + t => + t.source_key === 'lols' && + t.target_entity_ref === 'location:default/new-root', + ), + ).toBeFalsy(); + }); }); }); diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts index f0c5443651..a80325d469 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts @@ -130,34 +130,48 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { ); } + private async createDelta( + tx: Knex.Transaction, + options: ReplaceUnprocessedEntitiesOptions, + ): Promise<{ toAdd: Entity[]; toRemove: string[] }> { + if (options.type === 'delta') { + return { + toAdd: options.added, + toRemove: options.removed.map(e => stringifyEntityRef(e)), + }; + } + + const oldRefs = await tx( + 'refresh_state_references', + ) + .where({ source_key: options.sourceKey }) + .select('target_entity_ref') + .then(rows => rows.map(r => r.target_entity_ref)); + + const items = options.items.map(entity => ({ + entity, + ref: stringifyEntityRef(entity), + })); + + const oldRefsSet = new Set(oldRefs); + const newRefsSet = new Set(items.map(item => item.ref)); + const toAdd = items.filter(item => !oldRefsSet.has(item.ref)); + const toRemove = oldRefs.filter(ref => !newRefsSet.has(ref)); + + return { toAdd: toAdd.map(({ entity }) => entity), toRemove }; + } + async replaceUnprocessedEntities( txOpaque: Transaction, options: ReplaceUnprocessedEntitiesOptions, ): Promise { const tx = txOpaque as Knex.Transaction; - if (options.type === 'full') { - const oldRefs = await tx( - 'refresh_state_references', - ) - .where({ source_key: options.sourceKey }) - .select('target_entity_ref') - .then(rows => rows.map(r => r.target_entity_ref)); + const { toAdd, toRemove } = await this.createDelta(tx, options); - const items = options.items.map(entity => ({ - entity, - ref: stringifyEntityRef(entity), - id: uuid(), - })); - - const oldRefsSet = new Set(oldRefs); - const newRefsSet = new Set(items.map(item => item.ref)); - const toAdd = items.filter(item => !oldRefsSet.has(item.ref)); - const toRemove = oldRefs.filter(ref => !newRefsSet.has(ref)); - - if (toRemove.length) { - // TODO(freben): Batch split, to not hit variable limits? - /* + if (toRemove.length) { + // TODO(freben): Batch split, to not hit variable limits? + /* WITH RECURSIVE -- All the refs that can be reached from each individual root root_reach(id, entity_ref) AS ( @@ -188,119 +202,87 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { AND refresh_state_references.target_entity_ref = "A" AND them.id IS NULL; */ - const removedCount = await tx('refresh_state') - .whereIn('entity_ref', function orphanedEntityRefs(orphans) { - return ( - orphans - // All the refs that can be reached from each individual root - .withRecursive('root_reach', function rootReach(outer) { - // Start with all roots - return outer - .select({ id: 'id', entity_ref: 'target_entity_ref' }) - .from('refresh_state_references') - .whereNotNull('source_key') - .union(function recurse(inner) { - return ( - inner - // For each match, select all children - .select({ - id: 'root_reach.id', - entity_ref: - 'refresh_state_references.target_entity_ref', - }) - .from('refresh_state_references') - .crossJoin('root_reach', { - 'root_reach.entity_ref': - 'refresh_state_references.source_entity_ref', - }) - ); - }); - }) - .select('us.entity_ref') - // Start out with our own matching row - .from('refresh_state_references') - .where('source_key', options.sourceKey) - .whereIn('target_entity_ref', toRemove) - // Expand the entire tree that emanates from that row - .leftJoin({ us: 'root_reach' }, function us() { - this.on('us.id', '=', 'refresh_state_references.id'); - }) - // Expand with all roots that target the same node but aren't ourselves - .leftOuterJoin({ them: 'root_reach' }, function them() { - this.on('them.entity_ref', '=', 'us.entity_ref'); - this.andOn('them.id', '!=', 'us.id'); - }) - // Keep only the matches that had no other rooots - .whereNull('them.id') - ); - }) - .delete(); + const removedCount = await tx('refresh_state') + .whereIn('entity_ref', function orphanedEntityRefs(orphans) { + return ( + orphans + // All the refs that can be reached from each individual root + .withRecursive('root_reach', function rootReach(outer) { + // Start with all roots + return outer + .select({ id: 'id', entity_ref: 'target_entity_ref' }) + .from('refresh_state_references') + .whereNotNull('source_key') + .union(function recurse(inner) { + return ( + inner + // For each match, select all children + .select({ + id: 'root_reach.id', + entity_ref: + 'refresh_state_references.target_entity_ref', + }) + .from('refresh_state_references') + .crossJoin('root_reach', { + 'root_reach.entity_ref': + 'refresh_state_references.source_entity_ref', + }) + ); + }); + }) + .select('us.entity_ref') + // Start out with our own matching row + .from('refresh_state_references') + .where('source_key', options.sourceKey) + .whereIn('target_entity_ref', toRemove) + // Expand the entire tree that emanates from that row + .leftJoin({ us: 'root_reach' }, function us() { + this.on('us.id', '=', 'refresh_state_references.id'); + }) + // Expand with all roots that target the same node but aren't ourselves + .leftOuterJoin({ them: 'root_reach' }, function them() { + this.on('them.entity_ref', '=', 'us.entity_ref'); + this.andOn('them.id', '!=', 'us.id'); + }) + // Keep only the matches that had no other rooots + .whereNull('them.id') + ); + }) + .delete(); - await tx('refresh_state_references') - .where('source_key', '=', options.sourceKey) - .whereIn('target_entity_ref', toRemove) - .delete(); + await tx('refresh_state_references') + .where('source_key', '=', options.sourceKey) + .whereIn('target_entity_ref', toRemove) + .delete(); - console.log( - `REMOVED, ${removedCount} entities: ${JSON.stringify(toRemove)}`, - ); - } + this.logger.debug( + `removed, ${removedCount} entities: ${JSON.stringify(toRemove)}`, + ); + } - if (toAdd.length) { - const state: Knex.DbRecord[] = toAdd.map(item => ({ - entity_id: item.id, - entity_ref: item.ref, - unprocessed_entity: JSON.stringify(item.entity), - errors: '', - next_update_at: tx.fn.now(), - last_discovery_at: tx.fn.now(), - })); - const stateReferences: DbRefreshStateReferencesRow[] = toAdd.map( - item => ({ - source_key: options.sourceKey, - target_entity_ref: item.ref, - }), - ); - // TODO(freben): Concurrency? If we did these one by one, a .onConflict().merge would have made sense - await tx.batchInsert('refresh_state', state, BATCH_SIZE); - await tx.batchInsert( - 'refresh_state_references', - stateReferences, - BATCH_SIZE, - ); - } + if (toAdd.length) { + const state: Knex.DbRecord[] = toAdd.map(entity => ({ + entity_id: uuid(), + entity_ref: stringifyEntityRef(entity), + unprocessed_entity: JSON.stringify(entity), + errors: '', + next_update_at: tx.fn.now(), + last_discovery_at: tx.fn.now(), + })); - // for (const entity of options.items) { - // const entityRef = stringifyEntityRef(entity); - // await tx('refresh_state') - // .insert({ - // entity_id: uuid(), - // entity_ref: entityRef, - // unprocessed_entity: JSON.stringify(entity), - // errors: '', - // next_update_at: tx.fn.now(), - // last_discovery_at: tx.fn.now(), - // }) - // .onConflict('entity_ref') - // .merge(['unprocessed_entity', 'last_discovery_at']); - - // const [{ entity_id: entityId }] = await tx( - // 'refresh_state', - // ).where({ entity_ref: entityRef }); - // entityIds.push(entityId); - // } - // const referenceRows: DbRefreshStateReferencesRow[] = entityIds.map( - // entityId => ({ - // source_key: options.sourceKey, - // target_entityRef: entityRef, - // }), - // ); - // await tx.batchInsert( - // 'refresh_state_references', - // referenceRows, - // BATCH_SIZE, - // ); - // return; + const stateReferences: DbRefreshStateReferencesRow[] = toAdd.map( + entity => ({ + source_key: options.sourceKey, + target_entity_ref: stringifyEntityRef(entity), + }), + ); + // TODO(freben): Concurrency? If we did these one by one, a .onConflict().merge would have made sense + await tx.batchInsert('refresh_state', state, BATCH_SIZE); + await tx.batchInsert( + 'refresh_state_references', + stateReferences, + BATCH_SIZE, + ); } } From 11ef45c0972a439085dbf772057d299dadccc63c Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 26 Apr 2021 10:14:45 +0200 Subject: [PATCH 155/485] catalog-backend: Remove obervables Signed-off-by: Johan Haals --- plugins/catalog-backend/package.json | 4 +- .../src/next/DatabaseLocationProvider.ts | 71 ------------------- .../next/DefaultCatalogProcessingEngine.ts | 27 +------ .../src/next/DefaultLocationStore.ts | 4 -- plugins/catalog-backend/src/next/types.ts | 5 +- 5 files changed, 5 insertions(+), 106 deletions(-) delete mode 100644 plugins/catalog-backend/src/next/DatabaseLocationProvider.ts diff --git a/plugins/catalog-backend/package.json b/plugins/catalog-backend/package.json index 9afb537637..5f70ec60e1 100644 --- a/plugins/catalog-backend/package.json +++ b/plugins/catalog-backend/package.json @@ -33,7 +33,6 @@ "@backstage/backend-common": "^0.6.3", "@backstage/catalog-model": "^0.7.7", "@backstage/config": "^0.1.4", - "@backstage/core": "^0.7.6", "@backstage/errors": "^0.1.1", "@backstage/integration": "^0.5.1", "@backstage/plugin-search-backend-node": "^0.1.3", @@ -61,8 +60,7 @@ "winston": "^3.2.1", "yaml": "^1.9.2", "yn": "^4.0.0", - "yup": "^0.29.3", - "zen-observable": "^0.8.15" + "yup": "^0.29.3" }, "devDependencies": { "@backstage/cli": "^0.6.9", diff --git a/plugins/catalog-backend/src/next/DatabaseLocationProvider.ts b/plugins/catalog-backend/src/next/DatabaseLocationProvider.ts deleted file mode 100644 index eaf5a78556..0000000000 --- a/plugins/catalog-backend/src/next/DatabaseLocationProvider.ts +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 { Observable } from '@backstage/core'; -import { ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model'; -import { EntityProvider, LocationStore, EntityMessage } from './types'; -import ObservableImpl from 'zen-observable'; -import { - locationSpecToLocationEntity, - locationSpecToMetadataName, -} from './util'; - -export class DatabaseLocationProvider implements EntityProvider { - private subscribers = new Set< - ZenObservable.SubscriptionObserver - >(); - - constructor(private readonly store: LocationStore) { - store.location$().subscribe({ - next: locations => { - if ('all' in locations) { - this.notify({ - all: locations.all.map(l => locationSpecToLocationEntity(l)), - }); - } else { - this.notify({ - added: locations.added.map(l => locationSpecToLocationEntity(l)), - removed: locations.removed.map(l => ({ - kind: 'Location', - namespace: ENTITY_DEFAULT_NAMESPACE, - name: locationSpecToMetadataName(l), - })), - }); - } - }, - }); - } - - private notify(message: EntityMessage) { - for (const subscriber of this.subscribers) { - subscriber.next(message); - } - } - - entityChange$(): Observable { - return new ObservableImpl(subscriber => { - this.store.listLocations().then(locations => { - subscriber.next({ - all: locations.map(l => locationSpecToLocationEntity(l)), - }); - this.subscribers.add(subscriber); - }); - return () => { - this.subscribers.delete(subscriber); - }; - }); - } -} diff --git a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts index 7f49bf832d..b71b2c1045 100644 --- a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts +++ b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts @@ -14,11 +14,9 @@ * limitations under the License. */ -import { Subscription } from '@backstage/core'; import { CatalogProcessingEngine, EntityProvider, - EntityMessage, EntityProviderConnection, EntityProviderMutation, ProcessingStateManager, @@ -40,7 +38,7 @@ class Connection implements EntityProviderConnection { async applyMutation(mutation: EntityProviderMutation): Promise { if (mutation.type === 'full') { await this.config.stateManager.replaceProcessingItems({ - id: this.config.id, + sourceKey: this.config.id, type: 'full', items: mutation.entities, }); @@ -49,7 +47,7 @@ class Connection implements EntityProviderConnection { } await this.config.stateManager.replaceProcessingItems({ - id: this.config.id, + sourceKey: this.config.id, type: 'delta', added: mutation.added, removed: mutation.removed, @@ -120,25 +118,4 @@ export class DefaultCatalogProcessingEngine implements CatalogProcessingEngine { async stop() { this.running = false; } - - private async onNext(id: string, message: EntityMessage) { - if ('all' in message) { - // TODO unhandled rejection - await this.stateManager.addProcessingItems({ - id, - type: 'provider', - entities: message.all, - }); - } - - if ('added' in message) { - await this.stateManager.addProcessingItems({ - id, - type: 'provider', - entities: message.added, - }); - - // TODO deletions of message.removed - } - } } diff --git a/plugins/catalog-backend/src/next/DefaultLocationStore.ts b/plugins/catalog-backend/src/next/DefaultLocationStore.ts index dff424b1a9..21206f0a7b 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationStore.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationStore.ts @@ -25,10 +25,6 @@ import { v4 as uuidv4 } from 'uuid'; import { locationSpecToLocationEntity } from './util'; import { ConflictError } from '@backstage/errors'; -export type LocationMessage = - | { all: Location[] } - | { added: Location[]; removed: Location[] }; - export class DefaultLocationStore implements LocationStore, EntityProvider { private _connection: EntityProviderConnection | undefined; diff --git a/plugins/catalog-backend/src/next/types.ts b/plugins/catalog-backend/src/next/types.ts index f8b4de1c41..a39ab9a8ff 100644 --- a/plugins/catalog-backend/src/next/types.ts +++ b/plugins/catalog-backend/src/next/types.ts @@ -16,7 +16,6 @@ import { Entity, - EntityName, LocationSpec, Location, EntityRelationSpec, @@ -116,12 +115,12 @@ export type ProcessingItem = { export type ReplaceProcessingItemsRequest = | { - id: string; + sourceKey: string; items: Entity[]; type: 'full'; } | { - id: string; + sourceKey: string; added: Entity[]; removed: Entity[]; type: 'delta'; From fd7cd5d44959a3bd1d356eca4837dfd419372eb4 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 26 Apr 2021 13:56:32 +0200 Subject: [PATCH 156/485] Refactor deferredEntities processing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: Ben Lambert Signed-off-by: Johan Haals --- .../src/next/DefaultLocationStore.ts | 8 + .../src/next/DefaultProcessingStateManager.ts | 39 ++- .../src/next/NextCatalogBuilder.ts | 1 - plugins/catalog-backend/src/next/Stitcher.ts | 4 +- .../DefaultProcessingDatabase.test.ts | 83 ++++-- .../database/DefaultProcessingDatabase.ts | 236 ++++++++++-------- .../src/next/database/types.ts | 7 +- 7 files changed, 222 insertions(+), 156 deletions(-) diff --git a/plugins/catalog-backend/src/next/DefaultLocationStore.ts b/plugins/catalog-backend/src/next/DefaultLocationStore.ts index 21206f0a7b..40870cff7b 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationStore.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationStore.ts @@ -104,5 +104,13 @@ export class DefaultLocationStore implements LocationStore, EntityProvider { async connect(connection: EntityProviderConnection): Promise { this._connection = connection; + const locations = await this.db.locations(); + const entities = locations.map(location => { + return locationSpecToLocationEntity(location); + }); + await this.connection.applyMutation({ + type: 'full', + entities, + }); } } diff --git a/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts b/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts index d2765c3101..0003b7a7cf 100644 --- a/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts +++ b/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts @@ -49,35 +49,28 @@ export class DefaultProcessingStateManager implements ProcessingStateManager { async addProcessingItems(request: AddProcessingItemRequest) { return this.db.transaction(async tx => { - await this.db.addUnprocessedEntities(tx, request); + // await this.db.addUnprocessedEntities(tx, request); }); } async getNextProcessingItem(): Promise { - const entities = await new Promise(resolve => - this.popFromQueue(resolve), - ); - const { id, state, unprocessedEntity } = entities[0]; - return { - id, - entity: unprocessedEntity, - state, - }; - } - - async popFromQueue(resolve: (rows: RefreshStateItem[]) => void) { - const entities = await this.db.transaction(async tx => { - return this.db.getProcessableEntities(tx, { - processBatchSize: 1, + for (;;) { + const { items } = await this.db.transaction(async tx => { + return this.db.getProcessableEntities(tx, { + processBatchSize: 1, + }); }); - }); - // No entities require refresh, wait and try again. - if (!entities.items.length) { - setTimeout(() => this.popFromQueue(resolve), 1000); - return; + if (items.length) { + const { id, state, unprocessedEntity } = items[0]; + return { + id, + entity: unprocessedEntity, + state, + }; + } + + await new Promise(resolve => setTimeout(resolve, 1000)); } - - resolve(entities.items); } } diff --git a/plugins/catalog-backend/src/next/NextCatalogBuilder.ts b/plugins/catalog-backend/src/next/NextCatalogBuilder.ts index 1796847164..d720bd331a 100644 --- a/plugins/catalog-backend/src/next/NextCatalogBuilder.ts +++ b/plugins/catalog-backend/src/next/NextCatalogBuilder.ts @@ -67,7 +67,6 @@ import { LocationAnalyzer } from '../ingestion/types'; import { DefaultCatalogProcessingEngine } from './DefaultCatalogProcessingEngine'; import { DefaultCatalogProcessingOrchestrator } from './DefaultCatalogProcessingOrchestrator'; import { DefaultProcessingDatabase } from './database/DefaultProcessingDatabase'; -import { DatabaseLocationProvider } from '../next/DatabaseLocationProvider'; import { DefaultLocationStore } from './DefaultLocationStore'; import { DefaultProcessingStateManager } from './DefaultProcessingStateManager'; import { CatalogProcessingEngine } from '../next/types'; diff --git a/plugins/catalog-backend/src/next/Stitcher.ts b/plugins/catalog-backend/src/next/Stitcher.ts index 3e5e3ac24b..f53b7c6fad 100644 --- a/plugins/catalog-backend/src/next/Stitcher.ts +++ b/plugins/catalog-backend/src/next/Stitcher.ts @@ -76,8 +76,8 @@ export class Stitcher { const [reference_count_result] = await tx( 'refresh_state_references', ) - .where({ target_entity_id: entity.metadata.uid }) - .count({ reference_count: 'target_entity_id' }); + .where({ target_entity_ref: entityRef }) + .count({ reference_count: 'target_entity_ref' }); if (Number(reference_count_result.reference_count) === 0) { this.logger.debug(`${entityRef} is orphan`); diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts index c4784c081d..14990a2a79 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts @@ -27,27 +27,26 @@ import * as uuid from 'uuid'; import { getVoidLogger } from '@backstage/backend-common'; describe('Default Processing Database', () => { - let db: Knex | undefined; - let processingDatabase: DefaultProcessingDatabase | undefined; - + let db: Knex; + let processingDatabase: DefaultProcessingDatabase; const logger = getVoidLogger(); beforeEach(async () => { db = await DatabaseManager.createTestDatabaseConnection(); await DatabaseManager.createDatabase(db); - processingDatabase = new DefaultProcessingDatabase(db!, logger); + processingDatabase = new DefaultProcessingDatabase(db, logger); }); describe('replaceUnprocessedEntities', () => { const insertRefRow = async (ref: DbRefreshStateReferencesRow) => { - return db!( - 'refresh_state_references', - ).insert(ref); + return db('refresh_state_references').insert( + ref, + ); }; const insertRefreshStateRow = async (ref: DbRefreshStateRow) => { - await db!('refresh_state').insert(ref); + await db('refresh_state').insert(ref); }; const createLocations = async (entityRefs: string[]) => { @@ -101,8 +100,8 @@ describe('Default Processing Database', () => { target_entity_ref: 'location:default/root-2', }); - await processingDatabase!.transaction(async tx => { - await processingDatabase!.replaceUnprocessedEntities(tx, { + await processingDatabase.transaction(async tx => { + await processingDatabase.replaceUnprocessedEntities(tx, { type: 'full', sourceKey: 'config', items: [ @@ -117,11 +116,11 @@ describe('Default Processing Database', () => { }); }); - const currentRefreshState = await db!( + const currentRefreshState = await db( 'refresh_state', ).select(); - const currentRefRowState = await db!( + const currentRefRowState = await db( 'refresh_state_references', ).select(); @@ -205,8 +204,8 @@ describe('Default Processing Database', () => { target_entity_ref: 'location:default/root-2', }); - await processingDatabase!.transaction(async tx => { - await processingDatabase!.replaceUnprocessedEntities(tx, { + await processingDatabase.transaction(async tx => { + await processingDatabase.replaceUnprocessedEntities(tx, { type: 'full', sourceKey: 'config', items: [ @@ -221,11 +220,11 @@ describe('Default Processing Database', () => { }); }); - const currentRefreshState = await db!( + const currentRefreshState = await db( 'refresh_state', ).select(); - const currentRefRowState = await db!( + const currentRefRowState = await db( 'refresh_state_references', ).select(); @@ -296,8 +295,8 @@ describe('Default Processing Database', () => { }); it('should add new locations using the delta options', async () => { - await processingDatabase!.transaction(async tx => { - await processingDatabase!.replaceUnprocessedEntities(tx, { + await processingDatabase.transaction(async tx => { + await processingDatabase.replaceUnprocessedEntities(tx, { type: 'delta', sourceKey: 'lols', removed: [], @@ -313,11 +312,11 @@ describe('Default Processing Database', () => { }); }); - const currentRefreshState = await db!( + const currentRefreshState = await db( 'refresh_state', ).select(); - const currentRefRowState = await db!( + const currentRefRowState = await db( 'refresh_state_references', ).select(); @@ -336,6 +335,42 @@ describe('Default Processing Database', () => { ).toBeTruthy(); }); + it('should not remove locations that are referenced elsewhere', async () => { + /* + config-1 -> location:default/root + config-2 -> location:default/root + */ + await createLocations(['location:default/root']); + + await insertRefRow({ + source_key: 'config-1', + target_entity_ref: 'location:default/root', + }); + await insertRefRow({ + source_key: 'config-2', + target_entity_ref: 'location:default/root', + }); + + await processingDatabase.transaction(async tx => { + await processingDatabase.replaceUnprocessedEntities(tx, { + type: 'full', + sourceKey: 'config-1', + items: [], + }); + }); + + const currentRefRowState = await db( + 'refresh_state_references', + ).select(); + + expect(currentRefRowState).toEqual({ + source_key: 'config-2', + target_entity_ref: 'location:default/root', + }); + + // TODO: assert that root wasn't removed + }); + it('should remove old locations using the delta options', async () => { await createLocations(['location:default/new-root']); @@ -344,8 +379,8 @@ describe('Default Processing Database', () => { target_entity_ref: 'location:default/new-root', }); - await processingDatabase!.transaction(async tx => { - await processingDatabase!.replaceUnprocessedEntities(tx, { + await processingDatabase.transaction(async tx => { + await processingDatabase.replaceUnprocessedEntities(tx, { type: 'delta', sourceKey: 'lols', added: [], @@ -361,11 +396,11 @@ describe('Default Processing Database', () => { }); }); - const currentRefreshState = await db!( + const currentRefreshState = await db( 'refresh_state', ).select(); - const currentRefRowState = await db!( + const currentRefRowState = await db( 'refresh_state_references', ).select(); diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts index a80325d469..dc5e6036f5 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts @@ -26,10 +26,12 @@ import { UpdateProcessedEntityOptions, GetProcessableEntitiesResult, ReplaceUnprocessedEntitiesOptions, + RefreshStateItem, } from './types'; import type { Logger } from 'winston'; import { v4 as uuid } from 'uuid'; +import { JsonObject } from '@backstage/config'; export type DbRefreshStateRow = { entity_id: string; @@ -88,7 +90,6 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { errors, }) .where('entity_id', id); - if (refreshResult === 0) { throw new NotFoundError(`Processing state not found for ${id}`); } @@ -96,8 +97,7 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { // Schedule all deferred entities for future processing. await this.addUnprocessedEntities(tx, { entities: deferredEntities, - id, - type: 'entity', + entityRef: stringifyEntityRef(processedEntity), }); // Update fragments @@ -172,80 +172,104 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { if (toRemove.length) { // TODO(freben): Batch split, to not hit variable limits? /* - WITH RECURSIVE - -- All the refs that can be reached from each individual root - root_reach(id, entity_ref) AS ( - -- Start with all roots - SELECT id, target_entity_ref - FROM refresh_state_references - WHERE source_key IS NOT NULL - UNION - -- For each match, select all children - SELECT root_reach.id, target_entity_ref - FROM refresh_state_references, root_reach - WHERE source_entity_ref = root_reach.entity_ref - ) - -- Start out with our own matching row (see the WHERE that - -- matches on source_key and target_entity_ref below) - SELECT us.entity_ref - FROM refresh_state_references - -- Expand the entire tree that emanates from that row - JOIN root_reach AS us - ON us.id = refresh_state_references.id - -- Expand with all roots that target the same node but - -- aren't ourselves - LEFT OUTER JOIN root_reach AS them - ON them.entity_ref = us.entity_ref - AND them.id != us.id - -- Keep only the matches that had no other rooots - WHERE refresh_state_references.source_key = "R1" - AND refresh_state_references.target_entity_ref = "A" - AND them.id IS NULL; - */ + WITH RECURSIVE + -- All the nodes that can be reached downwards from our root + descendants(root_id, entity_ref) AS ( + SELECT id, target_entity_ref + FROM refresh_state_references + WHERE source_key = "R1" AND target_entity_ref = "A" + UNION + SELECT descendants.root_id, target_entity_ref + FROM descendants + JOIN refresh_state_references ON source_entity_ref = descendants.entity_ref + ), + -- All the nodes that can be reached upwards from the descendants + ancestors(root_id, via_entity_ref, to_entity_ref) AS ( + SELECT NULL, entity_ref, entity_ref + FROM descendants + UNION + SELECT + CASE WHEN source_key IS NOT NULL THEN id ELSE NULL END, + source_entity_ref, + ancestors.to_entity_ref + FROM ancestors + JOIN refresh_state_references ON target_entity_ref = ancestors.via_entity_ref + ) + -- Start out with all of the descendants + SELECT descendants.entity_ref + FROM descendants + -- Expand with all ancestors that point to those, but aren't the current root + LEFT OUTER JOIN ancestors + ON ancestors.to_entity_ref = descendants.entity_ref + AND ancestors.root_id IS NOT NULL + AND ancestors.root_id != descendants.root_id + -- Exclude all lines that had such a foreign ancestor + WHERE ancestors.root_id IS NULL; + */ const removedCount = await tx('refresh_state') .whereIn('entity_ref', function orphanedEntityRefs(orphans) { return ( orphans - // All the refs that can be reached from each individual root - .withRecursive('root_reach', function rootReach(outer) { - // Start with all roots + // All the nodes that can be reached downwards from our root + .withRecursive('descendants', function descendants(outer) { return outer - .select({ id: 'id', entity_ref: 'target_entity_ref' }) + .select({ root_id: 'id', entity_ref: 'target_entity_ref' }) .from('refresh_state_references') - .whereNotNull('source_key') - .union(function recurse(inner) { - return ( - inner - // For each match, select all children - .select({ - id: 'root_reach.id', - entity_ref: - 'refresh_state_references.target_entity_ref', - }) - .from('refresh_state_references') - .crossJoin('root_reach', { - 'root_reach.entity_ref': - 'refresh_state_references.source_entity_ref', - }) - ); + .where('source_key', options.sourceKey) + .whereIn('target_entity_ref', toRemove) + .union(function recursive(inner) { + return inner + .select({ + root_id: 'descendants.root_id', + entity_ref: + 'refresh_state_references.target_entity_ref', + }) + .from('descendants') + .join('refresh_state_references', { + 'descendants.entity_ref': + 'refresh_state_references.source_entity_ref', + }); }); }) - .select('us.entity_ref') - // Start out with our own matching row - .from('refresh_state_references') - .where('source_key', options.sourceKey) - .whereIn('target_entity_ref', toRemove) - // Expand the entire tree that emanates from that row - .leftJoin({ us: 'root_reach' }, function us() { - this.on('us.id', '=', 'refresh_state_references.id'); + // All the nodes that can be reached upwards from the descendants + .withRecursive('ancestors', function ancestors(outer) { + return outer + .select({ + root_id: tx.raw('NULL', []), + via_entity_ref: 'entity_ref', + to_entity_ref: 'entity_ref', + }) + .from('descendants') + .union(function recursive(inner) { + return inner + .select({ + root_id: tx.raw( + 'CASE WHEN source_key IS NOT NULL THEN id ELSE NULL END', + [], + ), + via_entity_ref: 'source_entity_ref', + to_entity_ref: 'ancestors.to_entity_ref', + }) + .from('ancestors') + .join('refresh_state_references', { + target_entity_ref: 'ancestors.via_entity_ref', + }); + }); }) - // Expand with all roots that target the same node but aren't ourselves - .leftOuterJoin({ them: 'root_reach' }, function them() { - this.on('them.entity_ref', '=', 'us.entity_ref'); - this.andOn('them.id', '!=', 'us.id'); + // Start out with all of the descendants + .select('descendants.entity_ref') + .from('descendants') + // Expand with all ancestors that point to those, but aren't the current root + .leftOuterJoin('ancestors', function keepaliveRoots() { + this.on( + 'ancestors.to_entity_ref', + '=', + 'descendants.entity_ref', + ); + this.andOnNotNull('ancestors.root_id'); + this.andOn('ancestors.root_id', '!=', 'descendants.root_id'); }) - // Keep only the matches that had no other rooots - .whereNull('them.id') + .whereNull('ancestors.root_id') ); }) .delete(); @@ -291,44 +315,45 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { options: AddUnprocessedEntitiesOptions, ): Promise { const tx = txOpaque as Knex.Transaction; - const entityIds = new Array(); - for (const entity of options.entities) { - const entityRef = stringifyEntityRef(entity); - await tx('refresh_state') - .insert({ + const stateRows = options.entities.map( + entity => + ({ entity_id: uuid(), - entity_ref: entityRef, + entity_ref: stringifyEntityRef(entity), unprocessed_entity: JSON.stringify(entity), errors: '', next_update_at: tx.fn.now(), last_discovery_at: tx.fn.now(), - }) + } as Knex.DbRecord), + ); + const stateReferenceRows = stateRows.map( + stateRow => + ({ + source_entity_ref: options.entityRef, + target_entity_ref: stateRow.entity_ref, + } as Knex.DbRecord), + ); + + // Upsert all of the unprocessed entities into the refresh_state table, by + // their entity ref. + // TODO(freben): Can this be batched somehow? + for (const row of stateRows) { + await tx('refresh_state') + .insert(row) .onConflict('entity_ref') .merge(['unprocessed_entity', 'last_discovery_at']); - - const [{ entity_id: entityId }] = await tx( - 'refresh_state', - ).where({ entity_ref: entityRef }); - entityIds.push(entityId); } - const key = - options.type === 'provider' - ? { source_special_key: options.id } - : { source_entity_id: options.id }; - // copied from update refs + // Replace all references for the originating entity before creating new ones await tx('refresh_state_references') - .where(key) + .where({ source_entity_ref: options.entityRef }) .delete(); - - const referenceRows: DbRefreshStateReferencesRow[] = entityIds.map( - entityId => ({ - ...key, - target_entity_id: entityId, - }), + await tx.batchInsert( + 'refresh_state_references', + stateReferenceRows, + BATCH_SIZE, ); - await tx.batchInsert('refresh_state_references', referenceRows, BATCH_SIZE); } async getProcessableEntities( @@ -356,16 +381,23 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { }); return { - items: items.map(i => ({ - id: i.entity_id, - entityRef: i.entity_ref, - unprocessedEntity: JSON.parse(i.unprocessed_entity) as Entity, - processedEntity: JSON.parse(i.processed_entity) as Entity, - nextUpdateAt: i.next_update_at, - lastDiscoveryAt: i.last_discovery_at, - state: JSON.parse(i.cache), - errors: i.errors, - })), + items: items.map( + i => + ({ + id: i.entity_id, + entityRef: i.entity_ref, + unprocessedEntity: JSON.parse(i.unprocessed_entity) as Entity, + processedEntity: i.processed_entity + ? (JSON.parse(i.processed_entity) as Entity) + : undefined, + nextUpdateAt: i.next_update_at, + lastDiscoveryAt: i.last_discovery_at, + state: i.cache + ? JSON.parse(i.cache) + : new Map(), + errors: i.errors, + } as RefreshStateItem), + ), }; } diff --git a/plugins/catalog-backend/src/next/database/types.ts b/plugins/catalog-backend/src/next/database/types.ts index b926676887..d7a1dcd20b 100644 --- a/plugins/catalog-backend/src/next/database/types.ts +++ b/plugins/catalog-backend/src/next/database/types.ts @@ -19,8 +19,7 @@ import { JsonObject } from '@backstage/config'; import { Transaction } from '../../database/types'; export type AddUnprocessedEntitiesOptions = { - type: 'entity' | 'provider'; - id: string; + entityRef: string; entities: Entity[]; }; @@ -39,11 +38,11 @@ export type RefreshStateItem = { id: string; entityRef: string; unprocessedEntity: Entity; - processedEntity: Entity; + processedEntity?: Entity; nextUpdateAt: string; lastDiscoveryAt: string; // remove? state: Map; - errors: string; + errors?: string; }; export type GetProcessableEntitiesResult = { From 19b07a6f67b3c5ba58d11258be9db4a6c2596326 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 26 Apr 2021 14:02:41 +0200 Subject: [PATCH 157/485] Remove addProcessingItems MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: Ben Lambert Co-authored-by: Patrik Oldsberg Signed-off-by: Johan Haals --- plugins/catalog-backend/src/next/Stitcher.ts | 4 ++-- plugins/catalog-backend/src/next/types.ts | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/plugins/catalog-backend/src/next/Stitcher.ts b/plugins/catalog-backend/src/next/Stitcher.ts index f53b7c6fad..57f5ae9167 100644 --- a/plugins/catalog-backend/src/next/Stitcher.ts +++ b/plugins/catalog-backend/src/next/Stitcher.ts @@ -19,7 +19,7 @@ import { Logger } from 'winston'; import { Transaction } from '../database'; import { ConflictError } from '@backstage/errors'; import { - DbRefreshStateReferences, + DbRefreshStateReferencesRow, DbRefreshStateRow, DbRelationsRow, } from './database/DefaultProcessingDatabase'; @@ -73,7 +73,7 @@ export class Stitcher { return; } - const [reference_count_result] = await tx( + const [reference_count_result] = await tx( 'refresh_state_references', ) .where({ target_entity_ref: entityRef }) diff --git a/plugins/catalog-backend/src/next/types.ts b/plugins/catalog-backend/src/next/types.ts index a39ab9a8ff..ef3bab797b 100644 --- a/plugins/catalog-backend/src/next/types.ts +++ b/plugins/catalog-backend/src/next/types.ts @@ -101,12 +101,6 @@ export type ProcessingItemResult = { deferredEntities: Entity[]; }; -export type AddProcessingItemRequest = { - type: 'entity' | 'provider'; - id: string; - entities: Entity[]; -}; - export type ProcessingItem = { id: string; entity: Entity; @@ -128,6 +122,5 @@ export type ReplaceProcessingItemsRequest = export interface ProcessingStateManager { setProcessingItemResult(result: ProcessingItemResult): Promise; getNextProcessingItem(): Promise; - addProcessingItems(request: AddProcessingItemRequest): Promise; replaceProcessingItems(request: ReplaceProcessingItemsRequest): Promise; } From e0c39cd7e308a20f5e91b4cb04283589c5bc2251 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 26 Apr 2021 14:12:57 +0200 Subject: [PATCH 158/485] Add moar tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: Ben Lambert Co-authored-by: Patrik Oldsberg Signed-off-by: Johan Haals --- .../DefaultProcessingDatabase.test.ts | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts index 14990a2a79..f67b8603db 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts @@ -359,16 +359,26 @@ describe('Default Processing Database', () => { }); }); + const currentRefreshState = await db( + 'refresh_state', + ).select(); + const currentRefRowState = await db( 'refresh_state_references', ).select(); - expect(currentRefRowState).toEqual({ - source_key: 'config-2', - target_entity_ref: 'location:default/root', - }); + expect(currentRefRowState).toEqual([ + expect.objectContaining({ + source_key: 'config-2', + target_entity_ref: 'location:default/root', + }), + ]); - // TODO: assert that root wasn't removed + expect(currentRefreshState).toEqual([ + expect.objectContaining({ + entity_ref: 'location:default/root', + }), + ]); }); it('should remove old locations using the delta options', async () => { From ac48004b7d8f60e3389ca30890a4abdc5d00493e Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 26 Apr 2021 14:15:29 +0200 Subject: [PATCH 159/485] Remove dead code Signed-off-by: Johan Haals --- .../src/next/DefaultProcessingStateManager.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts b/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts index 0003b7a7cf..9c1d20ae9c 100644 --- a/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts +++ b/plugins/catalog-backend/src/next/DefaultProcessingStateManager.ts @@ -14,9 +14,8 @@ * limitations under the License. */ -import { ProcessingDatabase, RefreshStateItem } from './database/types'; +import { ProcessingDatabase } from './database/types'; import { - AddProcessingItemRequest, ProcessingItem, ProcessingItemResult, ProcessingStateManager, @@ -47,12 +46,6 @@ export class DefaultProcessingStateManager implements ProcessingStateManager { }); } - async addProcessingItems(request: AddProcessingItemRequest) { - return this.db.transaction(async tx => { - // await this.db.addUnprocessedEntities(tx, request); - }); - } - async getNextProcessingItem(): Promise { for (;;) { const { items } = await this.db.transaction(async tx => { From c58f8fd1477b6ca536d54ce6ef3aae2b92cd944a Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 26 Apr 2021 15:38:31 +0200 Subject: [PATCH 160/485] Add all migration files to migrationsv2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: Ben Lambert Co-authored-by: Patrik Oldsberg Signed-off-by: Johan Haals --- .../migrationsv2/20200511113813_init.js | 133 ++++++++++ ...0200520140700_location_update_log_table.js | 43 ++++ ...7114117_location_update_log_latest_view.js | 45 ++++ .../migrationsv2/20200702153613_entities.js | 236 ++++++++++++++++++ ..._location_update_log_latest_deduplicate.js | 44 ++++ ...904_location_update_log_duplication_fix.js | 87 +++++++ .../20200807120600_entitySearch.js | 41 +++ .../20200809202832_add_bootstrap_location.js | 42 ++++ .../20200923104503_case_insensitivity.js | 32 +++ .../20201005122705_add_entity_full_name.js | 60 +++++ .../20201006130744_entity_data_column.js | 66 +++++ ...6203131_entity_remove_redundant_columns.js | 50 ++++ .../20201007201501_index_entity_search.js | 37 +++ .../20201019130742_add_relations_table.js | 54 ++++ .../20201123205611_relations_table_uniq.js | 93 +++++++ .../migrationsv2/20201210185851_fk_index.js | 45 ++++ .../20201230103504_update_log_varchar.js | 73 ++++++ .../20210209121210_locations_fk_index.js | 45 ++++ .../src/next/database/DatabaseManager.ts | 15 -- 19 files changed, 1226 insertions(+), 15 deletions(-) create mode 100644 plugins/catalog-backend/migrationsv2/20200511113813_init.js create mode 100644 plugins/catalog-backend/migrationsv2/20200520140700_location_update_log_table.js create mode 100644 plugins/catalog-backend/migrationsv2/20200527114117_location_update_log_latest_view.js create mode 100644 plugins/catalog-backend/migrationsv2/20200702153613_entities.js create mode 100644 plugins/catalog-backend/migrationsv2/20200721115244_location_update_log_latest_deduplicate.js create mode 100644 plugins/catalog-backend/migrationsv2/20200805163904_location_update_log_duplication_fix.js create mode 100644 plugins/catalog-backend/migrationsv2/20200807120600_entitySearch.js create mode 100644 plugins/catalog-backend/migrationsv2/20200809202832_add_bootstrap_location.js create mode 100644 plugins/catalog-backend/migrationsv2/20200923104503_case_insensitivity.js create mode 100644 plugins/catalog-backend/migrationsv2/20201005122705_add_entity_full_name.js create mode 100644 plugins/catalog-backend/migrationsv2/20201006130744_entity_data_column.js create mode 100644 plugins/catalog-backend/migrationsv2/20201006203131_entity_remove_redundant_columns.js create mode 100644 plugins/catalog-backend/migrationsv2/20201007201501_index_entity_search.js create mode 100644 plugins/catalog-backend/migrationsv2/20201019130742_add_relations_table.js create mode 100644 plugins/catalog-backend/migrationsv2/20201123205611_relations_table_uniq.js create mode 100644 plugins/catalog-backend/migrationsv2/20201210185851_fk_index.js create mode 100644 plugins/catalog-backend/migrationsv2/20201230103504_update_log_varchar.js create mode 100644 plugins/catalog-backend/migrationsv2/20210209121210_locations_fk_index.js diff --git a/plugins/catalog-backend/migrationsv2/20200511113813_init.js b/plugins/catalog-backend/migrationsv2/20200511113813_init.js new file mode 100644 index 0000000000..7f3d75e35c --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20200511113813_init.js @@ -0,0 +1,133 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + return ( + knex.schema + // + // locations + // + .createTable('locations', table => { + table.comment( + 'Registered locations that shall be contiuously scanned for catalog item updates', + ); + table + .uuid('id') + .primary() + .notNullable() + .comment('Auto-generated ID of the location'); + table.string('type').notNullable().comment('The type of location'); + table + .string('target') + .notNullable() + .comment('The actual target of the location'); + }) + // + // entities + // + .createTable('entities', table => { + table.comment('All entities currently stored in the catalog'); + table.uuid('id').primary().comment('Auto-generated ID of the entity'); + table + .uuid('location_id') + .references('id') + .inTable('locations') + .nullable() + .comment('The location that originated the entity'); + table + .string('etag') + .notNullable() + .comment( + 'An opaque string that changes for each update operation to any part of the entity, including metadata.', + ); + table + .string('generation') + .notNullable() + .unsigned() + .comment( + 'A positive nonzero number that indicates the current generation of data for this entity; the value is incremented each time the spec changes.', + ); + table + .string('api_version') + .notNullable() + .comment('The apiVersion field of the entity'); + table + .string('kind') + .notNullable() + .comment('The kind field of the entity'); + table + .string('name') + .nullable() + .comment('The metadata.name field of the entity'); + table + .string('namespace') + .nullable() + .comment('The metadata.namespace field of the entity'); + table + .string('metadata') + .notNullable() + .comment('The entire metadata JSON blob of the entity'); + table + .string('spec') + .nullable() + .comment('The entire spec JSON blob of the entity'); + }) + .alterTable('entities', table => { + // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#objectmeta-v1-meta + table.unique(['kind', 'name', 'namespace'], 'entities_unique_name'); + }) + // + // entities_search + // + .createTable('entities_search', table => { + table.comment( + 'Flattened key-values from the entities, used for quick filtering', + ); + table + .uuid('entity_id') + .references('id') + .inTable('entities') + .onDelete('CASCADE') + .comment('The entity that matches this key/value'); + table + .string('key') + .notNullable() + .comment('A key that occurs in the entity'); + table + .string('value') + .nullable() + .comment('The corresponding value to match on'); + }) + ); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + return knex.schema + .dropTable('entities_search') + .alterTable('entities', table => { + table.dropUnique([], 'entities_unique_name'); + }) + .dropTable('entities') + .dropTable('locations'); +}; diff --git a/plugins/catalog-backend/migrationsv2/20200520140700_location_update_log_table.js b/plugins/catalog-backend/migrationsv2/20200520140700_location_update_log_table.js new file mode 100644 index 0000000000..d8093fc9b4 --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20200520140700_location_update_log_table.js @@ -0,0 +1,43 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + return knex.schema.createTable('location_update_log', table => { + table.uuid('id').primary(); + table.enum('status', ['success', 'fail']).notNullable(); + table.dateTime('created_at').defaultTo(knex.fn.now()).notNullable(); + table.string('message'); + table + .uuid('location_id') + .references('id') + .inTable('locations') + .onUpdate('CASCADE') + .onDelete('CASCADE'); + table.string('entity_name').nullable(); + }); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + return knex.schema.dropTableIfExists('location_update_log'); +}; diff --git a/plugins/catalog-backend/migrationsv2/20200527114117_location_update_log_latest_view.js b/plugins/catalog-backend/migrationsv2/20200527114117_location_update_log_latest_view.js new file mode 100644 index 0000000000..a0f0f33a65 --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20200527114117_location_update_log_latest_view.js @@ -0,0 +1,45 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + // Get list sorted by created_at timestamp in descending order + // Grouped by location_id + return knex.schema.raw(` + CREATE VIEW location_update_log_latest AS + SELECT t1.* FROM location_update_log t1 + JOIN + ( + SELECT location_id, MAX(created_at) AS MAXDATE + FROM location_update_log + GROUP BY location_id + ) t2 + ON t1.location_id = t2.location_id + AND t1.created_at = t2.MAXDATE + ORDER BY created_at DESC; + `); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + return knex.schema.raw(`DROP VIEW location_update_log_latest;`); +}; diff --git a/plugins/catalog-backend/migrationsv2/20200702153613_entities.js b/plugins/catalog-backend/migrationsv2/20200702153613_entities.js new file mode 100644 index 0000000000..0f1c204f9b --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20200702153613_entities.js @@ -0,0 +1,236 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + // SQLite does not support FK and PK + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('entities_search', table => { + table.dropForeign(['entity_id']); + }); + await knex.schema.alterTable('entities', table => { + table.dropPrimary('entities_pkey'); + }); + } + await knex.schema.alterTable('entities', table => { + table.dropUnique([], 'entities_unique_name'); + }); + // Setup temporary tables + await knex.schema.renameTable('entities_search', 'tmp_entities_search'); + await knex.schema.renameTable('entities', 'tmp_entities'); + + // + // entities + // + await knex.schema + .createTable('entities', table => { + table.comment('All entities currently stored in the catalog'); + table.uuid('id').primary().comment('Auto-generated ID of the entity'); + table + .uuid('location_id') + .references('id') + .inTable('locations') + .nullable() + .comment('The location that originated the entity'); + table + .string('etag') + .notNullable() + .comment( + 'An opaque string that changes for each update operation to any part of the entity, including metadata.', + ); + table + .string('generation') + .notNullable() + .unsigned() + .comment( + 'A positive nonzero number that indicates the current generation of data for this entity; the value is incremented each time the spec changes.', + ); + table + .string('api_version') + .notNullable() + .comment('The apiVersion field of the entity'); + table + .string('kind') + .notNullable() + .comment('The kind field of the entity'); + table + .string('name') + .nullable() + .comment('The metadata.name field of the entity'); + table + .string('namespace') + .nullable() + .comment('The metadata.namespace field of the entity'); + table + .text('metadata') + .notNullable() + .comment('The entire metadata JSON blob of the entity'); + table + .text('spec') + .nullable() + .comment('The entire spec JSON blob of the entity'); + }) + .alterTable('entities', table => { + // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#objectmeta-v1-meta + table.unique(['kind', 'name', 'namespace'], 'entities_unique_name'); + }); + + await knex.schema.raw(`INSERT INTO entities SELECT * FROM tmp_entities`); + + // + // entities_search + // + await knex.schema.createTable('entities_search', table => { + table.comment( + 'Flattened key-values from the entities, used for quick filtering', + ); + table + .uuid('entity_id') + .references('id') + .inTable('entities') + .onDelete('CASCADE') + .comment('The entity that matches this key/value'); + table + .string('key') + .notNullable() + .comment('A key that occurs in the entity'); + table + .string('value') + .nullable() + .comment('The corresponding value to match on'); + }); + await knex.schema.raw( + `INSERT INTO entities_search SELECT * FROM tmp_entities_search`, + ); + + // Clean up + await knex.schema.dropTable('tmp_entities'); + return knex.schema.dropTable('tmp_entities_search'); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + // SQLite does not support FK and PK + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('entities_search', table => { + table.dropForeign(['entity_id']); + }); + await knex.schema.alterTable('entities', table => { + table.dropPrimary('entities_pkey'); + }); + } + await knex.schema.alterTable('entities', table => { + table.dropUnique([], 'entities_unique_name'); + }); + + // Setup temporary tables + await knex.schema.renameTable('entities_search', 'tmp_entities_search'); + await knex.schema.renameTable('entities', 'tmp_entities'); + + // + // entities + // + await knex.schema + .createTable('entities', table => { + table.comment('All entities currently stored in the catalog'); + table.uuid('id').primary().comment('Auto-generated ID of the entity'); + table + .uuid('location_id') + .references('id') + .inTable('locations') + .nullable() + .comment('The location that originated the entity'); + table + .string('etag') + .notNullable() + .comment( + 'An opaque string that changes for each update operation to any part of the entity, including metadata.', + ); + table + .string('generation') + .notNullable() + .unsigned() + .comment( + 'A positive nonzero number that indicates the current generation of data for this entity; the value is incremented each time the spec changes.', + ); + table + .string('api_version') + .notNullable() + .comment('The apiVersion field of the entity'); + table + .string('kind') + .notNullable() + .comment('The kind field of the entity'); + table + .string('name') + .nullable() + .comment('The metadata.name field of the entity'); + table + .string('namespace') + .nullable() + .comment('The metadata.namespace field of the entity'); + table + .string('metadata') + .notNullable() + .comment('The entire metadata JSON blob of the entity'); + table + .string('spec') + .nullable() + .comment('The entire spec JSON blob of the entity'); + }) + .alterTable('entities', table => { + // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#objectmeta-v1-meta + table.unique(['kind', 'name', 'namespace'], 'entities_unique_name'); + }); + + await knex.schema.raw(`INSERT INTO entities SELECT * FROM tmp_entities`); + + // + // entities_search + // + await knex.schema.createTable('entities_search', table => { + table.comment( + 'Flattened key-values from the entities, used for quick filtering', + ); + table + .uuid('entity_id') + .references('id') + .inTable('entities') + .onDelete('CASCADE') + .comment('The entity that matches this key/value'); + table + .string('key') + .notNullable() + .comment('A key that occurs in the entity'); + table + .string('value') + .nullable() + .comment('The corresponding value to match on'); + }); + await knex.schema.raw( + `INSERT INTO entities_search SELECT * FROM tmp_entities_search`, + ); + + // Clean up + await knex.schema.dropTable('tmp_entities'); + return knex.schema.dropTable('tmp_entities_search'); +}; diff --git a/plugins/catalog-backend/migrationsv2/20200721115244_location_update_log_latest_deduplicate.js b/plugins/catalog-backend/migrationsv2/20200721115244_location_update_log_latest_deduplicate.js new file mode 100644 index 0000000000..87b41a80fc --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20200721115244_location_update_log_latest_deduplicate.js @@ -0,0 +1,44 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = function up(knex) { + return knex.schema.raw(`DROP VIEW location_update_log_latest;`).raw(` + CREATE VIEW location_update_log_latest AS + SELECT t1.* FROM location_update_log t1 + JOIN + ( + SELECT location_id, MAX(created_at) AS MAXDATE + FROM location_update_log + GROUP BY location_id + ) t2 + ON t1.location_id = t2.location_id + AND t1.created_at = t2.MAXDATE + GROUP BY t1.location_id, t1.id + ORDER BY created_at DESC; +`); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = function down(knex) { + knex.schema.raw(`DROP VIEW location_update_log_latest;`); +}; diff --git a/plugins/catalog-backend/migrationsv2/20200805163904_location_update_log_duplication_fix.js b/plugins/catalog-backend/migrationsv2/20200805163904_location_update_log_duplication_fix.js new file mode 100644 index 0000000000..de2b194cff --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20200805163904_location_update_log_duplication_fix.js @@ -0,0 +1,87 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = function up(knex) { + return knex.schema + .raw('DROP VIEW location_update_log_latest;') + .dropTable('location_update_log') + .createTable('location_update_log', table => { + table.bigIncrements('id').primary(); // instead of uuid, so we can MAX it + table.enum('status', ['success', 'fail']).notNullable(); + table.dateTime('created_at').defaultTo(knex.fn.now()).notNullable(); + table.string('message'); + table + .uuid('location_id') + .references('id') + .inTable('locations') + .onUpdate('CASCADE') + .onDelete('CASCADE'); + table.string('entity_name').nullable(); + }).raw(` + CREATE VIEW location_update_log_latest AS + SELECT t1.* FROM location_update_log t1 + JOIN + ( + SELECT location_id, MAX(id) AS MAXID + FROM location_update_log + GROUP BY location_id + ) t2 + ON t1.location_id = t2.location_id + AND t1.id = t2.MAXID + GROUP BY t1.location_id, t1.id + ORDER BY created_at DESC; + `); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = function down(knex) { + return knex.schema + .raw('DROP VIEW location_update_log_latest;') + .dropTable('location_update_log') + .createTable('location_update_log', table => { + table.uuid('id').primary(); + table.enum('status', ['success', 'fail']).notNullable(); + table.dateTime('created_at').defaultTo(knex.fn.now()).notNullable(); + table.string('message'); + table + .uuid('location_id') + .references('id') + .inTable('locations') + .onUpdate('CASCADE') + .onDelete('CASCADE'); + table.string('entity_name').nullable(); + }).raw(` + CREATE VIEW location_update_log_latest AS + SELECT t1.* FROM location_update_log t1 + JOIN + ( + SELECT location_id, MAX(created_at) AS MAXDATE + FROM location_update_log + GROUP BY location_id + ) t2 + ON t1.location_id = t2.location_id + AND t1.created_at = t2.MAXDATE + GROUP BY t1.location_id, t1.id + ORDER BY created_at DESC; + `); +}; diff --git a/plugins/catalog-backend/migrationsv2/20200807120600_entitySearch.js b/plugins/catalog-backend/migrationsv2/20200807120600_entitySearch.js new file mode 100644 index 0000000000..45226e53b4 --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20200807120600_entitySearch.js @@ -0,0 +1,41 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + // Sqlite does not support alter column. + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('entities_search', table => { + table.text('value').nullable().alter(); + }); + } +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + // Sqlite does not support alter column. + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('entities_search', table => { + table.string('value').nullable().alter(); + }); + } +}; diff --git a/plugins/catalog-backend/migrationsv2/20200809202832_add_bootstrap_location.js b/plugins/catalog-backend/migrationsv2/20200809202832_add_bootstrap_location.js new file mode 100644 index 0000000000..a90813fe85 --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20200809202832_add_bootstrap_location.js @@ -0,0 +1,42 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + // Adds a single 'bootstrap' location that can be used to trigger work in processors. + // This is primarily here to fulfill foreign key constraints. + await knex('locations').insert({ + id: require('uuid').v4(), + type: 'bootstrap', + target: 'bootstrap', + }); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + await knex('locations') + .where({ + type: 'bootstrap', + target: 'bootstrap', + }) + .del(); +}; diff --git a/plugins/catalog-backend/migrationsv2/20200923104503_case_insensitivity.js b/plugins/catalog-backend/migrationsv2/20200923104503_case_insensitivity.js new file mode 100644 index 0000000000..ea5ba9e58d --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20200923104503_case_insensitivity.js @@ -0,0 +1,32 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + await knex('entities') + .where({ namespace: null }) + .update({ namespace: 'default' }); + await knex('entities_search').update({ + key: knex.raw('LOWER(key)'), + value: knex.raw('LOWER(value)'), + }); +}; + +exports.down = async function down() {}; diff --git a/plugins/catalog-backend/migrationsv2/20201005122705_add_entity_full_name.js b/plugins/catalog-backend/migrationsv2/20201005122705_add_entity_full_name.js new file mode 100644 index 0000000000..aae1861658 --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20201005122705_add_entity_full_name.js @@ -0,0 +1,60 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + await knex.schema.alterTable('entities', table => { + table.text('full_name').nullable(); + }); + + await knex('entities').update({ + full_name: knex.raw( + "LOWER(kind) || ':' || LOWER(COALESCE(namespace, 'default')) || '/' || LOWER(name)", + ), + }); + + // SQLite does not support alter column + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('entities', table => { + table.text('full_name').notNullable().alter(); + }); + } + + await knex.schema.alterTable('entities', table => { + // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#objectmeta-v1-meta + table.unique(['full_name'], 'entities_unique_full_name'); + table.dropUnique([], 'entities_unique_name'); + }); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + await knex.schema.alterTable('entities', table => { + // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#objectmeta-v1-meta + table.dropUnique([], 'entities_unique_full_name'); + table.unique(['kind', 'namespace', 'name'], 'entities_unique_name'); + }); + + await knex.schema.alterTable('entities_search', table => { + table.dropColumn('full_name'); + }); +}; diff --git a/plugins/catalog-backend/migrationsv2/20201006130744_entity_data_column.js b/plugins/catalog-backend/migrationsv2/20201006130744_entity_data_column.js new file mode 100644 index 0000000000..a8964efbf6 --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20201006130744_entity_data_column.js @@ -0,0 +1,66 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + await knex.schema.alterTable('entities', table => { + table + .text('data') + .nullable() + .comment('The entire JSON data blob of the entity'); + }); + + await knex('entities').update({ + // apiVersion and kind should not contain any JSON unsafe chars, and both + // metadata and spec are already valid serialized JSON + data: knex.raw( + `'{"apiVersion":"' || api_version || '","kind":"' || kind || '","metadata":' || metadata || COALESCE(',"spec":' || spec, '') || '}'`, + ), + }); + + await knex.schema.alterTable('entities', table => { + table.dropColumn('metadata'); + table.dropColumn('spec'); + }); + + // SQLite does not support ALTER COLUMN. + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('entities', table => { + table.text('data').notNullable().alter(); + }); + } +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + await knex.schema.alterTable('entities', table => { + table + .text('metadata') + .notNullable() + .comment('The entire metadata JSON blob of the entity'); + table + .text('spec') + .nullable() + .comment('The entire spec JSON blob of the entity'); + table.dropColumn('data'); + }); +}; diff --git a/plugins/catalog-backend/migrationsv2/20201006203131_entity_remove_redundant_columns.js b/plugins/catalog-backend/migrationsv2/20201006203131_entity_remove_redundant_columns.js new file mode 100644 index 0000000000..f40df5f73e --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20201006203131_entity_remove_redundant_columns.js @@ -0,0 +1,50 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + await knex.schema.alterTable('entities', table => { + table.dropColumn('api_version'); + table.dropColumn('kind'); + table.dropColumn('name'); + table.dropColumn('namespace'); + }); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + await knex.schema.alterTable('entities', table => { + table + .string('api_version') + .notNullable() + .comment('The apiVersion field of the entity'); + table.string('kind').notNullable().comment('The kind field of the entity'); + table + .string('name') + .nullable() + .comment('The metadata.name field of the entity'); + table + .string('namespace') + .nullable() + .comment('The metadata.namespace field of the entity'); + }); +}; diff --git a/plugins/catalog-backend/migrationsv2/20201007201501_index_entity_search.js b/plugins/catalog-backend/migrationsv2/20201007201501_index_entity_search.js new file mode 100644 index 0000000000..77bf0529eb --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20201007201501_index_entity_search.js @@ -0,0 +1,37 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + await knex.schema.alterTable('entities_search', table => { + table.index(['key'], 'entities_search_key'); + table.index(['value'], 'entities_search_value'); + }); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + await knex.schema.alterTable('entities_search', table => { + table.dropIndex('', 'entities_search_key'); + table.dropIndex('', 'entities_search_value'); + }); +}; diff --git a/plugins/catalog-backend/migrationsv2/20201019130742_add_relations_table.js b/plugins/catalog-backend/migrationsv2/20201019130742_add_relations_table.js new file mode 100644 index 0000000000..85e729f814 --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20201019130742_add_relations_table.js @@ -0,0 +1,54 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + await knex.schema.createTable('entities_relations', table => { + table.comment('All relations between entities in the catalog'); + table + .uuid('originating_entity_id') + .references('id') + .inTable('entities') + .onDelete('CASCADE') + .notNullable() + .comment('The entity that provided the relation'); + table + .string('source_full_name') + .notNullable() + .comment('The full name of the source entity of the relation'); + table + .string('type') + .notNullable() + .comment('The type of the relation between the entities'); + table + .string('target_full_name') + .notNullable() + .comment('The full name of the target entity of the relation'); + + table.primary(['source_full_name', 'type', 'target_full_name']); + }); +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + await knex.schema.dropTable('entities_relations'); +}; diff --git a/plugins/catalog-backend/migrationsv2/20201123205611_relations_table_uniq.js b/plugins/catalog-backend/migrationsv2/20201123205611_relations_table_uniq.js new file mode 100644 index 0000000000..9e8198b5eb --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20201123205611_relations_table_uniq.js @@ -0,0 +1,93 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + if (knex.client.config.client === 'sqlite3') { + // sqlite doesn't support dropPrimary so we recreate it properly instead + await knex.schema.dropTable('entities_relations'); + await knex.schema.createTable('entities_relations', table => { + table.comment('All relations between entities in the catalog'); + table + .uuid('originating_entity_id') + .references('id') + .inTable('entities') + .onDelete('CASCADE') + .notNullable() + .comment('The entity that provided the relation'); + table + .string('source_full_name') + .notNullable() + .comment('The full name of the source entity of the relation'); + table + .string('type') + .notNullable() + .comment('The type of the relation between the entities'); + table + .string('target_full_name') + .notNullable() + .comment('The full name of the target entity of the relation'); + table.index('source_full_name', 'source_full_name_idx'); + }); + } else { + await knex.schema.alterTable('entities_relations', table => { + table.dropPrimary(); + table.index('source_full_name', 'source_full_name_idx'); + }); + } +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + if (knex.client.config.client === 'sqlite3') { + await knex.schema.dropTable('entities_relations'); + await knex.schema.createTable('entities_relations', table => { + table.comment('All relations between entities in the catalog'); + table + .uuid('originating_entity_id') + .references('id') + .inTable('entities') + .onDelete('CASCADE') + .notNullable() + .comment('The entity that provided the relation'); + table + .string('source_full_name') + .notNullable() + .comment('The full name of the source entity of the relation'); + table + .string('type') + .notNullable() + .comment('The type of the relation between the entities'); + table + .string('target_full_name') + .notNullable() + .comment('The full name of the target entity of the relation'); + + table.primary(['source_full_name', 'type', 'target_full_name']); + }); + } else { + await knex.schema.alterTable('entities_relations', table => { + table.dropIndex([], 'source_full_name_idx'); + table.primary(['source_full_name', 'type', 'target_full_name']); + }); + } +}; diff --git a/plugins/catalog-backend/migrationsv2/20201210185851_fk_index.js b/plugins/catalog-backend/migrationsv2/20201210185851_fk_index.js new file mode 100644 index 0000000000..abb26cd5fc --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20201210185851_fk_index.js @@ -0,0 +1,45 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('entities_relations', table => { + table.index('originating_entity_id', 'originating_entity_id_idx'); + }); + await knex.schema.alterTable('entities_search', table => { + table.index('entity_id', 'entity_id_idx'); + }); + } +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('entities_relations', table => { + table.dropIndex([], 'originating_entity_id_idx'); + }); + await knex.schema.alterTable('entities_relations', table => { + table.dropIndex([], 'entity_id_idx'); + }); + } +}; diff --git a/plugins/catalog-backend/migrationsv2/20201230103504_update_log_varchar.js b/plugins/catalog-backend/migrationsv2/20201230103504_update_log_varchar.js new file mode 100644 index 0000000000..d924b0414a --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20201230103504_update_log_varchar.js @@ -0,0 +1,73 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + if (knex.client.config.client !== 'sqlite3') { + // We actually just want to widen columns, but can't do that while a + // view is dependent on them - so we just reconstruct it exactly as it was + await knex.schema + .raw('DROP VIEW location_update_log_latest;') + .alterTable('location_update_log', table => { + table.text('message').alter(); + table.text('entity_name').nullable().alter(); + }).raw(` + CREATE VIEW location_update_log_latest AS + SELECT t1.* FROM location_update_log t1 + JOIN + ( + SELECT location_id, MAX(id) AS MAXID + FROM location_update_log + GROUP BY location_id + ) t2 + ON t1.location_id = t2.location_id + AND t1.id = t2.MAXID + GROUP BY t1.location_id, t1.id + ORDER BY created_at DESC; + `); + } +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + if (knex.client.config.client !== 'sqlite3') { + await knex.schema + .raw('DROP VIEW location_update_log_latest;') + .alterTable('location_update_log', table => { + table.string('message').alter(); + table.string('entity_name').nullable().alter(); + }).raw(` + CREATE VIEW location_update_log_latest AS + SELECT t1.* FROM location_update_log t1 + JOIN + ( + SELECT location_id, MAX(id) AS MAXID + FROM location_update_log + GROUP BY location_id + ) t2 + ON t1.location_id = t2.location_id + AND t1.id = t2.MAXID + GROUP BY t1.location_id, t1.id + ORDER BY created_at DESC; + `); + } +}; diff --git a/plugins/catalog-backend/migrationsv2/20210209121210_locations_fk_index.js b/plugins/catalog-backend/migrationsv2/20210209121210_locations_fk_index.js new file mode 100644 index 0000000000..ccfb1faffb --- /dev/null +++ b/plugins/catalog-backend/migrationsv2/20210209121210_locations_fk_index.js @@ -0,0 +1,45 @@ +/* + * Copyright 2020 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. + */ + +// @ts-check + +/** + * @param {import('knex').Knex} knex + */ +exports.up = async function up(knex) { + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('entities', table => { + table.index('location_id', 'entity_location_id_idx'); + }); + await knex.schema.alterTable('location_update_log', table => { + table.index('location_id', 'update_log_location_id_idx'); + }); + } +}; + +/** + * @param {import('knex').Knex} knex + */ +exports.down = async function down(knex) { + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable('entities', table => { + table.dropIndex([], 'entity_location_id_idx'); + }); + await knex.schema.alterTable('location_update_log', table => { + table.dropIndex([], 'update_log_location_id_idx'); + }); + } +}; diff --git a/plugins/catalog-backend/src/next/database/DatabaseManager.ts b/plugins/catalog-backend/src/next/database/DatabaseManager.ts index 4c9e45950f..f660f73ecb 100644 --- a/plugins/catalog-backend/src/next/database/DatabaseManager.ts +++ b/plugins/catalog-backend/src/next/database/DatabaseManager.ts @@ -20,7 +20,6 @@ import { v4 as uuidv4 } from 'uuid'; import { Logger } from 'winston'; import { CommonDatabase } from '../../database/CommonDatabase'; import { Database } from '../../database/types'; -import fs from 'fs-extra'; export type CreateDatabaseOptions = { logger: Logger; @@ -35,16 +34,10 @@ export class DatabaseManager { knex: Knex, options: Partial = {}, ): Promise { - const allMigrations = resolvePackagePath( - '@backstage/plugin-catalog-backend', - 'migrations', - ); - const migrationsDir = resolvePackagePath( '@backstage/plugin-catalog-backend', 'migrationsv2', ); - await fs.copy(allMigrations, migrationsDir); await knex.migrate.latest({ directory: migrationsDir, @@ -79,14 +72,6 @@ export class DatabaseManager { public static async createTestDatabaseConnection(): Promise { const config: Knex.Config = { - /* - client: 'pg', - connection: { - host: 'localhost', - user: 'postgres', - password: 'postgres', - }, - */ client: 'sqlite3', connection: ':memory:', useNullAsDefault: true, From aad89f55460c1d9f96165d677e188edd7d304daf Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 26 Apr 2021 15:43:22 +0200 Subject: [PATCH 161/485] Add configLocationProvider and provider identifiers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: Ben Lambert Co-authored-by: Patrik Oldsberg Signed-off-by: Johan Haals --- .../src/next/ConfigLocationProvider.ts | 49 +++++++++++++++++++ .../next/DefaultCatalogProcessingEngine.ts | 9 ++-- .../src/next/DefaultLocationStore.ts | 4 ++ .../src/next/NextCatalogBuilder.ts | 7 +-- plugins/catalog-backend/src/next/types.ts | 1 + 5 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 plugins/catalog-backend/src/next/ConfigLocationProvider.ts diff --git a/plugins/catalog-backend/src/next/ConfigLocationProvider.ts b/plugins/catalog-backend/src/next/ConfigLocationProvider.ts new file mode 100644 index 0000000000..5b93fcfd98 --- /dev/null +++ b/plugins/catalog-backend/src/next/ConfigLocationProvider.ts @@ -0,0 +1,49 @@ +/* + * 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 { EntityProviderConnection, EntityProvider } from './types'; +import path from 'path'; +import { Config } from '@backstage/config'; +import { locationSpecToLocationEntity } from './util'; + +export class ConfigLocationProvider implements EntityProvider { + private connection: EntityProviderConnection | undefined; + + constructor(private readonly config: Config) {} + + getProviderName(): string { + return 'ConfigLocationProvider'; + } + + async connect(connection: EntityProviderConnection): Promise { + this.connection = connection; + + const locationConfigs = + this.config.getOptionalConfigArray('catalog.locations') ?? []; + + const entities = locationConfigs.map(location => + locationSpecToLocationEntity({ + type: location.getString('type'), + target: path.resolve(location.getString('target')), + }), + ); + + await this.connection.applyMutation({ + type: 'full', + entities, + }); + } +} diff --git a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts index b71b2c1045..1934b0aea7 100644 --- a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts +++ b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts @@ -68,9 +68,12 @@ export class DefaultCatalogProcessingEngine implements CatalogProcessingEngine { async start() { for (const provider of this.entityProviders) { - // TODO: this ID should be some form of identifier for the EntityProvider - const id = 'databaseProvider'; - provider.connect(new Connection({ stateManager: this.stateManager, id })); + provider.connect( + new Connection({ + stateManager: this.stateManager, + id: provider.getProviderName(), + }), + ); } this.running = true; diff --git a/plugins/catalog-backend/src/next/DefaultLocationStore.ts b/plugins/catalog-backend/src/next/DefaultLocationStore.ts index 40870cff7b..a56e5d1585 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationStore.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationStore.ts @@ -30,6 +30,10 @@ export class DefaultLocationStore implements LocationStore, EntityProvider { constructor(private readonly db: Database) {} + getProviderName(): string { + return 'DefaultLocationStore'; + } + createLocation(spec: LocationSpec): Promise { return this.db.transaction(async tx => { // TODO: id should really be type and target combined and not a uuid. diff --git a/plugins/catalog-backend/src/next/NextCatalogBuilder.ts b/plugins/catalog-backend/src/next/NextCatalogBuilder.ts index d720bd331a..0699a13f58 100644 --- a/plugins/catalog-backend/src/next/NextCatalogBuilder.ts +++ b/plugins/catalog-backend/src/next/NextCatalogBuilder.ts @@ -50,6 +50,7 @@ import { GithubDiscoveryProcessor, GithubOrgReaderProcessor, LdapOrgReaderProcessor, + LocationEntityProcessor, MicrosoftGraphOrgReaderProcessor, PlaceholderProcessor, PlaceholderResolver, @@ -73,6 +74,7 @@ import { CatalogProcessingEngine } from '../next/types'; import { NextEntitiesCatalog } from './NextEntitiesCatalog'; import { Stitcher } from './Stitcher'; import { CommonDatabase } from '../database/CommonDatabase'; +import { ConfigLocationProvider } from './ConfigLocationProvider'; export type CatalogEnvironment = { logger: Logger; @@ -272,9 +274,10 @@ export class NextCatalogBuilder { const locationStore = new DefaultLocationStore(db); const stitcher = new Stitcher(dbClient, logger); + const configLocationProvider = new ConfigLocationProvider(config); const processingEngine = new DefaultCatalogProcessingEngine( logger, - [locationStore], // entityproviders + [locationStore, configLocationProvider], stateManager, orchestrator, stitcher, @@ -322,7 +325,6 @@ export class NextCatalogBuilder { // These are always there no matter what const processors: CatalogProcessor[] = [ - StaticLocationProcessor.fromConfig(config), new PlaceholderProcessor({ resolvers: placeholderResolvers, reader }), new BuiltinKindsEntityProcessor(), ]; @@ -338,7 +340,6 @@ export class NextCatalogBuilder { MicrosoftGraphOrgReaderProcessor.fromConfig(config, { logger }), new UrlReaderProcessor({ reader, logger }), CodeOwnersProcessor.fromConfig(config, { logger, reader }), - // new LocationEntityProcessor({ integrations }), new AnnotateLocationEntityProcessor({ integrations }), ); } diff --git a/plugins/catalog-backend/src/next/types.ts b/plugins/catalog-backend/src/next/types.ts index ef3bab797b..e0616fb336 100644 --- a/plugins/catalog-backend/src/next/types.ts +++ b/plugins/catalog-backend/src/next/types.ts @@ -65,6 +65,7 @@ export interface EntityProviderConnection { } export interface EntityProvider { + getProviderName(): string; connect(connection: EntityProviderConnection): Promise; } From b7200a4b70334521fd391e58c4f75f33e3339e13 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 26 Apr 2021 16:53:44 +0200 Subject: [PATCH 162/485] chore: remove unused imports Signed-off-by: Johan Haals --- plugins/catalog-backend/src/next/NextCatalogBuilder.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/catalog-backend/src/next/NextCatalogBuilder.ts b/plugins/catalog-backend/src/next/NextCatalogBuilder.ts index 0699a13f58..24b763a098 100644 --- a/plugins/catalog-backend/src/next/NextCatalogBuilder.ts +++ b/plugins/catalog-backend/src/next/NextCatalogBuilder.ts @@ -50,11 +50,9 @@ import { GithubDiscoveryProcessor, GithubOrgReaderProcessor, LdapOrgReaderProcessor, - LocationEntityProcessor, MicrosoftGraphOrgReaderProcessor, PlaceholderProcessor, PlaceholderResolver, - StaticLocationProcessor, UrlReaderProcessor, } from '../ingestion'; import { RepoLocationAnalyzer } from '../ingestion/LocationAnalyzer'; From 72becbd2cc5fa95246da21b234c4f916e2a8cb9b Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Tue, 27 Apr 2021 14:16:49 +0200 Subject: [PATCH 163/485] catalog-backend: Add ConfigLocationProvider tests Co-authored-by: Ben Lambert Signed-off-by: Johan Haals --- .../src/next/ConfigLocationProvider.test.ts | 67 +++++++++++++++++++ .../src/next/ConfigLocationProvider.ts | 14 ++-- 2 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 plugins/catalog-backend/src/next/ConfigLocationProvider.test.ts diff --git a/plugins/catalog-backend/src/next/ConfigLocationProvider.test.ts b/plugins/catalog-backend/src/next/ConfigLocationProvider.test.ts new file mode 100644 index 0000000000..9aaba13c48 --- /dev/null +++ b/plugins/catalog-backend/src/next/ConfigLocationProvider.test.ts @@ -0,0 +1,67 @@ +/* + * 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 { ConfigLocationProvider } from './ConfigLocationProvider'; +import { EntityProviderConnection } from './types'; +import { ConfigReader } from '@backstage/config'; +import { resolvePackagePath } from '@backstage/backend-common'; +import path from 'path'; + +describe('Config Location Provider', () => { + it('should apply mutation with the correct paths in the config', async () => { + const mockConfig = new ConfigReader({ + catalog: { + locations: [ + { type: 'file', target: './lols.yaml' }, + { type: 'url', target: 'https://github.com/backstage/backstage' }, + ], + }, + }); + + const mockConnection = ({ + applyMutation: jest.fn(), + } as unknown) as EntityProviderConnection; + const locationProvider = new ConfigLocationProvider(mockConfig); + + await locationProvider.connect(mockConnection); + + expect(mockConnection.applyMutation).toHaveBeenCalledWith({ + type: 'full', + entities: expect.arrayContaining([ + expect.objectContaining({ + spec: { + target: path.join( + resolvePackagePath('@backstage/plugin-catalog-backend'), + './lols.yaml', + ), + type: 'file', + }, + }), + ]), + }); + expect(mockConnection.applyMutation).toHaveBeenCalledWith({ + type: 'full', + entities: expect.arrayContaining([ + expect.objectContaining({ + spec: { + target: 'https://github.com/backstage/backstage', + type: 'url', + }, + }), + ]), + }); + }); +}); diff --git a/plugins/catalog-backend/src/next/ConfigLocationProvider.ts b/plugins/catalog-backend/src/next/ConfigLocationProvider.ts index 5b93fcfd98..8a65487df1 100644 --- a/plugins/catalog-backend/src/next/ConfigLocationProvider.ts +++ b/plugins/catalog-backend/src/next/ConfigLocationProvider.ts @@ -34,12 +34,14 @@ export class ConfigLocationProvider implements EntityProvider { const locationConfigs = this.config.getOptionalConfigArray('catalog.locations') ?? []; - const entities = locationConfigs.map(location => - locationSpecToLocationEntity({ - type: location.getString('type'), - target: path.resolve(location.getString('target')), - }), - ); + const entities = locationConfigs.map(location => { + const type = location.getString('type'); + const target = location.getString('target'); + return locationSpecToLocationEntity({ + type, + target: type === 'file' ? path.resolve(target) : target, + }); + }); await this.connection.applyMutation({ type: 'full', From bbf0878afc247917a82121328b01102fbd87a871 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Tue, 27 Apr 2021 18:28:55 +0200 Subject: [PATCH 164/485] WIP tests for DefaultProcessingDatabase Signed-off-by: Johan Haals --- .../DefaultProcessingDatabase.test.ts | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts index f67b8603db..a5c1e56cff 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts @@ -429,4 +429,66 @@ describe('Default Processing Database', () => { ).toBeFalsy(); }); }); + + describe('updateProcessedEntity', () => { + it('should throw if the entity does not exist', async () => { + await processingDatabase.transaction(async tx => { + await expect( + processingDatabase.updateProcessedEntity(tx, { + id: '9', + processedEntity: { + apiVersion: '1.0.0', + metadata: { + name: 'new-root', + }, + kind: 'Location', + } as Entity, + deferredEntities: [], + relations: [], + }), + ).rejects.toThrow('Processing state not found for 9'); + }); + }); + + it('should update a processed entity', async () => { + await db('refresh_state').insert({ + entity_id: '123', + entity_ref: 'Component:default/wacka', + unprocessed_entity: '', + errors: '', + next_update_at: 'now()', + last_discovery_at: 'now()', + }); + + const deferredEntity = { + apiVersion: '1.0.0', + metadata: { + name: 'deferred', + }, + kind: 'Location', + } as Entity; + + await processingDatabase.transaction(async tx => { + await processingDatabase.updateProcessedEntity(tx, { + id: '123', + processedEntity: { + apiVersion: '1.0.0', + metadata: { + name: 'new-root', + }, + kind: 'Location', + } as Entity, + deferredEntities: [deferredEntity], + relations: [], + }); + }); + + console.log( + await db('refresh_state') + .where({ entity_ref: 'deferred' }) + .select(), + ); + expect(1).toBeDefined(); + }); + }); }); From c6af78b93b0bc09c19f5d87d23a764eb01f7e7c4 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Tue, 27 Apr 2021 18:30:00 +0200 Subject: [PATCH 165/485] Combine stitiching queries Signed-off-by: Johan Haals --- plugins/catalog-backend/src/next/Stitcher.ts | 118 ++++++++++++++----- 1 file changed, 88 insertions(+), 30 deletions(-) diff --git a/plugins/catalog-backend/src/next/Stitcher.ts b/plugins/catalog-backend/src/next/Stitcher.ts index 57f5ae9167..04a8ab8cfc 100644 --- a/plugins/catalog-backend/src/next/Stitcher.ts +++ b/plugins/catalog-backend/src/next/Stitcher.ts @@ -26,6 +26,14 @@ import { import { Entity, parseEntityRef } from '@backstage/catalog-model'; import { createHash } from 'crypto'; import stableStringify from 'fast-json-stable-stringify'; +import { buildEntitySearch } from '../database/search'; +import { DbEntitiesSearchRow } from '../database/types'; + +// The number of items that are sent per batch to the database layer, when +// doing .batchInsert calls to knex. This needs to be low enough to not cause +// errors in the underlying engine due to exceeding query limits, but large +// enough to get the speed benefits. +const BATCH_SIZE = 50; export type DbFinalEntitiesRow = { entity_id: string; @@ -49,64 +57,114 @@ export class Stitcher { for (const entityRef of entityRefs) { await this.transaction(async txOpaque => { const tx = txOpaque as Knex.Transaction; - const [result] = await tx('refresh_state') - .select('entity_id', 'processed_entity') - .where({ entity_ref: entityRef }); - if (!result) { + const result: Array<{ + entityId: string; + processedEntity?: string; + errors: string; + incomingReferenceCount: string | number; + previousEtag?: string; + relationType?: string; + relationTarget?: string; + }> = await tx + .with('incoming_references', function incomingReferences(builder) { + return builder + .from('refresh_state_references') + .where({ target_entity_ref: entityRef }) + .count({ count: '*' }); + }) + .select({ + entityId: 'refresh_state.entity_id', + processedEntity: 'refresh_state.processed_entity', + errors: 'refresh_state.errors', + incomingReferenceCount: 'incoming_references.count', + previousEtag: 'final_entities.etag', + relationType: 'relations.type', + relationTarget: 'relations.target_entity_ref', + }) + .from('refresh_state') + .leftJoin('incoming_references', {}) + .leftOuterJoin('final_entities', { + 'final_entities.entity_id': 'refresh_state.entity_id', + }) + .leftOuterJoin('relations', { + 'relations.source_entity_ref': 'refresh_state.entity_ref', + }) + .where({ 'refresh_state.entity_ref': entityRef }); + + if (!result.length) { this.logger.debug( `Unable to stitch ${entityRef}, item does not exist in refresh state table`, ); return; - } else if (!result.processed_entity) { + } + + const { + entityId, + processedEntity, + errors, + incomingReferenceCount, + previousEtag, + } = result[0]; + + if (!processedEntity) { this.logger.debug( `Unable to stitch ${entityRef}, the entity has not yet been processed`, ); return; } - const entity: Entity = JSON.parse(result.processed_entity); + const entity = JSON.parse(processedEntity) as Entity; + const isOrphan = Number(incomingReferenceCount) === 0; - const entityId = entity?.metadata?.uid; - if (!entityId) { - this.logger.error(`missing ID in entity ${JSON.stringify(entity)}`); - return; - } - - const [reference_count_result] = await tx( - 'refresh_state_references', - ) - .where({ target_entity_ref: entityRef }) - .count({ reference_count: 'target_entity_ref' }); - - if (Number(reference_count_result.reference_count) === 0) { - this.logger.debug(`${entityRef} is orphan`); + if (isOrphan) { + this.logger.debug(`${entityRef} is an orphan`); entity.metadata.annotations = { ...entity.metadata.annotations, ['backstage.io/orphan']: 'true', }; } - const relationResults = await tx('relations') - .where({ source_entity_ref: entityRef }) - .select(); - - // TODO: entityRef is lower case and should be uppercase in the final result. - entity.relations = relationResults.map(relation => ({ - type: relation.type, - target: parseEntityRef(relation.target_entity_ref), - })); + // TODO: entityRef is lower case and should be uppercase in the final result + entity.relations = result + .filter(row => row.relationType) + .map(row => ({ + type: row.relationType!, + target: parseEntityRef(row.relationTarget!), + })); entity.metadata.generation = 1; + + // If the output entity was actually not changed, just abort const etag = generateEntityEtag(entity); + if (etag === previousEtag) { + console.log(`Skipped stitching of ${entityRef}, no changes`); + return; + } + entity.metadata.etag = etag; + await tx('final_entities') .insert({ - finalized_entity: JSON.stringify(entity), entity_id: entityId, + finalized_entity: JSON.stringify(entity), etag, }) .onConflict('entity_id') .merge(['finalized_entity', 'etag']); + + try { + const entries = buildEntitySearch(entityId, entity); + await tx('search') + .where({ entity_id: entityId }) + .delete(); + await tx.batchInsert('search', entries, BATCH_SIZE); + } catch (e) { + this.logger.debug( + `Failed to write search entries for ${entityId}`, + e, + ); + // intentionally ignored + } }); } } From 5c60c66ff508bae37ccfcb597d5e6e6c030a68aa Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Tue, 27 Apr 2021 18:30:22 +0200 Subject: [PATCH 166/485] Create search table Signed-off-by: Johan Haals --- .../20210302150147_refresh_state.js | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js index 2afeda02c0..755a645894 100644 --- a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js +++ b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js @@ -154,6 +154,28 @@ exports.up = async function up(knex) { table.index('source_entity_ref', 'relations_source_entity_ref_idx'); table.index('originating_entity_id', 'relations_source_entity_id_idx'); }); + + await knex.schema.createTable('search', table => { + table.comment( + 'Flattened key-values from the entities, used for quick filtering', + ); + table + .uuid('entity_id') + .references('entity_id') + .inTable('refresh_state') + .onDelete('CASCADE') + .comment('The entity that matches this key/value'); + table + .string('key') + .notNullable() + .comment('A key that occurs in the entity'); + table + .string('value') + .nullable() + .comment('The corresponding value to match on'); + table.index(['key'], 'search_key_idx'); + table.index(['value'], 'search_value_idx'); + }); }; /** @@ -177,6 +199,12 @@ exports.down = async function down(knex) { table.index('source_entity_ref', 'relations_source_entity_ref_idx'); table.index('originating_entity_id', 'relations_source_entity_id_idx'); }); + await knex.schema.alterTable('search', table => { + table.dropIndex([], 'search_key_idx'); + table.dropIndex([], 'search_value_idx'); + }); + + await knex.schema.dropTable('search'); await knex.schema.dropTable('final_entities'); await knex.schema.dropTable('relations'); await knex.schema.dropTable('references'); From d798708943c6b851a96de8837653040eaad5a757 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 27 Apr 2021 21:23:35 +0200 Subject: [PATCH 167/485] chore(tests): Added some more tests for DefaultLocationStore and fixing migration so it will run properly on PG Signed-off-by: blam --- .../20210302150147_refresh_state.js | 2 +- .../src/next/DefaultLocationStore.test.ts | 146 ++++++++++++++++++ .../src/next/DefaultLocationStore.ts | 26 ++-- 3 files changed, 161 insertions(+), 13 deletions(-) create mode 100644 plugins/catalog-backend/src/next/DefaultLocationStore.test.ts diff --git a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js index 755a645894..bbaf4820cd 100644 --- a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js +++ b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js @@ -160,7 +160,7 @@ exports.up = async function up(knex) { 'Flattened key-values from the entities, used for quick filtering', ); table - .uuid('entity_id') + .text('entity_id') .references('entity_id') .inTable('refresh_state') .onDelete('CASCADE') diff --git a/plugins/catalog-backend/src/next/DefaultLocationStore.test.ts b/plugins/catalog-backend/src/next/DefaultLocationStore.test.ts new file mode 100644 index 0000000000..be20179e9a --- /dev/null +++ b/plugins/catalog-backend/src/next/DefaultLocationStore.test.ts @@ -0,0 +1,146 @@ +/* + * 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 { DatabaseManager } from './database/DatabaseManager'; +import { DefaultLocationStore } from './DefaultLocationStore'; +import { v4 } from 'uuid'; + +describe('Default Location Store', () => { + const createLocationStore = async () => { + const db = await DatabaseManager.createTestDatabase(); + const connection = { applyMutation: jest.fn() }; + const store = new DefaultLocationStore(db); + await store.connect(connection); + return { store, connection }; + }; + + it('should do a full sync with the locations on connect', async () => { + const { connection } = await createLocationStore(); + + expect(connection.applyMutation).toHaveBeenCalledWith({ + type: 'full', + entities: [], + }); + }); + + describe('listLocations', () => { + it('lists empty locations when there is no locations', async () => { + const { store } = await createLocationStore(); + + expect(await store.listLocations()).toEqual([]); + }); + + it('lists locations that are added to the db', async () => { + const { store } = await createLocationStore(); + + await store.createLocation({ + target: + 'https://github.com/backstage/demo/blob/master/catalog-info.yml', + type: 'url', + }); + + const listLocations = await store.listLocations(); + + expect(listLocations).toHaveLength(1); + expect(listLocations).toEqual( + expect.arrayContaining([ + expect.objectContaining({ + target: + 'https://github.com/backstage/demo/blob/master/catalog-info.yml', + type: 'url', + }), + ]), + ); + }); + }); + + describe('createLocation', () => { + it('throws when the location already exists', async () => { + const { store } = await createLocationStore(); + const spec = { + target: + 'https://github.com/backstage/demo/blob/master/catalog-info.yml', + type: 'url', + }; + await store.createLocation(spec); + + await expect(() => store.createLocation(spec)).rejects.toThrow( + new RegExp(`Location ${spec.type}:${spec.target} already exists`), + ); + }); + + it('calls apply mutation when adding a new location', async () => { + const { store, connection } = await createLocationStore(); + + await store.createLocation({ + target: + 'https://github.com/backstage/demo/blob/master/catalog-info.yml', + type: 'url', + }); + + expect(connection.applyMutation).toHaveBeenCalledWith({ + type: 'delta', + removed: [], + added: expect.arrayContaining([ + expect.objectContaining({ + spec: { + target: + 'https://github.com/backstage/demo/blob/master/catalog-info.yml', + type: 'url', + }, + }), + ]), + }); + }); + }); + + describe('deleteLocation', () => { + it('throws if the location does not exist', async () => { + const { store } = await createLocationStore(); + + const id = v4(); + + await expect(() => store.deleteLocation(id)).rejects.toThrow( + new RegExp(`Found no location with ID ${id}`), + ); + }); + + it('calls apply mutation when adding a new location', async () => { + const { store, connection } = await createLocationStore(); + + const location = await store.createLocation({ + target: + 'https://github.com/backstage/demo/blob/master/catalog-info.yml', + type: 'url', + }); + + await store.deleteLocation(location.id); + + expect(connection.applyMutation).toHaveBeenCalledWith({ + type: 'delta', + added: [], + removed: expect.arrayContaining([ + expect.objectContaining({ + spec: { + target: + 'https://github.com/backstage/demo/blob/master/catalog-info.yml', + type: 'url', + }, + }), + ]), + }); + }); + }); +}); diff --git a/plugins/catalog-backend/src/next/DefaultLocationStore.ts b/plugins/catalog-backend/src/next/DefaultLocationStore.ts index a56e5d1585..28db3790b6 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationStore.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationStore.ts @@ -34,10 +34,8 @@ export class DefaultLocationStore implements LocationStore, EntityProvider { return 'DefaultLocationStore'; } - createLocation(spec: LocationSpec): Promise { + async createLocation(spec: LocationSpec): Promise { return this.db.transaction(async tx => { - // TODO: id should really be type and target combined and not a uuid. - // Attempt to find a previous location matching the spec const previousLocations = await this.listLocations(); const previousLocation = previousLocations.some( @@ -50,6 +48,7 @@ export class DefaultLocationStore implements LocationStore, EntityProvider { ); } + // TODO: id should really be type and target combined and not a uuid. const location = await this.db.addLocation(tx, { id: uuidv4(), type: spec.type, @@ -68,11 +67,17 @@ export class DefaultLocationStore implements LocationStore, EntityProvider { async listLocations(): Promise { const dbLocations = await this.db.locations(); - return dbLocations.map(item => ({ - id: item.id, - target: item.target, - type: item.type, - })); + return ( + dbLocations + // TODO(blam): We should create a mutation to remove this location for everyone + // eventually when it's all done and dusted + .filter(({ type }) => type !== 'bootstrap') + .map(item => ({ + id: item.id, + target: item.target, + type: item.type, + })) + ); } getLocation(id: string): Promise { @@ -86,9 +91,6 @@ export class DefaultLocationStore implements LocationStore, EntityProvider { return this.db.transaction(async tx => { const location = await this.db.location(id); - if (!location) { - throw new ConflictError(`No location found with id: ${id}`); - } await this.db.removeLocation(tx, id); await this.connection.applyMutation({ type: 'delta', @@ -108,7 +110,7 @@ export class DefaultLocationStore implements LocationStore, EntityProvider { async connect(connection: EntityProviderConnection): Promise { this._connection = connection; - const locations = await this.db.locations(); + const locations = await this.listLocations(); const entities = locations.map(location => { return locationSpecToLocationEntity(location); }); From a60c2d9f8f4f3dfbb529e10ddaf7ab0679ee7772 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Wed, 28 Apr 2021 09:18:35 +0200 Subject: [PATCH 168/485] Update processed entity tests Signed-off-by: Johan Haals --- .../DefaultProcessingDatabase.test.ts | 45 ++++++++++++++----- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts index a5c1e56cff..d76bd74260 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.test.ts @@ -19,10 +19,11 @@ import { Knex } from 'knex'; import { DbRefreshStateReferencesRow, DbRefreshStateRow, + DbRelationsRow, DefaultProcessingDatabase, } from './DefaultProcessingDatabase'; -import { Entity } from '@backstage/catalog-model'; +import { Entity, EntityRelationSpec } from '@backstage/catalog-model'; import * as uuid from 'uuid'; import { getVoidLogger } from '@backstage/backend-common'; @@ -452,8 +453,8 @@ describe('Default Processing Database', () => { it('should update a processed entity', async () => { await db('refresh_state').insert({ - entity_id: '123', - entity_ref: 'Component:default/wacka', + entity_id: '321', + entity_ref: 'location:default/new-root', unprocessed_entity: '', errors: '', next_update_at: 'now()', @@ -468,9 +469,23 @@ describe('Default Processing Database', () => { kind: 'Location', } as Entity; + const relation: EntityRelationSpec = { + source: { + kind: 'Component', + namespace: 'Default', + name: 'foo', + }, + target: { + kind: 'Component', + namespace: 'Default', + name: 'foo', + }, + type: 'url', + }; + await processingDatabase.transaction(async tx => { await processingDatabase.updateProcessedEntity(tx, { - id: '123', + id: '321', processedEntity: { apiVersion: '1.0.0', metadata: { @@ -479,16 +494,24 @@ describe('Default Processing Database', () => { kind: 'Location', } as Entity, deferredEntities: [deferredEntity], - relations: [], + relations: [relation], }); }); - console.log( - await db('refresh_state') - .where({ entity_ref: 'deferred' }) - .select(), - ); - expect(1).toBeDefined(); + const deferredResult = await db('refresh_state') + .where({ entity_ref: 'location:default/deferred' }) + .select(); + expect(deferredResult.length).toBe(1); + + const [relations] = await db('relations') + .where({ originating_entity_id: '321' }) + .select(); + expect(relations).toEqual({ + originating_entity_id: '321', + source_entity_ref: 'component:default/foo', + type: 'url', + target_entity_ref: 'component:default/foo', + }); }); }); }); From 35b3246116ee756abeb27760073c9e5561f046c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 28 Apr 2021 09:18:36 +0200 Subject: [PATCH 169/485] update the stitcher including search MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .../20210302150147_refresh_state.js | 7 +- .../catalog-backend/src/next/Stitcher.test.ts | 205 ++++++++++++++++++ plugins/catalog-backend/src/next/Stitcher.ts | 59 ++--- .../catalog-backend/src/next/search.test.ts | 160 ++++++++++++++ plugins/catalog-backend/src/next/search.ts | 191 ++++++++++++++++ plugins/catalog-backend/src/next/types.ts | 1 + 6 files changed, 592 insertions(+), 31 deletions(-) create mode 100644 plugins/catalog-backend/src/next/Stitcher.test.ts create mode 100644 plugins/catalog-backend/src/next/search.test.ts create mode 100644 plugins/catalog-backend/src/next/search.ts diff --git a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js index bbaf4820cd..4d2c30f194 100644 --- a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js +++ b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js @@ -33,7 +33,6 @@ exports.up = async function up(knex) { ); table .text('entity_ref') - .unique() .notNullable() .comment('A reference to the entity that the refresh state is tied to'); table @@ -59,13 +58,14 @@ exports.up = async function up(knex) { .notNullable() .comment('JSON array containing all errors related to entity'); table - .dateTime('next_update_at') // TOOD: timezone or change to epoch-millis or similar + .dateTime('next_update_at') // TODO: timezone or change to epoch-millis or similar .notNullable() .comment('Timestamp of when entity should be updated'); table - .dateTime('last_discovery_at') // TOOD: timezone or change to epoch-millis or similar + .dateTime('last_discovery_at') // TODO: timezone or change to epoch-millis or similar .notNullable() .comment('The last timestamp of which this entity was discovered'); + table.unique(['entity_ref'], 'refresh_state_entity_ref_uniq'); table.index('entity_id', 'refresh_state_entity_id_idx'); table.index('entity_ref', 'refresh_state_entity_ref_idx'); table.index('next_update_at', 'refresh_state_next_update_at_idx'); @@ -188,6 +188,7 @@ exports.down = async function down(knex) { table.dropIndex([], 'refresh_state_references_target_entity_id_idx'); }); await knex.schema.alterTable('refresh_state', table => { + table.dropUnique([], 'refresh_state_entity_ref_uniq'); table.dropIndex([], 'refresh_state_entity_id_idx'); table.dropIndex([], 'refresh_state_entity_ref_idx'); table.dropIndex([], 'refresh_state_next_update_at_idx'); diff --git a/plugins/catalog-backend/src/next/Stitcher.test.ts b/plugins/catalog-backend/src/next/Stitcher.test.ts new file mode 100644 index 0000000000..327d922c07 --- /dev/null +++ b/plugins/catalog-backend/src/next/Stitcher.test.ts @@ -0,0 +1,205 @@ +/* + * 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 { getVoidLogger } from '@backstage/backend-common'; +import { Knex } from 'knex'; +import { DatabaseManager } from './database/DatabaseManager'; +import { + DbRefreshStateReferencesRow, + DbRefreshStateRow, + DbRelationsRow, +} from './database/DefaultProcessingDatabase'; +import { DbSearchRow } from './search'; +import { DbFinalEntitiesRow, Stitcher } from './Stitcher'; + +describe('Stitcher', () => { + let db: Knex; + const logger = getVoidLogger(); + + beforeEach(async () => { + db = await DatabaseManager.createTestDatabaseConnection(); + await DatabaseManager.createDatabase(db); + }); + + it('runs the happy path', async () => { + const stitcher = new Stitcher(db, logger); + + await db.transaction(async tx => { + await tx('refresh_state').insert([ + { + entity_id: 'my-id', + entity_ref: 'k:ns/n', + unprocessed_entity: JSON.stringify({}), + processed_entity: JSON.stringify({ + apiVersion: 'a', + kind: 'k', + metadata: { + name: 'n', + namespace: 'ns', + }, + spec: { + k: 'v', + }, + }), + errors: '[]', + next_update_at: tx.fn.now(), + last_discovery_at: tx.fn.now(), + }, + ]); + await tx('refresh_state_references').insert([ + { source_key: 'a', target_entity_ref: 'k:ns/n' }, + ]); + await tx('relations').insert([ + { + originating_entity_id: 'my-id', + source_entity_ref: 'k:ns/n', + type: 'looksAt', + target_entity_ref: 'k:ns/other', + }, + ]); + }); + + await stitcher.stitch(new Set(['k:ns/n'])); + + let firstEtag: string; + await db.transaction(async tx => { + const entities = await tx('final_entities'); + + expect(entities.length).toBe(1); + const entity = JSON.parse(entities[0].finalized_entity); + expect(entity).toEqual({ + relations: [ + { + type: 'looksAt', + target: { + kind: 'k', + namespace: 'ns', + name: 'other', + }, + }, + ], + apiVersion: 'a', + kind: 'k', + metadata: { + name: 'n', + namespace: 'ns', + etag: expect.any(String), + generation: 1, + uid: 'my-id', + }, + spec: { + k: 'v', + }, + }); + + firstEtag = entity.metadata.etag; + + const search = await tx('search'); + expect(search).toEqual( + expect.arrayContaining([ + { entity_id: 'my-id', key: 'relations', value: 'looksat:k:ns/other' }, + { entity_id: 'my-id', key: 'apiversion', value: 'a' }, + { entity_id: 'my-id', key: 'kind', value: 'k' }, + { entity_id: 'my-id', key: 'metadata.name', value: 'n' }, + { entity_id: 'my-id', key: 'metadata.namespace', value: 'ns' }, + { entity_id: 'my-id', key: 'metadata.uid', value: 'my-id' }, + { entity_id: 'my-id', key: 'spec.k', value: 'v' }, + ]), + ); + }); + + // Re-stitch without any changes + await stitcher.stitch(new Set(['k:ns/n'])); + + await db.transaction(async tx => { + const entities = await tx('final_entities'); + expect(entities.length).toBe(1); + const entity = JSON.parse(entities[0].finalized_entity); + expect(entities[0].etag).toEqual(firstEtag); + expect(entity.metadata.etag).toEqual(firstEtag); + }); + + // Now add one more relation and re-stitch + await db.transaction(async tx => { + await tx('relations').insert([ + { + originating_entity_id: 'my-id', + source_entity_ref: 'k:ns/n', + type: 'looksAt', + target_entity_ref: 'k:ns/third', + }, + ]); + }); + + await stitcher.stitch(new Set(['k:ns/n'])); + + await db.transaction(async tx => { + const entities = await tx('final_entities'); + + expect(entities.length).toBe(1); + const entity = JSON.parse(entities[0].finalized_entity); + expect(entity).toEqual({ + relations: expect.arrayContaining([ + { + type: 'looksAt', + target: { + kind: 'k', + namespace: 'ns', + name: 'other', + }, + }, + { + type: 'looksAt', + target: { + kind: 'k', + namespace: 'ns', + name: 'third', + }, + }, + ]), + apiVersion: 'a', + kind: 'k', + metadata: { + name: 'n', + namespace: 'ns', + etag: expect.any(String), + generation: 1, + uid: 'my-id', + }, + spec: { + k: 'v', + }, + }); + + expect(entities[0].etag).not.toEqual(firstEtag); + expect(entities[0].etag).toEqual(entity.metadata.etag); + + const search = await tx('search'); + expect(search).toEqual( + expect.arrayContaining([ + { entity_id: 'my-id', key: 'relations', value: 'looksat:k:ns/other' }, + { entity_id: 'my-id', key: 'relations', value: 'looksat:k:ns/third' }, + { entity_id: 'my-id', key: 'apiversion', value: 'a' }, + { entity_id: 'my-id', key: 'kind', value: 'k' }, + { entity_id: 'my-id', key: 'metadata.name', value: 'n' }, + { entity_id: 'my-id', key: 'metadata.namespace', value: 'ns' }, + { entity_id: 'my-id', key: 'metadata.uid', value: 'my-id' }, + { entity_id: 'my-id', key: 'spec.k', value: 'v' }, + ]), + ); + }); + }); +}); diff --git a/plugins/catalog-backend/src/next/Stitcher.ts b/plugins/catalog-backend/src/next/Stitcher.ts index 04a8ab8cfc..cd9220e934 100644 --- a/plugins/catalog-backend/src/next/Stitcher.ts +++ b/plugins/catalog-backend/src/next/Stitcher.ts @@ -14,20 +14,14 @@ * limitations under the License. */ +import { Entity, parseEntityRef } from '@backstage/catalog-model'; +import { ConflictError } from '@backstage/errors'; +import { createHash } from 'crypto'; +import stableStringify from 'fast-json-stable-stringify'; import { Knex } from 'knex'; import { Logger } from 'winston'; import { Transaction } from '../database'; -import { ConflictError } from '@backstage/errors'; -import { - DbRefreshStateReferencesRow, - DbRefreshStateRow, - DbRelationsRow, -} from './database/DefaultProcessingDatabase'; -import { Entity, parseEntityRef } from '@backstage/catalog-model'; -import { createHash } from 'crypto'; -import stableStringify from 'fast-json-stable-stringify'; -import { buildEntitySearch } from '../database/search'; -import { DbEntitiesSearchRow } from '../database/types'; +import { buildEntitySearch, DbSearchRow } from './search'; // The number of items that are sent per batch to the database layer, when // doing .batchInsert calls to knex. This needs to be low enough to not cause @@ -58,6 +52,13 @@ export class Stitcher { await this.transaction(async txOpaque => { const tx = txOpaque as Knex.Transaction; + // Selecting from refresh_state and final_entities should yield exactly + // one row (except in abnormal cases where the stitch was invoked for + // something that didn't exist at all, in which case it's zero rows). + // The join with the temporary incoming_references still gives one row. + // The only result set "expanding" join is the one with relations, so + // the output should be at least one row (if zero or one relations were + // found), or at most the same number of rows as relations. const result: Array<{ entityId: string; processedEntity?: string; @@ -90,8 +91,14 @@ export class Stitcher { .leftOuterJoin('relations', { 'relations.source_entity_ref': 'refresh_state.entity_ref', }) - .where({ 'refresh_state.entity_ref': entityRef }); + .where({ 'refresh_state.entity_ref': entityRef }) + .orderBy('relationType', 'asc') + .orderBy('relationTarget', 'asc'); + // If there were no rows returned, it would mean that there was no + // matching row even in the refresh_state. This can happen for example + // if we emit a relation to something that hasn't been ingested yet. + // It's safe to ignore this stitch attempt in that case. if (!result.length) { this.logger.debug( `Unable to stitch ${entityRef}, item does not exist in refresh state table`, @@ -102,11 +109,15 @@ export class Stitcher { const { entityId, processedEntity, - errors, + // errors, incomingReferenceCount, previousEtag, } = result[0]; + // If there was no processed entity in place, the target hasn't been + // through the processing steps yet. It's safe to ignore this stitch + // attempt in that case, since another stitch will be triggered when + // that processing has finished. if (!processedEntity) { this.logger.debug( `Unable to stitch ${entityRef}, the entity has not yet been processed`, @@ -114,6 +125,7 @@ export class Stitcher { return; } + // Grab the processed entity and stitch all of the relevant data into it const entity = JSON.parse(processedEntity) as Entity; const isOrphan = Number(incomingReferenceCount) === 0; @@ -132,15 +144,16 @@ export class Stitcher { type: row.relationType!, target: parseEntityRef(row.relationTarget!), })); - entity.metadata.generation = 1; // If the output entity was actually not changed, just abort const etag = generateEntityEtag(entity); if (etag === previousEtag) { - console.log(`Skipped stitching of ${entityRef}, no changes`); + this.logger.debug(`Skipped stitching of ${entityRef}, no changes`); return; } + entity.metadata.uid = entityId; + entity.metadata.generation = 1; entity.metadata.etag = etag; await tx('final_entities') @@ -152,19 +165,9 @@ export class Stitcher { .onConflict('entity_id') .merge(['finalized_entity', 'etag']); - try { - const entries = buildEntitySearch(entityId, entity); - await tx('search') - .where({ entity_id: entityId }) - .delete(); - await tx.batchInsert('search', entries, BATCH_SIZE); - } catch (e) { - this.logger.debug( - `Failed to write search entries for ${entityId}`, - e, - ); - // intentionally ignored - } + const searchEntries = buildEntitySearch(entityId, entity); + await tx('search').where({ entity_id: entityId }).delete(); + await tx.batchInsert('search', searchEntries, BATCH_SIZE); }); } } diff --git a/plugins/catalog-backend/src/next/search.test.ts b/plugins/catalog-backend/src/next/search.test.ts new file mode 100644 index 0000000000..be9a98fe69 --- /dev/null +++ b/plugins/catalog-backend/src/next/search.test.ts @@ -0,0 +1,160 @@ +/* + * Copyright 2020 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 { Entity, ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model'; +import { buildEntitySearch, mapToRows, traverse } from './search'; + +describe('search', () => { + describe('traverse', () => { + it('expands lists of strings to several rows', () => { + const input = { a: ['b', 'c', 'd'] }; + const output = traverse(input); + expect(output).toEqual([ + { key: 'a', value: 'b' }, + { key: 'a.b', value: true }, + { key: 'a', value: 'c' }, + { key: 'a.c', value: true }, + { key: 'a', value: 'd' }, + { key: 'a.d', value: true }, + ]); + }); + + it('expands objects', () => { + const input = { a: { b: { c: 'd' }, e: 'f' } }; + const output = traverse(input); + expect(output).toEqual([ + { key: 'a.b.c', value: 'd' }, + { key: 'a.e', value: 'f' }, + ]); + }); + + it('expands list of objects', () => { + const input = { root: { list: [{ a: 1 }, { a: 2 }] } }; + const output = traverse(input); + expect(output).toEqual([ + { key: 'root.list.a', value: 1 }, + { key: 'root.list.a', value: 2 }, + ]); + }); + + it('skips over special keys', () => { + const input = { + state: { x: 1 }, + relations: [{ y: 2 }], + a: 'a', + metadata: { + b: 'b', + name: 'name', + namespace: 'namespace', + uid: 'uid', + etag: 'etag', + generation: 'generation', + c: 'c', + }, + d: 'd', + }; + const output = traverse(input); + expect(output).toEqual([ + { key: 'a', value: 'a' }, + { key: 'metadata.b', value: 'b' }, + { key: 'metadata.c', value: 'c' }, + { key: 'd', value: 'd' }, + ]); + }); + }); + + describe('mapToRows', () => { + it('converts base types to strings or null', () => { + const input = [ + { key: 'a', value: true }, + { key: 'b', value: false }, + { key: 'c', value: 7 }, + { key: 'd', value: 'string' }, + { key: 'e', value: null }, + { key: 'f', value: undefined }, + ]; + const output = mapToRows(input, 'eid'); + expect(output).toEqual([ + { entity_id: 'eid', key: 'a', value: 'true' }, + { entity_id: 'eid', key: 'b', value: 'false' }, + { entity_id: 'eid', key: 'c', value: '7' }, + { entity_id: 'eid', key: 'd', value: 'string' }, + { entity_id: 'eid', key: 'e', value: null }, + { entity_id: 'eid', key: 'f', value: null }, + ]); + }); + + it('emits lowercase version of keys and values', () => { + const input = [{ key: 'fOo', value: 'BaR' }]; + const output = mapToRows(input, 'eid'); + expect(output).toEqual([{ entity_id: 'eid', key: 'foo', value: 'bar' }]); + }); + + it('skips very large values', () => { + const input = [{ key: 'foo', value: 'a'.repeat(10000) }]; + const output = mapToRows(input, 'eid'); + expect(output).toEqual([]); + }); + }); + + describe('buildEntitySearch', () => { + it('adds special keys even if missing', () => { + const input: Entity = { + apiVersion: 'a', + kind: 'b', + metadata: { name: 'n' }, + }; + expect(buildEntitySearch('eid', input)).toEqual([ + { entity_id: 'eid', key: 'apiversion', value: 'a' }, + { entity_id: 'eid', key: 'kind', value: 'b' }, + { entity_id: 'eid', key: 'metadata.name', value: 'n' }, + { entity_id: 'eid', key: 'metadata.namespace', value: null }, + { entity_id: 'eid', key: 'metadata.uid', value: null }, + { + entity_id: 'eid', + key: 'metadata.namespace', + value: ENTITY_DEFAULT_NAMESPACE, + }, + ]); + }); + + it('adds relations', () => { + const input: Entity = { + relations: [ + { type: 't1', target: { kind: 'k', namespace: 'ns', name: 'a' } }, + { type: 't2', target: { kind: 'k', namespace: 'ns', name: 'b' } }, + ], + apiVersion: 'a', + kind: 'b', + metadata: { name: 'n' }, + }; + expect(buildEntitySearch('eid', input)).toEqual([ + { entity_id: 'eid', key: 'apiversion', value: 'a' }, + { entity_id: 'eid', key: 'kind', value: 'b' }, + { entity_id: 'eid', key: 'metadata.name', value: 'n' }, + { entity_id: 'eid', key: 'metadata.namespace', value: null }, + { entity_id: 'eid', key: 'metadata.uid', value: null }, + { + entity_id: 'eid', + key: 'metadata.namespace', + value: ENTITY_DEFAULT_NAMESPACE, + }, + { entity_id: 'eid', key: 'relations', value: 't1:k:ns/a' }, + { entity_id: 'eid', key: 'relations', value: 't2:k:ns/b' }, + ]); + }); + }); +}); diff --git a/plugins/catalog-backend/src/next/search.ts b/plugins/catalog-backend/src/next/search.ts new file mode 100644 index 0000000000..4aa8bae1a8 --- /dev/null +++ b/plugins/catalog-backend/src/next/search.ts @@ -0,0 +1,191 @@ +/* + * Copyright 2020 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 { + Entity, + ENTITY_DEFAULT_NAMESPACE, + stringifyEntityRef, +} from '@backstage/catalog-model'; + +export type DbSearchRow = { + entity_id: string; + key: string; + value: string | null; +}; + +// These are excluded in the generic loop, either because they do not make sense +// to index, or because they are special-case always inserted whether they are +// null or not +const SPECIAL_KEYS = [ + 'state', + 'relations', + 'metadata.name', + 'metadata.namespace', + 'metadata.uid', + 'metadata.etag', + 'metadata.generation', +]; + +// The maximum length allowed for search values. These columns are indexed, and +// database engines do not like to index on massive values. For example, +// postgres will balk after 8191 byte line sizes. +const MAX_VALUE_LENGTH = 200; + +type Kv = { + key: string; + value: unknown; +}; + +// Helper for traversing through a nested structure and outputting a list of +// path->value entries of the leaves. +// +// For example, this yaml structure +// +// a: 1 +// b: +// c: null +// e: [f, g] +// h: +// - i: 1 +// j: k +// - i: 2 +// j: l +// +// will result in +// +// "a", 1 +// "b.c", null +// "b.e": "f" +// "b.e.f": true +// "b.e": "g" +// "b.e.g": true +// "h.i": 1 +// "h.j": "k" +// "h.i": 2 +// "h.j": "l" +export function traverse(root: unknown): Kv[] { + const output: Kv[] = []; + + function visit(path: string, current: unknown) { + if (SPECIAL_KEYS.includes(path)) { + return; + } + + // empty or scalar + if ( + current === undefined || + current === null || + ['string', 'number', 'boolean'].includes(typeof current) + ) { + output.push({ key: path, value: current }); + return; + } + + // unknown + if (typeof current !== 'object') { + return; + } + + // array + if (Array.isArray(current)) { + for (const item of current) { + // NOTE(freben): The reason that these are output in two different ways, + // is to support use cases where you want to express that MORE than one + // tag is present in a list. Since the EntityFilters structure is a + // record, you can't have several entries of the same key. Therefore + // you will have to match on + // + // { "a.b": ["true"], "a.c": ["true"] } + // + // rather than + // + // { "a": ["b", "c"] } + // + // because the latter means EITHER b or c has to be present. + visit(path, item); + if (typeof item === 'string') { + output.push({ key: `${path}.${item}`, value: true }); + } + } + return; + } + + // object + for (const [key, value] of Object.entries(current!)) { + visit(path ? `${path}.${key}` : key, value); + } + } + + visit('', root); + + return output; +} + +// Translates a number of raw data rows to search table rows +export function mapToRows(input: Kv[], entityId: string): DbSearchRow[] { + const result: DbSearchRow[] = []; + + for (const { key: rawKey, value: rawValue } of input) { + const key = rawKey.toLocaleLowerCase('en-US'); + if (rawValue === undefined || rawValue === null) { + result.push({ entity_id: entityId, key, value: null }); + } else { + const value = String(rawValue).toLocaleLowerCase('en-US'); + if (value.length <= MAX_VALUE_LENGTH) { + result.push({ entity_id: entityId, key, value }); + } + } + } + + return result; +} + +/** + * Generates all of the search rows that are relevant for this entity. + * + * @param entityId The uid of the entity + * @param entity The entity + * @returns A list of entity search rows + */ +export function buildEntitySearch( + entityId: string, + entity: Entity, +): DbSearchRow[] { + // Visit the base structure recursively + const raw = traverse(entity); + + // Start with some special keys that are always present because you want to + // be able to easily search for null specifically + raw.push({ key: 'metadata.name', value: entity.metadata.name }); + raw.push({ key: 'metadata.namespace', value: entity.metadata.namespace }); + raw.push({ key: 'metadata.uid', value: entity.metadata.uid }); + + // Namespace not specified has the default value "default", so we want to + // match on that as well + if (!entity.metadata.namespace) { + raw.push({ key: 'metadata.namespace', value: ENTITY_DEFAULT_NAMESPACE }); + } + + // Visit relations + for (const relation of entity.relations ?? []) { + raw.push({ + key: 'relations', + value: `${relation.type}:${stringifyEntityRef(relation.target)}`, + }); + } + + return mapToRows(raw, entityId); +} diff --git a/plugins/catalog-backend/src/next/types.ts b/plugins/catalog-backend/src/next/types.ts index e0616fb336..cc9cc48ad6 100644 --- a/plugins/catalog-backend/src/next/types.ts +++ b/plugins/catalog-backend/src/next/types.ts @@ -120,6 +120,7 @@ export type ReplaceProcessingItemsRequest = removed: Entity[]; type: 'delta'; }; + export interface ProcessingStateManager { setProcessingItemResult(result: ProcessingItemResult): Promise; getNextProcessingItem(): Promise; From ec848a257d8ad6fb25b11c6e1329358c56492bf8 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 28 Apr 2021 11:57:33 +0200 Subject: [PATCH 170/485] chore: disable tests for now Signed-off-by: blam --- plugins/catalog-backend/package.json | 1 - plugins/catalog-backend/src/next/DefaultLocationStore.test.ts | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/catalog-backend/package.json b/plugins/catalog-backend/package.json index 5f70ec60e1..a5bb9e00af 100644 --- a/plugins/catalog-backend/package.json +++ b/plugins/catalog-backend/package.json @@ -78,7 +78,6 @@ "files": [ "dist", "migrations/**/*.{js,d.ts}", - "migrationsv2/**/*.{js,d.ts}", "config.d.ts" ], "configSchema": "config.d.ts" diff --git a/plugins/catalog-backend/src/next/DefaultLocationStore.test.ts b/plugins/catalog-backend/src/next/DefaultLocationStore.test.ts index be20179e9a..d30509eaec 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationStore.test.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationStore.test.ts @@ -17,7 +17,8 @@ import { DatabaseManager } from './database/DatabaseManager'; import { DefaultLocationStore } from './DefaultLocationStore'; import { v4 } from 'uuid'; -describe('Default Location Store', () => { +/* eslint-disable */ +xdescribe('Default Location Store', () => { const createLocationStore = async () => { const db = await DatabaseManager.createTestDatabase(); const connection = { applyMutation: jest.fn() }; From e2000428aec1302800520aa9a2ce2bfdc79a51cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 28 Apr 2021 12:18:41 +0200 Subject: [PATCH 171/485] add forgotten index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .../migrationsv2/20210302150147_refresh_state.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js index 4d2c30f194..7b0cf9b2a6 100644 --- a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js +++ b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js @@ -173,6 +173,7 @@ exports.up = async function up(knex) { .string('value') .nullable() .comment('The corresponding value to match on'); + table.index(['entity_id'], 'search_entity_id_idx'); table.index(['key'], 'search_key_idx'); table.index(['value'], 'search_value_idx'); }); @@ -201,6 +202,7 @@ exports.down = async function down(knex) { table.index('originating_entity_id', 'relations_source_entity_id_idx'); }); await knex.schema.alterTable('search', table => { + table.dropIndex([], 'search_entity_id_idx'); table.dropIndex([], 'search_key_idx'); table.dropIndex([], 'search_value_idx'); }); From 1ce80ff02230fba7afe6284425a15ff30112d981 Mon Sep 17 00:00:00 2001 From: Oliver Sand Date: Wed, 28 Apr 2021 12:50:03 +0200 Subject: [PATCH 172/485] Resolve issues with AsyncAPI rendering by updating `@asyncapi/react-component` to `0.23.0` Signed-off-by: Oliver Sand --- .changeset/calm-zebras-remain.md | 7 ++++ plugins/api-docs/package.json | 2 +- .../AsyncApiDefinitionWidget.tsx | 10 +---- yarn.lock | 38 +++++++++---------- 4 files changed, 28 insertions(+), 29 deletions(-) create mode 100644 .changeset/calm-zebras-remain.md diff --git a/.changeset/calm-zebras-remain.md b/.changeset/calm-zebras-remain.md new file mode 100644 index 0000000000..3b961ab3f2 --- /dev/null +++ b/.changeset/calm-zebras-remain.md @@ -0,0 +1,7 @@ +--- +'@backstage/plugin-api-docs': patch +--- + +Resolve issues with AsyncAPI rendering by updating `@asyncapi/react-component` +to `0.23.0`. The theming of the component is adjusted to the latest styling +changes. diff --git a/plugins/api-docs/package.json b/plugins/api-docs/package.json index 51df09ba80..532dacf684 100644 --- a/plugins/api-docs/package.json +++ b/plugins/api-docs/package.json @@ -29,7 +29,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@asyncapi/react-component": "^0.22.3", + "@asyncapi/react-component": "^0.23.0", "@backstage/catalog-model": "^0.7.7", "@backstage/core": "^0.7.6", "@backstage/plugin-catalog-react": "^0.1.4", diff --git a/plugins/api-docs/src/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.tsx b/plugins/api-docs/src/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.tsx index a908a91b14..300c9d0c8a 100644 --- a/plugins/api-docs/src/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.tsx +++ b/plugins/api-docs/src/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.tsx @@ -88,18 +88,10 @@ const useStyles = makeStyles(theme => ({ '& .asyncapi__enum': { color: theme.palette.secondary.main, }, - '& .asyncapi__toggle-arrow:before': { - content: '">"', - 'font-family': 'inherit', - }, - '& .asyncapi__anchor-icon:before': { - content: '"🔗"', - 'font-family': 'inherit', - }, '& .asyncapi__info, .asyncapi__channel, .asyncapi__channels > div, .asyncapi__schema, .asyncapi__channel-operations-list .asyncapi__messages-list-item .asyncapi__message, .asyncapi__message, .asyncapi__server, .asyncapi__servers > div, .asyncapi__messages > div, .asyncapi__schemas > div': { 'background-color': 'inherit', }, - '& .asyncapi__channel-parameters-header, .asyncapi__channel-operations-header, .asyncapi__channel-operation-oneOf-subscribe-header, .asyncapi__channel-operation-oneOf-publish-header': { + '& .asyncapi__channel-parameters-header, .asyncapi__channel-operations-header, .asyncapi__channel-operation-oneOf-subscribe-header, .asyncapi__channel-operation-oneOf-publish-header, .asyncapi__channel-operation-message-header, .asyncapi__message-header, .asyncapi__message-header-title, .asyncapi__message-header-title > h3, .asyncapi__bindings, .asyncapi__bindings-header, .asyncapi__bindings-header > h4': { 'background-color': 'inherit', color: theme.palette.text.primary, }, diff --git a/yarn.lock b/yarn.lock index 80819e5307..66be73ae3b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -69,22 +69,22 @@ dependencies: tslib "~2.0.1" -"@asyncapi/avro-schema-parser@^0.2.0": - version "0.2.0" - resolved "https://registry.npmjs.org/@asyncapi/avro-schema-parser/-/avro-schema-parser-0.2.0.tgz#c9da2bb2858aca5a3b9e9a0e600084afd3765551" - integrity sha512-/oPDPudF82RGFXz5uhF77PSDZkAR+yHpdxUEbJ5jwk/X3RB74VRk8dqSgTqhUO+pLh+/Hut3x3VFacA8C9L2QA== +"@asyncapi/avro-schema-parser@^0.2.1": + version "0.2.1" + resolved "https://registry.npmjs.org/@asyncapi/avro-schema-parser/-/avro-schema-parser-0.2.1.tgz#0b7d9953e12084e6f556db261ae08bd8f6690faa" + integrity sha512-RZJaHsdYM4dChYSrb/TWrVCn/r2qcus+9/8iLL8+SMINHb0ECgH8tFZFJpr3Tq+LV2SBFaRQ+9kuecjQ8BNDSA== -"@asyncapi/openapi-schema-parser@^2.0.0": - version "2.0.0" - resolved "https://registry.npmjs.org/@asyncapi/openapi-schema-parser/-/openapi-schema-parser-2.0.0.tgz#80e2f38e92b6635dde19aae07b92e3caa0effc58" - integrity sha512-XfDp3EIs6ptar3jARQZzi3ObmS44l6Qozc5GJmZJUQ6mHLTTqUGJ0nxcrXAW88vosjilgJVaQ63oGolA6smSHQ== +"@asyncapi/openapi-schema-parser@^2.0.1": + version "2.0.1" + resolved "https://registry.npmjs.org/@asyncapi/openapi-schema-parser/-/openapi-schema-parser-2.0.1.tgz#4d6e82cced907b14e0ad6f98261ff2562d968d96" + integrity sha512-algbtdM1gcAOa8+V8kp7WeBhdaNac82jmZUXx8YjyNfRVo02N2juDrjeBAGJd+FNva9Mb4MM7qfkJoAFpTL5VQ== dependencies: "@openapi-contrib/openapi-schema-to-json-schema" "^3.0.0" -"@asyncapi/parser@^1.4.4": - version "1.4.4" - resolved "https://registry.npmjs.org/@asyncapi/parser/-/parser-1.4.4.tgz#66f2642e3f9ae4166cdea2480b665250b1edbd59" - integrity sha512-HEYEDM0BzfCxXNAv/pIS5yZWe11xB8fQo9G/SmsbpJavOpcF0sVZVIELva/NxHVz/ZUKPMKCa4Gqz7DF/lMqpw== +"@asyncapi/parser@^1.5.0": + version "1.5.0" + resolved "https://registry.npmjs.org/@asyncapi/parser/-/parser-1.5.0.tgz#d70616a1e6081c7dd86957befd5dccc46b9a77df" + integrity sha512-HzrehCcT6R+iqtktNmrUM9wRUEMBqnCeXIrGJT0txBMS1QduNRmXGjvuDpxqwyaATPH/xu1gSp2l6pFP/hyVbA== dependencies: "@apidevtools/json-schema-ref-parser" "^9.0.6" "@asyncapi/specs" "^2.7.7" @@ -96,14 +96,14 @@ node-fetch "^2.6.0" tiny-merge-patch "^0.1.2" -"@asyncapi/react-component@^0.22.3": - version "0.22.3" - resolved "https://registry.npmjs.org/@asyncapi/react-component/-/react-component-0.22.3.tgz#6ea7fb1044308e6d46f8455218920389becf2b22" - integrity sha512-f47sboqEQ0jNp0z2A+WGzBYYMS3ASmTwAXG/q6SwLuHBW15bSjaIYOVK3E8bmftBl+wVcEgAqUc6RKGtD9iVJg== +"@asyncapi/react-component@^0.23.0": + version "0.23.0" + resolved "https://registry.npmjs.org/@asyncapi/react-component/-/react-component-0.23.0.tgz#dce9a95cd0fb0d9f0364278088ad31194d411d52" + integrity sha512-mX70k3j5eSM7ets8BBZWnu6RsNXapLKD/7np+dMeXFk7KFbigVQXXr3hS0k2R+c8tRfkhlklicibq5ar1+fjDA== dependencies: - "@asyncapi/avro-schema-parser" "^0.2.0" - "@asyncapi/openapi-schema-parser" "^2.0.0" - "@asyncapi/parser" "^1.4.4" + "@asyncapi/avro-schema-parser" "^0.2.1" + "@asyncapi/openapi-schema-parser" "^2.0.1" + "@asyncapi/parser" "^1.5.0" constate "^1.2.0" dompurify "^2.1.1" markdown-it "^11.0.1" From 11461a20b304c47eae7581b9a77de5e033ab78e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 28 Apr 2021 14:50:05 +0200 Subject: [PATCH 173/485] await the connection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .../catalog-backend/src/next/DefaultCatalogProcessingEngine.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts index 1934b0aea7..9de9f0ffd5 100644 --- a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts +++ b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts @@ -68,7 +68,7 @@ export class DefaultCatalogProcessingEngine implements CatalogProcessingEngine { async start() { for (const provider of this.entityProviders) { - provider.connect( + await provider.connect( new Connection({ stateManager: this.stateManager, id: provider.getProviderName(), From d1b1306d98a51f4a6e9814fb18a4abdb7179c2e8 Mon Sep 17 00:00:00 2001 From: Will Date: Tue, 27 Apr 2021 15:36:01 +0100 Subject: [PATCH 174/485] catalog-client: allow `filter` param to be specified multiple times This is possible on the backend, see: - https://github.com/backstage/backstage/blob/f9d077f5f6c3bf1e20255359798dd1febbeb3e27/plugins/catalog-backend/src/database/types.ts#L129-L131 - https://github.com/backstage/backstage/blob/f9d077f5f6c3bf1e20255359798dd1febbeb3e27/plugins/catalog-backend/src/service/request/parseEntityFilterParams.ts#L25-L42 Signed-off-by: Will Sewell --- .changeset/twenty-peas-deny.md | 5 +++ .../catalog-client/src/CatalogClient.test.ts | 32 +++++++++++++++++++ packages/catalog-client/src/CatalogClient.ts | 25 ++++++++++----- packages/catalog-client/src/types.ts | 5 ++- 4 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 .changeset/twenty-peas-deny.md diff --git a/.changeset/twenty-peas-deny.md b/.changeset/twenty-peas-deny.md new file mode 100644 index 0000000000..61c9cb3587 --- /dev/null +++ b/.changeset/twenty-peas-deny.md @@ -0,0 +1,5 @@ +--- +'@backstage/catalog-client': minor +--- + +Allow `filter` param to be specified multiple times diff --git a/packages/catalog-client/src/CatalogClient.test.ts b/packages/catalog-client/src/CatalogClient.test.ts index 19da45e4ec..fefe670a55 100644 --- a/packages/catalog-client/src/CatalogClient.test.ts +++ b/packages/catalog-client/src/CatalogClient.test.ts @@ -79,6 +79,37 @@ describe('CatalogClient', () => { it('builds entity search filters properly', async () => { expect.assertions(2); + server.use( + rest.get(`${mockBaseUrl}/entities`, (req, res, ctx) => { + expect(req.url.search).toBe( + '?filter=a=1,b=2,b=3,%C3%B6=%3D&filter=a=2', + ); + return res(ctx.json([])); + }), + ); + + const response = await client.getEntities( + { + filter: [ + { + a: '1', + b: ['2', '3'], + ö: '=', + }, + { + a: '2', + }, + ], + }, + { token }, + ); + + expect(response.items).toEqual([]); + }); + + it('builds entity legacy search filters properly', async () => { + expect.assertions(2); + server.use( rest.get(`${mockBaseUrl}/entities`, (req, res, ctx) => { expect(req.url.search).toBe('?filter=a=1,b=2,b=3,%C3%B6=%3D'); @@ -88,6 +119,7 @@ describe('CatalogClient', () => { const response = await client.getEntities( { + // The legacy value of filter is not an array filter: { a: '1', b: ['2', '3'], diff --git a/packages/catalog-client/src/CatalogClient.ts b/packages/catalog-client/src/CatalogClient.ts index 3de25e9808..a246b3abab 100644 --- a/packages/catalog-client/src/CatalogClient.ts +++ b/packages/catalog-client/src/CatalogClient.ts @@ -56,18 +56,27 @@ export class CatalogClient implements CatalogApi { request?: CatalogEntitiesRequest, options?: CatalogRequestOptions, ): Promise> { - const { filter = {}, fields = [] } = request ?? {}; + const { filter = [], fields = [] } = request ?? {}; + const filterItems = [filter].flat(); const params: string[] = []; - const filterParts: string[] = []; - for (const [key, value] of Object.entries(filter)) { - for (const v of [value].flat()) { - filterParts.push(`${encodeURIComponent(key)}=${encodeURIComponent(v)}`); + // filter param can occur multiple times, for example + // /api/catalog/entities?filter=metadata.name=wayback-search,kind=component&filter=metadata.name=www-artist,kind=component' + // the "outer array" defined by `filter` occurrences corresponds to "anyOf" filters + // the "inner array" defined within a `filter` param corresponds to "allOf" filters + for (const filterItem of filterItems) { + const filterParts: string[] = []; + for (const [key, value] of Object.entries(filterItem)) { + for (const v of [value].flat()) { + filterParts.push( + `${encodeURIComponent(key)}=${encodeURIComponent(v)}`, + ); + } } - } - if (filterParts.length) { - params.push(`filter=${filterParts.join(',')}`); + if (filterParts.length) { + params.push(`filter=${filterParts.join(',')}`); + } } if (fields.length) { diff --git a/packages/catalog-client/src/types.ts b/packages/catalog-client/src/types.ts index 0d25bf7483..9035657ddc 100644 --- a/packages/catalog-client/src/types.ts +++ b/packages/catalog-client/src/types.ts @@ -17,7 +17,10 @@ import { Entity, EntityName, Location } from '@backstage/catalog-model'; export type CatalogEntitiesRequest = { - filter?: Record | undefined; + filter?: + | Record[] + | Record // Legacy type preserved for backwards compatibility + | undefined; fields?: string[] | undefined; }; From 17644ca68eb67dea67b1691f34181c61b811326a Mon Sep 17 00:00:00 2001 From: Will Date: Wed, 28 Apr 2021 14:23:10 +0100 Subject: [PATCH 175/485] Don't treat singuler `filter` type as legacy Instead it's a convenience type for when only a single instance of a param is required. Signed-off-by: Will Sewell --- packages/catalog-client/src/CatalogClient.test.ts | 5 ++--- packages/catalog-client/src/types.ts | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/catalog-client/src/CatalogClient.test.ts b/packages/catalog-client/src/CatalogClient.test.ts index fefe670a55..359e3a2c60 100644 --- a/packages/catalog-client/src/CatalogClient.test.ts +++ b/packages/catalog-client/src/CatalogClient.test.ts @@ -76,7 +76,7 @@ describe('CatalogClient', () => { expect(response).toEqual(defaultResponse); }); - it('builds entity search filters properly', async () => { + it('builds multiple entity search filters properly', async () => { expect.assertions(2); server.use( @@ -107,7 +107,7 @@ describe('CatalogClient', () => { expect(response.items).toEqual([]); }); - it('builds entity legacy search filters properly', async () => { + it('builds single entity search filter properly', async () => { expect.assertions(2); server.use( @@ -119,7 +119,6 @@ describe('CatalogClient', () => { const response = await client.getEntities( { - // The legacy value of filter is not an array filter: { a: '1', b: ['2', '3'], diff --git a/packages/catalog-client/src/types.ts b/packages/catalog-client/src/types.ts index 9035657ddc..ef907eafa9 100644 --- a/packages/catalog-client/src/types.ts +++ b/packages/catalog-client/src/types.ts @@ -19,7 +19,7 @@ import { Entity, EntityName, Location } from '@backstage/catalog-model'; export type CatalogEntitiesRequest = { filter?: | Record[] - | Record // Legacy type preserved for backwards compatibility + | Record | undefined; fields?: string[] | undefined; }; From bd877d4518ec75be2ce9d63ad6cd26da93d1808c Mon Sep 17 00:00:00 2001 From: Will Date: Wed, 28 Apr 2021 14:25:05 +0100 Subject: [PATCH 176/485] Make "patch"-level change instead of "minor" Signed-off-by: Will Sewell --- .changeset/twenty-peas-deny.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/twenty-peas-deny.md b/.changeset/twenty-peas-deny.md index 61c9cb3587..df335ea95a 100644 --- a/.changeset/twenty-peas-deny.md +++ b/.changeset/twenty-peas-deny.md @@ -1,5 +1,5 @@ --- -'@backstage/catalog-client': minor +'@backstage/catalog-client': patch --- Allow `filter` param to be specified multiple times From d8b81fd28bf3cacf96cf62739e092f01568234fb Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Wed, 28 Apr 2021 16:11:29 +0200 Subject: [PATCH 177/485] changesets: add changeset for json-schema bump Signed-off-by: Patrik Oldsberg --- .changeset/tough-walls-wash.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .changeset/tough-walls-wash.md diff --git a/.changeset/tough-walls-wash.md b/.changeset/tough-walls-wash.md new file mode 100644 index 0000000000..a45adcfbf6 --- /dev/null +++ b/.changeset/tough-walls-wash.md @@ -0,0 +1,9 @@ +--- +'@backstage/catalog-model': patch +'@backstage/cli': patch +'@backstage/config-loader': patch +'@backstage/config': patch +'@backstage/plugin-scaffolder': patch +--- + +Bump `json-schema` dependency from `0.2.5` to `0.3.0`. From 55e1d9f3a58696ad23e50e49a1a48a173aef10bb Mon Sep 17 00:00:00 2001 From: jrusso1020 Date: Wed, 28 Apr 2021 08:45:35 -0600 Subject: [PATCH 178/485] update JSON Signed-off-by: jrusso1020 --- docs/features/software-catalog/descriptor-format.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/features/software-catalog/descriptor-format.md b/docs/features/software-catalog/descriptor-format.md index 0dba11fd62..eb087a9c5f 100644 --- a/docs/features/software-catalog/descriptor-format.md +++ b/docs/features/software-catalog/descriptor-format.md @@ -77,7 +77,7 @@ This is the same entity as returned in JSON from the software catalog API: "etag": "ZjU2MWRkZWUtMmMxZS00YTZiLWFmMWMtOTE1NGNiZDdlYzNk", "generation": 1, "labels": { - "backstage.io/custom": "ValueStuff" + "example.com/custom": "custom_label_value" }, "links": [{ "url": "https://admin.example-org.com", From d6cfbc797f768de5760eec9b93ade77ad9282597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 28 Apr 2021 17:05:55 +0200 Subject: [PATCH 179/485] Tweaks to the v2 catalog ingestion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .../20210302150147_refresh_state.js | 14 ++++++-- .../src/next/NextEntitiesCatalog.ts | 2 +- .../catalog-backend/src/next/Stitcher.test.ts | 25 ++++++------- plugins/catalog-backend/src/next/Stitcher.ts | 36 +++++++++++-------- .../catalog-backend/src/next/search.test.ts | 4 +-- plugins/catalog-backend/src/next/search.ts | 4 +-- 6 files changed, 50 insertions(+), 35 deletions(-) diff --git a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js index 7b0cf9b2a6..4c03405910 100644 --- a/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js +++ b/plugins/catalog-backend/migrationsv2/20210302150147_refresh_state.js @@ -83,10 +83,18 @@ exports.up = async function up(knex) { .inTable('refresh_state') .onDelete('CASCADE') .comment( - 'Entity ID which correspond to the ID in the refresh_state table', + 'Entity ID which corresponds to the ID in the refresh_state table', ); - table.text('etag').notNullable().comment('Etag to be used for caching'); - table.text('finalized_entity').notNullable().comment('The final entity'); + table + .text('hash') + .notNullable() + .comment( + 'Stable hash of the entity data, to be used for caching and avoiding redundant work', + ); + table + .text('final_entity') + .notNullable() + .comment('The JSON encoded final entity'); table.index('entity_id', 'final_entities_entity_id_idx'); }); diff --git a/plugins/catalog-backend/src/next/NextEntitiesCatalog.ts b/plugins/catalog-backend/src/next/NextEntitiesCatalog.ts index 5bddd47f41..e87bb01e1f 100644 --- a/plugins/catalog-backend/src/next/NextEntitiesCatalog.ts +++ b/plugins/catalog-backend/src/next/NextEntitiesCatalog.ts @@ -37,7 +37,7 @@ export class NextEntitiesCatalog implements EntitiesCatalog { 'final_entities', ).select(); - const entities = dbResponse.map(e => JSON.parse(e.finalized_entity)); + const entities = dbResponse.map(e => JSON.parse(e.final_entity)); return { entities, diff --git a/plugins/catalog-backend/src/next/Stitcher.test.ts b/plugins/catalog-backend/src/next/Stitcher.test.ts index 327d922c07..f38af384fa 100644 --- a/plugins/catalog-backend/src/next/Stitcher.test.ts +++ b/plugins/catalog-backend/src/next/Stitcher.test.ts @@ -74,12 +74,12 @@ describe('Stitcher', () => { await stitcher.stitch(new Set(['k:ns/n'])); - let firstEtag: string; + let firstHash: string; await db.transaction(async tx => { const entities = await tx('final_entities'); expect(entities.length).toBe(1); - const entity = JSON.parse(entities[0].finalized_entity); + const entity = JSON.parse(entities[0].final_entity); expect(entity).toEqual({ relations: [ { @@ -105,12 +105,13 @@ describe('Stitcher', () => { }, }); - firstEtag = entity.metadata.etag; + expect(entity.metadata.etag).toEqual(entities[0].hash); + firstHash = entities[0].hash; const search = await tx('search'); expect(search).toEqual( expect.arrayContaining([ - { entity_id: 'my-id', key: 'relations', value: 'looksat:k:ns/other' }, + { entity_id: 'my-id', key: 'relations.looksat', value: 'k:ns/other' }, { entity_id: 'my-id', key: 'apiversion', value: 'a' }, { entity_id: 'my-id', key: 'kind', value: 'k' }, { entity_id: 'my-id', key: 'metadata.name', value: 'n' }, @@ -127,9 +128,9 @@ describe('Stitcher', () => { await db.transaction(async tx => { const entities = await tx('final_entities'); expect(entities.length).toBe(1); - const entity = JSON.parse(entities[0].finalized_entity); - expect(entities[0].etag).toEqual(firstEtag); - expect(entity.metadata.etag).toEqual(firstEtag); + const entity = JSON.parse(entities[0].final_entity); + expect(entities[0].hash).toEqual(firstHash); + expect(entity.metadata.etag).toEqual(firstHash); }); // Now add one more relation and re-stitch @@ -150,7 +151,7 @@ describe('Stitcher', () => { const entities = await tx('final_entities'); expect(entities.length).toBe(1); - const entity = JSON.parse(entities[0].finalized_entity); + const entity = JSON.parse(entities[0].final_entity); expect(entity).toEqual({ relations: expect.arrayContaining([ { @@ -184,14 +185,14 @@ describe('Stitcher', () => { }, }); - expect(entities[0].etag).not.toEqual(firstEtag); - expect(entities[0].etag).toEqual(entity.metadata.etag); + expect(entities[0].hash).not.toEqual(firstHash); + expect(entities[0].hash).toEqual(entity.metadata.etag); const search = await tx('search'); expect(search).toEqual( expect.arrayContaining([ - { entity_id: 'my-id', key: 'relations', value: 'looksat:k:ns/other' }, - { entity_id: 'my-id', key: 'relations', value: 'looksat:k:ns/third' }, + { entity_id: 'my-id', key: 'relations.looksat', value: 'k:ns/other' }, + { entity_id: 'my-id', key: 'relations.looksat', value: 'k:ns/third' }, { entity_id: 'my-id', key: 'apiversion', value: 'a' }, { entity_id: 'my-id', key: 'kind', value: 'k' }, { entity_id: 'my-id', key: 'metadata.name', value: 'n' }, diff --git a/plugins/catalog-backend/src/next/Stitcher.ts b/plugins/catalog-backend/src/next/Stitcher.ts index cd9220e934..bdc028d923 100644 --- a/plugins/catalog-backend/src/next/Stitcher.ts +++ b/plugins/catalog-backend/src/next/Stitcher.ts @@ -31,11 +31,11 @@ const BATCH_SIZE = 50; export type DbFinalEntitiesRow = { entity_id: string; - etag: string; - finalized_entity: string; + hash: string; + final_entity: string; }; -function generateEntityEtag(entity: Entity) { +function generateStableHash(entity: Entity) { return createHash('sha1') .update(stableStringify({ ...entity })) .digest('hex'); @@ -64,7 +64,7 @@ export class Stitcher { processedEntity?: string; errors: string; incomingReferenceCount: string | number; - previousEtag?: string; + previousHash?: string; relationType?: string; relationTarget?: string; }> = await tx @@ -79,7 +79,7 @@ export class Stitcher { processedEntity: 'refresh_state.processed_entity', errors: 'refresh_state.errors', incomingReferenceCount: 'incoming_references.count', - previousEtag: 'final_entities.etag', + previousHash: 'final_entities.hash', relationType: 'relations.type', relationTarget: 'relations.target_entity_ref', }) @@ -111,7 +111,7 @@ export class Stitcher { processedEntity, // errors, incomingReferenceCount, - previousEtag, + previousHash, } = result[0]; // If there was no processed entity in place, the target hasn't been @@ -125,7 +125,8 @@ export class Stitcher { return; } - // Grab the processed entity and stitch all of the relevant data into it + // Grab the processed entity and stitch all of the relevant data into + // it const entity = JSON.parse(processedEntity) as Entity; const isOrphan = Number(incomingReferenceCount) === 0; @@ -137,33 +138,38 @@ export class Stitcher { }; } - // TODO: entityRef is lower case and should be uppercase in the final result + // TODO: entityRef is lower case and should be uppercase in the final + // result entity.relations = result - .filter(row => row.relationType) + .filter(row => row.relationType /* exclude null row, if relevant */) .map(row => ({ type: row.relationType!, target: parseEntityRef(row.relationTarget!), })); // If the output entity was actually not changed, just abort - const etag = generateEntityEtag(entity); - if (etag === previousEtag) { + const hash = generateStableHash(entity); + if (hash === previousHash) { this.logger.debug(`Skipped stitching of ${entityRef}, no changes`); return; } entity.metadata.uid = entityId; entity.metadata.generation = 1; - entity.metadata.etag = etag; + if (!entity.metadata.etag) { + // If the original data source did not have its own etag handling, + // use the hash as a good-quality etag + entity.metadata.etag = hash; + } await tx('final_entities') .insert({ entity_id: entityId, - finalized_entity: JSON.stringify(entity), - etag, + final_entity: JSON.stringify(entity), + hash, }) .onConflict('entity_id') - .merge(['finalized_entity', 'etag']); + .merge(['final_entity', 'hash']); const searchEntries = buildEntitySearch(entityId, entity); await tx('search').where({ entity_id: entityId }).delete(); diff --git a/plugins/catalog-backend/src/next/search.test.ts b/plugins/catalog-backend/src/next/search.test.ts index be9a98fe69..ff1cba01b9 100644 --- a/plugins/catalog-backend/src/next/search.test.ts +++ b/plugins/catalog-backend/src/next/search.test.ts @@ -152,8 +152,8 @@ describe('search', () => { key: 'metadata.namespace', value: ENTITY_DEFAULT_NAMESPACE, }, - { entity_id: 'eid', key: 'relations', value: 't1:k:ns/a' }, - { entity_id: 'eid', key: 'relations', value: 't2:k:ns/b' }, + { entity_id: 'eid', key: 'relations.t1', value: 'k:ns/a' }, + { entity_id: 'eid', key: 'relations.t2', value: 'k:ns/b' }, ]); }); }); diff --git a/plugins/catalog-backend/src/next/search.ts b/plugins/catalog-backend/src/next/search.ts index 4aa8bae1a8..5ff0721f91 100644 --- a/plugins/catalog-backend/src/next/search.ts +++ b/plugins/catalog-backend/src/next/search.ts @@ -182,8 +182,8 @@ export function buildEntitySearch( // Visit relations for (const relation of entity.relations ?? []) { raw.push({ - key: 'relations', - value: `${relation.type}:${stringifyEntityRef(relation.target)}`, + key: `relations.${relation.type}`, + value: stringifyEntityRef(relation.target), }); } From d5b892d0410eb2c75711087acc81a876a47a953f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20A=CC=8Ahsberg?= Date: Wed, 28 Apr 2021 15:18:55 +0000 Subject: [PATCH 180/485] Wrap Bitbucket types into separate namespace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathias Åhsberg --- .../processors/BitbucketDiscoveryProcessor.ts | 4 ++-- .../BitbucketRepositoryParser.test.ts | 6 ++--- .../bitbucket/BitbucketRepositoryParser.ts | 4 ++-- .../ingestion/processors/bitbucket/types.ts | 24 ++++++++++--------- .../src/ingestion/processors/index.ts | 3 +-- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.ts b/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.ts index f92a5c6f7c..858219423f 100644 --- a/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.ts +++ b/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.ts @@ -22,7 +22,7 @@ import { } from '@backstage/integration'; import { LocationSpec } from '@backstage/catalog-model'; import { - Repository, + Bitbucket, BitbucketRepositoryParser, BitbucketClient, defaultRepositoryParser, @@ -159,5 +159,5 @@ function escapeRegExp(str: string): RegExp { type Result = { scanned: number; - matches: Repository[]; + matches: Bitbucket.Repository[]; }; diff --git a/plugins/catalog-backend/src/ingestion/processors/bitbucket/BitbucketRepositoryParser.test.ts b/plugins/catalog-backend/src/ingestion/processors/bitbucket/BitbucketRepositoryParser.test.ts index ab5080f446..e0d430f77b 100644 --- a/plugins/catalog-backend/src/ingestion/processors/bitbucket/BitbucketRepositoryParser.test.ts +++ b/plugins/catalog-backend/src/ingestion/processors/bitbucket/BitbucketRepositoryParser.test.ts @@ -14,7 +14,7 @@ * limitations under the License. */ import { defaultRepositoryParser } from './BitbucketRepositoryParser'; -import { Project, Repository } from './types'; +import { Bitbucket } from './types'; import { BitbucketClient } from './client'; import { results } from '../index'; @@ -36,12 +36,12 @@ describe('BitbucketRepositoryParser', () => { const actual = await defaultRepositoryParser({ client: {} as BitbucketClient, repository: { - project: {} as Project, + project: {} as Bitbucket.Project, slug: 'repo-slug', links: { self: [{ href: browseUrl }], }, - } as Repository, + } as Bitbucket.Repository, path: path, }); diff --git a/plugins/catalog-backend/src/ingestion/processors/bitbucket/BitbucketRepositoryParser.ts b/plugins/catalog-backend/src/ingestion/processors/bitbucket/BitbucketRepositoryParser.ts index f786b6dac8..05e3c6822a 100644 --- a/plugins/catalog-backend/src/ingestion/processors/bitbucket/BitbucketRepositoryParser.ts +++ b/plugins/catalog-backend/src/ingestion/processors/bitbucket/BitbucketRepositoryParser.ts @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Repository } from './types'; +import { Bitbucket } from './types'; import { CatalogProcessorResult } from '../types'; import { results } from '../index'; import { BitbucketClient } from './client'; export type BitbucketRepositoryParser = (options: { client: BitbucketClient; - repository: Repository; + repository: Bitbucket.Repository; path: string; }) => AsyncIterable; diff --git a/plugins/catalog-backend/src/ingestion/processors/bitbucket/types.ts b/plugins/catalog-backend/src/ingestion/processors/bitbucket/types.ts index 75dd372faa..8a8656f666 100644 --- a/plugins/catalog-backend/src/ingestion/processors/bitbucket/types.ts +++ b/plugins/catalog-backend/src/ingestion/processors/bitbucket/types.ts @@ -13,16 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export type Project = { - key: string; -}; +export namespace Bitbucket { + export type Project = { + key: string; + }; -export type Repository = { - project: Project; - slug: string; - links: Record; -}; + export type Repository = { + project: Project; + slug: string; + links: Record; + }; -export type Link = { - href: string; -}; + export type Link = { + href: string; + }; +} diff --git a/plugins/catalog-backend/src/ingestion/processors/index.ts b/plugins/catalog-backend/src/ingestion/processors/index.ts index 8d1a7967cd..c8f51bbccc 100644 --- a/plugins/catalog-backend/src/ingestion/processors/index.ts +++ b/plugins/catalog-backend/src/ingestion/processors/index.ts @@ -36,6 +36,5 @@ export { UrlReaderProcessor } from './UrlReaderProcessor'; export { parseEntityYaml } from './util/parse'; export { results }; -export * from './bitbucket/types'; export { BitbucketClient } from './bitbucket'; -export type { BitbucketRepositoryParser } from './bitbucket'; +export type { BitbucketRepositoryParser, Bitbucket } from './bitbucket'; From a7a68535e161ade9970e396056c18857c45bafec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 28 Apr 2021 18:31:26 +0200 Subject: [PATCH 181/485] Minor typo entites -> entities and remove unused type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .../src/next/DefaultCatalogProcessingEngine.ts | 2 +- .../next/DefaultCatalogProcessingOrchestrator.ts | 10 +++++----- plugins/catalog-backend/src/next/types.ts | 14 +------------- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts index 9de9f0ffd5..1397d9038a 100644 --- a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts +++ b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts @@ -105,7 +105,7 @@ export class DefaultCatalogProcessingEngine implements CatalogProcessingEngine { state: result.state, errors: result.errors, relations: result.relations, - deferredEntities: result.deferredEntites, + deferredEntities: result.deferredEntities, }); const setOfThingsToStitch = new Set([ diff --git a/plugins/catalog-backend/src/next/DefaultCatalogProcessingOrchestrator.ts b/plugins/catalog-backend/src/next/DefaultCatalogProcessingOrchestrator.ts index 1880b5d17e..8fbb19e536 100644 --- a/plugins/catalog-backend/src/next/DefaultCatalogProcessingOrchestrator.ts +++ b/plugins/catalog-backend/src/next/DefaultCatalogProcessingOrchestrator.ts @@ -179,7 +179,7 @@ export class DefaultCatalogProcessingOrchestrator ); } - // Backwards compatible processing of location entites + // Backwards compatible processing of location entities if (isLocationEntity(entity)) { const { type = location.type } = entity.spec; const targets = new Array(); @@ -268,7 +268,7 @@ function createEmitter(logger: Logger, parentEntity: Entity) { const errors = new Array(); const relations = new Array(); - const deferredEntites = new Array(); + const deferredEntities = new Array(); const emit = (i: CatalogProcessorResult) => { if (done) { @@ -282,7 +282,7 @@ function createEmitter(logger: Logger, parentEntity: Entity) { if (i.type === 'entity') { const originLocation = getEntityOriginLocationRef(parentEntity); - deferredEntites.push({ + deferredEntities.push({ ...i.entity, metadata: { ...i.entity.metadata, @@ -294,7 +294,7 @@ function createEmitter(logger: Logger, parentEntity: Entity) { }, }); } else if (i.type === 'location') { - deferredEntites.push( + deferredEntities.push( locationSpecToLocationEntity(i.location, parentEntity), ); } else if (i.type === 'relation') { @@ -311,7 +311,7 @@ function createEmitter(logger: Logger, parentEntity: Entity) { return { errors, relations, - deferredEntites, + deferredEntities, }; }, }; diff --git a/plugins/catalog-backend/src/next/types.ts b/plugins/catalog-backend/src/next/types.ts index cc9cc48ad6..202576fddd 100644 --- a/plugins/catalog-backend/src/next/types.ts +++ b/plugins/catalog-backend/src/next/types.ts @@ -22,18 +22,6 @@ import { } from '@backstage/catalog-model'; import { JsonObject } from '@backstage/config'; -export interface LocationEntity { - apiVersion: 'backstage.io/v1alpha1'; - kind: 'Location'; - metadata: { - name: string; // type:target - namespace: 'default'; - }; - spec: { - location: { type: string; target: string }; - }; -} - export interface LocationService { createLocation( spec: LocationSpec, @@ -80,7 +68,7 @@ export type EntityProcessingResult = ok: true; state: Map; completedEntity: Entity; - deferredEntites: Entity[]; + deferredEntities: Entity[]; relations: EntityRelationSpec[]; errors: Error[]; } From 30821b2b413bf1a46daf09c0c5600864d6f962a1 Mon Sep 17 00:00:00 2001 From: Tim Hansen Date: Wed, 28 Apr 2021 10:57:00 -0600 Subject: [PATCH 182/485] Update cost-insights and circleci logos Signed-off-by: Tim Hansen --- microsite/data/plugins/circleci.yaml | 2 +- microsite/data/plugins/cost-insights.yaml | 2 +- microsite/static/img/circleci.png | Bin 0 -> 16688 bytes microsite/static/img/cost-insights.png | Bin 0 -> 105171 bytes 4 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 microsite/static/img/circleci.png create mode 100644 microsite/static/img/cost-insights.png diff --git a/microsite/data/plugins/circleci.yaml b/microsite/data/plugins/circleci.yaml index 0acad832fa..cffbedca37 100644 --- a/microsite/data/plugins/circleci.yaml +++ b/microsite/data/plugins/circleci.yaml @@ -5,7 +5,7 @@ authorUrl: https://github.com/spotify category: CI/CD description: Automate your development process with CI hosted in the cloud or on a private server. documentation: https://github.com/backstage/backstage/tree/master/plugins/circleci -iconUrl: https://www.saaves.com/storage/brochure/logo-circleci-icon1583764538.png +iconUrl: img/circleci.png npmPackageName: '@backstage/plugin-circleci' tags: - ci diff --git a/microsite/data/plugins/cost-insights.yaml b/microsite/data/plugins/cost-insights.yaml index daa4f55a02..ec2d162b9d 100644 --- a/microsite/data/plugins/cost-insights.yaml +++ b/microsite/data/plugins/cost-insights.yaml @@ -5,7 +5,7 @@ authorUrl: https://github.com/spotify category: Discovery description: Visualize, understand and optimize your team's cloud costs. documentation: https://github.com/backstage/backstage/tree/master/plugins/cost-insights -iconUrl: https://www.materialui.co/materialIcons/editor/monetization_on_white_192x192.png +iconUrl: img/cost-insights.png npmPackageName: '@backstage/plugin-cost-insights' tags: - web diff --git a/microsite/static/img/circleci.png b/microsite/static/img/circleci.png new file mode 100644 index 0000000000000000000000000000000000000000..3fc450d54d9afbea45c5717cd68f9315dce7fa01 GIT binary patch literal 16688 zcmXwB2UJtb)4xdwp;zfWAV?9=&+w=DnItq*n&Zq-meOOQFXrJzi=W--5Q9-w@_Q<Iq8I zSM--OMX27tki|_iC|*n~VFYx1ylaeo8U$rt%4GG*B+CV_2$l&}3f2wQER@yUcyy{N zx$M{Bn?D&-lc>eA&1Dn4DYU}|DS;{eJ#H={7li~wf=q(8rnHNKO9W-}1EHgO{wfQI za1!PnMqNQ)k+{;~_6_|_g3{&o4Z3;ZRbhcIJOmfRI^5B>^ux4e6Oaj)2GXZpY8*dm;dE3B1DMJ{b;r)&6jDcPWU);8?eZ=5xAUIwah zi4VOpP}(LPw)4a78+7I^Q&c=+2kI@fJlOP-bl3u7o)}J%B(EWR@{hs4z<@e$R25#xAfJ-p$UZx z0VdCWGb_)UF}QE~_7U*l-Hm3)W*(xOOz!j=s23BNp_>sJ1y?ke{DxNeT?XGsiWasI zb$;nW;peYR_|Ce>>w3P=pZ3KSyG(a^?XQ9IYz1zosqKqfVZqbmgkLjC^#;)mjDT|r z#%ost(MRv^Tu4HQ^4ez~Yz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%!xF<0kM)aN=#BWs$G|7!>Z0QsyETEjoBcrre50Tdh0J!dUMO z5;l`vc1`OlAHy(_Q@Sh~tzg_+WeaFf$R$ro5&v-WHFO#R7>JIU>#;{ry9mujnzff9 zRM{Aiiv4XzM!_0|p#$uXNFfFGh9QE1dJ&B-w5j;os;_3Sd<#%0m&eW`wWR3u} z`WU={mGkqhZMpNpUd*~Ks9wpwc@%7M^&W zKfhx#Ul{OnK6{pU@b}OCz-IU6^Yxq!XF;WF!v=%52I*Z454b>j7!*$5-x&j>9Y8G$ z;HiABKxYFxcA$0$u=fXYD1(F8s1ztPt^y18|NLU?*$#P^C*A~!c)I$ztaD0e0sx;> BKA8Xj literal 0 HcmV?d00001 From b98de52ae834349b5d23097f38dc2fb237c87246 Mon Sep 17 00:00:00 2001 From: Phil Kuang Date: Tue, 27 Apr 2021 21:36:51 -0400 Subject: [PATCH 183/485] feat(CostInsights): support a display friendly name prop for projects Signed-off-by: Phil Kuang --- .changeset/cost-insights-gorgeous-dancers-hope.md | 5 +++++ .../components/ProjectSelect/ProjectSelect.test.tsx | 6 ++++-- .../src/components/ProjectSelect/ProjectSelect.tsx | 11 +++++++---- plugins/cost-insights/src/types/Project.ts | 1 + 4 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 .changeset/cost-insights-gorgeous-dancers-hope.md diff --git a/.changeset/cost-insights-gorgeous-dancers-hope.md b/.changeset/cost-insights-gorgeous-dancers-hope.md new file mode 100644 index 0000000000..8e0abce57f --- /dev/null +++ b/.changeset/cost-insights-gorgeous-dancers-hope.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-cost-insights': patch +--- + +Support a `name` prop for Projects for display purposes diff --git a/plugins/cost-insights/src/components/ProjectSelect/ProjectSelect.test.tsx b/plugins/cost-insights/src/components/ProjectSelect/ProjectSelect.test.tsx index 1bd57a9eed..1820b9e35a 100644 --- a/plugins/cost-insights/src/components/ProjectSelect/ProjectSelect.test.tsx +++ b/plugins/cost-insights/src/components/ProjectSelect/ProjectSelect.test.tsx @@ -23,7 +23,7 @@ import { renderInTestApp } from '@backstage/test-utils'; const mockProjects = [ { id: 'project1' }, - { id: 'project2' }, + { id: 'project2', name: 'Project 2' }, { id: 'project3' }, ]; @@ -56,7 +56,9 @@ describe('', () => { await waitFor(() => rendered.getByTestId('option-all')); mockProjects.forEach(project => - expect(rendered.getByText(project.id)).toBeInTheDocument(), + expect( + rendered.getByText(project.name ?? project.id), + ).toBeInTheDocument(), ); }); }); diff --git a/plugins/cost-insights/src/components/ProjectSelect/ProjectSelect.tsx b/plugins/cost-insights/src/components/ProjectSelect/ProjectSelect.tsx index bc34eb9c8d..25fdc0c171 100644 --- a/plugins/cost-insights/src/components/ProjectSelect/ProjectSelect.tsx +++ b/plugins/cost-insights/src/components/ProjectSelect/ProjectSelect.tsx @@ -33,7 +33,9 @@ export const ProjectSelect = ({ const projectOptions = projects .filter(p => p.id) - .sort((a, b) => (a.id as string).localeCompare(b.id as string)); + .sort((a, b) => + ((a.name ?? a.id) as string).localeCompare((b.name ?? b.id) as string), + ); const handleOnChange = (e: React.ChangeEvent<{ value: unknown }>) => { onSelect(e.target.value as string); @@ -41,9 +43,10 @@ export const ProjectSelect = ({ const renderValue = (value: unknown) => { const proj = value as string; + const projectObj = projects.find(p => p.id === proj); return ( - {proj === 'all' ? 'All Projects' : proj} + {proj === 'all' ? 'All Projects' : projectObj?.name ?? proj} ); }; @@ -52,7 +55,7 @@ export const ProjectSelect = ({ diff --git a/plugins/cost-insights/src/types/Project.ts b/plugins/cost-insights/src/types/Project.ts index 24259f6910..6ac61f1fb7 100644 --- a/plugins/cost-insights/src/types/Project.ts +++ b/plugins/cost-insights/src/types/Project.ts @@ -16,4 +16,5 @@ export interface Project { id: string; + name?: string; } From 410be7722c1541e4b5ff140b7ff75ef381829a01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 28 Apr 2021 19:25:24 +0200 Subject: [PATCH 184/485] exclude status instead of state, and also attachments while we're at it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- plugins/catalog-backend/src/next/search.test.ts | 5 +++-- plugins/catalog-backend/src/next/search.ts | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/catalog-backend/src/next/search.test.ts b/plugins/catalog-backend/src/next/search.test.ts index ff1cba01b9..2e0b07b4a9 100644 --- a/plugins/catalog-backend/src/next/search.test.ts +++ b/plugins/catalog-backend/src/next/search.test.ts @@ -52,8 +52,9 @@ describe('search', () => { it('skips over special keys', () => { const input = { - state: { x: 1 }, - relations: [{ y: 2 }], + status: { x: 1 }, + attachments: [{ y: 2 }], + relations: [{ z: 3 }], a: 'a', metadata: { b: 'b', diff --git a/plugins/catalog-backend/src/next/search.ts b/plugins/catalog-backend/src/next/search.ts index 5ff0721f91..383b29fd70 100644 --- a/plugins/catalog-backend/src/next/search.ts +++ b/plugins/catalog-backend/src/next/search.ts @@ -30,8 +30,9 @@ export type DbSearchRow = { // to index, or because they are special-case always inserted whether they are // null or not const SPECIAL_KEYS = [ - 'state', + 'attachments', 'relations', + 'status', 'metadata.name', 'metadata.namespace', 'metadata.uid', From 0f26d52325c62fc1e47ee03f5e2449e37665a13c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 28 Apr 2021 19:25:56 +0200 Subject: [PATCH 185/485] remove unnecessary copying of migration files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .../src/next/NextCatalogBuilder.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/plugins/catalog-backend/src/next/NextCatalogBuilder.ts b/plugins/catalog-backend/src/next/NextCatalogBuilder.ts index 24b763a098..7129809c71 100644 --- a/plugins/catalog-backend/src/next/NextCatalogBuilder.ts +++ b/plugins/catalog-backend/src/next/NextCatalogBuilder.ts @@ -243,19 +243,13 @@ export class NextCatalogBuilder { const parser = this.parser || defaultEntityDataParser; const dbClient = await database.getClient(); - const allMigrations = resolvePackagePath( - '@backstage/plugin-catalog-backend', - 'migrations', - ); - - const migrationsDir = resolvePackagePath( - '@backstage/plugin-catalog-backend', - 'migrationsv2', - ); - await fs.copy(allMigrations, migrationsDir); await dbClient.migrate.latest({ - directory: migrationsDir, + directory: resolvePackagePath( + '@backstage/plugin-catalog-backend', + 'migrationsv2', + ), }); + const db = new CommonDatabase(dbClient, logger); const processingDatabase = new DefaultProcessingDatabase(dbClient, logger); From f4009504d34e5259ff7f2ef31981e9c23138bab6 Mon Sep 17 00:00:00 2001 From: ImgBotApp Date: Wed, 28 Apr 2021 18:38:11 +0000 Subject: [PATCH 186/485] [ImgBot] Optimize images *Total -- 119.00kb -> 98.54kb (17.19%) /microsite/static/img/circleci.png -- 16.30kb -> 9.54kb (41.43%) /microsite/static/img/cost-insights.png -- 102.71kb -> 89.00kb (13.35%) Signed-off-by: ImgBotApp --- microsite/static/img/circleci.png | Bin 16688 -> 9774 bytes microsite/static/img/cost-insights.png | Bin 105171 -> 91134 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/microsite/static/img/circleci.png b/microsite/static/img/circleci.png index 3fc450d54d9afbea45c5717cd68f9315dce7fa01..85f262e4b31af221482e868387c1a1a469cc6f8a 100644 GIT binary patch literal 9774 zcmZ`fWmwct(7!vnIY7F*>yVc2?v^eE=@JnRX;3(j?(POb5I8_UI;BBC8YHBo@8$n~ zdq2FNW@cw+cXpqNoq0A!M@tzGn-UuU06bL{1w8-&KcQd%6ZHvLdQy8n0aPbhO<4eF zNWi(bL3^U#VOn`~C(EITa(Y1Ei{%iM_JOe{Gp&TXzQ-vXiJ99d_#b=AZ-3zyKPmxcnV8Sv4@!%rT z?!`>=N}DS)QIU1lK#}23LlEmr(Jb?T^nLrL$V*pyoaF^s-Zl~)8G(Kh{o!BtS9K92 zaBW_R#c@*M#?UX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os;_3Sd<#%0m&eW`wWR3u} z`WU={mGkqhZMpNpUd*~Ks9wpwc@%7M^&W zKfhx#Ul{OnK6{pU@b}OCz-IU6^Yxq!XF;WF!v=%52I*Z454b>j7!*$5-x&j>9Y8G$ z;HiABKxYFxcA$0$u=fXYD1(F8s1ztPt^y18|NLU?*$#P^C*A~!c)I$ztaD0e0sx;> BKA8Xj From 0f2e4098f0a441cfa23039fc7127369dd885e727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 28 Apr 2021 21:07:21 +0200 Subject: [PATCH 187/485] some light renaming MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- ...r.test.ts => ConfigLocationEntityProvider.test.ts} | 10 +++++----- ...ionProvider.ts => ConfigLocationEntityProvider.ts} | 6 +++--- .../src/next/DefaultCatalogProcessingEngine.ts | 9 ++++----- .../{DefaultService.ts => DefaultLocationService.ts} | 0 .../src/next/DefaultLocationStore.test.ts | 6 +++--- .../catalog-backend/src/next/DefaultLocationStore.ts | 4 ++-- .../catalog-backend/src/next/NextCatalogBuilder.ts | 11 +++++------ .../src/next/database/DatabaseManager.ts | 4 ++-- 8 files changed, 24 insertions(+), 26 deletions(-) rename plugins/catalog-backend/src/next/{ConfigLocationProvider.test.ts => ConfigLocationEntityProvider.test.ts} (90%) rename plugins/catalog-backend/src/next/{ConfigLocationProvider.ts => ConfigLocationEntityProvider.ts} (91%) rename plugins/catalog-backend/src/next/{DefaultService.ts => DefaultLocationService.ts} (100%) diff --git a/plugins/catalog-backend/src/next/ConfigLocationProvider.test.ts b/plugins/catalog-backend/src/next/ConfigLocationEntityProvider.test.ts similarity index 90% rename from plugins/catalog-backend/src/next/ConfigLocationProvider.test.ts rename to plugins/catalog-backend/src/next/ConfigLocationEntityProvider.test.ts index 9aaba13c48..226e5c06a8 100644 --- a/plugins/catalog-backend/src/next/ConfigLocationProvider.test.ts +++ b/plugins/catalog-backend/src/next/ConfigLocationEntityProvider.test.ts @@ -14,13 +14,13 @@ * limitations under the License. */ -import { ConfigLocationProvider } from './ConfigLocationProvider'; -import { EntityProviderConnection } from './types'; -import { ConfigReader } from '@backstage/config'; import { resolvePackagePath } from '@backstage/backend-common'; +import { ConfigReader } from '@backstage/config'; import path from 'path'; +import { ConfigLocationEntityProvider } from './ConfigLocationEntityProvider'; +import { EntityProviderConnection } from './types'; -describe('Config Location Provider', () => { +describe('ConfigLocationEntityProvider', () => { it('should apply mutation with the correct paths in the config', async () => { const mockConfig = new ConfigReader({ catalog: { @@ -34,7 +34,7 @@ describe('Config Location Provider', () => { const mockConnection = ({ applyMutation: jest.fn(), } as unknown) as EntityProviderConnection; - const locationProvider = new ConfigLocationProvider(mockConfig); + const locationProvider = new ConfigLocationEntityProvider(mockConfig); await locationProvider.connect(mockConnection); diff --git a/plugins/catalog-backend/src/next/ConfigLocationProvider.ts b/plugins/catalog-backend/src/next/ConfigLocationEntityProvider.ts similarity index 91% rename from plugins/catalog-backend/src/next/ConfigLocationProvider.ts rename to plugins/catalog-backend/src/next/ConfigLocationEntityProvider.ts index 8a65487df1..bccbd0ba41 100644 --- a/plugins/catalog-backend/src/next/ConfigLocationProvider.ts +++ b/plugins/catalog-backend/src/next/ConfigLocationEntityProvider.ts @@ -14,12 +14,12 @@ * limitations under the License. */ -import { EntityProviderConnection, EntityProvider } from './types'; -import path from 'path'; import { Config } from '@backstage/config'; +import path from 'path'; +import { EntityProvider, EntityProviderConnection } from './types'; import { locationSpecToLocationEntity } from './util'; -export class ConfigLocationProvider implements EntityProvider { +export class ConfigLocationEntityProvider implements EntityProvider { private connection: EntityProviderConnection | undefined; constructor(private readonly config: Config) {} diff --git a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts index 1397d9038a..e724fe79d8 100644 --- a/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts +++ b/plugins/catalog-backend/src/next/DefaultCatalogProcessingEngine.ts @@ -14,19 +14,18 @@ * limitations under the License. */ +import { stringifyEntityRef } from '@backstage/catalog-model'; +import { Logger } from 'winston'; +import { Stitcher } from './Stitcher'; import { CatalogProcessingEngine, + CatalogProcessingOrchestrator, EntityProvider, EntityProviderConnection, EntityProviderMutation, ProcessingStateManager, - CatalogProcessingOrchestrator, } from './types'; -import { Logger } from 'winston'; -import { stringifyEntityRef } from '@backstage/catalog-model'; -import { Stitcher } from './Stitcher'; - class Connection implements EntityProviderConnection { constructor( private readonly config: { diff --git a/plugins/catalog-backend/src/next/DefaultService.ts b/plugins/catalog-backend/src/next/DefaultLocationService.ts similarity index 100% rename from plugins/catalog-backend/src/next/DefaultService.ts rename to plugins/catalog-backend/src/next/DefaultLocationService.ts diff --git a/plugins/catalog-backend/src/next/DefaultLocationStore.test.ts b/plugins/catalog-backend/src/next/DefaultLocationStore.test.ts index d30509eaec..f9bb97477c 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationStore.test.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationStore.test.ts @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { v4 as uuid } from 'uuid'; import { DatabaseManager } from './database/DatabaseManager'; import { DefaultLocationStore } from './DefaultLocationStore'; -import { v4 } from 'uuid'; /* eslint-disable */ -xdescribe('Default Location Store', () => { +xdescribe('DefaultLocationStore', () => { const createLocationStore = async () => { const db = await DatabaseManager.createTestDatabase(); const connection = { applyMutation: jest.fn() }; @@ -111,7 +111,7 @@ xdescribe('Default Location Store', () => { it('throws if the location does not exist', async () => { const { store } = await createLocationStore(); - const id = v4(); + const id = uuid(); await expect(() => store.deleteLocation(id)).rejects.toThrow( new RegExp(`Found no location with ID ${id}`), diff --git a/plugins/catalog-backend/src/next/DefaultLocationStore.ts b/plugins/catalog-backend/src/next/DefaultLocationStore.ts index 28db3790b6..f6267df6a5 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationStore.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationStore.ts @@ -21,7 +21,7 @@ import { EntityProvider, EntityProviderConnection, } from './types'; -import { v4 as uuidv4 } from 'uuid'; +import { v4 as uuid } from 'uuid'; import { locationSpecToLocationEntity } from './util'; import { ConflictError } from '@backstage/errors'; @@ -50,7 +50,7 @@ export class DefaultLocationStore implements LocationStore, EntityProvider { // TODO: id should really be type and target combined and not a uuid. const location = await this.db.addLocation(tx, { - id: uuidv4(), + id: uuid(), type: spec.type, target: spec.target, }); diff --git a/plugins/catalog-backend/src/next/NextCatalogBuilder.ts b/plugins/catalog-backend/src/next/NextCatalogBuilder.ts index 7129809c71..10500fdc15 100644 --- a/plugins/catalog-backend/src/next/NextCatalogBuilder.ts +++ b/plugins/catalog-backend/src/next/NextCatalogBuilder.ts @@ -19,7 +19,6 @@ import { resolvePackagePath, UrlReader, } from '@backstage/backend-common'; -import fs from 'fs-extra'; import { DefaultNamespaceEntityPolicy, EntityPolicies, @@ -39,6 +38,7 @@ import { EntitiesCatalog, LocationsCatalog, } from '../catalog'; +import { CommonDatabase } from '../database/CommonDatabase'; import { AnnotateLocationEntityProcessor, BitbucketDiscoveryProcessor, @@ -63,16 +63,15 @@ import { } from '../ingestion/processors/PlaceholderProcessor'; import { defaultEntityDataParser } from '../ingestion/processors/util/parse'; import { LocationAnalyzer } from '../ingestion/types'; +import { CatalogProcessingEngine } from '../next/types'; +import { ConfigLocationEntityProvider } from './ConfigLocationEntityProvider'; +import { DefaultProcessingDatabase } from './database/DefaultProcessingDatabase'; import { DefaultCatalogProcessingEngine } from './DefaultCatalogProcessingEngine'; import { DefaultCatalogProcessingOrchestrator } from './DefaultCatalogProcessingOrchestrator'; -import { DefaultProcessingDatabase } from './database/DefaultProcessingDatabase'; import { DefaultLocationStore } from './DefaultLocationStore'; import { DefaultProcessingStateManager } from './DefaultProcessingStateManager'; -import { CatalogProcessingEngine } from '../next/types'; import { NextEntitiesCatalog } from './NextEntitiesCatalog'; import { Stitcher } from './Stitcher'; -import { CommonDatabase } from '../database/CommonDatabase'; -import { ConfigLocationProvider } from './ConfigLocationProvider'; export type CatalogEnvironment = { logger: Logger; @@ -266,7 +265,7 @@ export class NextCatalogBuilder { const locationStore = new DefaultLocationStore(db); const stitcher = new Stitcher(dbClient, logger); - const configLocationProvider = new ConfigLocationProvider(config); + const configLocationProvider = new ConfigLocationEntityProvider(config); const processingEngine = new DefaultCatalogProcessingEngine( logger, [locationStore, configLocationProvider], diff --git a/plugins/catalog-backend/src/next/database/DatabaseManager.ts b/plugins/catalog-backend/src/next/database/DatabaseManager.ts index f660f73ecb..22ae4e782f 100644 --- a/plugins/catalog-backend/src/next/database/DatabaseManager.ts +++ b/plugins/catalog-backend/src/next/database/DatabaseManager.ts @@ -16,7 +16,7 @@ import { getVoidLogger, resolvePackagePath } from '@backstage/backend-common'; import knexFactory, { Knex } from 'knex'; -import { v4 as uuidv4 } from 'uuid'; +import { v4 as uuid } from 'uuid'; import { Logger } from 'winston'; import { CommonDatabase } from '../../database/CommonDatabase'; import { Database } from '../../database/types'; @@ -79,7 +79,7 @@ export class DatabaseManager { let knex = knexFactory(config); if (typeof config.connection !== 'string') { - const tempDbName = `d${uuidv4().replace(/-/g, '')}`; + const tempDbName = `d${uuid().replace(/-/g, '')}`; await knex.raw(`CREATE DATABASE ${tempDbName};`); knex = knexFactory({ ...config, From 2a4ad54f77fd8e4dbaf03573ada95dba2689b707 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Apr 2021 23:17:43 +0000 Subject: [PATCH 188/485] chore(deps): bump y18n from 3.2.1 to 3.2.2 Bumps [y18n](https://github.com/yargs/y18n) from 3.2.1 to 3.2.2. - [Release notes](https://github.com/yargs/y18n/releases) - [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md) - [Commits](https://github.com/yargs/y18n/commits) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 19aff83248..1e7d42537e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -27074,9 +27074,9 @@ xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.1: integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== y18n@^3.2.1: - version "3.2.1" - resolved "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" - integrity sha1-bRX7qITAhnnA136I53WegR4H+kE= + version "3.2.2" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.2.tgz#85c901bd6470ce71fc4bb723ad209b70f7f28696" + integrity sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ== y18n@^4.0.0: version "4.0.0" From 54ef04e72ac16e2f09ee6016c6dcf714c8683094 Mon Sep 17 00:00:00 2001 From: Heather Lee Date: Wed, 28 Apr 2021 17:21:26 -0700 Subject: [PATCH 189/485] Added lax option to app:build Signed-off-by: Heather Lee --- packages/cli/src/commands/app/build.ts | 1 + packages/cli/src/commands/index.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/cli/src/commands/app/build.ts b/packages/cli/src/commands/app/build.ts index 21189e9427..0da4112646 100644 --- a/packages/cli/src/commands/app/build.ts +++ b/packages/cli/src/commands/app/build.ts @@ -30,6 +30,7 @@ export default async (cmd: Command) => { ...(await loadCliConfig({ args: cmd.config, fromPackage: name, + mockEnv: cmd.lax, })), }); }; diff --git a/packages/cli/src/commands/index.ts b/packages/cli/src/commands/index.ts index c770239464..ae39941106 100644 --- a/packages/cli/src/commands/index.ts +++ b/packages/cli/src/commands/index.ts @@ -29,6 +29,7 @@ export function registerCommands(program: CommanderStatic) { .command('app:build') .description('Build an app for a production release') .option('--stats', 'Write bundle stats to output directory') + .option('--lax', 'Do not require environment variables to be set') .option(...configOption) .action(lazy(() => import('./app/build').then(m => m.default))); From fc79a6dd3c9932327b50b161409c33469700d231 Mon Sep 17 00:00:00 2001 From: Heather Lee Date: Wed, 28 Apr 2021 17:27:58 -0700 Subject: [PATCH 190/485] Added changeset Signed-off-by: Heather Lee --- .changeset/nice-shirts-fetch.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/nice-shirts-fetch.md diff --git a/.changeset/nice-shirts-fetch.md b/.changeset/nice-shirts-fetch.md new file mode 100644 index 0000000000..e9537e63b3 --- /dev/null +++ b/.changeset/nice-shirts-fetch.md @@ -0,0 +1,5 @@ +--- +'@backstage/cli': patch +--- + +Added lax option to backstage-cli app:build command From 3923318d8780f51f416f4b688da8d0c9bdfa4d06 Mon Sep 17 00:00:00 2001 From: Heather Lee Date: Wed, 28 Apr 2021 17:41:45 -0700 Subject: [PATCH 191/485] Updated documentation Signed-off-by: Heather Lee --- docs/cli/commands.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/cli/commands.md b/docs/cli/commands.md index 324d17463c..a99d4cd9d0 100644 --- a/docs/cli/commands.md +++ b/docs/cli/commands.md @@ -111,6 +111,7 @@ Usage: backstage-cli app:build Options: --stats Write bundle stats to output directory + --lax Do not require environment variables to be set --config <path> Config files to load instead of app-config.yaml (default: []) -h, --help display help for command ``` @@ -486,6 +487,7 @@ Usage: backstage-cli config:print [options] Options: --package <name> Only load config schema that applies to the given package + --lax Do not require environment variables to be set --frontend Print only the frontend configuration --with-secrets Include secrets in the printed configuration --format <format> Format to print the configuration in, either json or yaml [yaml] @@ -506,6 +508,7 @@ Usage: backstage-cli config:check [options] Options: --package <name> Only load config schema that applies to the given package + --lax Do not require environment variables to be set --config <path> Config files to load instead of app-config.yaml (default: []) -h, --help display help for command ``` From c9307150662e018160c6948ca5c342e7c1787da8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 29 Apr 2021 04:15:56 +0000 Subject: [PATCH 192/485] chore(deps): bump @kubernetes/client-node from 0.14.0 to 0.14.3 Bumps [@kubernetes/client-node](https://github.com/kubernetes-client/javascript) from 0.14.0 to 0.14.3. - [Release notes](https://github.com/kubernetes-client/javascript/releases) - [Changelog](https://github.com/kubernetes-client/javascript/blob/master/CHANGELOG.md) - [Commits](https://github.com/kubernetes-client/javascript/compare/0.14.0...0.14.3) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 1e7d42537e..43e5c33ca5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2961,9 +2961,9 @@ integrity sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg== "@kubernetes/client-node@^0.14.0": - version "0.14.0" - resolved "https://registry.npmjs.org/@kubernetes/client-node/-/client-node-0.14.0.tgz#a02806f3b6fdb68fb51d451ee8ff01faa446f557" - integrity sha512-/37JHuEUAQ5GQ4kLKBmCYvGgf5W1KZWKreKGWFYH8VvT2Hl/o0aJZasu2w0EHEfmE11JCn0X9arVmOTyVCYvww== + version "0.14.3" + resolved "https://registry.npmjs.org/@kubernetes/client-node/-/client-node-0.14.3.tgz#5ed9b88873419080547f22cb74eb502bf6671fca" + integrity sha512-9hHGDNm2JEFQcRTpDxVoAVr0fowU+JH/l5atCXY9VXwvFM18pW5wr2LzLP+Q2Rh+uQv7Moz4gEjEKSCgVKykEQ== dependencies: "@types/js-yaml" "^3.12.1" "@types/node" "^10.12.0" From 8853366eb1718b67c0ef21e06220ba3d3157f349 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 29 Apr 2021 09:29:40 +0200 Subject: [PATCH 193/485] Update plugin yaml author Signed-off-by: Erik Engervall --- microsite/data/plugins/github-release-manager.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/microsite/data/plugins/github-release-manager.yaml b/microsite/data/plugins/github-release-manager.yaml index 9c930b2bbb..febc03f714 100644 --- a/microsite/data/plugins/github-release-manager.yaml +++ b/microsite/data/plugins/github-release-manager.yaml @@ -1,7 +1,7 @@ --- title: GitHub Release Manager -author: '@erikengervall' -authorUrl: https://github.com/erikengervall +author: '@Spotify' +authorUrl: https://github.com/spotify category: Release management description: Manage releases without having to juggle git commands documentation: https://github.com/backstage/backstage/tree/master/plugins/github-release-manager From 90e93079ecd518855fd6eb6b3fb7a5538e0e6843 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 29 Apr 2021 09:41:40 +0200 Subject: [PATCH 194/485] Address PR comments Signed-off-by: Erik Engervall --- packages/app/src/apis.ts | 11 ------ plugins/github-release-manager/dev/index.tsx | 18 ++++------ .../src/GitHubReleaseManager.tsx | 21 +++++------ .../src/components/Divider.tsx | 10 ++++-- .../src/contexts/PluginApiClientContext.ts | 36 ------------------- .../features/CreateRc/hooks/useCreateRc.ts | 5 +-- .../src/features/Features.tsx | 6 ++-- .../src/features/Patch/PatchBody.tsx | 5 +-- .../src/features/Patch/hooks/usePatch.ts | 5 +-- .../features/PromoteRc/hooks/usePromoteRc.ts | 7 ++-- .../src/features/RepoDetailsForm/Owner.tsx | 5 +-- .../src/features/RepoDetailsForm/Repo.tsx | 5 +-- .../Stats/Info/hooks/useGetReleaseTimes.tsx | 5 +-- .../src/features/Stats/hooks/useGetCommit.ts | 5 +-- .../src/features/Stats/hooks/useGetStats.ts | 5 +-- 15 files changed, 54 insertions(+), 95 deletions(-) delete mode 100644 plugins/github-release-manager/src/contexts/PluginApiClientContext.ts diff --git a/packages/app/src/apis.ts b/packages/app/src/apis.ts index beea444a6c..ccc576e727 100644 --- a/packages/app/src/apis.ts +++ b/packages/app/src/apis.ts @@ -33,7 +33,6 @@ import { graphQlBrowseApiRef, GraphQLEndpoints, } from '@backstage/plugin-graphiql'; -// import { githubReleaseManagerApiRef } from '@backstage/plugin-github-release-manager'; export const apis: AnyApiFactory[] = [ createApiFactory({ @@ -42,16 +41,6 @@ export const apis: AnyApiFactory[] = [ factory: ({ configApi }) => ScmIntegrationsApi.fromConfig(configApi), }), - // createApiFactory({ - // api: githubReleaseManagerApiRef, - // deps: { githubAuthApi: githubAuthApiRef }, - // factory: ({ githubAuthApi }) => { - // return { - - // } - // }, - // }), - createApiFactory({ api: graphQlBrowseApiRef, deps: { errorApi: errorApiRef, githubAuthApi: githubAuthApiRef }, diff --git a/plugins/github-release-manager/dev/index.tsx b/plugins/github-release-manager/dev/index.tsx index 31a6a9a563..62eb2a8246 100644 --- a/plugins/github-release-manager/dev/index.tsx +++ b/plugins/github-release-manager/dev/index.tsx @@ -16,7 +16,7 @@ import React from 'react'; import { createDevApp } from '@backstage/dev-utils'; -import { Typography } from '@material-ui/core'; +import { Box, Typography } from '@material-ui/core'; import { gitHubReleaseManagerPlugin, @@ -24,31 +24,27 @@ import { } from '../src/plugin'; import { InfoCardPlus } from '../src/components/InfoCardPlus'; -function DevWrapper({ children }: { children: React.ReactNode }) { - return
{children}
; -} - createDevApp() .registerPlugin(gitHubReleaseManagerPlugin) .addPage({ title: 'Dynamic', path: '/dynamic', element: ( - + Dev notes Configure plugin via select inputs - + ), }) .addPage({ title: 'Static', path: '/static', element: ( - + Dev notes @@ -64,14 +60,14 @@ createDevApp() versioningStrategy: 'semver', }} /> - + ), }) .addPage({ title: 'Omit', path: '/omit', element: ( - + Dev notes Each feature can be omitted @@ -112,7 +108,7 @@ createDevApp() }, }} /> - + ), }) .render(); diff --git a/plugins/github-release-manager/src/GitHubReleaseManager.tsx b/plugins/github-release-manager/src/GitHubReleaseManager.tsx index f0156af06c..df17b8c002 100644 --- a/plugins/github-release-manager/src/GitHubReleaseManager.tsx +++ b/plugins/github-release-manager/src/GitHubReleaseManager.tsx @@ -30,7 +30,6 @@ import { CenteredCircularProgress } from './components/CenteredCircularProgress' import { githubReleaseManagerApiRef } from './api/serviceApiRef'; import { InfoCardPlus } from './components/InfoCardPlus'; import { isProjectValid } from './helpers/isProjectValid'; -import { PluginApiClientContext } from './contexts/PluginApiClientContext'; import { ProjectContext, Project } from './contexts/ProjectContext'; import { RepoDetailsForm } from './features/RepoDetailsForm/RepoDetailsForm'; import { useQueryHandler } from './hooks/useQueryHandler'; @@ -82,18 +81,16 @@ export function GitHubReleaseManager(props: GitHubReleaseManagerProps) { } return ( - - -
- + +
+ - - - + + + - {isProjectValid(project) && } -
-
- + {isProjectValid(project) && } +
+
); } diff --git a/plugins/github-release-manager/src/components/Divider.tsx b/plugins/github-release-manager/src/components/Divider.tsx index 9ddf21e0ff..6be0f4eb3c 100644 --- a/plugins/github-release-manager/src/components/Divider.tsx +++ b/plugins/github-release-manager/src/components/Divider.tsx @@ -15,14 +15,18 @@ */ import React from 'react'; -import { Divider as MaterialDivider } from '@material-ui/core'; +import { Box, Divider as MaterialDivider } from '@material-ui/core'; import { TEST_IDS } from '../test-helpers/test-ids'; export const Divider = () => { return ( -
+ -
+ ); }; diff --git a/plugins/github-release-manager/src/contexts/PluginApiClientContext.ts b/plugins/github-release-manager/src/contexts/PluginApiClientContext.ts deleted file mode 100644 index 2d4c9f27ac..0000000000 --- a/plugins/github-release-manager/src/contexts/PluginApiClientContext.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 { createContext, useContext } from 'react'; - -import { IPluginApiClient } from '../api/PluginApiClient'; -import { GitHubReleaseManagerError } from '../errors/GitHubReleaseManagerError'; - -export const PluginApiClientContext = createContext< - { pluginApiClient: IPluginApiClient } | undefined ->(undefined); - -export const usePluginApiClientContext = () => { - const { pluginApiClient } = useContext(PluginApiClientContext) ?? {}; - - if (!pluginApiClient) { - throw new GitHubReleaseManagerError('pluginApiClient not found'); - } - - return { - pluginApiClient, - }; -}; diff --git a/plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.ts b/plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.ts index 30d5a8894f..b205cfad6a 100644 --- a/plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.ts +++ b/plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.ts @@ -16,6 +16,7 @@ import { useEffect, useState } from 'react'; import { useAsync, useAsyncFn } from 'react-use'; +import { useApi } from '@backstage/core'; import { GetLatestReleaseResult, @@ -23,10 +24,10 @@ import { } from '../../../api/PluginApiClient'; import { CardHook, ComponentConfigCreateRc } from '../../../types/types'; import { getRcGitHubInfo } from '../../../helpers/getRcGitHubInfo'; +import { githubReleaseManagerApiRef } from '../../../api/serviceApiRef'; import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; import { Project } from '../../../contexts/ProjectContext'; import { useResponseSteps } from '../../../hooks/useResponseSteps'; -import { usePluginApiClientContext } from '../../../contexts/PluginApiClientContext'; interface CreateRC { defaultBranch: GetRepositoryResult['defaultBranch']; @@ -43,7 +44,7 @@ export function useCreateRc({ project, successCb, }: CreateRC): CardHook { - const { pluginApiClient } = usePluginApiClientContext(); + const pluginApiClient = useApi(githubReleaseManagerApiRef); if (nextGitHubInfo.error) { throw new GitHubReleaseManagerError( diff --git a/plugins/github-release-manager/src/features/Features.tsx b/plugins/github-release-manager/src/features/Features.tsx index 5d3e2a7151..f8c48b0732 100644 --- a/plugins/github-release-manager/src/features/Features.tsx +++ b/plugins/github-release-manager/src/features/Features.tsx @@ -16,17 +16,17 @@ import React, { useState } from 'react'; import { Alert, AlertTitle } from '@material-ui/lab'; -import { ErrorBoundary } from '@backstage/core'; +import { ErrorBoundary, useApi } from '@backstage/core'; import { CenteredCircularProgress } from '../components/CenteredCircularProgress'; import { CreateRc } from './CreateRc/CreateRc'; +import { githubReleaseManagerApiRef } from '../api/serviceApiRef'; import { GitHubReleaseManagerProps } from '../GitHubReleaseManager'; import { Info } from './Info/Info'; import { Patch } from './Patch/Patch'; import { PromoteRc } from './PromoteRc/PromoteRc'; import { RefetchContext } from '../contexts/RefetchContext'; import { useGetGitHubBatchInfo } from '../hooks/useGetGitHubBatchInfo'; -import { usePluginApiClientContext } from '../contexts/PluginApiClientContext'; import { useProjectContext } from '../contexts/ProjectContext'; import { useVersioningStrategyMatchesRepoTags } from '../hooks/useVersioningStrategyMatchesRepoTags'; import { validateTagName } from '../helpers/tagParts/validateTagName'; @@ -36,7 +36,7 @@ export function Features({ }: { features: GitHubReleaseManagerProps['features']; }) { - const { pluginApiClient } = usePluginApiClientContext(); + const pluginApiClient = useApi(githubReleaseManagerApiRef); const { project } = useProjectContext(); const [refetchTrigger, setRefetchTrigger] = useState(0); const { gitHubBatchInfo } = useGetGitHubBatchInfo({ diff --git a/plugins/github-release-manager/src/features/Patch/PatchBody.tsx b/plugins/github-release-manager/src/features/Patch/PatchBody.tsx index 7c99e66f9e..47b1db1578 100644 --- a/plugins/github-release-manager/src/features/Patch/PatchBody.tsx +++ b/plugins/github-release-manager/src/features/Patch/PatchBody.tsx @@ -32,6 +32,7 @@ import { } from '@material-ui/core'; import FileCopyIcon from '@material-ui/icons/FileCopy'; import OpenInNewIcon from '@material-ui/icons/OpenInNew'; +import { useApi } from '@backstage/core'; import { GetBranchResult, @@ -41,12 +42,12 @@ import { CalverTagParts } from '../../helpers/tagParts/getCalverTagParts'; import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; import { ComponentConfigPatch } from '../../types/types'; import { Differ } from '../../components/Differ'; +import { githubReleaseManagerApiRef } from '../../api/serviceApiRef'; import { GitHubReleaseManagerError } from '../../errors/GitHubReleaseManagerError'; import { ResponseStepDialog } from '../../components/ResponseStepDialog/ResponseStepDialog'; import { SemverTagParts } from '../../helpers/tagParts/getSemverTagParts'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { usePatch } from './hooks/usePatch'; -import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; import { useProjectContext } from '../../contexts/ProjectContext'; import { useStyles } from '../../styles/styles'; @@ -65,7 +66,7 @@ export const PatchBody = ({ successCb, tagParts, }: PatchBodyProps) => { - const { pluginApiClient } = usePluginApiClientContext(); + const pluginApiClient = useApi(githubReleaseManagerApiRef); const { project } = useProjectContext(); const [checkedCommitIndex, setCheckedCommitIndex] = useState(-1); diff --git a/plugins/github-release-manager/src/features/Patch/hooks/usePatch.ts b/plugins/github-release-manager/src/features/Patch/hooks/usePatch.ts index 06001f1771..5da8d020b9 100644 --- a/plugins/github-release-manager/src/features/Patch/hooks/usePatch.ts +++ b/plugins/github-release-manager/src/features/Patch/hooks/usePatch.ts @@ -16,6 +16,7 @@ import { useEffect, useState } from 'react'; import { useAsync, useAsyncFn } from 'react-use'; +import { useApi } from '@backstage/core'; import { GetLatestReleaseResult, @@ -23,9 +24,9 @@ import { } from '../../../api/PluginApiClient'; import { CalverTagParts } from '../../../helpers/tagParts/getCalverTagParts'; import { ComponentConfigPatch, CardHook } from '../../../types/types'; +import { githubReleaseManagerApiRef } from '../../../api/serviceApiRef'; import { Project } from '../../../contexts/ProjectContext'; import { SemverTagParts } from '../../../helpers/tagParts/getSemverTagParts'; -import { usePluginApiClientContext } from '../../../contexts/PluginApiClientContext'; import { useResponseSteps } from '../../../hooks/useResponseSteps'; interface Patch { @@ -44,7 +45,7 @@ export function usePatch({ tagParts, successCb, }: Patch): CardHook { - const { pluginApiClient } = usePluginApiClientContext(); + const pluginApiClient = useApi(githubReleaseManagerApiRef); const { responseSteps, addStepToResponseSteps, diff --git a/plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts b/plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts index 4d1a9e4037..6ff6c5ef9f 100644 --- a/plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts +++ b/plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts @@ -16,11 +16,12 @@ import { useState, useEffect } from 'react'; import { useAsync, useAsyncFn } from 'react-use'; +import { useApi } from '@backstage/core'; -import { GetLatestReleaseResult } from '../../../api/PluginApiClient'; import { CardHook, ComponentConfigPromoteRc } from '../../../types/types'; +import { GetLatestReleaseResult } from '../../../api/PluginApiClient'; +import { githubReleaseManagerApiRef } from '../../../api/serviceApiRef'; import { useProjectContext } from '../../../contexts/ProjectContext'; -import { usePluginApiClientContext } from '../../../contexts/PluginApiClientContext'; import { useResponseSteps } from '../../../hooks/useResponseSteps'; interface PromoteRc { @@ -34,7 +35,7 @@ export function usePromoteRc({ releaseVersion, successCb, }: PromoteRc): CardHook { - const { pluginApiClient } = usePluginApiClientContext(); + const pluginApiClient = useApi(githubReleaseManagerApiRef); const { project } = useProjectContext(); const { responseSteps, diff --git a/plugins/github-release-manager/src/features/RepoDetailsForm/Owner.tsx b/plugins/github-release-manager/src/features/RepoDetailsForm/Owner.tsx index 3cd2be6f7e..a392671c0f 100644 --- a/plugins/github-release-manager/src/features/RepoDetailsForm/Owner.tsx +++ b/plugins/github-release-manager/src/features/RepoDetailsForm/Owner.tsx @@ -24,16 +24,17 @@ import { MenuItem, Select, } from '@material-ui/core'; +import { useApi } from '@backstage/core'; import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; +import { githubReleaseManagerApiRef } from '../../api/serviceApiRef'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { useFormClasses } from './styles'; -import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; import { useProjectContext } from '../../contexts/ProjectContext'; import { useQueryHandler } from '../../hooks/useQueryHandler'; export function Owner({ username }: { username: string }) { - const { pluginApiClient } = usePluginApiClientContext(); + const pluginApiClient = useApi(githubReleaseManagerApiRef); const { project } = useProjectContext(); const formClasses = useFormClasses(); const navigate = useNavigate(); diff --git a/plugins/github-release-manager/src/features/RepoDetailsForm/Repo.tsx b/plugins/github-release-manager/src/features/RepoDetailsForm/Repo.tsx index cb08a651cb..b1f8298495 100644 --- a/plugins/github-release-manager/src/features/RepoDetailsForm/Repo.tsx +++ b/plugins/github-release-manager/src/features/RepoDetailsForm/Repo.tsx @@ -24,16 +24,17 @@ import { MenuItem, Select, } from '@material-ui/core'; +import { useApi } from '@backstage/core'; import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; +import { githubReleaseManagerApiRef } from '../../api/serviceApiRef'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { useFormClasses } from './styles'; -import { usePluginApiClientContext } from '../../contexts/PluginApiClientContext'; import { useProjectContext } from '../../contexts/ProjectContext'; import { useQueryHandler } from '../../hooks/useQueryHandler'; export function Repo() { - const { pluginApiClient } = usePluginApiClientContext(); + const pluginApiClient = useApi(githubReleaseManagerApiRef); const { project } = useProjectContext(); const navigate = useNavigate(); const formClasses = useFormClasses(); diff --git a/plugins/github-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx b/plugins/github-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx index 2909763a8f..afe9a2f8c5 100644 --- a/plugins/github-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx +++ b/plugins/github-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx @@ -17,9 +17,10 @@ import { useEffect, useState } from 'react'; import { useAsync, useAsyncFn } from 'react-use'; import { DateTime } from 'luxon'; +import { useApi } from '@backstage/core'; import { getReleaseCommitPairs } from '../helpers/getReleaseCommitPairs'; -import { usePluginApiClientContext } from '../../../../contexts/PluginApiClientContext'; +import { githubReleaseManagerApiRef } from '../../../../api/serviceApiRef'; import { useProjectContext } from '../../../../contexts/ProjectContext'; import { useReleaseStatsContext } from '../../contexts/ReleaseStatsContext'; @@ -45,7 +46,7 @@ type ReleaseTime = { }; export function useGetReleaseTimes() { - const { pluginApiClient } = usePluginApiClientContext(); + const pluginApiClient = useApi(githubReleaseManagerApiRef); const { project } = useProjectContext(); const { releaseStats } = useReleaseStatsContext(); const [averageReleaseTime, setAverageReleaseTime] = useState( diff --git a/plugins/github-release-manager/src/features/Stats/hooks/useGetCommit.ts b/plugins/github-release-manager/src/features/Stats/hooks/useGetCommit.ts index 95db493774..f9681beda6 100644 --- a/plugins/github-release-manager/src/features/Stats/hooks/useGetCommit.ts +++ b/plugins/github-release-manager/src/features/Stats/hooks/useGetCommit.ts @@ -15,13 +15,14 @@ */ import { useAsync } from 'react-use'; +import { useApi } from '@backstage/core'; +import { githubReleaseManagerApiRef } from '../../../api/serviceApiRef'; import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; -import { usePluginApiClientContext } from '../../../contexts/PluginApiClientContext'; import { useProjectContext } from '../../../contexts/ProjectContext'; export const useGetCommit = ({ ref }: { ref?: string }) => { - const { pluginApiClient } = usePluginApiClientContext(); + const pluginApiClient = useApi(githubReleaseManagerApiRef); const { project } = useProjectContext(); const commit = useAsync(async () => { diff --git a/plugins/github-release-manager/src/features/Stats/hooks/useGetStats.ts b/plugins/github-release-manager/src/features/Stats/hooks/useGetStats.ts index f918be0c97..3e093f68aa 100644 --- a/plugins/github-release-manager/src/features/Stats/hooks/useGetStats.ts +++ b/plugins/github-release-manager/src/features/Stats/hooks/useGetStats.ts @@ -14,13 +14,14 @@ * limitations under the License. */ +import { useApi } from '@backstage/core'; import { useAsync } from 'react-use'; -import { usePluginApiClientContext } from '../../../contexts/PluginApiClientContext'; +import { githubReleaseManagerApiRef } from '../../../api/serviceApiRef'; import { useProjectContext } from '../../../contexts/ProjectContext'; export const useGetStats = () => { - const { pluginApiClient } = usePluginApiClientContext(); + const pluginApiClient = useApi(githubReleaseManagerApiRef); const { project } = useProjectContext(); const stats = useAsync(async () => { From 08e32cf91327ac57628499c61524fc4e2dff3c46 Mon Sep 17 00:00:00 2001 From: Dominik Henneke Date: Thu, 29 Apr 2021 10:36:53 +0200 Subject: [PATCH 195/485] Add support for oneOf and allOf Signed-off-by: Dominik Henneke --- .changeset/tough-planes-jump.md | 2 +- .../MultistepJsonForm/schema.test.ts | 96 +++++++++++++++++++ .../components/MultistepJsonForm/schema.ts | 20 +++- 3 files changed, 116 insertions(+), 2 deletions(-) diff --git a/.changeset/tough-planes-jump.md b/.changeset/tough-planes-jump.md index a30315e9e4..ebbec65159 100644 --- a/.changeset/tough-planes-jump.md +++ b/.changeset/tough-planes-jump.md @@ -2,4 +2,4 @@ '@backstage/plugin-scaffolder': patch --- -Support anyOf schemas in the scaffolder template +Support `anyOf`, `oneOf` and `allOf` schemas in the scaffolder template. diff --git a/plugins/scaffolder/src/components/MultistepJsonForm/schema.test.ts b/plugins/scaffolder/src/components/MultistepJsonForm/schema.test.ts index edfde0ea90..64dd705952 100644 --- a/plugins/scaffolder/src/components/MultistepJsonForm/schema.test.ts +++ b/plugins/scaffolder/src/components/MultistepJsonForm/schema.test.ts @@ -94,6 +94,28 @@ describe('transformSchemaToProps', () => { }, }, ], + oneOf: [ + { + properties: { + field4: { + type: 'string', + default: 'Value 1', + 'ui:readonly': true, + }, + }, + }, + ], + allOf: [ + { + properties: { + field5: { + type: 'string', + default: 'Value 1', + 'ui:readonly': true, + }, + }, + }, + ], properties: { field1: { type: 'object', @@ -117,6 +139,28 @@ describe('transformSchemaToProps', () => { }, }, ], + oneOf: [ + { + properties: { + field4: { + type: 'string', + default: 'Value 1', + 'ui:readonly': true, + }, + }, + }, + ], + allOf: [ + { + properties: { + field5: { + type: 'string', + default: 'Value 1', + 'ui:readonly': true, + }, + }, + }, + ], }, field2: { type: 'string', @@ -144,6 +188,26 @@ describe('transformSchemaToProps', () => { }, }, ], + oneOf: [ + { + properties: { + field4: { + type: 'string', + default: 'Value 1', + }, + }, + }, + ], + allOf: [ + { + properties: { + field5: { + type: 'string', + default: 'Value 1', + }, + }, + }, + ], properties: { field1: { type: 'object', @@ -165,6 +229,26 @@ describe('transformSchemaToProps', () => { }, }, ], + oneOf: [ + { + properties: { + field4: { + type: 'string', + default: 'Value 1', + }, + }, + }, + ], + allOf: [ + { + properties: { + field5: { + type: 'string', + default: 'Value 1', + }, + }, + }, + ], }, field2: { type: 'string', @@ -175,10 +259,22 @@ describe('transformSchemaToProps', () => { field3: { 'ui:readonly': true, }, + field4: { + 'ui:readonly': true, + }, + field5: { + 'ui:readonly': true, + }, field1: { field3: { 'ui:readonly': true, }, + field4: { + 'ui:readonly': true, + }, + field5: { + 'ui:readonly': true, + }, }, field2: { 'ui:derp': 'xerp', diff --git a/plugins/scaffolder/src/components/MultistepJsonForm/schema.ts b/plugins/scaffolder/src/components/MultistepJsonForm/schema.ts index c189bbf1a7..b4aa3e309d 100644 --- a/plugins/scaffolder/src/components/MultistepJsonForm/schema.ts +++ b/plugins/scaffolder/src/components/MultistepJsonForm/schema.ts @@ -26,7 +26,7 @@ function extractUiSchema(schema: JsonObject, uiSchema: JsonObject) { return; } - const { properties, anyOf } = schema; + const { properties, anyOf, oneOf, allOf } = schema; for (const propName in schema) { if (!schema.hasOwnProperty(propName)) { @@ -63,6 +63,24 @@ function extractUiSchema(schema: JsonObject, uiSchema: JsonObject) { extractUiSchema(schemaNode, uiSchema); } } + + if (Array.isArray(oneOf)) { + for (const schemaNode of oneOf) { + if (!isObject(schemaNode)) { + continue; + } + extractUiSchema(schemaNode, uiSchema); + } + } + + if (Array.isArray(allOf)) { + for (const schemaNode of allOf) { + if (!isObject(schemaNode)) { + continue; + } + extractUiSchema(schemaNode, uiSchema); + } + } } export function transformSchemaToProps( From e9e56b01ac3d115c81fc511c8f82afa36ce9a9c8 Mon Sep 17 00:00:00 2001 From: Jussi Hallila Date: Thu, 29 Apr 2021 09:43:10 +0200 Subject: [PATCH 196/485] Add possibility to use path style discovery on S3 tech docs. Enables the possibility to support S3-like buckets that rely on path style API like Localstack. Signed-off-by: Jussi Hallila --- .changeset/tricky-yaks-melt.md | 6 ++++++ .github/styles/vocab.txt | 2 ++ docs/features/techdocs/configuration.md | 5 +++++ packages/techdocs-common/src/stages/publish/awsS3.ts | 7 +++++++ plugins/techdocs-backend/config.d.ts | 7 +++++++ 5 files changed, 27 insertions(+) create mode 100644 .changeset/tricky-yaks-melt.md diff --git a/.changeset/tricky-yaks-melt.md b/.changeset/tricky-yaks-melt.md new file mode 100644 index 0000000000..3679e6d1da --- /dev/null +++ b/.changeset/tricky-yaks-melt.md @@ -0,0 +1,6 @@ +--- +'@backstage/techdocs-common': patch +--- + +Adding optional config to enable S3-like API for tech-docs using s3ForcePathStyle option. +This allows providers like LocalStack, Minio and Wasabi (+possibly others) to be used to host tech docs. diff --git a/.github/styles/vocab.txt b/.github/styles/vocab.txt index a12f638a74..694226b8cc 100644 --- a/.github/styles/vocab.txt +++ b/.github/styles/vocab.txt @@ -41,8 +41,10 @@ Kaewkasi Knex Leasot Lerna +LocalStack Luxon Minikube +Minio Mkdocs Monorepo Namespaces diff --git a/docs/features/techdocs/configuration.md b/docs/features/techdocs/configuration.md index c7876f3874..aa38dd42b1 100644 --- a/docs/features/techdocs/configuration.md +++ b/docs/features/techdocs/configuration.md @@ -78,6 +78,11 @@ techdocs: # https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#constructor-property endpoint: ${AWS_ENDPOINT} + # (Optional) Whether to use path style URLs when communicating with S3. + # Defaults to false. + # This allows providers like LocalStack, Minio and Wasabi (and possibly others) to be used to host tech docs. + s3ForcePathStyle: false + # Required when techdocs.publisher.type is set to 'azureBlobStorage'. Skip otherwise. azureBlobStorage: diff --git a/packages/techdocs-common/src/stages/publish/awsS3.ts b/packages/techdocs-common/src/stages/publish/awsS3.ts index 9c6684fdca..d628c860fd 100644 --- a/packages/techdocs-common/src/stages/publish/awsS3.ts +++ b/packages/techdocs-common/src/stages/publish/awsS3.ts @@ -80,10 +80,17 @@ export class AwsS3Publish implements PublisherBase { 'techdocs.publisher.awsS3.endpoint', ); + // AWS forcePathStyle is an optional config. If missing, it defaults to false. Needs to be enabled for cases + // where endpoint url points to locally hosted S3 compatible storage like Localstack + const s3ForcePathStyle = config.getOptionalBoolean( + 'techdocs.publisher.awsS3.s3ForcePathStyle', + ); + const storageClient = new aws.S3({ credentials, ...(region && { region }), ...(endpoint && { endpoint }), + ...(s3ForcePathStyle && { s3ForcePathStyle }), }); return new AwsS3Publish(storageClient, bucketName, logger); diff --git a/plugins/techdocs-backend/config.d.ts b/plugins/techdocs-backend/config.d.ts index 83b79f2f6c..57dbb5108e 100644 --- a/plugins/techdocs-backend/config.d.ts +++ b/plugins/techdocs-backend/config.d.ts @@ -90,6 +90,13 @@ export interface Config { * @visibility secret */ endpoint?: string; + /** + * (Optional) Whether to use path style URLs when communicating with S3. + * Defaults to false. + * This allows providers like LocalStack, Minio and Wasabi (and possibly others) to be used to host tech docs. + * @visibility backend + */ + endpoint?: string; }; } | { From ac64ec2228c49a976bc994d320f94da9a051f6c0 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 29 Apr 2021 10:55:31 +0200 Subject: [PATCH 197/485] Fix tests Signed-off-by: Erik Engervall --- .../src/features/CreateRc/CreateRc.test.tsx | 5 ++--- .../features/CreateRc/hooks/useCreateRc.test.tsx | 7 +++---- .../src/features/Features.test.tsx | 16 +++++++++------- .../src/features/Info/Info.test.tsx | 3 +-- .../src/features/Patch/Patch.test.tsx | 3 +-- .../src/features/Patch/PatchBody.test.tsx | 12 +++++------- .../src/features/Patch/hooks/usePatch.test.ts | 7 +++---- .../src/features/PromoteRc/PromoteRc.test.tsx | 3 +-- .../features/PromoteRc/PromoteRcBody.test.tsx | 3 +-- .../PromoteRc/hooks/usePromoteRc.test.ts | 7 +++---- .../src/features/RepoDetailsForm/Owner.test.tsx | 12 +++++------- .../src/features/RepoDetailsForm/Repo.test.tsx | 12 +++++------- .../RepoDetailsForm/VersioningStrategy.test.tsx | 3 +-- .../src/helpers/tagParts/getTagParts.test.ts | 7 +++---- .../src/hooks/useQueryHandler.test.tsx | 3 +-- 15 files changed, 44 insertions(+), 59 deletions(-) diff --git a/plugins/github-release-manager/src/features/CreateRc/CreateRc.test.tsx b/plugins/github-release-manager/src/features/CreateRc/CreateRc.test.tsx index 3c4a324b25..5f0ccaa20c 100644 --- a/plugins/github-release-manager/src/features/CreateRc/CreateRc.test.tsx +++ b/plugins/github-release-manager/src/features/CreateRc/CreateRc.test.tsx @@ -25,8 +25,10 @@ import { mockReleaseVersionCalver, mockSemverProject, } from '../../test-helpers/test-helpers'; +import { CreateRc } from './CreateRc'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { useCreateRc } from './hooks/useCreateRc'; +import { useProjectContext } from '../../contexts/ProjectContext'; jest.mock('../../contexts/ProjectContext', () => ({ useProjectContext: jest.fn(() => ({ @@ -46,9 +48,6 @@ jest.mock('./hooks/useCreateRc', () => ({ } as ReturnType), })); -import { useProjectContext } from '../../contexts/ProjectContext'; -import { CreateRc } from './CreateRc'; - describe('CreateRc', () => { it('should display CTA', () => { const { getByTestId } = render( diff --git a/plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.test.tsx b/plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.test.tsx index cf4fa0f5ed..adbbe3b9f6 100644 --- a/plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.test.tsx +++ b/plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.test.tsx @@ -26,10 +26,9 @@ import { } from '../../../test-helpers/test-helpers'; import { useCreateRc } from './useCreateRc'; -jest.mock('../../../contexts/PluginApiClientContext', () => ({ - usePluginApiClientContext: () => ({ - pluginApiClient: mockApiClient, - }), +jest.mock('@backstage/core', () => ({ + useApi: () => mockApiClient, + createApiRef: jest.fn(), })); describe('useCreateRc', () => { diff --git a/plugins/github-release-manager/src/features/Features.test.tsx b/plugins/github-release-manager/src/features/Features.test.tsx index d53f542cef..e2f5428331 100644 --- a/plugins/github-release-manager/src/features/Features.test.tsx +++ b/plugins/github-release-manager/src/features/Features.test.tsx @@ -17,13 +17,17 @@ import React from 'react'; import { render, act, waitFor } from '@testing-library/react'; +import { Features } from './Features'; import { mockApiClient, mockCalverProject } from '../test-helpers/test-helpers'; import { TEST_IDS } from '../test-helpers/test-ids'; -jest.mock('../contexts/PluginApiClientContext', () => ({ - usePluginApiClientContext: () => ({ - pluginApiClient: mockApiClient, - }), +jest.mock('@backstage/core', () => ({ + useApi: () => mockApiClient, + createApiRef: jest.fn(), + ErrorBoundary: ({ children }: { children: React.ReactNode }) => ( + <>{children} + ), + InfoCard: ({ children }: { children: React.ReactNode }) => <>{children}, })); jest.mock('../contexts/ProjectContext', () => ({ useProjectContext: () => ({ @@ -31,8 +35,6 @@ jest.mock('../contexts/ProjectContext', () => ({ }), })); -import { Features } from './Features'; - describe('Features', () => { it('should omit features omitted via configuration', async () => { const { getByTestId } = render( @@ -52,7 +54,7 @@ describe('Features', () => { expect(getByTestId(TEST_IDS.info.info)).toMatchInlineSnapshot(`
({ useProjectContext: () => ({ @@ -29,8 +30,6 @@ jest.mock('../../contexts/ProjectContext', () => ({ }), })); -import { Info } from './Info'; - describe('Info', () => { it('should return early if no latestRelease exists', async () => { const { findByText } = render( diff --git a/plugins/github-release-manager/src/features/Patch/Patch.test.tsx b/plugins/github-release-manager/src/features/Patch/Patch.test.tsx index 2f7f170d9f..458861c802 100644 --- a/plugins/github-release-manager/src/features/Patch/Patch.test.tsx +++ b/plugins/github-release-manager/src/features/Patch/Patch.test.tsx @@ -22,6 +22,7 @@ import { mockCalverProject, } from '../../test-helpers/test-helpers'; import { TEST_IDS } from '../../test-helpers/test-ids'; +import { Patch } from './Patch'; jest.mock('../../contexts/ProjectContext', () => ({ useProjectContext: () => ({ @@ -29,8 +30,6 @@ jest.mock('../../contexts/ProjectContext', () => ({ }), })); -import { Patch } from './Patch'; - describe('Patch', () => { it('should return early if no latestRelease exists', () => { const { getByTestId } = render( diff --git a/plugins/github-release-manager/src/features/Patch/PatchBody.test.tsx b/plugins/github-release-manager/src/features/Patch/PatchBody.test.tsx index be9ea1ce45..38c09ab943 100644 --- a/plugins/github-release-manager/src/features/Patch/PatchBody.test.tsx +++ b/plugins/github-release-manager/src/features/Patch/PatchBody.test.tsx @@ -26,11 +26,12 @@ import { mockReleaseVersionCalver, mockTagParts, } from '../../test-helpers/test-helpers'; +import { PatchBody } from './PatchBody'; +import { TEST_IDS } from '../../test-helpers/test-ids'; -jest.mock('../../contexts/PluginApiClientContext', () => ({ - usePluginApiClientContext: () => ({ - pluginApiClient: mockApiClient, - }), +jest.mock('@backstage/core', () => ({ + useApi: () => mockApiClient, + createApiRef: jest.fn(), })); jest.mock('../../contexts/ProjectContext', () => ({ useProjectContext: () => ({ @@ -45,9 +46,6 @@ jest.mock('./hooks/usePatch', () => ({ }), })); -import { PatchBody } from './PatchBody'; -import { TEST_IDS } from '../../test-helpers/test-ids'; - describe('PatchBody', () => { beforeEach(jest.clearAllMocks); diff --git a/plugins/github-release-manager/src/features/Patch/hooks/usePatch.test.ts b/plugins/github-release-manager/src/features/Patch/hooks/usePatch.test.ts index be25b84809..5fe1614e42 100644 --- a/plugins/github-release-manager/src/features/Patch/hooks/usePatch.test.ts +++ b/plugins/github-release-manager/src/features/Patch/hooks/usePatch.test.ts @@ -27,10 +27,9 @@ import { } from '../../../test-helpers/test-helpers'; import { usePatch } from './usePatch'; -jest.mock('../../../contexts/PluginApiClientContext', () => ({ - usePluginApiClientContext: () => ({ - pluginApiClient: mockApiClient, - }), +jest.mock('@backstage/core', () => ({ + useApi: () => mockApiClient, + createApiRef: jest.fn(), })); describe('patch', () => { diff --git a/plugins/github-release-manager/src/features/PromoteRc/PromoteRc.test.tsx b/plugins/github-release-manager/src/features/PromoteRc/PromoteRc.test.tsx index f4e7c1fb41..089b626da3 100644 --- a/plugins/github-release-manager/src/features/PromoteRc/PromoteRc.test.tsx +++ b/plugins/github-release-manager/src/features/PromoteRc/PromoteRc.test.tsx @@ -22,6 +22,7 @@ import { mockReleaseVersionCalver, } from '../../test-helpers/test-helpers'; import { TEST_IDS } from '../../test-helpers/test-ids'; +import { PromoteRc } from './PromoteRc'; jest.mock('./PromoteRcBody', () => ({ PromoteRcBody: () => ( @@ -29,8 +30,6 @@ jest.mock('./PromoteRcBody', () => ({ ), })); -import { PromoteRc } from './PromoteRc'; - describe('PromoteRc', () => { it('return early if no latest release present', () => { const { getByTestId } = render(); diff --git a/plugins/github-release-manager/src/features/PromoteRc/PromoteRcBody.test.tsx b/plugins/github-release-manager/src/features/PromoteRc/PromoteRcBody.test.tsx index 2d67832587..14b294e581 100644 --- a/plugins/github-release-manager/src/features/PromoteRc/PromoteRcBody.test.tsx +++ b/plugins/github-release-manager/src/features/PromoteRc/PromoteRcBody.test.tsx @@ -19,6 +19,7 @@ import { render } from '@testing-library/react'; import { mockReleaseCandidateCalver } from '../../test-helpers/test-helpers'; import { TEST_IDS } from '../../test-helpers/test-ids'; +import { PromoteRcBody } from './PromoteRcBody'; jest.mock('./hooks/usePromoteRc', () => ({ usePromoteRc: () => ({ @@ -28,8 +29,6 @@ jest.mock('./hooks/usePromoteRc', () => ({ }), })); -import { PromoteRcBody } from './PromoteRcBody'; - describe('PromoteRcBody', () => { it('should display CTA', () => { const { getByTestId } = render( diff --git a/plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.test.ts b/plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.test.ts index 4b7149ba7b..d682476d33 100644 --- a/plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.test.ts +++ b/plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.test.ts @@ -24,10 +24,9 @@ import { } from '../../../test-helpers/test-helpers'; import { usePromoteRc } from './usePromoteRc'; -jest.mock('../../../contexts/PluginApiClientContext', () => ({ - usePluginApiClientContext: () => ({ - pluginApiClient: mockApiClient, - }), +jest.mock('@backstage/core', () => ({ + useApi: () => mockApiClient, + createApiRef: jest.fn(), })); jest.mock('../../../contexts/ProjectContext', () => ({ useProjectContext: () => ({ diff --git a/plugins/github-release-manager/src/features/RepoDetailsForm/Owner.test.tsx b/plugins/github-release-manager/src/features/RepoDetailsForm/Owner.test.tsx index da95f5fa50..aed6fe3496 100644 --- a/plugins/github-release-manager/src/features/RepoDetailsForm/Owner.test.tsx +++ b/plugins/github-release-manager/src/features/RepoDetailsForm/Owner.test.tsx @@ -23,6 +23,8 @@ import { mockSearchCalver, } from '../../test-helpers/test-helpers'; import { TEST_IDS } from '../../test-helpers/test-ids'; +import { useProjectContext } from '../../contexts/ProjectContext'; +import { Owner } from './Owner'; jest.mock('react-router', () => ({ useNavigate: jest.fn(), @@ -30,10 +32,9 @@ jest.mock('react-router', () => ({ search: mockSearchCalver, })), })); -jest.mock('../../contexts/PluginApiClientContext', () => ({ - usePluginApiClientContext: () => ({ - pluginApiClient: mockApiClient, - }), +jest.mock('@backstage/core', () => ({ + useApi: () => mockApiClient, + createApiRef: jest.fn(), })); jest.mock('../../contexts/ProjectContext', () => ({ useProjectContext: jest.fn(() => ({ @@ -41,9 +42,6 @@ jest.mock('../../contexts/ProjectContext', () => ({ })), })); -import { useProjectContext } from '../../contexts/ProjectContext'; -import { Owner } from './Owner'; - describe('Owner', () => { beforeEach(jest.clearAllMocks); diff --git a/plugins/github-release-manager/src/features/RepoDetailsForm/Repo.test.tsx b/plugins/github-release-manager/src/features/RepoDetailsForm/Repo.test.tsx index ab6c98ea5f..9b087d47e2 100644 --- a/plugins/github-release-manager/src/features/RepoDetailsForm/Repo.test.tsx +++ b/plugins/github-release-manager/src/features/RepoDetailsForm/Repo.test.tsx @@ -23,6 +23,8 @@ import { mockSearchCalver, } from '../../test-helpers/test-helpers'; import { TEST_IDS } from '../../test-helpers/test-ids'; +import { useProjectContext } from '../../contexts/ProjectContext'; +import { Repo } from './Repo'; jest.mock('react-router', () => ({ useNavigate: jest.fn(), @@ -30,10 +32,9 @@ jest.mock('react-router', () => ({ search: mockSearchCalver, })), })); -jest.mock('../../contexts/PluginApiClientContext', () => ({ - usePluginApiClientContext: () => ({ - pluginApiClient: mockApiClient, - }), +jest.mock('@backstage/core', () => ({ + useApi: () => mockApiClient, + createApiRef: jest.fn(), })); jest.mock('../../contexts/ProjectContext', () => ({ useProjectContext: jest.fn(() => ({ @@ -41,9 +42,6 @@ jest.mock('../../contexts/ProjectContext', () => ({ })), })); -import { useProjectContext } from '../../contexts/ProjectContext'; -import { Repo } from './Repo'; - describe('Repo', () => { beforeEach(jest.clearAllMocks); diff --git a/plugins/github-release-manager/src/features/RepoDetailsForm/VersioningStrategy.test.tsx b/plugins/github-release-manager/src/features/RepoDetailsForm/VersioningStrategy.test.tsx index 4d36b26ed6..42a17f9b43 100644 --- a/plugins/github-release-manager/src/features/RepoDetailsForm/VersioningStrategy.test.tsx +++ b/plugins/github-release-manager/src/features/RepoDetailsForm/VersioningStrategy.test.tsx @@ -21,6 +21,7 @@ import { mockSemverProject, mockSearchCalver, } from '../../test-helpers/test-helpers'; +import { VersioningStrategy } from './VersioningStrategy'; const mockNavigate = jest.fn(); @@ -36,8 +37,6 @@ jest.mock('../../contexts/ProjectContext', () => ({ }), })); -import { VersioningStrategy } from './VersioningStrategy'; - describe('Repo', () => { beforeEach(jest.clearAllMocks); diff --git a/plugins/github-release-manager/src/helpers/tagParts/getTagParts.test.ts b/plugins/github-release-manager/src/helpers/tagParts/getTagParts.test.ts index fc1ab1479b..825d23c001 100644 --- a/plugins/github-release-manager/src/helpers/tagParts/getTagParts.test.ts +++ b/plugins/github-release-manager/src/helpers/tagParts/getTagParts.test.ts @@ -18,6 +18,9 @@ import { mockCalverProject, mockSemverProject, } from '../../test-helpers/test-helpers'; +import { getCalverTagParts } from './getCalverTagParts'; +import { getSemverTagParts } from './getSemverTagParts'; +import { getTagParts } from './getTagParts'; jest.mock('./getCalverTagParts', () => ({ getCalverTagParts: jest.fn(), @@ -26,10 +29,6 @@ jest.mock('./getSemverTagParts', () => ({ getSemverTagParts: jest.fn(), })); -import { getCalverTagParts } from './getCalverTagParts'; -import { getSemverTagParts } from './getSemverTagParts'; -import { getTagParts } from './getTagParts'; - describe('getTagParts', () => { beforeEach(jest.resetAllMocks); diff --git a/plugins/github-release-manager/src/hooks/useQueryHandler.test.tsx b/plugins/github-release-manager/src/hooks/useQueryHandler.test.tsx index a80fa3df04..4024e37054 100644 --- a/plugins/github-release-manager/src/hooks/useQueryHandler.test.tsx +++ b/plugins/github-release-manager/src/hooks/useQueryHandler.test.tsx @@ -18,6 +18,7 @@ import React from 'react'; import { render } from '@testing-library/react'; import { mockSearchSemver } from '../test-helpers/test-helpers'; +import { useQueryHandler } from './useQueryHandler'; jest.mock('react-router', () => ({ useLocation: jest.fn(() => ({ @@ -25,8 +26,6 @@ jest.mock('react-router', () => ({ })), })); -import { useQueryHandler } from './useQueryHandler'; - const TEST_ID = 'grm--use-query-handler'; const MockComponent = () => { From 09fc040eec6f374f970db948f4534181edfe0e08 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 29 Apr 2021 10:57:39 +0200 Subject: [PATCH 198/485] Address PR comment regarding ConfigReader mocking Signed-off-by: Erik Engervall --- .../src/api/PluginApiClient.test.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/plugins/github-release-manager/src/api/PluginApiClient.test.ts b/plugins/github-release-manager/src/api/PluginApiClient.test.ts index 867974b80b..d4f86ef9e7 100644 --- a/plugins/github-release-manager/src/api/PluginApiClient.test.ts +++ b/plugins/github-release-manager/src/api/PluginApiClient.test.ts @@ -14,19 +14,13 @@ * limitations under the License. */ -import { OAuthApi } from '@backstage/core'; +import { ConfigReader, OAuthApi } from '@backstage/core'; import { PluginApiClient } from './PluginApiClient'; -jest.mock('@backstage/integration', () => ({ - readGitHubIntegrationConfigs: jest.fn(() => []), -})); - describe('PluginApiClient', () => { it('should return the default plugin api client', () => { - const configApi = { - getOptionalConfigArray: jest.fn(), - } as any; + const configApi = new ConfigReader({}); const githubAuthApi: OAuthApi = { getAccessToken: jest.fn(), }; From c6367d81afe6475568a2447d3c2fa85534ea489f Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 29 Apr 2021 10:58:33 +0200 Subject: [PATCH 199/485] chore: updating variable names in terraform doc Signed-off-by: blam --- .../techdocs-s3-storage/terraform.tf | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/contrib/terraform/techdocs-s3-storage/terraform.tf b/contrib/terraform/techdocs-s3-storage/terraform.tf index ca267f0f12..f256663f43 100644 --- a/contrib/terraform/techdocs-s3-storage/terraform.tf +++ b/contrib/terraform/techdocs-s3-storage/terraform.tf @@ -2,15 +2,15 @@ # Variables #========================== -variable "backstage-bucket" { +variable "backstage_bucket" { default = "backstage_bucket_for_my_corp" } -variable "backstage-iam" { +variable "backstage_iam" { default = "backstage" } -variable "shared-managed-tag-value" { +variable "shared_managed_tag" { default = "terraform_for_my_corp" } @@ -19,7 +19,7 @@ variable "shared-managed-tag-value" { #========================== resource "aws_s3_bucket" "backstage" { - bucket = var.backstage-bucket + bucket = var.backstage_bucket acl = "private" provider = aws @@ -36,8 +36,8 @@ resource "aws_s3_bucket" "backstage" { } tags = { - Name = var.backstage-bucket - "Managed By Terraform" = var.shared-managed-tag-value + Name = var.backstage_bucket + "Managed By Terraform" = var.shared_managed_tag } } @@ -56,16 +56,16 @@ resource "aws_s3_bucket_public_access_block" "backstage" { #========================== resource "aws_iam_user" "backstage" { - name = var.backstage-iam + name = var.backstage_iam } resource "aws_iam_user_policy" "backstage" { - name = var.backstage-iam + name = var.backstage_iam user = aws_iam_user.backstage.name - policy = data.aws_iam_policy_document.backstage-policy.json + policy = data.aws_iam_policy_document.backstage_policy.json } -data "aws_iam_policy_document" "backstage-policy" { +data "aws_iam_policy_document" "backstage_policy" { statement { actions = [ "s3:PutObject", From 4a83f6493b293868a7c3c52ea34d620adc357b6a Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 29 Apr 2021 11:04:56 +0200 Subject: [PATCH 200/485] Rename github-release-manager to git-release-manager Signed-off-by: Erik Engervall --- ...elease-manager.yaml => git-release-manager.yaml} | 6 +++--- ...anager-logo.svg => git-release-manager-logo.svg} | 0 packages/app/package.json | 2 +- .../.eslintrc.js | 0 .../README.md | 0 .../dev/README.md | 6 +++--- .../dev/index.tsx | 0 .../package.json | 2 +- .../src/GitHubReleaseManager.tsx | 0 .../src/api/PluginApiClient.test.ts | 0 .../src/api/PluginApiClient.ts | 0 .../src/api/serviceApiRef.test.ts | 2 +- .../src/api/serviceApiRef.ts | 4 ++-- .../src/components/CenteredCircularProgress.tsx | 0 .../src/components/Differ.test.tsx | 0 .../src/components/Differ.tsx | 0 .../src/components/Divider.test.tsx | 0 .../src/components/Divider.tsx | 0 .../src/components/InfoCardPlus.test.tsx | 0 .../src/components/InfoCardPlus.tsx | 0 .../src/components/NoLatestRelease.test.tsx | 0 .../src/components/NoLatestRelease.tsx | 0 .../LinearProgressWithLabel.test.tsx | 0 .../ResponseStepDialog/LinearProgressWithLabel.tsx | 0 .../ResponseStepDialog/ResponseStepDialog.test.tsx | 0 .../ResponseStepDialog/ResponseStepDialog.tsx | 0 .../ResponseStepDialog/ResponseStepList.test.tsx | 0 .../ResponseStepDialog/ResponseStepList.tsx | 0 .../ResponseStepListItem.test.tsx | 0 .../ResponseStepDialog/ResponseStepListItem.tsx | 0 .../src/components/Transition.tsx | 0 .../src/constants/constants.test.ts | 0 .../src/constants/constants.ts | 0 .../src/contexts/ProjectContext.ts | 0 .../src/contexts/RefetchContext.ts | 0 .../src/errors/GitHubReleaseManagerError.ts | 0 .../src/features/CreateRc/CreateRc.test.tsx | 0 .../src/features/CreateRc/CreateRc.tsx | 0 .../features/CreateRc/hooks/useCreateRc.test.tsx | 0 .../src/features/CreateRc/hooks/useCreateRc.ts | 0 .../src/features/Features.test.tsx | 0 .../src/features/Features.tsx | 0 .../src/features/Info/Info.test.tsx | 0 .../src/features/Info/Info.tsx | 0 .../src/features/Info/flow.png | Bin .../src/features/Patch/Patch.test.tsx | 0 .../src/features/Patch/Patch.tsx | 0 .../src/features/Patch/PatchBody.test.tsx | 0 .../src/features/Patch/PatchBody.tsx | 0 .../src/features/Patch/hooks/usePatch.test.ts | 0 .../src/features/Patch/hooks/usePatch.ts | 0 .../src/features/PromoteRc/PromoteRc.test.tsx | 0 .../src/features/PromoteRc/PromoteRc.tsx | 0 .../src/features/PromoteRc/PromoteRcBody.test.tsx | 0 .../src/features/PromoteRc/PromoteRcBody.tsx | 0 .../features/PromoteRc/hooks/usePromoteRc.test.ts | 0 .../src/features/PromoteRc/hooks/usePromoteRc.ts | 0 .../src/features/RepoDetailsForm/Owner.test.tsx | 0 .../src/features/RepoDetailsForm/Owner.tsx | 0 .../src/features/RepoDetailsForm/Repo.test.tsx | 0 .../src/features/RepoDetailsForm/Repo.tsx | 0 .../features/RepoDetailsForm/RepoDetailsForm.tsx | 0 .../RepoDetailsForm/VersioningStrategy.test.tsx | 0 .../features/RepoDetailsForm/VersioningStrategy.tsx | 0 .../src/features/RepoDetailsForm/styles.ts | 0 .../src/features/Stats/DialogBody.tsx | 0 .../src/features/Stats/DialogTitle.tsx | 0 .../Stats/Info/InDepth/AverageReleaseTime.tsx | 0 .../src/features/Stats/Info/InDepth/InDepth.tsx | 0 .../Stats/Info/InDepth/LongestReleaseTime.tsx | 0 .../src/features/Stats/Info/Info.tsx | 0 .../src/features/Stats/Info/Summary.tsx | 0 .../Info/helpers/getReleaseCommitPairs.test.tsx | 0 .../Stats/Info/helpers/getReleaseCommitPairs.tsx | 0 .../Stats/Info/hooks/useGetReleaseTimes.tsx | 0 .../src/features/Stats/Row/Row.tsx | 0 .../Stats/Row/RowCollapsed/ReleaseTagList.tsx | 0 .../features/Stats/Row/RowCollapsed/ReleaseTime.tsx | 0 .../Stats/Row/RowCollapsed/RowCollapsed.tsx | 0 .../src/features/Stats/Stats.tsx | 0 .../src/features/Stats/Warn.tsx | 0 .../features/Stats/contexts/ReleaseStatsContext.tsx | 0 .../Stats/helpers/getDecimalNumber.test.tsx | 0 .../src/features/Stats/helpers/getDecimalNumber.tsx | 0 .../Stats/helpers/getMappedReleases.test.tsx | 0 .../features/Stats/helpers/getMappedReleases.tsx | 0 .../features/Stats/helpers/getReleaseStats.test.tsx | 0 .../src/features/Stats/helpers/getReleaseStats.tsx | 0 .../src/features/Stats/helpers/getSummary.test.tsx | 0 .../src/features/Stats/helpers/getSummary.tsx | 0 .../src/features/Stats/hooks/useGetCommit.ts | 0 .../src/features/Stats/hooks/useGetStats.ts | 0 .../src/helpers/createResponseStepError.test.ts | 0 .../src/helpers/createResponseStepError.ts | 0 .../src/helpers/getBumpedTag.test.ts | 0 .../src/helpers/getBumpedTag.ts | 0 .../src/helpers/getRcGitHubInfo.test.ts | 0 .../src/helpers/getRcGitHubInfo.ts | 0 .../src/helpers/getShortCommitHash.test.ts | 0 .../src/helpers/getShortCommitHash.ts | 0 .../src/helpers/isCalverTagParts.test.ts | 0 .../src/helpers/isCalverTagParts.ts | 0 .../src/helpers/isProjectValid.test.ts | 0 .../src/helpers/isProjectValid.ts | 0 .../src/helpers/tagParts/getCalverTagParts.test.ts | 0 .../src/helpers/tagParts/getCalverTagParts.ts | 0 .../src/helpers/tagParts/getSemverTagParts.test.ts | 0 .../src/helpers/tagParts/getSemverTagParts.ts | 0 .../src/helpers/tagParts/getTagParts.test.ts | 0 .../src/helpers/tagParts/getTagParts.ts | 0 .../src/helpers/tagParts/validateTagName.ts | 0 .../src/helpers/tagParts/validateTagParts.test.ts | 0 .../src/hooks/useGetGitHubBatchInfo.test.ts | 0 .../src/hooks/useGetGitHubBatchInfo.ts | 0 .../src/hooks/useQueryHandler.test.tsx | 0 .../src/hooks/useQueryHandler.ts | 0 .../src/hooks/useResponseSteps.test.ts | 0 .../src/hooks/useResponseSteps.ts | 0 .../useVersioningStrategyMatchesRepoTags.test.tsx | 0 .../hooks/useVersioningStrategyMatchesRepoTags.ts | 0 .../src/index.ts | 0 .../src/plugin.test.ts | 2 +- .../src/plugin.ts | 2 +- .../src/routes.ts | 2 +- .../src/setupTests.ts | 0 .../src/styles/styles.ts | 0 .../src/test-helpers/stats.ts | 0 .../src/test-helpers/test-helpers.ts | 0 .../src/test-helpers/test-ids.ts | 0 .../src/types/types.ts | 0 130 files changed, 14 insertions(+), 14 deletions(-) rename microsite/data/plugins/{github-release-manager.yaml => git-release-manager.yaml} (64%) rename microsite/static/img/{github-release-manager-logo.svg => git-release-manager-logo.svg} (100%) rename plugins/{github-release-manager => git-release-manager}/.eslintrc.js (100%) rename plugins/{github-release-manager => git-release-manager}/README.md (100%) rename plugins/{github-release-manager => git-release-manager}/dev/README.md (72%) rename plugins/{github-release-manager => git-release-manager}/dev/index.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/package.json (96%) rename plugins/{github-release-manager => git-release-manager}/src/GitHubReleaseManager.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/api/PluginApiClient.test.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/api/PluginApiClient.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/api/serviceApiRef.test.ts (94%) rename plugins/{github-release-manager => git-release-manager}/src/api/serviceApiRef.ts (86%) rename plugins/{github-release-manager => git-release-manager}/src/components/CenteredCircularProgress.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/components/Differ.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/components/Differ.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/components/Divider.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/components/Divider.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/components/InfoCardPlus.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/components/InfoCardPlus.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/components/NoLatestRelease.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/components/NoLatestRelease.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/components/ResponseStepDialog/LinearProgressWithLabel.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/components/ResponseStepDialog/LinearProgressWithLabel.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/components/ResponseStepDialog/ResponseStepDialog.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/components/ResponseStepDialog/ResponseStepDialog.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/components/ResponseStepDialog/ResponseStepList.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/components/ResponseStepDialog/ResponseStepList.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/components/ResponseStepDialog/ResponseStepListItem.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/components/ResponseStepDialog/ResponseStepListItem.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/components/Transition.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/constants/constants.test.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/constants/constants.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/contexts/ProjectContext.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/contexts/RefetchContext.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/errors/GitHubReleaseManagerError.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/CreateRc/CreateRc.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/CreateRc/CreateRc.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/CreateRc/hooks/useCreateRc.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/CreateRc/hooks/useCreateRc.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Features.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Features.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Info/Info.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Info/Info.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Info/flow.png (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Patch/Patch.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Patch/Patch.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Patch/PatchBody.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Patch/PatchBody.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Patch/hooks/usePatch.test.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Patch/hooks/usePatch.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/PromoteRc/PromoteRc.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/PromoteRc/PromoteRc.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/PromoteRc/PromoteRcBody.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/PromoteRc/PromoteRcBody.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/PromoteRc/hooks/usePromoteRc.test.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/PromoteRc/hooks/usePromoteRc.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/RepoDetailsForm/Owner.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/RepoDetailsForm/Owner.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/RepoDetailsForm/Repo.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/RepoDetailsForm/Repo.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/RepoDetailsForm/RepoDetailsForm.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/RepoDetailsForm/VersioningStrategy.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/RepoDetailsForm/VersioningStrategy.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/RepoDetailsForm/styles.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/DialogBody.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/DialogTitle.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/Info/InDepth/AverageReleaseTime.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/Info/InDepth/InDepth.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/Info/InDepth/LongestReleaseTime.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/Info/Info.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/Info/Summary.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/Info/helpers/getReleaseCommitPairs.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/Info/helpers/getReleaseCommitPairs.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/Row/Row.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/Row/RowCollapsed/ReleaseTagList.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/Row/RowCollapsed/RowCollapsed.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/Stats.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/Warn.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/contexts/ReleaseStatsContext.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/helpers/getDecimalNumber.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/helpers/getDecimalNumber.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/helpers/getMappedReleases.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/helpers/getMappedReleases.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/helpers/getReleaseStats.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/helpers/getReleaseStats.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/helpers/getSummary.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/helpers/getSummary.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/hooks/useGetCommit.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/features/Stats/hooks/useGetStats.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/helpers/createResponseStepError.test.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/helpers/createResponseStepError.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/helpers/getBumpedTag.test.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/helpers/getBumpedTag.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/helpers/getRcGitHubInfo.test.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/helpers/getRcGitHubInfo.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/helpers/getShortCommitHash.test.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/helpers/getShortCommitHash.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/helpers/isCalverTagParts.test.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/helpers/isCalverTagParts.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/helpers/isProjectValid.test.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/helpers/isProjectValid.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/helpers/tagParts/getCalverTagParts.test.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/helpers/tagParts/getCalverTagParts.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/helpers/tagParts/getSemverTagParts.test.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/helpers/tagParts/getSemverTagParts.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/helpers/tagParts/getTagParts.test.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/helpers/tagParts/getTagParts.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/helpers/tagParts/validateTagName.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/helpers/tagParts/validateTagParts.test.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/hooks/useGetGitHubBatchInfo.test.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/hooks/useGetGitHubBatchInfo.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/hooks/useQueryHandler.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/hooks/useQueryHandler.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/hooks/useResponseSteps.test.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/hooks/useResponseSteps.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/hooks/useVersioningStrategyMatchesRepoTags.test.tsx (100%) rename plugins/{github-release-manager => git-release-manager}/src/hooks/useVersioningStrategyMatchesRepoTags.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/index.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/plugin.test.ts (95%) rename plugins/{github-release-manager => git-release-manager}/src/plugin.ts (98%) rename plugins/{github-release-manager => git-release-manager}/src/routes.ts (95%) rename plugins/{github-release-manager => git-release-manager}/src/setupTests.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/styles/styles.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/test-helpers/stats.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/test-helpers/test-helpers.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/test-helpers/test-ids.ts (100%) rename plugins/{github-release-manager => git-release-manager}/src/types/types.ts (100%) diff --git a/microsite/data/plugins/github-release-manager.yaml b/microsite/data/plugins/git-release-manager.yaml similarity index 64% rename from microsite/data/plugins/github-release-manager.yaml rename to microsite/data/plugins/git-release-manager.yaml index febc03f714..7eec6040ac 100644 --- a/microsite/data/plugins/github-release-manager.yaml +++ b/microsite/data/plugins/git-release-manager.yaml @@ -4,6 +4,6 @@ author: '@Spotify' authorUrl: https://github.com/spotify category: Release management description: Manage releases without having to juggle git commands -documentation: https://github.com/backstage/backstage/tree/master/plugins/github-release-manager -iconUrl: img/github-release-manager-logo.svg -npmPackageName: '@backstage/plugin-github-release-manager' +documentation: https://github.com/backstage/backstage/tree/master/plugins/git-release-manager +iconUrl: img/git-release-manager-logo.svg +npmPackageName: '@backstage/plugin-git-release-manager' diff --git a/microsite/static/img/github-release-manager-logo.svg b/microsite/static/img/git-release-manager-logo.svg similarity index 100% rename from microsite/static/img/github-release-manager-logo.svg rename to microsite/static/img/git-release-manager-logo.svg diff --git a/packages/app/package.json b/packages/app/package.json index a3ef3698cb..70209f876c 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -28,7 +28,7 @@ "@backstage/plugin-newrelic": "^0.2.6", "@backstage/plugin-org": "^0.3.12", "@backstage/plugin-pagerduty": "0.3.2", - "@backstage/plugin-github-release-manager": "^0.1.1", + "@backstage/plugin-git-release-manager": "^0.1.1", "@backstage/plugin-rollbar": "^0.3.3", "@backstage/plugin-scaffolder": "^0.9.0", "@backstage/plugin-search": "^0.3.4", diff --git a/plugins/github-release-manager/.eslintrc.js b/plugins/git-release-manager/.eslintrc.js similarity index 100% rename from plugins/github-release-manager/.eslintrc.js rename to plugins/git-release-manager/.eslintrc.js diff --git a/plugins/github-release-manager/README.md b/plugins/git-release-manager/README.md similarity index 100% rename from plugins/github-release-manager/README.md rename to plugins/git-release-manager/README.md diff --git a/plugins/github-release-manager/dev/README.md b/plugins/git-release-manager/dev/README.md similarity index 72% rename from plugins/github-release-manager/dev/README.md rename to plugins/git-release-manager/dev/README.md index 52a8c8656b..c78083aa4f 100644 --- a/plugins/github-release-manager/dev/README.md +++ b/plugins/git-release-manager/dev/README.md @@ -1,12 +1,12 @@ -# github-release-manager +# git-release-manager -Welcome to the github-release-manager plugin! +Welcome to the git-release-manager plugin! _This plugin was created through the Backstage CLI_ ## Getting started -Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn start` in the root directory, and then navigating to [/github-release-manager](http://localhost:3000/github-release-manager). +Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn start` in the root directory, and then navigating to [/git-release-manager](http://localhost:3000/git-release-manager). You can also serve the plugin in isolation by running `yarn start` in the plugin directory. This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads. diff --git a/plugins/github-release-manager/dev/index.tsx b/plugins/git-release-manager/dev/index.tsx similarity index 100% rename from plugins/github-release-manager/dev/index.tsx rename to plugins/git-release-manager/dev/index.tsx diff --git a/plugins/github-release-manager/package.json b/plugins/git-release-manager/package.json similarity index 96% rename from plugins/github-release-manager/package.json rename to plugins/git-release-manager/package.json index be544bc1fb..248250324a 100644 --- a/plugins/github-release-manager/package.json +++ b/plugins/git-release-manager/package.json @@ -1,5 +1,5 @@ { - "name": "@backstage/plugin-github-release-manager", + "name": "@backstage/plugin-git-release-manager", "version": "0.1.1", "main": "src/index.ts", "types": "src/index.ts", diff --git a/plugins/github-release-manager/src/GitHubReleaseManager.tsx b/plugins/git-release-manager/src/GitHubReleaseManager.tsx similarity index 100% rename from plugins/github-release-manager/src/GitHubReleaseManager.tsx rename to plugins/git-release-manager/src/GitHubReleaseManager.tsx diff --git a/plugins/github-release-manager/src/api/PluginApiClient.test.ts b/plugins/git-release-manager/src/api/PluginApiClient.test.ts similarity index 100% rename from plugins/github-release-manager/src/api/PluginApiClient.test.ts rename to plugins/git-release-manager/src/api/PluginApiClient.test.ts diff --git a/plugins/github-release-manager/src/api/PluginApiClient.ts b/plugins/git-release-manager/src/api/PluginApiClient.ts similarity index 100% rename from plugins/github-release-manager/src/api/PluginApiClient.ts rename to plugins/git-release-manager/src/api/PluginApiClient.ts diff --git a/plugins/github-release-manager/src/api/serviceApiRef.test.ts b/plugins/git-release-manager/src/api/serviceApiRef.test.ts similarity index 94% rename from plugins/github-release-manager/src/api/serviceApiRef.test.ts rename to plugins/git-release-manager/src/api/serviceApiRef.test.ts index 7dc22deb29..4e8c204c6b 100644 --- a/plugins/github-release-manager/src/api/serviceApiRef.test.ts +++ b/plugins/git-release-manager/src/api/serviceApiRef.test.ts @@ -24,7 +24,7 @@ describe('githubReleaseManagerApiRef', () => { ApiRefImpl { "config": Object { "description": "Used by the GitHub Release Manager plugin to make requests", - "id": "plugin.github-release-manager.service", + "id": "plugin.git-release-manager.service", }, } `); diff --git a/plugins/github-release-manager/src/api/serviceApiRef.ts b/plugins/git-release-manager/src/api/serviceApiRef.ts similarity index 86% rename from plugins/github-release-manager/src/api/serviceApiRef.ts rename to plugins/git-release-manager/src/api/serviceApiRef.ts index 4451dd8dc8..f44168c476 100644 --- a/plugins/github-release-manager/src/api/serviceApiRef.ts +++ b/plugins/git-release-manager/src/api/serviceApiRef.ts @@ -19,6 +19,6 @@ import { createApiRef } from '@backstage/core'; import { IPluginApiClient } from './PluginApiClient'; export const githubReleaseManagerApiRef = createApiRef({ - id: 'plugin.github-release-manager.service', - description: 'Used by the GitHub Release Manager plugin to make requests', + id: 'plugin.git-release-manager.service', + description: 'Used by the Git Release Manager plugin to make requests', }); diff --git a/plugins/github-release-manager/src/components/CenteredCircularProgress.tsx b/plugins/git-release-manager/src/components/CenteredCircularProgress.tsx similarity index 100% rename from plugins/github-release-manager/src/components/CenteredCircularProgress.tsx rename to plugins/git-release-manager/src/components/CenteredCircularProgress.tsx diff --git a/plugins/github-release-manager/src/components/Differ.test.tsx b/plugins/git-release-manager/src/components/Differ.test.tsx similarity index 100% rename from plugins/github-release-manager/src/components/Differ.test.tsx rename to plugins/git-release-manager/src/components/Differ.test.tsx diff --git a/plugins/github-release-manager/src/components/Differ.tsx b/plugins/git-release-manager/src/components/Differ.tsx similarity index 100% rename from plugins/github-release-manager/src/components/Differ.tsx rename to plugins/git-release-manager/src/components/Differ.tsx diff --git a/plugins/github-release-manager/src/components/Divider.test.tsx b/plugins/git-release-manager/src/components/Divider.test.tsx similarity index 100% rename from plugins/github-release-manager/src/components/Divider.test.tsx rename to plugins/git-release-manager/src/components/Divider.test.tsx diff --git a/plugins/github-release-manager/src/components/Divider.tsx b/plugins/git-release-manager/src/components/Divider.tsx similarity index 100% rename from plugins/github-release-manager/src/components/Divider.tsx rename to plugins/git-release-manager/src/components/Divider.tsx diff --git a/plugins/github-release-manager/src/components/InfoCardPlus.test.tsx b/plugins/git-release-manager/src/components/InfoCardPlus.test.tsx similarity index 100% rename from plugins/github-release-manager/src/components/InfoCardPlus.test.tsx rename to plugins/git-release-manager/src/components/InfoCardPlus.test.tsx diff --git a/plugins/github-release-manager/src/components/InfoCardPlus.tsx b/plugins/git-release-manager/src/components/InfoCardPlus.tsx similarity index 100% rename from plugins/github-release-manager/src/components/InfoCardPlus.tsx rename to plugins/git-release-manager/src/components/InfoCardPlus.tsx diff --git a/plugins/github-release-manager/src/components/NoLatestRelease.test.tsx b/plugins/git-release-manager/src/components/NoLatestRelease.test.tsx similarity index 100% rename from plugins/github-release-manager/src/components/NoLatestRelease.test.tsx rename to plugins/git-release-manager/src/components/NoLatestRelease.test.tsx diff --git a/plugins/github-release-manager/src/components/NoLatestRelease.tsx b/plugins/git-release-manager/src/components/NoLatestRelease.tsx similarity index 100% rename from plugins/github-release-manager/src/components/NoLatestRelease.tsx rename to plugins/git-release-manager/src/components/NoLatestRelease.tsx diff --git a/plugins/github-release-manager/src/components/ResponseStepDialog/LinearProgressWithLabel.test.tsx b/plugins/git-release-manager/src/components/ResponseStepDialog/LinearProgressWithLabel.test.tsx similarity index 100% rename from plugins/github-release-manager/src/components/ResponseStepDialog/LinearProgressWithLabel.test.tsx rename to plugins/git-release-manager/src/components/ResponseStepDialog/LinearProgressWithLabel.test.tsx diff --git a/plugins/github-release-manager/src/components/ResponseStepDialog/LinearProgressWithLabel.tsx b/plugins/git-release-manager/src/components/ResponseStepDialog/LinearProgressWithLabel.tsx similarity index 100% rename from plugins/github-release-manager/src/components/ResponseStepDialog/LinearProgressWithLabel.tsx rename to plugins/git-release-manager/src/components/ResponseStepDialog/LinearProgressWithLabel.tsx diff --git a/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.test.tsx b/plugins/git-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.test.tsx similarity index 100% rename from plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.test.tsx rename to plugins/git-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.test.tsx diff --git a/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.tsx b/plugins/git-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.tsx similarity index 100% rename from plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.tsx rename to plugins/git-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.tsx diff --git a/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepList.test.tsx b/plugins/git-release-manager/src/components/ResponseStepDialog/ResponseStepList.test.tsx similarity index 100% rename from plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepList.test.tsx rename to plugins/git-release-manager/src/components/ResponseStepDialog/ResponseStepList.test.tsx diff --git a/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepList.tsx b/plugins/git-release-manager/src/components/ResponseStepDialog/ResponseStepList.tsx similarity index 100% rename from plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepList.tsx rename to plugins/git-release-manager/src/components/ResponseStepDialog/ResponseStepList.tsx diff --git a/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepListItem.test.tsx b/plugins/git-release-manager/src/components/ResponseStepDialog/ResponseStepListItem.test.tsx similarity index 100% rename from plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepListItem.test.tsx rename to plugins/git-release-manager/src/components/ResponseStepDialog/ResponseStepListItem.test.tsx diff --git a/plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepListItem.tsx b/plugins/git-release-manager/src/components/ResponseStepDialog/ResponseStepListItem.tsx similarity index 100% rename from plugins/github-release-manager/src/components/ResponseStepDialog/ResponseStepListItem.tsx rename to plugins/git-release-manager/src/components/ResponseStepDialog/ResponseStepListItem.tsx diff --git a/plugins/github-release-manager/src/components/Transition.tsx b/plugins/git-release-manager/src/components/Transition.tsx similarity index 100% rename from plugins/github-release-manager/src/components/Transition.tsx rename to plugins/git-release-manager/src/components/Transition.tsx diff --git a/plugins/github-release-manager/src/constants/constants.test.ts b/plugins/git-release-manager/src/constants/constants.test.ts similarity index 100% rename from plugins/github-release-manager/src/constants/constants.test.ts rename to plugins/git-release-manager/src/constants/constants.test.ts diff --git a/plugins/github-release-manager/src/constants/constants.ts b/plugins/git-release-manager/src/constants/constants.ts similarity index 100% rename from plugins/github-release-manager/src/constants/constants.ts rename to plugins/git-release-manager/src/constants/constants.ts diff --git a/plugins/github-release-manager/src/contexts/ProjectContext.ts b/plugins/git-release-manager/src/contexts/ProjectContext.ts similarity index 100% rename from plugins/github-release-manager/src/contexts/ProjectContext.ts rename to plugins/git-release-manager/src/contexts/ProjectContext.ts diff --git a/plugins/github-release-manager/src/contexts/RefetchContext.ts b/plugins/git-release-manager/src/contexts/RefetchContext.ts similarity index 100% rename from plugins/github-release-manager/src/contexts/RefetchContext.ts rename to plugins/git-release-manager/src/contexts/RefetchContext.ts diff --git a/plugins/github-release-manager/src/errors/GitHubReleaseManagerError.ts b/plugins/git-release-manager/src/errors/GitHubReleaseManagerError.ts similarity index 100% rename from plugins/github-release-manager/src/errors/GitHubReleaseManagerError.ts rename to plugins/git-release-manager/src/errors/GitHubReleaseManagerError.ts diff --git a/plugins/github-release-manager/src/features/CreateRc/CreateRc.test.tsx b/plugins/git-release-manager/src/features/CreateRc/CreateRc.test.tsx similarity index 100% rename from plugins/github-release-manager/src/features/CreateRc/CreateRc.test.tsx rename to plugins/git-release-manager/src/features/CreateRc/CreateRc.test.tsx diff --git a/plugins/github-release-manager/src/features/CreateRc/CreateRc.tsx b/plugins/git-release-manager/src/features/CreateRc/CreateRc.tsx similarity index 100% rename from plugins/github-release-manager/src/features/CreateRc/CreateRc.tsx rename to plugins/git-release-manager/src/features/CreateRc/CreateRc.tsx diff --git a/plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.test.tsx b/plugins/git-release-manager/src/features/CreateRc/hooks/useCreateRc.test.tsx similarity index 100% rename from plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.test.tsx rename to plugins/git-release-manager/src/features/CreateRc/hooks/useCreateRc.test.tsx diff --git a/plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.ts b/plugins/git-release-manager/src/features/CreateRc/hooks/useCreateRc.ts similarity index 100% rename from plugins/github-release-manager/src/features/CreateRc/hooks/useCreateRc.ts rename to plugins/git-release-manager/src/features/CreateRc/hooks/useCreateRc.ts diff --git a/plugins/github-release-manager/src/features/Features.test.tsx b/plugins/git-release-manager/src/features/Features.test.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Features.test.tsx rename to plugins/git-release-manager/src/features/Features.test.tsx diff --git a/plugins/github-release-manager/src/features/Features.tsx b/plugins/git-release-manager/src/features/Features.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Features.tsx rename to plugins/git-release-manager/src/features/Features.tsx diff --git a/plugins/github-release-manager/src/features/Info/Info.test.tsx b/plugins/git-release-manager/src/features/Info/Info.test.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Info/Info.test.tsx rename to plugins/git-release-manager/src/features/Info/Info.test.tsx diff --git a/plugins/github-release-manager/src/features/Info/Info.tsx b/plugins/git-release-manager/src/features/Info/Info.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Info/Info.tsx rename to plugins/git-release-manager/src/features/Info/Info.tsx diff --git a/plugins/github-release-manager/src/features/Info/flow.png b/plugins/git-release-manager/src/features/Info/flow.png similarity index 100% rename from plugins/github-release-manager/src/features/Info/flow.png rename to plugins/git-release-manager/src/features/Info/flow.png diff --git a/plugins/github-release-manager/src/features/Patch/Patch.test.tsx b/plugins/git-release-manager/src/features/Patch/Patch.test.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Patch/Patch.test.tsx rename to plugins/git-release-manager/src/features/Patch/Patch.test.tsx diff --git a/plugins/github-release-manager/src/features/Patch/Patch.tsx b/plugins/git-release-manager/src/features/Patch/Patch.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Patch/Patch.tsx rename to plugins/git-release-manager/src/features/Patch/Patch.tsx diff --git a/plugins/github-release-manager/src/features/Patch/PatchBody.test.tsx b/plugins/git-release-manager/src/features/Patch/PatchBody.test.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Patch/PatchBody.test.tsx rename to plugins/git-release-manager/src/features/Patch/PatchBody.test.tsx diff --git a/plugins/github-release-manager/src/features/Patch/PatchBody.tsx b/plugins/git-release-manager/src/features/Patch/PatchBody.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Patch/PatchBody.tsx rename to plugins/git-release-manager/src/features/Patch/PatchBody.tsx diff --git a/plugins/github-release-manager/src/features/Patch/hooks/usePatch.test.ts b/plugins/git-release-manager/src/features/Patch/hooks/usePatch.test.ts similarity index 100% rename from plugins/github-release-manager/src/features/Patch/hooks/usePatch.test.ts rename to plugins/git-release-manager/src/features/Patch/hooks/usePatch.test.ts diff --git a/plugins/github-release-manager/src/features/Patch/hooks/usePatch.ts b/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts similarity index 100% rename from plugins/github-release-manager/src/features/Patch/hooks/usePatch.ts rename to plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts diff --git a/plugins/github-release-manager/src/features/PromoteRc/PromoteRc.test.tsx b/plugins/git-release-manager/src/features/PromoteRc/PromoteRc.test.tsx similarity index 100% rename from plugins/github-release-manager/src/features/PromoteRc/PromoteRc.test.tsx rename to plugins/git-release-manager/src/features/PromoteRc/PromoteRc.test.tsx diff --git a/plugins/github-release-manager/src/features/PromoteRc/PromoteRc.tsx b/plugins/git-release-manager/src/features/PromoteRc/PromoteRc.tsx similarity index 100% rename from plugins/github-release-manager/src/features/PromoteRc/PromoteRc.tsx rename to plugins/git-release-manager/src/features/PromoteRc/PromoteRc.tsx diff --git a/plugins/github-release-manager/src/features/PromoteRc/PromoteRcBody.test.tsx b/plugins/git-release-manager/src/features/PromoteRc/PromoteRcBody.test.tsx similarity index 100% rename from plugins/github-release-manager/src/features/PromoteRc/PromoteRcBody.test.tsx rename to plugins/git-release-manager/src/features/PromoteRc/PromoteRcBody.test.tsx diff --git a/plugins/github-release-manager/src/features/PromoteRc/PromoteRcBody.tsx b/plugins/git-release-manager/src/features/PromoteRc/PromoteRcBody.tsx similarity index 100% rename from plugins/github-release-manager/src/features/PromoteRc/PromoteRcBody.tsx rename to plugins/git-release-manager/src/features/PromoteRc/PromoteRcBody.tsx diff --git a/plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.test.ts b/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.test.ts similarity index 100% rename from plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.test.ts rename to plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.test.ts diff --git a/plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts b/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts similarity index 100% rename from plugins/github-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts rename to plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts diff --git a/plugins/github-release-manager/src/features/RepoDetailsForm/Owner.test.tsx b/plugins/git-release-manager/src/features/RepoDetailsForm/Owner.test.tsx similarity index 100% rename from plugins/github-release-manager/src/features/RepoDetailsForm/Owner.test.tsx rename to plugins/git-release-manager/src/features/RepoDetailsForm/Owner.test.tsx diff --git a/plugins/github-release-manager/src/features/RepoDetailsForm/Owner.tsx b/plugins/git-release-manager/src/features/RepoDetailsForm/Owner.tsx similarity index 100% rename from plugins/github-release-manager/src/features/RepoDetailsForm/Owner.tsx rename to plugins/git-release-manager/src/features/RepoDetailsForm/Owner.tsx diff --git a/plugins/github-release-manager/src/features/RepoDetailsForm/Repo.test.tsx b/plugins/git-release-manager/src/features/RepoDetailsForm/Repo.test.tsx similarity index 100% rename from plugins/github-release-manager/src/features/RepoDetailsForm/Repo.test.tsx rename to plugins/git-release-manager/src/features/RepoDetailsForm/Repo.test.tsx diff --git a/plugins/github-release-manager/src/features/RepoDetailsForm/Repo.tsx b/plugins/git-release-manager/src/features/RepoDetailsForm/Repo.tsx similarity index 100% rename from plugins/github-release-manager/src/features/RepoDetailsForm/Repo.tsx rename to plugins/git-release-manager/src/features/RepoDetailsForm/Repo.tsx diff --git a/plugins/github-release-manager/src/features/RepoDetailsForm/RepoDetailsForm.tsx b/plugins/git-release-manager/src/features/RepoDetailsForm/RepoDetailsForm.tsx similarity index 100% rename from plugins/github-release-manager/src/features/RepoDetailsForm/RepoDetailsForm.tsx rename to plugins/git-release-manager/src/features/RepoDetailsForm/RepoDetailsForm.tsx diff --git a/plugins/github-release-manager/src/features/RepoDetailsForm/VersioningStrategy.test.tsx b/plugins/git-release-manager/src/features/RepoDetailsForm/VersioningStrategy.test.tsx similarity index 100% rename from plugins/github-release-manager/src/features/RepoDetailsForm/VersioningStrategy.test.tsx rename to plugins/git-release-manager/src/features/RepoDetailsForm/VersioningStrategy.test.tsx diff --git a/plugins/github-release-manager/src/features/RepoDetailsForm/VersioningStrategy.tsx b/plugins/git-release-manager/src/features/RepoDetailsForm/VersioningStrategy.tsx similarity index 100% rename from plugins/github-release-manager/src/features/RepoDetailsForm/VersioningStrategy.tsx rename to plugins/git-release-manager/src/features/RepoDetailsForm/VersioningStrategy.tsx diff --git a/plugins/github-release-manager/src/features/RepoDetailsForm/styles.ts b/plugins/git-release-manager/src/features/RepoDetailsForm/styles.ts similarity index 100% rename from plugins/github-release-manager/src/features/RepoDetailsForm/styles.ts rename to plugins/git-release-manager/src/features/RepoDetailsForm/styles.ts diff --git a/plugins/github-release-manager/src/features/Stats/DialogBody.tsx b/plugins/git-release-manager/src/features/Stats/DialogBody.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/DialogBody.tsx rename to plugins/git-release-manager/src/features/Stats/DialogBody.tsx diff --git a/plugins/github-release-manager/src/features/Stats/DialogTitle.tsx b/plugins/git-release-manager/src/features/Stats/DialogTitle.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/DialogTitle.tsx rename to plugins/git-release-manager/src/features/Stats/DialogTitle.tsx diff --git a/plugins/github-release-manager/src/features/Stats/Info/InDepth/AverageReleaseTime.tsx b/plugins/git-release-manager/src/features/Stats/Info/InDepth/AverageReleaseTime.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/Info/InDepth/AverageReleaseTime.tsx rename to plugins/git-release-manager/src/features/Stats/Info/InDepth/AverageReleaseTime.tsx diff --git a/plugins/github-release-manager/src/features/Stats/Info/InDepth/InDepth.tsx b/plugins/git-release-manager/src/features/Stats/Info/InDepth/InDepth.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/Info/InDepth/InDepth.tsx rename to plugins/git-release-manager/src/features/Stats/Info/InDepth/InDepth.tsx diff --git a/plugins/github-release-manager/src/features/Stats/Info/InDepth/LongestReleaseTime.tsx b/plugins/git-release-manager/src/features/Stats/Info/InDepth/LongestReleaseTime.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/Info/InDepth/LongestReleaseTime.tsx rename to plugins/git-release-manager/src/features/Stats/Info/InDepth/LongestReleaseTime.tsx diff --git a/plugins/github-release-manager/src/features/Stats/Info/Info.tsx b/plugins/git-release-manager/src/features/Stats/Info/Info.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/Info/Info.tsx rename to plugins/git-release-manager/src/features/Stats/Info/Info.tsx diff --git a/plugins/github-release-manager/src/features/Stats/Info/Summary.tsx b/plugins/git-release-manager/src/features/Stats/Info/Summary.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/Info/Summary.tsx rename to plugins/git-release-manager/src/features/Stats/Info/Summary.tsx diff --git a/plugins/github-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.test.tsx b/plugins/git-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.test.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.test.tsx rename to plugins/git-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.test.tsx diff --git a/plugins/github-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.tsx b/plugins/git-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.tsx rename to plugins/git-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.tsx diff --git a/plugins/github-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx b/plugins/git-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx rename to plugins/git-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx diff --git a/plugins/github-release-manager/src/features/Stats/Row/Row.tsx b/plugins/git-release-manager/src/features/Stats/Row/Row.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/Row/Row.tsx rename to plugins/git-release-manager/src/features/Stats/Row/Row.tsx diff --git a/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTagList.tsx b/plugins/git-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTagList.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTagList.tsx rename to plugins/git-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTagList.tsx diff --git a/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx b/plugins/git-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx rename to plugins/git-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx diff --git a/plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/RowCollapsed.tsx b/plugins/git-release-manager/src/features/Stats/Row/RowCollapsed/RowCollapsed.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/Row/RowCollapsed/RowCollapsed.tsx rename to plugins/git-release-manager/src/features/Stats/Row/RowCollapsed/RowCollapsed.tsx diff --git a/plugins/github-release-manager/src/features/Stats/Stats.tsx b/plugins/git-release-manager/src/features/Stats/Stats.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/Stats.tsx rename to plugins/git-release-manager/src/features/Stats/Stats.tsx diff --git a/plugins/github-release-manager/src/features/Stats/Warn.tsx b/plugins/git-release-manager/src/features/Stats/Warn.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/Warn.tsx rename to plugins/git-release-manager/src/features/Stats/Warn.tsx diff --git a/plugins/github-release-manager/src/features/Stats/contexts/ReleaseStatsContext.tsx b/plugins/git-release-manager/src/features/Stats/contexts/ReleaseStatsContext.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/contexts/ReleaseStatsContext.tsx rename to plugins/git-release-manager/src/features/Stats/contexts/ReleaseStatsContext.tsx diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getDecimalNumber.test.tsx b/plugins/git-release-manager/src/features/Stats/helpers/getDecimalNumber.test.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/helpers/getDecimalNumber.test.tsx rename to plugins/git-release-manager/src/features/Stats/helpers/getDecimalNumber.test.tsx diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getDecimalNumber.tsx b/plugins/git-release-manager/src/features/Stats/helpers/getDecimalNumber.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/helpers/getDecimalNumber.tsx rename to plugins/git-release-manager/src/features/Stats/helpers/getDecimalNumber.tsx diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getMappedReleases.test.tsx b/plugins/git-release-manager/src/features/Stats/helpers/getMappedReleases.test.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/helpers/getMappedReleases.test.tsx rename to plugins/git-release-manager/src/features/Stats/helpers/getMappedReleases.test.tsx diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getMappedReleases.tsx b/plugins/git-release-manager/src/features/Stats/helpers/getMappedReleases.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/helpers/getMappedReleases.tsx rename to plugins/git-release-manager/src/features/Stats/helpers/getMappedReleases.tsx diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getReleaseStats.test.tsx b/plugins/git-release-manager/src/features/Stats/helpers/getReleaseStats.test.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/helpers/getReleaseStats.test.tsx rename to plugins/git-release-manager/src/features/Stats/helpers/getReleaseStats.test.tsx diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getReleaseStats.tsx b/plugins/git-release-manager/src/features/Stats/helpers/getReleaseStats.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/helpers/getReleaseStats.tsx rename to plugins/git-release-manager/src/features/Stats/helpers/getReleaseStats.tsx diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getSummary.test.tsx b/plugins/git-release-manager/src/features/Stats/helpers/getSummary.test.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/helpers/getSummary.test.tsx rename to plugins/git-release-manager/src/features/Stats/helpers/getSummary.test.tsx diff --git a/plugins/github-release-manager/src/features/Stats/helpers/getSummary.tsx b/plugins/git-release-manager/src/features/Stats/helpers/getSummary.tsx similarity index 100% rename from plugins/github-release-manager/src/features/Stats/helpers/getSummary.tsx rename to plugins/git-release-manager/src/features/Stats/helpers/getSummary.tsx diff --git a/plugins/github-release-manager/src/features/Stats/hooks/useGetCommit.ts b/plugins/git-release-manager/src/features/Stats/hooks/useGetCommit.ts similarity index 100% rename from plugins/github-release-manager/src/features/Stats/hooks/useGetCommit.ts rename to plugins/git-release-manager/src/features/Stats/hooks/useGetCommit.ts diff --git a/plugins/github-release-manager/src/features/Stats/hooks/useGetStats.ts b/plugins/git-release-manager/src/features/Stats/hooks/useGetStats.ts similarity index 100% rename from plugins/github-release-manager/src/features/Stats/hooks/useGetStats.ts rename to plugins/git-release-manager/src/features/Stats/hooks/useGetStats.ts diff --git a/plugins/github-release-manager/src/helpers/createResponseStepError.test.ts b/plugins/git-release-manager/src/helpers/createResponseStepError.test.ts similarity index 100% rename from plugins/github-release-manager/src/helpers/createResponseStepError.test.ts rename to plugins/git-release-manager/src/helpers/createResponseStepError.test.ts diff --git a/plugins/github-release-manager/src/helpers/createResponseStepError.ts b/plugins/git-release-manager/src/helpers/createResponseStepError.ts similarity index 100% rename from plugins/github-release-manager/src/helpers/createResponseStepError.ts rename to plugins/git-release-manager/src/helpers/createResponseStepError.ts diff --git a/plugins/github-release-manager/src/helpers/getBumpedTag.test.ts b/plugins/git-release-manager/src/helpers/getBumpedTag.test.ts similarity index 100% rename from plugins/github-release-manager/src/helpers/getBumpedTag.test.ts rename to plugins/git-release-manager/src/helpers/getBumpedTag.test.ts diff --git a/plugins/github-release-manager/src/helpers/getBumpedTag.ts b/plugins/git-release-manager/src/helpers/getBumpedTag.ts similarity index 100% rename from plugins/github-release-manager/src/helpers/getBumpedTag.ts rename to plugins/git-release-manager/src/helpers/getBumpedTag.ts diff --git a/plugins/github-release-manager/src/helpers/getRcGitHubInfo.test.ts b/plugins/git-release-manager/src/helpers/getRcGitHubInfo.test.ts similarity index 100% rename from plugins/github-release-manager/src/helpers/getRcGitHubInfo.test.ts rename to plugins/git-release-manager/src/helpers/getRcGitHubInfo.test.ts diff --git a/plugins/github-release-manager/src/helpers/getRcGitHubInfo.ts b/plugins/git-release-manager/src/helpers/getRcGitHubInfo.ts similarity index 100% rename from plugins/github-release-manager/src/helpers/getRcGitHubInfo.ts rename to plugins/git-release-manager/src/helpers/getRcGitHubInfo.ts diff --git a/plugins/github-release-manager/src/helpers/getShortCommitHash.test.ts b/plugins/git-release-manager/src/helpers/getShortCommitHash.test.ts similarity index 100% rename from plugins/github-release-manager/src/helpers/getShortCommitHash.test.ts rename to plugins/git-release-manager/src/helpers/getShortCommitHash.test.ts diff --git a/plugins/github-release-manager/src/helpers/getShortCommitHash.ts b/plugins/git-release-manager/src/helpers/getShortCommitHash.ts similarity index 100% rename from plugins/github-release-manager/src/helpers/getShortCommitHash.ts rename to plugins/git-release-manager/src/helpers/getShortCommitHash.ts diff --git a/plugins/github-release-manager/src/helpers/isCalverTagParts.test.ts b/plugins/git-release-manager/src/helpers/isCalverTagParts.test.ts similarity index 100% rename from plugins/github-release-manager/src/helpers/isCalverTagParts.test.ts rename to plugins/git-release-manager/src/helpers/isCalverTagParts.test.ts diff --git a/plugins/github-release-manager/src/helpers/isCalverTagParts.ts b/plugins/git-release-manager/src/helpers/isCalverTagParts.ts similarity index 100% rename from plugins/github-release-manager/src/helpers/isCalverTagParts.ts rename to plugins/git-release-manager/src/helpers/isCalverTagParts.ts diff --git a/plugins/github-release-manager/src/helpers/isProjectValid.test.ts b/plugins/git-release-manager/src/helpers/isProjectValid.test.ts similarity index 100% rename from plugins/github-release-manager/src/helpers/isProjectValid.test.ts rename to plugins/git-release-manager/src/helpers/isProjectValid.test.ts diff --git a/plugins/github-release-manager/src/helpers/isProjectValid.ts b/plugins/git-release-manager/src/helpers/isProjectValid.ts similarity index 100% rename from plugins/github-release-manager/src/helpers/isProjectValid.ts rename to plugins/git-release-manager/src/helpers/isProjectValid.ts diff --git a/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.test.ts b/plugins/git-release-manager/src/helpers/tagParts/getCalverTagParts.test.ts similarity index 100% rename from plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.test.ts rename to plugins/git-release-manager/src/helpers/tagParts/getCalverTagParts.test.ts diff --git a/plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.ts b/plugins/git-release-manager/src/helpers/tagParts/getCalverTagParts.ts similarity index 100% rename from plugins/github-release-manager/src/helpers/tagParts/getCalverTagParts.ts rename to plugins/git-release-manager/src/helpers/tagParts/getCalverTagParts.ts diff --git a/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.test.ts b/plugins/git-release-manager/src/helpers/tagParts/getSemverTagParts.test.ts similarity index 100% rename from plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.test.ts rename to plugins/git-release-manager/src/helpers/tagParts/getSemverTagParts.test.ts diff --git a/plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.ts b/plugins/git-release-manager/src/helpers/tagParts/getSemverTagParts.ts similarity index 100% rename from plugins/github-release-manager/src/helpers/tagParts/getSemverTagParts.ts rename to plugins/git-release-manager/src/helpers/tagParts/getSemverTagParts.ts diff --git a/plugins/github-release-manager/src/helpers/tagParts/getTagParts.test.ts b/plugins/git-release-manager/src/helpers/tagParts/getTagParts.test.ts similarity index 100% rename from plugins/github-release-manager/src/helpers/tagParts/getTagParts.test.ts rename to plugins/git-release-manager/src/helpers/tagParts/getTagParts.test.ts diff --git a/plugins/github-release-manager/src/helpers/tagParts/getTagParts.ts b/plugins/git-release-manager/src/helpers/tagParts/getTagParts.ts similarity index 100% rename from plugins/github-release-manager/src/helpers/tagParts/getTagParts.ts rename to plugins/git-release-manager/src/helpers/tagParts/getTagParts.ts diff --git a/plugins/github-release-manager/src/helpers/tagParts/validateTagName.ts b/plugins/git-release-manager/src/helpers/tagParts/validateTagName.ts similarity index 100% rename from plugins/github-release-manager/src/helpers/tagParts/validateTagName.ts rename to plugins/git-release-manager/src/helpers/tagParts/validateTagName.ts diff --git a/plugins/github-release-manager/src/helpers/tagParts/validateTagParts.test.ts b/plugins/git-release-manager/src/helpers/tagParts/validateTagParts.test.ts similarity index 100% rename from plugins/github-release-manager/src/helpers/tagParts/validateTagParts.test.ts rename to plugins/git-release-manager/src/helpers/tagParts/validateTagParts.test.ts diff --git a/plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.test.ts b/plugins/git-release-manager/src/hooks/useGetGitHubBatchInfo.test.ts similarity index 100% rename from plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.test.ts rename to plugins/git-release-manager/src/hooks/useGetGitHubBatchInfo.test.ts diff --git a/plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.ts b/plugins/git-release-manager/src/hooks/useGetGitHubBatchInfo.ts similarity index 100% rename from plugins/github-release-manager/src/hooks/useGetGitHubBatchInfo.ts rename to plugins/git-release-manager/src/hooks/useGetGitHubBatchInfo.ts diff --git a/plugins/github-release-manager/src/hooks/useQueryHandler.test.tsx b/plugins/git-release-manager/src/hooks/useQueryHandler.test.tsx similarity index 100% rename from plugins/github-release-manager/src/hooks/useQueryHandler.test.tsx rename to plugins/git-release-manager/src/hooks/useQueryHandler.test.tsx diff --git a/plugins/github-release-manager/src/hooks/useQueryHandler.ts b/plugins/git-release-manager/src/hooks/useQueryHandler.ts similarity index 100% rename from plugins/github-release-manager/src/hooks/useQueryHandler.ts rename to plugins/git-release-manager/src/hooks/useQueryHandler.ts diff --git a/plugins/github-release-manager/src/hooks/useResponseSteps.test.ts b/plugins/git-release-manager/src/hooks/useResponseSteps.test.ts similarity index 100% rename from plugins/github-release-manager/src/hooks/useResponseSteps.test.ts rename to plugins/git-release-manager/src/hooks/useResponseSteps.test.ts diff --git a/plugins/github-release-manager/src/hooks/useResponseSteps.ts b/plugins/git-release-manager/src/hooks/useResponseSteps.ts similarity index 100% rename from plugins/github-release-manager/src/hooks/useResponseSteps.ts rename to plugins/git-release-manager/src/hooks/useResponseSteps.ts diff --git a/plugins/github-release-manager/src/hooks/useVersioningStrategyMatchesRepoTags.test.tsx b/plugins/git-release-manager/src/hooks/useVersioningStrategyMatchesRepoTags.test.tsx similarity index 100% rename from plugins/github-release-manager/src/hooks/useVersioningStrategyMatchesRepoTags.test.tsx rename to plugins/git-release-manager/src/hooks/useVersioningStrategyMatchesRepoTags.test.tsx diff --git a/plugins/github-release-manager/src/hooks/useVersioningStrategyMatchesRepoTags.ts b/plugins/git-release-manager/src/hooks/useVersioningStrategyMatchesRepoTags.ts similarity index 100% rename from plugins/github-release-manager/src/hooks/useVersioningStrategyMatchesRepoTags.ts rename to plugins/git-release-manager/src/hooks/useVersioningStrategyMatchesRepoTags.ts diff --git a/plugins/github-release-manager/src/index.ts b/plugins/git-release-manager/src/index.ts similarity index 100% rename from plugins/github-release-manager/src/index.ts rename to plugins/git-release-manager/src/index.ts diff --git a/plugins/github-release-manager/src/plugin.test.ts b/plugins/git-release-manager/src/plugin.test.ts similarity index 95% rename from plugins/github-release-manager/src/plugin.test.ts rename to plugins/git-release-manager/src/plugin.test.ts index 60ab101d11..5f30848771 100644 --- a/plugins/github-release-manager/src/plugin.test.ts +++ b/plugins/git-release-manager/src/plugin.test.ts @@ -16,7 +16,7 @@ import * as plugin from './plugin'; -describe('github-release-manager', () => { +describe('git-release-manager', () => { it('should export plugin & friends', () => { expect(Object.keys(plugin)).toMatchInlineSnapshot(` Array [ diff --git a/plugins/github-release-manager/src/plugin.ts b/plugins/git-release-manager/src/plugin.ts similarity index 98% rename from plugins/github-release-manager/src/plugin.ts rename to plugins/git-release-manager/src/plugin.ts index 9c01c1e959..507d1044aa 100644 --- a/plugins/github-release-manager/src/plugin.ts +++ b/plugins/git-release-manager/src/plugin.ts @@ -29,7 +29,7 @@ import { rootRouteRef } from './routes'; export { githubReleaseManagerApiRef }; export const gitHubReleaseManagerPlugin = createPlugin({ - id: 'github-release-manager', + id: 'git-release-manager', routes: { root: rootRouteRef, }, diff --git a/plugins/github-release-manager/src/routes.ts b/plugins/git-release-manager/src/routes.ts similarity index 95% rename from plugins/github-release-manager/src/routes.ts rename to plugins/git-release-manager/src/routes.ts index 9406a4c6a7..3b3ea80cc2 100644 --- a/plugins/github-release-manager/src/routes.ts +++ b/plugins/git-release-manager/src/routes.ts @@ -17,5 +17,5 @@ import { createRouteRef } from '@backstage/core'; export const rootRouteRef = createRouteRef({ - title: 'github-release-manager', + title: 'git-release-manager', }); diff --git a/plugins/github-release-manager/src/setupTests.ts b/plugins/git-release-manager/src/setupTests.ts similarity index 100% rename from plugins/github-release-manager/src/setupTests.ts rename to plugins/git-release-manager/src/setupTests.ts diff --git a/plugins/github-release-manager/src/styles/styles.ts b/plugins/git-release-manager/src/styles/styles.ts similarity index 100% rename from plugins/github-release-manager/src/styles/styles.ts rename to plugins/git-release-manager/src/styles/styles.ts diff --git a/plugins/github-release-manager/src/test-helpers/stats.ts b/plugins/git-release-manager/src/test-helpers/stats.ts similarity index 100% rename from plugins/github-release-manager/src/test-helpers/stats.ts rename to plugins/git-release-manager/src/test-helpers/stats.ts diff --git a/plugins/github-release-manager/src/test-helpers/test-helpers.ts b/plugins/git-release-manager/src/test-helpers/test-helpers.ts similarity index 100% rename from plugins/github-release-manager/src/test-helpers/test-helpers.ts rename to plugins/git-release-manager/src/test-helpers/test-helpers.ts diff --git a/plugins/github-release-manager/src/test-helpers/test-ids.ts b/plugins/git-release-manager/src/test-helpers/test-ids.ts similarity index 100% rename from plugins/github-release-manager/src/test-helpers/test-ids.ts rename to plugins/git-release-manager/src/test-helpers/test-ids.ts diff --git a/plugins/github-release-manager/src/types/types.ts b/plugins/git-release-manager/src/types/types.ts similarity index 100% rename from plugins/github-release-manager/src/types/types.ts rename to plugins/git-release-manager/src/types/types.ts From a99e0bc42c08d81a5a01794baca372f726082860 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Thu, 29 Apr 2021 11:38:21 +0200 Subject: [PATCH 201/485] [Search] Improvements to DefaultCatalogCollator (#5491) * Add owner/lifecycle to default catalog document and allow location to be configured by integrators. Signed-off-by: Eric Peterson * Test the DefaultCatalogCollator Signed-off-by: Eric Peterson * Changeset. Signed-off-by: Eric Peterson --- .changeset/search-moar-catalog-yo.md | 5 + packages/backend/src/plugins/search.ts | 2 +- .../src/search/DefaultCatalogCollator.test.ts | 91 +++++++++++++++++++ .../src/search/DefaultCatalogCollator.ts | 37 ++++++-- 4 files changed, 128 insertions(+), 7 deletions(-) create mode 100644 .changeset/search-moar-catalog-yo.md create mode 100644 plugins/catalog-backend/src/search/DefaultCatalogCollator.test.ts diff --git a/.changeset/search-moar-catalog-yo.md b/.changeset/search-moar-catalog-yo.md new file mode 100644 index 0000000000..4e665157e1 --- /dev/null +++ b/.changeset/search-moar-catalog-yo.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend': patch +--- + +Entity lifecycle and owner are now indexed by the `DefaultCatalogCollator`. A `locationTemplate` may now optionally be provided to its constructor to reflect a custom catalog entity path in the Backstage frontend. diff --git a/packages/backend/src/plugins/search.ts b/packages/backend/src/plugins/search.ts index dcd48aaf40..1691f53485 100644 --- a/packages/backend/src/plugins/search.ts +++ b/packages/backend/src/plugins/search.ts @@ -32,7 +32,7 @@ export default async function createPlugin({ indexBuilder.addCollator({ type: 'software-catalog', defaultRefreshIntervalSeconds: 600, - collator: new DefaultCatalogCollator(discovery), + collator: new DefaultCatalogCollator({ discovery }), }); const { scheduler } = await indexBuilder.build(); diff --git a/plugins/catalog-backend/src/search/DefaultCatalogCollator.test.ts b/plugins/catalog-backend/src/search/DefaultCatalogCollator.test.ts new file mode 100644 index 0000000000..0764912f0f --- /dev/null +++ b/plugins/catalog-backend/src/search/DefaultCatalogCollator.test.ts @@ -0,0 +1,91 @@ +/* + * 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 { PluginEndpointDiscovery } from '@backstage/backend-common'; +import { Entity } from '@backstage/catalog-model'; +import { DefaultCatalogCollator } from './DefaultCatalogCollator'; + +const expectedEntities: Entity[] = [ + { + apiVersion: 'backstage.io/v1alpha1', + kind: 'Component', + metadata: { + name: 'test-entity', + description: 'The expected description', + }, + spec: { + type: 'some-type', + lifecycle: 'experimental', + owner: 'someone', + }, + }, +]; + +jest.mock('cross-fetch', () => ({ + __esModule: true, + default: async () => { + return { + json: async () => { + return expectedEntities; + }, + }; + }, +})); + +describe('DefaultCatalogCollator', () => { + let mockDiscoveryApi: jest.Mocked; + let collator: DefaultCatalogCollator; + + beforeEach(() => { + mockDiscoveryApi = { + getBaseUrl: jest.fn().mockResolvedValueOnce('http://localhost:7000'), + getExternalBaseUrl: jest.fn(), + }; + collator = new DefaultCatalogCollator({ discovery: mockDiscoveryApi }); + }); + + it('fetches from the configured catalog service', async () => { + const documents = await collator.execute(); + expect(mockDiscoveryApi.getBaseUrl).toHaveBeenCalledWith('catalog'); + expect(documents).toHaveLength(expectedEntities.length); + }); + + it('maps a returned entity to an expected CatalogEntityDocument', async () => { + const documents = await collator.execute(); + expect(documents[0]).toMatchObject({ + title: expectedEntities[0].metadata.name, + location: '/catalog/default/component/test-entity', + text: expectedEntities[0].metadata.description, + namespace: 'default', + componentType: expectedEntities[0]!.spec!.type, + lifecycle: expectedEntities[0]!.spec!.lifecycle, + owner: expectedEntities[0]!.spec!.owner, + }); + }); + + it('maps a returned entity with a custom locationTemplate', async () => { + // Provide an alternate location template. + collator = new DefaultCatalogCollator({ + discovery: mockDiscoveryApi, + locationTemplate: '/software/:name', + }); + + const documents = await collator.execute(); + expect(documents[0]).toMatchObject({ + location: '/software/test-entity', + }); + }); +}); diff --git a/plugins/catalog-backend/src/search/DefaultCatalogCollator.ts b/plugins/catalog-backend/src/search/DefaultCatalogCollator.ts index 72bf43f8f9..068b9e36ae 100644 --- a/plugins/catalog-backend/src/search/DefaultCatalogCollator.ts +++ b/plugins/catalog-backend/src/search/DefaultCatalogCollator.ts @@ -23,13 +23,35 @@ export interface CatalogEntityDocument extends IndexableDocument { componentType: string; namespace: string; kind: string; + lifecycle: string; + owner: string; } export class DefaultCatalogCollator implements DocumentCollator { protected discovery: PluginEndpointDiscovery; + protected locationTemplate: string; - constructor(discovery: PluginEndpointDiscovery) { + constructor({ + discovery, + locationTemplate, + }: { + discovery: PluginEndpointDiscovery; + locationTemplate?: string; + }) { this.discovery = discovery; + this.locationTemplate = + locationTemplate || '/catalog/:namespace/:kind/:name'; + } + + protected applyArgsToFormat( + format: string, + args: Record, + ): string { + let formatted = format; + for (const [key, value] of Object.entries(args)) { + formatted = formatted.replace(`:${key}`, value); + } + return formatted.toLowerCase(); } async execute() { @@ -37,17 +59,20 @@ export class DefaultCatalogCollator implements DocumentCollator { const res = await fetch(`${baseUrl}/entities`); const entities: Entity[] = await res.json(); return entities.map( - (entity): CatalogEntityDocument => { + (entity: Entity): CatalogEntityDocument => { return { title: entity.metadata.name, - // TODO: Use a config-based template approach for entity location. - location: `/catalog/${ - entity.metadata.namespace || 'default' - }/component/${entity.metadata.name}`, + location: this.applyArgsToFormat(this.locationTemplate, { + namespace: entity.metadata.namespace || 'default', + kind: entity.kind, + name: entity.metadata.name, + }), text: entity.metadata.description || '', componentType: entity.spec?.type?.toString() || 'other', namespace: entity.metadata.namespace || 'default', kind: entity.kind, + lifecycle: (entity.spec?.lifecycle as string) || '', + owner: (entity.spec?.owner as string) || '', }; }, ); From 85409a343ea196ad2814b52fba160f3bccf9d968 Mon Sep 17 00:00:00 2001 From: David Tuite Date: Thu, 29 Apr 2021 10:35:29 +0100 Subject: [PATCH 202/485] Mention error handling on GitHub discovery docs Signed-off-by: David Tuite --- docs/integrations/github/discovery.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/integrations/github/discovery.md b/docs/integrations/github/discovery.md index a578d0893d..3e776c8088 100644 --- a/docs/integrations/github/discovery.md +++ b/docs/integrations/github/discovery.md @@ -52,3 +52,13 @@ Backstage to use the [github-apps plugin](../../plugins/github-apps.md). This is true for any method of adding GitHub entities to the catalog, but especially easy to hit with automatic discovery. + +## Error handling + +Syntax errors or other types of errors present in `catalog-info.yaml` files will +be logged for investigation and the importer will continue. Errors do not cause +the process to fail. + +When multiple `catalog-info.yaml` files with the same `metadata.name` property +are discovered, one will be skipped and the process will continue. This action +will be logged for later investication. From 66918b71fb3a92f85cd39b51d8856602164058a5 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 29 Apr 2021 11:41:14 +0200 Subject: [PATCH 203/485] Update snapshot Signed-off-by: Erik Engervall --- plugins/git-release-manager/src/api/serviceApiRef.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git-release-manager/src/api/serviceApiRef.test.ts b/plugins/git-release-manager/src/api/serviceApiRef.test.ts index 4e8c204c6b..28a876be49 100644 --- a/plugins/git-release-manager/src/api/serviceApiRef.test.ts +++ b/plugins/git-release-manager/src/api/serviceApiRef.test.ts @@ -23,7 +23,7 @@ describe('githubReleaseManagerApiRef', () => { expect(result).toMatchInlineSnapshot(` ApiRefImpl { "config": Object { - "description": "Used by the GitHub Release Manager plugin to make requests", + "description": "Used by the Git Release Manager plugin to make requests", "id": "plugin.git-release-manager.service", }, } From ce563d118be2535e7a080252427e1da92af3a000 Mon Sep 17 00:00:00 2001 From: David Tuite Date: Thu, 29 Apr 2021 10:48:04 +0100 Subject: [PATCH 204/485] Fix spelling error Signed-off-by: David Tuite --- docs/integrations/github/discovery.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/integrations/github/discovery.md b/docs/integrations/github/discovery.md index 3e776c8088..8d2ca8fb32 100644 --- a/docs/integrations/github/discovery.md +++ b/docs/integrations/github/discovery.md @@ -61,4 +61,4 @@ the process to fail. When multiple `catalog-info.yaml` files with the same `metadata.name` property are discovered, one will be skipped and the process will continue. This action -will be logged for later investication. +will be logged for later investigation. From 19e6ebc1f20c5580fcaee760712114c56deb8fa6 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 29 Apr 2021 12:02:05 +0200 Subject: [PATCH 205/485] Continue renaming code from GitHub to Git Signed-off-by: Erik Engervall --- plugins/git-release-manager/README.md | 18 +++--- plugins/git-release-manager/dev/index.tsx | 13 ++--- ...leaseManager.tsx => GitReleaseManager.tsx} | 10 ++-- .../src/api/PluginApiClient.test.ts | 9 ++- .../src/api/PluginApiClient.ts | 10 ++-- .../src/api/serviceApiRef.test.ts | 6 +- .../src/api/serviceApiRef.ts | 4 +- .../src/components/Differ.tsx | 4 +- .../src/contexts/ProjectContext.ts | 4 +- .../src/contexts/RefetchContext.ts | 4 +- ...agerError.ts => GitReleaseManagerError.ts} | 4 +- .../CreateReleaseCandidate.test.tsx} | 22 +++---- .../CreateReleaseCandidate.tsx} | 45 +++++++------- .../hooks/useCreateReleaseCandidate.test.tsx} | 14 ++--- .../hooks/useCreateReleaseCandidate.ts} | 44 +++++++------- .../src/features/Features.test.tsx | 13 ++--- .../src/features/Features.tsx | 58 +++++++++---------- .../src/features/Info/Info.tsx | 17 +++--- .../src/features/Patch/PatchBody.tsx | 26 ++++----- .../src/features/Patch/hooks/usePatch.ts | 4 +- .../src/features/PromoteRc/PromoteRc.tsx | 4 +- .../features/PromoteRc/hooks/usePromoteRc.ts | 4 +- .../src/features/RepoDetailsForm/Owner.tsx | 4 +- .../src/features/RepoDetailsForm/Repo.tsx | 4 +- .../Stats/Info/hooks/useGetReleaseTimes.tsx | 4 +- .../Stats/contexts/ReleaseStatsContext.tsx | 4 +- .../src/features/Stats/hooks/useGetCommit.ts | 8 +-- .../src/features/Stats/hooks/useGetStats.ts | 4 +- ....ts => getReleaseCandidateGitInfo.test.ts} | 10 ++-- ...bInfo.ts => getReleaseCandidateGitInfo.ts} | 2 +- .../src/helpers/getShortCommitHash.ts | 4 +- ...nfo.test.ts => useGetGitBatchInfo.test.ts} | 16 ++--- ...tHubBatchInfo.ts => useGetGitBatchInfo.ts} | 14 ++--- plugins/git-release-manager/src/index.ts | 6 +- .../git-release-manager/src/plugin.test.ts | 6 +- plugins/git-release-manager/src/plugin.ts | 16 ++--- .../src/test-helpers/test-helpers.ts | 14 +++-- .../src/test-helpers/test-ids.ts | 2 +- 38 files changed, 230 insertions(+), 225 deletions(-) rename plugins/git-release-manager/src/{GitHubReleaseManager.tsx => GitReleaseManager.tsx} (90%) rename plugins/git-release-manager/src/errors/{GitHubReleaseManagerError.ts => GitReleaseManagerError.ts} (86%) rename plugins/git-release-manager/src/features/{CreateRc/CreateRc.test.tsx => CreateReleaseCandidate/CreateReleaseCandidate.test.tsx} (78%) rename plugins/git-release-manager/src/features/{CreateRc/CreateRc.tsx => CreateReleaseCandidate/CreateReleaseCandidate.tsx} (79%) rename plugins/git-release-manager/src/features/{CreateRc/hooks/useCreateRc.test.tsx => CreateReleaseCandidate/hooks/useCreateReleaseCandidate.test.tsx} (90%) rename plugins/git-release-manager/src/features/{CreateRc/hooks/useCreateRc.ts => CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts} (80%) rename plugins/git-release-manager/src/helpers/{getRcGitHubInfo.test.ts => getReleaseCandidateGitInfo.test.ts} (91%) rename plugins/git-release-manager/src/helpers/{getRcGitHubInfo.ts => getReleaseCandidateGitInfo.ts} (97%) rename plugins/git-release-manager/src/hooks/{useGetGitHubBatchInfo.test.ts => useGetGitBatchInfo.test.ts} (85%) rename plugins/git-release-manager/src/hooks/{useGetGitHubBatchInfo.ts => useGetGitBatchInfo.ts} (83%) diff --git a/plugins/git-release-manager/README.md b/plugins/git-release-manager/README.md index 86efc0c069..d9e1703781 100644 --- a/plugins/git-release-manager/README.md +++ b/plugins/git-release-manager/README.md @@ -1,4 +1,4 @@ -# GitHub Release Manager (GRM) +# Git Release Manager (GRM) ## Overview @@ -6,17 +6,17 @@ Does it build and ship your code? **No**. -What `GRM` does is manage your **[releases](https://docs.github.com/en/github/administering-a-repository/managing-releases-in-a-repository)** on GitHub, building and shipping is entirely up to you as a developer to handle in your CI. +What `GRM` does is manage your Git **[releases](https://docs.github.com/en/github/administering-a-repository/managing-releases-in-a-repository)**, building and shipping is entirely up to you as a developer to handle in your CI. `GRM` is built with industry standards in mind and the flow is as follows: ![](./src/features/Info/flow.png) -> **GitHub**: The source control system where releases reside in a practical sense. Read more about [GitHub releases](https://docs.github.com/en/github/administering-a-repository/managing-releases-in-a-repository). (Note that this plugin works just as well with GitHub Enterprise.) +> **Git**: The source control system where releases reside in a practical sense. Read more about [Git releases](https://docs.github.com/en/github/administering-a-repository/managing-releases-in-a-repository). (Note that this plugin works just as well with any system implementing `Git`.) > -> **Release Candidate (RC)**: A GitHub pre-release intended primarily for internal testing +> **Release Candidate (RC)**: A Git pre-release intended primarily for internal testing > -> **Release Version**: A GitHub release intended for end users +> **Release Version**: A Git release intended for end users Looking at the flow above, a common release lifecycle could be: @@ -24,7 +24,7 @@ Looking at the flow above, a common release lifecycle could be: - `GRM` 1. Creates a release branch `rc/` 1. Creates Release Candidate tag `rc-` - 1. Creates a GitHub prerelease with Release Candidate tag + 1. Creates a Git prerelease with Release Candidate tag - Your CI 1. Detects the new tag by matching the git reference `refs/tags/rc-.*` 1. Builds and deploys to staging environment for testing @@ -32,14 +32,14 @@ Looking at the flow above, a common release lifecycle could be: - `GRM` 1. The selected commit is cherry-picked to the release branch 1. The release tag is bumped - 1. Updates GitHub release's tag and description with the patch's details + 1. Updates Git release's tag and description with the patch's details - Your CI 1. Detects the new tag by matching the git reference `refs/tags/(rc|version)-.*` (Release Versions are patchable as well) 1. Builds and deploys to staging (or production if Release Version) for testing - User presses **Promote Release Candidate to Release Version** - `GRM` 1. Creates Release Version tag `version-` - 1. Promotes the GitHub release by removing the prerelease flag + 1. Promotes the Git release by removing the prerelease flag - Your CI 1. Detects the new tag by matching the git reference `refs/tags/version-.*` 1. Builds and deploys to production for testing @@ -48,7 +48,7 @@ Looking at the flow above, a common release lifecycle could be: ### Importing -The plugin exports a single full-page extension `GitHubReleaseManagerPage`, which one can add to an app like a usual top-level tool on a dedicated route. +The plugin exports a single full-page extension `GitReleaseManagerPage`, which one can add to an app like a usual top-level tool on a dedicated route. ### Configuration diff --git a/plugins/git-release-manager/dev/index.tsx b/plugins/git-release-manager/dev/index.tsx index 62eb2a8246..d1d2d6e7d9 100644 --- a/plugins/git-release-manager/dev/index.tsx +++ b/plugins/git-release-manager/dev/index.tsx @@ -18,14 +18,11 @@ import React from 'react'; import { createDevApp } from '@backstage/dev-utils'; import { Box, Typography } from '@material-ui/core'; -import { - gitHubReleaseManagerPlugin, - GitHubReleaseManagerPage, -} from '../src/plugin'; +import { gitReleaseManagerPlugin, GitReleaseManagerPage } from '../src/plugin'; import { InfoCardPlus } from '../src/components/InfoCardPlus'; createDevApp() - .registerPlugin(gitHubReleaseManagerPlugin) + .registerPlugin(gitReleaseManagerPlugin) .addPage({ title: 'Dynamic', path: '/dynamic', @@ -36,7 +33,7 @@ createDevApp() Configure plugin via select inputs - + ), }) @@ -53,7 +50,7 @@ createDevApp() - Success callbacks can also be added - ; features?: { info?: Pick, 'omit'>; @@ -46,8 +46,8 @@ export interface GitHubReleaseManagerProps { }; } -export function GitHubReleaseManager(props: GitHubReleaseManagerProps) { - const pluginApiClient = useApi(githubReleaseManagerApiRef); +export function GitReleaseManager(props: GitReleaseManagerProps) { + const pluginApiClient = useApi(gitReleaseManagerApiRef); const classes = useStyles(); const { getParsedQuery } = useQueryHandler(); @@ -83,7 +83,7 @@ export function GitHubReleaseManager(props: GitHubReleaseManagerProps) { return (
- + diff --git a/plugins/git-release-manager/src/api/PluginApiClient.test.ts b/plugins/git-release-manager/src/api/PluginApiClient.test.ts index d4f86ef9e7..efb0a32ee7 100644 --- a/plugins/git-release-manager/src/api/PluginApiClient.test.ts +++ b/plugins/git-release-manager/src/api/PluginApiClient.test.ts @@ -16,7 +16,7 @@ import { ConfigReader, OAuthApi } from '@backstage/core'; -import { PluginApiClient } from './PluginApiClient'; +import { GitReleaseApiClient } from './PluginApiClient'; describe('PluginApiClient', () => { it('should return the default plugin api client', () => { @@ -24,10 +24,13 @@ describe('PluginApiClient', () => { const githubAuthApi: OAuthApi = { getAccessToken: jest.fn(), }; - const pluginApiClient = new PluginApiClient({ configApi, githubAuthApi }); + const pluginApiClient = new GitReleaseApiClient({ + configApi, + githubAuthApi, + }); expect(pluginApiClient).toMatchInlineSnapshot(` - PluginApiClient { + GitReleaseApiClient { "baseUrl": "https://api.github.com", "createRc": Object { "createRef": [Function], diff --git a/plugins/git-release-manager/src/api/PluginApiClient.ts b/plugins/git-release-manager/src/api/PluginApiClient.ts index 52764c6613..2a0eadcadd 100644 --- a/plugins/git-release-manager/src/api/PluginApiClient.ts +++ b/plugins/git-release-manager/src/api/PluginApiClient.ts @@ -23,7 +23,7 @@ import { DISABLE_CACHE } from '../constants/constants'; import { Project } from '../contexts/ProjectContext'; import { SemverTagParts } from '../helpers/tagParts/getSemverTagParts'; -export class PluginApiClient implements IPluginApiClient { +export class GitReleaseApiClient implements GitReleaseApi { private readonly githubAuthApi: OAuthApi; private readonly baseUrl: string; readonly host: string; @@ -774,7 +774,7 @@ type CreateTempCommit = ( tagParts: SemverTagParts | CalverTagParts; releaseBranchTree: string; selectedPatchCommit: UnboxArray< - UnboxReturnedPromise + UnboxReturnedPromise >; } & OwnerRepo, ) => Promise<{ @@ -812,7 +812,7 @@ type CreateCherryPickCommit = ( args: { bumpedTag: string; selectedPatchCommit: UnboxArray< - UnboxReturnedPromise + UnboxReturnedPromise >; mergeTree: string; releaseBranchSha: string; @@ -827,7 +827,7 @@ type ReplaceTempCommit = ( args: { releaseBranchName: string; cherryPickCommit: UnboxReturnedPromise< - IPluginApiClient['patch']['createCherryPickCommit'] + GitReleaseApi['patch']['createCherryPickCommit'] >; } & OwnerRepo, ) => Promise<{ @@ -924,7 +924,7 @@ type GetCommit = ( }>; export type GetCommitResult = UnboxReturnedPromise; -export interface IPluginApiClient { +export interface GitReleaseApi { getHost: GetHost; getRepoPath: GetRepoPath; getOwners: GetOwners; diff --git a/plugins/git-release-manager/src/api/serviceApiRef.test.ts b/plugins/git-release-manager/src/api/serviceApiRef.test.ts index 28a876be49..8313294683 100644 --- a/plugins/git-release-manager/src/api/serviceApiRef.test.ts +++ b/plugins/git-release-manager/src/api/serviceApiRef.test.ts @@ -14,11 +14,11 @@ * limitations under the License. */ -import { githubReleaseManagerApiRef } from './serviceApiRef'; +import { gitReleaseManagerApiRef } from './serviceApiRef'; -describe('githubReleaseManagerApiRef', () => { +describe('gitReleaseManagerApiRef', () => { it('should work', () => { - const result = githubReleaseManagerApiRef; + const result = gitReleaseManagerApiRef; expect(result).toMatchInlineSnapshot(` ApiRefImpl { diff --git a/plugins/git-release-manager/src/api/serviceApiRef.ts b/plugins/git-release-manager/src/api/serviceApiRef.ts index f44168c476..b2652aac65 100644 --- a/plugins/git-release-manager/src/api/serviceApiRef.ts +++ b/plugins/git-release-manager/src/api/serviceApiRef.ts @@ -16,9 +16,9 @@ import { createApiRef } from '@backstage/core'; -import { IPluginApiClient } from './PluginApiClient'; +import { GitReleaseApi } from './PluginApiClient'; -export const githubReleaseManagerApiRef = createApiRef({ +export const gitReleaseManagerApiRef = createApiRef({ id: 'plugin.git-release-manager.service', description: 'Used by the Git Release Manager plugin to make requests', }); diff --git a/plugins/git-release-manager/src/components/Differ.tsx b/plugins/git-release-manager/src/components/Differ.tsx index d4eda688a6..e5d64cc914 100644 --- a/plugins/git-release-manager/src/components/Differ.tsx +++ b/plugins/git-release-manager/src/components/Differ.tsx @@ -22,7 +22,7 @@ import DynamicFeedIcon from '@material-ui/icons/DynamicFeed'; import GitHubIcon from '@material-ui/icons/GitHub'; import LocalOfferIcon from '@material-ui/icons/LocalOffer'; -import { GitHubReleaseManagerError } from '../errors/GitHubReleaseManagerError'; +import { GitReleaseManagerError } from '../errors/GitReleaseManagerError'; import { TEST_IDS } from '../test-helpers/test-ids'; interface DifferProps { @@ -115,6 +115,6 @@ function Icon({ icon }: IconProps) { ); default: - throw new GitHubReleaseManagerError('Invalid Differ icon'); + throw new GitReleaseManagerError('Invalid Differ icon'); } } diff --git a/plugins/git-release-manager/src/contexts/ProjectContext.ts b/plugins/git-release-manager/src/contexts/ProjectContext.ts index bd8e78c53b..cc13c5ac77 100644 --- a/plugins/git-release-manager/src/contexts/ProjectContext.ts +++ b/plugins/git-release-manager/src/contexts/ProjectContext.ts @@ -17,7 +17,7 @@ import { createContext, useContext } from 'react'; import { VERSIONING_STRATEGIES } from '../constants/constants'; -import { GitHubReleaseManagerError } from '../errors/GitHubReleaseManagerError'; +import { GitReleaseManagerError } from '../errors/GitReleaseManagerError'; export interface Project { /** @@ -57,7 +57,7 @@ export const useProjectContext = () => { const { project } = useContext(ProjectContext) ?? {}; if (!project) { - throw new GitHubReleaseManagerError('project not found'); + throw new GitReleaseManagerError('project not found'); } return { diff --git a/plugins/git-release-manager/src/contexts/RefetchContext.ts b/plugins/git-release-manager/src/contexts/RefetchContext.ts index 344df3d9a5..24867ca7c9 100644 --- a/plugins/git-release-manager/src/contexts/RefetchContext.ts +++ b/plugins/git-release-manager/src/contexts/RefetchContext.ts @@ -16,7 +16,7 @@ import { createContext, useContext } from 'react'; -import { GitHubReleaseManagerError } from '../errors/GitHubReleaseManagerError'; +import { GitReleaseManagerError } from '../errors/GitReleaseManagerError'; export const RefetchContext = createContext< | { @@ -30,7 +30,7 @@ export const useRefetchContext = () => { const refetch = useContext(RefetchContext); if (!refetch) { - throw new GitHubReleaseManagerError('refetch not found'); + throw new GitReleaseManagerError('refetch not found'); } return { diff --git a/plugins/git-release-manager/src/errors/GitHubReleaseManagerError.ts b/plugins/git-release-manager/src/errors/GitReleaseManagerError.ts similarity index 86% rename from plugins/git-release-manager/src/errors/GitHubReleaseManagerError.ts rename to plugins/git-release-manager/src/errors/GitReleaseManagerError.ts index 7806d4baad..3c2b516202 100644 --- a/plugins/git-release-manager/src/errors/GitHubReleaseManagerError.ts +++ b/plugins/git-release-manager/src/errors/GitReleaseManagerError.ts @@ -14,10 +14,10 @@ * limitations under the License. */ -export class GitHubReleaseManagerError extends Error { +export class GitReleaseManagerError extends Error { constructor(message: string) { super(message); - this.name = 'GitHubReleaseManagerError'; + this.name = 'GitReleaseManagerError'; } } diff --git a/plugins/git-release-manager/src/features/CreateRc/CreateRc.test.tsx b/plugins/git-release-manager/src/features/CreateReleaseCandidate/CreateReleaseCandidate.test.tsx similarity index 78% rename from plugins/git-release-manager/src/features/CreateRc/CreateRc.test.tsx rename to plugins/git-release-manager/src/features/CreateReleaseCandidate/CreateReleaseCandidate.test.tsx index 5f0ccaa20c..b7509cd27b 100644 --- a/plugins/git-release-manager/src/features/CreateRc/CreateRc.test.tsx +++ b/plugins/git-release-manager/src/features/CreateReleaseCandidate/CreateReleaseCandidate.test.tsx @@ -19,15 +19,15 @@ import { render } from '@testing-library/react'; import { mockCalverProject, - mockNextGitHubInfoSemver, + mockNextGitInfoSemver, mockReleaseBranch, mockReleaseCandidateCalver, mockReleaseVersionCalver, mockSemverProject, } from '../../test-helpers/test-helpers'; -import { CreateRc } from './CreateRc'; +import { CreateReleaseCandidate } from './CreateReleaseCandidate'; import { TEST_IDS } from '../../test-helpers/test-ids'; -import { useCreateRc } from './hooks/useCreateRc'; +import { useCreateReleaseCandidate } from './hooks/useCreateReleaseCandidate'; import { useProjectContext } from '../../contexts/ProjectContext'; jest.mock('../../contexts/ProjectContext', () => ({ @@ -35,23 +35,23 @@ jest.mock('../../contexts/ProjectContext', () => ({ project: mockCalverProject, })), })); -jest.mock('../../helpers/getRcGitHubInfo', () => ({ - getRcGitHubInfo: () => mockNextGitHubInfoSemver, +jest.mock('../../helpers/getReleaseCandidateGitInfo', () => ({ + getReleaseCandidateGitInfo: () => mockNextGitInfoSemver, })); -jest.mock('./hooks/useCreateRc', () => ({ - useCreateRc: () => +jest.mock('./hooks/useCreateReleaseCandidate', () => ({ + useCreateReleaseCandidate: () => ({ run: jest.fn(), responseSteps: [], progress: 0, runInvoked: false, - } as ReturnType), + } as ReturnType), })); -describe('CreateRc', () => { +describe('CreateReleaseCandidate', () => { it('should display CTA', () => { const { getByTestId } = render( - { }); const { getByTestId } = render( - { ); }; -export const CreateRc = ({ +export const CreateReleaseCandidate = ({ defaultBranch, latestRelease, releaseBranch, successCb, -}: CreateRcProps) => { +}: CreateReleaseCandidateProps) => { const { project } = useProjectContext(); const classes = useStyles(); const [semverBumpLevel, setSemverBumpLevel] = useState<'major' | 'minor'>( SEMVER_PARTS.minor, ); - const [nextGitHubInfo, setNextGitHubInfo] = useState( - getRcGitHubInfo({ latestRelease, project, semverBumpLevel }), + const [releaseCandidateGitInfo, setReleaseCandidateGitInfo] = useState( + getReleaseCandidateGitInfo({ latestRelease, project, semverBumpLevel }), ); useEffect(() => { - setNextGitHubInfo( - getRcGitHubInfo({ latestRelease, project, semverBumpLevel }), + setReleaseCandidateGitInfo( + getReleaseCandidateGitInfo({ latestRelease, project, semverBumpLevel }), ); - }, [semverBumpLevel, setNextGitHubInfo, latestRelease, project]); + }, [semverBumpLevel, setReleaseCandidateGitInfo, latestRelease, project]); - const { progress, responseSteps, run, runInvoked } = useCreateRc({ + const { + progress, + responseSteps, + run, + runInvoked, + } = useCreateReleaseCandidate({ defaultBranch, latestRelease, - nextGitHubInfo, + releaseCandidateGitInfo, project, successCb, }); @@ -99,15 +104,15 @@ export const CreateRc = ({ ); } - if (nextGitHubInfo.error !== undefined) { + if (releaseCandidateGitInfo.error !== undefined) { return ( - {nextGitHubInfo.error.title && ( - {nextGitHubInfo.error.title} + {releaseCandidateGitInfo.error.title && ( + {releaseCandidateGitInfo.error.title} )} - {nextGitHubInfo.error.subtitle} + {releaseCandidateGitInfo.error.subtitle} ); @@ -115,7 +120,7 @@ export const CreateRc = ({ const tagAlreadyExists = latestRelease !== null && - latestRelease.tagName === nextGitHubInfo.rcReleaseTag; + latestRelease.tagName === releaseCandidateGitInfo.rcReleaseTag; const conflictingPreRelease = latestRelease !== null && latestRelease.prerelease; @@ -159,7 +164,7 @@ export const CreateRc = ({ {tagAlreadyExists && ( There's already a tag named{' '} - {nextGitHubInfo.rcReleaseTag} + {releaseCandidateGitInfo.rcReleaseTag} )} @@ -169,7 +174,7 @@ export const CreateRc = ({ @@ -177,7 +182,7 @@ export const CreateRc = ({
diff --git a/plugins/git-release-manager/src/features/CreateRc/hooks/useCreateRc.test.tsx b/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.test.tsx similarity index 90% rename from plugins/git-release-manager/src/features/CreateRc/hooks/useCreateRc.test.tsx rename to plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.test.tsx index adbbe3b9f6..2acffbf52c 100644 --- a/plugins/git-release-manager/src/features/CreateRc/hooks/useCreateRc.test.tsx +++ b/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.test.tsx @@ -21,25 +21,25 @@ import { mockApiClient, mockCalverProject, mockDefaultBranch, - mockNextGitHubInfoCalver, + mockNextGitInfoCalver, mockReleaseVersionCalver, } from '../../../test-helpers/test-helpers'; -import { useCreateRc } from './useCreateRc'; +import { useCreateReleaseCandidate } from './useCreateReleaseCandidate'; jest.mock('@backstage/core', () => ({ useApi: () => mockApiClient, createApiRef: jest.fn(), })); -describe('useCreateRc', () => { +describe('useCreateReleaseCandidate', () => { beforeEach(jest.clearAllMocks); it('should return the expected responseSteps and progress', async () => { const { result } = renderHook(() => - useCreateRc({ + useCreateReleaseCandidate({ defaultBranch: mockDefaultBranch, latestRelease: mockReleaseVersionCalver, - nextGitHubInfo: mockNextGitHubInfoCalver, + releaseCandidateGitInfo: mockNextGitInfoCalver, project: mockCalverProject, }), ); @@ -54,10 +54,10 @@ describe('useCreateRc', () => { it('should return the expected responseSteps and progress (with successCb)', async () => { const { result } = renderHook(() => - useCreateRc({ + useCreateReleaseCandidate({ defaultBranch: mockDefaultBranch, latestRelease: mockReleaseVersionCalver, - nextGitHubInfo: mockNextGitHubInfoCalver, + releaseCandidateGitInfo: mockNextGitInfoCalver, project: mockCalverProject, successCb: jest.fn(), }), diff --git a/plugins/git-release-manager/src/features/CreateRc/hooks/useCreateRc.ts b/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts similarity index 80% rename from plugins/git-release-manager/src/features/CreateRc/hooks/useCreateRc.ts rename to plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts index b205cfad6a..a5a174ebd2 100644 --- a/plugins/git-release-manager/src/features/CreateRc/hooks/useCreateRc.ts +++ b/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts @@ -23,35 +23,35 @@ import { GetRepositoryResult, } from '../../../api/PluginApiClient'; import { CardHook, ComponentConfigCreateRc } from '../../../types/types'; -import { getRcGitHubInfo } from '../../../helpers/getRcGitHubInfo'; -import { githubReleaseManagerApiRef } from '../../../api/serviceApiRef'; -import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; +import { getReleaseCandidateGitInfo } from '../../../helpers/getReleaseCandidateGitInfo'; +import { gitReleaseManagerApiRef } from '../../../api/serviceApiRef'; +import { GitReleaseManagerError } from '../../../errors/GitReleaseManagerError'; import { Project } from '../../../contexts/ProjectContext'; import { useResponseSteps } from '../../../hooks/useResponseSteps'; -interface CreateRC { +interface UseCreateReleaseCandidate { defaultBranch: GetRepositoryResult['defaultBranch']; latestRelease: GetLatestReleaseResult; - nextGitHubInfo: ReturnType; + releaseCandidateGitInfo: ReturnType; project: Project; successCb?: ComponentConfigCreateRc['successCb']; } -export function useCreateRc({ +export function useCreateReleaseCandidate({ defaultBranch, latestRelease, - nextGitHubInfo, + releaseCandidateGitInfo, project, successCb, -}: CreateRC): CardHook { - const pluginApiClient = useApi(githubReleaseManagerApiRef); +}: UseCreateReleaseCandidate): CardHook { + const pluginApiClient = useApi(gitReleaseManagerApiRef); - if (nextGitHubInfo.error) { - throw new GitHubReleaseManagerError( + if (releaseCandidateGitInfo.error) { + throw new GitReleaseManagerError( `Unexpected error: ${ - nextGitHubInfo.error.title - ? `${nextGitHubInfo.error.title} (${nextGitHubInfo.error.subtitle})` - : nextGitHubInfo.error.subtitle + releaseCandidateGitInfo.error.title + ? `${releaseCandidateGitInfo.error.title} (${releaseCandidateGitInfo.error.subtitle})` + : releaseCandidateGitInfo.error.subtitle }`, ); } @@ -98,12 +98,12 @@ export function useCreateRc({ owner: project.owner, repo: project.repo, mostRecentSha: latestCommitRes.value.latestCommit.sha, - targetBranch: nextGitHubInfo.rcBranch, + targetBranch: releaseCandidateGitInfo.rcBranch, }) .catch(error => { if (error?.body?.message === 'Reference already exists') { - throw new GitHubReleaseManagerError( - `Branch "${nextGitHubInfo.rcBranch}" already exists: .../tree/${nextGitHubInfo.rcBranch}`, + throw new GitReleaseManagerError( + `Branch "${releaseCandidateGitInfo.rcBranch}" already exists: .../tree/${releaseCandidateGitInfo.rcBranch}`, ); } throw error; @@ -130,7 +130,7 @@ export function useCreateRc({ const previousReleaseBranch = latestRelease ? latestRelease.targetCommitish : defaultBranch; - const nextReleaseBranch = nextGitHubInfo.rcBranch; + const nextReleaseBranch = releaseCandidateGitInfo.rcBranch; const comparison = await pluginApiClient.createRc .getComparison({ owner: project.owner, @@ -173,16 +173,16 @@ export function useCreateRc({ .createRelease({ owner: project.owner, repo: project.repo, - rcReleaseTag: nextGitHubInfo.rcReleaseTag, - releaseName: nextGitHubInfo.releaseName, - rcBranch: nextGitHubInfo.rcBranch, + rcReleaseTag: releaseCandidateGitInfo.rcReleaseTag, + releaseName: releaseCandidateGitInfo.releaseName, + rcBranch: releaseCandidateGitInfo.rcBranch, releaseBody: getComparisonRes.value.releaseBody, }) .catch(asyncCatcher); addStepToResponseSteps({ message: `Created Release Candidate "${createReleaseResult.name}"`, - secondaryMessage: `with tag "${nextGitHubInfo.rcReleaseTag}"`, + secondaryMessage: `with tag "${releaseCandidateGitInfo.rcReleaseTag}"`, link: createReleaseResult.htmlUrl, }); diff --git a/plugins/git-release-manager/src/features/Features.test.tsx b/plugins/git-release-manager/src/features/Features.test.tsx index e2f5428331..15fa360f4a 100644 --- a/plugins/git-release-manager/src/features/Features.test.tsx +++ b/plugins/git-release-manager/src/features/Features.test.tsx @@ -66,7 +66,7 @@ describe('Features', () => { class="MuiTypography-root MuiTypography-body1" > - GitHub + Git : The source control system where releases reside in a practical sense. Read more about @@ -75,9 +75,9 @@ describe('Features', () => { href="https://docs.github.com/en/github/administering-a-repository/managing-releases-in-a-repository" target="_blank" > - GitHub releases + Git releases
- . (Note that this plugin works just as well with GitHub Enterprise.) + .

{ Release Candidate - : A GitHub + : A Git prerelease - - intended primarily for internal testing + intended primarily for internal testing

{ Release Version - : A GitHub release intended for end users + : A Git release intended for end users

`); diff --git a/plugins/git-release-manager/src/features/Features.tsx b/plugins/git-release-manager/src/features/Features.tsx index f8c48b0732..ce715654ae 100644 --- a/plugins/git-release-manager/src/features/Features.tsx +++ b/plugins/git-release-manager/src/features/Features.tsx @@ -14,19 +14,19 @@ * limitations under the License. */ -import React, { useState } from 'react'; +import React, { useState, ComponentProps } from 'react'; import { Alert, AlertTitle } from '@material-ui/lab'; import { ErrorBoundary, useApi } from '@backstage/core'; import { CenteredCircularProgress } from '../components/CenteredCircularProgress'; -import { CreateRc } from './CreateRc/CreateRc'; -import { githubReleaseManagerApiRef } from '../api/serviceApiRef'; -import { GitHubReleaseManagerProps } from '../GitHubReleaseManager'; +import { CreateReleaseCandidate } from './CreateReleaseCandidate/CreateReleaseCandidate'; +import { GitReleaseManager } from '../GitReleaseManager'; +import { gitReleaseManagerApiRef } from '../api/serviceApiRef'; import { Info } from './Info/Info'; import { Patch } from './Patch/Patch'; import { PromoteRc } from './PromoteRc/PromoteRc'; import { RefetchContext } from '../contexts/RefetchContext'; -import { useGetGitHubBatchInfo } from '../hooks/useGetGitHubBatchInfo'; +import { useGetGitBatchInfo } from '../hooks/useGetGitBatchInfo'; import { useProjectContext } from '../contexts/ProjectContext'; import { useVersioningStrategyMatchesRepoTags } from '../hooks/useVersioningStrategyMatchesRepoTags'; import { validateTagName } from '../helpers/tagParts/validateTagName'; @@ -34,43 +34,43 @@ import { validateTagName } from '../helpers/tagParts/validateTagName'; export function Features({ features, }: { - features: GitHubReleaseManagerProps['features']; + features: ComponentProps['features']; }) { - const pluginApiClient = useApi(githubReleaseManagerApiRef); + const pluginApiClient = useApi(gitReleaseManagerApiRef); const { project } = useProjectContext(); const [refetchTrigger, setRefetchTrigger] = useState(0); - const { gitHubBatchInfo } = useGetGitHubBatchInfo({ + const { gitBatchInfo } = useGetGitBatchInfo({ pluginApiClient, project, refetchTrigger, }); const { versioningStrategyMatches } = useVersioningStrategyMatchesRepoTags({ - latestReleaseTagName: gitHubBatchInfo.value?.latestRelease?.tagName, + latestReleaseTagName: gitBatchInfo.value?.latestRelease?.tagName, project, - repositoryName: gitHubBatchInfo.value?.repository.name, + repositoryName: gitBatchInfo.value?.repository.name, }); - if (gitHubBatchInfo.error) { + if (gitBatchInfo.error) { return ( Error occured while fetching information for "{project.owner}/ - {project.repo}" ({gitHubBatchInfo.error.message}) + {project.repo}" ({gitBatchInfo.error.message}) ); } - if (gitHubBatchInfo.loading) { + if (gitBatchInfo.loading) { return ; } - if (gitHubBatchInfo.value === undefined) { + if (gitBatchInfo.value === undefined) { return ( Failed to fetch latest GitHub release ); } - if (!gitHubBatchInfo.value.repository.pushPermissions) { + if (!gitBatchInfo.value.repository.pushPermissions) { return ( You lack push permissions for repository "{project.owner}/{project.repo} @@ -81,7 +81,7 @@ export function Features({ const { tagNameError } = validateTagName({ project, - tagName: gitHubBatchInfo.value.latestRelease?.tagName, + tagName: gitBatchInfo.value.latestRelease?.tagName, }); if (tagNameError) { return ( @@ -95,20 +95,20 @@ export function Features({ return ( - {gitHubBatchInfo.value.latestRelease && !versioningStrategyMatches && ( + {gitBatchInfo.value.latestRelease && !versioningStrategyMatches && ( Versioning mismatch, expected {project.versioningStrategy} version, - got "{gitHubBatchInfo.value.latestRelease.tagName}" + got "{gitBatchInfo.value.latestRelease.tagName}" )} - {!gitHubBatchInfo.value.latestRelease && ( + {!gitBatchInfo.value.latestRelease && ( This repository doesn't have any releases yet )} - {!gitHubBatchInfo.value.releaseBranch && ( + {!gitBatchInfo.value.releaseBranch && ( This repository doesn't have any release branches @@ -116,32 +116,32 @@ export function Features({ {!features?.info?.omit && ( )} {!features?.createRc?.omit && ( - )} {!features?.promoteRc?.omit && ( )} {!features?.patch?.omit && ( )} diff --git a/plugins/git-release-manager/src/features/Info/Info.tsx b/plugins/git-release-manager/src/features/Info/Info.tsx index 063c66adee..e6be3b45de 100644 --- a/plugins/git-release-manager/src/features/Info/Info.tsx +++ b/plugins/git-release-manager/src/features/Info/Info.tsx @@ -51,25 +51,24 @@ export const Info = ({ Terminology - GitHub: The source control system where releases - reside in a practical sense. Read more about{' '} + Git: The source control system where releases reside + in a practical sense. Read more about{' '} - GitHub releases + Git releases - . (Note that this plugin works just as well with GitHub Enterprise.) + . - Release Candidate: A GitHub prerelease{' '} - intended primarily for internal testing + Release Candidate: A Git prerelease intended + primarily for internal testing - Release Version: A GitHub release intended for end - users + Release Version: A Git release intended for end users @@ -77,7 +76,7 @@ export const Info = ({ Flow - GitHub Release Manager is built with a specific flow in mind. For + Git Release Manager is built with a specific flow in mind. For example, it assumes your project is configured to react to tags prefixed with rc or version. diff --git a/plugins/git-release-manager/src/features/Patch/PatchBody.tsx b/plugins/git-release-manager/src/features/Patch/PatchBody.tsx index 47b1db1578..8ab21e1112 100644 --- a/plugins/git-release-manager/src/features/Patch/PatchBody.tsx +++ b/plugins/git-release-manager/src/features/Patch/PatchBody.tsx @@ -42,8 +42,8 @@ import { CalverTagParts } from '../../helpers/tagParts/getCalverTagParts'; import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; import { ComponentConfigPatch } from '../../types/types'; import { Differ } from '../../components/Differ'; -import { githubReleaseManagerApiRef } from '../../api/serviceApiRef'; -import { GitHubReleaseManagerError } from '../../errors/GitHubReleaseManagerError'; +import { gitReleaseManagerApiRef } from '../../api/serviceApiRef'; +import { GitReleaseManagerError } from '../../errors/GitReleaseManagerError'; import { ResponseStepDialog } from '../../components/ResponseStepDialog/ResponseStepDialog'; import { SemverTagParts } from '../../helpers/tagParts/getSemverTagParts'; import { TEST_IDS } from '../../test-helpers/test-ids'; @@ -66,11 +66,11 @@ export const PatchBody = ({ successCb, tagParts, }: PatchBodyProps) => { - const pluginApiClient = useApi(githubReleaseManagerApiRef); + const pluginApiClient = useApi(gitReleaseManagerApiRef); const { project } = useProjectContext(); const [checkedCommitIndex, setCheckedCommitIndex] = useState(-1); - const githubDataResponse = useAsync(async () => { + const gitDataResponse = useAsync(async () => { const [ recentCommitsOnDefaultBranch, recentCommitsOnReleaseBranch, @@ -109,15 +109,15 @@ export const PatchBody = ({ ); } - if (githubDataResponse.error) { + if (gitDataResponse.error) { return ( - Unexpected error: {githubDataResponse.error.message} + Unexpected error: {gitDataResponse.error.message} ); } - if (githubDataResponse.loading) { + if (gitDataResponse.loading) { return ; } @@ -133,7 +133,7 @@ export const PatchBody = ({ severity="info" > - The current GitHub release is a Release Version + The current Git release is a Release Version It's still possible to patch it, but be extra mindful of changes @@ -147,16 +147,16 @@ export const PatchBody = ({ } function CommitList() { - if (!githubDataResponse.value?.recentCommitsOnDefaultBranch) { + if (!gitDataResponse.value?.recentCommitsOnDefaultBranch) { return null; } return ( - {githubDataResponse.value.recentCommitsOnDefaultBranch.map( + {gitDataResponse.value.recentCommitsOnDefaultBranch.map( (commit, index) => { // FIXME: Performance improvement opportunity: Convert to object lookup - const commitExistsOnReleaseBranch = !!githubDataResponse.value?.recentCommitsOnReleaseBranch.find( + const commitExistsOnReleaseBranch = !!gitDataResponse.value?.recentCommitsOnReleaseBranch.find( releaseBranchCommit => releaseBranchCommit.sha === commit.sha || releaseBranchCommit.commit.message.includes(commit.sha), // The selected patch commit's sha is included in the commit message @@ -277,11 +277,11 @@ export const PatchBody = ({ color="primary" onClick={() => { const selectedPatchCommit = - githubDataResponse.value?.recentCommitsOnDefaultBranch[ + gitDataResponse.value?.recentCommitsOnDefaultBranch[ checkedCommitIndex ]; if (!selectedPatchCommit) { - throw new GitHubReleaseManagerError( + throw new GitReleaseManagerError( 'Could not find selected patch commit', ); } diff --git a/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts b/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts index 5da8d020b9..dc13e65ea7 100644 --- a/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts +++ b/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts @@ -24,7 +24,7 @@ import { } from '../../../api/PluginApiClient'; import { CalverTagParts } from '../../../helpers/tagParts/getCalverTagParts'; import { ComponentConfigPatch, CardHook } from '../../../types/types'; -import { githubReleaseManagerApiRef } from '../../../api/serviceApiRef'; +import { gitReleaseManagerApiRef } from '../../../api/serviceApiRef'; import { Project } from '../../../contexts/ProjectContext'; import { SemverTagParts } from '../../../helpers/tagParts/getSemverTagParts'; import { useResponseSteps } from '../../../hooks/useResponseSteps'; @@ -45,7 +45,7 @@ export function usePatch({ tagParts, successCb, }: Patch): CardHook { - const pluginApiClient = useApi(githubReleaseManagerApiRef); + const pluginApiClient = useApi(gitReleaseManagerApiRef); const { responseSteps, addStepToResponseSteps, diff --git a/plugins/git-release-manager/src/features/PromoteRc/PromoteRc.tsx b/plugins/git-release-manager/src/features/PromoteRc/PromoteRc.tsx index 5d2783bcfd..16dd8de38c 100644 --- a/plugins/git-release-manager/src/features/PromoteRc/PromoteRc.tsx +++ b/plugins/git-release-manager/src/features/PromoteRc/PromoteRc.tsx @@ -46,9 +46,7 @@ export const PromoteRc = ({ latestRelease, successCb }: PromoteRcProps) => { className={classes.paragraph} severity="warning" > - - Latest GitHub release is not a Release Candidate - + Latest Git release is not a Release Candidate One can only promote Release Candidates to Release Versions ); diff --git a/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts b/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts index 6ff6c5ef9f..075700f2c1 100644 --- a/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts +++ b/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts @@ -20,7 +20,7 @@ import { useApi } from '@backstage/core'; import { CardHook, ComponentConfigPromoteRc } from '../../../types/types'; import { GetLatestReleaseResult } from '../../../api/PluginApiClient'; -import { githubReleaseManagerApiRef } from '../../../api/serviceApiRef'; +import { gitReleaseManagerApiRef } from '../../../api/serviceApiRef'; import { useProjectContext } from '../../../contexts/ProjectContext'; import { useResponseSteps } from '../../../hooks/useResponseSteps'; @@ -35,7 +35,7 @@ export function usePromoteRc({ releaseVersion, successCb, }: PromoteRc): CardHook { - const pluginApiClient = useApi(githubReleaseManagerApiRef); + const pluginApiClient = useApi(gitReleaseManagerApiRef); const { project } = useProjectContext(); const { responseSteps, diff --git a/plugins/git-release-manager/src/features/RepoDetailsForm/Owner.tsx b/plugins/git-release-manager/src/features/RepoDetailsForm/Owner.tsx index a392671c0f..36d63d2b47 100644 --- a/plugins/git-release-manager/src/features/RepoDetailsForm/Owner.tsx +++ b/plugins/git-release-manager/src/features/RepoDetailsForm/Owner.tsx @@ -27,14 +27,14 @@ import { import { useApi } from '@backstage/core'; import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; -import { githubReleaseManagerApiRef } from '../../api/serviceApiRef'; +import { gitReleaseManagerApiRef } from '../../api/serviceApiRef'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { useFormClasses } from './styles'; import { useProjectContext } from '../../contexts/ProjectContext'; import { useQueryHandler } from '../../hooks/useQueryHandler'; export function Owner({ username }: { username: string }) { - const pluginApiClient = useApi(githubReleaseManagerApiRef); + const pluginApiClient = useApi(gitReleaseManagerApiRef); const { project } = useProjectContext(); const formClasses = useFormClasses(); const navigate = useNavigate(); diff --git a/plugins/git-release-manager/src/features/RepoDetailsForm/Repo.tsx b/plugins/git-release-manager/src/features/RepoDetailsForm/Repo.tsx index b1f8298495..3db956116a 100644 --- a/plugins/git-release-manager/src/features/RepoDetailsForm/Repo.tsx +++ b/plugins/git-release-manager/src/features/RepoDetailsForm/Repo.tsx @@ -27,14 +27,14 @@ import { import { useApi } from '@backstage/core'; import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; -import { githubReleaseManagerApiRef } from '../../api/serviceApiRef'; +import { gitReleaseManagerApiRef } from '../../api/serviceApiRef'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { useFormClasses } from './styles'; import { useProjectContext } from '../../contexts/ProjectContext'; import { useQueryHandler } from '../../hooks/useQueryHandler'; export function Repo() { - const pluginApiClient = useApi(githubReleaseManagerApiRef); + const pluginApiClient = useApi(gitReleaseManagerApiRef); const { project } = useProjectContext(); const navigate = useNavigate(); const formClasses = useFormClasses(); diff --git a/plugins/git-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx b/plugins/git-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx index afe9a2f8c5..37f1d88a88 100644 --- a/plugins/git-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx +++ b/plugins/git-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx @@ -20,7 +20,7 @@ import { DateTime } from 'luxon'; import { useApi } from '@backstage/core'; import { getReleaseCommitPairs } from '../helpers/getReleaseCommitPairs'; -import { githubReleaseManagerApiRef } from '../../../../api/serviceApiRef'; +import { gitReleaseManagerApiRef } from '../../../../api/serviceApiRef'; import { useProjectContext } from '../../../../contexts/ProjectContext'; import { useReleaseStatsContext } from '../../contexts/ReleaseStatsContext'; @@ -46,7 +46,7 @@ type ReleaseTime = { }; export function useGetReleaseTimes() { - const pluginApiClient = useApi(githubReleaseManagerApiRef); + const pluginApiClient = useApi(gitReleaseManagerApiRef); const { project } = useProjectContext(); const { releaseStats } = useReleaseStatsContext(); const [averageReleaseTime, setAverageReleaseTime] = useState( diff --git a/plugins/git-release-manager/src/features/Stats/contexts/ReleaseStatsContext.tsx b/plugins/git-release-manager/src/features/Stats/contexts/ReleaseStatsContext.tsx index be0d68e2e5..452adbb87b 100644 --- a/plugins/git-release-manager/src/features/Stats/contexts/ReleaseStatsContext.tsx +++ b/plugins/git-release-manager/src/features/Stats/contexts/ReleaseStatsContext.tsx @@ -16,7 +16,7 @@ import { createContext, useContext } from 'react'; -import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; +import { GitReleaseManagerError } from '../../../errors/GitReleaseManagerError'; export interface ReleaseStats { unmappableTags: string[]; @@ -55,7 +55,7 @@ export const useReleaseStatsContext = () => { const { releaseStats } = useContext(ReleaseStatsContext) ?? {}; if (!releaseStats) { - throw new GitHubReleaseManagerError('releaseStats not found'); + throw new GitReleaseManagerError('releaseStats not found'); } return { diff --git a/plugins/git-release-manager/src/features/Stats/hooks/useGetCommit.ts b/plugins/git-release-manager/src/features/Stats/hooks/useGetCommit.ts index f9681beda6..01ff486a74 100644 --- a/plugins/git-release-manager/src/features/Stats/hooks/useGetCommit.ts +++ b/plugins/git-release-manager/src/features/Stats/hooks/useGetCommit.ts @@ -17,17 +17,17 @@ import { useAsync } from 'react-use'; import { useApi } from '@backstage/core'; -import { githubReleaseManagerApiRef } from '../../../api/serviceApiRef'; -import { GitHubReleaseManagerError } from '../../../errors/GitHubReleaseManagerError'; +import { gitReleaseManagerApiRef } from '../../../api/serviceApiRef'; +import { GitReleaseManagerError } from '../../../errors/GitReleaseManagerError'; import { useProjectContext } from '../../../contexts/ProjectContext'; export const useGetCommit = ({ ref }: { ref?: string }) => { - const pluginApiClient = useApi(githubReleaseManagerApiRef); + const pluginApiClient = useApi(gitReleaseManagerApiRef); const { project } = useProjectContext(); const commit = useAsync(async () => { if (!ref) { - throw new GitHubReleaseManagerError('Missing ref to get commit'); + throw new GitReleaseManagerError('Missing ref to get commit'); } return pluginApiClient.stats.getCommit({ diff --git a/plugins/git-release-manager/src/features/Stats/hooks/useGetStats.ts b/plugins/git-release-manager/src/features/Stats/hooks/useGetStats.ts index 3e093f68aa..ed29c09e75 100644 --- a/plugins/git-release-manager/src/features/Stats/hooks/useGetStats.ts +++ b/plugins/git-release-manager/src/features/Stats/hooks/useGetStats.ts @@ -17,11 +17,11 @@ import { useApi } from '@backstage/core'; import { useAsync } from 'react-use'; -import { githubReleaseManagerApiRef } from '../../../api/serviceApiRef'; +import { gitReleaseManagerApiRef } from '../../../api/serviceApiRef'; import { useProjectContext } from '../../../contexts/ProjectContext'; export const useGetStats = () => { - const pluginApiClient = useApi(githubReleaseManagerApiRef); + const pluginApiClient = useApi(gitReleaseManagerApiRef); const { project } = useProjectContext(); const stats = useAsync(async () => { diff --git a/plugins/git-release-manager/src/helpers/getRcGitHubInfo.test.ts b/plugins/git-release-manager/src/helpers/getReleaseCandidateGitInfo.test.ts similarity index 91% rename from plugins/git-release-manager/src/helpers/getRcGitHubInfo.test.ts rename to plugins/git-release-manager/src/helpers/getReleaseCandidateGitInfo.test.ts index 51ad5fc122..23aa7366b7 100644 --- a/plugins/git-release-manager/src/helpers/getRcGitHubInfo.test.ts +++ b/plugins/git-release-manager/src/helpers/getReleaseCandidateGitInfo.test.ts @@ -22,9 +22,9 @@ import { mockReleaseVersionSemver, mockSemverProject, } from '../test-helpers/test-helpers'; -import { getRcGitHubInfo } from './getRcGitHubInfo'; +import { getReleaseCandidateGitInfo } from './getReleaseCandidateGitInfo'; -describe('getRcGitHubInfo', () => { +describe('getReleaseCandidateGitInfo', () => { describe('DateTime', () => { it('should format dates as expected', () => { const formattedDate = DateTime.now().toFormat('yyyy.MM.dd'); @@ -36,7 +36,7 @@ describe('getRcGitHubInfo', () => { describe('calver', () => { it('should return correct GitHub info', () => { expect( - getRcGitHubInfo({ + getReleaseCandidateGitInfo({ project: mockCalverProject, latestRelease: mockReleaseVersionCalver, semverBumpLevel: 'minor', @@ -55,7 +55,7 @@ describe('getRcGitHubInfo', () => { describe('semver', () => { it("should return correct GitHub info when there's previous releases", () => { expect( - getRcGitHubInfo({ + getReleaseCandidateGitInfo({ project: mockSemverProject, latestRelease: mockReleaseVersionSemver, semverBumpLevel: 'minor', @@ -71,7 +71,7 @@ describe('getRcGitHubInfo', () => { it("should return correct GitHub info when there's no previous release", () => { expect( - getRcGitHubInfo({ + getReleaseCandidateGitInfo({ project: mockSemverProject, latestRelease: null, semverBumpLevel: 'minor', diff --git a/plugins/git-release-manager/src/helpers/getRcGitHubInfo.ts b/plugins/git-release-manager/src/helpers/getReleaseCandidateGitInfo.ts similarity index 97% rename from plugins/git-release-manager/src/helpers/getRcGitHubInfo.ts rename to plugins/git-release-manager/src/helpers/getReleaseCandidateGitInfo.ts index 70935a0dd3..bef2e63d44 100644 --- a/plugins/git-release-manager/src/helpers/getRcGitHubInfo.ts +++ b/plugins/git-release-manager/src/helpers/getReleaseCandidateGitInfo.ts @@ -22,7 +22,7 @@ import { getSemverTagParts } from './tagParts/getSemverTagParts'; import { Project } from '../contexts/ProjectContext'; import { SEMVER_PARTS } from '../constants/constants'; -export const getRcGitHubInfo = ({ +export const getReleaseCandidateGitInfo = ({ project, latestRelease, semverBumpLevel, diff --git a/plugins/git-release-manager/src/helpers/getShortCommitHash.ts b/plugins/git-release-manager/src/helpers/getShortCommitHash.ts index e2088caced..55241b390a 100644 --- a/plugins/git-release-manager/src/helpers/getShortCommitHash.ts +++ b/plugins/git-release-manager/src/helpers/getShortCommitHash.ts @@ -14,13 +14,13 @@ * limitations under the License. */ -import { GitHubReleaseManagerError } from '../errors/GitHubReleaseManagerError'; +import { GitReleaseManagerError } from '../errors/GitReleaseManagerError'; export function getShortCommitHash(hash: string) { const shortCommitHash = hash.substr(0, 7); if (shortCommitHash.length < 7) { - throw new GitHubReleaseManagerError( + throw new GitReleaseManagerError( 'Invalid shortCommitHash: less than 7 characters', ); } diff --git a/plugins/git-release-manager/src/hooks/useGetGitHubBatchInfo.test.ts b/plugins/git-release-manager/src/hooks/useGetGitBatchInfo.test.ts similarity index 85% rename from plugins/git-release-manager/src/hooks/useGetGitHubBatchInfo.test.ts rename to plugins/git-release-manager/src/hooks/useGetGitBatchInfo.test.ts index 7d45fd111a..e2a355a2e6 100644 --- a/plugins/git-release-manager/src/hooks/useGetGitHubBatchInfo.test.ts +++ b/plugins/git-release-manager/src/hooks/useGetGitBatchInfo.test.ts @@ -18,12 +18,12 @@ import { renderHook, act } from '@testing-library/react-hooks'; import { waitFor } from '@testing-library/react'; import { mockApiClient, mockSemverProject } from '../test-helpers/test-helpers'; -import { useGetGitHubBatchInfo } from './useGetGitHubBatchInfo'; +import { useGetGitBatchInfo } from './useGetGitBatchInfo'; -describe('useGetGitHubBatchInfo', () => { +describe('useGetHubBatchInfo', () => { it('should handle repositories with releases', async () => { const { result } = renderHook(() => - useGetGitHubBatchInfo({ + useGetGitBatchInfo({ pluginApiClient: mockApiClient, project: mockSemverProject, refetchTrigger: 1337, @@ -31,10 +31,10 @@ describe('useGetGitHubBatchInfo', () => { ); await act(async () => { - await waitFor(() => result.current.gitHubBatchInfo !== undefined); + await waitFor(() => result.current.gitBatchInfo !== undefined); }); - expect(result.current.gitHubBatchInfo).toMatchInlineSnapshot(` + expect(result.current.gitBatchInfo).toMatchInlineSnapshot(` Object { "loading": false, "value": Object { @@ -73,7 +73,7 @@ describe('useGetGitHubBatchInfo', () => { (mockApiClient.getLatestRelease as jest.Mock).mockResolvedValueOnce(null); const { result } = renderHook(() => - useGetGitHubBatchInfo({ + useGetGitBatchInfo({ pluginApiClient: mockApiClient, project: mockSemverProject, refetchTrigger: 1337, @@ -81,10 +81,10 @@ describe('useGetGitHubBatchInfo', () => { ); await act(async () => { - await waitFor(() => result.current.gitHubBatchInfo !== undefined); + await waitFor(() => result.current.gitBatchInfo !== undefined); }); - expect(result.current.gitHubBatchInfo).toMatchInlineSnapshot(` + expect(result.current.gitBatchInfo).toMatchInlineSnapshot(` Object { "loading": false, "value": Object { diff --git a/plugins/git-release-manager/src/hooks/useGetGitHubBatchInfo.ts b/plugins/git-release-manager/src/hooks/useGetGitBatchInfo.ts similarity index 83% rename from plugins/git-release-manager/src/hooks/useGetGitHubBatchInfo.ts rename to plugins/git-release-manager/src/hooks/useGetGitBatchInfo.ts index 5cf5115116..6469b275b5 100644 --- a/plugins/git-release-manager/src/hooks/useGetGitHubBatchInfo.ts +++ b/plugins/git-release-manager/src/hooks/useGetGitBatchInfo.ts @@ -16,21 +16,21 @@ import { useAsync } from 'react-use'; -import { IPluginApiClient } from '../api/PluginApiClient'; +import { GitReleaseApi } from '../api/PluginApiClient'; import { Project } from '../contexts/ProjectContext'; -interface GetGitHubBatchInfo { +interface GetGitBatchInfo { project: Project; - pluginApiClient: IPluginApiClient; + pluginApiClient: GitReleaseApi; refetchTrigger: number; } -export const useGetGitHubBatchInfo = ({ +export const useGetGitBatchInfo = ({ project, pluginApiClient, refetchTrigger, -}: GetGitHubBatchInfo) => { - const gitHubBatchInfo = useAsync(async () => { +}: GetGitBatchInfo) => { + const gitBatchInfo = useAsync(async () => { const [repository, latestRelease] = await Promise.all([ pluginApiClient.getRepository({ ...project }), pluginApiClient.getLatestRelease({ ...project }), @@ -57,6 +57,6 @@ export const useGetGitHubBatchInfo = ({ }, [project, refetchTrigger]); return { - gitHubBatchInfo, + gitBatchInfo, }; }; diff --git a/plugins/git-release-manager/src/index.ts b/plugins/git-release-manager/src/index.ts index bb9a29c419..38b6a4ebb3 100644 --- a/plugins/git-release-manager/src/index.ts +++ b/plugins/git-release-manager/src/index.ts @@ -15,7 +15,7 @@ */ export { - gitHubReleaseManagerPlugin, - GitHubReleaseManagerPage, - githubReleaseManagerApiRef, + gitReleaseManagerPlugin, + GitReleaseManagerPage, + gitReleaseManagerApiRef, } from './plugin'; diff --git a/plugins/git-release-manager/src/plugin.test.ts b/plugins/git-release-manager/src/plugin.test.ts index 5f30848771..a4882ceb9b 100644 --- a/plugins/git-release-manager/src/plugin.test.ts +++ b/plugins/git-release-manager/src/plugin.test.ts @@ -20,9 +20,9 @@ describe('git-release-manager', () => { it('should export plugin & friends', () => { expect(Object.keys(plugin)).toMatchInlineSnapshot(` Array [ - "githubReleaseManagerApiRef", - "gitHubReleaseManagerPlugin", - "GitHubReleaseManagerPage", + "gitReleaseManagerApiRef", + "gitReleaseManagerPlugin", + "GitReleaseManagerPage", ] `); }); diff --git a/plugins/git-release-manager/src/plugin.ts b/plugins/git-release-manager/src/plugin.ts index 507d1044aa..0760f6a393 100644 --- a/plugins/git-release-manager/src/plugin.ts +++ b/plugins/git-release-manager/src/plugin.ts @@ -22,26 +22,26 @@ import { createRoutableExtension, } from '@backstage/core'; -import { githubReleaseManagerApiRef } from './api/serviceApiRef'; -import { PluginApiClient } from './api/PluginApiClient'; +import { gitReleaseManagerApiRef } from './api/serviceApiRef'; +import { GitReleaseApiClient } from './api/PluginApiClient'; import { rootRouteRef } from './routes'; -export { githubReleaseManagerApiRef }; +export { gitReleaseManagerApiRef }; -export const gitHubReleaseManagerPlugin = createPlugin({ +export const gitReleaseManagerPlugin = createPlugin({ id: 'git-release-manager', routes: { root: rootRouteRef, }, apis: [ createApiFactory({ - api: githubReleaseManagerApiRef, + api: gitReleaseManagerApiRef, deps: { configApi: configApiRef, githubAuthApi: githubAuthApiRef, }, factory: ({ configApi, githubAuthApi }) => { - return new PluginApiClient({ + return new GitReleaseApiClient({ configApi, githubAuthApi, }); @@ -50,10 +50,10 @@ export const gitHubReleaseManagerPlugin = createPlugin({ ], }); -export const GitHubReleaseManagerPage = gitHubReleaseManagerPlugin.provide( +export const GitReleaseManagerPage = gitReleaseManagerPlugin.provide( createRoutableExtension({ component: () => - import('./GitHubReleaseManager').then(m => m.GitHubReleaseManager), + import('./GitReleaseManager').then(m => m.GitReleaseManager), mountPoint: rootRouteRef, }), ); diff --git a/plugins/git-release-manager/src/test-helpers/test-helpers.ts b/plugins/git-release-manager/src/test-helpers/test-helpers.ts index 68bd9c7e3b..cbf287a5cf 100644 --- a/plugins/git-release-manager/src/test-helpers/test-helpers.ts +++ b/plugins/git-release-manager/src/test-helpers/test-helpers.ts @@ -18,11 +18,11 @@ import { GetBranchResult, GetLatestReleaseResult, GetRecentCommitsResultSingle, - IPluginApiClient, + GitReleaseApi, } from '../api/PluginApiClient'; import { CalverTagParts } from '../helpers/tagParts/getCalverTagParts'; import { Project } from '../contexts/ProjectContext'; -import { getRcGitHubInfo } from '../helpers/getRcGitHubInfo'; +import { getReleaseCandidateGitInfo } from '../helpers/getReleaseCandidateGitInfo'; const mockOwner = 'mock_owner'; const mockRepo = 'mock_repo'; @@ -59,13 +59,17 @@ export const mockSearchSemver = `?versioningStrategy=${mockSemverProject.version export const mockDefaultBranch = 'mock_defaultBranch'; -export const mockNextGitHubInfoSemver: ReturnType = { +export const mockNextGitInfoSemver: ReturnType< + typeof getReleaseCandidateGitInfo +> = { rcBranch: MOCK_RELEASE_BRANCH_NAME_SEMVER, rcReleaseTag: MOCK_RELEASE_CANDIDATE_TAG_NAME_SEMVER, releaseName: MOCK_RELEASE_NAME_SEMVER, }; -export const mockNextGitHubInfoCalver: ReturnType = { +export const mockNextGitInfoCalver: ReturnType< + typeof getReleaseCandidateGitInfo +> = { rcBranch: MOCK_RELEASE_BRANCH_NAME_CALVER, rcReleaseTag: MOCK_RELEASE_CANDIDATE_TAG_NAME_CALVER, releaseName: MOCK_RELEASE_NAME_CALVER, @@ -168,7 +172,7 @@ export const mockSelectedPatchCommit = createMockRecentCommit({ /** * MOCK API CLIENT */ -export const mockApiClient: IPluginApiClient = { +export const mockApiClient: GitReleaseApi = { getHost: jest.fn(() => 'github.com'), getRepoPath: jest.fn(() => `${mockOwner}/${mockRepo}`), diff --git a/plugins/git-release-manager/src/test-helpers/test-ids.ts b/plugins/git-release-manager/src/test-helpers/test-ids.ts index a5b38e93a1..5e4175ba4d 100644 --- a/plugins/git-release-manager/src/test-helpers/test-ids.ts +++ b/plugins/git-release-manager/src/test-helpers/test-ids.ts @@ -72,7 +72,7 @@ export const TEST_IDS = { icons: { tag: 'grm--differ--icons--tag', branch: 'grm--differ--icons--branch', - github: 'grm--differ--icons--github', + github: 'grm--differ--icons--git', slack: 'grm--differ--icons--slack', versioning: 'grm--differ--icons--versioning', }, From 7a61ec487cc6ce494705a709268f3b4544626bf8 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 29 Apr 2021 12:03:56 +0200 Subject: [PATCH 206/485] Continue renaming code from GitHub to Git Signed-off-by: Erik Engervall --- plugins/git-release-manager/dev/index.tsx | 8 ++++---- .../hooks/useCreateReleaseCandidate.ts | 6 +++--- plugins/git-release-manager/src/features/Features.tsx | 4 +--- .../src/features/PromoteRc/hooks/usePromoteRc.ts | 4 ++-- .../src/helpers/getReleaseCandidateGitInfo.test.ts | 6 +++--- plugins/git-release-manager/src/types/types.ts | 8 ++++---- 6 files changed, 17 insertions(+), 19 deletions(-) diff --git a/plugins/git-release-manager/dev/index.tsx b/plugins/git-release-manager/dev/index.tsx index d1d2d6e7d9..ba794e7b21 100644 --- a/plugins/git-release-manager/dev/index.tsx +++ b/plugins/git-release-manager/dev/index.tsx @@ -82,8 +82,8 @@ createDevApp() successCb: ({ comparisonUrl, createdTag, - gitHubReleaseName, - gitHubReleaseUrl, + gitReleaseName, + gitReleaseUrl, previousTag, }) => { // eslint-disable-next-line no-console @@ -91,8 +91,8 @@ createDevApp() 'Custom success callback for Create RC', comparisonUrl, createdTag, - gitHubReleaseName, - gitHubReleaseUrl, + gitReleaseName, + gitReleaseUrl, previousTag, ); }, diff --git a/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts b/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts index a5a174ebd2..d922658d2c 100644 --- a/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts +++ b/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts @@ -163,7 +163,7 @@ export function useCreateReleaseCandidate({ }, [createRcRes.value, createRcRes.error]); /** - * (4) Creates the release itself in GitHub + * (4) Creates the Git Release itself */ const createReleaseRes = useAsync(async () => { abortIfError(getComparisonRes.error); @@ -202,8 +202,8 @@ export function useCreateReleaseCandidate({ await successCb({ comparisonUrl: getComparisonRes.value.htmlUrl, createdTag: createReleaseRes.value.tagName, - gitHubReleaseName: createReleaseRes.value.name, - gitHubReleaseUrl: createReleaseRes.value.htmlUrl, + gitReleaseName: createReleaseRes.value.name, + gitReleaseUrl: createReleaseRes.value.htmlUrl, previousTag: latestRelease?.tagName, }); } catch (error) { diff --git a/plugins/git-release-manager/src/features/Features.tsx b/plugins/git-release-manager/src/features/Features.tsx index ce715654ae..3649b0c3f7 100644 --- a/plugins/git-release-manager/src/features/Features.tsx +++ b/plugins/git-release-manager/src/features/Features.tsx @@ -65,9 +65,7 @@ export function Features({ } if (gitBatchInfo.value === undefined) { - return ( - Failed to fetch latest GitHub release - ); + return Failed to fetch latest Git release; } if (!gitBatchInfo.value.repository.pushPermissions) { diff --git a/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts b/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts index 075700f2c1..ba236b29ce 100644 --- a/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts +++ b/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts @@ -77,8 +77,8 @@ export function usePromoteRc({ try { await successCb?.({ - gitHubReleaseUrl: promotedReleaseRes.value.htmlUrl, - gitHubReleaseName: promotedReleaseRes.value.name, + gitReleaseUrl: promotedReleaseRes.value.htmlUrl, + gitReleaseName: promotedReleaseRes.value.name, previousTagUrl: rcRelease.htmlUrl, previousTag: rcRelease.tagName, updatedTagUrl: promotedReleaseRes.value.htmlUrl, diff --git a/plugins/git-release-manager/src/helpers/getReleaseCandidateGitInfo.test.ts b/plugins/git-release-manager/src/helpers/getReleaseCandidateGitInfo.test.ts index 23aa7366b7..c27e37ce86 100644 --- a/plugins/git-release-manager/src/helpers/getReleaseCandidateGitInfo.test.ts +++ b/plugins/git-release-manager/src/helpers/getReleaseCandidateGitInfo.test.ts @@ -34,7 +34,7 @@ describe('getReleaseCandidateGitInfo', () => { }); describe('calver', () => { - it('should return correct GitHub info', () => { + it('should return correct Git info', () => { expect( getReleaseCandidateGitInfo({ project: mockCalverProject, @@ -53,7 +53,7 @@ describe('getReleaseCandidateGitInfo', () => { }); describe('semver', () => { - it("should return correct GitHub info when there's previous releases", () => { + it("should return correct Git info when there's previous releases", () => { expect( getReleaseCandidateGitInfo({ project: mockSemverProject, @@ -69,7 +69,7 @@ describe('getReleaseCandidateGitInfo', () => { `); }); - it("should return correct GitHub info when there's no previous release", () => { + it("should return correct Git info when there's no previous release", () => { expect( getReleaseCandidateGitInfo({ project: mockSemverProject, diff --git a/plugins/git-release-manager/src/types/types.ts b/plugins/git-release-manager/src/types/types.ts index ece840fa5f..8e2a034d3a 100644 --- a/plugins/git-release-manager/src/types/types.ts +++ b/plugins/git-release-manager/src/types/types.ts @@ -20,8 +20,8 @@ export type ComponentConfig = { }; interface CreateRcSuccessCbArgs { - gitHubReleaseUrl: string; - gitHubReleaseName: string | null; + gitReleaseUrl: string; + gitReleaseName: string | null; comparisonUrl: string; previousTag?: string; createdTag: string; @@ -29,8 +29,8 @@ interface CreateRcSuccessCbArgs { export type ComponentConfigCreateRc = ComponentConfig; interface PromoteRcSuccessCbArgs { - gitHubReleaseUrl: string; - gitHubReleaseName: string | null; + gitReleaseUrl: string; + gitReleaseName: string | null; previousTagUrl: string; previousTag: string; updatedTagUrl: string; From 4b1ce5edb03474a862de13f78f541ab011b13543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Thu, 29 Apr 2021 12:19:57 +0200 Subject: [PATCH 207/485] fix master lint errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .../src/stages/publish/awsS3.test.ts | 55 ++++++++---------- .../stages/publish/azureBlobStorage.test.ts | 32 +++++------ .../src/stages/publish/googleStorage.test.ts | 53 ++++++++--------- .../src/stages/publish/googleStorage.ts | 2 +- .../src/stages/publish/openStackSwift.test.ts | 57 +++++++++---------- 5 files changed, 90 insertions(+), 109 deletions(-) diff --git a/packages/techdocs-common/src/stages/publish/awsS3.test.ts b/packages/techdocs-common/src/stages/publish/awsS3.test.ts index 15da3b7cfc..f094457346 100644 --- a/packages/techdocs-common/src/stages/publish/awsS3.test.ts +++ b/packages/techdocs-common/src/stages/publish/awsS3.test.ts @@ -13,11 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { getVoidLogger } from '@backstage/backend-common'; import { Entity, - ENTITY_DEFAULT_NAMESPACE, EntityName, + ENTITY_DEFAULT_NAMESPACE, } from '@backstage/catalog-model'; import { ConfigReader } from '@backstage/config'; import mockFs from 'mock-fs'; @@ -154,7 +155,6 @@ describe('AwsS3Publish', () => { }); it('should fail to publish a directory', async () => { - expect.assertions(3); const wrongPathToGeneratedDirectory = path.join( rootDir, 'wrong', @@ -171,23 +171,22 @@ describe('AwsS3Publish', () => { }), ).rejects.toThrowError(); - await publisher - .publish({ - entity, - directory: wrongPathToGeneratedDirectory, - }) - .catch(error => { - expect(error.message).toEqual( - // Can not do exact error message match due to mockFs adding unexpected characters in the path when throwing the error - // Issue reported https://github.com/tschaub/mock-fs/issues/118 - expect.stringContaining( - `Unable to upload file(s) to AWS S3. Error: Failed to read template directory: ENOENT, no such file or directory`, - ), - ); - expect(error.message).toEqual( - expect.stringContaining(wrongPathToGeneratedDirectory), - ); - }); + const fails = publisher.publish({ + entity, + directory: wrongPathToGeneratedDirectory, + }); + + // Can not do exact error message match due to mockFs adding unexpected characters in the path when throwing the error + // Issue reported https://github.com/tschaub/mock-fs/issues/118 + await expect(fails).rejects.toMatchObject({ + message: expect.stringContaining( + 'Unable to upload file(s) to AWS S3. Error: Failed to read template directory: ENOENT, no such file or directory', + ), + }); + await expect(fails).rejects.toMatchObject({ + message: expect.stringContaining(wrongPathToGeneratedDirectory), + }); + mockFs.restore(); }); }); @@ -265,18 +264,12 @@ describe('AwsS3Publish', () => { const entity = createMockEntity(); const entityRootDir = getEntityRootDir(entity); - await publisher - .fetchTechDocsMetadata(entityNameMock) - .catch(error => - expect(error).toEqual( - new Error( - `TechDocs metadata fetch failed, The file ${path.join( - entityRootDir, - 'techdocs_metadata.json', - )} does not exist !`, - ), - ), - ); + const fails = publisher.fetchTechDocsMetadata(entityNameMock); + + const errorPath = path.join(entityRootDir, 'techdocs_metadata.json'); + await expect(fails).rejects.toMatchObject({ + message: `TechDocs metadata fetch failed, The file ${errorPath} does not exist !`, + }); }); }); }); diff --git a/packages/techdocs-common/src/stages/publish/azureBlobStorage.test.ts b/packages/techdocs-common/src/stages/publish/azureBlobStorage.test.ts index c431e924a8..1160ffe49d 100644 --- a/packages/techdocs-common/src/stages/publish/azureBlobStorage.test.ts +++ b/packages/techdocs-common/src/stages/publish/azureBlobStorage.test.ts @@ -13,11 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { getVoidLogger } from '@backstage/backend-common'; import { Entity, - ENTITY_DEFAULT_NAMESPACE, EntityName, + ENTITY_DEFAULT_NAMESPACE, } from '@backstage/catalog-model'; import { ConfigReader } from '@backstage/config'; import mockFs from 'mock-fs'; @@ -157,7 +158,6 @@ describe('publishing with valid credentials', () => { }); it('should fail to publish a directory', async () => { - expect.assertions(1); const wrongPathToGeneratedDirectory = path.join( rootDir, 'wrong', @@ -168,22 +168,20 @@ describe('publishing with valid credentials', () => { const entity = createMockEntity(); - await publisher - .publish({ - entity, - directory: wrongPathToGeneratedDirectory, - }) - .catch(error => { - // Can not do exact error message match due to mockFs adding unexpected characters in the path when throwing the error - // Issue reported https://github.com/tschaub/mock-fs/issues/118 - expect.stringContaining( - `Unable to upload file(s) to Azure Blob Storage. Error: Failed to read template directory: ENOENT, no such file or directory`, - ); + const fails = publisher.publish({ + entity, + directory: wrongPathToGeneratedDirectory, + }); + + await expect(fails).rejects.toMatchObject({ + message: expect.stringContaining( + `Unable to upload file(s) to Azure Blob Storage. Error: Failed to read template directory: ENOENT, no such file or directory`, + ), + }); + await expect(fails).rejects.toMatchObject({ + message: expect.stringContaining(wrongPathToGeneratedDirectory), + }); - expect(error.message).toEqual( - expect.stringContaining(wrongPathToGeneratedDirectory), - ); - }); mockFs.restore(); }); diff --git a/packages/techdocs-common/src/stages/publish/googleStorage.test.ts b/packages/techdocs-common/src/stages/publish/googleStorage.test.ts index 7e580b16bc..19e4938763 100644 --- a/packages/techdocs-common/src/stages/publish/googleStorage.test.ts +++ b/packages/techdocs-common/src/stages/publish/googleStorage.test.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { getVoidLogger } from '@backstage/backend-common'; import { Entity, @@ -146,8 +147,6 @@ describe('GoogleGCSPublish', () => { }); it('should fail to publish a directory', async () => { - expect.assertions(3); - const wrongPathToGeneratedDirectory = path.join( rootDir, 'wrong', @@ -165,23 +164,21 @@ describe('GoogleGCSPublish', () => { }), ).rejects.toThrowError(); - await publisher - .publish({ - entity, - directory: wrongPathToGeneratedDirectory, - }) - .catch(error => { - expect(error.message).toEqual( - // Can not do exact error message match due to mockFs adding unexpected characters in the path when throwing the error - // Issue reported https://github.com/tschaub/mock-fs/issues/118 - expect.stringContaining( - `Unable to upload file(s) to Google Cloud Storage. Error: Failed to read template directory: ENOENT, no such file or directory`, - ), - ); - expect(error.message).toEqual( - expect.stringContaining(wrongPathToGeneratedDirectory), - ); - }); + const fails = publisher.publish({ + entity, + directory: wrongPathToGeneratedDirectory, + }); + + // Can not do exact error message match due to mockFs adding unexpected characters in the path when throwing the error + // Issue reported https://github.com/tschaub/mock-fs/issues/118 + await expect(fails).rejects.toMatchObject({ + message: expect.stringContaining( + `Unable to upload file(s) to Google Cloud Storage. Error: Failed to read template directory: ENOENT, no such file or directory`, + ), + }); + await expect(fails).rejects.toMatchObject({ + message: expect.stringContaining(wrongPathToGeneratedDirectory), + }); mockFs.restore(); }); @@ -264,16 +261,14 @@ describe('GoogleGCSPublish', () => { const entity = createMockEntity(); const entityRootDir = getEntityRootDir(entity); - await publisher - .fetchTechDocsMetadata(entityNameMock) - .catch(errorMessage => - expect(errorMessage).toEqual( - `The file ${path.join( - entityRootDir, - 'techdocs_metadata.json', - )} does not exist !`, - ), - ); + const fails = publisher.fetchTechDocsMetadata(entityNameMock); + + await expect(fails).rejects.toMatchObject({ + message: `The file ${path.join( + entityRootDir, + 'techdocs_metadata.json', + )} does not exist !`, + }); }); }); }); diff --git a/packages/techdocs-common/src/stages/publish/googleStorage.ts b/packages/techdocs-common/src/stages/publish/googleStorage.ts index 28fbb42ece..8adafc361a 100644 --- a/packages/techdocs-common/src/stages/publish/googleStorage.ts +++ b/packages/techdocs-common/src/stages/publish/googleStorage.ts @@ -168,7 +168,7 @@ export class GoogleGCSPublish implements PublisherBase { .createReadStream() .on('error', err => { this.logger.error(err.message); - reject(err.message); + reject(err); }) .on('data', chunk => { fileStreamChunks.push(chunk); diff --git a/packages/techdocs-common/src/stages/publish/openStackSwift.test.ts b/packages/techdocs-common/src/stages/publish/openStackSwift.test.ts index 6f0aacede0..e179aeb9a7 100644 --- a/packages/techdocs-common/src/stages/publish/openStackSwift.test.ts +++ b/packages/techdocs-common/src/stages/publish/openStackSwift.test.ts @@ -13,11 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { getVoidLogger } from '@backstage/backend-common'; import { Entity, - ENTITY_DEFAULT_NAMESPACE, EntityName, + ENTITY_DEFAULT_NAMESPACE, } from '@backstage/catalog-model'; import { ConfigReader } from '@backstage/config'; import mockFs from 'mock-fs'; @@ -157,7 +158,6 @@ describe('OpenStackSwiftPublish', () => { }); it('should fail to publish a directory', async () => { - expect.assertions(3); const wrongPathToGeneratedDirectory = path.join( rootDir, 'wrong', @@ -174,23 +174,22 @@ describe('OpenStackSwiftPublish', () => { }), ).rejects.toThrowError(); - await publisher - .publish({ - entity, - directory: wrongPathToGeneratedDirectory, - }) - .catch(error => { - expect(error.message).toEqual( - // Can not do exact error message match due to mockFs adding unexpected characters in the path when throwing the error - // Issue reported https://github.com/tschaub/mock-fs/issues/118 - expect.stringContaining( - `Unable to upload file(s) to OpenStack Swift. Error: Failed to read template directory: ENOENT, no such file or directory`, - ), - ); - expect(error.message).toEqual( - expect.stringContaining(wrongPathToGeneratedDirectory), - ); - }); + const fails = publisher.publish({ + entity, + directory: wrongPathToGeneratedDirectory, + }); + + // Can not do exact error message match due to mockFs adding unexpected characters in the path when throwing the error + // Issue reported https://github.com/tschaub/mock-fs/issues/118 + await expect(fails).rejects.toMatchObject({ + message: expect.stringContaining( + `Unable to upload file(s) to OpenStack Swift. Error: Failed to read template directory: ENOENT, no such file or directory`, + ), + }); + await expect(fails).rejects.toMatchObject({ + message: expect.stringContaining(wrongPathToGeneratedDirectory), + }); + mockFs.restore(); }); }); @@ -268,18 +267,14 @@ describe('OpenStackSwiftPublish', () => { const entity = createMockEntity(); const entityRootDir = getEntityRootDir(entity); - await publisher - .fetchTechDocsMetadata(entityNameMock) - .catch(error => - expect(error).toEqual( - new Error( - `TechDocs metadata fetch failed, The file ${path.join( - entityRootDir, - 'techdocs_metadata.json', - )} does not exist !`, - ), - ), - ); + const fails = publisher.fetchTechDocsMetadata(entityNameMock); + + await expect(fails).rejects.toMatchObject({ + message: `TechDocs metadata fetch failed, The file ${path.join( + entityRootDir, + 'techdocs_metadata.json', + )} does not exist !`, + }); }); }); }); From 6179bff5f08b71359f0deece5d2068f2ecc168bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Thu, 29 Apr 2021 12:59:42 +0200 Subject: [PATCH 208/485] depend on core, not core-api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- plugins/catalog/package.json | 1 - plugins/catalog/src/components/EntityLayout/EntityLayout.tsx | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/catalog/package.json b/plugins/catalog/package.json index d87ca5b7d9..b6b306c260 100644 --- a/plugins/catalog/package.json +++ b/plugins/catalog/package.json @@ -33,7 +33,6 @@ "@backstage/catalog-client": "^0.3.10", "@backstage/catalog-model": "^0.7.7", "@backstage/core": "^0.7.6", - "@backstage/core-api": "^0.2.17", "@backstage/errors": "^0.1.1", "@backstage/integration": "^0.5.1", "@backstage/integration-react": "^0.1.1", diff --git a/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx b/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx index e3a8a89b71..dfd27631f8 100644 --- a/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx +++ b/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx @@ -20,6 +20,7 @@ import { RELATION_OWNED_BY, } from '@backstage/catalog-model'; import { + attachComponentData, Content, Header, HeaderLabel, @@ -34,12 +35,11 @@ import { getEntityRelations, useEntityCompoundName, } from '@backstage/plugin-catalog-react'; -import { attachComponentData } from '@backstage/core-api'; import { Box, TabProps } from '@material-ui/core'; import { Alert } from '@material-ui/lab'; import { - default as React, Children, + default as React, Fragment, isValidElement, useContext, From 44abfaada67300d542caead0a505df4d664c074a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 29 Apr 2021 11:32:12 +0000 Subject: [PATCH 209/485] Version Packages --- .changeset/calm-zebras-remain.md | 7 ---- .../cost-insights-gorgeous-dancers-hope.md | 5 --- .changeset/empty-lizards-doubt.md | 5 --- .changeset/gentle-days-return.md | 21 ---------- .changeset/healthy-phones-press.md | 5 --- .changeset/kind-suns-melt.md | 5 --- .changeset/little-trees-fold.md | 5 --- .changeset/long-ladybugs-promise.md | 5 --- .changeset/pink-islands-help.md | 5 --- .changeset/rare-parrots-share.md | 6 --- .changeset/search-moar-catalog-yo.md | 5 --- .changeset/search-odd-ads-invite.md | 5 --- .changeset/six-rocks-allow.md | 5 --- .changeset/sixty-dragons-retire.md | 5 --- .changeset/small-snakes-shake.md | 5 --- .changeset/small-ways-hunt.md | 6 --- .changeset/techdocs-lovely-wombats-relate.md | 6 --- .changeset/techdocs-mean-humans-hammer.md | 5 --- .changeset/techdocs-quiet-pens-prove.md | 5 --- .changeset/techdocs-red-donkeys-share.md | 5 --- .changeset/techdocs-swift-waves-sleep.md | 12 ------ .changeset/techdocs-young-walls-decide.md | 5 --- .changeset/thin-coins-compete.md | 5 --- .changeset/thirty-humans-knock.md | 5 --- .changeset/tough-planes-jump.md | 5 --- .changeset/witty-lies-shave.md | 5 --- packages/app/CHANGELOG.md | 42 +++++++++++++++++++ packages/app/package.json | 36 ++++++++-------- packages/core/CHANGELOG.md | 8 ++++ packages/core/package.json | 2 +- packages/create-app/CHANGELOG.md | 39 +++++++++++++++++ packages/create-app/package.json | 2 +- packages/techdocs-common/CHANGELOG.md | 6 +++ packages/techdocs-common/package.json | 2 +- plugins/api-docs/CHANGELOG.md | 14 +++++++ plugins/api-docs/package.json | 4 +- plugins/badges/package.json | 2 +- plugins/bitrise/CHANGELOG.md | 10 +++++ plugins/bitrise/package.json | 4 +- plugins/catalog-backend/CHANGELOG.md | 8 ++++ plugins/catalog-backend/package.json | 4 +- plugins/catalog-import/CHANGELOG.md | 10 +++++ plugins/catalog-import/package.json | 4 +- plugins/catalog/CHANGELOG.md | 13 ++++++ plugins/catalog/package.json | 4 +- plugins/circleci/CHANGELOG.md | 10 +++++ plugins/circleci/package.json | 4 +- plugins/cloudbuild/package.json | 2 +- plugins/code-coverage-backend/CHANGELOG.md | 6 +++ plugins/code-coverage-backend/package.json | 2 +- plugins/code-coverage/package.json | 2 +- plugins/config-schema/package.json | 2 +- plugins/cost-insights/CHANGELOG.md | 11 +++++ plugins/cost-insights/package.json | 4 +- plugins/explore/CHANGELOG.md | 10 +++++ plugins/explore/package.json | 4 +- plugins/fossa/CHANGELOG.md | 10 +++++ plugins/fossa/package.json | 4 +- plugins/gcp-projects/package.json | 2 +- plugins/github-actions/CHANGELOG.md | 11 +++++ plugins/github-actions/package.json | 4 +- plugins/github-deployments/CHANGELOG.md | 10 +++++ plugins/github-deployments/package.json | 4 +- plugins/gitops-profiles/package.json | 2 +- plugins/graphiql/CHANGELOG.md | 10 +++++ plugins/graphiql/package.json | 4 +- plugins/jenkins/CHANGELOG.md | 10 +++++ plugins/jenkins/package.json | 4 +- plugins/kafka/package.json | 2 +- plugins/kubernetes/package.json | 2 +- plugins/lighthouse/CHANGELOG.md | 10 +++++ plugins/lighthouse/package.json | 4 +- plugins/newrelic/package.json | 2 +- plugins/org/package.json | 2 +- plugins/pagerduty/CHANGELOG.md | 10 +++++ plugins/pagerduty/package.json | 4 +- plugins/register-component/CHANGELOG.md | 10 +++++ plugins/register-component/package.json | 4 +- plugins/rollbar/CHANGELOG.md | 10 +++++ plugins/rollbar/package.json | 4 +- plugins/scaffolder-backend/CHANGELOG.md | 6 +++ plugins/scaffolder-backend/package.json | 2 +- plugins/scaffolder/CHANGELOG.md | 12 ++++++ plugins/scaffolder/package.json | 4 +- plugins/search-backend-node/CHANGELOG.md | 6 +++ plugins/search-backend-node/package.json | 2 +- plugins/search/CHANGELOG.md | 10 +++++ plugins/search/package.json | 4 +- plugins/sentry/CHANGELOG.md | 10 +++++ plugins/sentry/package.json | 4 +- plugins/sonarqube/CHANGELOG.md | 10 +++++ plugins/sonarqube/package.json | 4 +- plugins/splunk-on-call/package.json | 2 +- plugins/tech-radar/package.json | 2 +- plugins/techdocs/CHANGELOG.md | 26 ++++++++++++ plugins/techdocs/package.json | 4 +- plugins/todo/package.json | 2 +- plugins/user-settings/package.json | 2 +- plugins/welcome/package.json | 2 +- 99 files changed, 441 insertions(+), 241 deletions(-) delete mode 100644 .changeset/calm-zebras-remain.md delete mode 100644 .changeset/cost-insights-gorgeous-dancers-hope.md delete mode 100644 .changeset/empty-lizards-doubt.md delete mode 100644 .changeset/gentle-days-return.md delete mode 100644 .changeset/healthy-phones-press.md delete mode 100644 .changeset/kind-suns-melt.md delete mode 100644 .changeset/little-trees-fold.md delete mode 100644 .changeset/long-ladybugs-promise.md delete mode 100644 .changeset/pink-islands-help.md delete mode 100644 .changeset/rare-parrots-share.md delete mode 100644 .changeset/search-moar-catalog-yo.md delete mode 100644 .changeset/search-odd-ads-invite.md delete mode 100644 .changeset/six-rocks-allow.md delete mode 100644 .changeset/sixty-dragons-retire.md delete mode 100644 .changeset/small-snakes-shake.md delete mode 100644 .changeset/small-ways-hunt.md delete mode 100644 .changeset/techdocs-lovely-wombats-relate.md delete mode 100644 .changeset/techdocs-mean-humans-hammer.md delete mode 100644 .changeset/techdocs-quiet-pens-prove.md delete mode 100644 .changeset/techdocs-red-donkeys-share.md delete mode 100644 .changeset/techdocs-swift-waves-sleep.md delete mode 100644 .changeset/techdocs-young-walls-decide.md delete mode 100644 .changeset/thin-coins-compete.md delete mode 100644 .changeset/thirty-humans-knock.md delete mode 100644 .changeset/tough-planes-jump.md delete mode 100644 .changeset/witty-lies-shave.md diff --git a/.changeset/calm-zebras-remain.md b/.changeset/calm-zebras-remain.md deleted file mode 100644 index 3b961ab3f2..0000000000 --- a/.changeset/calm-zebras-remain.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@backstage/plugin-api-docs': patch ---- - -Resolve issues with AsyncAPI rendering by updating `@asyncapi/react-component` -to `0.23.0`. The theming of the component is adjusted to the latest styling -changes. diff --git a/.changeset/cost-insights-gorgeous-dancers-hope.md b/.changeset/cost-insights-gorgeous-dancers-hope.md deleted file mode 100644 index 8e0abce57f..0000000000 --- a/.changeset/cost-insights-gorgeous-dancers-hope.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-cost-insights': patch ---- - -Support a `name` prop for Projects for display purposes diff --git a/.changeset/empty-lizards-doubt.md b/.changeset/empty-lizards-doubt.md deleted file mode 100644 index cfe1e128fc..0000000000 --- a/.changeset/empty-lizards-doubt.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-github-actions': patch ---- - -Wrap EmptyState in Card diff --git a/.changeset/gentle-days-return.md b/.changeset/gentle-days-return.md deleted file mode 100644 index 96552173bd..0000000000 --- a/.changeset/gentle-days-return.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -'@backstage/plugin-api-docs': patch -'@backstage/plugin-bitrise': patch -'@backstage/plugin-catalog-import': patch -'@backstage/plugin-circleci': patch -'@backstage/plugin-cost-insights': patch -'@backstage/plugin-explore': patch -'@backstage/plugin-fossa': patch -'@backstage/plugin-github-actions': patch -'@backstage/plugin-github-deployments': patch -'@backstage/plugin-graphiql': patch -'@backstage/plugin-jenkins': patch -'@backstage/plugin-lighthouse': patch -'@backstage/plugin-pagerduty': patch -'@backstage/plugin-register-component': patch -'@backstage/plugin-rollbar': patch -'@backstage/plugin-sentry': patch -'@backstage/plugin-sonarqube': patch ---- - -Updated README to have up-to-date install instructions. diff --git a/.changeset/healthy-phones-press.md b/.changeset/healthy-phones-press.md deleted file mode 100644 index c771caefc5..0000000000 --- a/.changeset/healthy-phones-press.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/core': patch ---- - -Allow passing NavLinkProps to SidebarItem component to use in NavLink diff --git a/.changeset/kind-suns-melt.md b/.changeset/kind-suns-melt.md deleted file mode 100644 index 7cbec28fea..0000000000 --- a/.changeset/kind-suns-melt.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-api-docs': patch ---- - -Added fields filtering in get API entities to avoid the requesting of unused data diff --git a/.changeset/little-trees-fold.md b/.changeset/little-trees-fold.md deleted file mode 100644 index 4963dd5aa1..0000000000 --- a/.changeset/little-trees-fold.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/create-app': patch ---- - -Updates the end to end test in the app to match the new catalog index page title. To apply this change to an existing app, update `packages/app/cypress/integration/app.js` to search for `"My Company Catalog"` instead of `"My Company Service Catalog"`. diff --git a/.changeset/long-ladybugs-promise.md b/.changeset/long-ladybugs-promise.md deleted file mode 100644 index 7d683650c3..0000000000 --- a/.changeset/long-ladybugs-promise.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-scaffolder': patch ---- - -Enable starred templates on Scaffolder frontend diff --git a/.changeset/pink-islands-help.md b/.changeset/pink-islands-help.md deleted file mode 100644 index c7672f484f..0000000000 --- a/.changeset/pink-islands-help.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-code-coverage-backend': patch ---- - -Include migrations diff --git a/.changeset/rare-parrots-share.md b/.changeset/rare-parrots-share.md deleted file mode 100644 index 917ec5a18e..0000000000 --- a/.changeset/rare-parrots-share.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@backstage/plugin-catalog': patch -'@backstage/plugin-scaffolder': patch ---- - -Removed unused `swr` dependency. diff --git a/.changeset/search-moar-catalog-yo.md b/.changeset/search-moar-catalog-yo.md deleted file mode 100644 index 4e665157e1..0000000000 --- a/.changeset/search-moar-catalog-yo.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-catalog-backend': patch ---- - -Entity lifecycle and owner are now indexed by the `DefaultCatalogCollator`. A `locationTemplate` may now optionally be provided to its constructor to reflect a custom catalog entity path in the Backstage frontend. diff --git a/.changeset/search-odd-ads-invite.md b/.changeset/search-odd-ads-invite.md deleted file mode 100644 index 0dde3d0c1f..0000000000 --- a/.changeset/search-odd-ads-invite.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-search-backend-node': patch ---- - -Introduced Scheduler which is responsible for adding new tasks to a schedule together with it's interval timer as well as starting and stopping the scheduler processes. diff --git a/.changeset/six-rocks-allow.md b/.changeset/six-rocks-allow.md deleted file mode 100644 index f207654f45..0000000000 --- a/.changeset/six-rocks-allow.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/techdocs-common': patch ---- - -Gracefully handle HTTP request failures in download method of AzureBlobStorage publisher. diff --git a/.changeset/sixty-dragons-retire.md b/.changeset/sixty-dragons-retire.md deleted file mode 100644 index 62965c6e88..0000000000 --- a/.changeset/sixty-dragons-retire.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-search': patch ---- - -Use `RouteRef` to generate path to search page. diff --git a/.changeset/small-snakes-shake.md b/.changeset/small-snakes-shake.md deleted file mode 100644 index 6db9db3754..0000000000 --- a/.changeset/small-snakes-shake.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-catalog': patch ---- - -Support `gridItem` variant for `EntityLinksCard`. diff --git a/.changeset/small-ways-hunt.md b/.changeset/small-ways-hunt.md deleted file mode 100644 index f0b8dc88cc..0000000000 --- a/.changeset/small-ways-hunt.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@backstage/core': patch -'@backstage/plugin-catalog': patch ---- - -Add `if` prop to `EntityLayout.Route` to conditionally render tabs diff --git a/.changeset/techdocs-lovely-wombats-relate.md b/.changeset/techdocs-lovely-wombats-relate.md deleted file mode 100644 index 33ed205c89..0000000000 --- a/.changeset/techdocs-lovely-wombats-relate.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@backstage/plugin-techdocs': patch ---- - -Use `EntityRefLink` in header and use relations to reference the owner of the -document. diff --git a/.changeset/techdocs-mean-humans-hammer.md b/.changeset/techdocs-mean-humans-hammer.md deleted file mode 100644 index 7697650250..0000000000 --- a/.changeset/techdocs-mean-humans-hammer.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-techdocs': patch ---- - -Fix TechDocs landing page table wrong copied link diff --git a/.changeset/techdocs-quiet-pens-prove.md b/.changeset/techdocs-quiet-pens-prove.md deleted file mode 100644 index 379c20e72a..0000000000 --- a/.changeset/techdocs-quiet-pens-prove.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-techdocs': patch ---- - -Add customization and exportable components for TechDocs landing page diff --git a/.changeset/techdocs-red-donkeys-share.md b/.changeset/techdocs-red-donkeys-share.md deleted file mode 100644 index 29d932d0b8..0000000000 --- a/.changeset/techdocs-red-donkeys-share.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-techdocs': patch ---- - -Disable color transitions on links to avoid issues in dark mode. diff --git a/.changeset/techdocs-swift-waves-sleep.md b/.changeset/techdocs-swift-waves-sleep.md deleted file mode 100644 index 79d10931cd..0000000000 --- a/.changeset/techdocs-swift-waves-sleep.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -'@backstage/plugin-techdocs': minor ---- - -Make `techdocsStorageApiRef` and `techdocsApiRef` use interfaces instead of the -actual implementation classes. - -This renames the classes `TechDocsApi` to `TechDocsClient` and `TechDocsStorageApi` -to `TechDocsStorageClient` and renames the interfaces `TechDocs` to `TechDocsApi` -and `TechDocsStorage` to `TechDocsStorageApi` to comply the pattern elsewhere in -the project. This also fixes the types returned by some methods on those -interfaces. diff --git a/.changeset/techdocs-young-walls-decide.md b/.changeset/techdocs-young-walls-decide.md deleted file mode 100644 index 8dc0373234..0000000000 --- a/.changeset/techdocs-young-walls-decide.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-techdocs': patch ---- - -Rework state management to avoid rendering multiple while navigating between pages. diff --git a/.changeset/thin-coins-compete.md b/.changeset/thin-coins-compete.md deleted file mode 100644 index 36511ec1cb..0000000000 --- a/.changeset/thin-coins-compete.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-scaffolder-backend': patch ---- - -Added the `nebula-preview` preview to `Octokit` for repository visibility. diff --git a/.changeset/thirty-humans-knock.md b/.changeset/thirty-humans-knock.md deleted file mode 100644 index 47545af282..0000000000 --- a/.changeset/thirty-humans-knock.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/core': patch ---- - -Improve owner example value in `MissingAnnotationEmptyState`. diff --git a/.changeset/tough-planes-jump.md b/.changeset/tough-planes-jump.md deleted file mode 100644 index ebbec65159..0000000000 --- a/.changeset/tough-planes-jump.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-scaffolder': patch ---- - -Support `anyOf`, `oneOf` and `allOf` schemas in the scaffolder template. diff --git a/.changeset/witty-lies-shave.md b/.changeset/witty-lies-shave.md deleted file mode 100644 index 68fd4b1137..0000000000 --- a/.changeset/witty-lies-shave.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-catalog': patch ---- - -Switch out the time-based personal greeting for a plain title on the catalog index page, and remove the clocks for different timezones. diff --git a/packages/app/CHANGELOG.md b/packages/app/CHANGELOG.md index 7262b2ae29..e9d3e63ad0 100644 --- a/packages/app/CHANGELOG.md +++ b/packages/app/CHANGELOG.md @@ -1,5 +1,47 @@ # example-app +## 0.2.26 + +### Patch Changes + +- Updated dependencies [1ce80ff02] +- Updated dependencies [b98de52ae] +- Updated dependencies [4c42ecca2] +- Updated dependencies [c614ede9a] +- Updated dependencies [9afcac5af] +- Updated dependencies [07a7806c3] +- Updated dependencies [f6efa71ee] +- Updated dependencies [19a4dd710] +- Updated dependencies [dcd54c7cd] +- Updated dependencies [da546ce00] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6fbd7beca] +- Updated dependencies [15cbe6815] +- Updated dependencies [39bdaa004] +- Updated dependencies [cb8c848a3] +- Updated dependencies [21fddf452] +- Updated dependencies [17915e29b] +- Updated dependencies [6eaecbd81] +- Updated dependencies [23769512a] +- Updated dependencies [1a142ae8a] + - @backstage/plugin-api-docs@0.4.12 + - @backstage/plugin-cost-insights@0.8.5 + - @backstage/plugin-github-actions@0.4.4 + - @backstage/plugin-catalog-import@0.5.4 + - @backstage/plugin-circleci@0.2.13 + - @backstage/plugin-explore@0.3.4 + - @backstage/plugin-graphiql@0.2.10 + - @backstage/plugin-jenkins@0.4.2 + - @backstage/plugin-lighthouse@0.2.15 + - @backstage/plugin-pagerduty@0.3.3 + - @backstage/plugin-rollbar@0.3.4 + - @backstage/plugin-sentry@0.3.9 + - @backstage/core@0.7.7 + - @backstage/plugin-scaffolder@0.9.2 + - @backstage/plugin-catalog@0.5.6 + - @backstage/plugin-search@0.3.5 + - @backstage/plugin-techdocs@0.9.0 + ## 0.2.25 ### Patch Changes diff --git a/packages/app/package.json b/packages/app/package.json index ba9af03310..402d09ade4 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -1,39 +1,39 @@ { "name": "example-app", - "version": "0.2.25", + "version": "0.2.26", "private": true, "bundled": true, "dependencies": { "@backstage/catalog-model": "^0.7.7", "@backstage/cli": "^0.6.9", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/integration-react": "^0.1.1", - "@backstage/plugin-api-docs": "^0.4.11", + "@backstage/plugin-api-docs": "^0.4.12", "@backstage/plugin-badges": "^0.2.0", - "@backstage/plugin-catalog": "^0.5.5", - "@backstage/plugin-catalog-import": "^0.5.3", + "@backstage/plugin-catalog": "^0.5.6", + "@backstage/plugin-catalog-import": "^0.5.4", "@backstage/plugin-catalog-react": "^0.1.3", - "@backstage/plugin-circleci": "^0.2.12", + "@backstage/plugin-circleci": "^0.2.13", "@backstage/plugin-cloudbuild": "^0.2.13", "@backstage/plugin-code-coverage": "^0.1.2", - "@backstage/plugin-cost-insights": "^0.8.4", - "@backstage/plugin-explore": "^0.3.2", + "@backstage/plugin-cost-insights": "^0.8.5", + "@backstage/plugin-explore": "^0.3.4", "@backstage/plugin-gcp-projects": "^0.2.5", - "@backstage/plugin-github-actions": "^0.4.2", - "@backstage/plugin-graphiql": "^0.2.9", - "@backstage/plugin-jenkins": "^0.4.1", + "@backstage/plugin-github-actions": "^0.4.4", + "@backstage/plugin-graphiql": "^0.2.10", + "@backstage/plugin-jenkins": "^0.4.2", "@backstage/plugin-kafka": "^0.2.6", "@backstage/plugin-kubernetes": "^0.4.2", - "@backstage/plugin-lighthouse": "^0.2.14", + "@backstage/plugin-lighthouse": "^0.2.15", "@backstage/plugin-newrelic": "^0.2.6", "@backstage/plugin-org": "^0.3.12", - "@backstage/plugin-pagerduty": "0.3.2", - "@backstage/plugin-rollbar": "^0.3.3", - "@backstage/plugin-scaffolder": "^0.9.1", - "@backstage/plugin-search": "^0.3.4", - "@backstage/plugin-sentry": "^0.3.8", + "@backstage/plugin-pagerduty": "0.3.3", + "@backstage/plugin-rollbar": "^0.3.4", + "@backstage/plugin-scaffolder": "^0.9.2", + "@backstage/plugin-search": "^0.3.5", + "@backstage/plugin-sentry": "^0.3.9", "@backstage/plugin-tech-radar": "^0.3.9", - "@backstage/plugin-techdocs": "^0.8.0", + "@backstage/plugin-techdocs": "^0.9.0", "@backstage/plugin-todo": "^0.1.0", "@backstage/plugin-user-settings": "^0.2.8", "@backstage/theme": "^0.2.6", diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 1b556ac1c3..974dcd3b91 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,13 @@ # @backstage/core +## 0.7.7 + +### Patch Changes + +- 9afcac5af: Allow passing NavLinkProps to SidebarItem component to use in NavLink +- e0c9ed759: Add `if` prop to `EntityLayout.Route` to conditionally render tabs +- 6eaecbd81: Improve owner example value in `MissingAnnotationEmptyState`. + ## 0.7.6 ### Patch Changes diff --git a/packages/core/package.json b/packages/core/package.json index 344ea10398..59391e122a 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/core", "description": "Core API used by Backstage plugins and apps", - "version": "0.7.6", + "version": "0.7.7", "private": false, "publishConfig": { "access": "public", diff --git a/packages/create-app/CHANGELOG.md b/packages/create-app/CHANGELOG.md index c821a3ab81..430e7f003a 100644 --- a/packages/create-app/CHANGELOG.md +++ b/packages/create-app/CHANGELOG.md @@ -1,5 +1,44 @@ # @backstage/create-app +## 0.3.20 + +### Patch Changes + +- 73f3f5d78: Updates the end to end test in the app to match the new catalog index page title. To apply this change to an existing app, update `packages/app/cypress/integration/app.js` to search for `"My Company Catalog"` instead of `"My Company Service Catalog"`. +- Updated dependencies [1ce80ff02] +- Updated dependencies [4c42ecca2] +- Updated dependencies [c614ede9a] +- Updated dependencies [9afcac5af] +- Updated dependencies [07a7806c3] +- Updated dependencies [f6efa71ee] +- Updated dependencies [19a4dd710] +- Updated dependencies [a99e0bc42] +- Updated dependencies [dcd54c7cd] +- Updated dependencies [da546ce00] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6fbd7beca] +- Updated dependencies [15cbe6815] +- Updated dependencies [39bdaa004] +- Updated dependencies [cb8c848a3] +- Updated dependencies [21fddf452] +- Updated dependencies [17915e29b] +- Updated dependencies [a1783f306] +- Updated dependencies [6eaecbd81] +- Updated dependencies [23769512a] +- Updated dependencies [1a142ae8a] + - @backstage/plugin-api-docs@0.4.12 + - @backstage/plugin-github-actions@0.4.4 + - @backstage/plugin-catalog-import@0.5.4 + - @backstage/plugin-explore@0.3.4 + - @backstage/plugin-lighthouse@0.2.15 + - @backstage/core@0.7.7 + - @backstage/plugin-scaffolder@0.9.2 + - @backstage/plugin-catalog@0.5.6 + - @backstage/plugin-catalog-backend@0.8.1 + - @backstage/plugin-search@0.3.5 + - @backstage/plugin-techdocs@0.9.0 + - @backstage/plugin-scaffolder-backend@0.10.1 + ## 0.3.19 ### Patch Changes diff --git a/packages/create-app/package.json b/packages/create-app/package.json index 5cf6cdd78e..071a0a5ebd 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.19", + "version": "0.3.20", "private": false, "publishConfig": { "access": "public" diff --git a/packages/techdocs-common/CHANGELOG.md b/packages/techdocs-common/CHANGELOG.md index 9dd6447a14..1788502e45 100644 --- a/packages/techdocs-common/CHANGELOG.md +++ b/packages/techdocs-common/CHANGELOG.md @@ -1,5 +1,11 @@ # @backstage/techdocs-common +## 0.5.1 + +### Patch Changes + +- f4af06ebe: Gracefully handle HTTP request failures in download method of AzureBlobStorage publisher. + ## 0.5.0 ### Minor Changes diff --git a/packages/techdocs-common/package.json b/packages/techdocs-common/package.json index c41dce72b1..e749b33919 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.5.0", + "version": "0.5.1", "main": "src/index.ts", "types": "src/index.ts", "private": false, diff --git a/plugins/api-docs/CHANGELOG.md b/plugins/api-docs/CHANGELOG.md index a2d5a28e41..f268ba1c4d 100644 --- a/plugins/api-docs/CHANGELOG.md +++ b/plugins/api-docs/CHANGELOG.md @@ -1,5 +1,19 @@ # @backstage/plugin-api-docs +## 0.4.12 + +### Patch Changes + +- 1ce80ff02: Resolve issues with AsyncAPI rendering by updating `@asyncapi/react-component` + to `0.23.0`. The theming of the component is adjusted to the latest styling + changes. +- c614ede9a: Updated README to have up-to-date install instructions. +- 07a7806c3: Added fields filtering in get API entities to avoid the requesting of unused data +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.4.11 ### Patch Changes diff --git a/plugins/api-docs/package.json b/plugins/api-docs/package.json index 532dacf684..5c9f9ca7ee 100644 --- a/plugins/api-docs/package.json +++ b/plugins/api-docs/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-api-docs", - "version": "0.4.11", + "version": "0.4.12", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,7 +31,7 @@ "dependencies": { "@asyncapi/react-component": "^0.23.0", "@backstage/catalog-model": "^0.7.7", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/plugin-catalog-react": "^0.1.4", "@backstage/theme": "^0.2.6", "@material-icons/font": "^1.0.2", diff --git a/plugins/badges/package.json b/plugins/badges/package.json index 9f0c49af7e..8f7b5865a1 100644 --- a/plugins/badges/package.json +++ b/plugins/badges/package.json @@ -21,7 +21,7 @@ }, "dependencies": { "@backstage/catalog-model": "^0.7.6", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/errors": "^0.1.1", "@backstage/plugin-catalog-react": "^0.1.3", "@backstage/theme": "^0.2.6", diff --git a/plugins/bitrise/CHANGELOG.md b/plugins/bitrise/CHANGELOG.md index 66314933bb..ecb26efd50 100644 --- a/plugins/bitrise/CHANGELOG.md +++ b/plugins/bitrise/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-bitrise +## 0.1.2 + +### Patch Changes + +- c614ede9a: Updated README to have up-to-date install instructions. +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.1.1 ### Patch Changes diff --git a/plugins/bitrise/package.json b/plugins/bitrise/package.json index 83911cdfc4..950392f732 100644 --- a/plugins/bitrise/package.json +++ b/plugins/bitrise/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-bitrise", - "version": "0.1.1", + "version": "0.1.2", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -21,7 +21,7 @@ }, "dependencies": { "@backstage/catalog-model": "^0.7.2", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/plugin-catalog-react": "^0.1.2", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", diff --git a/plugins/catalog-backend/CHANGELOG.md b/plugins/catalog-backend/CHANGELOG.md index 28efc1c5d3..ed87e4dbc5 100644 --- a/plugins/catalog-backend/CHANGELOG.md +++ b/plugins/catalog-backend/CHANGELOG.md @@ -1,5 +1,13 @@ # @backstage/plugin-catalog-backend +## 0.8.1 + +### Patch Changes + +- a99e0bc42: Entity lifecycle and owner are now indexed by the `DefaultCatalogCollator`. A `locationTemplate` may now optionally be provided to its constructor to reflect a custom catalog entity path in the Backstage frontend. +- Updated dependencies [e1e757569] + - @backstage/plugin-search-backend-node@0.1.4 + ## 0.8.0 ### Minor Changes diff --git a/plugins/catalog-backend/package.json b/plugins/catalog-backend/package.json index a5bb9e00af..7649067a44 100644 --- a/plugins/catalog-backend/package.json +++ b/plugins/catalog-backend/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-catalog-backend", - "version": "0.8.0", + "version": "0.8.1", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -35,7 +35,7 @@ "@backstage/config": "^0.1.4", "@backstage/errors": "^0.1.1", "@backstage/integration": "^0.5.1", - "@backstage/plugin-search-backend-node": "^0.1.3", + "@backstage/plugin-search-backend-node": "^0.1.4", "@backstage/search-common": "^0.1.1", "@octokit/graphql": "^4.5.8", "@types/express": "^4.17.6", diff --git a/plugins/catalog-import/CHANGELOG.md b/plugins/catalog-import/CHANGELOG.md index 8c189a5f9b..4b0d264a52 100644 --- a/plugins/catalog-import/CHANGELOG.md +++ b/plugins/catalog-import/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-catalog-import +## 0.5.4 + +### Patch Changes + +- c614ede9a: Updated README to have up-to-date install instructions. +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.5.3 ### Patch Changes diff --git a/plugins/catalog-import/package.json b/plugins/catalog-import/package.json index 9ba32d830c..ca540fe8be 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.3", + "version": "0.5.4", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -32,7 +32,7 @@ "dependencies": { "@backstage/catalog-model": "^0.7.6", "@backstage/catalog-client": "^0.3.9", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/integration": "^0.5.0", "@backstage/integration-react": "^0.1.1", "@backstage/plugin-catalog-react": "^0.1.4", diff --git a/plugins/catalog/CHANGELOG.md b/plugins/catalog/CHANGELOG.md index 35e000f130..d6254a347a 100644 --- a/plugins/catalog/CHANGELOG.md +++ b/plugins/catalog/CHANGELOG.md @@ -1,5 +1,18 @@ # @backstage/plugin-catalog +## 0.5.6 + +### Patch Changes + +- 19a4dd710: Removed unused `swr` dependency. +- da546ce00: Support `gridItem` variant for `EntityLinksCard`. +- e0c9ed759: Add `if` prop to `EntityLayout.Route` to conditionally render tabs +- 1a142ae8a: Switch out the time-based personal greeting for a plain title on the catalog index page, and remove the clocks for different timezones. +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.5.5 ### Patch Changes diff --git a/plugins/catalog/package.json b/plugins/catalog/package.json index 965a0b327b..4f54735611 100644 --- a/plugins/catalog/package.json +++ b/plugins/catalog/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-catalog", - "version": "0.5.5", + "version": "0.5.6", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -32,7 +32,7 @@ "dependencies": { "@backstage/catalog-client": "^0.3.10", "@backstage/catalog-model": "^0.7.7", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/errors": "^0.1.1", "@backstage/integration": "^0.5.1", "@backstage/integration-react": "^0.1.1", diff --git a/plugins/circleci/CHANGELOG.md b/plugins/circleci/CHANGELOG.md index ff01f44258..8c6d6e094d 100644 --- a/plugins/circleci/CHANGELOG.md +++ b/plugins/circleci/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-circleci +## 0.2.13 + +### Patch Changes + +- c614ede9a: Updated README to have up-to-date install instructions. +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.2.12 ### Patch Changes diff --git a/plugins/circleci/package.json b/plugins/circleci/package.json index 5c05c0ee6f..20c757eda0 100644 --- a/plugins/circleci/package.json +++ b/plugins/circleci/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-circleci", - "version": "0.2.12", + "version": "0.2.13", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -32,7 +32,7 @@ }, "dependencies": { "@backstage/catalog-model": "^0.7.3", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/plugin-catalog-react": "^0.1.2", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", diff --git a/plugins/cloudbuild/package.json b/plugins/cloudbuild/package.json index 6ad0b8bfa9..cb2a08fce1 100644 --- a/plugins/cloudbuild/package.json +++ b/plugins/cloudbuild/package.json @@ -32,7 +32,7 @@ "dependencies": { "@backstage/catalog-model": "^0.7.3", "@backstage/plugin-catalog-react": "^0.1.2", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", diff --git a/plugins/code-coverage-backend/CHANGELOG.md b/plugins/code-coverage-backend/CHANGELOG.md index cfc08db5c4..d7a0f136f5 100644 --- a/plugins/code-coverage-backend/CHANGELOG.md +++ b/plugins/code-coverage-backend/CHANGELOG.md @@ -1,5 +1,11 @@ # @backstage/plugin-code-coverage-backend +## 0.1.3 + +### Patch Changes + +- d47c2628b: Include migrations + ## 0.1.2 ### Patch Changes diff --git a/plugins/code-coverage-backend/package.json b/plugins/code-coverage-backend/package.json index 3ae76e3fe0..c2bebbf293 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.2", + "version": "0.1.3", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", diff --git a/plugins/code-coverage/package.json b/plugins/code-coverage/package.json index 1adc94fff7..f5c36811cc 100644 --- a/plugins/code-coverage/package.json +++ b/plugins/code-coverage/package.json @@ -22,7 +22,7 @@ "dependencies": { "@backstage/catalog-model": "^0.7.7", "@backstage/config": "^0.1.4", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/errors": "^0.1.1", "@backstage/plugin-catalog-react": "^0.1.4", "@backstage/theme": "^0.2.6", diff --git a/plugins/config-schema/package.json b/plugins/config-schema/package.json index 55f785a7a4..a017529400 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": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/errors": "^0.1.1", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", diff --git a/plugins/cost-insights/CHANGELOG.md b/plugins/cost-insights/CHANGELOG.md index 47fa9633bf..c86a71f8c9 100644 --- a/plugins/cost-insights/CHANGELOG.md +++ b/plugins/cost-insights/CHANGELOG.md @@ -1,5 +1,16 @@ # @backstage/plugin-cost-insights +## 0.8.5 + +### Patch Changes + +- b98de52ae: Support a `name` prop for Projects for display purposes +- c614ede9a: Updated README to have up-to-date install instructions. +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.8.4 ### Patch Changes diff --git a/plugins/cost-insights/package.json b/plugins/cost-insights/package.json index c68fdde509..39e3fe1791 100644 --- a/plugins/cost-insights/package.json +++ b/plugins/cost-insights/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-cost-insights", - "version": "0.8.4", + "version": "0.8.5", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,7 +31,7 @@ }, "dependencies": { "@backstage/config": "^0.1.3", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", diff --git a/plugins/explore/CHANGELOG.md b/plugins/explore/CHANGELOG.md index bebf6a8c44..78275577f5 100644 --- a/plugins/explore/CHANGELOG.md +++ b/plugins/explore/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-explore +## 0.3.4 + +### Patch Changes + +- c614ede9a: Updated README to have up-to-date install instructions. +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.3.3 ### Patch Changes diff --git a/plugins/explore/package.json b/plugins/explore/package.json index 7c2eb5c90d..be61bc1fd9 100644 --- a/plugins/explore/package.json +++ b/plugins/explore/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-explore", - "version": "0.3.3", + "version": "0.3.4", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,7 +31,7 @@ }, "dependencies": { "@backstage/catalog-model": "^0.7.5", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/plugin-catalog-react": "^0.1.4", "@backstage/plugin-explore-react": "^0.0.4", "@backstage/theme": "^0.2.6", diff --git a/plugins/fossa/CHANGELOG.md b/plugins/fossa/CHANGELOG.md index fe916804d2..bd7af91dca 100644 --- a/plugins/fossa/CHANGELOG.md +++ b/plugins/fossa/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-fossa +## 0.2.6 + +### Patch Changes + +- c614ede9a: Updated README to have up-to-date install instructions. +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.2.5 ### Patch Changes diff --git a/plugins/fossa/package.json b/plugins/fossa/package.json index 23f9cfde74..ba7e1a381e 100644 --- a/plugins/fossa/package.json +++ b/plugins/fossa/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-fossa", - "version": "0.2.5", + "version": "0.2.6", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -32,7 +32,7 @@ }, "dependencies": { "@backstage/catalog-model": "^0.7.3", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/errors": "^0.1.1", "@backstage/plugin-catalog-react": "^0.1.1", "@backstage/theme": "^0.2.6", diff --git a/plugins/gcp-projects/package.json b/plugins/gcp-projects/package.json index 509576cf2b..0930c791e4 100644 --- a/plugins/gcp-projects/package.json +++ b/plugins/gcp-projects/package.json @@ -30,7 +30,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", diff --git a/plugins/github-actions/CHANGELOG.md b/plugins/github-actions/CHANGELOG.md index a2c6e6bf1f..6896a7f877 100644 --- a/plugins/github-actions/CHANGELOG.md +++ b/plugins/github-actions/CHANGELOG.md @@ -1,5 +1,16 @@ # @backstage/plugin-github-actions +## 0.4.4 + +### Patch Changes + +- 4c42ecca2: Wrap EmptyState in Card +- c614ede9a: Updated README to have up-to-date install instructions. +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.4.3 ### Patch Changes diff --git a/plugins/github-actions/package.json b/plugins/github-actions/package.json index 6a95803d6f..2c26061cf3 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.3", + "version": "0.4.4", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -34,7 +34,7 @@ "dependencies": { "@backstage/catalog-model": "^0.7.5", "@backstage/plugin-catalog-react": "^0.1.4", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/integration": "^0.5.1", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", diff --git a/plugins/github-deployments/CHANGELOG.md b/plugins/github-deployments/CHANGELOG.md index e7f849ef2e..23c8943349 100644 --- a/plugins/github-deployments/CHANGELOG.md +++ b/plugins/github-deployments/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-github-deployments +## 0.1.4 + +### Patch Changes + +- c614ede9a: Updated README to have up-to-date install instructions. +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.1.3 ### Patch Changes diff --git a/plugins/github-deployments/package.json b/plugins/github-deployments/package.json index 12a36c160e..049e02de4c 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.3", + "version": "0.1.4", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -21,7 +21,7 @@ }, "dependencies": { "@backstage/catalog-model": "^0.7.6", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/plugin-catalog-react": "^0.1.3", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", diff --git a/plugins/gitops-profiles/package.json b/plugins/gitops-profiles/package.json index ae614fe504..d1897b018c 100644 --- a/plugins/gitops-profiles/package.json +++ b/plugins/gitops-profiles/package.json @@ -31,7 +31,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", diff --git a/plugins/graphiql/CHANGELOG.md b/plugins/graphiql/CHANGELOG.md index 67e39d6600..681005b13f 100644 --- a/plugins/graphiql/CHANGELOG.md +++ b/plugins/graphiql/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-graphiql +## 0.2.10 + +### Patch Changes + +- c614ede9a: Updated README to have up-to-date install instructions. +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.2.9 ### Patch Changes diff --git a/plugins/graphiql/package.json b/plugins/graphiql/package.json index 4aa26587ad..9ce1603b57 100644 --- a/plugins/graphiql/package.json +++ b/plugins/graphiql/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/plugin-graphiql", "description": "Backstage plugin for browsing GraphQL APIs", - "version": "0.2.9", + "version": "0.2.10", "private": false, "publishConfig": { "access": "public", @@ -31,7 +31,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", diff --git a/plugins/jenkins/CHANGELOG.md b/plugins/jenkins/CHANGELOG.md index ab57d71f61..ac734e9a95 100644 --- a/plugins/jenkins/CHANGELOG.md +++ b/plugins/jenkins/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-jenkins +## 0.4.2 + +### Patch Changes + +- c614ede9a: Updated README to have up-to-date install instructions. +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.4.1 ### Patch Changes diff --git a/plugins/jenkins/package.json b/plugins/jenkins/package.json index edee4bc2ee..d1cabd2143 100644 --- a/plugins/jenkins/package.json +++ b/plugins/jenkins/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-jenkins", - "version": "0.4.1", + "version": "0.4.2", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -32,7 +32,7 @@ }, "dependencies": { "@backstage/catalog-model": "^0.7.3", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/plugin-catalog-react": "^0.1.3", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", diff --git a/plugins/kafka/package.json b/plugins/kafka/package.json index a7295469d6..0963d3178f 100644 --- a/plugins/kafka/package.json +++ b/plugins/kafka/package.json @@ -21,7 +21,7 @@ }, "dependencies": { "@backstage/catalog-model": "^0.7.4", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/plugin-catalog-react": "^0.1.1", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", diff --git a/plugins/kubernetes/package.json b/plugins/kubernetes/package.json index 03013e1480..8d21c79a24 100644 --- a/plugins/kubernetes/package.json +++ b/plugins/kubernetes/package.json @@ -33,7 +33,7 @@ "dependencies": { "@backstage/catalog-model": "^0.7.4", "@backstage/config": "^0.1.4", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/plugin-catalog-react": "^0.1.3", "@backstage/plugin-kubernetes-backend": "^0.3.2", "@backstage/theme": "^0.2.6", diff --git a/plugins/lighthouse/CHANGELOG.md b/plugins/lighthouse/CHANGELOG.md index 26eb041442..cb2cb5b9d1 100644 --- a/plugins/lighthouse/CHANGELOG.md +++ b/plugins/lighthouse/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-lighthouse +## 0.2.15 + +### Patch Changes + +- c614ede9a: Updated README to have up-to-date install instructions. +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.2.14 ### Patch Changes diff --git a/plugins/lighthouse/package.json b/plugins/lighthouse/package.json index 45980df00c..2fce507756 100644 --- a/plugins/lighthouse/package.json +++ b/plugins/lighthouse/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-lighthouse", - "version": "0.2.14", + "version": "0.2.15", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -33,7 +33,7 @@ "dependencies": { "@backstage/catalog-model": "^0.7.3", "@backstage/config": "^0.1.4", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/plugin-catalog-react": "^0.1.2", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", diff --git a/plugins/newrelic/package.json b/plugins/newrelic/package.json index 0951d972c2..2dbb2a7eb8 100644 --- a/plugins/newrelic/package.json +++ b/plugins/newrelic/package.json @@ -31,7 +31,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", diff --git a/plugins/org/package.json b/plugins/org/package.json index 5bed02e9c8..9ad4704630 100644 --- a/plugins/org/package.json +++ b/plugins/org/package.json @@ -21,7 +21,7 @@ }, "dependencies": { "@backstage/catalog-model": "^0.7.6", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/core-api": "^0.2.16", "@backstage/plugin-catalog-react": "^0.1.4", "@backstage/theme": "^0.2.6", diff --git a/plugins/pagerduty/CHANGELOG.md b/plugins/pagerduty/CHANGELOG.md index 0cd9d0cfb8..b7fc7fec40 100644 --- a/plugins/pagerduty/CHANGELOG.md +++ b/plugins/pagerduty/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-pagerduty +## 0.3.3 + +### Patch Changes + +- c614ede9a: Updated README to have up-to-date install instructions. +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.3.2 ### Patch Changes diff --git a/plugins/pagerduty/package.json b/plugins/pagerduty/package.json index c0e3afec34..821b89a5b1 100644 --- a/plugins/pagerduty/package.json +++ b/plugins/pagerduty/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-pagerduty", - "version": "0.3.2", + "version": "0.3.3", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,7 +31,7 @@ }, "dependencies": { "@backstage/catalog-model": "^0.7.3", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/plugin-catalog-react": "^0.1.1", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", diff --git a/plugins/register-component/CHANGELOG.md b/plugins/register-component/CHANGELOG.md index 424887263c..3634972e9a 100644 --- a/plugins/register-component/CHANGELOG.md +++ b/plugins/register-component/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-register-component +## 0.2.14 + +### Patch Changes + +- c614ede9a: Updated README to have up-to-date install instructions. +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.2.13 ### Patch Changes diff --git a/plugins/register-component/package.json b/plugins/register-component/package.json index 2870ef79f1..38d1e3202e 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.13", + "version": "0.2.14", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,7 +31,7 @@ }, "dependencies": { "@backstage/catalog-model": "^0.7.5", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/plugin-catalog-react": "^0.1.4", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", diff --git a/plugins/rollbar/CHANGELOG.md b/plugins/rollbar/CHANGELOG.md index 2e9bc946a2..1d8c2c399e 100644 --- a/plugins/rollbar/CHANGELOG.md +++ b/plugins/rollbar/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-rollbar +## 0.3.4 + +### Patch Changes + +- c614ede9a: Updated README to have up-to-date install instructions. +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.3.3 ### Patch Changes diff --git a/plugins/rollbar/package.json b/plugins/rollbar/package.json index 6d654866af..64ea010b54 100644 --- a/plugins/rollbar/package.json +++ b/plugins/rollbar/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-rollbar", - "version": "0.3.3", + "version": "0.3.4", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -32,7 +32,7 @@ }, "dependencies": { "@backstage/catalog-model": "^0.7.3", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/plugin-catalog-react": "^0.1.1", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", diff --git a/plugins/scaffolder-backend/CHANGELOG.md b/plugins/scaffolder-backend/CHANGELOG.md index cb1855e041..f591568d44 100644 --- a/plugins/scaffolder-backend/CHANGELOG.md +++ b/plugins/scaffolder-backend/CHANGELOG.md @@ -1,5 +1,11 @@ # @backstage/plugin-scaffolder-backend +## 0.10.1 + +### Patch Changes + +- a1783f306: Added the `nebula-preview` preview to `Octokit` for repository visibility. + ## 0.10.0 ### Minor Changes diff --git a/plugins/scaffolder-backend/package.json b/plugins/scaffolder-backend/package.json index 729ef58d99..355bed4de0 100644 --- a/plugins/scaffolder-backend/package.json +++ b/plugins/scaffolder-backend/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-scaffolder-backend", - "version": "0.10.0", + "version": "0.10.1", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", diff --git a/plugins/scaffolder/CHANGELOG.md b/plugins/scaffolder/CHANGELOG.md index fee76f8775..1d0bbcede9 100644 --- a/plugins/scaffolder/CHANGELOG.md +++ b/plugins/scaffolder/CHANGELOG.md @@ -1,5 +1,17 @@ # @backstage/plugin-scaffolder +## 0.9.2 + +### Patch Changes + +- f6efa71ee: Enable starred templates on Scaffolder frontend +- 19a4dd710: Removed unused `swr` dependency. +- 23769512a: Support `anyOf`, `oneOf` and `allOf` schemas in the scaffolder template. +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.9.1 ### Patch Changes diff --git a/plugins/scaffolder/package.json b/plugins/scaffolder/package.json index 2b4feecb7b..3c2c308c24 100644 --- a/plugins/scaffolder/package.json +++ b/plugins/scaffolder/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-scaffolder", - "version": "0.9.1", + "version": "0.9.2", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -33,7 +33,7 @@ "@backstage/catalog-client": "^0.3.10", "@backstage/catalog-model": "^0.7.7", "@backstage/config": "^0.1.4", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/integration": "^0.5.1", "@backstage/integration-react": "^0.1.1", "@backstage/plugin-catalog-react": "^0.1.4", diff --git a/plugins/search-backend-node/CHANGELOG.md b/plugins/search-backend-node/CHANGELOG.md index e7a9d9aa0a..da49bd0726 100644 --- a/plugins/search-backend-node/CHANGELOG.md +++ b/plugins/search-backend-node/CHANGELOG.md @@ -1,5 +1,11 @@ # @backstage/plugin-search-backend-node +## 0.1.4 + +### Patch Changes + +- e1e757569: Introduced Scheduler which is responsible for adding new tasks to a schedule together with it's interval timer as well as starting and stopping the scheduler processes. + ## 0.1.3 ### Patch Changes diff --git a/plugins/search-backend-node/package.json b/plugins/search-backend-node/package.json index b5d13af01c..e39fbb5579 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.1.3", + "version": "0.1.4", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", diff --git a/plugins/search/CHANGELOG.md b/plugins/search/CHANGELOG.md index 35f3ee97c1..b4bcd1f855 100644 --- a/plugins/search/CHANGELOG.md +++ b/plugins/search/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-search +## 0.3.5 + +### Patch Changes + +- dcd54c7cd: Use `RouteRef` to generate path to search page. +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.3.4 ### Patch Changes diff --git a/plugins/search/package.json b/plugins/search/package.json index c7ab201efe..2b9db3444e 100644 --- a/plugins/search/package.json +++ b/plugins/search/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-search", - "version": "0.3.4", + "version": "0.3.5", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -29,7 +29,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/catalog-model": "^0.7.3", "@backstage/plugin-catalog-react": "^0.1.2", "@backstage/search-common": "^0.1.1", diff --git a/plugins/sentry/CHANGELOG.md b/plugins/sentry/CHANGELOG.md index dc45bcae60..261972384a 100644 --- a/plugins/sentry/CHANGELOG.md +++ b/plugins/sentry/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-sentry +## 0.3.9 + +### Patch Changes + +- c614ede9a: Updated README to have up-to-date install instructions. +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.3.8 ### Patch Changes diff --git a/plugins/sentry/package.json b/plugins/sentry/package.json index 9908af2e24..e34d8bcef9 100644 --- a/plugins/sentry/package.json +++ b/plugins/sentry/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-sentry", - "version": "0.3.8", + "version": "0.3.9", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -32,7 +32,7 @@ }, "dependencies": { "@backstage/catalog-model": "^0.7.3", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/plugin-catalog-react": "^0.1.1", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", diff --git a/plugins/sonarqube/CHANGELOG.md b/plugins/sonarqube/CHANGELOG.md index 0ed86737dd..48b9292791 100644 --- a/plugins/sonarqube/CHANGELOG.md +++ b/plugins/sonarqube/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-sonarqube +## 0.1.17 + +### Patch Changes + +- c614ede9a: Updated README to have up-to-date install instructions. +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.1.16 ### Patch Changes diff --git a/plugins/sonarqube/package.json b/plugins/sonarqube/package.json index 97243bb930..c31b99bac8 100644 --- a/plugins/sonarqube/package.json +++ b/plugins/sonarqube/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-sonarqube", - "version": "0.1.16", + "version": "0.1.17", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -34,7 +34,7 @@ "dependencies": { "@backstage/catalog-model": "^0.7.7", "@backstage/plugin-catalog-react": "^0.1.3", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", diff --git a/plugins/splunk-on-call/package.json b/plugins/splunk-on-call/package.json index ecaf21f8eb..9e93004bf5 100644 --- a/plugins/splunk-on-call/package.json +++ b/plugins/splunk-on-call/package.json @@ -31,7 +31,7 @@ }, "dependencies": { "@backstage/catalog-model": "^0.7.4", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/plugin-catalog-react": "^0.1.1", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", diff --git a/plugins/tech-radar/package.json b/plugins/tech-radar/package.json index 5a1c2e2095..37ad7d8211 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": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", diff --git a/plugins/techdocs/CHANGELOG.md b/plugins/techdocs/CHANGELOG.md index 4f89cd9844..847121c0cf 100644 --- a/plugins/techdocs/CHANGELOG.md +++ b/plugins/techdocs/CHANGELOG.md @@ -1,5 +1,31 @@ # @backstage/plugin-techdocs +## 0.9.0 + +### Minor Changes + +- 21fddf452: Make `techdocsStorageApiRef` and `techdocsApiRef` use interfaces instead of the + actual implementation classes. + + This renames the classes `TechDocsApi` to `TechDocsClient` and `TechDocsStorageApi` + to `TechDocsStorageClient` and renames the interfaces `TechDocs` to `TechDocsApi` + and `TechDocsStorage` to `TechDocsStorageApi` to comply the pattern elsewhere in + the project. This also fixes the types returned by some methods on those + interfaces. + +### Patch Changes + +- 6fbd7beca: Use `EntityRefLink` in header and use relations to reference the owner of the + document. +- 15cbe6815: Fix TechDocs landing page table wrong copied link +- 39bdaa004: Add customization and exportable components for TechDocs landing page +- cb8c848a3: Disable color transitions on links to avoid issues in dark mode. +- 17915e29b: Rework state management to avoid rendering multiple while navigating between pages. +- Updated dependencies [9afcac5af] +- Updated dependencies [e0c9ed759] +- Updated dependencies [6eaecbd81] + - @backstage/core@0.7.7 + ## 0.8.0 ### Minor Changes diff --git a/plugins/techdocs/package.json b/plugins/techdocs/package.json index 7bde151663..632feac3c1 100644 --- a/plugins/techdocs/package.json +++ b/plugins/techdocs/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-techdocs", - "version": "0.8.0", + "version": "0.9.0", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -33,7 +33,7 @@ "dependencies": { "@backstage/config": "^0.1.4", "@backstage/catalog-model": "^0.7.7", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/plugin-catalog-react": "^0.1.4", "@backstage/theme": "^0.2.6", "@backstage/errors": "^0.1.1", diff --git a/plugins/todo/package.json b/plugins/todo/package.json index 7339e568c3..92390857ef 100644 --- a/plugins/todo/package.json +++ b/plugins/todo/package.json @@ -27,7 +27,7 @@ }, "dependencies": { "@backstage/catalog-model": "^0.7.3", - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/errors": "^0.1.1", "@backstage/plugin-catalog-react": "^0.1.1", "@backstage/theme": "^0.2.6", diff --git a/plugins/user-settings/package.json b/plugins/user-settings/package.json index d410dc103e..08ae87d3ec 100644 --- a/plugins/user-settings/package.json +++ b/plugins/user-settings/package.json @@ -30,7 +30,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", diff --git a/plugins/welcome/package.json b/plugins/welcome/package.json index b276b86835..189b6eeb59 100644 --- a/plugins/welcome/package.json +++ b/plugins/welcome/package.json @@ -30,7 +30,7 @@ "start": "backstage-cli plugin:serve" }, "dependencies": { - "@backstage/core": "^0.7.6", + "@backstage/core": "^0.7.7", "@backstage/theme": "^0.2.6", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", From 86891fd2742b8b7624cb80619781aff0383b3385 Mon Sep 17 00:00:00 2001 From: Will Sewell Date: Thu, 29 Apr 2021 12:36:41 +0100 Subject: [PATCH 210/485] Rename 'param' -> 'parameter' in changeset Signed-off-by: Will Sewell --- .changeset/twenty-peas-deny.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/twenty-peas-deny.md b/.changeset/twenty-peas-deny.md index df335ea95a..d149a9337c 100644 --- a/.changeset/twenty-peas-deny.md +++ b/.changeset/twenty-peas-deny.md @@ -2,4 +2,4 @@ '@backstage/catalog-client': patch --- -Allow `filter` param to be specified multiple times +Allow `filter` parameter to be specified multiple times From 1d6159e40db6f665fb8396b5a097fc33ed84776a Mon Sep 17 00:00:00 2001 From: Juan Lulkin Date: Wed, 14 Apr 2021 17:53:48 +0200 Subject: [PATCH 211/485] kubernetes-common: Adds initial shared types and files Signed-off-by: Juan Lulkin --- packages/kubernetes-common/.eslintrc.js | 0 packages/kubernetes-common/CHANGELOG.md | 7 + packages/kubernetes-common/README.md | 3 + packages/kubernetes-common/package.json | 48 ++++++ packages/kubernetes-common/src/index.ts | 17 ++ packages/kubernetes-common/src/types.ts | 208 ++++++++++++++++++++++++ 6 files changed, 283 insertions(+) create mode 100644 packages/kubernetes-common/.eslintrc.js create mode 100644 packages/kubernetes-common/CHANGELOG.md create mode 100644 packages/kubernetes-common/README.md create mode 100644 packages/kubernetes-common/package.json create mode 100644 packages/kubernetes-common/src/index.ts create mode 100644 packages/kubernetes-common/src/types.ts diff --git a/packages/kubernetes-common/.eslintrc.js b/packages/kubernetes-common/.eslintrc.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/kubernetes-common/CHANGELOG.md b/packages/kubernetes-common/CHANGELOG.md new file mode 100644 index 0000000000..4b73dbafad --- /dev/null +++ b/packages/kubernetes-common/CHANGELOG.md @@ -0,0 +1,7 @@ +# @backstage/techdocs-common + +## 0.1.0 + +### Minor Changes + +- Adds the following types to be shared by the backend and the front end: \ No newline at end of file diff --git a/packages/kubernetes-common/README.md b/packages/kubernetes-common/README.md new file mode 100644 index 0000000000..db3989cdcb --- /dev/null +++ b/packages/kubernetes-common/README.md @@ -0,0 +1,3 @@ +# @backstage/kubernetes-common + +Common types and functionalities for kubernetes, to be shared between kubernetes and kubernetes-backend. \ No newline at end of file diff --git a/packages/kubernetes-common/package.json b/packages/kubernetes-common/package.json new file mode 100644 index 0000000000..ff541911ba --- /dev/null +++ b/packages/kubernetes-common/package.json @@ -0,0 +1,48 @@ +{ + "name": "@backstage/kubernetes-common", + "description": "Common functionalities for kubernetes, to be shared between kubernetes and kubernetes-backend plugin", + "version": "0.1.0", + "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" + }, + "homepage": "https://backstage.io", + "repository": { + "type": "git", + "url": "https://github.com/backstage/backstage", + "directory": "packages/kubernetes-common" + }, + "keywords": [ + "techdocs", + "kubernetes" + ], + "files": [ + "dist" + ], + "scripts": { + "build": "backstage-cli build --outputs cjs,types", + "lint": "backstage-cli lint", + "test": "backstage-cli test", + "prepack": "backstage-cli prepack", + "postpack": "backstage-cli postpack", + "clean": "backstage-cli clean" + }, + "bugs": { + "url": "https://github.com/backstage/backstage/issues" + }, + "dependencies": { + "@kubernetes/client-node": "^0.14.0" + }, + "devDependencies": { + "@backstage/cli": "^0.6.5" + }, + "jest": { + "roots": [ + ".." + ] + } +} diff --git a/packages/kubernetes-common/src/index.ts b/packages/kubernetes-common/src/index.ts new file mode 100644 index 0000000000..50e9534751 --- /dev/null +++ b/packages/kubernetes-common/src/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2020 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. + */ + +export * from './types'; diff --git a/packages/kubernetes-common/src/types.ts b/packages/kubernetes-common/src/types.ts new file mode 100644 index 0000000000..84ca08585b --- /dev/null +++ b/packages/kubernetes-common/src/types.ts @@ -0,0 +1,208 @@ +/* + * Copyright 2020 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 { + ExtensionsV1beta1Ingress, + V1ConfigMap, + V1Deployment, + V1HorizontalPodAutoscaler, + V1Pod, + V1ReplicaSet, + V1Service, +} from '@kubernetes/client-node'; +import { Entity } from '@backstage/catalog-model'; + +export interface ClusterDetails { + name: string; + url: string; + authProvider: string; + serviceAccountToken?: string | undefined; +} + +export interface KubernetesRequestBody { + auth?: { + google?: string; + }; + entity: Entity; +} + +export interface ClusterObjects { + cluster: { name: string }; + resources: FetchResponse[]; + errors: KubernetesFetchError[]; +} + +export interface ObjectsByEntityResponse { + items: ClusterObjects[]; +} + +export interface FetchResponseWrapper { + errors: KubernetesFetchError[]; + responses: FetchResponse[]; +} + +export type FetchResponse = + | PodFetchResponse + | ServiceFetchResponse + | ConfigMapFetchResponse + | DeploymentFetchResponse + | ReplicaSetsFetchResponse + | HorizontalPodAutoscalersFetchResponse + | IngressesFetchResponse + | CustomResourceFetchResponse; + +// TODO fairly sure there's a easier way to do this + +export type KubernetesObjectTypes = + | 'pods' + | 'services' + | 'configmaps' + | 'deployments' + | 'replicasets' + | 'horizontalpodautoscalers' + | 'ingresses' + | 'customresources'; + +export interface PodFetchResponse { + type: 'pods'; + resources: Array; +} + +export interface ServiceFetchResponse { + type: 'services'; + resources: Array; +} + +export interface ConfigMapFetchResponse { + type: 'configmaps'; + resources: Array; +} + +export interface DeploymentFetchResponse { + type: 'deployments'; + resources: Array; +} + +export interface ReplicaSetsFetchResponse { + type: 'replicasets'; + resources: Array; +} + +export interface HorizontalPodAutoscalersFetchResponse { + type: 'horizontalpodautoscalers'; + resources: Array; +} + +export interface IngressesFetchResponse { + type: 'ingresses'; + resources: Array; +} + +export interface CustomResourceFetchResponse { + type: 'customresources'; + resources: Array; +} + +export interface ObjectFetchParams { + serviceId: string; + clusterDetails: ClusterDetails; + objectTypesToFetch: Set; + labelSelector: string; + customResources: CustomResource[]; +} + +// Fetches information from a kubernetes cluster using the cluster details object +// to target a specific cluster +export interface KubernetesFetcher { + fetchObjectsForService( + params: ObjectFetchParams, + ): Promise; +} + +// Used to locate which cluster(s) a service is running on +export interface KubernetesServiceLocator { + getClustersByServiceId(serviceId: string): Promise; +} + +// Used to load cluster details from different sources +export interface KubernetesClustersSupplier { + getClusters(): Promise; +} + +export type KubernetesErrorTypes = + | 'BAD_REQUEST' + | 'UNAUTHORIZED_ERROR' + | 'SYSTEM_ERROR' + | 'UNKNOWN_ERROR'; + +export interface KubernetesFetchError { + errorType: KubernetesErrorTypes; + statusCode?: number; + resourcePath?: string; +} + +export interface ConfigClusterLocatorMethod { + /** + * @visibility frontend + */ + type: 'config'; + clusters: { + /** + * @visibility frontend + */ + url: string; + /** + * @visibility frontend + */ + name: string; + /** + * @visibility secret + */ + serviceAccountToken: string | undefined; + /** + * @visibility frontend + */ + authProvider: 'aws' | 'google' | 'serviceAccount'; + }[]; +} + +export interface GKEClusterLocatorMethod { + /** + * @visibility frontend + */ + type: 'gke'; + /** + * @visibility frontend + */ + projectId: string; + /** + * @visibility frontend + */ + region?: string; +} + +export type ClusterLocatorMethod = + | ConfigClusterLocatorMethod + | GKEClusterLocatorMethod; + +export type ServiceLocatorMethod = 'multiTenant' | 'http'; // TODO implement http +export type AuthProviderType = 'google' | 'serviceAccount' | 'aws'; + +export interface CustomResource { + group: string; + apiVersion: string; + plural: string; +} From 1f790d756fa6a796217b693eef109f872b80dfc1 Mon Sep 17 00:00:00 2001 From: Juan Lulkin Date: Wed, 14 Apr 2021 17:54:18 +0200 Subject: [PATCH 212/485] kubernetes-backend: Updates kube backend to reexport types from common Signed-off-by: Juan Lulkin --- plugins/kubernetes-backend/package.json | 1 + plugins/kubernetes-backend/src/types/types.ts | 208 ++---------------- 2 files changed, 16 insertions(+), 193 deletions(-) diff --git a/plugins/kubernetes-backend/package.json b/plugins/kubernetes-backend/package.json index 7a8b16bc8a..6c600f4d8b 100644 --- a/plugins/kubernetes-backend/package.json +++ b/plugins/kubernetes-backend/package.json @@ -34,6 +34,7 @@ "@backstage/backend-common": "^0.6.3", "@backstage/catalog-model": "^0.7.7", "@backstage/config": "^0.1.4", + "@backstage/kubernetes-common": "^0.1.0", "@google-cloud/container": "^2.2.0", "@kubernetes/client-node": "^0.14.0", "@types/express": "^4.17.6", diff --git a/plugins/kubernetes-backend/src/types/types.ts b/plugins/kubernetes-backend/src/types/types.ts index c597c718c5..2316740af0 100644 --- a/plugins/kubernetes-backend/src/types/types.ts +++ b/plugins/kubernetes-backend/src/types/types.ts @@ -14,196 +14,18 @@ * limitations under the License. */ -import { - ExtensionsV1beta1Ingress, - V1ConfigMap, - V1Deployment, - V1HorizontalPodAutoscaler, - V1Pod, - V1ReplicaSet, - V1Service, -} from '@kubernetes/client-node'; -import { Entity } from '@backstage/catalog-model'; - -export interface ClusterDetails { - name: string; - url: string; - authProvider: string; - serviceAccountToken?: string | undefined; - skipTLSVerify?: boolean; -} - -export interface KubernetesRequestBody { - auth?: { - google?: string; - }; - entity: Entity; -} - -export interface ClusterObjects { - cluster: { name: string }; - resources: FetchResponse[]; - errors: KubernetesFetchError[]; -} - -export interface ObjectsByEntityResponse { - items: ClusterObjects[]; -} - -export interface FetchResponseWrapper { - errors: KubernetesFetchError[]; - responses: FetchResponse[]; -} - -export type FetchResponse = - | PodFetchResponse - | ServiceFetchResponse - | ConfigMapFetchResponse - | DeploymentFetchResponse - | ReplicaSetsFetchResponse - | HorizontalPodAutoscalersFetchResponse - | IngressesFetchResponse - | CustomResourceFetchResponse; - -// TODO fairly sure there's a easier way to do this - -export type KubernetesObjectTypes = - | 'pods' - | 'services' - | 'configmaps' - | 'deployments' - | 'replicasets' - | 'horizontalpodautoscalers' - | 'ingresses' - | 'customresources'; - -export interface PodFetchResponse { - type: 'pods'; - resources: Array; -} - -export interface ServiceFetchResponse { - type: 'services'; - resources: Array; -} - -export interface ConfigMapFetchResponse { - type: 'configmaps'; - resources: Array; -} - -export interface DeploymentFetchResponse { - type: 'deployments'; - resources: Array; -} - -export interface ReplicaSetsFetchResponse { - type: 'replicasets'; - resources: Array; -} - -export interface HorizontalPodAutoscalersFetchResponse { - type: 'horizontalpodautoscalers'; - resources: Array; -} - -export interface IngressesFetchResponse { - type: 'ingresses'; - resources: Array; -} - -export interface CustomResourceFetchResponse { - type: 'customresources'; - resources: Array; -} - -export interface ObjectFetchParams { - serviceId: string; - clusterDetails: ClusterDetails; - objectTypesToFetch: Set; - labelSelector: string; - customResources: CustomResource[]; -} - -// Fetches information from a kubernetes cluster using the cluster details object -// to target a specific cluster -export interface KubernetesFetcher { - fetchObjectsForService( - params: ObjectFetchParams, - ): Promise; -} - -// Used to locate which cluster(s) a service is running on -export interface KubernetesServiceLocator { - getClustersByServiceId(serviceId: string): Promise; -} - -// Used to load cluster details from different sources -export interface KubernetesClustersSupplier { - getClusters(): Promise; -} - -export type KubernetesErrorTypes = - | 'BAD_REQUEST' - | 'UNAUTHORIZED_ERROR' - | 'SYSTEM_ERROR' - | 'UNKNOWN_ERROR'; - -export interface KubernetesFetchError { - errorType: KubernetesErrorTypes; - statusCode?: number; - resourcePath?: string; -} - -export interface ConfigClusterLocatorMethod { - /** - * @visibility frontend - */ - type: 'config'; - clusters: { - /** - * @visibility frontend - */ - url: string; - /** - * @visibility frontend - */ - name: string; - /** - * @visibility secret - */ - serviceAccountToken: string | undefined; - /** - * @visibility frontend - */ - authProvider: 'aws' | 'google' | 'serviceAccount'; - }[]; -} - -export interface GKEClusterLocatorMethod { - /** - * @visibility frontend - */ - type: 'gke'; - /** - * @visibility frontend - */ - projectId: string; - /** - * @visibility frontend - */ - region?: string; -} - -export type ClusterLocatorMethod = - | ConfigClusterLocatorMethod - | GKEClusterLocatorMethod; - -export type ServiceLocatorMethod = 'multiTenant' | 'http'; // TODO implement http -export type AuthProviderType = 'google' | 'serviceAccount' | 'aws'; - -export interface CustomResource { - group: string; - apiVersion: string; - plural: string; -} +export type { + ClusterDetails, + CustomResource, + FetchResponse, + FetchResponseWrapper, + KubernetesClustersSupplier, + KubernetesErrorTypes, + KubernetesFetchError, + KubernetesFetcher, + KubernetesObjectTypes, + KubernetesRequestBody, + KubernetesServiceLocator, + ObjectFetchParams, + ServiceLocatorMethod, +} from '@backstage/kubernetes-common'; From 0b61c22e0af1fdc74e74b5556cef9994b64b3c7e Mon Sep 17 00:00:00 2001 From: Juan Lulkin Date: Wed, 14 Apr 2021 17:55:09 +0200 Subject: [PATCH 213/485] kubernetes: Updates kubernetes frontend to use common Signed-off-by: Juan Lulkin --- plugins/kubernetes/package.json | 4 ++-- plugins/kubernetes/schema.d.ts | 2 +- plugins/kubernetes/src/api/KubernetesBackendClient.ts | 2 +- plugins/kubernetes/src/api/types.ts | 2 +- .../src/components/KubernetesContent/ErrorPanel.tsx | 2 +- .../src/components/KubernetesContent/KubernetesContent.tsx | 2 +- .../kubernetes/src/error-detection/error-detection.test.ts | 2 +- plugins/kubernetes/src/error-detection/error-detection.ts | 2 +- plugins/kubernetes/src/hooks/useKubernetesObjects.ts | 2 +- .../src/kubernetes-auth-provider/AwsKubernetesAuthProvider.ts | 2 +- .../kubernetes-auth-provider/GoogleKubernetesAuthProvider.ts | 2 +- .../src/kubernetes-auth-provider/KubernetesAuthProviders.ts | 2 +- .../ServiceAccountKubernetesAuthProvider.ts | 2 +- plugins/kubernetes/src/kubernetes-auth-provider/types.ts | 2 +- plugins/kubernetes/src/utils/response.ts | 2 +- 15 files changed, 16 insertions(+), 16 deletions(-) diff --git a/plugins/kubernetes/package.json b/plugins/kubernetes/package.json index 03013e1480..7c607b1776 100644 --- a/plugins/kubernetes/package.json +++ b/plugins/kubernetes/package.json @@ -34,8 +34,8 @@ "@backstage/catalog-model": "^0.7.4", "@backstage/config": "^0.1.4", "@backstage/core": "^0.7.6", - "@backstage/plugin-catalog-react": "^0.1.3", - "@backstage/plugin-kubernetes-backend": "^0.3.2", + "@backstage/kubernetes-common": "^0.1.0", + "@backstage/plugin-catalog-react": "^0.1.3", "@backstage/theme": "^0.2.6", "@kubernetes/client-node": "^0.14.0", "@material-ui/core": "^4.11.0", diff --git a/plugins/kubernetes/schema.d.ts b/plugins/kubernetes/schema.d.ts index 196f5ba76d..e421100760 100644 --- a/plugins/kubernetes/schema.d.ts +++ b/plugins/kubernetes/schema.d.ts @@ -17,7 +17,7 @@ import { ClusterLocatorMethod, CustomResource, -} from '@backstage/plugin-kubernetes-backend'; +} from '@backstage/kubernetes-common'; export interface Config { kubernetes?: { diff --git a/plugins/kubernetes/src/api/KubernetesBackendClient.ts b/plugins/kubernetes/src/api/KubernetesBackendClient.ts index 1eadec3fb0..0bbba7c8f7 100644 --- a/plugins/kubernetes/src/api/KubernetesBackendClient.ts +++ b/plugins/kubernetes/src/api/KubernetesBackendClient.ts @@ -19,7 +19,7 @@ import { KubernetesApi } from './types'; import { KubernetesRequestBody, ObjectsByEntityResponse, -} from '@backstage/plugin-kubernetes-backend'; +} from '@backstage/kubernetes-common'; export class KubernetesBackendClient implements KubernetesApi { private readonly discoveryApi: DiscoveryApi; diff --git a/plugins/kubernetes/src/api/types.ts b/plugins/kubernetes/src/api/types.ts index da1b36989a..a575aea4b8 100644 --- a/plugins/kubernetes/src/api/types.ts +++ b/plugins/kubernetes/src/api/types.ts @@ -18,7 +18,7 @@ import { createApiRef } from '@backstage/core'; import { KubernetesRequestBody, ObjectsByEntityResponse, -} from '@backstage/plugin-kubernetes-backend'; +} from '@backstage/kubernetes-common'; export const kubernetesApiRef = createApiRef({ id: 'plugin.kubernetes.service', diff --git a/plugins/kubernetes/src/components/KubernetesContent/ErrorPanel.tsx b/plugins/kubernetes/src/components/KubernetesContent/ErrorPanel.tsx index 650e6ddff1..2261cd5e3f 100644 --- a/plugins/kubernetes/src/components/KubernetesContent/ErrorPanel.tsx +++ b/plugins/kubernetes/src/components/KubernetesContent/ErrorPanel.tsx @@ -17,7 +17,7 @@ import React from 'react'; import { WarningPanel } from '@backstage/core'; import { Typography } from '@material-ui/core'; -import { ClusterObjects } from '@backstage/plugin-kubernetes-backend'; +import { ClusterObjects } from '@backstage/kubernetes-common'; const clustersWithErrorsToErrorMessage = ( clustersWithErrors: ClusterObjects[], diff --git a/plugins/kubernetes/src/components/KubernetesContent/KubernetesContent.tsx b/plugins/kubernetes/src/components/KubernetesContent/KubernetesContent.tsx index cda8dd7e6b..5b30c62949 100644 --- a/plugins/kubernetes/src/components/KubernetesContent/KubernetesContent.tsx +++ b/plugins/kubernetes/src/components/KubernetesContent/KubernetesContent.tsx @@ -31,7 +31,7 @@ import { StatusOK, } from '@backstage/core'; import { Entity } from '@backstage/catalog-model'; -import { ClusterObjects } from '@backstage/plugin-kubernetes-backend'; +import { ClusterObjects } from '@backstage/kubernetes-common'; import { ErrorPanel } from './ErrorPanel'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import { DeploymentsAccordions } from '../DeploymentsAccordions'; diff --git a/plugins/kubernetes/src/error-detection/error-detection.test.ts b/plugins/kubernetes/src/error-detection/error-detection.test.ts index 8a4575c8be..50cf81a522 100644 --- a/plugins/kubernetes/src/error-detection/error-detection.test.ts +++ b/plugins/kubernetes/src/error-detection/error-detection.test.ts @@ -30,7 +30,7 @@ import * as maxedOutHpa from './__fixtures__/hpa-maxed-out.json'; import { FetchResponse, ObjectsByEntityResponse, -} from '@backstage/plugin-kubernetes-backend'; +} from '@backstage/kubernetes-common'; const CLUSTER_NAME = 'cluster-a'; diff --git a/plugins/kubernetes/src/error-detection/error-detection.ts b/plugins/kubernetes/src/error-detection/error-detection.ts index a44747969d..5cffbc181f 100644 --- a/plugins/kubernetes/src/error-detection/error-detection.ts +++ b/plugins/kubernetes/src/error-detection/error-detection.ts @@ -15,7 +15,7 @@ */ import { DetectedError, DetectedErrorsByCluster } from './types'; -import { ObjectsByEntityResponse } from '@backstage/plugin-kubernetes-backend'; +import { ObjectsByEntityResponse } from '@backstage/kubernetes-common'; import { groupResponses } from '../utils/response'; import { detectErrorsInPods } from './pods'; import { detectErrorsInDeployments } from './deployments'; diff --git a/plugins/kubernetes/src/hooks/useKubernetesObjects.ts b/plugins/kubernetes/src/hooks/useKubernetesObjects.ts index 7c4de9ff1a..44434ec8f5 100644 --- a/plugins/kubernetes/src/hooks/useKubernetesObjects.ts +++ b/plugins/kubernetes/src/hooks/useKubernetesObjects.ts @@ -22,7 +22,7 @@ import { useEffect, useState } from 'react'; import { KubernetesRequestBody, ObjectsByEntityResponse, -} from '@backstage/plugin-kubernetes-backend'; +} from '@backstage/kubernetes-common'; export interface KubernetesObjects { kubernetesObjects: ObjectsByEntityResponse | undefined; diff --git a/plugins/kubernetes/src/kubernetes-auth-provider/AwsKubernetesAuthProvider.ts b/plugins/kubernetes/src/kubernetes-auth-provider/AwsKubernetesAuthProvider.ts index cab81f3622..cb14574bdc 100644 --- a/plugins/kubernetes/src/kubernetes-auth-provider/AwsKubernetesAuthProvider.ts +++ b/plugins/kubernetes/src/kubernetes-auth-provider/AwsKubernetesAuthProvider.ts @@ -15,7 +15,7 @@ */ import { KubernetesAuthProvider } from './types'; -import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-backend'; +import { KubernetesRequestBody } from '@backstage/kubernetes-common'; export class AwsKubernetesAuthProvider implements KubernetesAuthProvider { async decorateRequestBodyForAuth( diff --git a/plugins/kubernetes/src/kubernetes-auth-provider/GoogleKubernetesAuthProvider.ts b/plugins/kubernetes/src/kubernetes-auth-provider/GoogleKubernetesAuthProvider.ts index 570806a1a4..649f0c14da 100644 --- a/plugins/kubernetes/src/kubernetes-auth-provider/GoogleKubernetesAuthProvider.ts +++ b/plugins/kubernetes/src/kubernetes-auth-provider/GoogleKubernetesAuthProvider.ts @@ -16,7 +16,7 @@ import { OAuthApi } from '@backstage/core'; import { KubernetesAuthProvider } from './types'; -import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-backend'; +import { KubernetesRequestBody } from '@backstage/kubernetes-common'; export class GoogleKubernetesAuthProvider implements KubernetesAuthProvider { authProvider: OAuthApi; diff --git a/plugins/kubernetes/src/kubernetes-auth-provider/KubernetesAuthProviders.ts b/plugins/kubernetes/src/kubernetes-auth-provider/KubernetesAuthProviders.ts index dc9d9b5e0d..bc74b2717f 100644 --- a/plugins/kubernetes/src/kubernetes-auth-provider/KubernetesAuthProviders.ts +++ b/plugins/kubernetes/src/kubernetes-auth-provider/KubernetesAuthProviders.ts @@ -15,7 +15,7 @@ */ import { OAuthApi } from '@backstage/core'; -import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-backend'; +import { KubernetesRequestBody } from '@backstage/kubernetes-common'; import { KubernetesAuthProvider, KubernetesAuthProvidersApi } from './types'; import { GoogleKubernetesAuthProvider } from './GoogleKubernetesAuthProvider'; import { ServiceAccountKubernetesAuthProvider } from './ServiceAccountKubernetesAuthProvider'; diff --git a/plugins/kubernetes/src/kubernetes-auth-provider/ServiceAccountKubernetesAuthProvider.ts b/plugins/kubernetes/src/kubernetes-auth-provider/ServiceAccountKubernetesAuthProvider.ts index 5d33521ae4..f54c51bf48 100644 --- a/plugins/kubernetes/src/kubernetes-auth-provider/ServiceAccountKubernetesAuthProvider.ts +++ b/plugins/kubernetes/src/kubernetes-auth-provider/ServiceAccountKubernetesAuthProvider.ts @@ -15,7 +15,7 @@ */ import { KubernetesAuthProvider } from './types'; -import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-backend'; +import { KubernetesRequestBody } from '@backstage/kubernetes-common'; export class ServiceAccountKubernetesAuthProvider implements KubernetesAuthProvider { diff --git a/plugins/kubernetes/src/kubernetes-auth-provider/types.ts b/plugins/kubernetes/src/kubernetes-auth-provider/types.ts index 2bed2838b9..afb2615939 100644 --- a/plugins/kubernetes/src/kubernetes-auth-provider/types.ts +++ b/plugins/kubernetes/src/kubernetes-auth-provider/types.ts @@ -15,7 +15,7 @@ */ import { createApiRef } from '@backstage/core'; -import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-backend'; +import { KubernetesRequestBody } from '@backstage/kubernetes-common'; export interface KubernetesAuthProvider { decorateRequestBodyForAuth( diff --git a/plugins/kubernetes/src/utils/response.ts b/plugins/kubernetes/src/utils/response.ts index a9b10e7759..a38010ba74 100644 --- a/plugins/kubernetes/src/utils/response.ts +++ b/plugins/kubernetes/src/utils/response.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { FetchResponse } from '@backstage/plugin-kubernetes-backend'; +import { FetchResponse } from '@backstage/kubernetes-common'; import { GroupedResponses } from '../types/types'; // TODO this could probably be a lodash groupBy From f53fba29f6559c4ca0560100e1bccdef424a6476 Mon Sep 17 00:00:00 2001 From: Juan Lulkin Date: Wed, 14 Apr 2021 18:15:47 +0200 Subject: [PATCH 214/485] kubernetes-common: Adds changeset and fixes linting Signed-off-by: Juan Lulkin --- .changeset/silly-tables-build.md | 6 ++++++ packages/kubernetes-common/.eslintrc.js | 3 +++ packages/kubernetes-common/CHANGELOG.md | 2 +- packages/kubernetes-common/README.md | 2 +- packages/kubernetes-common/package.json | 1 + 5 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 .changeset/silly-tables-build.md diff --git a/.changeset/silly-tables-build.md b/.changeset/silly-tables-build.md new file mode 100644 index 0000000000..3f7b3182dd --- /dev/null +++ b/.changeset/silly-tables-build.md @@ -0,0 +1,6 @@ +--- +'@backstage/plugin-kubernetes': patch +'@backstage/plugin-kubernetes-backend': patch +--- + +Adds @backstage/kubernetes-common library to share types between kubernetes frontend and backend. diff --git a/packages/kubernetes-common/.eslintrc.js b/packages/kubernetes-common/.eslintrc.js index e69de29bb2..16a033dbc6 100644 --- a/packages/kubernetes-common/.eslintrc.js +++ b/packages/kubernetes-common/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + extends: [require.resolve('@backstage/cli/config/eslint.backend')], +}; diff --git a/packages/kubernetes-common/CHANGELOG.md b/packages/kubernetes-common/CHANGELOG.md index 4b73dbafad..a10c37c7d1 100644 --- a/packages/kubernetes-common/CHANGELOG.md +++ b/packages/kubernetes-common/CHANGELOG.md @@ -4,4 +4,4 @@ ### Minor Changes -- Adds the following types to be shared by the backend and the front end: \ No newline at end of file +- Adds types to be shared by the backend and the front end. diff --git a/packages/kubernetes-common/README.md b/packages/kubernetes-common/README.md index db3989cdcb..0034efbbff 100644 --- a/packages/kubernetes-common/README.md +++ b/packages/kubernetes-common/README.md @@ -1,3 +1,3 @@ # @backstage/kubernetes-common -Common types and functionalities for kubernetes, to be shared between kubernetes and kubernetes-backend. \ No newline at end of file +Common types and functionalities for kubernetes, to be shared between kubernetes and kubernetes-backend. diff --git a/packages/kubernetes-common/package.json b/packages/kubernetes-common/package.json index ff541911ba..9494b29ed0 100644 --- a/packages/kubernetes-common/package.json +++ b/packages/kubernetes-common/package.json @@ -35,6 +35,7 @@ "url": "https://github.com/backstage/backstage/issues" }, "dependencies": { + "@backstage/catalog-model": "^0.7.6", "@kubernetes/client-node": "^0.14.0" }, "devDependencies": { From 0cd313a7a9f0b14a126fe432e6e56a4ecfacdc31 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 29 Apr 2021 14:11:47 +0200 Subject: [PATCH 215/485] Rename GitReleaseApiClient file Signed-off-by: Erik Engervall --- ...luginApiClient.test.ts => GitReleaseApiClient.test.ts} | 8 ++++---- .../api/{PluginApiClient.ts => GitReleaseApiClient.ts} | 0 plugins/git-release-manager/src/api/serviceApiRef.ts | 2 +- .../CreateReleaseCandidate/CreateReleaseCandidate.tsx | 2 +- .../hooks/useCreateReleaseCandidate.ts | 2 +- plugins/git-release-manager/src/features/Info/Info.tsx | 2 +- plugins/git-release-manager/src/features/Patch/Patch.tsx | 2 +- .../git-release-manager/src/features/Patch/PatchBody.tsx | 2 +- .../src/features/Patch/hooks/usePatch.ts | 2 +- .../src/features/PromoteRc/PromoteRc.tsx | 2 +- .../src/features/PromoteRc/PromoteRcBody.tsx | 2 +- .../src/features/PromoteRc/hooks/usePromoteRc.ts | 2 +- .../src/features/Stats/helpers/getMappedReleases.tsx | 2 +- .../src/features/Stats/helpers/getReleaseStats.tsx | 2 +- .../src/helpers/getReleaseCandidateGitInfo.ts | 2 +- .../git-release-manager/src/hooks/useGetGitBatchInfo.ts | 2 +- plugins/git-release-manager/src/plugin.ts | 2 +- .../git-release-manager/src/test-helpers/test-helpers.ts | 2 +- 18 files changed, 20 insertions(+), 20 deletions(-) rename plugins/git-release-manager/src/api/{PluginApiClient.test.ts => GitReleaseApiClient.test.ts} (89%) rename plugins/git-release-manager/src/api/{PluginApiClient.ts => GitReleaseApiClient.ts} (100%) diff --git a/plugins/git-release-manager/src/api/PluginApiClient.test.ts b/plugins/git-release-manager/src/api/GitReleaseApiClient.test.ts similarity index 89% rename from plugins/git-release-manager/src/api/PluginApiClient.test.ts rename to plugins/git-release-manager/src/api/GitReleaseApiClient.test.ts index efb0a32ee7..4d89e5b2e6 100644 --- a/plugins/git-release-manager/src/api/PluginApiClient.test.ts +++ b/plugins/git-release-manager/src/api/GitReleaseApiClient.test.ts @@ -16,20 +16,20 @@ import { ConfigReader, OAuthApi } from '@backstage/core'; -import { GitReleaseApiClient } from './PluginApiClient'; +import { GitReleaseApiClient } from './GitReleaseApiClient'; -describe('PluginApiClient', () => { +describe('GitReleaseApiClient', () => { it('should return the default plugin api client', () => { const configApi = new ConfigReader({}); const githubAuthApi: OAuthApi = { getAccessToken: jest.fn(), }; - const pluginApiClient = new GitReleaseApiClient({ + const gitReleaseApiClient = new GitReleaseApiClient({ configApi, githubAuthApi, }); - expect(pluginApiClient).toMatchInlineSnapshot(` + expect(gitReleaseApiClient).toMatchInlineSnapshot(` GitReleaseApiClient { "baseUrl": "https://api.github.com", "createRc": Object { diff --git a/plugins/git-release-manager/src/api/PluginApiClient.ts b/plugins/git-release-manager/src/api/GitReleaseApiClient.ts similarity index 100% rename from plugins/git-release-manager/src/api/PluginApiClient.ts rename to plugins/git-release-manager/src/api/GitReleaseApiClient.ts diff --git a/plugins/git-release-manager/src/api/serviceApiRef.ts b/plugins/git-release-manager/src/api/serviceApiRef.ts index b2652aac65..d8c9887fcb 100644 --- a/plugins/git-release-manager/src/api/serviceApiRef.ts +++ b/plugins/git-release-manager/src/api/serviceApiRef.ts @@ -16,7 +16,7 @@ import { createApiRef } from '@backstage/core'; -import { GitReleaseApi } from './PluginApiClient'; +import { GitReleaseApi } from './GitReleaseApiClient'; export const gitReleaseManagerApiRef = createApiRef({ id: 'plugin.git-release-manager.service', diff --git a/plugins/git-release-manager/src/features/CreateReleaseCandidate/CreateReleaseCandidate.tsx b/plugins/git-release-manager/src/features/CreateReleaseCandidate/CreateReleaseCandidate.tsx index 0f19322a17..cdbd79382e 100644 --- a/plugins/git-release-manager/src/features/CreateReleaseCandidate/CreateReleaseCandidate.tsx +++ b/plugins/git-release-manager/src/features/CreateReleaseCandidate/CreateReleaseCandidate.tsx @@ -29,7 +29,7 @@ import { GetBranchResult, GetLatestReleaseResult, GetRepositoryResult, -} from '../../api/PluginApiClient'; +} from '../../api/GitReleaseApiClient'; import { ComponentConfigCreateRc } from '../../types/types'; import { Differ } from '../../components/Differ'; import { getReleaseCandidateGitInfo } from '../../helpers/getReleaseCandidateGitInfo'; diff --git a/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts b/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts index d922658d2c..236ba7edbf 100644 --- a/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts +++ b/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts @@ -21,7 +21,7 @@ import { useApi } from '@backstage/core'; import { GetLatestReleaseResult, GetRepositoryResult, -} from '../../../api/PluginApiClient'; +} from '../../../api/GitReleaseApiClient'; import { CardHook, ComponentConfigCreateRc } from '../../../types/types'; import { getReleaseCandidateGitInfo } from '../../../helpers/getReleaseCandidateGitInfo'; import { gitReleaseManagerApiRef } from '../../../api/serviceApiRef'; diff --git a/plugins/git-release-manager/src/features/Info/Info.tsx b/plugins/git-release-manager/src/features/Info/Info.tsx index e6be3b45de..a0cdc0bdd4 100644 --- a/plugins/git-release-manager/src/features/Info/Info.tsx +++ b/plugins/git-release-manager/src/features/Info/Info.tsx @@ -21,7 +21,7 @@ import BarChartIcon from '@material-ui/icons/BarChart'; import { GetBranchResult, GetLatestReleaseResult, -} from '../../api/PluginApiClient'; +} from '../../api/GitReleaseApiClient'; import { Differ } from '../../components/Differ'; import { InfoCardPlus } from '../../components/InfoCardPlus'; import { Stats } from '../Stats/Stats'; diff --git a/plugins/git-release-manager/src/features/Patch/Patch.tsx b/plugins/git-release-manager/src/features/Patch/Patch.tsx index d01a366ffb..7ceb570c58 100644 --- a/plugins/git-release-manager/src/features/Patch/Patch.tsx +++ b/plugins/git-release-manager/src/features/Patch/Patch.tsx @@ -21,7 +21,7 @@ import { Alert, AlertTitle } from '@material-ui/lab'; import { GetBranchResult, GetLatestReleaseResult, -} from '../../api/PluginApiClient'; +} from '../../api/GitReleaseApiClient'; import { ComponentConfigPatch } from '../../types/types'; import { getBumpedTag } from '../../helpers/getBumpedTag'; import { InfoCardPlus } from '../../components/InfoCardPlus'; diff --git a/plugins/git-release-manager/src/features/Patch/PatchBody.tsx b/plugins/git-release-manager/src/features/Patch/PatchBody.tsx index 8ab21e1112..ab2769e2a1 100644 --- a/plugins/git-release-manager/src/features/Patch/PatchBody.tsx +++ b/plugins/git-release-manager/src/features/Patch/PatchBody.tsx @@ -37,7 +37,7 @@ import { useApi } from '@backstage/core'; import { GetBranchResult, GetLatestReleaseResult, -} from '../../api/PluginApiClient'; +} from '../../api/GitReleaseApiClient'; import { CalverTagParts } from '../../helpers/tagParts/getCalverTagParts'; import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; import { ComponentConfigPatch } from '../../types/types'; diff --git a/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts b/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts index dc13e65ea7..4ad29d1699 100644 --- a/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts +++ b/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts @@ -21,7 +21,7 @@ import { useApi } from '@backstage/core'; import { GetLatestReleaseResult, GetRecentCommitsResultSingle, -} from '../../../api/PluginApiClient'; +} from '../../../api/GitReleaseApiClient'; import { CalverTagParts } from '../../../helpers/tagParts/getCalverTagParts'; import { ComponentConfigPatch, CardHook } from '../../../types/types'; import { gitReleaseManagerApiRef } from '../../../api/serviceApiRef'; diff --git a/plugins/git-release-manager/src/features/PromoteRc/PromoteRc.tsx b/plugins/git-release-manager/src/features/PromoteRc/PromoteRc.tsx index 16dd8de38c..915330aaf4 100644 --- a/plugins/git-release-manager/src/features/PromoteRc/PromoteRc.tsx +++ b/plugins/git-release-manager/src/features/PromoteRc/PromoteRc.tsx @@ -19,7 +19,7 @@ import { Alert, AlertTitle } from '@material-ui/lab'; import { Typography } from '@material-ui/core'; import { ComponentConfigPromoteRc } from '../../types/types'; -import { GetLatestReleaseResult } from '../../api/PluginApiClient'; +import { GetLatestReleaseResult } from '../../api/GitReleaseApiClient'; import { InfoCardPlus } from '../../components/InfoCardPlus'; import { NoLatestRelease } from '../../components/NoLatestRelease'; import { PromoteRcBody } from './PromoteRcBody'; diff --git a/plugins/git-release-manager/src/features/PromoteRc/PromoteRcBody.tsx b/plugins/git-release-manager/src/features/PromoteRc/PromoteRcBody.tsx index 5dfe4b13aa..6841c21d86 100644 --- a/plugins/git-release-manager/src/features/PromoteRc/PromoteRcBody.tsx +++ b/plugins/git-release-manager/src/features/PromoteRc/PromoteRcBody.tsx @@ -19,7 +19,7 @@ import { Button, Typography } from '@material-ui/core'; import { ComponentConfigPromoteRc } from '../../types/types'; import { Differ } from '../../components/Differ'; -import { GetLatestReleaseResult } from '../../api/PluginApiClient'; +import { GetLatestReleaseResult } from '../../api/GitReleaseApiClient'; import { ResponseStepDialog } from '../../components/ResponseStepDialog/ResponseStepDialog'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { usePromoteRc } from './hooks/usePromoteRc'; diff --git a/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts b/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts index ba236b29ce..7a106c3e51 100644 --- a/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts +++ b/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts @@ -19,7 +19,7 @@ import { useAsync, useAsyncFn } from 'react-use'; import { useApi } from '@backstage/core'; import { CardHook, ComponentConfigPromoteRc } from '../../../types/types'; -import { GetLatestReleaseResult } from '../../../api/PluginApiClient'; +import { GetLatestReleaseResult } from '../../../api/GitReleaseApiClient'; import { gitReleaseManagerApiRef } from '../../../api/serviceApiRef'; import { useProjectContext } from '../../../contexts/ProjectContext'; import { useResponseSteps } from '../../../hooks/useResponseSteps'; diff --git a/plugins/git-release-manager/src/features/Stats/helpers/getMappedReleases.tsx b/plugins/git-release-manager/src/features/Stats/helpers/getMappedReleases.tsx index 55382100ac..2cbea22664 100644 --- a/plugins/git-release-manager/src/features/Stats/helpers/getMappedReleases.tsx +++ b/plugins/git-release-manager/src/features/Stats/helpers/getMappedReleases.tsx @@ -15,7 +15,7 @@ */ import { calverRegexp } from '../../../helpers/tagParts/getCalverTagParts'; -import { GetAllReleasesResult } from '../../../api/PluginApiClient'; +import { GetAllReleasesResult } from '../../../api/GitReleaseApiClient'; import { Project } from '../../../contexts/ProjectContext'; import { ReleaseStats } from '../contexts/ReleaseStatsContext'; import { semverRegexp } from '../../../helpers/tagParts/getSemverTagParts'; diff --git a/plugins/git-release-manager/src/features/Stats/helpers/getReleaseStats.tsx b/plugins/git-release-manager/src/features/Stats/helpers/getReleaseStats.tsx index 9b77cc1223..41ce41b1ac 100644 --- a/plugins/git-release-manager/src/features/Stats/helpers/getReleaseStats.tsx +++ b/plugins/git-release-manager/src/features/Stats/helpers/getReleaseStats.tsx @@ -15,7 +15,7 @@ */ import { calverRegexp } from '../../../helpers/tagParts/getCalverTagParts'; -import { GetAllTagsResult } from '../../../api/PluginApiClient'; +import { GetAllTagsResult } from '../../../api/GitReleaseApiClient'; import { Project } from '../../../contexts/ProjectContext'; import { ReleaseStats } from '../contexts/ReleaseStatsContext'; import { semverRegexp } from '../../../helpers/tagParts/getSemverTagParts'; diff --git a/plugins/git-release-manager/src/helpers/getReleaseCandidateGitInfo.ts b/plugins/git-release-manager/src/helpers/getReleaseCandidateGitInfo.ts index bef2e63d44..ce4a9c0c80 100644 --- a/plugins/git-release-manager/src/helpers/getReleaseCandidateGitInfo.ts +++ b/plugins/git-release-manager/src/helpers/getReleaseCandidateGitInfo.ts @@ -17,7 +17,7 @@ import { DateTime } from 'luxon'; import { getBumpedSemverTagParts } from './getBumpedTag'; -import { GetLatestReleaseResult } from '../api/PluginApiClient'; +import { GetLatestReleaseResult } from '../api/GitReleaseApiClient'; import { getSemverTagParts } from './tagParts/getSemverTagParts'; import { Project } from '../contexts/ProjectContext'; import { SEMVER_PARTS } from '../constants/constants'; diff --git a/plugins/git-release-manager/src/hooks/useGetGitBatchInfo.ts b/plugins/git-release-manager/src/hooks/useGetGitBatchInfo.ts index 6469b275b5..653f91e3a5 100644 --- a/plugins/git-release-manager/src/hooks/useGetGitBatchInfo.ts +++ b/plugins/git-release-manager/src/hooks/useGetGitBatchInfo.ts @@ -16,7 +16,7 @@ import { useAsync } from 'react-use'; -import { GitReleaseApi } from '../api/PluginApiClient'; +import { GitReleaseApi } from '../api/GitReleaseApiClient'; import { Project } from '../contexts/ProjectContext'; interface GetGitBatchInfo { diff --git a/plugins/git-release-manager/src/plugin.ts b/plugins/git-release-manager/src/plugin.ts index 0760f6a393..de5a945de3 100644 --- a/plugins/git-release-manager/src/plugin.ts +++ b/plugins/git-release-manager/src/plugin.ts @@ -23,7 +23,7 @@ import { } from '@backstage/core'; import { gitReleaseManagerApiRef } from './api/serviceApiRef'; -import { GitReleaseApiClient } from './api/PluginApiClient'; +import { GitReleaseApiClient } from './api/GitReleaseApiClient'; import { rootRouteRef } from './routes'; export { gitReleaseManagerApiRef }; diff --git a/plugins/git-release-manager/src/test-helpers/test-helpers.ts b/plugins/git-release-manager/src/test-helpers/test-helpers.ts index cbf287a5cf..4dbcb9ce10 100644 --- a/plugins/git-release-manager/src/test-helpers/test-helpers.ts +++ b/plugins/git-release-manager/src/test-helpers/test-helpers.ts @@ -19,7 +19,7 @@ import { GetLatestReleaseResult, GetRecentCommitsResultSingle, GitReleaseApi, -} from '../api/PluginApiClient'; +} from '../api/GitReleaseApiClient'; import { CalverTagParts } from '../helpers/tagParts/getCalverTagParts'; import { Project } from '../contexts/ProjectContext'; import { getReleaseCandidateGitInfo } from '../helpers/getReleaseCandidateGitInfo'; From 1cf63d00df1abc0d62f0f1f0f57e3750a46b86db Mon Sep 17 00:00:00 2001 From: Juan Lulkin Date: Thu, 15 Apr 2021 10:21:25 +0200 Subject: [PATCH 216/485] plugin-kubernetes-common: Moves packages/kuberntes-common to plugins as per ADR11 Signed-off-by: Juan Lulkin --- plugins/kubernetes-backend/package.json | 2 +- plugins/kubernetes-backend/src/types/types.ts | 2 +- {packages => plugins}/kubernetes-common/.eslintrc.js | 0 {packages => plugins}/kubernetes-common/CHANGELOG.md | 2 +- {packages => plugins}/kubernetes-common/README.md | 2 +- {packages => plugins}/kubernetes-common/package.json | 4 ++-- {packages => plugins}/kubernetes-common/src/index.ts | 0 {packages => plugins}/kubernetes-common/src/types.ts | 0 plugins/kubernetes/schema.d.ts | 2 +- plugins/kubernetes/src/api/KubernetesBackendClient.ts | 2 +- plugins/kubernetes/src/api/types.ts | 2 +- .../src/components/KubernetesContent/ErrorPanel.tsx | 2 +- .../src/components/KubernetesContent/KubernetesContent.tsx | 2 +- .../kubernetes/src/error-detection/error-detection.test.ts | 2 +- plugins/kubernetes/src/error-detection/error-detection.ts | 2 +- plugins/kubernetes/src/hooks/useKubernetesObjects.ts | 2 +- .../src/kubernetes-auth-provider/AwsKubernetesAuthProvider.ts | 2 +- .../kubernetes-auth-provider/GoogleKubernetesAuthProvider.ts | 2 +- .../src/kubernetes-auth-provider/KubernetesAuthProviders.ts | 2 +- .../ServiceAccountKubernetesAuthProvider.ts | 2 +- plugins/kubernetes/src/kubernetes-auth-provider/types.ts | 2 +- plugins/kubernetes/src/utils/response.ts | 2 +- 22 files changed, 20 insertions(+), 20 deletions(-) rename {packages => plugins}/kubernetes-common/.eslintrc.js (100%) rename {packages => plugins}/kubernetes-common/CHANGELOG.md (70%) rename {packages => plugins}/kubernetes-common/README.md (73%) rename {packages => plugins}/kubernetes-common/package.json (92%) rename {packages => plugins}/kubernetes-common/src/index.ts (100%) rename {packages => plugins}/kubernetes-common/src/types.ts (100%) diff --git a/plugins/kubernetes-backend/package.json b/plugins/kubernetes-backend/package.json index 6c600f4d8b..3c8380b661 100644 --- a/plugins/kubernetes-backend/package.json +++ b/plugins/kubernetes-backend/package.json @@ -34,7 +34,7 @@ "@backstage/backend-common": "^0.6.3", "@backstage/catalog-model": "^0.7.7", "@backstage/config": "^0.1.4", - "@backstage/kubernetes-common": "^0.1.0", + "@backstage/plugin-kubernetes-common": "^0.1.0", "@google-cloud/container": "^2.2.0", "@kubernetes/client-node": "^0.14.0", "@types/express": "^4.17.6", diff --git a/plugins/kubernetes-backend/src/types/types.ts b/plugins/kubernetes-backend/src/types/types.ts index 2316740af0..119ca0451e 100644 --- a/plugins/kubernetes-backend/src/types/types.ts +++ b/plugins/kubernetes-backend/src/types/types.ts @@ -28,4 +28,4 @@ export type { KubernetesServiceLocator, ObjectFetchParams, ServiceLocatorMethod, -} from '@backstage/kubernetes-common'; +} from '@backstage/plugin-kubernetes-common'; diff --git a/packages/kubernetes-common/.eslintrc.js b/plugins/kubernetes-common/.eslintrc.js similarity index 100% rename from packages/kubernetes-common/.eslintrc.js rename to plugins/kubernetes-common/.eslintrc.js diff --git a/packages/kubernetes-common/CHANGELOG.md b/plugins/kubernetes-common/CHANGELOG.md similarity index 70% rename from packages/kubernetes-common/CHANGELOG.md rename to plugins/kubernetes-common/CHANGELOG.md index a10c37c7d1..44c9066ada 100644 --- a/packages/kubernetes-common/CHANGELOG.md +++ b/plugins/kubernetes-common/CHANGELOG.md @@ -1,4 +1,4 @@ -# @backstage/techdocs-common +# @backstage/plugin-kubernetes-common ## 0.1.0 diff --git a/packages/kubernetes-common/README.md b/plugins/kubernetes-common/README.md similarity index 73% rename from packages/kubernetes-common/README.md rename to plugins/kubernetes-common/README.md index 0034efbbff..c366d0493c 100644 --- a/packages/kubernetes-common/README.md +++ b/plugins/kubernetes-common/README.md @@ -1,3 +1,3 @@ -# @backstage/kubernetes-common +# @backstage/plugin-kubernetes-common Common types and functionalities for kubernetes, to be shared between kubernetes and kubernetes-backend. diff --git a/packages/kubernetes-common/package.json b/plugins/kubernetes-common/package.json similarity index 92% rename from packages/kubernetes-common/package.json rename to plugins/kubernetes-common/package.json index 9494b29ed0..813b965c2c 100644 --- a/packages/kubernetes-common/package.json +++ b/plugins/kubernetes-common/package.json @@ -1,5 +1,5 @@ { - "name": "@backstage/kubernetes-common", + "name": "@backstage/plugin-kubernetes-common", "description": "Common functionalities for kubernetes, to be shared between kubernetes and kubernetes-backend plugin", "version": "0.1.0", "main": "src/index.ts", @@ -14,7 +14,7 @@ "repository": { "type": "git", "url": "https://github.com/backstage/backstage", - "directory": "packages/kubernetes-common" + "directory": "plugin/kubernetes-common" }, "keywords": [ "techdocs", diff --git a/packages/kubernetes-common/src/index.ts b/plugins/kubernetes-common/src/index.ts similarity index 100% rename from packages/kubernetes-common/src/index.ts rename to plugins/kubernetes-common/src/index.ts diff --git a/packages/kubernetes-common/src/types.ts b/plugins/kubernetes-common/src/types.ts similarity index 100% rename from packages/kubernetes-common/src/types.ts rename to plugins/kubernetes-common/src/types.ts diff --git a/plugins/kubernetes/schema.d.ts b/plugins/kubernetes/schema.d.ts index e421100760..9845fa4e47 100644 --- a/plugins/kubernetes/schema.d.ts +++ b/plugins/kubernetes/schema.d.ts @@ -17,7 +17,7 @@ import { ClusterLocatorMethod, CustomResource, -} from '@backstage/kubernetes-common'; +} from '@backstage/plugin-kubernetes-common'; export interface Config { kubernetes?: { diff --git a/plugins/kubernetes/src/api/KubernetesBackendClient.ts b/plugins/kubernetes/src/api/KubernetesBackendClient.ts index 0bbba7c8f7..19f1602143 100644 --- a/plugins/kubernetes/src/api/KubernetesBackendClient.ts +++ b/plugins/kubernetes/src/api/KubernetesBackendClient.ts @@ -19,7 +19,7 @@ import { KubernetesApi } from './types'; import { KubernetesRequestBody, ObjectsByEntityResponse, -} from '@backstage/kubernetes-common'; +} from '@backstage/plugin-kubernetes-common'; export class KubernetesBackendClient implements KubernetesApi { private readonly discoveryApi: DiscoveryApi; diff --git a/plugins/kubernetes/src/api/types.ts b/plugins/kubernetes/src/api/types.ts index a575aea4b8..2e91783132 100644 --- a/plugins/kubernetes/src/api/types.ts +++ b/plugins/kubernetes/src/api/types.ts @@ -18,7 +18,7 @@ import { createApiRef } from '@backstage/core'; import { KubernetesRequestBody, ObjectsByEntityResponse, -} from '@backstage/kubernetes-common'; +} from '@backstage/plugin-kubernetes-common'; export const kubernetesApiRef = createApiRef({ id: 'plugin.kubernetes.service', diff --git a/plugins/kubernetes/src/components/KubernetesContent/ErrorPanel.tsx b/plugins/kubernetes/src/components/KubernetesContent/ErrorPanel.tsx index 2261cd5e3f..ba0026ac47 100644 --- a/plugins/kubernetes/src/components/KubernetesContent/ErrorPanel.tsx +++ b/plugins/kubernetes/src/components/KubernetesContent/ErrorPanel.tsx @@ -17,7 +17,7 @@ import React from 'react'; import { WarningPanel } from '@backstage/core'; import { Typography } from '@material-ui/core'; -import { ClusterObjects } from '@backstage/kubernetes-common'; +import { ClusterObjects } from '@backstage/plugin-kubernetes-common'; const clustersWithErrorsToErrorMessage = ( clustersWithErrors: ClusterObjects[], diff --git a/plugins/kubernetes/src/components/KubernetesContent/KubernetesContent.tsx b/plugins/kubernetes/src/components/KubernetesContent/KubernetesContent.tsx index 5b30c62949..1461f52112 100644 --- a/plugins/kubernetes/src/components/KubernetesContent/KubernetesContent.tsx +++ b/plugins/kubernetes/src/components/KubernetesContent/KubernetesContent.tsx @@ -31,7 +31,7 @@ import { StatusOK, } from '@backstage/core'; import { Entity } from '@backstage/catalog-model'; -import { ClusterObjects } from '@backstage/kubernetes-common'; +import { ClusterObjects } from '@backstage/plugin-kubernetes-common'; import { ErrorPanel } from './ErrorPanel'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import { DeploymentsAccordions } from '../DeploymentsAccordions'; diff --git a/plugins/kubernetes/src/error-detection/error-detection.test.ts b/plugins/kubernetes/src/error-detection/error-detection.test.ts index 50cf81a522..5079ed9245 100644 --- a/plugins/kubernetes/src/error-detection/error-detection.test.ts +++ b/plugins/kubernetes/src/error-detection/error-detection.test.ts @@ -30,7 +30,7 @@ import * as maxedOutHpa from './__fixtures__/hpa-maxed-out.json'; import { FetchResponse, ObjectsByEntityResponse, -} from '@backstage/kubernetes-common'; +} from '@backstage/plugin-kubernetes-common'; const CLUSTER_NAME = 'cluster-a'; diff --git a/plugins/kubernetes/src/error-detection/error-detection.ts b/plugins/kubernetes/src/error-detection/error-detection.ts index 5cffbc181f..91544fe623 100644 --- a/plugins/kubernetes/src/error-detection/error-detection.ts +++ b/plugins/kubernetes/src/error-detection/error-detection.ts @@ -15,7 +15,7 @@ */ import { DetectedError, DetectedErrorsByCluster } from './types'; -import { ObjectsByEntityResponse } from '@backstage/kubernetes-common'; +import { ObjectsByEntityResponse } from '@backstage/plugin-kubernetes-common'; import { groupResponses } from '../utils/response'; import { detectErrorsInPods } from './pods'; import { detectErrorsInDeployments } from './deployments'; diff --git a/plugins/kubernetes/src/hooks/useKubernetesObjects.ts b/plugins/kubernetes/src/hooks/useKubernetesObjects.ts index 44434ec8f5..1dfe85fe38 100644 --- a/plugins/kubernetes/src/hooks/useKubernetesObjects.ts +++ b/plugins/kubernetes/src/hooks/useKubernetesObjects.ts @@ -22,7 +22,7 @@ import { useEffect, useState } from 'react'; import { KubernetesRequestBody, ObjectsByEntityResponse, -} from '@backstage/kubernetes-common'; +} from '@backstage/plugin-kubernetes-common'; export interface KubernetesObjects { kubernetesObjects: ObjectsByEntityResponse | undefined; diff --git a/plugins/kubernetes/src/kubernetes-auth-provider/AwsKubernetesAuthProvider.ts b/plugins/kubernetes/src/kubernetes-auth-provider/AwsKubernetesAuthProvider.ts index cb14574bdc..ef541b0173 100644 --- a/plugins/kubernetes/src/kubernetes-auth-provider/AwsKubernetesAuthProvider.ts +++ b/plugins/kubernetes/src/kubernetes-auth-provider/AwsKubernetesAuthProvider.ts @@ -15,7 +15,7 @@ */ import { KubernetesAuthProvider } from './types'; -import { KubernetesRequestBody } from '@backstage/kubernetes-common'; +import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common'; export class AwsKubernetesAuthProvider implements KubernetesAuthProvider { async decorateRequestBodyForAuth( diff --git a/plugins/kubernetes/src/kubernetes-auth-provider/GoogleKubernetesAuthProvider.ts b/plugins/kubernetes/src/kubernetes-auth-provider/GoogleKubernetesAuthProvider.ts index 649f0c14da..9c9db0b9fc 100644 --- a/plugins/kubernetes/src/kubernetes-auth-provider/GoogleKubernetesAuthProvider.ts +++ b/plugins/kubernetes/src/kubernetes-auth-provider/GoogleKubernetesAuthProvider.ts @@ -16,7 +16,7 @@ import { OAuthApi } from '@backstage/core'; import { KubernetesAuthProvider } from './types'; -import { KubernetesRequestBody } from '@backstage/kubernetes-common'; +import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common'; export class GoogleKubernetesAuthProvider implements KubernetesAuthProvider { authProvider: OAuthApi; diff --git a/plugins/kubernetes/src/kubernetes-auth-provider/KubernetesAuthProviders.ts b/plugins/kubernetes/src/kubernetes-auth-provider/KubernetesAuthProviders.ts index bc74b2717f..a96565f0c0 100644 --- a/plugins/kubernetes/src/kubernetes-auth-provider/KubernetesAuthProviders.ts +++ b/plugins/kubernetes/src/kubernetes-auth-provider/KubernetesAuthProviders.ts @@ -15,7 +15,7 @@ */ import { OAuthApi } from '@backstage/core'; -import { KubernetesRequestBody } from '@backstage/kubernetes-common'; +import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common'; import { KubernetesAuthProvider, KubernetesAuthProvidersApi } from './types'; import { GoogleKubernetesAuthProvider } from './GoogleKubernetesAuthProvider'; import { ServiceAccountKubernetesAuthProvider } from './ServiceAccountKubernetesAuthProvider'; diff --git a/plugins/kubernetes/src/kubernetes-auth-provider/ServiceAccountKubernetesAuthProvider.ts b/plugins/kubernetes/src/kubernetes-auth-provider/ServiceAccountKubernetesAuthProvider.ts index f54c51bf48..b88fd7679e 100644 --- a/plugins/kubernetes/src/kubernetes-auth-provider/ServiceAccountKubernetesAuthProvider.ts +++ b/plugins/kubernetes/src/kubernetes-auth-provider/ServiceAccountKubernetesAuthProvider.ts @@ -15,7 +15,7 @@ */ import { KubernetesAuthProvider } from './types'; -import { KubernetesRequestBody } from '@backstage/kubernetes-common'; +import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common'; export class ServiceAccountKubernetesAuthProvider implements KubernetesAuthProvider { diff --git a/plugins/kubernetes/src/kubernetes-auth-provider/types.ts b/plugins/kubernetes/src/kubernetes-auth-provider/types.ts index afb2615939..8d4cead11a 100644 --- a/plugins/kubernetes/src/kubernetes-auth-provider/types.ts +++ b/plugins/kubernetes/src/kubernetes-auth-provider/types.ts @@ -15,7 +15,7 @@ */ import { createApiRef } from '@backstage/core'; -import { KubernetesRequestBody } from '@backstage/kubernetes-common'; +import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common'; export interface KubernetesAuthProvider { decorateRequestBodyForAuth( diff --git a/plugins/kubernetes/src/utils/response.ts b/plugins/kubernetes/src/utils/response.ts index a38010ba74..1d860ca226 100644 --- a/plugins/kubernetes/src/utils/response.ts +++ b/plugins/kubernetes/src/utils/response.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { FetchResponse } from '@backstage/kubernetes-common'; +import { FetchResponse } from '@backstage/plugin-kubernetes-common'; import { GroupedResponses } from '../types/types'; // TODO this could probably be a lodash groupBy From a3b25f6c2e0bb1f17e3513567211f945b6fde5ac Mon Sep 17 00:00:00 2001 From: Juan Lulkin Date: Thu, 15 Apr 2021 11:43:08 +0200 Subject: [PATCH 217/485] kubernetes: Removes schema.d.ts Signed-off-by: Juan Lulkin --- plugins/kubernetes/package.json | 4 +--- plugins/kubernetes/schema.d.ts | 42 --------------------------------- 2 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 plugins/kubernetes/schema.d.ts diff --git a/plugins/kubernetes/package.json b/plugins/kubernetes/package.json index 7c607b1776..c808678922 100644 --- a/plugins/kubernetes/package.json +++ b/plugins/kubernetes/package.json @@ -19,7 +19,6 @@ "backstage", "kubernetes" ], - "configSchema": "schema.d.ts", "scripts": { "build": "backstage-cli plugin:build", "start": "backstage-cli plugin:serve", @@ -63,7 +62,6 @@ "msw": "^0.21.2" }, "files": [ - "dist", - "schema.d.ts" + "dist" ] } diff --git a/plugins/kubernetes/schema.d.ts b/plugins/kubernetes/schema.d.ts deleted file mode 100644 index 9845fa4e47..0000000000 --- a/plugins/kubernetes/schema.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2020 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 { - ClusterLocatorMethod, - CustomResource, -} from '@backstage/plugin-kubernetes-common'; - -export interface Config { - kubernetes?: { - /** - * @visibility frontend - */ - serviceLocatorMethod: { - /** - * @visibility frontend - */ - type: 'multiTenant'; - }; - /** - * @visibility frontend - */ - clusterLocatorMethods: ClusterLocatorMethod[]; - /** - * @visibility frontend - */ - customResources?: CustomResource[]; - }; -} From 219313b29db39fdface66981e5c7b8450f928761 Mon Sep 17 00:00:00 2001 From: Juan Lulkin Date: Thu, 15 Apr 2021 11:48:01 +0200 Subject: [PATCH 218/485] kubernetes-backend: Moves backend specific types back from common Signed-off-by: Juan Lulkin --- plugins/kubernetes-backend/src/types/types.ts | 118 ++++++++++++++++-- plugins/kubernetes-common/src/types.ts | 111 +--------------- 2 files changed, 113 insertions(+), 116 deletions(-) diff --git a/plugins/kubernetes-backend/src/types/types.ts b/plugins/kubernetes-backend/src/types/types.ts index 119ca0451e..b7822557c2 100644 --- a/plugins/kubernetes-backend/src/types/types.ts +++ b/plugins/kubernetes-backend/src/types/types.ts @@ -14,18 +14,116 @@ * limitations under the License. */ -export type { - ClusterDetails, - CustomResource, +import type { + FetchResponse, + KubernetesFetchError, +} from '@backstage/plugin-kubernetes-common'; + +export type { FetchResponse, - FetchResponseWrapper, - KubernetesClustersSupplier, KubernetesErrorTypes, KubernetesFetchError, - KubernetesFetcher, - KubernetesObjectTypes, KubernetesRequestBody, - KubernetesServiceLocator, - ObjectFetchParams, - ServiceLocatorMethod, } from '@backstage/plugin-kubernetes-common'; + +export type ClusterLocatorMethod = + | ConfigClusterLocatorMethod + | GKEClusterLocatorMethod; + +export interface ConfigClusterLocatorMethod { + /** + * @visibility frontend + */ + type: 'config'; + clusters: { + /** + * @visibility frontend + */ + url: string; + /** + * @visibility frontend + */ + name: string; + /** + * @visibility secret + */ + serviceAccountToken: string | undefined; + /** + * @visibility frontend + */ + authProvider: 'aws' | 'google' | 'serviceAccount'; + }[]; +} + +export interface GKEClusterLocatorMethod { + /** + * @visibility frontend + */ + type: 'gke'; + /** + * @visibility frontend + */ + projectId: string; + /** + * @visibility frontend + */ + region?: string; +} + +export interface CustomResource { + group: string; + apiVersion: string; + plural: string; +} + +export interface ObjectFetchParams { + serviceId: string; + clusterDetails: ClusterDetails; + objectTypesToFetch: Set; + labelSelector: string; + customResources: CustomResource[]; +} + +// Fetches information from a kubernetes cluster using the cluster details object +// to target a specific cluster +export interface KubernetesFetcher { + fetchObjectsForService( + params: ObjectFetchParams, + ): Promise; +} + +export interface FetchResponseWrapper { + errors: KubernetesFetchError[]; + responses: FetchResponse[]; +} + +// TODO fairly sure there's a easier way to do this + +export type KubernetesObjectTypes = + | 'pods' + | 'services' + | 'configmaps' + | 'deployments' + | 'replicasets' + | 'horizontalpodautoscalers' + | 'ingresses' + | 'customresources'; + +// Used to load cluster details from different sources +export interface KubernetesClustersSupplier { + getClusters(): Promise; +} + +// Used to locate which cluster(s) a service is running on +export interface KubernetesServiceLocator { + getClustersByServiceId(serviceId: string): Promise; +} + +export type ServiceLocatorMethod = 'multiTenant' | 'http'; // TODO implement http + +export interface ClusterDetails { + name: string; + url: string; + authProvider: string; + serviceAccountToken?: string | undefined; +} diff --git a/plugins/kubernetes-common/src/types.ts b/plugins/kubernetes-common/src/types.ts index 84ca08585b..23dc4f0f3c 100644 --- a/plugins/kubernetes-common/src/types.ts +++ b/plugins/kubernetes-common/src/types.ts @@ -25,13 +25,6 @@ import { } from '@kubernetes/client-node'; import { Entity } from '@backstage/catalog-model'; -export interface ClusterDetails { - name: string; - url: string; - authProvider: string; - serviceAccountToken?: string | undefined; -} - export interface KubernetesRequestBody { auth?: { google?: string; @@ -49,10 +42,7 @@ export interface ObjectsByEntityResponse { items: ClusterObjects[]; } -export interface FetchResponseWrapper { - errors: KubernetesFetchError[]; - responses: FetchResponse[]; -} +export type AuthProviderType = 'google' | 'serviceAccount' | 'aws'; export type FetchResponse = | PodFetchResponse @@ -64,18 +54,6 @@ export type FetchResponse = | IngressesFetchResponse | CustomResourceFetchResponse; -// TODO fairly sure there's a easier way to do this - -export type KubernetesObjectTypes = - | 'pods' - | 'services' - | 'configmaps' - | 'deployments' - | 'replicasets' - | 'horizontalpodautoscalers' - | 'ingresses' - | 'customresources'; - export interface PodFetchResponse { type: 'pods'; resources: Array; @@ -116,30 +94,10 @@ export interface CustomResourceFetchResponse { resources: Array; } -export interface ObjectFetchParams { - serviceId: string; - clusterDetails: ClusterDetails; - objectTypesToFetch: Set; - labelSelector: string; - customResources: CustomResource[]; -} - -// Fetches information from a kubernetes cluster using the cluster details object -// to target a specific cluster -export interface KubernetesFetcher { - fetchObjectsForService( - params: ObjectFetchParams, - ): Promise; -} - -// Used to locate which cluster(s) a service is running on -export interface KubernetesServiceLocator { - getClustersByServiceId(serviceId: string): Promise; -} - -// Used to load cluster details from different sources -export interface KubernetesClustersSupplier { - getClusters(): Promise; +export interface KubernetesFetchError { + errorType: KubernetesErrorTypes; + statusCode?: number; + resourcePath?: string; } export type KubernetesErrorTypes = @@ -147,62 +105,3 @@ export type KubernetesErrorTypes = | 'UNAUTHORIZED_ERROR' | 'SYSTEM_ERROR' | 'UNKNOWN_ERROR'; - -export interface KubernetesFetchError { - errorType: KubernetesErrorTypes; - statusCode?: number; - resourcePath?: string; -} - -export interface ConfigClusterLocatorMethod { - /** - * @visibility frontend - */ - type: 'config'; - clusters: { - /** - * @visibility frontend - */ - url: string; - /** - * @visibility frontend - */ - name: string; - /** - * @visibility secret - */ - serviceAccountToken: string | undefined; - /** - * @visibility frontend - */ - authProvider: 'aws' | 'google' | 'serviceAccount'; - }[]; -} - -export interface GKEClusterLocatorMethod { - /** - * @visibility frontend - */ - type: 'gke'; - /** - * @visibility frontend - */ - projectId: string; - /** - * @visibility frontend - */ - region?: string; -} - -export type ClusterLocatorMethod = - | ConfigClusterLocatorMethod - | GKEClusterLocatorMethod; - -export type ServiceLocatorMethod = 'multiTenant' | 'http'; // TODO implement http -export type AuthProviderType = 'google' | 'serviceAccount' | 'aws'; - -export interface CustomResource { - group: string; - apiVersion: string; - plural: string; -} From 99930d194c3cab71dd7bc0f54921ab586ce925f0 Mon Sep 17 00:00:00 2001 From: Juan Lulkin Date: Thu, 15 Apr 2021 13:35:55 +0200 Subject: [PATCH 219/485] kubernetes-common: Exports types in a way that pleases the transpiler Signed-off-by: Juan Lulkin --- plugins/kubernetes-backend/src/types/types.ts | 9 +++++---- plugins/kubernetes-common/package.json | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/kubernetes-backend/src/types/types.ts b/plugins/kubernetes-backend/src/types/types.ts index b7822557c2..344e265426 100644 --- a/plugins/kubernetes-backend/src/types/types.ts +++ b/plugins/kubernetes-backend/src/types/types.ts @@ -15,17 +15,18 @@ */ import type { - FetchResponse, - KubernetesFetchError, + FetchResponse as FetchResponseCommon, + KubernetesFetchError as KubernetesFetchErrorCommon, } from '@backstage/plugin-kubernetes-common'; export type { - FetchResponse, KubernetesErrorTypes, - KubernetesFetchError, KubernetesRequestBody, } from '@backstage/plugin-kubernetes-common'; +export type KubernetesFetchError = KubernetesFetchErrorCommon; +export type FetchResponse = FetchResponseCommon; + export type ClusterLocatorMethod = | ConfigClusterLocatorMethod | GKEClusterLocatorMethod; diff --git a/plugins/kubernetes-common/package.json b/plugins/kubernetes-common/package.json index 813b965c2c..682223d92e 100644 --- a/plugins/kubernetes-common/package.json +++ b/plugins/kubernetes-common/package.json @@ -24,7 +24,7 @@ "dist" ], "scripts": { - "build": "backstage-cli build --outputs cjs,types", + "build": "backstage-cli build", "lint": "backstage-cli lint", "test": "backstage-cli test", "prepack": "backstage-cli prepack", From fb4ebd961edc3059c89c5f230c4371e29fa9ecaa Mon Sep 17 00:00:00 2001 From: Juan Lulkin Date: Thu, 15 Apr 2021 14:11:20 +0200 Subject: [PATCH 220/485] plugin-kubernetes-common: Adds pass with no tests, since these are just types Signed-off-by: Juan Lulkin --- plugins/kubernetes-common/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/kubernetes-common/package.json b/plugins/kubernetes-common/package.json index 682223d92e..3551eb6413 100644 --- a/plugins/kubernetes-common/package.json +++ b/plugins/kubernetes-common/package.json @@ -26,7 +26,7 @@ "scripts": { "build": "backstage-cli build", "lint": "backstage-cli lint", - "test": "backstage-cli test", + "test": "backstage-cli test --passWithNoTests", "prepack": "backstage-cli prepack", "postpack": "backstage-cli postpack", "clean": "backstage-cli clean" From 03c485f8e2856139886427669afc97e871a9190f Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 29 Apr 2021 14:30:54 +0200 Subject: [PATCH 221/485] Improve GitReleaseApiClient typings Signed-off-by: Erik Engervall --- .../src/GitReleaseManager.tsx | 26 +- .../src/api/GitReleaseApiClient.ts | 776 ++++++++---------- .../src/contexts/UserContext.ts | 38 + .../src/test-helpers/test-helpers.ts | 4 +- .../git-release-manager/src/types/helpers.ts | 25 + 5 files changed, 430 insertions(+), 439 deletions(-) create mode 100644 plugins/git-release-manager/src/contexts/UserContext.ts create mode 100644 plugins/git-release-manager/src/types/helpers.ts diff --git a/plugins/git-release-manager/src/GitReleaseManager.tsx b/plugins/git-release-manager/src/GitReleaseManager.tsx index fa33faac50..9b10d5d16d 100644 --- a/plugins/git-release-manager/src/GitReleaseManager.tsx +++ b/plugins/git-release-manager/src/GitReleaseManager.tsx @@ -25,14 +25,15 @@ import { ComponentConfigPatch, ComponentConfigPromoteRc, } from './types/types'; -import { Features } from './features/Features'; import { CenteredCircularProgress } from './components/CenteredCircularProgress'; +import { Features } from './features/Features'; import { gitReleaseManagerApiRef } from './api/serviceApiRef'; import { InfoCardPlus } from './components/InfoCardPlus'; import { isProjectValid } from './helpers/isProjectValid'; import { ProjectContext, Project } from './contexts/ProjectContext'; import { RepoDetailsForm } from './features/RepoDetailsForm/RepoDetailsForm'; import { useQueryHandler } from './hooks/useQueryHandler'; +import { UserContext } from './contexts/UserContext'; import { useStyles } from './styles/styles'; interface GitReleaseManagerProps { @@ -65,7 +66,7 @@ export function GitReleaseManager(props: GitReleaseManagerProps) { }; const usernameResponse = useAsync(() => - pluginApiClient.getUsername({ owner: project.owner, repo: project.repo }), + pluginApiClient.getUser({ owner: project.owner, repo: project.repo }), ); if (usernameResponse.error) { @@ -80,17 +81,24 @@ export function GitReleaseManager(props: GitReleaseManagerProps) { return Unable to retrieve username; } + const user = { + username: usernameResponse.value.username, + email: usernameResponse.value.email, + }; + return ( -
- + +
+ - - - + + + - {isProjectValid(project) && } -
+ {isProjectValid(project) && } +
+
); } diff --git a/plugins/git-release-manager/src/api/GitReleaseApiClient.ts b/plugins/git-release-manager/src/api/GitReleaseApiClient.ts index 2a0eadcadd..8e15f5c912 100644 --- a/plugins/git-release-manager/src/api/GitReleaseApiClient.ts +++ b/plugins/git-release-manager/src/api/GitReleaseApiClient.ts @@ -22,6 +22,7 @@ import { CalverTagParts } from '../helpers/tagParts/getCalverTagParts'; import { DISABLE_CACHE } from '../constants/constants'; import { Project } from '../contexts/ProjectContext'; import { SemverTagParts } from '../helpers/tagParts/getSemverTagParts'; +import { UnboxArray, UnboxReturnedPromise } from '../types/helpers'; export class GitReleaseApiClient implements GitReleaseApi { private readonly githubAuthApi: OAuthApi; @@ -71,15 +72,15 @@ export class GitReleaseApiClient implements GitReleaseApi { }; } - public getHost() { + public getHost: GitReleaseApi['getHost'] = () => { return this.host; - } + }; - public getRepoPath({ owner, repo }: OwnerRepo) { + public getRepoPath: GitReleaseApi['getRepoPath'] = ({ owner, repo }) => { return `${owner}/${repo}`; - } + }; - async getOwners() { + getOwners: GitReleaseApi['getOwners'] = async () => { const { octokit } = await this.getOctokit(); const orgListResponse = await octokit.paginate( octokit.orgs.listForAuthenticatedUser, @@ -89,9 +90,9 @@ export class GitReleaseApiClient implements GitReleaseApi { return { owners: orgListResponse.map(organization => organization.login), }; - } + }; - async getRepositories({ owner }: { owner: string }) { + getRepositories: GitReleaseApi['getRepositories'] = async ({ owner }) => { const { octokit } = await this.getOctokit(); const repositoryResponse = await octokit @@ -112,24 +113,23 @@ export class GitReleaseApiClient implements GitReleaseApi { return { repositories: repositoryResponse.map(repository => repository.name), }; - } + }; - async getUsername() { + getUser: GitReleaseApi['getUser'] = async () => { const { octokit } = await this.getOctokit(); const userResponse = await octokit.users.getAuthenticated(); return { username: userResponse.data.login, + email: userResponse.data.email ?? undefined, }; - } + }; - async getRecentCommits({ + getRecentCommits: GitReleaseApi['getRecentCommits'] = async ({ owner, repo, releaseBranchName, - }: { - releaseBranchName?: string; - } & OwnerRepo) { + }) => { const { octokit } = await this.getOctokit(); const recentCommitsResponse = await octokit.repos.listCommits({ owner, @@ -150,9 +150,12 @@ export class GitReleaseApiClient implements GitReleaseApi { }, firstParentSha: commit.parents?.[0]?.sha, })); - } + }; - async getLatestRelease({ owner, repo }: OwnerRepo) { + getLatestRelease: GitReleaseApi['getLatestRelease'] = async ({ + owner, + repo, + }) => { const { octokit } = await this.getOctokit(); const { data: latestReleases } = await octokit.repos.listReleases({ owner, @@ -175,9 +178,9 @@ export class GitReleaseApiClient implements GitReleaseApi { htmlUrl: latestRelease.html_url, body: latestRelease.body, }; - } + }; - async getRepository({ owner, repo }: OwnerRepo) { + getRepository: GitReleaseApi['getRepository'] = async ({ owner, repo }) => { const { octokit } = await this.getOctokit(); const { data: repository } = await octokit.repos.get({ owner, @@ -190,15 +193,13 @@ export class GitReleaseApiClient implements GitReleaseApi { defaultBranch: repository.default_branch, name: repository.name, }; - } + }; - async getLatestCommit({ + getLatestCommit: GitReleaseApi['getLatestCommit'] = async ({ owner, repo, defaultBranch, - }: { - defaultBranch: GetRepositoryResult['defaultBranch']; - } & OwnerRepo) { + }) => { const { octokit } = await this.getOctokit(); const { data: latestCommit } = await octokit.repos.getCommit({ owner, @@ -214,15 +215,13 @@ export class GitReleaseApiClient implements GitReleaseApi { message: latestCommit.commit.message, }, }; - } + }; - async getBranch({ + getBranch: GitReleaseApi['getBranch'] = async ({ owner, repo, branchName, - }: { - branchName: string; - } & OwnerRepo) { + }) => { const { octokit } = await this.getOctokit(); const { data: branch } = await octokit.repos.getBranch({ @@ -246,18 +245,10 @@ export class GitReleaseApiClient implements GitReleaseApi { }, }, }; - } + }; - createRc = { - createRef: async ({ - owner, - repo, - mostRecentSha, - targetBranch, - }: { - mostRecentSha: string; - targetBranch: string; - } & OwnerRepo) => { + createRc: GitReleaseApi['createRc'] = { + createRef: async ({ owner, repo, mostRecentSha, targetBranch }) => { const { octokit } = await this.getOctokit(); const createRefResponse = await octokit.git.createRef({ owner, @@ -276,10 +267,7 @@ export class GitReleaseApiClient implements GitReleaseApi { repo, previousReleaseBranch, nextReleaseBranch, - }: { - previousReleaseBranch: string; - nextReleaseBranch: string; - } & OwnerRepo) => { + }) => { const { octokit } = await this.getOctokit(); const compareCommitsResponse = await octokit.repos.compareCommits({ owner, @@ -301,12 +289,7 @@ export class GitReleaseApiClient implements GitReleaseApi { releaseName, rcBranch, releaseBody, - }: { - rcReleaseTag: string; - releaseName: string; - rcBranch: string; - releaseBody: string; - } & OwnerRepo) => { + }) => { const { octokit } = await this.getOctokit(); const createReleaseResponse = await octokit.repos.createRelease({ owner, @@ -326,18 +309,14 @@ export class GitReleaseApiClient implements GitReleaseApi { }, }; - patch = { + patch: GitReleaseApi['patch'] = { createTempCommit: async ({ owner, repo, tagParts, releaseBranchTree, selectedPatchCommit, - }: { - tagParts: SemverTagParts | CalverTagParts; - releaseBranchTree: string; - selectedPatchCommit: GetRecentCommitsResultSingle; - } & OwnerRepo) => { + }) => { const { octokit } = await this.getOctokit(); const { data: tempCommit } = await octokit.git.createCommit({ owner, @@ -358,12 +337,8 @@ export class GitReleaseApiClient implements GitReleaseApi { repo, releaseBranchName, tempCommit, - }: { - releaseBranchName: string; - tempCommit: CreateTempCommitResult; - } & OwnerRepo) => { + }) => { const { octokit } = await this.getOctokit(); - // await octokit.request("PATCH reposrefs") await octokit.git.updateRef({ owner, repo, @@ -373,12 +348,7 @@ export class GitReleaseApiClient implements GitReleaseApi { }); }, - merge: async ({ - owner, - repo, - base, - head, - }: { base: string; head: string } & OwnerRepo) => { + merge: async ({ owner, repo, base, head }) => { const { octokit } = await this.getOctokit(); const { data: merge } = await octokit.repos.merge({ owner, @@ -405,12 +375,7 @@ export class GitReleaseApiClient implements GitReleaseApi { selectedPatchCommit, mergeTree, releaseBranchSha, - }: { - bumpedTag: string; - selectedPatchCommit: GetRecentCommitsResultSingle; - mergeTree: string; - releaseBranchSha: string; - } & OwnerRepo) => { + }) => { const { octokit } = await this.getOctokit(); const { data: cherryPickCommit } = await octokit.git.createCommit({ owner, @@ -433,10 +398,7 @@ ${selectedPatchCommit.sha}`, repo, releaseBranchName, cherryPickCommit, - }: { - releaseBranchName: string; - cherryPickCommit: CreateCherryPickCommitResult; - } & OwnerRepo) => { + }) => { const { octokit } = await this.getOctokit(); const { data: updatedReference } = await octokit.git.updateRef({ owner, @@ -454,15 +416,7 @@ ${selectedPatchCommit.sha}`, }; }, - createTagObject: async ({ - owner, - repo, - bumpedTag, - updatedReference, - }: { - bumpedTag: string; - updatedReference: ReplaceTempCommitResult; - } & OwnerRepo) => { + createTagObject: async ({ owner, repo, bumpedTag, updatedReference }) => { const { octokit } = await this.getOctokit(); const { data: createdTagObject } = await octokit.git.createTag({ owner, @@ -480,15 +434,7 @@ ${selectedPatchCommit.sha}`, }; }, - createReference: async ({ - owner, - repo, - bumpedTag, - createdTagObject, - }: { - bumpedTag: string; - createdTagObject: CreateTagObjectResult; - } & OwnerRepo) => { + createReference: async ({ owner, repo, bumpedTag, createdTagObject }) => { const { octokit } = await this.getOctokit(); const { data: reference } = await octokit.git.createRef({ owner, @@ -509,12 +455,7 @@ ${selectedPatchCommit.sha}`, latestRelease, tagParts, selectedPatchCommit, - }: { - bumpedTag: string; - latestRelease: NonNullable; - tagParts: SemverTagParts | CalverTagParts; - selectedPatchCommit: GetRecentCommitsResultSingle; - } & OwnerRepo) => { + }) => { const { octokit } = await this.getOctokit(); const { data: updatedRelease } = await octokit.repos.updateRelease({ owner, @@ -536,16 +477,8 @@ ${selectedPatchCommit.commit.message}`, }, }; - promoteRc = { - promoteRelease: async ({ - owner, - repo, - releaseId, - releaseVersion, - }: { - releaseId: NonNullable['id']; - releaseVersion: string; - } & OwnerRepo) => { + promoteRc: GitReleaseApi['promoteRc'] = { + promoteRelease: async ({ owner, repo, releaseId, releaseVersion }) => { const { octokit } = await this.getOctokit(); const { data: promotedRelease } = await octokit.repos.updateRelease({ owner, @@ -563,8 +496,8 @@ ${selectedPatchCommit.commit.message}`, }, }; - stats = { - getAllTags: async ({ owner, repo }: OwnerRepo) => { + stats: GitReleaseApi['stats'] = { + getAllTags: async ({ owner, repo }) => { const { octokit } = await this.getOctokit(); const tags = await octokit.paginate(octokit.repos.listTags, { @@ -580,7 +513,7 @@ ${selectedPatchCommit.commit.message}`, })); }, - getAllReleases: async ({ owner, repo }: OwnerRepo) => { + getAllReleases: async ({ owner, repo }) => { const { octokit } = await this.getOctokit(); const releases = await octokit.paginate(octokit.repos.listReleases, { @@ -599,7 +532,7 @@ ${selectedPatchCommit.commit.message}`, })); }, - getCommit: async ({ owner, repo, ref }: { ref: string } & OwnerRepo) => { + getCommit: async ({ owner, repo, ref }) => { const { octokit } = await this.getOctokit(); const { data: commit } = await octokit.repos.getCommit({ @@ -615,347 +548,332 @@ ${selectedPatchCommit.commit.message}`, }; } -type UnboxPromise> = T extends Promise - ? U - : never; - -type UnboxReturnedPromise< - T extends (...args: any) => Promise -> = UnboxPromise>; - -type UnboxArray = T extends (infer U)[] ? U : T; - type OwnerRepo = { owner: Project['owner']; repo: Project['repo']; }; -type GetHost = () => string; +export interface GitReleaseApi { + getHost: () => string; -type GetRepoPath = (args: OwnerRepo) => string; + getRepoPath: (args: OwnerRepo) => string; -type GetOwners = () => Promise<{ - owners: string[]; -}>; -export type GetOwnersResult = UnboxReturnedPromise; + getOwners: () => Promise<{ + owners: string[]; + }>; -type GetRepositories = (args: { - owner: OwnerRepo['owner']; -}) => Promise<{ - repositories: string[]; -}>; -export type GetRepositoriesResult = UnboxReturnedPromise; + getRepositories: (args: { + owner: OwnerRepo['owner']; + }) => Promise<{ + repositories: string[]; + }>; -type GetUsername = ( - args: OwnerRepo, -) => Promise<{ - username: string; -}>; -export type GetUsernameResult = UnboxReturnedPromise; + getUser: ( + args: OwnerRepo, + ) => Promise<{ + username: string; + email?: string; + }>; -type GetRecentCommits = ( - args: { - releaseBranchName?: string; - } & OwnerRepo, -) => Promise< - { + getRecentCommits: ( + args: { + releaseBranchName?: string; + } & OwnerRepo, + ) => Promise< + { + htmlUrl: string; + sha: string; + author: { + htmlUrl?: string; + login?: string; + }; + commit: { + message: string; + }; + firstParentSha?: string; + }[] + >; + getLatestRelease: ( + args: OwnerRepo, + ) => Promise<{ + targetCommitish: string; + tagName: string; + prerelease: boolean; + id: number; htmlUrl: string; + body?: string | null; + } | null>; + getRepository: ( + args: OwnerRepo, + ) => Promise<{ + pushPermissions: boolean | undefined; + defaultBranch: string; + name: string; + }>; + + getLatestCommit: ( + args: { + defaultBranch: string; + } & OwnerRepo, + ) => Promise<{ sha: string; - author: { - htmlUrl?: string; - login?: string; - }; + htmlUrl: string; commit: { message: string; }; - firstParentSha?: string; - }[] ->; -export type GetRecentCommitsResult = UnboxReturnedPromise; -export type GetRecentCommitsResultSingle = UnboxArray; + }>; -type GetLatestRelease = ( - args: OwnerRepo, -) => Promise<{ - targetCommitish: string; - tagName: string; - prerelease: boolean; - id: number; - htmlUrl: string; - body?: string | null; -} | null>; -export type GetLatestReleaseResult = UnboxReturnedPromise; - -type GetRepository = ( - args: OwnerRepo, -) => Promise<{ - pushPermissions: boolean | undefined; - defaultBranch: string; - name: string; -}>; -export type GetRepositoryResult = UnboxReturnedPromise; - -type GetLatestCommit = ( - args: { - defaultBranch: string; - } & OwnerRepo, -) => Promise<{ - sha: string; - htmlUrl: string; - commit: { - message: string; - }; -}>; -export type GetLatestCommitResult = UnboxReturnedPromise; - -type GetBranch = ( - args: { - branchName: string; - } & OwnerRepo, -) => Promise<{ - name: string; - links: { - html: string; - }; - commit: { - sha: string; + getBranch: ( + args: { + branchName: string; + } & OwnerRepo, + ) => Promise<{ + name: string; + links: { + html: string; + }; commit: { - tree: { - sha: string; + sha: string; + commit: { + tree: { + sha: string; + }; }; }; - }; -}>; -export type GetBranchResult = UnboxReturnedPromise; + }>; -/** - * CreateRc - */ -type CreateRef = ( - args: { - mostRecentSha: string; - targetBranch: string; - } & OwnerRepo, -) => Promise<{ - ref: string; -}>; -export type CreateRefResult = UnboxReturnedPromise; - -type GetComparison = ( - args: { - previousReleaseBranch: string; - nextReleaseBranch: string; - } & OwnerRepo, -) => Promise<{ - htmlUrl: string; - aheadBy: number; -}>; -export type GetComparisonResult = UnboxReturnedPromise; - -type CreateRelease = ( - args: { - rcReleaseTag: string; - releaseName: string; - rcBranch: string; - releaseBody: string; - } & OwnerRepo, -) => Promise<{ - name: string | null; - htmlUrl: string; - tagName: string; -}>; -export type CreateReleaseResult = UnboxReturnedPromise; - -/** - * Patch - */ -type CreateTempCommit = ( - args: { - tagParts: SemverTagParts | CalverTagParts; - releaseBranchTree: string; - selectedPatchCommit: UnboxArray< - UnboxReturnedPromise - >; - } & OwnerRepo, -) => Promise<{ - message: string; - sha: string; -}>; -export type CreateTempCommitResult = UnboxReturnedPromise; - -type ForceBranchHeadToTempCommit = ( - args: { - releaseBranchName: string; - tempCommit: CreateTempCommitResult; - } & OwnerRepo, -) => Promise; -export type ForceBranchHeadToTempCommitResult = UnboxReturnedPromise; - -type Merge = ({ - base, - head, -}: { - base: string; - head: string; -} & OwnerRepo) => Promise<{ - htmlUrl: string; - commit: { - message: string; - tree: { - sha: string; - }; - }; -}>; -export type MergeResult = UnboxReturnedPromise; - -type CreateCherryPickCommit = ( - args: { - bumpedTag: string; - selectedPatchCommit: UnboxArray< - UnboxReturnedPromise - >; - mergeTree: string; - releaseBranchSha: string; - } & OwnerRepo, -) => Promise<{ - message: string; - sha: string; -}>; -export type CreateCherryPickCommitResult = UnboxReturnedPromise; - -type ReplaceTempCommit = ( - args: { - releaseBranchName: string; - cherryPickCommit: UnboxReturnedPromise< - GitReleaseApi['patch']['createCherryPickCommit'] - >; - } & OwnerRepo, -) => Promise<{ - ref: string; - object: { - sha: string; - }; -}>; -export type ReplaceTempCommitResult = UnboxReturnedPromise; - -type CreateTagObject = ({ - bumpedTag, - updatedReference, -}: { - bumpedTag: string; - updatedReference: ReplaceTempCommitResult; -} & OwnerRepo) => Promise<{ - tag: string; - sha: string; -}>; -export type CreateTagObjectResult = UnboxReturnedPromise; - -type CreateReference = ( - args: { - bumpedTag: string; - createdTagObject: CreateTagObjectResult; - } & OwnerRepo, -) => Promise<{ - ref: string; -}>; -export type CreateReferenceResult = UnboxReturnedPromise; - -type UpdateRelease = ( - args: { - bumpedTag: string; - latestRelease: NonNullable; - tagParts: SemverTagParts | CalverTagParts; - selectedPatchCommit: GetRecentCommitsResultSingle; - } & OwnerRepo, -) => Promise<{ - name: string | null; - tagName: string; - htmlUrl: string; -}>; -export type UpdateReleaseResult = UnboxReturnedPromise; - -/** - * PromoteRc - */ -type PromoteRelease = ( - args: { - releaseId: NonNullable['id']; - releaseVersion: string; - } & OwnerRepo, -) => Promise<{ - name: string | null; - tagName: string; - htmlUrl: string; -}>; -export type PromoteReleaseResult = UnboxReturnedPromise; - -/** - * Stats - */ -type GetAllTags = ( - args: OwnerRepo, -) => Promise< - Array<{ - tagName: string; - sha: string; - }> ->; -export type GetAllTagsResult = UnboxReturnedPromise; - -type GetAllReleases = ( - args: OwnerRepo, -) => Promise< - Array<{ - id: number; - name: string | null; - tagName: string; - createdAt: string | null; - htmlUrl: string; - }> ->; -export type GetAllReleasesResult = UnboxReturnedPromise; - -type GetCommit = ( - args: { - ref: string; - } & OwnerRepo, -) => Promise<{ - createdAt: string | undefined; -}>; -export type GetCommitResult = UnboxReturnedPromise; - -export interface GitReleaseApi { - getHost: GetHost; - getRepoPath: GetRepoPath; - getOwners: GetOwners; - getRepositories: GetRepositories; - getUsername: GetUsername; - getRecentCommits: GetRecentCommits; - getLatestRelease: GetLatestRelease; - getRepository: GetRepository; - getLatestCommit: GetLatestCommit; - getBranch: GetBranch; createRc: { - createRef: CreateRef; - getComparison: GetComparison; - createRelease: CreateRelease; + createRef: ( + args: { + mostRecentSha: string; + targetBranch: string; + } & OwnerRepo, + ) => Promise<{ + ref: string; + }>; + + getComparison: ( + args: { + previousReleaseBranch: string; + nextReleaseBranch: string; + } & OwnerRepo, + ) => Promise<{ + htmlUrl: string; + aheadBy: number; + }>; + + createRelease: ( + args: { + rcReleaseTag: string; + releaseName: string; + rcBranch: string; + releaseBody: string; + } & OwnerRepo, + ) => Promise<{ + name: string | null; + htmlUrl: string; + tagName: string; + }>; }; patch: { - createTempCommit: CreateTempCommit; - forceBranchHeadToTempCommit: ForceBranchHeadToTempCommit; - merge: Merge; - createCherryPickCommit: CreateCherryPickCommit; - replaceTempCommit: ReplaceTempCommit; - createTagObject: CreateTagObject; - createReference: CreateReference; - updateRelease: UpdateRelease; + createTempCommit: ( + args: { + tagParts: SemverTagParts | CalverTagParts; + releaseBranchTree: string; + selectedPatchCommit: UnboxArray< + UnboxReturnedPromise + >; + } & OwnerRepo, + ) => Promise<{ + message: string; + sha: string; + }>; + + forceBranchHeadToTempCommit: ( + args: { + releaseBranchName: string; + tempCommit: CreateTempCommitResult; + } & OwnerRepo, + ) => Promise; + merge: ({ + base, + head, + }: { + base: string; + head: string; + } & OwnerRepo) => Promise<{ + htmlUrl: string; + commit: { + message: string; + tree: { + sha: string; + }; + }; + }>; + + createCherryPickCommit: ( + args: { + bumpedTag: string; + selectedPatchCommit: UnboxArray< + UnboxReturnedPromise + >; + mergeTree: string; + releaseBranchSha: string; + } & OwnerRepo, + ) => Promise<{ + message: string; + sha: string; + }>; + + replaceTempCommit: ( + args: { + releaseBranchName: string; + cherryPickCommit: UnboxReturnedPromise< + GitReleaseApi['patch']['createCherryPickCommit'] + >; + } & OwnerRepo, + ) => Promise<{ + ref: string; + object: { + sha: string; + }; + }>; + + createTagObject: ({ + bumpedTag, + updatedReference, + }: { + bumpedTag: string; + updatedReference: ReplaceTempCommitResult; + } & OwnerRepo) => Promise<{ + tag: string; + sha: string; + }>; + + createReference: ( + args: { + bumpedTag: string; + createdTagObject: CreateTagObjectResult; + } & OwnerRepo, + ) => Promise<{ + ref: string; + }>; + + updateRelease: ( + args: { + bumpedTag: string; + latestRelease: NonNullable; + tagParts: SemverTagParts | CalverTagParts; + selectedPatchCommit: GetRecentCommitsResultSingle; + } & OwnerRepo, + ) => Promise<{ + name: string | null; + tagName: string; + htmlUrl: string; + }>; }; promoteRc: { - promoteRelease: PromoteRelease; + promoteRelease: ( + args: { + releaseId: NonNullable['id']; + releaseVersion: string; + } & OwnerRepo, + ) => Promise<{ + name: string | null; + tagName: string; + htmlUrl: string; + }>; }; stats: { - getAllTags: GetAllTags; - getAllReleases: GetAllReleases; - getCommit: GetCommit; + getAllTags: ( + args: OwnerRepo, + ) => Promise< + Array<{ + tagName: string; + sha: string; + }> + >; + getAllReleases: ( + args: OwnerRepo, + ) => Promise< + Array<{ + id: number; + name: string | null; + tagName: string; + createdAt: string | null; + htmlUrl: string; + }> + >; + + getCommit: ( + args: { + ref: string; + } & OwnerRepo, + ) => Promise<{ + createdAt: string | undefined; + }>; }; } + +export type GetOwnersResult = UnboxReturnedPromise; +export type GetRepositoriesResult = UnboxReturnedPromise< + GitReleaseApi['getRepositories'] +>; +export type GetUserResult = UnboxReturnedPromise; +export type GetRecentCommitsResult = UnboxReturnedPromise< + GitReleaseApi['getRecentCommits'] +>; +export type GetRecentCommitsResultSingle = UnboxArray; +export type GetLatestReleaseResult = UnboxReturnedPromise< + GitReleaseApi['getLatestRelease'] +>; +export type GetRepositoryResult = UnboxReturnedPromise< + GitReleaseApi['getRepository'] +>; +export type GetLatestCommitResult = UnboxReturnedPromise< + GitReleaseApi['getLatestCommit'] +>; +export type GetBranchResult = UnboxReturnedPromise; +export type CreateRefResult = UnboxReturnedPromise< + GitReleaseApi['createRc']['createRef'] +>; +export type GetComparisonResult = UnboxReturnedPromise< + GitReleaseApi['createRc']['getComparison'] +>; +export type CreateReleaseResult = UnboxReturnedPromise< + GitReleaseApi['createRc']['createRelease'] +>; +export type CreateTempCommitResult = UnboxReturnedPromise< + GitReleaseApi['patch']['createTempCommit'] +>; +export type ForceBranchHeadToTempCommitResult = UnboxReturnedPromise< + GitReleaseApi['patch']['forceBranchHeadToTempCommit'] +>; +export type MergeResult = UnboxReturnedPromise; +export type CreateCherryPickCommitResult = UnboxReturnedPromise< + GitReleaseApi['patch']['createCherryPickCommit'] +>; +export type ReplaceTempCommitResult = UnboxReturnedPromise< + GitReleaseApi['patch']['replaceTempCommit'] +>; +export type CreateTagObjectResult = UnboxReturnedPromise< + GitReleaseApi['patch']['createTagObject'] +>; +export type CreateReferenceResult = UnboxReturnedPromise< + GitReleaseApi['patch']['createReference'] +>; +export type UpdateReleaseResult = UnboxReturnedPromise< + GitReleaseApi['patch']['updateRelease'] +>; +export type PromoteReleaseResult = UnboxReturnedPromise< + GitReleaseApi['promoteRc']['promoteRelease'] +>; +export type GetAllTagsResult = UnboxReturnedPromise< + GitReleaseApi['stats']['getAllTags'] +>; +export type GetCommitResult = UnboxReturnedPromise< + GitReleaseApi['stats']['getCommit'] +>; +export type GetAllReleasesResult = UnboxReturnedPromise< + GitReleaseApi['stats']['getAllReleases'] +>; diff --git a/plugins/git-release-manager/src/contexts/UserContext.ts b/plugins/git-release-manager/src/contexts/UserContext.ts new file mode 100644 index 0000000000..664c621d3c --- /dev/null +++ b/plugins/git-release-manager/src/contexts/UserContext.ts @@ -0,0 +1,38 @@ +/* + * 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 { createContext, useContext } from 'react'; + +import { GitReleaseManagerError } from '../errors/GitReleaseManagerError'; + +interface User { + username: string; + email?: string; +} + +export const UserContext = createContext<{ user: User } | undefined>(undefined); + +export const useUserContext = () => { + const { user } = useContext(UserContext) ?? {}; + + if (!user) { + throw new GitReleaseManagerError('user not found'); + } + + return { + user, + }; +}; diff --git a/plugins/git-release-manager/src/test-helpers/test-helpers.ts b/plugins/git-release-manager/src/test-helpers/test-helpers.ts index 4dbcb9ce10..886fad9de0 100644 --- a/plugins/git-release-manager/src/test-helpers/test-helpers.ts +++ b/plugins/git-release-manager/src/test-helpers/test-helpers.ts @@ -24,6 +24,7 @@ import { CalverTagParts } from '../helpers/tagParts/getCalverTagParts'; import { Project } from '../contexts/ProjectContext'; import { getReleaseCandidateGitInfo } from '../helpers/getReleaseCandidateGitInfo'; +const mockEmail = 'mock_email'; const mockOwner = 'mock_owner'; const mockRepo = 'mock_repo'; @@ -185,8 +186,9 @@ export const mockApiClient: GitReleaseApi = { repositories: [mockRepo, `${mockRepo}2`], })), - getUsername: jest.fn(async () => ({ + getUser: jest.fn(async () => ({ username: mockOwner, + email: mockEmail, })), getRecentCommits: jest.fn(async () => [ diff --git a/plugins/git-release-manager/src/types/helpers.ts b/plugins/git-release-manager/src/types/helpers.ts new file mode 100644 index 0000000000..55bc6fdcac --- /dev/null +++ b/plugins/git-release-manager/src/types/helpers.ts @@ -0,0 +1,25 @@ +/* + * 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. + */ + +export type UnboxPromise> = T extends Promise + ? U + : never; + +export type UnboxReturnedPromise< + T extends (...args: any) => Promise +> = UnboxPromise>; + +export type UnboxArray = T extends (infer U)[] ? U : T; From 34a4aa2c1e44664a08cdabc4bc2e68eabe86b14c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20A=CC=8Ahsberg?= Date: Wed, 28 Apr 2021 15:52:33 +0000 Subject: [PATCH 222/485] Pass processor logger to repository parser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathias Åhsberg --- .../processors/BitbucketDiscoveryProcessor.ts | 19 ++++++++------- .../BitbucketRepositoryParser.test.ts | 16 ++++--------- .../bitbucket/BitbucketRepositoryParser.ts | 15 ++++++------ .../ingestion/processors/bitbucket/client.ts | 9 -------- .../ingestion/processors/bitbucket/types.ts | 23 ++++++++----------- 5 files changed, 31 insertions(+), 51 deletions(-) diff --git a/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.ts b/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.ts index 858219423f..9c56eb14e3 100644 --- a/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.ts +++ b/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.ts @@ -22,11 +22,11 @@ import { } from '@backstage/integration'; import { LocationSpec } from '@backstage/catalog-model'; import { - Bitbucket, BitbucketRepositoryParser, BitbucketClient, defaultRepositoryParser, paginated, + BitbucketRepository, } from './bitbucket'; import { CatalogProcessor, CatalogProcessorEmit } from './types'; @@ -66,20 +66,19 @@ export class BitbucketDiscoveryProcessor implements CatalogProcessor { return false; } - const bitbucketConfig = this.integrations.bitbucket.byUrl(location.target) - ?.config; - if (!bitbucketConfig) { + const integration = this.integrations.bitbucket.byUrl(location.target); + if (!integration) { throw new Error( `There is no Bitbucket integration that matches ${location.target}. Please add a configuration entry for it under integrations.bitbucket`, ); - } else if (bitbucketConfig.host === 'bitbucket.org') { + } else if (integration.config.host === 'bitbucket.org') { throw new Error( `Component discovery for Bitbucket Cloud is not yet supported`, ); } const client = new BitbucketClient({ - config: bitbucketConfig, + config: integration.config, }); const startTimestamp = Date.now(); this.logger.info(`Reading Bitbucket repositories from ${location.target}`); @@ -90,9 +89,9 @@ export class BitbucketDiscoveryProcessor implements CatalogProcessor { for (const repository of result.matches) { for await (const entity of this.parser({ - client: client, - repository: repository, - path: catalogPath, + integration: integration, + target: `${repository.links.self[0]}${catalogPath}`, + logger: this.logger, })) { emit(entity); } @@ -159,5 +158,5 @@ function escapeRegExp(str: string): RegExp { type Result = { scanned: number; - matches: Bitbucket.Repository[]; + matches: BitbucketRepository[]; }; diff --git a/plugins/catalog-backend/src/ingestion/processors/bitbucket/BitbucketRepositoryParser.test.ts b/plugins/catalog-backend/src/ingestion/processors/bitbucket/BitbucketRepositoryParser.test.ts index e0d430f77b..3d42d9c4ba 100644 --- a/plugins/catalog-backend/src/ingestion/processors/bitbucket/BitbucketRepositoryParser.test.ts +++ b/plugins/catalog-backend/src/ingestion/processors/bitbucket/BitbucketRepositoryParser.test.ts @@ -14,9 +14,9 @@ * limitations under the License. */ import { defaultRepositoryParser } from './BitbucketRepositoryParser'; -import { Bitbucket } from './types'; -import { BitbucketClient } from './client'; import { results } from '../index'; +import { getVoidLogger } from '@backstage/backend-common'; +import { BitbucketIntegration } from '@backstage/integration'; describe('BitbucketRepositoryParser', () => { describe('defaultRepositoryParser', () => { @@ -34,15 +34,9 @@ describe('BitbucketRepositoryParser', () => { ), ]; const actual = await defaultRepositoryParser({ - client: {} as BitbucketClient, - repository: { - project: {} as Bitbucket.Project, - slug: 'repo-slug', - links: { - self: [{ href: browseUrl }], - }, - } as Bitbucket.Repository, - path: path, + integration: {} as BitbucketIntegration, + target: `${browseUrl}${path}`, + logger: getVoidLogger(), }); let i = 0; diff --git a/plugins/catalog-backend/src/ingestion/processors/bitbucket/BitbucketRepositoryParser.ts b/plugins/catalog-backend/src/ingestion/processors/bitbucket/BitbucketRepositoryParser.ts index 05e3c6822a..9ad038f9ec 100644 --- a/plugins/catalog-backend/src/ingestion/processors/bitbucket/BitbucketRepositoryParser.ts +++ b/plugins/catalog-backend/src/ingestion/processors/bitbucket/BitbucketRepositoryParser.ts @@ -13,25 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Bitbucket } from './types'; import { CatalogProcessorResult } from '../types'; import { results } from '../index'; -import { BitbucketClient } from './client'; +import { Logger } from 'winston'; +import { BitbucketIntegration } from '@backstage/integration'; export type BitbucketRepositoryParser = (options: { - client: BitbucketClient; - repository: Bitbucket.Repository; - path: string; + integration: BitbucketIntegration; + target: string; + logger: Logger; }) => AsyncIterable; export const defaultRepositoryParser: BitbucketRepositoryParser = async function* defaultRepositoryParser({ - repository, - path, + target, }) { yield results.location( { type: 'url', - target: `${repository.links.self[0].href}${path}`, + target: target, }, // Not all locations may actually exist, since the user defined them as a wildcard pattern. // Thus, we emit them as optional and let the downstream processor find them while not outputting diff --git a/plugins/catalog-backend/src/ingestion/processors/bitbucket/client.ts b/plugins/catalog-backend/src/ingestion/processors/bitbucket/client.ts index 601461dcf5..c3c27aedfc 100644 --- a/plugins/catalog-backend/src/ingestion/processors/bitbucket/client.ts +++ b/plugins/catalog-backend/src/ingestion/processors/bitbucket/client.ts @@ -41,15 +41,6 @@ export class BitbucketClient { ); } - async getRaw( - projectKey: string, - repo: string, - path: string, - ): Promise { - const request = `${this.config.apiBaseUrl}/projects/${projectKey}/repos/${repo}/raw/${path}`; - return fetch(request, getBitbucketRequestOptions(this.config)); - } - private async pagedRequest( endpoint: string, options?: ListOptions, diff --git a/plugins/catalog-backend/src/ingestion/processors/bitbucket/types.ts b/plugins/catalog-backend/src/ingestion/processors/bitbucket/types.ts index 8a8656f666..32dc28eb98 100644 --- a/plugins/catalog-backend/src/ingestion/processors/bitbucket/types.ts +++ b/plugins/catalog-backend/src/ingestion/processors/bitbucket/types.ts @@ -13,18 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export namespace Bitbucket { - export type Project = { +export type BitbucketRepository = { + project: { key: string; }; - - export type Repository = { - project: Project; - slug: string; - links: Record; - }; - - export type Link = { - href: string; - }; -} + slug: string; + links: Record< + string, + { + href: string; + }[] + >; +}; From cfe5a53da41f03c2509ee37c2435fee733b80c45 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 29 Apr 2021 15:01:28 +0200 Subject: [PATCH 223/485] Add getSingleTag API method, start simplifying the API client Signed-off-by: Erik Engervall --- .../src/api/GitReleaseApiClient.test.ts | 11 +++ .../src/api/GitReleaseApiClient.ts | 74 ++++++++++++------- .../hooks/useCreateReleaseCandidate.ts | 4 +- .../src/features/Patch/hooks/usePatch.ts | 4 +- .../Stats/Info/hooks/useGetReleaseTimes.tsx | 17 ++--- .../Stats/helpers/getMappedReleases.test.tsx | 14 +--- .../Stats/helpers/getMappedReleases.tsx | 10 +-- .../Stats/helpers/getReleaseStats.test.tsx | 19 +---- .../Stats/helpers/getReleaseStats.tsx | 13 +--- .../src/features/Stats/helpers/getTagDate.ts | 40 ++++++++++ .../src/features/Stats/hooks/useGetTagDate.ts | 46 ++++++++++++ .../src/test-helpers/test-helpers.ts | 6 ++ 12 files changed, 167 insertions(+), 91 deletions(-) create mode 100644 plugins/git-release-manager/src/features/Stats/helpers/getTagDate.ts create mode 100644 plugins/git-release-manager/src/features/Stats/hooks/useGetTagDate.ts diff --git a/plugins/git-release-manager/src/api/GitReleaseApiClient.test.ts b/plugins/git-release-manager/src/api/GitReleaseApiClient.test.ts index 4d89e5b2e6..b37500451f 100644 --- a/plugins/git-release-manager/src/api/GitReleaseApiClient.test.ts +++ b/plugins/git-release-manager/src/api/GitReleaseApiClient.test.ts @@ -37,6 +37,16 @@ describe('GitReleaseApiClient', () => { "createRelease": [Function], "getComparison": [Function], }, + "getBranch": [Function], + "getHost": [Function], + "getLatestCommit": [Function], + "getLatestRelease": [Function], + "getOwners": [Function], + "getRecentCommits": [Function], + "getRepoPath": [Function], + "getRepositories": [Function], + "getRepository": [Function], + "getUser": [Function], "githubAuthApi": Object { "getAccessToken": [MockFunction], }, @@ -58,6 +68,7 @@ describe('GitReleaseApiClient', () => { "getAllReleases": [Function], "getAllTags": [Function], "getCommit": [Function], + "getSingleTag": [Function], }, } `); diff --git a/plugins/git-release-manager/src/api/GitReleaseApiClient.ts b/plugins/git-release-manager/src/api/GitReleaseApiClient.ts index 8e15f5c912..22762ac812 100644 --- a/plugins/git-release-manager/src/api/GitReleaseApiClient.ts +++ b/plugins/git-release-manager/src/api/GitReleaseApiClient.ts @@ -262,18 +262,13 @@ export class GitReleaseApiClient implements GitReleaseApi { }; }, - getComparison: async ({ - owner, - repo, - previousReleaseBranch, - nextReleaseBranch, - }) => { + getComparison: async ({ owner, repo, base, head }) => { const { octokit } = await this.getOctokit(); const compareCommitsResponse = await octokit.repos.compareCommits({ owner, repo, - base: previousReleaseBranch, - head: nextReleaseBranch, + base, + head, }); return { @@ -416,15 +411,15 @@ ${selectedPatchCommit.sha}`, }; }, - createTagObject: async ({ owner, repo, bumpedTag, updatedReference }) => { + createTagObject: async ({ owner, repo, tag, objectSha }) => { const { octokit } = await this.getOctokit(); const { data: createdTagObject } = await octokit.git.createTag({ owner, repo, message: 'Tag generated by your friendly neighborhood Backstage Release Manager', - tag: bumpedTag, - object: updatedReference.object.sha, + tag, + object: objectSha, type: 'commit', }); @@ -545,6 +540,21 @@ ${selectedPatchCommit.commit.message}`, createdAt: commit.commit.committer?.date, }; }, + + getSingleTag: async ({ owner, repo, tagSha }) => { + const { octokit } = await this.getOctokit(); + const singleTag = await octokit.git.getTag({ + owner, + repo, + tag_sha: tagSha, + }); + + return { + date: singleTag.data.tagger.date, + username: singleTag.data.tagger.name, + userEmail: singleTag.data.tagger.email, + }; + }, }; } @@ -654,8 +664,8 @@ export interface GitReleaseApi { getComparison: ( args: { - previousReleaseBranch: string; - nextReleaseBranch: string; + base: string; + head: string; } & OwnerRepo, ) => Promise<{ htmlUrl: string; @@ -695,13 +705,13 @@ export interface GitReleaseApi { tempCommit: CreateTempCommitResult; } & OwnerRepo, ) => Promise; - merge: ({ - base, - head, - }: { - base: string; - head: string; - } & OwnerRepo) => Promise<{ + + merge: ( + args: { + base: string; + head: string; + } & OwnerRepo, + ) => Promise<{ htmlUrl: string; commit: { message: string; @@ -739,13 +749,12 @@ export interface GitReleaseApi { }; }>; - createTagObject: ({ - bumpedTag, - updatedReference, - }: { - bumpedTag: string; - updatedReference: ReplaceTempCommitResult; - } & OwnerRepo) => Promise<{ + createTagObject: ( + args: { + tag: string; + objectSha: string; + } & OwnerRepo, + ) => Promise<{ tag: string; sha: string; }>; @@ -793,6 +802,7 @@ export interface GitReleaseApi { sha: string; }> >; + getAllReleases: ( args: OwnerRepo, ) => Promise< @@ -812,6 +822,16 @@ export interface GitReleaseApi { ) => Promise<{ createdAt: string | undefined; }>; + + getSingleTag: ( + args: { + tagSha: string; + } & OwnerRepo, + ) => Promise<{ + date: string; + username: string; + userEmail: string; + }>; }; } diff --git a/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts b/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts index 236ba7edbf..ca203a1d10 100644 --- a/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts +++ b/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts @@ -135,8 +135,8 @@ export function useCreateReleaseCandidate({ .getComparison({ owner: project.owner, repo: project.repo, - previousReleaseBranch, - nextReleaseBranch, + base: previousReleaseBranch, + head: nextReleaseBranch, }) .catch(asyncCatcher); diff --git a/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts b/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts index 4ad29d1699..d188e2bf51 100644 --- a/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts +++ b/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts @@ -238,8 +238,8 @@ export function usePatch({ .createTagObject({ owner: project.owner, repo: project.repo, - bumpedTag, - updatedReference: updatedRefRes.value, + tag: bumpedTag, + objectSha: updatedRefRes.value.object.sha, }) .catch(asyncCatcher); diff --git a/plugins/git-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx b/plugins/git-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx index 37f1d88a88..59ae036405 100644 --- a/plugins/git-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx +++ b/plugins/git-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx @@ -20,6 +20,7 @@ import { DateTime } from 'luxon'; import { useApi } from '@backstage/core'; import { getReleaseCommitPairs } from '../helpers/getReleaseCommitPairs'; +import { getTagDate } from '../../helpers/getTagDate'; import { gitReleaseManagerApiRef } from '../../../../api/serviceApiRef'; import { useProjectContext } from '../../../../contexts/ProjectContext'; import { useReleaseStatsContext } from '../../contexts/ReleaseStatsContext'; @@ -80,19 +81,11 @@ export function useGetReleaseTimes() { const { baseVersion, startCommit, endCommit } = releaseCommitPairs[index]; const [ - { createdAt: startCommitCreatedAt }, - { createdAt: endCommitCreatedAt }, + { tagDate: startCommitCreatedAt }, + { tagDate: endCommitCreatedAt }, ] = await Promise.all([ - pluginApiClient.stats.getCommit({ - owner: project.owner, - repo: project.repo, - ref: startCommit.sha, - }), - pluginApiClient.stats.getCommit({ - owner: project.owner, - repo: project.repo, - ref: endCommit.sha, - }), + getTagDate({ pluginApiClient, project, tagSha: startCommit.sha }), + getTagDate({ pluginApiClient, project, tagSha: endCommit.sha }), ]); const releaseTime: ReleaseTime = { diff --git a/plugins/git-release-manager/src/features/Stats/helpers/getMappedReleases.test.tsx b/plugins/git-release-manager/src/features/Stats/helpers/getMappedReleases.test.tsx index 5bea396d5c..fd5b23beaf 100644 --- a/plugins/git-release-manager/src/features/Stats/helpers/getMappedReleases.test.tsx +++ b/plugins/git-release-manager/src/features/Stats/helpers/getMappedReleases.test.tsx @@ -38,24 +38,14 @@ describe('getMappedReleases', () => { "releases": Object { "1.0": Object { "baseVersion": "1.0", - "candidates": Array [ - Object { - "sha": "", - "tagName": "rc-1.0.0", - }, - ], + "candidates": Array [], "createdAt": "2021-01-01T10:11:12Z", "htmlUrl": "html_url", "versions": Array [], }, "1.1": Object { "baseVersion": "1.1", - "candidates": Array [ - Object { - "sha": "", - "tagName": "rc-1.1.0", - }, - ], + "candidates": Array [], "createdAt": "2021-01-01T10:11:12Z", "htmlUrl": "html_url", "versions": Array [], diff --git a/plugins/git-release-manager/src/features/Stats/helpers/getMappedReleases.tsx b/plugins/git-release-manager/src/features/Stats/helpers/getMappedReleases.tsx index 2cbea22664..cee64436a1 100644 --- a/plugins/git-release-manager/src/features/Stats/helpers/getMappedReleases.tsx +++ b/plugins/git-release-manager/src/features/Stats/helpers/getMappedReleases.tsx @@ -40,24 +40,18 @@ export function getMappedReleases({ return acc; } - const prefix = match[1] as 'rc' | 'version'; const baseVersion = project.versioningStrategy === 'semver' ? `${match[2]}.${match[3]}` : match[2]; if (!acc.releases[baseVersion]) { - const releaseEntry = { - tagName: release.tagName, - sha: '', - }; - acc.releases[baseVersion] = { baseVersion, createdAt: release.createdAt, htmlUrl: release.htmlUrl, - candidates: prefix === 'rc' ? [releaseEntry] : [], - versions: prefix === 'version' ? [releaseEntry] : [], + candidates: [], + versions: [], }; return acc; diff --git a/plugins/git-release-manager/src/features/Stats/helpers/getReleaseStats.test.tsx b/plugins/git-release-manager/src/features/Stats/helpers/getReleaseStats.test.tsx index 3b59cc4c46..6d0cb1ca3d 100644 --- a/plugins/git-release-manager/src/features/Stats/helpers/getReleaseStats.test.tsx +++ b/plugins/git-release-manager/src/features/Stats/helpers/getReleaseStats.test.tsx @@ -27,24 +27,15 @@ describe('getReleaseStats', () => { baseVersion: '1.0', createdAt: '2021-01-01T10:11:12Z', htmlUrl: 'html_url', - candidates: [ - { - tagName: 'rc-1.0.0', - sha: '', - }, - ], + candidates: [], versions: [], }, '1.1': { baseVersion: '1.1', createdAt: '2021-01-01T10:11:12Z', htmlUrl: 'html_url', - candidates: [ - { - tagName: 'rc-1.1.0', - sha: '', - }, - ], + candidates: [], + versions: [], }, }, @@ -96,10 +87,6 @@ describe('getReleaseStats', () => { "1.1": Object { "baseVersion": "1.1", "candidates": Array [ - Object { - "sha": "", - "tagName": "rc-1.1.0", - }, Object { "sha": "sha", "tagName": "rc-1.1.1", diff --git a/plugins/git-release-manager/src/features/Stats/helpers/getReleaseStats.tsx b/plugins/git-release-manager/src/features/Stats/helpers/getReleaseStats.tsx index 41ce41b1ac..fb3bad8d0c 100644 --- a/plugins/git-release-manager/src/features/Stats/helpers/getReleaseStats.tsx +++ b/plugins/git-release-manager/src/features/Stats/helpers/getReleaseStats.tsx @@ -55,18 +55,7 @@ export function getReleaseStats({ } const dest = release[prefix === 'rc' ? 'candidates' : 'versions']; - const releaseToEnrich = dest.find( - ({ tagName }) => tagName === tag.tagName, - ); - - if (releaseToEnrich) { - releaseToEnrich.sha = tag.sha; - } else { - dest.push({ - tagName: tag.tagName, - sha: tag.sha, - }); - } + dest.push(tag); return acc; }, diff --git a/plugins/git-release-manager/src/features/Stats/helpers/getTagDate.ts b/plugins/git-release-manager/src/features/Stats/helpers/getTagDate.ts new file mode 100644 index 0000000000..f0c3bcd445 --- /dev/null +++ b/plugins/git-release-manager/src/features/Stats/helpers/getTagDate.ts @@ -0,0 +1,40 @@ +/* + * 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 { GitReleaseApi } from '../../../api/GitReleaseApiClient'; +import { Project } from '../../../contexts/ProjectContext'; + +interface GetTagDate { + pluginApiClient: GitReleaseApi; + project: Project; + tagSha: string; +} + +export const getTagDate = async ({ + pluginApiClient, + project, + tagSha, +}: GetTagDate) => { + const commitRes = await pluginApiClient.stats.getCommit({ + owner: project.owner, + repo: project.repo, + ref: tagSha, + }); + + return { + tagDate: commitRes.createdAt, + }; +}; diff --git a/plugins/git-release-manager/src/features/Stats/hooks/useGetTagDate.ts b/plugins/git-release-manager/src/features/Stats/hooks/useGetTagDate.ts new file mode 100644 index 0000000000..028b3a1929 --- /dev/null +++ b/plugins/git-release-manager/src/features/Stats/hooks/useGetTagDate.ts @@ -0,0 +1,46 @@ +/* + * 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 { useAsync } from 'react-use'; +import { useApi } from '@backstage/core'; + +import { getTagDate } from '../helpers/getTagDate'; +import { gitReleaseManagerApiRef } from '../../../api/serviceApiRef'; +import { GitReleaseManagerError } from '../../../errors/GitReleaseManagerError'; +import { ReleaseStats } from '../contexts/ReleaseStatsContext'; +import { UnboxArray } from '../../../types/helpers'; +import { useProjectContext } from '../../../contexts/ProjectContext'; + +export const useGetTagDate = ({ + tag, +}: { + tag: UnboxArray; +}) => { + const pluginApiClient = useApi(gitReleaseManagerApiRef); + const { project } = useProjectContext(); + + const tagDate = useAsync(async () => { + if (!tag) { + throw new GitReleaseManagerError('Missing tag details to get tag date'); + } + + return await getTagDate({ pluginApiClient, project, tagSha: tag.sha }); + }); + + return { + tagDate, + }; +}; diff --git a/plugins/git-release-manager/src/test-helpers/test-helpers.ts b/plugins/git-release-manager/src/test-helpers/test-helpers.ts index 886fad9de0..56b1d0214f 100644 --- a/plugins/git-release-manager/src/test-helpers/test-helpers.ts +++ b/plugins/git-release-manager/src/test-helpers/test-helpers.ts @@ -306,5 +306,11 @@ export const mockApiClient: GitReleaseApi = { getCommit: jest.fn(async () => ({ createdAt: '2021-01-01T10:11:12Z', })), + + getSingleTag: jest.fn(async () => ({ + date: '2021-04-29T12:48:30.120Z', + username: 'mock_usersingle_tag_name', + userEmail: 'mock_userEsingle_tag_mail', + })), }, }; From 8d0e7f0adbd8274a15593bf8c48cac0e97233481 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 29 Apr 2021 15:23:29 +0200 Subject: [PATCH 224/485] Continue flattening API Signed-off-by: Erik Engervall --- .../src/api/GitReleaseApiClient.test.ts | 4 +- .../src/api/GitReleaseApiClient.ts | 129 ++++++++++-------- .../src/constants/constants.test.ts | 1 + .../src/constants/constants.ts | 3 + .../hooks/useCreateReleaseCandidate.test.tsx | 18 ++- .../hooks/useCreateReleaseCandidate.ts | 88 ++++++++++-- .../src/features/Patch/hooks/usePatch.test.ts | 4 + .../src/features/Patch/hooks/usePatch.ts | 12 +- .../src/test-helpers/test-helpers.ts | 24 ++-- 9 files changed, 200 insertions(+), 83 deletions(-) diff --git a/plugins/git-release-manager/src/api/GitReleaseApiClient.test.ts b/plugins/git-release-manager/src/api/GitReleaseApiClient.test.ts index b37500451f..215c615963 100644 --- a/plugins/git-release-manager/src/api/GitReleaseApiClient.test.ts +++ b/plugins/git-release-manager/src/api/GitReleaseApiClient.test.ts @@ -33,10 +33,11 @@ describe('GitReleaseApiClient', () => { GitReleaseApiClient { "baseUrl": "https://api.github.com", "createRc": Object { - "createRef": [Function], "createRelease": [Function], "getComparison": [Function], }, + "createRef": [Function], + "createTagObject": [Function], "getBranch": [Function], "getHost": [Function], "getLatestCommit": [Function], @@ -54,7 +55,6 @@ describe('GitReleaseApiClient', () => { "patch": Object { "createCherryPickCommit": [Function], "createReference": [Function], - "createTagObject": [Function], "createTempCommit": [Function], "forceBranchHeadToTempCommit": [Function], "merge": [Function], diff --git a/plugins/git-release-manager/src/api/GitReleaseApiClient.ts b/plugins/git-release-manager/src/api/GitReleaseApiClient.ts index 22762ac812..4a837a02e1 100644 --- a/plugins/git-release-manager/src/api/GitReleaseApiClient.ts +++ b/plugins/git-release-manager/src/api/GitReleaseApiClient.ts @@ -247,21 +247,22 @@ export class GitReleaseApiClient implements GitReleaseApi { }; }; + createRef: GitReleaseApi['createRef'] = async ({ owner, repo, sha, ref }) => { + const { octokit } = await this.getOctokit(); + const createRefResponse = await octokit.git.createRef({ + owner, + repo, + ref, + sha, + }); + + return { + ref: createRefResponse.data.ref, + objectSha: createRefResponse.data.object.sha, + }; + }; + createRc: GitReleaseApi['createRc'] = { - createRef: async ({ owner, repo, mostRecentSha, targetBranch }) => { - const { octokit } = await this.getOctokit(); - const createRefResponse = await octokit.git.createRef({ - owner, - repo, - ref: `refs/heads/${targetBranch}`, - sha: mostRecentSha, - }); - - return { - ref: createRefResponse.data.ref, - }; - }, - getComparison: async ({ owner, repo, base, head }) => { const { octokit } = await this.getOctokit(); const compareCommitsResponse = await octokit.repos.compareCommits({ @@ -304,6 +305,36 @@ export class GitReleaseApiClient implements GitReleaseApi { }, }; + createTagObject: GitReleaseApi['createTagObject'] = async ({ + owner, + repo, + tag, + objectSha, + taggerName, + taggerEmail, + message, + }) => { + const { octokit } = await this.getOctokit(); + const { data: createdTagObject } = await octokit.git.createTag({ + owner, + repo, + message, + tag, + object: objectSha, + type: 'commit', + tagger: { + date: new Date().toISOString(), + email: taggerEmail, + name: taggerName, + }, + }); + + return { + tagName: createdTagObject.tag, + tagSha: createdTagObject.sha, + }; + }; + patch: GitReleaseApi['patch'] = { createTempCommit: async ({ owner, @@ -411,31 +442,13 @@ ${selectedPatchCommit.sha}`, }; }, - createTagObject: async ({ owner, repo, tag, objectSha }) => { - const { octokit } = await this.getOctokit(); - const { data: createdTagObject } = await octokit.git.createTag({ - owner, - repo, - message: - 'Tag generated by your friendly neighborhood Backstage Release Manager', - tag, - object: objectSha, - type: 'commit', - }); - - return { - tag: createdTagObject.tag, - sha: createdTagObject.sha, - }; - }, - createReference: async ({ owner, repo, bumpedTag, createdTagObject }) => { const { octokit } = await this.getOctokit(); const { data: reference } = await octokit.git.createRef({ owner, repo, ref: `refs/tags/${bumpedTag}`, - sha: createdTagObject.sha, + sha: createdTagObject.tagSha, }); return { @@ -652,16 +665,17 @@ export interface GitReleaseApi { }; }>; - createRc: { - createRef: ( - args: { - mostRecentSha: string; - targetBranch: string; - } & OwnerRepo, - ) => Promise<{ + createRef: ( + args: { ref: string; - }>; + sha: string; + } & OwnerRepo, + ) => Promise<{ + ref: string; + objectSha: string; + }>; + createRc: { getComparison: ( args: { base: string; @@ -685,6 +699,20 @@ export interface GitReleaseApi { tagName: string; }>; }; + + createTagObject: ( + args: { + tag: string; + taggerEmail?: string; + message: string; + objectSha: string; + taggerName: string; + } & OwnerRepo, + ) => Promise<{ + tagName: string; + tagSha: string; + }>; + patch: { createTempCommit: ( args: { @@ -749,16 +777,6 @@ export interface GitReleaseApi { }; }>; - createTagObject: ( - args: { - tag: string; - objectSha: string; - } & OwnerRepo, - ) => Promise<{ - tag: string; - sha: string; - }>; - createReference: ( args: { bumpedTag: string; @@ -854,9 +872,7 @@ export type GetLatestCommitResult = UnboxReturnedPromise< GitReleaseApi['getLatestCommit'] >; export type GetBranchResult = UnboxReturnedPromise; -export type CreateRefResult = UnboxReturnedPromise< - GitReleaseApi['createRc']['createRef'] ->; +export type CreateRefResult = UnboxReturnedPromise; export type GetComparisonResult = UnboxReturnedPromise< GitReleaseApi['createRc']['getComparison'] >; @@ -877,7 +893,7 @@ export type ReplaceTempCommitResult = UnboxReturnedPromise< GitReleaseApi['patch']['replaceTempCommit'] >; export type CreateTagObjectResult = UnboxReturnedPromise< - GitReleaseApi['patch']['createTagObject'] + GitReleaseApi['createTagObject'] >; export type CreateReferenceResult = UnboxReturnedPromise< GitReleaseApi['patch']['createReference'] @@ -897,3 +913,6 @@ export type GetCommitResult = UnboxReturnedPromise< export type GetAllReleasesResult = UnboxReturnedPromise< GitReleaseApi['stats']['getAllReleases'] >; +export type GetSingleTagResult = UnboxReturnedPromise< + GitReleaseApi['stats']['getSingleTag'] +>; diff --git a/plugins/git-release-manager/src/constants/constants.test.ts b/plugins/git-release-manager/src/constants/constants.test.ts index cf2b7d7548..759c2c7ab2 100644 --- a/plugins/git-release-manager/src/constants/constants.test.ts +++ b/plugins/git-release-manager/src/constants/constants.test.ts @@ -30,6 +30,7 @@ describe('constants', () => { "minor": "minor", "patch": "patch", }, + "TAG_OBJECT_MESSAGE": "Tag generated by your friendly neighborhood Backstage Release Manager", "VERSIONING_STRATEGIES": Object { "calver": "calver", "semver": "semver", diff --git a/plugins/git-release-manager/src/constants/constants.ts b/plugins/git-release-manager/src/constants/constants.ts index 195a4b80af..099a5913ca 100644 --- a/plugins/git-release-manager/src/constants/constants.ts +++ b/plugins/git-release-manager/src/constants/constants.ts @@ -37,3 +37,6 @@ export const VERSIONING_STRATEGIES: { semver: 'semver', calver: 'calver', } as const; + +export const TAG_OBJECT_MESSAGE = + 'Tag generated by your friendly neighborhood Backstage Release Manager'; diff --git a/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.test.tsx b/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.test.tsx index 2acffbf52c..b4551083a3 100644 --- a/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.test.tsx +++ b/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.test.tsx @@ -23,6 +23,7 @@ import { mockDefaultBranch, mockNextGitInfoCalver, mockReleaseVersionCalver, + mockUser, } from '../../../test-helpers/test-helpers'; import { useCreateReleaseCandidate } from './useCreateReleaseCandidate'; @@ -30,6 +31,9 @@ jest.mock('@backstage/core', () => ({ useApi: () => mockApiClient, createApiRef: jest.fn(), })); +jest.mock('../../../contexts/UserContext', () => ({ + useUserContext: () => ({ user: mockUser }), +})); describe('useCreateReleaseCandidate', () => { beforeEach(jest.clearAllMocks); @@ -49,7 +53,7 @@ describe('useCreateReleaseCandidate', () => { }); expect(result.error).toEqual(undefined); - expect(result.current.responseSteps).toHaveLength(4); + expect(result.current.responseSteps).toHaveLength(6); }); it('should return the expected responseSteps and progress (with successCb)', async () => { @@ -67,7 +71,7 @@ describe('useCreateReleaseCandidate', () => { await waitFor(() => result.current.run()); }); - expect(result.current.responseSteps).toHaveLength(5); + expect(result.current.responseSteps).toHaveLength(7); expect(result.current).toMatchInlineSnapshot(` Object { "progress": 100, @@ -78,7 +82,15 @@ describe('useCreateReleaseCandidate', () => { "secondaryMessage": "with message \\"latestCommit.commit.message\\"", }, Object { - "message": "Cut Release Branch", + "message": "Created Release Branch", + "secondaryMessage": "with ref \\"mock_createRef_ref\\"", + }, + Object { + "message": "Created Tag Object", + "secondaryMessage": "with sha \\"mock_tag_object_sha\\"", + }, + Object { + "message": "Cut Tag Reference", "secondaryMessage": "with ref \\"mock_createRef_ref\\"", }, Object { diff --git a/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts b/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts index ca203a1d10..3e6967ff37 100644 --- a/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts +++ b/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts @@ -27,7 +27,9 @@ import { getReleaseCandidateGitInfo } from '../../../helpers/getReleaseCandidate import { gitReleaseManagerApiRef } from '../../../api/serviceApiRef'; import { GitReleaseManagerError } from '../../../errors/GitReleaseManagerError'; import { Project } from '../../../contexts/ProjectContext'; +import { TAG_OBJECT_MESSAGE } from '../../../constants/constants'; import { useResponseSteps } from '../../../hooks/useResponseSteps'; +import { useUserContext } from '../../../contexts/UserContext'; interface UseCreateReleaseCandidate { defaultBranch: GetRepositoryResult['defaultBranch']; @@ -45,6 +47,7 @@ export function useCreateReleaseCandidate({ successCb, }: UseCreateReleaseCandidate): CardHook { const pluginApiClient = useApi(gitReleaseManagerApiRef); + const { user } = useUserContext(); if (releaseCandidateGitInfo.error) { throw new GitReleaseManagerError( @@ -87,18 +90,18 @@ export function useCreateReleaseCandidate({ }); /** - * (2) Create a new ref based on the default branch's most recent sha + * (2) Create release branch based on default branch's most recent sha */ - const createRcRes = useAsync(async () => { + const releaseBranchRes = useAsync(async () => { abortIfError(latestCommitRes.error); if (!latestCommitRes.value) return undefined; - const createdRef = await pluginApiClient.createRc + const createdReleaseBranch = await pluginApiClient .createRef({ owner: project.owner, repo: project.repo, - mostRecentSha: latestCommitRes.value.latestCommit.sha, - targetBranch: releaseCandidateGitInfo.rcBranch, + sha: latestCommitRes.value.latestCommit.sha, + ref: `refs/heads/${releaseCandidateGitInfo.rcBranch}`, }) .catch(error => { if (error?.body?.message === 'Reference already exists') { @@ -111,17 +114,80 @@ export function useCreateReleaseCandidate({ .catch(asyncCatcher); addStepToResponseSteps({ - message: 'Cut Release Branch', + message: 'Created Release Branch', + secondaryMessage: `with ref "${createdReleaseBranch.ref}"`, + }); + + return { + ...createdReleaseBranch, + }; + }, [latestCommitRes.value, latestCommitRes.error]); + + /** + * (3) Create tag object for our soon-to-be-created annotated tag + */ + const tagObjectRes = useAsync(async () => { + abortIfError(releaseBranchRes.error); + if (!releaseBranchRes.value) return undefined; + + const createdTagObject = await pluginApiClient + .createTagObject({ + owner: project.owner, + repo: project.repo, + tag: releaseCandidateGitInfo.rcReleaseTag, + objectSha: releaseBranchRes.value.objectSha, + taggerName: user.username, + taggerEmail: user.email, + message: TAG_OBJECT_MESSAGE, + }) + .catch(asyncCatcher); + + addStepToResponseSteps({ + message: 'Created Tag Object', + secondaryMessage: `with sha "${createdTagObject.tagSha}"`, + }); + + return { + ...createdTagObject, + }; + }, [releaseBranchRes.value, releaseBranchRes.error]); + + /** + * (4) Create reference for tag object + */ + const createRcRes = useAsync(async () => { + abortIfError(tagObjectRes.error); + if (!tagObjectRes.value) return undefined; + + const createdRef = await pluginApiClient + .createRef({ + owner: project.owner, + repo: project.repo, + ref: `refs/tags/${releaseCandidateGitInfo.rcReleaseTag}`, + sha: tagObjectRes.value.tagSha, + }) + .catch(error => { + if (error?.body?.message === 'Reference already exists') { + throw new GitReleaseManagerError( + `Tag reference "${releaseCandidateGitInfo.rcReleaseTag}" already exists`, + ); + } + throw error; + }) + .catch(asyncCatcher); + + addStepToResponseSteps({ + message: 'Cut Tag Reference', secondaryMessage: `with ref "${createdRef.ref}"`, }); return { ...createdRef, }; - }, [latestCommitRes.value, latestCommitRes.error]); + }, [tagObjectRes.value, tagObjectRes.error]); /** - * (3) Compose a body for the release + * (5) Compose a body for the release */ const getComparisonRes = useAsync(async () => { abortIfError(createRcRes.error); @@ -163,7 +229,7 @@ export function useCreateReleaseCandidate({ }, [createRcRes.value, createRcRes.error]); /** - * (4) Creates the Git Release itself + * (6) Creates the Git Release itself */ const createReleaseRes = useAsync(async () => { abortIfError(getComparisonRes.error); @@ -192,7 +258,7 @@ export function useCreateReleaseCandidate({ }, [getComparisonRes.value, getComparisonRes.error]); /** - * (5) Run successCb if defined + * (7) Run successCb if defined */ useAsync(async () => { if (successCb && !!createReleaseRes.value && !!getComparisonRes.value) { @@ -217,7 +283,7 @@ export function useCreateReleaseCandidate({ } }, [createReleaseRes.value]); - const TOTAL_STEPS = 4 + (!!successCb ? 1 : 0); + const TOTAL_STEPS = 6 + (!!successCb ? 1 : 0); const [progress, setProgress] = useState(0); useEffect(() => { setProgress((responseSteps.length / TOTAL_STEPS) * 100); diff --git a/plugins/git-release-manager/src/features/Patch/hooks/usePatch.test.ts b/plugins/git-release-manager/src/features/Patch/hooks/usePatch.test.ts index 5fe1614e42..9741244c23 100644 --- a/plugins/git-release-manager/src/features/Patch/hooks/usePatch.test.ts +++ b/plugins/git-release-manager/src/features/Patch/hooks/usePatch.test.ts @@ -24,6 +24,7 @@ import { mockReleaseVersionCalver, mockSelectedPatchCommit, mockTagParts, + mockUser, } from '../../../test-helpers/test-helpers'; import { usePatch } from './usePatch'; @@ -31,6 +32,9 @@ jest.mock('@backstage/core', () => ({ useApi: () => mockApiClient, createApiRef: jest.fn(), })); +jest.mock('../../../contexts/UserContext', () => ({ + useUserContext: () => ({ user: mockUser }), +})); describe('patch', () => { beforeEach(jest.clearAllMocks); diff --git a/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts b/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts index d188e2bf51..7ae8ed920b 100644 --- a/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts +++ b/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts @@ -28,6 +28,8 @@ import { gitReleaseManagerApiRef } from '../../../api/serviceApiRef'; import { Project } from '../../../contexts/ProjectContext'; import { SemverTagParts } from '../../../helpers/tagParts/getSemverTagParts'; import { useResponseSteps } from '../../../hooks/useResponseSteps'; +import { TAG_OBJECT_MESSAGE } from '../../../constants/constants'; +import { useUserContext } from '../../../contexts/UserContext'; interface Patch { bumpedTag: string; @@ -46,6 +48,7 @@ export function usePatch({ successCb, }: Patch): CardHook { const pluginApiClient = useApi(gitReleaseManagerApiRef); + const { user } = useUserContext(); const { responseSteps, addStepToResponseSteps, @@ -234,18 +237,21 @@ export function usePatch({ abortIfError(updatedRefRes.error); if (!updatedRefRes.value) return undefined; - const createdTagObject = await pluginApiClient.patch + const createdTagObject = await pluginApiClient .createTagObject({ owner: project.owner, repo: project.repo, tag: bumpedTag, objectSha: updatedRefRes.value.object.sha, + message: TAG_OBJECT_MESSAGE, + taggerName: user.username, + taggerEmail: user.email, }) .catch(asyncCatcher); addStepToResponseSteps({ message: 'Created new tag object', - secondaryMessage: `with name "${createdTagObject.tag}"`, + secondaryMessage: `with name "${createdTagObject.tagName}"`, }); return { @@ -272,7 +278,7 @@ export function usePatch({ addStepToResponseSteps({ message: `Created new reference "${reference.ref}"`, - secondaryMessage: `for tag object "${createdTagObjRes.value.tag}"`, + secondaryMessage: `for tag object "${createdTagObjRes.value.tagName}"`, }); return { diff --git a/plugins/git-release-manager/src/test-helpers/test-helpers.ts b/plugins/git-release-manager/src/test-helpers/test-helpers.ts index 56b1d0214f..47a04e62ff 100644 --- a/plugins/git-release-manager/src/test-helpers/test-helpers.ts +++ b/plugins/git-release-manager/src/test-helpers/test-helpers.ts @@ -40,6 +40,11 @@ const MOCK_RELEASE_BRANCH_NAME_SEMVER = `rc/${A_SEMVER_VERSION}`; const MOCK_RELEASE_CANDIDATE_TAG_NAME_SEMVER = `rc-${A_SEMVER_VERSION}`; const MOCK_RELEASE_VERSION_TAG_NAME_SEMVER = `version-${A_SEMVER_VERSION}`; +export const mockUser = { + username: mockOwner, + email: mockEmail, +}; + export const mockSemverProject: Project = { owner: mockOwner, repo: mockRepo, @@ -214,11 +219,12 @@ export const mockApiClient: GitReleaseApi = { getBranch: jest.fn(async () => createMockBranch()), - createRc: { - createRef: jest.fn(async () => ({ - ref: 'mock_createRef_ref', - })), + createRef: jest.fn(async () => ({ + ref: 'mock_createRef_ref', + objectSha: 'mock_createRef_objectSha', + })), + createRc: { createRelease: jest.fn(async () => ({ name: 'mock_createRelease_name', htmlUrl: 'mock_createRelease_html_url', @@ -231,6 +237,11 @@ export const mockApiClient: GitReleaseApi = { })), }, + createTagObject: jest.fn(async () => ({ + tagName: 'mock_tag_object_tag', + tagSha: 'mock_tag_object_sha', + })), + patch: { createCherryPickCommit: jest.fn(async () => ({ message: 'mock_cherrypick_message', @@ -241,11 +252,6 @@ export const mockApiClient: GitReleaseApi = { ref: 'mock_reference_ref', })), - createTagObject: jest.fn(async () => ({ - tag: 'mock_tag_object_tag', - sha: 'mock_tag_object_sha', - })), - createTempCommit: jest.fn(async () => ({ message: 'mock_commit_message', sha: 'mock_commit_sha', From 34a5d56d80b69d83a1f42ef4ae639a816c4fa6e2 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 29 Apr 2021 15:30:35 +0200 Subject: [PATCH 225/485] Create getPatchCommitSuffix helper to help the patch list to filter commits Signed-off-by: Erik Engervall --- .../src/api/GitReleaseApiClient.ts | 4 +++- .../src/features/Patch/PatchBody.tsx | 7 ++++++- .../Patch/helpers/getPatchCommitSuffix.ts | 19 +++++++++++++++++++ .../src/features/Patch/hooks/usePatch.ts | 6 +++++- 4 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 plugins/git-release-manager/src/features/Patch/helpers/getPatchCommitSuffix.ts diff --git a/plugins/git-release-manager/src/api/GitReleaseApiClient.ts b/plugins/git-release-manager/src/api/GitReleaseApiClient.ts index 4a837a02e1..d35b5a043b 100644 --- a/plugins/git-release-manager/src/api/GitReleaseApiClient.ts +++ b/plugins/git-release-manager/src/api/GitReleaseApiClient.ts @@ -401,6 +401,7 @@ export class GitReleaseApiClient implements GitReleaseApi { selectedPatchCommit, mergeTree, releaseBranchSha, + messageSuffix, }) => { const { octokit } = await this.getOctokit(); const { data: cherryPickCommit } = await octokit.git.createCommit({ @@ -408,7 +409,7 @@ export class GitReleaseApiClient implements GitReleaseApi { repo, message: `[patch ${bumpedTag}] ${selectedPatchCommit.commit.message} -${selectedPatchCommit.sha}`, +${messageSuffix}`, tree: mergeTree, parents: [releaseBranchSha], }); @@ -757,6 +758,7 @@ export interface GitReleaseApi { >; mergeTree: string; releaseBranchSha: string; + messageSuffix: string; } & OwnerRepo, ) => Promise<{ message: string; diff --git a/plugins/git-release-manager/src/features/Patch/PatchBody.tsx b/plugins/git-release-manager/src/features/Patch/PatchBody.tsx index ab2769e2a1..8e916afa2e 100644 --- a/plugins/git-release-manager/src/features/Patch/PatchBody.tsx +++ b/plugins/git-release-manager/src/features/Patch/PatchBody.tsx @@ -42,6 +42,7 @@ import { CalverTagParts } from '../../helpers/tagParts/getCalverTagParts'; import { CenteredCircularProgress } from '../../components/CenteredCircularProgress'; import { ComponentConfigPatch } from '../../types/types'; import { Differ } from '../../components/Differ'; +import { getPatchCommitSuffix } from './helpers/getPatchCommitSuffix'; import { gitReleaseManagerApiRef } from '../../api/serviceApiRef'; import { GitReleaseManagerError } from '../../errors/GitReleaseManagerError'; import { ResponseStepDialog } from '../../components/ResponseStepDialog/ResponseStepDialog'; @@ -159,7 +160,11 @@ export const PatchBody = ({ const commitExistsOnReleaseBranch = !!gitDataResponse.value?.recentCommitsOnReleaseBranch.find( releaseBranchCommit => releaseBranchCommit.sha === commit.sha || - releaseBranchCommit.commit.message.includes(commit.sha), // The selected patch commit's sha is included in the commit message + // The selected patch commit's sha is included in the commit message, + // which means it's part of a previous patch + releaseBranchCommit.commit.message.includes( + getPatchCommitSuffix({ commitSha: commit.sha }), + ), ); const hasNoParent = !commit.firstParentSha; diff --git a/plugins/git-release-manager/src/features/Patch/helpers/getPatchCommitSuffix.ts b/plugins/git-release-manager/src/features/Patch/helpers/getPatchCommitSuffix.ts new file mode 100644 index 0000000000..09b867fd25 --- /dev/null +++ b/plugins/git-release-manager/src/features/Patch/helpers/getPatchCommitSuffix.ts @@ -0,0 +1,19 @@ +/* + * 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. + */ + +export const getPatchCommitSuffix = ({ commitSha }: { commitSha: string }) => { + return `[Backstage patch ${commitSha}]`; +}; diff --git a/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts b/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts index 7ae8ed920b..bc71267089 100644 --- a/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts +++ b/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts @@ -24,11 +24,12 @@ import { } from '../../../api/GitReleaseApiClient'; import { CalverTagParts } from '../../../helpers/tagParts/getCalverTagParts'; import { ComponentConfigPatch, CardHook } from '../../../types/types'; +import { getPatchCommitSuffix } from '../helpers/getPatchCommitSuffix'; import { gitReleaseManagerApiRef } from '../../../api/serviceApiRef'; import { Project } from '../../../contexts/ProjectContext'; import { SemverTagParts } from '../../../helpers/tagParts/getSemverTagParts'; -import { useResponseSteps } from '../../../hooks/useResponseSteps'; import { TAG_OBJECT_MESSAGE } from '../../../constants/constants'; +import { useResponseSteps } from '../../../hooks/useResponseSteps'; import { useUserContext } from '../../../contexts/UserContext'; interface Patch { @@ -190,6 +191,9 @@ export function usePatch({ mergeTree: mergeRes.value.commit.tree.sha, releaseBranchSha, selectedPatchCommit: releaseBranchRes.value.selectedPatchCommit, + messageSuffix: getPatchCommitSuffix({ + commitSha: releaseBranchRes.value.selectedPatchCommit.sha, + }), }) .catch(asyncCatcher); From c7ba03393c6abd2fb37827f5fa2cf4708088b680 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 29 Apr 2021 15:33:51 +0200 Subject: [PATCH 226/485] Replace api.patch.createReference with api.createRef Signed-off-by: Erik Engervall --- .../src/api/GitReleaseApiClient.test.ts | 1 - .../src/api/GitReleaseApiClient.ts | 26 ------------------- .../src/features/Patch/hooks/usePatch.test.ts | 2 +- .../src/features/Patch/hooks/usePatch.ts | 8 +++--- .../src/test-helpers/test-helpers.ts | 4 --- 5 files changed, 5 insertions(+), 36 deletions(-) diff --git a/plugins/git-release-manager/src/api/GitReleaseApiClient.test.ts b/plugins/git-release-manager/src/api/GitReleaseApiClient.test.ts index 215c615963..ba697ca99b 100644 --- a/plugins/git-release-manager/src/api/GitReleaseApiClient.test.ts +++ b/plugins/git-release-manager/src/api/GitReleaseApiClient.test.ts @@ -54,7 +54,6 @@ describe('GitReleaseApiClient', () => { "host": "github.com", "patch": Object { "createCherryPickCommit": [Function], - "createReference": [Function], "createTempCommit": [Function], "forceBranchHeadToTempCommit": [Function], "merge": [Function], diff --git a/plugins/git-release-manager/src/api/GitReleaseApiClient.ts b/plugins/git-release-manager/src/api/GitReleaseApiClient.ts index d35b5a043b..5d263f54a0 100644 --- a/plugins/git-release-manager/src/api/GitReleaseApiClient.ts +++ b/plugins/git-release-manager/src/api/GitReleaseApiClient.ts @@ -443,20 +443,6 @@ ${messageSuffix}`, }; }, - createReference: async ({ owner, repo, bumpedTag, createdTagObject }) => { - const { octokit } = await this.getOctokit(); - const { data: reference } = await octokit.git.createRef({ - owner, - repo, - ref: `refs/tags/${bumpedTag}`, - sha: createdTagObject.tagSha, - }); - - return { - ref: reference.ref, - }; - }, - updateRelease: async ({ owner, repo, @@ -779,15 +765,6 @@ export interface GitReleaseApi { }; }>; - createReference: ( - args: { - bumpedTag: string; - createdTagObject: CreateTagObjectResult; - } & OwnerRepo, - ) => Promise<{ - ref: string; - }>; - updateRelease: ( args: { bumpedTag: string; @@ -897,9 +874,6 @@ export type ReplaceTempCommitResult = UnboxReturnedPromise< export type CreateTagObjectResult = UnboxReturnedPromise< GitReleaseApi['createTagObject'] >; -export type CreateReferenceResult = UnboxReturnedPromise< - GitReleaseApi['patch']['createReference'] ->; export type UpdateReleaseResult = UnboxReturnedPromise< GitReleaseApi['patch']['updateRelease'] >; diff --git a/plugins/git-release-manager/src/features/Patch/hooks/usePatch.test.ts b/plugins/git-release-manager/src/features/Patch/hooks/usePatch.test.ts index 9741244c23..8d91d1c467 100644 --- a/plugins/git-release-manager/src/features/Patch/hooks/usePatch.test.ts +++ b/plugins/git-release-manager/src/features/Patch/hooks/usePatch.test.ts @@ -106,7 +106,7 @@ describe('patch', () => { "secondaryMessage": "with name \\"mock_tag_object_tag\\"", }, Object { - "message": "Created new reference \\"mock_reference_ref\\"", + "message": "Created new reference \\"mock_createRef_ref\\"", "secondaryMessage": "for tag object \\"mock_tag_object_tag\\"", }, Object { diff --git a/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts b/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts index bc71267089..140648e91a 100644 --- a/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts +++ b/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts @@ -271,12 +271,12 @@ export function usePatch({ abortIfError(createdTagObjRes.error); if (!createdTagObjRes.value) return undefined; - const reference = await pluginApiClient.patch - .createReference({ + const reference = await pluginApiClient + .createRef({ owner: project.owner, repo: project.repo, - bumpedTag, - createdTagObject: createdTagObjRes.value, + ref: `refs/tags/${bumpedTag}`, + sha: createdTagObjRes.value.tagSha, }) .catch(asyncCatcher); diff --git a/plugins/git-release-manager/src/test-helpers/test-helpers.ts b/plugins/git-release-manager/src/test-helpers/test-helpers.ts index 47a04e62ff..6b2951b9a3 100644 --- a/plugins/git-release-manager/src/test-helpers/test-helpers.ts +++ b/plugins/git-release-manager/src/test-helpers/test-helpers.ts @@ -248,10 +248,6 @@ export const mockApiClient: GitReleaseApi = { sha: 'mock_cherrypick_sha', })), - createReference: jest.fn(async () => ({ - ref: 'mock_reference_ref', - })), - createTempCommit: jest.fn(async () => ({ message: 'mock_commit_message', sha: 'mock_commit_sha', From 46d8949703364daa1f9d2feb19e95b5288bd9299 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 29 Apr 2021 15:43:41 +0200 Subject: [PATCH 227/485] Create annotated tags for promotions as well. Remove duplicate api.getCommit method Signed-off-by: Erik Engervall --- .../src/api/GitReleaseApiClient.test.ts | 3 +- .../src/api/GitReleaseApiClient.ts | 41 ++----- .../hooks/useCreateReleaseCandidate.ts | 4 +- .../PromoteRc/hooks/usePromoteRc.test.ts | 20 +++- .../features/PromoteRc/hooks/usePromoteRc.ts | 102 +++++++++++++++++- .../src/features/Stats/helpers/getTagDate.ts | 2 +- .../src/features/Stats/hooks/useGetCommit.ts | 2 +- .../src/test-helpers/test-helpers.ts | 7 +- 8 files changed, 129 insertions(+), 52 deletions(-) diff --git a/plugins/git-release-manager/src/api/GitReleaseApiClient.test.ts b/plugins/git-release-manager/src/api/GitReleaseApiClient.test.ts index ba697ca99b..1896693c6f 100644 --- a/plugins/git-release-manager/src/api/GitReleaseApiClient.test.ts +++ b/plugins/git-release-manager/src/api/GitReleaseApiClient.test.ts @@ -39,8 +39,8 @@ describe('GitReleaseApiClient', () => { "createRef": [Function], "createTagObject": [Function], "getBranch": [Function], + "getCommit": [Function], "getHost": [Function], - "getLatestCommit": [Function], "getLatestRelease": [Function], "getOwners": [Function], "getRecentCommits": [Function], @@ -66,7 +66,6 @@ describe('GitReleaseApiClient', () => { "stats": Object { "getAllReleases": [Function], "getAllTags": [Function], - "getCommit": [Function], "getSingleTag": [Function], }, } diff --git a/plugins/git-release-manager/src/api/GitReleaseApiClient.ts b/plugins/git-release-manager/src/api/GitReleaseApiClient.ts index 5d263f54a0..44816e860b 100644 --- a/plugins/git-release-manager/src/api/GitReleaseApiClient.ts +++ b/plugins/git-release-manager/src/api/GitReleaseApiClient.ts @@ -195,16 +195,12 @@ export class GitReleaseApiClient implements GitReleaseApi { }; }; - getLatestCommit: GitReleaseApi['getLatestCommit'] = async ({ - owner, - repo, - defaultBranch, - }) => { + getCommit: GitReleaseApi['getCommit'] = async ({ owner, repo, ref }) => { const { octokit } = await this.getOctokit(); const { data: latestCommit } = await octokit.repos.getCommit({ owner, repo, - ref: defaultBranch, + ref, ...DISABLE_CACHE, }); @@ -214,6 +210,7 @@ export class GitReleaseApiClient implements GitReleaseApi { commit: { message: latestCommit.commit.message, }, + createdAt: latestCommit.commit.committer?.date, }; }; @@ -527,20 +524,6 @@ ${selectedPatchCommit.commit.message}`, })); }, - getCommit: async ({ owner, repo, ref }) => { - const { octokit } = await this.getOctokit(); - - const { data: commit } = await octokit.repos.getCommit({ - owner, - repo, - ref, - }); - - return { - createdAt: commit.commit.committer?.date, - }; - }, - getSingleTag: async ({ owner, repo, tagSha }) => { const { octokit } = await this.getOctokit(); const singleTag = await octokit.git.getTag({ @@ -621,9 +604,9 @@ export interface GitReleaseApi { name: string; }>; - getLatestCommit: ( + getCommit: ( args: { - defaultBranch: string; + ref: string; } & OwnerRepo, ) => Promise<{ sha: string; @@ -631,6 +614,7 @@ export interface GitReleaseApi { commit: { message: string; }; + createdAt?: string; }>; getBranch: ( @@ -812,14 +796,6 @@ export interface GitReleaseApi { }> >; - getCommit: ( - args: { - ref: string; - } & OwnerRepo, - ) => Promise<{ - createdAt: string | undefined; - }>; - getSingleTag: ( args: { tagSha: string; @@ -848,7 +824,7 @@ export type GetRepositoryResult = UnboxReturnedPromise< GitReleaseApi['getRepository'] >; export type GetLatestCommitResult = UnboxReturnedPromise< - GitReleaseApi['getLatestCommit'] + GitReleaseApi['getCommit'] >; export type GetBranchResult = UnboxReturnedPromise; export type CreateRefResult = UnboxReturnedPromise; @@ -883,9 +859,6 @@ export type PromoteReleaseResult = UnboxReturnedPromise< export type GetAllTagsResult = UnboxReturnedPromise< GitReleaseApi['stats']['getAllTags'] >; -export type GetCommitResult = UnboxReturnedPromise< - GitReleaseApi['stats']['getCommit'] ->; export type GetAllReleasesResult = UnboxReturnedPromise< GitReleaseApi['stats']['getAllReleases'] >; diff --git a/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts b/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts index 3e6967ff37..d7cd38effc 100644 --- a/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts +++ b/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts @@ -71,10 +71,10 @@ export function useCreateReleaseCandidate({ */ const [latestCommitRes, run] = useAsyncFn(async () => { const latestCommit = await pluginApiClient - .getLatestCommit({ + .getCommit({ owner: project.owner, repo: project.repo, - defaultBranch, + ref: defaultBranch, }) .catch(asyncCatcher); diff --git a/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.test.ts b/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.test.ts index d682476d33..c1618027bb 100644 --- a/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.test.ts +++ b/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.test.ts @@ -21,6 +21,7 @@ import { mockApiClient, mockCalverProject, mockReleaseCandidateCalver, + mockUser, } from '../../../test-helpers/test-helpers'; import { usePromoteRc } from './usePromoteRc'; @@ -33,6 +34,9 @@ jest.mock('../../../contexts/ProjectContext', () => ({ project: mockCalverProject, }), })); +jest.mock('../../../contexts/UserContext', () => ({ + useUserContext: () => ({ user: mockUser }), +})); describe('usePromoteRc', () => { beforeEach(jest.clearAllMocks); @@ -50,7 +54,7 @@ describe('usePromoteRc', () => { }); expect(result.error).toEqual(undefined); - expect(result.current.responseSteps).toHaveLength(1); + expect(result.current.responseSteps).toHaveLength(4); }); it('should return the expected responseSteps and progress (with successCb)', async () => { @@ -66,11 +70,23 @@ describe('usePromoteRc', () => { await waitFor(() => result.current.run()); }); - expect(result.current.responseSteps).toHaveLength(2); + expect(result.current.responseSteps).toHaveLength(5); expect(result.current).toMatchInlineSnapshot(` Object { "progress": 100, "responseSteps": Array [ + Object { + "message": "Fetched most recent commit from release branch", + "secondaryMessage": "with sha \\"latestCommit.sha\\"", + }, + Object { + "message": "Created Tag Object", + "secondaryMessage": "with sha \\"mock_tag_object_sha\\"", + }, + Object { + "message": "Create Tag Reference", + "secondaryMessage": "with ref \\"mock_createRef_ref\\"", + }, Object { "link": "mock_release_html_url", "message": "Promoted \\"mock_release_name\\"", diff --git a/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts b/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts index 7a106c3e51..bbeacb6b59 100644 --- a/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts +++ b/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts @@ -23,6 +23,9 @@ import { GetLatestReleaseResult } from '../../../api/GitReleaseApiClient'; import { gitReleaseManagerApiRef } from '../../../api/serviceApiRef'; import { useProjectContext } from '../../../contexts/ProjectContext'; import { useResponseSteps } from '../../../hooks/useResponseSteps'; +import { useUserContext } from '../../../contexts/UserContext'; +import { TAG_OBJECT_MESSAGE } from '../../../constants/constants'; +import { GitReleaseManagerError } from '../../../errors/GitReleaseManagerError'; interface PromoteRc { rcRelease: NonNullable; @@ -36,6 +39,7 @@ export function usePromoteRc({ successCb, }: PromoteRc): CardHook { const pluginApiClient = useApi(gitReleaseManagerApiRef); + const { user } = useUserContext(); const { project } = useProjectContext(); const { responseSteps, @@ -45,9 +49,97 @@ export function usePromoteRc({ } = useResponseSteps(); /** - * (1) Promote Release Candidate to Release Version + * (1) Fetch most recent release branch commit */ - const [promotedReleaseRes, run] = useAsyncFn(async () => { + const [latestReleaseBranchCommitSha, run] = useAsyncFn(async () => { + const latestCommit = await pluginApiClient + .getCommit({ + owner: project.owner, + repo: project.repo, + ref: rcRelease.targetCommitish, + }) + .catch(asyncCatcher); + + addStepToResponseSteps({ + message: 'Fetched most recent commit from release branch', + secondaryMessage: `with sha "${latestCommit.sha}"`, + }); + + return { + ...latestCommit, + }; + }); + + /** + * (2) Create tag object for our soon-to-be-created annotated tag + */ + const tagObjectRes = useAsync(async () => { + abortIfError(latestReleaseBranchCommitSha.error); + if (!latestReleaseBranchCommitSha.value) return undefined; + + const createdTagObject = await pluginApiClient + .createTagObject({ + owner: project.owner, + repo: project.repo, + tag: releaseVersion, + objectSha: latestReleaseBranchCommitSha.value.sha, + taggerName: user.username, + taggerEmail: user.email, + message: TAG_OBJECT_MESSAGE, + }) + .catch(asyncCatcher); + + addStepToResponseSteps({ + message: 'Created Tag Object', + secondaryMessage: `with sha "${createdTagObject.tagSha}"`, + }); + + return { + ...createdTagObject, + }; + }, [latestReleaseBranchCommitSha.value, latestReleaseBranchCommitSha.error]); + + /** + * (3) Create reference for tag object + */ + const createRcRes = useAsync(async () => { + abortIfError(tagObjectRes.error); + if (!tagObjectRes.value) return undefined; + + const createdRef = await pluginApiClient + .createRef({ + owner: project.owner, + repo: project.repo, + ref: `refs/tags/${releaseVersion}`, + sha: tagObjectRes.value.tagSha, + }) + .catch(error => { + if (error?.body?.message === 'Reference already exists') { + throw new GitReleaseManagerError( + `Tag reference "${releaseVersion}" already exists`, + ); + } + throw error; + }) + .catch(asyncCatcher); + + addStepToResponseSteps({ + message: 'Create Tag Reference', + secondaryMessage: `with ref "${createdRef.ref}"`, + }); + + return { + ...createdRef, + }; + }, [tagObjectRes.value, tagObjectRes.error]); + + /** + * (4) Promote Release Candidate to Release Version + */ + const promotedReleaseRes = useAsync(async () => { + abortIfError(createRcRes.error); + if (!createRcRes.value) return undefined; + const promotedRelease = await pluginApiClient.promoteRc .promoteRelease({ owner: project.owner, @@ -66,10 +158,10 @@ export function usePromoteRc({ return { ...promotedRelease, }; - }); + }, [createRcRes.value, createRcRes.error]); /** - * (2) Run successCb if defined + * (5) Run successCb if defined */ useAsync(async () => { if (successCb && !!promotedReleaseRes.value) { @@ -95,7 +187,7 @@ export function usePromoteRc({ } }, [promotedReleaseRes.value]); - const TOTAL_STEPS = 1 + (!!successCb ? 1 : 0); + const TOTAL_STEPS = 4 + (!!successCb ? 1 : 0); const [progress, setProgress] = useState(0); useEffect(() => { setProgress((responseSteps.length / TOTAL_STEPS) * 100); diff --git a/plugins/git-release-manager/src/features/Stats/helpers/getTagDate.ts b/plugins/git-release-manager/src/features/Stats/helpers/getTagDate.ts index f0c3bcd445..8c389e879c 100644 --- a/plugins/git-release-manager/src/features/Stats/helpers/getTagDate.ts +++ b/plugins/git-release-manager/src/features/Stats/helpers/getTagDate.ts @@ -28,7 +28,7 @@ export const getTagDate = async ({ project, tagSha, }: GetTagDate) => { - const commitRes = await pluginApiClient.stats.getCommit({ + const commitRes = await pluginApiClient.getCommit({ owner: project.owner, repo: project.repo, ref: tagSha, diff --git a/plugins/git-release-manager/src/features/Stats/hooks/useGetCommit.ts b/plugins/git-release-manager/src/features/Stats/hooks/useGetCommit.ts index 01ff486a74..83c5324615 100644 --- a/plugins/git-release-manager/src/features/Stats/hooks/useGetCommit.ts +++ b/plugins/git-release-manager/src/features/Stats/hooks/useGetCommit.ts @@ -30,7 +30,7 @@ export const useGetCommit = ({ ref }: { ref?: string }) => { throw new GitReleaseManagerError('Missing ref to get commit'); } - return pluginApiClient.stats.getCommit({ + return pluginApiClient.getCommit({ owner: project.owner, repo: project.repo, ref, diff --git a/plugins/git-release-manager/src/test-helpers/test-helpers.ts b/plugins/git-release-manager/src/test-helpers/test-helpers.ts index 6b2951b9a3..458ffff9a1 100644 --- a/plugins/git-release-manager/src/test-helpers/test-helpers.ts +++ b/plugins/git-release-manager/src/test-helpers/test-helpers.ts @@ -209,12 +209,13 @@ export const mockApiClient: GitReleaseApi = { name: mockRepo, })), - getLatestCommit: jest.fn(async () => ({ + getCommit: jest.fn(async () => ({ sha: 'latestCommit.sha', htmlUrl: 'latestCommit.html_url', commit: { message: 'latestCommit.commit.message', }, + createdAt: '2021-01-01T10:11:12Z', })), getBranch: jest.fn(async () => createMockBranch()), @@ -305,10 +306,6 @@ export const mockApiClient: GitReleaseApi = { }, ]), - getCommit: jest.fn(async () => ({ - createdAt: '2021-01-01T10:11:12Z', - })), - getSingleTag: jest.fn(async () => ({ date: '2021-04-29T12:48:30.120Z', username: 'mock_usersingle_tag_name', From b2e2ec75337768330b277365bfc689cbc77188b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Thu, 29 Apr 2021 15:43:53 +0200 Subject: [PATCH 228/485] Update tech radar README for composability MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .changeset/spotty-pigs-bathe.md | 5 +++++ plugins/tech-radar/README.md | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 11 deletions(-) create mode 100644 .changeset/spotty-pigs-bathe.md diff --git a/.changeset/spotty-pigs-bathe.md b/.changeset/spotty-pigs-bathe.md new file mode 100644 index 0000000000..0585f335dc --- /dev/null +++ b/.changeset/spotty-pigs-bathe.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-tech-radar': patch +--- + +Update README for composability diff --git a/plugins/tech-radar/README.md b/plugins/tech-radar/README.md index 21f90ec432..7f97f88ed4 100644 --- a/plugins/tech-radar/README.md +++ b/plugins/tech-radar/README.md @@ -18,7 +18,7 @@ It serves and scales well for teams and companies of all sizes that want to have The Tech Radar can be used in two ways: -- **Simple (Recommended)** - This gives you an out-of-the-box Tech Radar experience. It lives on the `/tech-radar` URL of your Backstage installation, and you can set a variety of configuration directly in your `apis.ts`. +- **Simple (Recommended)** - This gives you an out-of-the-box Tech Radar experience. It lives on the `/tech-radar` URL of your Backstage installation. - **Advanced** - This gives you the React UI component directly. It enables you to insert the Radar on your own layout or page for a more customized feel. ### Install @@ -26,6 +26,7 @@ The Tech Radar can be used in two ways: For either simple or advanced installations, you'll need to add the dependency using Yarn: ```sh +cd packages/app yarn add @backstage/plugin-tech-radar ``` @@ -34,17 +35,16 @@ yarn add @backstage/plugin-tech-radar Modify your app routes to include the Router component exported from the tech radar, for example: ```tsx -import { Router as TechRadarRouter } from '@backstage/plugin-tech-radar'; +// in packages/app/src/App.tsx +import { TechRadarPage } from '@backstage/plugin-tech-radar'; -// Inside App component - - {/* other routes ... */} - } - /> - {/* other routes ... */} -; +const routes = ( + + {/* ... */} + } + /> ``` If you'd like to configure it more, see the `TechRadarPageProps` and `TechRadarComponentProps` types for options: From 6e9d535c697ad1bde957b2c55023d6029b1c2096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20A=CC=8Ahsberg?= Date: Thu, 29 Apr 2021 14:20:41 +0000 Subject: [PATCH 229/485] Do not expose Bitbucket internals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathias Åhsberg --- .../BitbucketDiscoveryProcessor.test.ts | 211 ++++++++---------- .../processors/BitbucketDiscoveryProcessor.ts | 2 +- .../ingestion/processors/bitbucket/index.ts | 6 +- .../src/ingestion/processors/index.ts | 3 +- 4 files changed, 93 insertions(+), 129 deletions(-) diff --git a/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.test.ts b/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.test.ts index 73f4281a51..1f01b77f42 100644 --- a/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.test.ts +++ b/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.test.ts @@ -17,21 +17,73 @@ import { getVoidLogger } from '@backstage/backend-common'; import { BitbucketDiscoveryProcessor } from './BitbucketDiscoveryProcessor'; import { ConfigReader } from '@backstage/config'; import { LocationSpec } from '@backstage/catalog-model'; -import { - BitbucketClient, - BitbucketRepositoryParser, - PagedResponse, -} from './bitbucket'; +import { BitbucketRepositoryParser, PagedResponse } from './bitbucket'; import { results } from './index'; +import { RequestHandler, rest } from 'msw'; +import { setupServer } from 'msw/node'; -function pagedResponse(values: any): PagedResponse { - return { - values: values, - isLastPage: true, - } as PagedResponse; +const server = setupServer(); + +function setupStubs(projects: any[]) { + function pagedResponse(values: any): PagedResponse { + return { + values: values, + isLastPage: true, + } as PagedResponse; + } + + function stubbedProject( + project: string, + repos: string[], + ): RequestHandler { + return rest.get( + `https://bitbucket.mycompany.com/api/rest/1.0/projects/${project}/repos`, + (_, res, ctx) => { + const response = []; + for (const repo of repos) { + response.push({ + slug: repo, + links: { + self: [ + { + href: `https://bitbucket.mycompany.com/projects/${project}/repos/${repo}/browse`, + }, + ], + }, + }); + } + return res(ctx.json(pagedResponse(response))); + }, + ); + } + + server.use( + rest.get( + `https://bitbucket.mycompany.com/api/rest/1.0/projects`, + (_, res, ctx) => { + return res( + ctx.json( + pagedResponse( + projects.map(p => { + return { key: p.key }; + }), + ), + ), + ); + }, + ), + ); + + for (const project of projects) { + server.use(stubbedProject(project.key, project.repos)); + } } describe('BitbucketDiscoveryProcessor', () => { + beforeAll(() => server.listen()); + afterEach(() => server.resetHandlers()); + afterAll(() => server.close()); + afterEach(() => jest.resetAllMocks()); describe('reject unrelated entries', () => { @@ -81,58 +133,29 @@ describe('BitbucketDiscoveryProcessor', () => { const processor = BitbucketDiscoveryProcessor.fromConfig( new ConfigReader({ integrations: { - bitbucket: [{ host: 'bitbucket.mycompany.com', token: 'blob' }], + bitbucket: [ + { + host: 'bitbucket.mycompany.com', + token: 'blob', + apiBaseUrl: 'https://bitbucket.mycompany.com/api/rest/1.0', + }, + ], }, }), { logger: getVoidLogger() }, ); it('output all repositories', async () => { + setupStubs([ + { key: 'backstage', repos: ['backstage'] }, + { key: 'demo', repos: ['demo'] }, + ]); const location: LocationSpec = { type: 'bitbucket-discovery', target: 'https://bitbucket.mycompany.com/projects/*/repos/*/catalog.yaml', }; - jest - .spyOn(BitbucketClient.prototype, 'listProjects') - .mockResolvedValue( - pagedResponse([{ key: 'backstage' }, { key: 'demo' }]), - ); - jest - .spyOn(BitbucketClient.prototype, 'listRepositories') - .mockResolvedValueOnce( - pagedResponse([ - { - slug: 'backstage', - links: { - self: [ - { - href: - 'https://bitbucket.mycompany.com/projects/backstage/repos/backstage/browse', - }, - ], - }, - }, - ]), - ); - jest - .spyOn(BitbucketClient.prototype, 'listRepositories') - .mockResolvedValueOnce( - pagedResponse([ - { - slug: 'demo', - links: { - self: [ - { - href: - 'https://bitbucket.mycompany.com/projects/demo/repos/demo/browse', - }, - ], - }, - }, - ]), - ); const emitter = jest.fn(); await processor.readLocation(location, false, emitter); @@ -158,44 +181,16 @@ describe('BitbucketDiscoveryProcessor', () => { }); it('output repositories with wildcards', async () => { + setupStubs([ + { key: 'backstage', repos: ['backstage', 'techdocs-cli'] }, + { key: 'demo', repos: ['demo'] }, + ]); const location: LocationSpec = { type: 'bitbucket-discovery', target: 'https://bitbucket.mycompany.com/projects/backstage/repos/techdocs-*/catalog.yaml', }; - jest - .spyOn(BitbucketClient.prototype, 'listProjects') - .mockResolvedValue(pagedResponse([{ key: 'backstage' }])); - jest - .spyOn(BitbucketClient.prototype, 'listRepositories') - .mockResolvedValueOnce( - pagedResponse([ - { slug: 'backstage' }, - { - slug: 'techdocs-cli', - links: { - self: [ - { - href: - 'https://bitbucket.mycompany.com/projects/backstage/repos/techdocs-cli/browse', - }, - ], - }, - }, - { - slug: 'techdocs-container', - links: { - self: [ - { - href: - 'https://bitbucket.mycompany.com/projects/backstage/repos/techdocs-container/browse', - }, - ], - }, - }, - ]), - ); const emitter = jest.fn(); await processor.readLocation(location, false, emitter); @@ -208,46 +203,15 @@ describe('BitbucketDiscoveryProcessor', () => { }, optional: true, }); - expect(emitter).toHaveBeenCalledWith({ - type: 'location', - location: { - type: 'url', - target: - 'https://bitbucket.mycompany.com/projects/backstage/repos/techdocs-container/browse/catalog.yaml', - }, - optional: true, - }); }); it('filter unrelated repositories', async () => { + setupStubs([{ key: 'backstage', repos: ['test', 'abctest', 'testxyz'] }]); const location: LocationSpec = { type: 'bitbucket-discovery', target: 'https://bitbucket.mycompany.com/projects/backstage/repos/test/catalog.yaml', }; - jest - .spyOn(BitbucketClient.prototype, 'listProjects') - .mockResolvedValue(pagedResponse([{ key: 'backstage' }])); - jest - .spyOn(BitbucketClient.prototype, 'listRepositories') - .mockResolvedValue( - pagedResponse([ - { slug: 'abstest' }, - { slug: 'testxyz' }, - { - slug: 'test', - links: { - self: [ - { - href: - 'https://bitbucket.mycompany.com/projects/backstage/repos/test', - }, - ], - }, - }, - ]), - ); - const emitter = jest.fn(); await processor.readLocation(location, false, emitter); @@ -256,7 +220,7 @@ describe('BitbucketDiscoveryProcessor', () => { location: { type: 'url', target: - 'https://bitbucket.mycompany.com/projects/backstage/repos/test/catalog.yaml', + 'https://bitbucket.mycompany.com/projects/backstage/repos/test/browse/catalog.yaml', }, optional: true, }); @@ -277,26 +241,27 @@ describe('BitbucketDiscoveryProcessor', () => { const processor = BitbucketDiscoveryProcessor.fromConfig( new ConfigReader({ integrations: { - bitbucket: [{ host: 'bitbucket.mycompany.com', token: 'blob' }], + bitbucket: [ + { + host: 'bitbucket.mycompany.com', + token: 'blob', + apiBaseUrl: 'https://bitbucket.mycompany.com/api/rest/1.0', + }, + ], }, }), { parser: customRepositoryParser, logger: getVoidLogger() }, ); it('use custom repository parser', async () => { + setupStubs([{ key: 'backstage', repos: ['test'] }]); + const location: LocationSpec = { type: 'bitbucket-discovery', target: 'https://bitbucket.mycompany.com/projects/backstage/repos/test/catalog.yaml', }; - jest - .spyOn(BitbucketClient.prototype, 'listProjects') - .mockResolvedValue(pagedResponse([{ key: 'backstage' }])); - jest - .spyOn(BitbucketClient.prototype, 'listRepositories') - .mockResolvedValue(pagedResponse([{ slug: 'test' }])); - const emitter = jest.fn(); await processor.readLocation(location, false, emitter); diff --git a/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.ts b/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.ts index 9c56eb14e3..399adfbc14 100644 --- a/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.ts +++ b/plugins/catalog-backend/src/ingestion/processors/BitbucketDiscoveryProcessor.ts @@ -90,7 +90,7 @@ export class BitbucketDiscoveryProcessor implements CatalogProcessor { for (const repository of result.matches) { for await (const entity of this.parser({ integration: integration, - target: `${repository.links.self[0]}${catalogPath}`, + target: `${repository.links.self[0].href}${catalogPath}`, logger: this.logger, })) { emit(entity); diff --git a/plugins/catalog-backend/src/ingestion/processors/bitbucket/index.ts b/plugins/catalog-backend/src/ingestion/processors/bitbucket/index.ts index ba2a2b3afe..06effffcd2 100644 --- a/plugins/catalog-backend/src/ingestion/processors/bitbucket/index.ts +++ b/plugins/catalog-backend/src/ingestion/processors/bitbucket/index.ts @@ -14,7 +14,7 @@ * limitations under the License. */ export { BitbucketClient, paginated } from './client'; -export type { PagedResponse } from './client'; -export * from './types'; -export type { BitbucketRepositoryParser } from './BitbucketRepositoryParser'; export { defaultRepositoryParser } from './BitbucketRepositoryParser'; +export type { PagedResponse } from './client'; +export type { BitbucketRepository } from './types'; +export type { BitbucketRepositoryParser } from './BitbucketRepositoryParser'; diff --git a/plugins/catalog-backend/src/ingestion/processors/index.ts b/plugins/catalog-backend/src/ingestion/processors/index.ts index c8f51bbccc..a92cc9ed3b 100644 --- a/plugins/catalog-backend/src/ingestion/processors/index.ts +++ b/plugins/catalog-backend/src/ingestion/processors/index.ts @@ -36,5 +36,4 @@ export { UrlReaderProcessor } from './UrlReaderProcessor'; export { parseEntityYaml } from './util/parse'; export { results }; -export { BitbucketClient } from './bitbucket'; -export type { BitbucketRepositoryParser, Bitbucket } from './bitbucket'; +export type { BitbucketRepositoryParser } from './bitbucket'; From cec7fb9b372c7ba20565119918f030ea50990bb4 Mon Sep 17 00:00:00 2001 From: Oliver Sand Date: Tue, 30 Mar 2021 17:23:24 +0200 Subject: [PATCH 230/485] Add support for json schema to API docs Signed-off-by: Oliver Sand --- .changeset/six-mayflies-peel.md | 5 + packages/catalog-model/examples/all-apis.yaml | 1 + .../examples/apis/config-schema-api.yaml | 11 + plugins/api-docs/README.md | 1 + plugins/api-docs/dev/index.tsx | 15 + .../api-docs/dev/jsonschema-example-api.yaml | 32 + plugins/api-docs/package.json | 3 + .../ApiDefinitionCard/ApiDefinitionWidget.tsx | 9 + .../JsonSchemaDefinitionWidget.test.tsx | 61 + .../JsonSchemaDefinitionWidget.tsx | 50 + .../JsonSchemaDefinitionWidget/index.ts | 17 + plugins/api-docs/src/components/index.ts | 1 + yarn.lock | 1038 ++++++++++++++++- 13 files changed, 1238 insertions(+), 6 deletions(-) create mode 100644 .changeset/six-mayflies-peel.md create mode 100644 packages/catalog-model/examples/apis/config-schema-api.yaml create mode 100644 plugins/api-docs/dev/jsonschema-example-api.yaml create mode 100644 plugins/api-docs/src/components/JsonSchemaDefinitionWidget/JsonSchemaDefinitionWidget.test.tsx create mode 100644 plugins/api-docs/src/components/JsonSchemaDefinitionWidget/JsonSchemaDefinitionWidget.tsx create mode 100644 plugins/api-docs/src/components/JsonSchemaDefinitionWidget/index.ts diff --git a/.changeset/six-mayflies-peel.md b/.changeset/six-mayflies-peel.md new file mode 100644 index 0000000000..9d022bca0a --- /dev/null +++ b/.changeset/six-mayflies-peel.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-api-docs': patch +--- + +Add support for displaying JSON schemas. diff --git a/packages/catalog-model/examples/all-apis.yaml b/packages/catalog-model/examples/all-apis.yaml index e23f1b3656..8ec9203b28 100644 --- a/packages/catalog-model/examples/all-apis.yaml +++ b/packages/catalog-model/examples/all-apis.yaml @@ -5,6 +5,7 @@ metadata: description: A collection of all Backstage example APIs spec: targets: + - ./apis/config-schema-api.yaml - ./apis/hello-world-api.yaml - ./apis/petstore-api.yaml - ./apis/spotify-api.yaml diff --git a/packages/catalog-model/examples/apis/config-schema-api.yaml b/packages/catalog-model/examples/apis/config-schema-api.yaml new file mode 100644 index 0000000000..4bd8976614 --- /dev/null +++ b/packages/catalog-model/examples/apis/config-schema-api.yaml @@ -0,0 +1,11 @@ +apiVersion: backstage.io/v1alpha1 +kind: API +metadata: + name: config-schema + description: A Backstage config schemas. +spec: + type: jsonschema + lifecycle: production + owner: team-a + definition: + $text: https://github.com/backstage/backstage/blob/master/plugins/config-schema/dev/example-schema.json diff --git a/plugins/api-docs/README.md b/plugins/api-docs/README.md index dac4b6ff4d..f995a7d002 100644 --- a/plugins/api-docs/README.md +++ b/plugins/api-docs/README.md @@ -15,6 +15,7 @@ Right now, the following API formats are supported: - [OpenAPI](https://swagger.io/specification/) 2 & 3 - [AsyncAPI](https://www.asyncapi.com/docs/specifications/latest/) - [GraphQL](https://graphql.org/learn/schema/) +- [JSON Schema](https://json-schema.org/) Other formats are displayed as plain text, but this can easily be extended. diff --git a/plugins/api-docs/dev/index.tsx b/plugins/api-docs/dev/index.tsx index fbfab37f5b..d51d3a714c 100644 --- a/plugins/api-docs/dev/index.tsx +++ b/plugins/api-docs/dev/index.tsx @@ -27,6 +27,7 @@ import { } from '../src'; import asyncapiApiEntity from './asyncapi-example-api.yaml'; import graphqlApiEntity from './graphql-example-api.yaml'; +import jsonschemaApiEntity from './jsonschema-example-api.yaml'; import openapiApiEntity from './openapi-example-api.yaml'; import otherApiEntity from './other-example-api.yaml'; @@ -41,6 +42,7 @@ createDevApp() items: [ openapiApiEntity, asyncapiApiEntity, + jsonschemaApiEntity, graphqlApiEntity, otherApiEntity, ], @@ -87,6 +89,19 @@ createDevApp() ), }) + .addPage({ + title: 'JSON Schema', + element: ( + +
+ + + + + + + ), + }) .addPage({ title: 'GraphQL', element: ( diff --git a/plugins/api-docs/dev/jsonschema-example-api.yaml b/plugins/api-docs/dev/jsonschema-example-api.yaml new file mode 100644 index 0000000000..a34b4f9a49 --- /dev/null +++ b/plugins/api-docs/dev/jsonschema-example-api.yaml @@ -0,0 +1,32 @@ +apiVersion: backstage.io/v1alpha1 +kind: API +metadata: + name: persons + description: Person dataset +spec: + type: jsonschema + lifecycle: experimental + owner: team-c + # From https://json-schema.org/learn/miscellaneous-examples.html + definition: | + { + "$id": "https://example.com/person.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } + } diff --git a/plugins/api-docs/package.json b/plugins/api-docs/package.json index 5c9f9ca7ee..be5d5186d2 100644 --- a/plugins/api-docs/package.json +++ b/plugins/api-docs/package.json @@ -38,6 +38,9 @@ "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.45", + "@stoplight/json-schema-viewer": "^4.0.0-beta.16", + "@stoplight/mosaic": "^1.0.0-beta.46", + "@stoplight/reporter": "^1.10.0", "@types/react": "^16.9", "graphiql": "^1.0.0-alpha.10", "graphql": "^15.3.0", diff --git a/plugins/api-docs/src/components/ApiDefinitionCard/ApiDefinitionWidget.tsx b/plugins/api-docs/src/components/ApiDefinitionCard/ApiDefinitionWidget.tsx index 360404af40..fc23c338ee 100644 --- a/plugins/api-docs/src/components/ApiDefinitionCard/ApiDefinitionWidget.tsx +++ b/plugins/api-docs/src/components/ApiDefinitionCard/ApiDefinitionWidget.tsx @@ -16,6 +16,7 @@ import React from 'react'; import { AsyncApiDefinitionWidget } from '../AsyncApiDefinitionWidget'; import { GraphQlDefinitionWidget } from '../GraphQlDefinitionWidget'; +import { JsonSchemaDefinitionWidget } from '../JsonSchemaDefinitionWidget'; import { OpenApiDefinitionWidget } from '../OpenApiDefinitionWidget'; export type ApiDefinitionWidget = { @@ -51,5 +52,13 @@ export function defaultDefinitionWidgets(): ApiDefinitionWidget[] { ), }, + { + type: 'jsonschema', + title: 'JSON Schema', + rawLanguage: 'json', + component: definition => ( + + ), + }, ]; } diff --git a/plugins/api-docs/src/components/JsonSchemaDefinitionWidget/JsonSchemaDefinitionWidget.test.tsx b/plugins/api-docs/src/components/JsonSchemaDefinitionWidget/JsonSchemaDefinitionWidget.test.tsx new file mode 100644 index 0000000000..b4077e6ea2 --- /dev/null +++ b/plugins/api-docs/src/components/JsonSchemaDefinitionWidget/JsonSchemaDefinitionWidget.test.tsx @@ -0,0 +1,61 @@ +/* + * Copyright 2020 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 { renderInTestApp } from '@backstage/test-utils'; +import React from 'react'; +import { JsonSchemaDefinitionWidget } from './JsonSchemaDefinitionWidget'; + +describe('', () => { + it('renders json schema', async () => { + // From https://json-schema.org/learn/miscellaneous-examples.html + const definition = ` +{ + "$id": "https://example.com/person.schema.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Person", + "type": "object", + "properties": { + "firstName": { + "type": "string", + "description": "The person's first name." + }, + "lastName": { + "type": "string", + "description": "The person's last name." + }, + "age": { + "description": "Age in years which must be equal to or greater than zero.", + "type": "integer", + "minimum": 0 + } + } +} + `; + const { getByText } = await renderInTestApp( + , + ); + + expect(getByText(/lastName/i)).toBeInTheDocument(); + expect(getByText(/The person's last name./i)).toBeInTheDocument(); + }); + + it('renders error if definition is missing', async () => { + const { getByText } = await renderInTestApp( + , + ); + expect(getByText(/No schema defined/i)).toBeInTheDocument(); + }); +}); diff --git a/plugins/api-docs/src/components/JsonSchemaDefinitionWidget/JsonSchemaDefinitionWidget.tsx b/plugins/api-docs/src/components/JsonSchemaDefinitionWidget/JsonSchemaDefinitionWidget.tsx new file mode 100644 index 0000000000..ea8ac652c8 --- /dev/null +++ b/plugins/api-docs/src/components/JsonSchemaDefinitionWidget/JsonSchemaDefinitionWidget.tsx @@ -0,0 +1,50 @@ +/* + * Copyright 2020 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 { useTheme } from '@material-ui/core'; +import { JsonSchemaViewer } from '@stoplight/json-schema-viewer'; +import { injectStyles, useThemeStore } from '@stoplight/mosaic'; +import React, { useMemo } from 'react'; +import { useEffectOnce } from 'react-use'; + +injectStyles(); + +type Props = { + definition: any; +}; + +export const JsonSchemaDefinitionWidget = ({ definition }: Props) => { + const schema = useMemo(() => JSON.parse(definition), [definition]); + const theme = useTheme(); + const themeStore = useThemeStore(); + + useEffectOnce(() => { + themeStore.setColor('background', theme.palette.background.paper); + themeStore.setColor('text', theme.palette.text.primary); + themeStore.setColor('primary', theme.palette.primary.main); + themeStore.setColor('success', theme.palette.success.main); + themeStore.setColor('warning', theme.palette.warning.main); + themeStore.setColor('danger', theme.palette.error.main); + themeStore.setMode(theme.palette.type); + }); + return ( + + ); +}; diff --git a/plugins/api-docs/src/components/JsonSchemaDefinitionWidget/index.ts b/plugins/api-docs/src/components/JsonSchemaDefinitionWidget/index.ts new file mode 100644 index 0000000000..47d2619ec2 --- /dev/null +++ b/plugins/api-docs/src/components/JsonSchemaDefinitionWidget/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2020 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. + */ + +export { JsonSchemaDefinitionWidget } from './JsonSchemaDefinitionWidget'; diff --git a/plugins/api-docs/src/components/index.ts b/plugins/api-docs/src/components/index.ts index cfd985f47c..afac37dc31 100644 --- a/plugins/api-docs/src/components/index.ts +++ b/plugins/api-docs/src/components/index.ts @@ -20,3 +20,4 @@ export * from './AsyncApiDefinitionWidget'; export * from './ComponentsCards'; export * from './OpenApiDefinitionWidget'; export * from './PlainApiDefinitionWidget'; +export * from './JsonSchemaDefinitionWidget'; diff --git a/yarn.lock b/yarn.lock index 5fdd60715c..4831b9f51a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,24 @@ # yarn lockfile v1 +"@amplitude/types@^1.5.4": + version "1.5.4" + resolved "https://registry.npmjs.org/@amplitude/types/-/types-1.5.4.tgz#7fcbcbfb321d794b6367596cd950a92c752431d1" + integrity sha512-+e+wqlO5E4lNTM19lATf+lJldV+VD2RGzrDEy45cPEtfpXxHJUHwhfOKZkKg/zlx+YAubcpNhWLm2NSPpHUs9A== + +"@amplitude/ua-parser-js@0.7.24": + version "0.7.24" + resolved "https://registry.npmjs.org/@amplitude/ua-parser-js/-/ua-parser-js-0.7.24.tgz#2ce605af7d2c38d4a01313fb2385df55fbbd69aa" + integrity sha512-VbQuJymJ20WEw0HtI2np7EdC3NJGUWi8+Xdbc7uk8WfMIF308T0howpzkQ3JFMN7ejnrcSM/OyNGveeE3TP3TA== + +"@amplitude/utils@^1.0.5": + version "1.5.4" + resolved "https://registry.npmjs.org/@amplitude/utils/-/utils-1.5.4.tgz#457e847d751522ac8dd910037667d780ef501642" + integrity sha512-VAd/ibhwBBeL8pKqCz8tjCnSx8epOvUa+Je6sA3AB4R8855xl+bdrDjYwMmOWOILvEH3Pltq2jVJCE2thBoFdQ== + dependencies: + "@amplitude/types" "^1.5.4" + tslib "^1.9.3" + "@apidevtools/json-schema-ref-parser@^9.0.6": version "9.0.6" resolved "https://registry.npmjs.org/@apidevtools/json-schema-ref-parser/-/json-schema-ref-parser-9.0.6.tgz#5d9000a3ac1fd25404da886da6b266adcd99cf1c" @@ -1623,6 +1641,13 @@ dependencies: regenerator-runtime "^0.13.4" +"@babel/runtime@^7.13.17", "@babel/runtime@^7.6.2": + version "7.13.17" + resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.13.17.tgz#8966d1fc9593bf848602f0662d6b4d0069e3a7ec" + integrity sha512-NCdgJEelPTSh+FEFylhnP1ylq848l1z9t9N0j1Lfbcw0+KXGjsTvUmkxy+voLLXB5SOKMbLLx4jxYliGrYQseA== + dependencies: + regenerator-runtime "^0.13.4" + "@babel/template@^7.10.4", "@babel/template@^7.12.13", "@babel/template@^7.3.3": version "7.12.13" resolved "https://registry.npmjs.org/@babel/template/-/template-7.12.13.tgz#530265be8a2589dbb37523844c5bcb55947fb327" @@ -2077,6 +2102,32 @@ dependencies: yaml-ast-parser "0.0.43" +"@fortawesome/fontawesome-common-types@^0.2.35": + version "0.2.35" + resolved "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.2.35.tgz#01dd3d054da07a00b764d78748df20daf2b317e9" + integrity sha512-IHUfxSEDS9dDGqYwIW7wTN6tn/O8E0n5PcAHz9cAaBoZw6UpG20IG/YM3NNLaGPwPqgjBAFjIURzqoQs3rrtuw== + +"@fortawesome/fontawesome-svg-core@^1.2.35": + version "1.2.35" + resolved "https://registry.npmjs.org/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-1.2.35.tgz#85aea8c25645fcec88d35f2eb1045c38d3e65cff" + integrity sha512-uLEXifXIL7hnh2sNZQrIJWNol7cTVIzwI+4qcBIq9QWaZqUblm0IDrtSqbNg+3SQf8SMGHkiSigD++rHmCHjBg== + dependencies: + "@fortawesome/fontawesome-common-types" "^0.2.35" + +"@fortawesome/free-solid-svg-icons@^5.15.2", "@fortawesome/free-solid-svg-icons@^5.15.3": + version "5.15.3" + resolved "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-5.15.3.tgz#52eebe354f60dc77e0bde934ffc5c75ffd04f9d8" + integrity sha512-XPeeu1IlGYqz4VWGRAT5ukNMd4VHUEEJ7ysZ7pSSgaEtNvSo+FLurybGJVmiqkQdK50OkSja2bfZXOeyMGRD8Q== + dependencies: + "@fortawesome/fontawesome-common-types" "^0.2.35" + +"@fortawesome/react-fontawesome@^0.1.14": + version "0.1.14" + resolved "https://registry.npmjs.org/@fortawesome/react-fontawesome/-/react-fontawesome-0.1.14.tgz#bf28875c3935b69ce2dc620e1060b217a47f64ca" + integrity sha512-4wqNb0gRLVaBm/h+lGe8UfPPivcbuJ6ecI4hIgW0LjI7kzpYB9FkN0L9apbVzg+lsBdcTf0AlBtODjcSX5mmKA== + dependencies: + prop-types "^15.7.2" + "@gitbeaker/core@^28.0.2", "@gitbeaker/core@^28.2.0": version "28.2.0" resolved "https://registry.npmjs.org/@gitbeaker/core/-/core-28.2.0.tgz#87e6f789faf55d726f75d05e470020e4bbb8e08c" @@ -2733,6 +2784,21 @@ resolved "https://registry.npmjs.org/@icons/material/-/material-0.2.4.tgz#e90c9f71768b3736e76d7dd6783fc6c2afa88bc8" integrity sha512-QPcGmICAPbGLGb6F/yNf/KzKqvFx8z5qx3D1yFqVAjoFmXK35EgyW+cJ57Te3CNsmzblwtzakLGFqHPqrfb4Tw== +"@internationalized/message@3.0.0-alpha.0": + version "3.0.0-alpha.0" + resolved "https://registry.npmjs.org/@internationalized/message/-/message-3.0.0-alpha.0.tgz#83015e2057d2b6b5034a3e23983b1e051f9d9e36" + integrity sha512-NT2eiVq5f5z7Yi9Hmchb8GAGYjEpYbYcD4u/Oxo5XG9XFbrnz7zNvrJJlzuQ+2jPozabq6pFKurqaFmM49DYUg== + dependencies: + "@babel/runtime" "^7.6.2" + intl-messageformat "^2.2.0" + +"@internationalized/number@3.0.0-alpha.0": + version "3.0.0-alpha.0" + resolved "https://registry.npmjs.org/@internationalized/number/-/number-3.0.0-alpha.0.tgz#27190fbc1d73a24ac96dfafdfe7aa4e520090eed" + integrity sha512-8aOD2I3HmEscIZO/cm1jkcrYMSmRPhoW9G1OsuQb4Ge/Y9HsJVGB9otTylUEXJUmoXi/eD8Mr1gx3+0FLCM4eA== + dependencies: + "@babel/runtime" "^7.6.2" + "@istanbuljs/load-nyc-config@^1.0.0": version "1.0.0" resolved "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.0.0.tgz#10602de5570baea82f8afbfa2630b24e7a8cfe5b" @@ -4233,6 +4299,445 @@ prop-types "^15.6.1" react-lifecycles-compat "^3.0.4" +"@react-aria/button@~3.3.1": + version "3.3.1" + resolved "https://registry.npmjs.org/@react-aria/button/-/button-3.3.1.tgz#f180ffa95e3e822b7da4937421cf8280dd17af17" + integrity sha512-LXNuo0L79AhYqnxV+Y3J3xt7hPcmCVCEpZaC/dBzovR1MLunrdpk3QAXsRt3tqza1XvoqdvNhNHQm1Z1kyBTUg== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-aria/focus" "^3.2.2" + "@react-aria/i18n" "^3.3.0" + "@react-aria/interactions" "^3.3.3" + "@react-aria/utils" "^3.6.0" + "@react-stately/toggle" "^3.2.1" + "@react-types/button" "^3.3.1" + +"@react-aria/dialog@~3.1.2": + version "3.1.2" + resolved "https://registry.npmjs.org/@react-aria/dialog/-/dialog-3.1.2.tgz#868970e7fdaa6ddb91a0d8d5b492778607d417fd" + integrity sha512-CUHzLdcKxnQ1IpbJOJ3BIDe762QoTOFXZfDAheNiTi24ym85w7KkW7dnfJDK2+J5RY15c5KWooOZvTaBmIJ7Xw== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-aria/focus" "^3.2.2" + "@react-aria/utils" "^3.3.0" + "@react-stately/overlays" "^3.1.1" + "@react-types/dialog" "^3.3.0" + +"@react-aria/focus@^3.2.2", "@react-aria/focus@^3.2.3", "@react-aria/focus@^3.2.4", "@react-aria/focus@~3.2.4": + version "3.2.4" + resolved "https://registry.npmjs.org/@react-aria/focus/-/focus-3.2.4.tgz#86c4fbde51a7cae414407b2d421fb5b311cd62f5" + integrity sha512-qoJoUDSriI7RCRq3L7yDOPtFZfquyjLA9d2pOJzvMx1F6dEqfNCaycyIg9lHykHXXhShgrXwfpyGTXoSUQpmtw== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-aria/interactions" "^3.3.4" + "@react-aria/utils" "^3.7.0" + "@react-types/shared" "^3.5.0" + clsx "^1.1.1" + +"@react-aria/i18n@^3.3.0": + version "3.3.0" + resolved "https://registry.npmjs.org/@react-aria/i18n/-/i18n-3.3.0.tgz#7f92ae81f6536b19b17b89c0991ddb6c10f2512a" + integrity sha512-8KYk0tQiEf9Kd9xdF4cKliP1169WSIryKFnZgnm9dvZl96TyfDK1xJpZQy58XjRdbS/H45CKydFmMcZEElu3BQ== + dependencies: + "@babel/runtime" "^7.6.2" + "@internationalized/message" "3.0.0-alpha.0" + "@internationalized/number" "3.0.0-alpha.0" + "@react-aria/ssr" "^3.0.1" + "@react-aria/utils" "^3.6.0" + "@react-types/shared" "^3.4.0" + +"@react-aria/interactions@^3.2.1", "@react-aria/interactions@^3.3.3", "@react-aria/interactions@^3.3.4", "@react-aria/interactions@~3.3.4": + version "3.3.4" + resolved "https://registry.npmjs.org/@react-aria/interactions/-/interactions-3.3.4.tgz#a5b3a87f886cf0f4e28cbd13fbe02c7efb4f1e2e" + integrity sha512-WzT9aIRWvLZvZvuwNKKUkZzeomZgIrquAtwgRYGWbjSbrYPOT9B3w/GBEWZDYUG0c1K8NkIEAxTX0e+QI+tqAA== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-aria/utils" "^3.7.0" + "@react-types/shared" "^3.5.0" + +"@react-aria/label@^3.1.1": + version "3.1.1" + resolved "https://registry.npmjs.org/@react-aria/label/-/label-3.1.1.tgz#03dc5c4813cd1f51760ba48783c186c2eeda1189" + integrity sha512-9kZKJonYSXeY6hZULZrsujAb6uXDGEy8qPq0tjTVoTA3+gx26LOmLCLgvHFtxUK1e4s99rHmaSPdOtq5qu3EVQ== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-aria/utils" "^3.3.0" + "@react-types/label" "^3.2.1" + "@react-types/shared" "^3.2.1" + +"@react-aria/listbox@~3.2.4": + version "3.2.4" + resolved "https://registry.npmjs.org/@react-aria/listbox/-/listbox-3.2.4.tgz#3162e47d64e1f6cd8fdfe45766cb88c3852a525d" + integrity sha512-IYs4oS2wzWVcWEtKG57zZLZI507WlDy24wuzymwgFxxIRXDVaBsSMOs7+uE7N1P4fLOa1yAlv170AvKDDbIJ2g== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-aria/interactions" "^3.3.3" + "@react-aria/label" "^3.1.1" + "@react-aria/selection" "^3.3.2" + "@react-aria/utils" "^3.6.0" + "@react-stately/collections" "^3.3.0" + "@react-stately/list" "^3.2.2" + "@react-types/listbox" "^3.1.1" + "@react-types/shared" "^3.4.0" + +"@react-aria/menu@^3.2.0": + version "3.2.0" + resolved "https://registry.npmjs.org/@react-aria/menu/-/menu-3.2.0.tgz#cd9417105b3230f1c34ddddddb31a95f462393e2" + integrity sha512-CFgC82ZO/LjJtMhDUJFdE3+PV0jS88LK9CCr6w11ggp+U3Q2fPXPdkAVeEB3cJn4KI0TRCBgE+4EneIzdTEgcw== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-aria/interactions" "^3.3.4" + "@react-aria/overlays" "^3.6.2" + "@react-aria/selection" "^3.4.0" + "@react-aria/utils" "^3.7.0" + "@react-stately/collections" "^3.3.1" + "@react-stately/menu" "^3.2.1" + "@react-stately/tree" "^3.1.3" + "@react-types/button" "^3.3.1" + "@react-types/menu" "^3.1.1" + "@react-types/shared" "^3.5.0" + +"@react-aria/overlays@^3.6.1", "@react-aria/overlays@^3.6.2", "@react-aria/overlays@~3.6.2": + version "3.6.2" + resolved "https://registry.npmjs.org/@react-aria/overlays/-/overlays-3.6.2.tgz#0a9fcb7426d4321dc80ee636282228eb7be83a84" + integrity sha512-6f9o1fypGcB/VcprvoDm5280glaiAp/9RZeNPP+HPXE5MxpQIzFDJCzTrSezAUYNkueh/KNMpUxOUUgytloScQ== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-aria/i18n" "^3.3.0" + "@react-aria/interactions" "^3.3.4" + "@react-aria/utils" "^3.7.0" + "@react-aria/visually-hidden" "^3.2.1" + "@react-stately/overlays" "^3.1.1" + "@react-types/button" "^3.3.1" + "@react-types/overlays" "^3.4.0" + dom-helpers "^3.3.1" + +"@react-aria/select@~3.3.1": + version "3.3.1" + resolved "https://registry.npmjs.org/@react-aria/select/-/select-3.3.1.tgz#cfa694ff4b2020846e08b58f6f0a489f0d2b24ff" + integrity sha512-E/EZ4SKf8P5EMVznCmTjfa9y1cR6L+WIzXHTFAlwrmmIzNirHSipbFp6LpJzoByqd0p9IKxhBdxqFP92url0Qg== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-aria/i18n" "^3.3.0" + "@react-aria/interactions" "^3.3.4" + "@react-aria/label" "^3.1.1" + "@react-aria/menu" "^3.2.0" + "@react-aria/selection" "^3.4.0" + "@react-aria/utils" "^3.7.0" + "@react-aria/visually-hidden" "^3.2.1" + "@react-stately/select" "^3.1.1" + "@react-types/button" "^3.3.1" + "@react-types/select" "^3.2.0" + "@react-types/shared" "^3.5.0" + +"@react-aria/selection@^3.3.2", "@react-aria/selection@^3.4.0": + version "3.4.0" + resolved "https://registry.npmjs.org/@react-aria/selection/-/selection-3.4.0.tgz#abd7aa5435f504e314a72122f2bcaef43b06fa78" + integrity sha512-ddxiB9zhy8JEkG4+DElSMNrSKxRI3RQKyOwQf4i3omqXj8bMH1XJesFwbdGNmR/zrbzXvr35ln9y3S0WS+4ClA== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-aria/focus" "^3.2.4" + "@react-aria/i18n" "^3.3.0" + "@react-aria/interactions" "^3.3.4" + "@react-aria/utils" "^3.7.0" + "@react-stately/collections" "^3.3.1" + "@react-stately/selection" "^3.4.0" + "@react-types/shared" "^3.5.0" + +"@react-aria/separator@~3.1.1": + version "3.1.1" + resolved "https://registry.npmjs.org/@react-aria/separator/-/separator-3.1.1.tgz#bfcd71bb5ab50dc04a7f307b84bd77955f08002f" + integrity sha512-VbiqQsTtKKMjvMcPVWgTbDHzx7qMP3VFC+y9cEVajicMwRoO4bn7kJgcSzainXpWx70bhT5RW1mt84fzxMF+Lg== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-aria/utils" "^3.3.0" + "@react-types/shared" "^3.2.1" + +"@react-aria/ssr@^3.0.1", "@react-aria/ssr@~3.0.1": + version "3.0.1" + resolved "https://registry.npmjs.org/@react-aria/ssr/-/ssr-3.0.1.tgz#5f7c111f9ecd184b8f6140139703c1ee552dca30" + integrity sha512-rweMNcSkUO4YkcmgFIoZFvgPyHN2P9DOjq3VOHnZ8SG3Y4TTvSY6Iv90KgzeEfmWCUqqt65FYH4JgrpGNToEMw== + dependencies: + "@babel/runtime" "^7.6.2" + +"@react-aria/tooltip@~3.1.1": + version "3.1.1" + resolved "https://registry.npmjs.org/@react-aria/tooltip/-/tooltip-3.1.1.tgz#e0dfdd9e51b581563f684927249d70e1bad761e3" + integrity sha512-wTszWN6lG3A9Ofdrhv1vG9aOmoqzuUZCbG9ZbXZ9+RtiOMwP/WnuSLWXcMH+KaWYpaImy7h1MDfOgHeaPxCbag== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-aria/focus" "^3.2.3" + "@react-aria/interactions" "^3.3.3" + "@react-aria/overlays" "^3.6.1" + "@react-aria/utils" "^3.6.0" + "@react-stately/tooltip" "^3.0.2" + "@react-types/shared" "^3.4.0" + "@react-types/tooltip" "^3.1.1" + +"@react-aria/utils@^3.3.0", "@react-aria/utils@^3.6.0", "@react-aria/utils@^3.7.0", "@react-aria/utils@~3.7.0": + version "3.7.0" + resolved "https://registry.npmjs.org/@react-aria/utils/-/utils-3.7.0.tgz#0aab1f682e9f1781cfadd2dd1ef9494bfaca0cbf" + integrity sha512-sMCdX0eF+4B05I+SX9V/NzI1/fD45vabi0dNyJhbSu2xNI82VIYgPcMBDjGU83NJSnjY969R3/JbbLjBrtKUgA== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-aria/ssr" "^3.0.1" + "@react-stately/utils" "^3.2.0" + "@react-types/shared" "^3.5.0" + clsx "^1.1.1" + +"@react-aria/visually-hidden@^3.2.1": + version "3.2.1" + resolved "https://registry.npmjs.org/@react-aria/visually-hidden/-/visually-hidden-3.2.1.tgz#c022c562346140a473242448045add59269a74fd" + integrity sha512-ba7bQD09MuzUghtPyrQoXHgQnRRfOu039roVKPz2em9gHD0Wy4ap2UPwlzx35KzNq6FdCzMDZeSZHSnUWlzKnw== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-aria/interactions" "^3.2.1" + "@react-aria/utils" "^3.3.0" + clsx "^1.1.1" + +"@react-hook/debounce@^3.0.0": + version "3.0.0" + resolved "https://registry.npmjs.org/@react-hook/debounce/-/debounce-3.0.0.tgz#9eea8b5d81d4cb67cd72dd8657b3ff724afc7cad" + integrity sha512-ir/kPrSfAzY12Gre0sOHkZ2rkEmM4fS5M5zFxCi4BnCeXh2nvx9Ujd+U4IGpKCuPA+EQD0pg1eK2NGLvfWejag== + dependencies: + "@react-hook/latest" "^1.0.2" + +"@react-hook/event@^1.2.1": + version "1.2.3" + resolved "https://registry.npmjs.org/@react-hook/event/-/event-1.2.3.tgz#cfe86d5cf36f53e85b367ff619990d001b5c82ae" + integrity sha512-WMBwLnYY2rubLeecsi4skl1imfx0oiXTgazV/1ByPT6WkmLvxUao3hC+mxps5D/+JK4Fq3uG9OWU/dn5jMtXyg== + dependencies: + "@react-hook/passive-layout-effect" "^1.2.0" + +"@react-hook/latest@^1.0.2": + version "1.0.3" + resolved "https://registry.npmjs.org/@react-hook/latest/-/latest-1.0.3.tgz#c2d1d0b0af8b69ec6e2b3a2412ba0768ac82db80" + integrity sha512-dy6duzl+JnAZcDbNTfmaP3xHiKtbXYOaz3G51MGVljh548Y8MWzTr+PHLOfvpypEVW9zwvl+VyKjbWKEVbV1Rg== + +"@react-hook/passive-layout-effect@^1.2.0": + version "1.2.1" + resolved "https://registry.npmjs.org/@react-hook/passive-layout-effect/-/passive-layout-effect-1.2.1.tgz#c06dac2d011f36d61259aa1c6df4f0d5e28bc55e" + integrity sha512-IwEphTD75liO8g+6taS+4oqz+nnroocNfWVHWz7j+N+ZO2vYrc6PV1q7GQhuahL0IOR7JccFTsFKQ/mb6iZWAg== + +"@react-hook/resize-observer@^1.1.0": + version "1.2.0" + resolved "https://registry.npmjs.org/@react-hook/resize-observer/-/resize-observer-1.2.0.tgz#a44b385d998f4ab33aa9481a43c4ac33af21f7d7" + integrity sha512-7Cpy0aaZ3xXlSabQ43aZcfgzwYSidrshEKGDqpfvdx7pHnGDGskr8m1Ajb6yamJUSdTRgqCemYQcwouCqMmZoQ== + dependencies: + "@react-hook/latest" "^1.0.2" + "@react-hook/passive-layout-effect" "^1.2.0" + "@types/raf-schd" "^4.0.0" + raf-schd "^4.0.2" + resize-observer-polyfill "^1.5.1" + +"@react-hook/size@^2.1.1": + version "2.1.1" + resolved "https://registry.npmjs.org/@react-hook/size/-/size-2.1.1.tgz#10d3fb5bc61e128f0d7924714a925a04c992ed1f" + integrity sha512-QtHDsrvz8p4cai2UKxBpzk0r/uM63UyhmozTVChaDHJsVpN5/7A2yu8wuGyNhExdeCYMclLM21QjY1dyqpGbuQ== + dependencies: + "@react-hook/passive-layout-effect" "^1.2.0" + "@react-hook/resize-observer" "^1.1.0" + +"@react-hook/throttle@^2.2.0": + version "2.2.0" + resolved "https://registry.npmjs.org/@react-hook/throttle/-/throttle-2.2.0.tgz#d0402714a06e1ba0bc1da1fdf5c3c5cd0e08d45a" + integrity sha512-LJ5eg+yMV8lXtqK3lR+OtOZ2WH/EfWvuiEEu0M3bhR7dZRfTyEJKxH1oK9uyBxiXPtWXiQggWbZirMCXam51tg== + dependencies: + "@react-hook/latest" "^1.0.2" + +"@react-hook/window-size@^3.0.7": + version "3.0.7" + resolved "https://registry.npmjs.org/@react-hook/window-size/-/window-size-3.0.7.tgz#00d176e7a8eb55814e161eae34aae20afbcbe35d" + integrity sha512-bK5ed/jN+cxy0s1jt2CelCnUt7jZRseUvPQ22ZJkUl/QDOsD+7CA/6wcqC3c0QweM/fPBRP6uI56TJ48SnlVww== + dependencies: + "@react-hook/debounce" "^3.0.0" + "@react-hook/event" "^1.2.1" + "@react-hook/throttle" "^2.2.0" + +"@react-spectrum/utils@~3.5.1": + version "3.5.1" + resolved "https://registry.npmjs.org/@react-spectrum/utils/-/utils-3.5.1.tgz#dd733913e30e0ed59c6bdae430531283b4cdcc96" + integrity sha512-lSdxCtshkj9dsi9sGcem6s9lak2XT55uyZGZr2S3w6iwm3aS7OlJNoT/4xtUFGW3t1bF2oxNngHX6eLl+quFyw== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-aria/i18n" "^3.3.0" + "@react-aria/ssr" "^3.0.1" + "@react-aria/utils" "^3.6.0" + "@react-types/shared" "^3.4.0" + clsx "^1.1.1" + +"@react-stately/collections@^3.2.1", "@react-stately/collections@^3.3.0", "@react-stately/collections@^3.3.1": + version "3.3.1" + resolved "https://registry.npmjs.org/@react-stately/collections/-/collections-3.3.1.tgz#683acf6e7a4e9ea174e1cf82a13bb8175ba0a1a0" + integrity sha512-bBiOj0hszFpCbk9KhSm04Jo87GAODm8kA52uFiGAO99yb2ypO+UTFYseBExFQ59cV7b++UMCfdJe/+Ymv9RALg== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-types/shared" "^3.5.0" + +"@react-stately/list@^3.2.1", "@react-stately/list@^3.2.2": + version "3.2.2" + resolved "https://registry.npmjs.org/@react-stately/list/-/list-3.2.2.tgz#fb368cc7678503179202d11aef0ef8d48d1cbf12" + integrity sha512-8sJvy0cUhllhUMadYjX1qKmTxAWMRGxkvZpU/6reOEChlvibjAwbn2paoR8yZ+ppieeQOBe+AAYTl53gK8fKDA== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-stately/collections" "^3.3.0" + "@react-stately/selection" "^3.2.1" + "@react-stately/utils" "^3.1.1" + "@react-types/shared" "^3.2.1" + +"@react-stately/menu@^3.2.1": + version "3.2.1" + resolved "https://registry.npmjs.org/@react-stately/menu/-/menu-3.2.1.tgz#314646217e5dd49fa1da6886d33f485d44d6f0dd" + integrity sha512-8cpCynynjjn3qWNzrZMJEpsdk4tkXK9q3Xaw0ADqVym/NC/wPU3P3cqL4HY+ETar01tS2x8K23qYHbOZz0cQtQ== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-stately/overlays" "^3.1.1" + "@react-stately/utils" "^3.1.1" + "@react-types/menu" "^3.1.1" + "@react-types/shared" "^3.2.1" + +"@react-stately/overlays@^3.1.1": + version "3.1.1" + resolved "https://registry.npmjs.org/@react-stately/overlays/-/overlays-3.1.1.tgz#6c1a393b77148184f7b1df22ece832d694d5a8b4" + integrity sha512-79YYXvmWKflezNPhc4fvXA1rDZurZvvEJcmbStNlR5Ryrnk/sQiOQCoVWooi2M4glSMT3UOTvD7YEnXxARcuIQ== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-stately/utils" "^3.1.1" + "@react-types/overlays" "^3.2.1" + +"@react-stately/select@^3.1.1", "@react-stately/select@~3.1.1": + version "3.1.1" + resolved "https://registry.npmjs.org/@react-stately/select/-/select-3.1.1.tgz#f49602ee7fc71f14550360bfa7c5becab58ac877" + integrity sha512-cl63nW66IJPsn9WQjKvghAIFKdFKuU1txx4zdEGY9tcwB/Yc+bgniLGOOTExJqN/RdPW9uBny5jjWcc4OQXyJA== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-stately/collections" "^3.2.1" + "@react-stately/list" "^3.2.1" + "@react-stately/menu" "^3.2.1" + "@react-stately/selection" "^3.2.1" + "@react-stately/utils" "^3.1.1" + "@react-types/select" "^3.1.1" + "@react-types/shared" "^3.2.1" + +"@react-stately/selection@^3.2.1", "@react-stately/selection@^3.4.0": + version "3.4.0" + resolved "https://registry.npmjs.org/@react-stately/selection/-/selection-3.4.0.tgz#795134e17b59f21cc4979b30179bccdfc2e3b9c1" + integrity sha512-5RV9f1Tm4WSTDguL1iizYcgzeWiK6Qe2EZ03zaaE9gm5UyyIrEPQD4WW9Semio2cUF8IFuWLaOvRCk+un7p53Q== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-stately/collections" "^3.3.1" + "@react-stately/utils" "^3.1.1" + "@react-types/shared" "^3.5.0" + +"@react-stately/toggle@^3.2.1": + version "3.2.1" + resolved "https://registry.npmjs.org/@react-stately/toggle/-/toggle-3.2.1.tgz#8b10b5eb99c3c4df2c36d17a5f23b77773ed7722" + integrity sha512-gZVuJ8OYoATUoXzdprsyx6O1w3wCrN+J0KnjhrjjKTrBG68n3pZH0p6dM0XpsaCzlSv0UgNa4fhHS3dYfr/ovw== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-stately/utils" "^3.1.1" + "@react-types/checkbox" "^3.2.1" + "@react-types/shared" "^3.2.1" + +"@react-stately/tooltip@^3.0.2", "@react-stately/tooltip@~3.0.3": + version "3.0.3" + resolved "https://registry.npmjs.org/@react-stately/tooltip/-/tooltip-3.0.3.tgz#577fbf3cca39db7047ec2d77ddc03a56c454a82a" + integrity sha512-N98S8ccHEpgbgM6wIMZwqz37s8IQTa+5nPr8eVnIs5wqwdnAARFjvckr2okOGwaksofp1wtpcYbnNrIBwexJOg== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-stately/overlays" "^3.1.1" + "@react-stately/utils" "^3.2.0" + "@react-types/tooltip" "^3.1.1" + +"@react-stately/tree@^3.1.3": + version "3.1.3" + resolved "https://registry.npmjs.org/@react-stately/tree/-/tree-3.1.3.tgz#5ceb1aa3793836a503253ddd47fc9227ac59c7b4" + integrity sha512-xwM2C3ppd8yJfduwgff7Gl2bNPMVeF4K65InFJZNVx5JLKFF6DJLAPTORAHLpCN+AoB8bY4sRK3V5fNBVpz0oQ== + dependencies: + "@babel/runtime" "^7.6.2" + "@react-stately/collections" "^3.3.1" + "@react-stately/selection" "^3.4.0" + "@react-stately/utils" "^3.1.1" + "@react-types/shared" "^3.5.0" + +"@react-stately/utils@^3.1.1", "@react-stately/utils@^3.2.0": + version "3.2.0" + resolved "https://registry.npmjs.org/@react-stately/utils/-/utils-3.2.0.tgz#0b90a70fee3236025ad8bed1f0e3555d5fc10296" + integrity sha512-vVBJvHVLnQySgqZ7OfP3ngDdwfGscJDsSD3WcN5ntHiT3JlZ5bksQReDkJEs20SFu2ST4w/0K7O4m97SbuMl2Q== + dependencies: + "@babel/runtime" "^7.6.2" + +"@react-types/button@^3.3.1": + version "3.3.1" + resolved "https://registry.npmjs.org/@react-types/button/-/button-3.3.1.tgz#4bdd325bc7df19c33911af256f63eae91e2a452e" + integrity sha512-xKLGSzGfsDBMe0SM7icOLNmzW38sdNSDSGMdrTLd3ygxb6pXY/LlcTdx7Sq28hdW8XL/ikFAnoQeS1VLXZHj7w== + dependencies: + "@react-types/shared" "^3.4.0" + +"@react-types/checkbox@^3.2.1": + version "3.2.2" + resolved "https://registry.npmjs.org/@react-types/checkbox/-/checkbox-3.2.2.tgz#7182d44a533e2ffd2c9118372cbc2c33b006eb18" + integrity sha512-WAAqLdjf6GUWjsMN5NaFMFumOtGTq+3+48CpM0ah2L+qmhMdj1s4gvHDerhls6u4ovRK/7zhg7XK+qQwcYVqMg== + dependencies: + "@react-types/shared" "^3.4.0" + +"@react-types/dialog@^3.3.0": + version "3.3.0" + resolved "https://registry.npmjs.org/@react-types/dialog/-/dialog-3.3.0.tgz#60a2b53f250ee082b53aef9340c80f1afe654bc7" + integrity sha512-63Vsr/UOZiaajlNDQUgWDi6v3EMenV1f8Cwh+L4lcyIJnbC6WeC2VEV3ld/TYVC0U58SQ0k7u2EIyHkWjc5kdQ== + dependencies: + "@react-types/overlays" "^3.2.1" + "@react-types/shared" "^3.2.1" + +"@react-types/label@^3.2.1": + version "3.4.0" + resolved "https://registry.npmjs.org/@react-types/label/-/label-3.4.0.tgz#6023dc9dd0146324ead52e08540cd60e57a3e27f" + integrity sha512-l84ysm1dcjL/5qVk9iN74z+/Ul0999XqnwTu6aTbuwAXqMk2sTU45eK2Yp/FJ7YWeflcF1vsomTkjMkX0BHKMw== + dependencies: + "@react-types/shared" "^3.4.0" + +"@react-types/listbox@^3.1.1": + version "3.1.1" + resolved "https://registry.npmjs.org/@react-types/listbox/-/listbox-3.1.1.tgz#b896303ccb87123cf59ee2c089953d7928497c9b" + integrity sha512-HAljfdpbyLoJL9iwqz7Fw9MOmRwfzODeN+sr5ncE0eXJxnRBFhb5LjbjAN1dUBrKFBkv3etGlYu5HvX+PJjpew== + dependencies: + "@react-types/shared" "^3.2.1" + +"@react-types/menu@^3.1.1": + version "3.1.1" + resolved "https://registry.npmjs.org/@react-types/menu/-/menu-3.1.1.tgz#e5aa52ac07c083243540dd5da0790a85fd1628c6" + integrity sha512-/xZWp4/3P/8dKFAGuzxz8IccSXvJH0TmHIk2/xnj2Eyw9152IfutIpOda3iswhjrx1LEkzUgdJ8bCdiebgg6QQ== + dependencies: + "@react-types/overlays" "^3.2.1" + "@react-types/shared" "^3.2.1" + +"@react-types/overlays@^3.2.1", "@react-types/overlays@^3.4.0": + version "3.4.0" + resolved "https://registry.npmjs.org/@react-types/overlays/-/overlays-3.4.0.tgz#3c4619906bb12e3697e770b59c2090bb18da25bd" + integrity sha512-ddiMB6JXR7acQnRFEL2/6SSdBropmNrcAFk3qFCfovuVZh6STYhPmoAgj06mJFDoAD63pxayysfPG2EvLl2yAw== + dependencies: + "@react-types/shared" "^3.3.0" + +"@react-types/select@^3.1.1", "@react-types/select@^3.2.0": + version "3.2.0" + resolved "https://registry.npmjs.org/@react-types/select/-/select-3.2.0.tgz#31b9e0f94fc24f053f4a1f073e174ffd59bac055" + integrity sha512-9vYhQWr1iB+3KWTZ1RxS2xZq0n0CJfsTRbEr0akLrtE/pRLC4O4l8RMFD49HyX0fShvz1FStmxTE2x7k8yVc4w== + dependencies: + "@react-types/shared" "^3.4.0" + +"@react-types/shared@^3.2.1", "@react-types/shared@^3.3.0", "@react-types/shared@^3.4.0", "@react-types/shared@^3.5.0": + version "3.5.0" + resolved "https://registry.npmjs.org/@react-types/shared/-/shared-3.5.0.tgz#dbc90e8fe711967e66d6f3ce0e17d34b24bd6283" + integrity sha512-997Me7AegwJOI10ye/Q5ds6fT+VBc6XcsXYzPqOD+HIbyL1kUQNDF/VoO37ib7KEH8jXH9aceoX9blz3Q1QcpA== + +"@react-types/tooltip@^3.1.1": + version "3.1.1" + resolved "https://registry.npmjs.org/@react-types/tooltip/-/tooltip-3.1.1.tgz#7d45a4dd8c57c422a1a2dcb03b6c043e7481c3ca" + integrity sha512-18gM2Co9tzCDfN0tEdfboD18sXDtD6YiKctd8HQ8tBiRO4IF1ce9ubKe6++Lj+38GQPq7GWFFoUiS1WArTWIHA== + dependencies: + "@react-types/overlays" "^3.4.0" + "@react-types/shared" "^3.4.0" + "@rjsf/core@^2.4.0": version "2.5.1" resolved "https://registry.npmjs.org/@rjsf/core/-/core-2.5.1.tgz#95a842d22bab5f83929662fcd73739108e9f5cbb" @@ -4440,6 +4945,179 @@ dependencies: any-observable "^0.3.0" +"@sentry/apm@5.13.2": + version "5.13.2" + resolved "https://registry.npmjs.org/@sentry/apm/-/apm-5.13.2.tgz#3a0809912426f52e19b1f4a603e99423a0ac8fb9" + integrity sha512-Pv6PRVkcmmYYIT422gXm968F8YQyf5uN1RSHOFBjWsxI3Ke/uRgeEdIVKPDo78GklBfETyRN6GyLEZ555jRe6g== + dependencies: + "@sentry/browser" "5.13.2" + "@sentry/hub" "5.13.2" + "@sentry/minimal" "5.13.2" + "@sentry/types" "5.13.2" + "@sentry/utils" "5.13.2" + tslib "^1.9.3" + +"@sentry/apm@5.19.2": + version "5.19.2" + resolved "https://registry.npmjs.org/@sentry/apm/-/apm-5.19.2.tgz#369fdcbc9fa5db992f707b24f3165e106a277cf7" + integrity sha512-V7p5niqG/Nn1OSMAyreChiIrQFYzFHKADKNaDEvIXqC4hxFnMG8lPRqEFJH49fNjsFBFfIG9iY1rO1ZFg3S42Q== + dependencies: + "@sentry/browser" "5.19.2" + "@sentry/hub" "5.19.2" + "@sentry/minimal" "5.19.2" + "@sentry/types" "5.19.2" + "@sentry/utils" "5.19.2" + tslib "^1.9.3" + +"@sentry/browser@5.13.2", "@sentry/browser@~5.13.2": + version "5.13.2" + resolved "https://registry.npmjs.org/@sentry/browser/-/browser-5.13.2.tgz#fcca630c8c80447ba8392803d4e4450fd2231b92" + integrity sha512-4MeauHs8Rf1c2FF6n84wrvA4LexEL1K/Tg3r+1vigItiqyyyYBx1sPjHGZeKeilgBi+6IEV5O8sy30QIrA/NsQ== + dependencies: + "@sentry/core" "5.13.2" + "@sentry/types" "5.13.2" + "@sentry/utils" "5.13.2" + tslib "^1.9.3" + +"@sentry/browser@5.19.2", "@sentry/browser@~5.19.2": + version "5.19.2" + resolved "https://registry.npmjs.org/@sentry/browser/-/browser-5.19.2.tgz#8bad445b8d1efd50e6510bb43b3018b941f6e5cb" + integrity sha512-o6Z532n+0N5ANDzgR9GN+Q6CU7zVlIJvBEW234rBiB+ZZj6XwTLS1dD+JexGr8lCo8PeXI2rypKcj1jUGLVW8w== + dependencies: + "@sentry/core" "5.19.2" + "@sentry/types" "5.19.2" + "@sentry/utils" "5.19.2" + tslib "^1.9.3" + +"@sentry/core@5.13.2", "@sentry/core@~5.13.2": + version "5.13.2" + resolved "https://registry.npmjs.org/@sentry/core/-/core-5.13.2.tgz#d89e199beef612d0a01e5c4df4e0bb7efcb72c74" + integrity sha512-iB7CQSt9e0EJhSmcNOCjzJ/u7E7qYJ3mI3h44GO83n7VOmxBXKSvtUl9FpKFypbWrsdrDz8HihLgAZZoMLWpPA== + dependencies: + "@sentry/hub" "5.13.2" + "@sentry/minimal" "5.13.2" + "@sentry/types" "5.13.2" + "@sentry/utils" "5.13.2" + tslib "^1.9.3" + +"@sentry/core@5.19.2": + version "5.19.2" + resolved "https://registry.npmjs.org/@sentry/core/-/core-5.19.2.tgz#99a64ef0e55230fc02a083c48fa07ada85de4929" + integrity sha512-sfbBsVXpA0WYJUichz5IhvqKD8xJUfQvsszrTsUKa7PQAMAboOmuh6bo8KquaVQnAZyZWZU08UduvlSV3tA7tw== + dependencies: + "@sentry/hub" "5.19.2" + "@sentry/minimal" "5.19.2" + "@sentry/types" "5.19.2" + "@sentry/utils" "5.19.2" + tslib "^1.9.3" + +"@sentry/electron@~1.3.0": + version "1.3.2" + resolved "https://registry.npmjs.org/@sentry/electron/-/electron-1.3.2.tgz#83c40943f2fad5e72c77dadf524fd59d1a773e3f" + integrity sha512-fhD6cF7Jy0AXAVNHrUnxhzK5d/reXpzRcp5Ggnr+IRoijGe7rsq/AlOX8KhLS6SmQdI/XXb3F7fxHdItBV9+7w== + dependencies: + "@sentry/browser" "~5.13.2" + "@sentry/core" "~5.13.2" + "@sentry/minimal" "~5.13.2" + "@sentry/node" "~5.13.2" + "@sentry/types" "~5.13.2" + "@sentry/utils" "~5.13.2" + electron-fetch "^1.4.0" + form-data "2.5.1" + util.promisify "1.0.1" + +"@sentry/hub@5.13.2": + version "5.13.2" + resolved "https://registry.npmjs.org/@sentry/hub/-/hub-5.13.2.tgz#875a5ba983d6ada5caae5b6b4decd0257ef5cdb7" + integrity sha512-/U7yq3DTuRz8SRpZVKAaenW9sD2F5wbj12kDVPxPnGspyqhy0wBWKs9j0YJfBiDXMKOwp3HX964O3ygtwjnfAw== + dependencies: + "@sentry/types" "5.13.2" + "@sentry/utils" "5.13.2" + tslib "^1.9.3" + +"@sentry/hub@5.19.2": + version "5.19.2" + resolved "https://registry.npmjs.org/@sentry/hub/-/hub-5.19.2.tgz#ab7f3d2d253c3441b2833a530b17c6de2418b2c7" + integrity sha512-2KkEYX4q9TDCOiaVEo2kQ1W0IXyZxJxZtIjDdFQyes9T4ubYlKHAbvCjTxHSQv37lDO4t7sOIApWG9rlkHzlEA== + dependencies: + "@sentry/types" "5.19.2" + "@sentry/utils" "5.19.2" + tslib "^1.9.3" + +"@sentry/minimal@5.13.2", "@sentry/minimal@~5.13.2": + version "5.13.2" + resolved "https://registry.npmjs.org/@sentry/minimal/-/minimal-5.13.2.tgz#e42e33dc74fc935f8857d1a43a528afd741640fd" + integrity sha512-VV0eA3HgrnN3mac1XVPpSCLukYsU+QxegbmpnZ8UL8eIQSZ/ZikYxagDNlZbdnmXHUpOEUeag2gxVntSCo5UcA== + dependencies: + "@sentry/hub" "5.13.2" + "@sentry/types" "5.13.2" + tslib "^1.9.3" + +"@sentry/minimal@5.19.2", "@sentry/minimal@~5.19.2": + version "5.19.2" + resolved "https://registry.npmjs.org/@sentry/minimal/-/minimal-5.19.2.tgz#0fc2fdf9911a0cb31b52f7ccad061b74785724a3" + integrity sha512-rApEOkjy+ZmkeqEItgFvUFxe5l+dht9AumuUzq74pWp+HJqxxv9IVTusKppBsE1adjtmyhwK4O3Wr8qyc75xlw== + dependencies: + "@sentry/hub" "5.19.2" + "@sentry/types" "5.19.2" + tslib "^1.9.3" + +"@sentry/node@~5.13.2": + version "5.13.2" + resolved "https://registry.npmjs.org/@sentry/node/-/node-5.13.2.tgz#3be5608e00fb3fe1b813ad8365073a465d19f5f6" + integrity sha512-LwNOUvc0+28jYfI0o4HmkDTEYdY3dWvSCnL5zggO12buon7Wc+jirXZbEQAx84HlXu7sGSjtKCTzUQOphv7sPw== + dependencies: + "@sentry/apm" "5.13.2" + "@sentry/core" "5.13.2" + "@sentry/hub" "5.13.2" + "@sentry/types" "5.13.2" + "@sentry/utils" "5.13.2" + cookie "^0.3.1" + https-proxy-agent "^4.0.0" + lru_map "^0.3.3" + tslib "^1.9.3" + +"@sentry/node@~5.19.2": + version "5.19.2" + resolved "https://registry.npmjs.org/@sentry/node/-/node-5.19.2.tgz#8c1c2f6c983c3d8b25143e5b99c4b6cc745125ec" + integrity sha512-gbww3iTWkdvYIAhOmULbv8znKwkIpklGJ0SPtAh0orUMuaa0lVht+6HQIhRgeXp50lMzNaYC3fuzkbFfYgpS7A== + dependencies: + "@sentry/apm" "5.19.2" + "@sentry/core" "5.19.2" + "@sentry/hub" "5.19.2" + "@sentry/types" "5.19.2" + "@sentry/utils" "5.19.2" + cookie "^0.3.1" + https-proxy-agent "^5.0.0" + lru_map "^0.3.3" + tslib "^1.9.3" + +"@sentry/types@5.13.2", "@sentry/types@~5.13.2": + version "5.13.2" + resolved "https://registry.npmjs.org/@sentry/types/-/types-5.13.2.tgz#8e68c31f8fb99b4074374bff13ed01035b373d8c" + integrity sha512-mgAEQyc77PYBnAjnslSXUz6aKgDlunlg2c2qSK/ivKlEkTgTWWW/dE76++qVdrqM8SupnqQoiXyPDL0wUNdB3g== + +"@sentry/types@5.19.2", "@sentry/types@~5.19.2": + version "5.19.2" + resolved "https://registry.npmjs.org/@sentry/types/-/types-5.19.2.tgz#ead586f0b64b91c396d3521b938ca25f7b59d655" + integrity sha512-O6zkW8oM1qK5Uma9+B/UMlmlm9/gkw9MooqycWuEhIaKfDBj/yVbwb/UTiJmNkGc5VJQo0v1uXUZZQt6/Xq1GA== + +"@sentry/utils@5.13.2", "@sentry/utils@~5.13.2": + version "5.13.2" + resolved "https://registry.npmjs.org/@sentry/utils/-/utils-5.13.2.tgz#441594f4f9412bfd1690739ce986bf3a49687806" + integrity sha512-LwPQl6WRMKEnd16kg35HS3yE+VhBc8vN4+BBIlrgs7X0aoT+AbEd/sQLMisDgxNboCF44Ho3RCKtztiPb9blqg== + dependencies: + "@sentry/types" "5.13.2" + tslib "^1.9.3" + +"@sentry/utils@5.19.2": + version "5.19.2" + resolved "https://registry.npmjs.org/@sentry/utils/-/utils-5.19.2.tgz#f2819d9de5abc33173019e81955904247e4a8246" + integrity sha512-gEPkC0CJwvIWqcTcPSdIzqJkJa9N5vZzUZyBvdu1oiyJu7MfazpJEvj3whfJMysSfXJQxoJ+a1IPrA73VY23VA== + dependencies: + "@sentry/types" "5.19.2" + tslib "^1.9.3" + "@sideway/address@^4.1.0": version "4.1.1" resolved "https://registry.npmjs.org/@sideway/address/-/address-4.1.1.tgz#9e321e74310963fdf8eebfbee09c7bd69972de4d" @@ -4508,6 +5186,168 @@ resolved "https://registry.npmjs.org/@spotify/prettier-config/-/prettier-config-9.0.0.tgz#7b562d56573c6fc0094446fbc92b22bc318945dc" integrity sha512-In1q0tIiqTYKAGe3KOHDcFDdZRFISyQeSeipeTHGfki23ebHRZcjxvqj5SSdBkw65D4VpSREMi0s9i5iJiMcTw== +"@stoplight/beaver-logger@^4.0.12": + version "4.0.12" + resolved "https://registry.npmjs.org/@stoplight/beaver-logger/-/beaver-logger-4.0.12.tgz#f754d2f20b4728f5e96fdec574729988e4fb0c2d" + integrity sha512-VPSqZ706GaAB/7VcXcKvzaxaKwHmr2jUNcn0mTvhR3dwglmDEsqoKRvzTxH+Zu1VUIRjdcy9zmU7mSfjKjPt7Q== + dependencies: + belter "^1.0.17" + zalgo-promise "^1.0.26" + +"@stoplight/json-schema-merge-allof@^0.7.5": + version "0.7.6" + resolved "https://registry.npmjs.org/@stoplight/json-schema-merge-allof/-/json-schema-merge-allof-0.7.6.tgz#39efac12a497ed29a06ae48e0141885634a045a4" + integrity sha512-xLbJC2VOd9AxO1VvvgyP/mWOqZbeg6mLpYzlzU4egDTTIrTsSqtv+yFakpPciuuMlOmJU/KzZK9C5AbMgE+VgQ== + dependencies: + compute-lcm "^1.1.0" + json-schema-compare "^0.2.2" + lodash "^4.17.4" + +"@stoplight/json-schema-tree@^2.0.0": + version "2.0.0" + resolved "https://registry.npmjs.org/@stoplight/json-schema-tree/-/json-schema-tree-2.0.0.tgz#00d54cb6aa2a791c34be91fc30cc92e6d448258c" + integrity sha512-vnzcb0TC07xh89lAVGjBTJ2CWvCqmDJDIs3u+gvgvjDPY86CQ0Wl4D2Cmb0iuqd986aiDPc8vDQf1N0dSq5+9A== + dependencies: + "@stoplight/json" "^3.12.0" + "@stoplight/json-schema-merge-allof" "^0.7.5" + "@stoplight/lifecycle" "^2.3.2" + "@types/json-schema" "^7.0.7" + magic-error "^0.0.0" + +"@stoplight/json-schema-viewer@^4.0.0-beta.16": + version "4.0.0-beta.16" + resolved "https://registry.npmjs.org/@stoplight/json-schema-viewer/-/json-schema-viewer-4.0.0-beta.16.tgz#8f55debcb1e84ddcd6f55012ed52712560beaca5" + integrity sha512-f6GijfWi15maRQH4J/ulc8tFpoc+ejGeckiIH+USTLPd7fmGiIU5wINbJSVbLJ5Hccky8wraxlCzfdRuck84Jw== + dependencies: + "@fortawesome/free-solid-svg-icons" "^5.15.2" + "@stoplight/json" "^3.10.0" + "@stoplight/json-schema-tree" "^2.0.0" + "@stoplight/mosaic" "1.0.0-beta.46" + "@stoplight/react-error-boundary" "^1.0.0" + "@types/json-schema" "^7.0.7" + classnames "^2.2.6" + lodash "^4.17.19" + +"@stoplight/json@^3.10.0", "@stoplight/json@^3.12.0": + version "3.12.0" + resolved "https://registry.npmjs.org/@stoplight/json/-/json-3.12.0.tgz#26c8d32da78eac6a760ba2c9cca6ae717dc417b4" + integrity sha512-c0bvFOGICk8QWIat72Td2GG6Bdvq/6O2jQcDZ8rEjh56YOdC/YPn1S8ihKu3AntJCtvqC9eTfadWBqkNK9HAjw== + dependencies: + "@stoplight/ordered-object-literal" "^1.0.1" + "@stoplight/types" "^11.9.0" + jsonc-parser "~2.2.1" + lodash "^4.17.15" + safe-stable-stringify "^1.1" + +"@stoplight/lifecycle@^2.3.2": + version "2.3.2" + resolved "https://registry.npmjs.org/@stoplight/lifecycle/-/lifecycle-2.3.2.tgz#d61dff9ba20648241432e2daaef547214dc8976e" + integrity sha512-v0u8p27FA/eg04b4z6QXw4s0NeeFcRzyvseBW0+k/q4jtpg7EhVCqy42EbbbU43NTNDpIeQ81OcvkFz+6CYshw== + dependencies: + wolfy87-eventemitter "~5.2.8" + +"@stoplight/mosaic@1.0.0-beta.46": + version "1.0.0-beta.46" + resolved "https://registry.npmjs.org/@stoplight/mosaic/-/mosaic-1.0.0-beta.46.tgz#35fa3c9aebdb3c3535d1d8dd53cc52f1b2b1f5db" + integrity sha512-GlGLb2RzvzS7CQpq006c6eZhe7tIgRvDIt/nYqx+FXJEh0M045I2EObstdbyQt/sL7Zw5lae3uxiQ/1j8FqkRA== + dependencies: + "@fortawesome/fontawesome-svg-core" "^1.2.35" + "@fortawesome/free-solid-svg-icons" "^5.15.3" + "@fortawesome/react-fontawesome" "^0.1.14" + "@react-aria/button" "~3.3.1" + "@react-aria/dialog" "~3.1.2" + "@react-aria/focus" "~3.2.4" + "@react-aria/interactions" "~3.3.4" + "@react-aria/listbox" "~3.2.4" + "@react-aria/overlays" "~3.6.2" + "@react-aria/select" "~3.3.1" + "@react-aria/separator" "~3.1.1" + "@react-aria/ssr" "~3.0.1" + "@react-aria/tooltip" "~3.1.1" + "@react-aria/utils" "~3.7.0" + "@react-hook/size" "^2.1.1" + "@react-hook/window-size" "^3.0.7" + "@react-spectrum/utils" "~3.5.1" + "@react-stately/select" "~3.1.1" + "@react-stately/tooltip" "~3.0.3" + clsx "^1.1.1" + copy-to-clipboard "^3.3.1" + deepmerge "^4.2.2" + lodash.get "^4.4.2" + polished "^4.1.1" + reakit "npm:@stoplight/reakit@~1.3.5" + ts-keycode-enum "^1.0.6" + tslib "^2.1.0" + zustand "^3.3.3" + +"@stoplight/mosaic@^1.0.0-beta.46": + version "1.0.0-beta.47" + resolved "https://registry.npmjs.org/@stoplight/mosaic/-/mosaic-1.0.0-beta.47.tgz#6b212163af3ab7fb981dee75785f1b967299171e" + integrity sha512-Rp6aXslPB0X2hqj8MFmbYSWUvSjo/ResDFNQoMHD1BCBGw0nTmlcPZaQDKQApUFQrDBzih+OGRKTk0mGxrTP3A== + dependencies: + "@fortawesome/fontawesome-svg-core" "^1.2.35" + "@fortawesome/free-solid-svg-icons" "^5.15.3" + "@fortawesome/react-fontawesome" "^0.1.14" + "@react-aria/button" "~3.3.1" + "@react-aria/dialog" "~3.1.2" + "@react-aria/focus" "~3.2.4" + "@react-aria/interactions" "~3.3.4" + "@react-aria/listbox" "~3.2.4" + "@react-aria/overlays" "~3.6.2" + "@react-aria/select" "~3.3.1" + "@react-aria/separator" "~3.1.1" + "@react-aria/ssr" "~3.0.1" + "@react-aria/tooltip" "~3.1.1" + "@react-aria/utils" "~3.7.0" + "@react-hook/size" "^2.1.1" + "@react-hook/window-size" "^3.0.7" + "@react-spectrum/utils" "~3.5.1" + "@react-stately/select" "~3.1.1" + "@react-stately/tooltip" "~3.0.3" + clsx "^1.1.1" + copy-to-clipboard "^3.3.1" + deepmerge "^4.2.2" + lodash.get "^4.4.2" + polished "^4.1.1" + reakit "npm:@stoplight/reakit@~1.3.5" + ts-keycode-enum "^1.0.6" + tslib "^2.1.0" + zustand "^3.3.3" + +"@stoplight/ordered-object-literal@^1.0.1": + version "1.0.2" + resolved "https://registry.npmjs.org/@stoplight/ordered-object-literal/-/ordered-object-literal-1.0.2.tgz#2a88a5ebc8b68b54837ac9a9ae7b779cdd862062" + integrity sha512-0ZMS/9sNU3kVo/6RF3eAv7MK9DY8WLjiVJB/tVyfF2lhr2R4kqh534jZ0PlrFB9CRXrdndzn1DbX6ihKZXft2w== + +"@stoplight/react-error-boundary@^1.0.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@stoplight/react-error-boundary/-/react-error-boundary-1.1.0.tgz#9b0fb5d0538abbf9a416723b90f5b776bf68a75d" + integrity sha512-z/1gDVQAafqYuJksL212F1DXHSr604KDqAspZwbC+kWVqCsddQBmXzwI4Lqqem4wHbNGeVZYk3svW+sILX/PUQ== + dependencies: + "@stoplight/types" "^11.9.0" + +"@stoplight/reporter@^1.10.0": + version "1.10.0" + resolved "https://registry.npmjs.org/@stoplight/reporter/-/reporter-1.10.0.tgz#cbb58a7842422178ff56410e3f009517a474a5ba" + integrity sha512-XdHIT+TwS00rEhsEClCddrACZCqxK+sh/R2EBFuXBTbWMIwujoWVTLPxEwhVkfm2JF57pK3jzULOFxEnNRnmpQ== + dependencies: + "@sentry/browser" "~5.19.2" + "@sentry/electron" "~1.3.0" + "@sentry/minimal" "~5.19.2" + "@sentry/node" "~5.19.2" + "@sentry/types" "~5.19.2" + "@stoplight/beaver-logger" "^4.0.12" + "@types/amplitude-js" "^5.11.0" + amplitude-js "^7.1.0" + +"@stoplight/types@^11.9.0": + version "11.10.0" + resolved "https://registry.npmjs.org/@stoplight/types/-/types-11.10.0.tgz#60bbee770526f4de9cd1c613c7ab84c4e4674126" + integrity sha512-ffHD9i4UHS8Gsg7Ar8pKjI9B4kq7MRekE7tCROFGcFDzQhfRx9T92AduoLAtP/010XNYq23yDKpLBRPIEk8+xg== + dependencies: + "@types/json-schema" "^7.0.4" + utility-types "^3.10.0" + "@storybook/addon-actions@^6.1.11": version "6.1.17" resolved "https://registry.npmjs.org/@storybook/addon-actions/-/addon-actions-6.1.17.tgz#9d32336284738cefa69b99acafa4b132d5533600" @@ -5631,6 +6471,11 @@ dependencies: "@types/node" "*" +"@types/amplitude-js@^5.11.0": + version "5.11.1" + resolved "https://registry.npmjs.org/@types/amplitude-js/-/amplitude-js-5.11.1.tgz#4883aa6f484530df3557de8683ff4529fcb7ec65" + integrity sha512-2BAZ8sMlOq4t0zC5LEBRL551u/kJPr+BTOe9OUtFT7J1U4Kgm+gHYmV4nYwq9sZnNj6MisCllKiiL27WEur7Sw== + "@types/anymatch@*": version "1.3.1" resolved "https://registry.npmjs.org/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a" @@ -6211,6 +7056,11 @@ resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz#f4c7ec43e81b319a9815115031709f26987891f0" integrity sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw== +"@types/json-schema@^7.0.7": + version "7.0.7" + resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz#98a993516c859eb0d5c4c8f098317a9ea68db9ad" + integrity sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA== + "@types/json-stable-stringify@^1.0.32": version "1.0.32" resolved "https://registry.npmjs.org/@types/json-stable-stringify/-/json-stable-stringify-1.0.32.tgz#121f6917c4389db3923640b2e68de5fa64dda88e" @@ -6532,6 +7382,11 @@ resolved "https://registry.npmjs.org/@types/qs/-/qs-6.9.4.tgz#a59e851c1ba16c0513ea123830dd639a0a15cb6a" integrity sha512-+wYo+L6ZF6BMoEjtf8zB2esQsqdV6WsjRK/GP9WOgLPrq87PbNWgIxS76dS5uvl/QXtHGakZmwTznIfcPXcKlQ== +"@types/raf-schd@^4.0.0": + version "4.0.1" + resolved "https://registry.npmjs.org/@types/raf-schd/-/raf-schd-4.0.1.tgz#1f9e03736f277fe9c7b82102bf18570a6ee19f82" + integrity sha512-Ha+EnKHFIh9EKW0/XZJPUd3EGDFisEvauaBd4VVCRPKeOqUxNEc9TodiY2Zhk33XCgzJucoFEcaoNcBAPHTQ2A== + "@types/raf@^3.4.0": version "3.4.0" resolved "https://registry.npmjs.org/@types/raf/-/raf-3.4.0.tgz#2b72cbd55405e071f1c4d29992638e022b20acc2" @@ -7418,6 +8273,11 @@ address@1.1.2, address@^1.0.1: resolved "https://registry.npmjs.org/address/-/address-1.1.2.tgz#bf1116c9c758c51b7a933d296b72c221ed9428b6" integrity sha512-aT6camzM4xEA54YVJYSqxz1kv4IHnQZRtThJJHhUMRExaU5spC7jX5ugSwTaTgJliIgs4VhZOk7htClvQ/LmRA== +agent-base@5: + version "5.1.1" + resolved "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz#e8fb3f242959db44d63be665db7a8e739537a32c" + integrity sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g== + agent-base@6: version "6.0.1" resolved "https://registry.npmjs.org/agent-base/-/agent-base-6.0.1.tgz#808007e4e5867decb0ab6ab2f928fbdb5a596db4" @@ -7507,6 +8367,16 @@ alphanum-sort@^1.0.0: resolved "https://registry.npmjs.org/alphanum-sort/-/alphanum-sort-1.0.2.tgz#97a1119649b211ad33691d9f9f486a8ec9fbe0a3" integrity sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM= +amplitude-js@^7.1.0: + version "7.4.4" + resolved "https://registry.npmjs.org/amplitude-js/-/amplitude-js-7.4.4.tgz#1abd76f96a44ebdbf90e7371b37d071010deffe6" + integrity sha512-3Ojj1draRcXvfxi5P+Ye/6Y4roxtf1lQEjczcLDnHU9vxbPtT4fDblC9+cdJy7XmlJkGoq+KvnItlWfLuHV9GQ== + dependencies: + "@amplitude/ua-parser-js" "0.7.24" + "@amplitude/utils" "^1.0.5" + blueimp-md5 "^2.10.0" + query-string "5" + anafanafo@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/anafanafo/-/anafanafo-1.0.0.tgz#2e67190aed5dc67f5f0043b710146e7276c1afb8" @@ -8715,6 +9585,15 @@ before-after-hook@^2.1.0: resolved "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz#b6c03487f44e24200dd30ca5e6a1979c5d2fb635" integrity sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A== +belter@^1.0.17: + version "1.0.165" + resolved "https://registry.npmjs.org/belter/-/belter-1.0.165.tgz#8bc32f0f30b94b67b80a63727b1584acd69942f0" + integrity sha512-TVOfXtLTTU3yyORjiYD2s9+fnTdxZp69KtR3pSDquLrdtK3OUmypgukVL+pIbcE6VMc85FRoFR48gybNZ2zHZQ== + dependencies: + cross-domain-safe-weakmap "^1" + cross-domain-utils "^2" + zalgo-promise "^1" + better-opn@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/better-opn/-/better-opn-2.0.0.tgz#c70d198e51164bdc220306a28a885d9ac7a14c44" @@ -8810,6 +9689,11 @@ bluebird@~3.4.1: resolved "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz#f72d760be09b7f76d08ed8fae98b289a8d05fab3" integrity sha1-9y12C+Cbf3bQjtj66Ysomo0F+rM= +blueimp-md5@^2.10.0: + version "2.18.0" + resolved "https://registry.npmjs.org/blueimp-md5/-/blueimp-md5-2.18.0.tgz#1152be1335f0c6b3911ed9e36db54f3e6ac52935" + integrity sha512-vE52okJvzsVWhcgUHOv+69OG3Mdg151xyn41aVQN/5W5S+S43qZhxECtYLAEHMSFWX6Mv5IZrzj3T5+JqXfj5Q== + bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.11.9: version "4.12.0" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" @@ -8831,6 +9715,11 @@ body-parser@1.19.0, body-parser@^1.18.3: raw-body "2.4.0" type-is "~1.6.17" +body-scroll-lock@^3.1.5: + version "3.1.5" + resolved "https://registry.npmjs.org/body-scroll-lock/-/body-scroll-lock-3.1.5.tgz#c1392d9217ed2c3e237fee1e910f6cdd80b7aaec" + integrity sha512-Yi1Xaml0EvNA0OYWxXiYNqY24AfWkbA6w5vxE7GWxtKfzIbZM+Qw+aSmkgsbWzbHiy/RCSkUZBplVxTA+E4jJg== + bonjour@^3.5.0: version "3.5.0" resolved "https://registry.npmjs.org/bonjour/-/bonjour-3.5.0.tgz#8e890a183d8ee9a2393b3844c691a42bcf7bc9f5" @@ -9863,7 +10752,7 @@ clone@^1.0.2: resolved "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4= -clsx@^1.0.1, clsx@^1.0.2, clsx@^1.0.4, clsx@^1.1.0: +clsx@^1.0.1, clsx@^1.0.2, clsx@^1.0.4, clsx@^1.1.0, clsx@^1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/clsx/-/clsx-1.1.1.tgz#98b3134f9abbdf23b2663491ace13c5c03a73188" integrity sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA== @@ -10403,6 +11292,11 @@ cookie@0.4.0: resolved "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba" integrity sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg== +cookie@^0.3.1: + version "0.3.1" + resolved "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb" + integrity sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s= + cookie@^0.4.1, cookie@~0.4.1: version "0.4.1" resolved "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz#afd713fe26ebd21ba95ceb61f9a8116e50a537d1" @@ -10605,6 +11499,20 @@ create-require@^1.1.0: resolved "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== +cross-domain-safe-weakmap@^1: + version "1.0.28" + resolved "https://registry.npmjs.org/cross-domain-safe-weakmap/-/cross-domain-safe-weakmap-1.0.28.tgz#d6c3c5af954340ce5f9d4ee5f3c38dba9513a165" + integrity sha512-gfQiQYSdWr9cYFVpmzp+b6MyTnefefDHr+fvm+JVv20hQxetV5J6chZOAusrpM/kFpTTbVDnHCziBFaREvgc0Q== + dependencies: + cross-domain-utils "^2.0.0" + +cross-domain-utils@^2, cross-domain-utils@^2.0.0: + version "2.0.34" + resolved "https://registry.npmjs.org/cross-domain-utils/-/cross-domain-utils-2.0.34.tgz#3f8dc8d82a5434213787433f17b76f51c316e382" + integrity sha512-ke4PirGRXwEElEmE/7k5aCvCW+EqbgseT7AOObzFfaVnOLuEVN9SjVWoOfS/qAT0rDPn3ggmNDW6mguMBy4HgA== + dependencies: + zalgo-promise "^1.0.11" + cross-env@^7.0.0: version "7.0.3" resolved "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf" @@ -11740,7 +12648,7 @@ dom-converter@^0.2: dependencies: utila "~0.4" -dom-helpers@^3.4.0: +dom-helpers@^3.3.1, dom-helpers@^3.4.0: version "3.4.0" resolved "https://registry.npmjs.org/dom-helpers/-/dom-helpers-3.4.0.tgz#e9b369700f959f62ecde5a6babde4bccd9169af8" integrity sha512-LnuPJ+dwqKDIyotW1VzmOZ5TONUN7CwkCR5hrgawTUbkBGYdeoNLZo6nNfGkCrjtE1nXXaj7iMMpDa8/d9WoIA== @@ -12030,6 +12938,13 @@ ejs@^3.1.2: dependencies: jake "^10.6.1" +electron-fetch@^1.4.0: + version "1.7.3" + resolved "https://registry.npmjs.org/electron-fetch/-/electron-fetch-1.7.3.tgz#06cf363d7f64073ec00a37e9949ec9d29ce6b08a" + integrity sha512-1AVMaxrHXTTMqd7EK0MGWusdqNr07Rpj8Th6bG4at0oNgIi/1LBwa9CjT/0Zy+M0k/tSJPS04nFxHj0SXDVgVw== + dependencies: + encoding "^0.1.13" + electron-to-chromium@^1.3.378: version "1.3.509" resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.509.tgz#830fcb89cd66dc2984d18d794973b99e3f00584c" @@ -12131,7 +13046,7 @@ encodeurl@~1.0.2: resolved "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= -encoding@^0.1.12: +encoding@^0.1.12, encoding@^0.1.13: version "0.1.13" resolved "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz#56574afdd791f54a8e9b2785c0582a2d26210fa9" integrity sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A== @@ -13550,7 +14465,7 @@ fork-ts-checker-webpack-plugin@4.1.6, fork-ts-checker-webpack-plugin@^4.0.5, for tapable "^1.0.0" worker-rpc "^0.1.0" -form-data@^2.3.1, form-data@^2.3.2, form-data@^2.5.0: +form-data@2.5.1, form-data@^2.3.1, form-data@^2.3.2, form-data@^2.5.0: version "2.5.1" resolved "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz#f2cbec57b5e59e23716e128fe44d4e5dd23895f4" integrity sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA== @@ -15095,6 +16010,14 @@ https-proxy-agent@^2.2.1: agent-base "^4.3.0" debug "^3.1.0" +https-proxy-agent@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz#702b71fb5520a132a66de1f67541d9e62154d82b" + integrity sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg== + dependencies: + agent-base "5" + debug "4" + https-proxy-agent@^5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz#e2a90542abb68a762e0a0850f6c9edadfd8506b2" @@ -15487,6 +16410,18 @@ interpret@^2.0.0, interpret@^2.2.0: resolved "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz#1a78a0b5965c40a5416d007ad6f50ad27c417df9" integrity sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw== +intl-messageformat-parser@1.4.0: + version "1.4.0" + resolved "https://registry.npmjs.org/intl-messageformat-parser/-/intl-messageformat-parser-1.4.0.tgz#b43d45a97468cadbe44331d74bb1e8dea44fc075" + integrity sha1-tD1FqXRoytvkQzHXS7Ho3qRPwHU= + +intl-messageformat@^2.2.0: + version "2.2.0" + resolved "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-2.2.0.tgz#345bcd46de630b7683330c2e52177ff5eab484fc" + integrity sha1-NFvNRt5jC3aDMwwuUhd/9eq0hPw= + dependencies: + intl-messageformat-parser "1.4.0" + invariant@^2.0.0, invariant@^2.2.2, invariant@^2.2.3, invariant@^2.2.4: version "2.2.4" resolved "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" @@ -17027,6 +17962,11 @@ json5@^1.0.1: dependencies: minimist "^1.2.0" +jsonc-parser@~2.2.1: + version "2.2.1" + resolved "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.2.1.tgz#db73cd59d78cce28723199466b2a03d1be1df2bc" + integrity sha512-o6/yDBYccGvTz1+QFevz6l6OBZ2+fMVu2JZ9CIhzsYRX4mjaK5IyX9eldUdCmga16zlgQxyrj5pt9kzuj2C02w== + jsonfile@^2.1.0: version "2.4.0" resolved "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8" @@ -17795,7 +18735,7 @@ lodash.flattendeep@^4.0.0: resolved "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2" integrity sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI= -lodash.get@^4, lodash.get@^4.0.0: +lodash.get@^4, lodash.get@^4.0.0, lodash.get@^4.4.2: version "4.4.2" resolved "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= @@ -18060,6 +19000,11 @@ lru-queue@^0.1.0: dependencies: es5-ext "~0.10.2" +lru_map@^0.3.3: + version "0.3.3" + resolved "https://registry.npmjs.org/lru_map/-/lru_map-0.3.3.tgz#b5c8351b9464cbd750335a79650a0ec0e56118dd" + integrity sha1-tcg1G5Rky9dQM1p5ZQoOwOVhGN0= + lunr@^2.3.9: version "2.3.9" resolved "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz#18b123142832337dd6e964df1a5a7707b25d35e1" @@ -18085,6 +19030,11 @@ macos-release@^2.2.0: resolved "https://registry.npmjs.org/macos-release/-/macos-release-2.3.0.tgz#eb1930b036c0800adebccd5f17bc4c12de8bb71f" integrity sha512-OHhSbtcviqMPt7yfw5ef5aghS2jzFVKEFyCJndQt2YpSQ9qRVSEv2axSJI1paVThEu+FFGs584h/1YhxjVqajA== +magic-error@^0.0.0: + version "0.0.0" + resolved "https://registry.npmjs.org/magic-error/-/magic-error-0.0.0.tgz#f8630c98c55764b4851601901fdcb63428758b7d" + integrity sha512-ZMU3ylGOb/YQEpJo0XtAXbPGmKJtwzc3cuOHPrKgosV8AAc6db8dlQYLe0cp64P3BxkYZGoUvkvdNR5JM78beA== + magic-string@^0.25.7: version "0.25.7" resolved "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051" @@ -20881,6 +21831,13 @@ polished@^3.4.4: dependencies: "@babel/runtime" "^7.9.2" +polished@^4.1.1: + version "4.1.2" + resolved "https://registry.npmjs.org/polished/-/polished-4.1.2.tgz#c04fcc203e287e2d866e9cfcaf102dae1c01a816" + integrity sha512-jq4t3PJUpVRcveC53nnbEX35VyQI05x3tniwp26WFdm1dwaNUBHAi5awa/roBlwQxx1uRhwNSYeAi/aMbfiJCQ== + dependencies: + "@babel/runtime" "^7.13.17" + popper.js@1.16.1-lts: version "1.16.1-lts" resolved "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1-lts.tgz#cf6847b807da3799d80ee3d6d2f90df8a3f50b05" @@ -21731,6 +22688,15 @@ qs@~6.5.2: resolved "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== +query-string@5: + version "5.1.1" + resolved "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz#a78c012b71c17e05f2e3fa2319dd330682efb3cb" + integrity sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw== + dependencies: + decode-uri-component "^0.2.0" + object-assign "^4.1.0" + strict-uri-encode "^1.0.0" + query-string@^4.1.0: version "4.3.4" resolved "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz#bbb693b9ca915c232515b228b1a02b609043dbeb" @@ -22645,6 +23611,36 @@ readdirp@~3.5.0: dependencies: picomatch "^2.2.1" +reakit-system@^0.15.1: + version "0.15.1" + resolved "https://registry.npmjs.org/reakit-system/-/reakit-system-0.15.1.tgz#bf5cc7a03f60a817373bc9cbb4a689c1f4100547" + integrity sha512-PkqfAyEohtcEu/gUvKriCv42NywDtUgvocEN3147BI45dOFAB89nrT7wRIbIcKJiUT598F+JlPXAZZVLWhc1Kg== + dependencies: + reakit-utils "^0.15.1" + +reakit-utils@^0.15.1: + version "0.15.1" + resolved "https://registry.npmjs.org/reakit-utils/-/reakit-utils-0.15.1.tgz#797f0a43f6a1dbc22d161224d5d2272e287dbfe3" + integrity sha512-6cZgKGvOkAMQgkwU9jdYbHfkuIN1Pr+vwcB19plLvcTfVN0Or10JhIuj9X+JaPZyI7ydqTDFaKNdUcDP69o/+Q== + +reakit-warning@^0.6.1: + version "0.6.1" + resolved "https://registry.npmjs.org/reakit-warning/-/reakit-warning-0.6.1.tgz#dba33bb8866aebe30e67ac433ead707d16d38a36" + integrity sha512-poFUV0EyxB+CcV9uTNBAFmcgsnR2DzAbOTkld4Ul+QOKSeEHZB3b3+MoZQgcYHmbvG19Na1uWaM7ES+/Eyr8tQ== + dependencies: + reakit-utils "^0.15.1" + +"reakit@npm:@stoplight/reakit@~1.3.5": + version "1.3.5" + resolved "https://registry.npmjs.org/@stoplight/reakit/-/reakit-1.3.5.tgz#0c1a1ae89a92de98413d3723b993c05d943bd56b" + integrity sha512-/Con1m4eSaztckgnEPckNPMkAIcOCYku60mANTGScevY9wYk56V2L6vpv6HR4r8gsFCl4S/CVoNCVMxkxi/pGw== + dependencies: + "@popperjs/core" "^2.5.4" + body-scroll-lock "^3.1.5" + reakit-system "^0.15.1" + reakit-utils "^0.15.1" + reakit-warning "^0.6.1" + recharts-scale@^0.4.2: version "0.4.3" resolved "https://registry.npmjs.org/recharts-scale/-/recharts-scale-0.4.3.tgz#040b4f638ed687a530357292ecac880578384b59" @@ -23389,6 +24385,11 @@ safe-regex@^1.1.0: dependencies: ret "~0.1.10" +safe-stable-stringify@^1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-1.1.1.tgz#c8a220ab525cd94e60ebf47ddc404d610dc5d84a" + integrity sha512-ERq4hUjKDbJfE4+XtZLFPCDi8Vb1JqaxAPTxWFLBx8XcAlf9Bda/ZJdVezs/NAfsMQScyIlUMx+Yeu7P7rx5jw== + "safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: version "2.1.2" resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" @@ -25542,6 +26543,11 @@ ts-jest@^26.4.3: semver "7.x" yargs-parser "20.x" +ts-keycode-enum@^1.0.6: + version "1.0.6" + resolved "https://registry.npmjs.org/ts-keycode-enum/-/ts-keycode-enum-1.0.6.tgz#aeefd1c2fc7b0557f86a0e696e300905bbb4c1c1" + integrity sha512-DF8+Cf/FJJnPRxwz8agCoDelQXKZWQOS/gnnwx01nZ106tPJdB3BgJ9QTtLwXgR82D8O+nTjuZzWgf0Rg4vuRA== + ts-loader@^8.0.17: version "8.0.17" resolved "https://registry.npmjs.org/ts-loader/-/ts-loader-8.0.17.tgz#98f2ccff9130074f4079fd89b946b4c637b1f2fc" @@ -26220,7 +27226,7 @@ util.promisify@1.0.0: define-properties "^1.1.2" object.getownpropertydescriptors "^2.0.3" -util.promisify@^1.0.0, util.promisify@~1.0.0: +util.promisify@1.0.1, util.promisify@^1.0.0, util.promisify@~1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.1.tgz#6baf7774b80eeb0f7520d8b81d07982a59abbaee" integrity sha512-g9JpC/3He3bm38zsLupWryXHoEcS22YHthuPQSJdMy6KNrzIRzWqcsHzD/WUnqe45whVou4VIsPew37DoXWNrA== @@ -26249,6 +27255,11 @@ utila@^0.4.0, utila@~0.4: resolved "https://registry.npmjs.org/utila/-/utila-0.4.0.tgz#8a16a05d445657a3aea5eecc5b12a4fa5379772c" integrity sha1-ihagXURWV6Oupe7MWxKk+lN5dyw= +utility-types@^3.10.0: + version "3.10.0" + resolved "https://registry.npmjs.org/utility-types/-/utility-types-3.10.0.tgz#ea4148f9a741015f05ed74fd615e1d20e6bed82b" + integrity sha512-O11mqxmi7wMKCo6HKFt5AhO4BwY3VV68YU07tgxfz8zJTIxr4BpsezN49Ffwy9j3ZpwwJp4fkRwjRzq3uWE6Rg== + utils-merge@1.0.1, utils-merge@1.x.x: version "1.0.1" resolved "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" @@ -26809,6 +27820,11 @@ winston@^3.2.1: triple-beam "^1.3.0" winston-transport "^4.3.0" +wolfy87-eventemitter@~5.2.8: + version "5.2.9" + resolved "https://registry.npmjs.org/wolfy87-eventemitter/-/wolfy87-eventemitter-5.2.9.tgz#e879f770b30fbb6512a8afbb330c388591099c2a" + integrity sha512-P+6vtWyuDw+MB01X7UeF8TaHBvbCovf4HPEMF/SV7BdDc1SMTiBy13SRD71lQh4ExFTG1d/WNzDGDCyOKSMblw== + word-wrap@^1.2.3, word-wrap@~1.2.3: version "1.2.3" resolved "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" @@ -27268,6 +28284,11 @@ z-schema@~3.18.3: optionalDependencies: commander "^2.7.1" +zalgo-promise@^1, zalgo-promise@^1.0.11, zalgo-promise@^1.0.26: + version "1.0.46" + resolved "https://registry.npmjs.org/zalgo-promise/-/zalgo-promise-1.0.46.tgz#325988d75d0be4cd63a266bad5e18f8f6cd85675" + integrity sha512-tzPpQRqaQQavxl17TY98nznvmr+judUg3My7ugsUcRDbdqisYOE2z79HNNDgXnyX3eA0mf2bMOJrqHptt00npg== + zen-observable-ts@^0.8.21: version "0.8.21" resolved "https://registry.npmjs.org/zen-observable-ts/-/zen-observable-ts-0.8.21.tgz#85d0031fbbde1eba3cd07d3ba90da241215f421d" @@ -27313,6 +28334,11 @@ zombie@^6.1.4: tough-cookie "^2.3.4" ws "^6.1.2" +zustand@^3.3.3: + version "3.4.2" + resolved "https://registry.npmjs.org/zustand/-/zustand-3.4.2.tgz#22f0e0503a364672c6e3bb83399e69479bcea9b2" + integrity sha512-/v0RRbzi8NNyiXf7vw2eizPfJaTlTbXNM3fjQ6xF+qr5Xc0cF0ypaa0ARLOvyaKsGx/q2p5azVhfGxl4uHK0Ag== + zwitch@^1.0.0: version "1.0.5" resolved "https://registry.npmjs.org/zwitch/-/zwitch-1.0.5.tgz#d11d7381ffed16b742f6af7b3f223d5cd9fe9920" From 4075c63675b7b9ec530d796ec8ecfa26108fc342 Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Sat, 24 Apr 2021 07:56:47 +0200 Subject: [PATCH 231/485] fix: optional git config for techdocs feedback Signed-off-by: Erik Larsson --- .changeset/ten-cups-relax.md | 5 +++++ .../src/reader/transformers/addGitFeedbackLink.ts | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 .changeset/ten-cups-relax.md diff --git a/.changeset/ten-cups-relax.md b/.changeset/ten-cups-relax.md new file mode 100644 index 0000000000..9e32ad3856 --- /dev/null +++ b/.changeset/ten-cups-relax.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-techdocs': patch +--- + +Make git config optional for techdocs feedback links diff --git a/plugins/techdocs/src/reader/transformers/addGitFeedbackLink.ts b/plugins/techdocs/src/reader/transformers/addGitFeedbackLink.ts index d19d90228c..c74f06934d 100644 --- a/plugins/techdocs/src/reader/transformers/addGitFeedbackLink.ts +++ b/plugins/techdocs/src/reader/transformers/addGitFeedbackLink.ts @@ -35,20 +35,20 @@ export const addGitFeedbackLink = (configApi: any): Transformer => { const sourceURL = new URL(sourceAnchor.href); const githubHosts = configApi - .getConfigArray('integrations.github') - .map((integration: any) => integration.data.host); + .getOptionalConfigArray('integrations.github') + ?.map((integration: any) => integration.data.host); const gitlabHosts = configApi - .getConfigArray('integrations.gitlab') - .map((integration: any) => integration.data.host); + .getOptionalConfigArray('integrations.gitlab') + ?.map((integration: any) => integration.data.host); // don't show if can't identify edit link hostname as a gitlab/github hosting if ( - githubHosts.includes(sourceURL.hostname) || + githubHosts?.includes(sourceURL.hostname) || sourceURL.origin.includes('github') ) { gitHost = 'github'; } else if ( - gitlabHosts.includes(sourceURL.hostname) || + gitlabHosts?.includes(sourceURL.hostname) || sourceURL.origin.includes('gitlab') ) { gitHost = 'gitlab'; From b61b268fd00d8f49ff9e2042cacd0cac8d480482 Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Sat, 24 Apr 2021 15:41:29 +0200 Subject: [PATCH 232/485] Update tests Signed-off-by: Erik Larsson --- .../src/reader/transformers/addGitFeedbackLink.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/techdocs/src/reader/transformers/addGitFeedbackLink.test.ts b/plugins/techdocs/src/reader/transformers/addGitFeedbackLink.test.ts index 4c9ea04fe9..5d88aab62e 100644 --- a/plugins/techdocs/src/reader/transformers/addGitFeedbackLink.test.ts +++ b/plugins/techdocs/src/reader/transformers/addGitFeedbackLink.test.ts @@ -18,10 +18,10 @@ import { createTestShadowDom } from '../../test-utils'; import { addGitFeedbackLink } from './addGitFeedbackLink'; const configApi = { - getConfigArray: function getConfigArray(key: string) { + getOptionalConfigArray: function getOptionalConfigArray(key: string) { return key === 'integrations.github' ? [{ data: { host: 'self-hosted-git-hub-provider.com' } }] - : []; + : undefined; }, }; From b9abc32f4928742b250e77d8d9a830037027cac5 Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Wed, 28 Apr 2021 23:41:52 +0200 Subject: [PATCH 233/485] Use ScmIntegrationsApi Signed-off-by: Erik Larsson --- plugins/techdocs/package.json | 2 ++ plugins/techdocs/src/plugin.ts | 24 +++++++---------- .../src/reader/components/Reader.test.tsx | 11 ++++++++ .../techdocs/src/reader/components/Reader.tsx | 9 ++++--- .../reader/components/TechDocsPage.test.tsx | 11 ++++++++ .../transformers/addGitFeedbackLink.test.ts | 26 ++++++++++--------- .../reader/transformers/addGitFeedbackLink.ts | 19 +++++--------- 7 files changed, 59 insertions(+), 43 deletions(-) diff --git a/plugins/techdocs/package.json b/plugins/techdocs/package.json index 632feac3c1..55e5dadb54 100644 --- a/plugins/techdocs/package.json +++ b/plugins/techdocs/package.json @@ -34,6 +34,8 @@ "@backstage/config": "^0.1.4", "@backstage/catalog-model": "^0.7.7", "@backstage/core": "^0.7.7", + "@backstage/integration": "^0.5.0", + "@backstage/integration-react": "^0.1.1", "@backstage/plugin-catalog-react": "^0.1.4", "@backstage/theme": "^0.2.6", "@backstage/errors": "^0.1.1", diff --git a/plugins/techdocs/src/plugin.ts b/plugins/techdocs/src/plugin.ts index 97dd6f2150..bbd0b77ba9 100644 --- a/plugins/techdocs/src/plugin.ts +++ b/plugins/techdocs/src/plugin.ts @@ -13,21 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * Copyright 2020 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 { configApiRef, @@ -39,6 +24,10 @@ import { discoveryApiRef, identityApiRef, } from '@backstage/core'; +import { + ScmIntegrationsApi, + scmIntegrationsApiRef, +} from '@backstage/integration-react'; import { techdocsApiRef, techdocsStorageApiRef } from './api'; import { TechDocsClient, TechDocsStorageClient } from './client'; @@ -60,6 +49,11 @@ export const rootCatalogDocsRouteRef = createRouteRef({ export const techdocsPlugin = createPlugin({ id: 'techdocs', apis: [ + createApiFactory({ + api: scmIntegrationsApiRef, + deps: { configApi: configApiRef }, + factory: ({ configApi }) => ScmIntegrationsApi.fromConfig(configApi), + }), createApiFactory({ api: techdocsStorageApiRef, deps: { diff --git a/plugins/techdocs/src/reader/components/Reader.test.tsx b/plugins/techdocs/src/reader/components/Reader.test.tsx index b39134b0cd..fbdac95658 100644 --- a/plugins/techdocs/src/reader/components/Reader.test.tsx +++ b/plugins/techdocs/src/reader/components/Reader.test.tsx @@ -14,7 +14,12 @@ * limitations under the License. */ +import { ConfigReader } from '@backstage/config'; import { ApiProvider, ApiRegistry } from '@backstage/core'; +import { + ScmIntegrationsApi, + scmIntegrationsApiRef, +} from '@backstage/integration-react'; import { wrapInTestApp } from '@backstage/test-utils'; import { act, render } from '@testing-library/react'; import React from 'react'; @@ -39,9 +44,15 @@ describe('', () => { entityId: 'Component::backstage', }); + const scmIntegrationsApi: ScmIntegrationsApi = ScmIntegrationsApi.fromConfig( + new ConfigReader({ + integrations: {}, + }), + ); const techdocsStorageApi: Partial = {}; const apiRegistry = ApiRegistry.from([ + [scmIntegrationsApiRef, scmIntegrationsApi], [techdocsStorageApiRef, techdocsStorageApi], ]); diff --git a/plugins/techdocs/src/reader/components/Reader.tsx b/plugins/techdocs/src/reader/components/Reader.tsx index b16a566afa..82b5245cfa 100644 --- a/plugins/techdocs/src/reader/components/Reader.tsx +++ b/plugins/techdocs/src/reader/components/Reader.tsx @@ -14,7 +14,8 @@ * limitations under the License. */ import { EntityName } from '@backstage/catalog-model'; -import { configApiRef, useApi } from '@backstage/core'; +import { useApi } from '@backstage/core'; +import { scmIntegrationsApiRef } from '@backstage/integration-react'; import { BackstageTheme } from '@backstage/theme'; import { useTheme } from '@material-ui/core'; import { Alert } from '@material-ui/lab'; @@ -54,7 +55,7 @@ export const Reader = ({ entityId, onReady }: Props) => { const [loadedPath, setLoadedPath] = useState(''); const [atInitialLoad, setAtInitialLoad] = useState(true); const [newerDocsExist, setNewerDocsExist] = useState(false); - const configApi = useApi(configApiRef); + const scmIntegrationsApi = useApi(scmIntegrationsApiRef); const { value: isSynced, @@ -145,7 +146,7 @@ export const Reader = ({ entityId, onReady }: Props) => { rewriteDocLinks(), removeMkdocsHeader(), simplifyMkdocsFooter(), - addGitFeedbackLink(configApi), + addGitFeedbackLink(scmIntegrationsApi), injectCss({ css: ` body { @@ -327,7 +328,7 @@ export const Reader = ({ entityId, onReady }: Props) => { theme.palette.background.default, newerDocsExist, isSynced, - configApi, + scmIntegrationsApi, ]); // docLoadError not considered an error state if sync request is still ongoing diff --git a/plugins/techdocs/src/reader/components/TechDocsPage.test.tsx b/plugins/techdocs/src/reader/components/TechDocsPage.test.tsx index 52ddd3794e..5b638ff668 100644 --- a/plugins/techdocs/src/reader/components/TechDocsPage.test.tsx +++ b/plugins/techdocs/src/reader/components/TechDocsPage.test.tsx @@ -16,6 +16,11 @@ import React from 'react'; import { TechDocsPage } from './TechDocsPage'; import { render, act } from '@testing-library/react'; +import { ConfigReader } from '@backstage/config'; +import { + ScmIntegrationsApi, + scmIntegrationsApiRef, +} from '@backstage/integration-react'; import { wrapInTestApp } from '@backstage/test-utils'; import { ApiRegistry, ApiProvider } from '@backstage/core'; import { @@ -50,6 +55,11 @@ describe('', () => { entityId: 'Component::backstage', }); + const scmIntegrationsApi: ScmIntegrationsApi = ScmIntegrationsApi.fromConfig( + new ConfigReader({ + integrations: {}, + }), + ); const techdocsApi: Partial = { getEntityMetadata: () => Promise.resolve({ @@ -72,6 +82,7 @@ describe('', () => { }; const apiRegistry = ApiRegistry.from([ + [scmIntegrationsApiRef, scmIntegrationsApi], [techdocsApiRef, techdocsApi], [techdocsStorageApiRef, techdocsStorageApi], ]); diff --git a/plugins/techdocs/src/reader/transformers/addGitFeedbackLink.test.ts b/plugins/techdocs/src/reader/transformers/addGitFeedbackLink.test.ts index 5d88aab62e..1b53b0141e 100644 --- a/plugins/techdocs/src/reader/transformers/addGitFeedbackLink.test.ts +++ b/plugins/techdocs/src/reader/transformers/addGitFeedbackLink.test.ts @@ -14,16 +14,18 @@ * limitations under the License. */ +import { ConfigReader } from '@backstage/config'; +import { ScmIntegrations } from '@backstage/integration'; import { createTestShadowDom } from '../../test-utils'; import { addGitFeedbackLink } from './addGitFeedbackLink'; -const configApi = { - getOptionalConfigArray: function getOptionalConfigArray(key: string) { - return key === 'integrations.github' - ? [{ data: { host: 'self-hosted-git-hub-provider.com' } }] - : undefined; - }, -}; +const integrations = ScmIntegrations.fromConfig( + new ConfigReader({ + integrations: { + github: [{ host: 'self-hosted-git-hub-provider.com' }], + }, + }), +); describe('addGitFeedbackLink', () => { it('adds a feedback link when a Gitlab source edit link is available', () => { @@ -38,7 +40,7 @@ describe('addGitFeedbackLink', () => { `, { - preTransformers: [addGitFeedbackLink(configApi)], + preTransformers: [addGitFeedbackLink(integrations)], postTransformers: [], }, ); @@ -63,7 +65,7 @@ describe('addGitFeedbackLink', () => { `, { - preTransformers: [addGitFeedbackLink(configApi)], + preTransformers: [addGitFeedbackLink(integrations)], postTransformers: [], }, ); @@ -87,7 +89,7 @@ describe('addGitFeedbackLink', () => { `, { - preTransformers: [addGitFeedbackLink(configApi)], + preTransformers: [addGitFeedbackLink(integrations)], postTransformers: [], }, ); @@ -107,7 +109,7 @@ describe('addGitFeedbackLink', () => { `, { - preTransformers: [addGitFeedbackLink(configApi)], + preTransformers: [addGitFeedbackLink(integrations)], postTransformers: [], }, ); @@ -127,7 +129,7 @@ describe('addGitFeedbackLink', () => { `, { - preTransformers: [addGitFeedbackLink(configApi)], + preTransformers: [addGitFeedbackLink(integrations)], postTransformers: [], }, ); diff --git a/plugins/techdocs/src/reader/transformers/addGitFeedbackLink.ts b/plugins/techdocs/src/reader/transformers/addGitFeedbackLink.ts index c74f06934d..5d45946238 100644 --- a/plugins/techdocs/src/reader/transformers/addGitFeedbackLink.ts +++ b/plugins/techdocs/src/reader/transformers/addGitFeedbackLink.ts @@ -15,12 +15,15 @@ */ import type { Transformer } from './index'; +import { ScmIntegrationRegistry } from '@backstage/integration'; import FeedbackOutlinedIcon from '@material-ui/icons/FeedbackOutlined'; import React from 'react'; import ReactDOM from 'react-dom'; // requires repo -export const addGitFeedbackLink = (configApi: any): Transformer => { +export const addGitFeedbackLink = ( + scmIntegrationsApi: ScmIntegrationRegistry, +): Transformer => { return dom => { // attempting to use selectors that are more likely to be static as MkDocs updates over time const sourceAnchor = dom.querySelector( @@ -34,21 +37,13 @@ export const addGitFeedbackLink = (configApi: any): Transformer => { let gitHost = ''; const sourceURL = new URL(sourceAnchor.href); - const githubHosts = configApi - .getOptionalConfigArray('integrations.github') - ?.map((integration: any) => integration.data.host); - const gitlabHosts = configApi - .getOptionalConfigArray('integrations.gitlab') - ?.map((integration: any) => integration.data.host); + const integration = scmIntegrationsApi.byUrl(sourceURL); // don't show if can't identify edit link hostname as a gitlab/github hosting - if ( - githubHosts?.includes(sourceURL.hostname) || - sourceURL.origin.includes('github') - ) { + if (integration?.type === 'github' || sourceURL.origin.includes('github')) { gitHost = 'github'; } else if ( - gitlabHosts?.includes(sourceURL.hostname) || + integration?.type === 'gitlab' || sourceURL.origin.includes('gitlab') ) { gitHost = 'gitlab'; From 5f1f40a65c28c9d3d5168cd312964ce39c94864f Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Thu, 29 Apr 2021 10:33:26 +0200 Subject: [PATCH 234/485] Remove incorreect api factory creation Signed-off-by: Erik Larsson --- plugins/techdocs/src/plugin.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/plugins/techdocs/src/plugin.ts b/plugins/techdocs/src/plugin.ts index bbd0b77ba9..202d49373c 100644 --- a/plugins/techdocs/src/plugin.ts +++ b/plugins/techdocs/src/plugin.ts @@ -49,11 +49,6 @@ export const rootCatalogDocsRouteRef = createRouteRef({ export const techdocsPlugin = createPlugin({ id: 'techdocs', apis: [ - createApiFactory({ - api: scmIntegrationsApiRef, - deps: { configApi: configApiRef }, - factory: ({ configApi }) => ScmIntegrationsApi.fromConfig(configApi), - }), createApiFactory({ api: techdocsStorageApiRef, deps: { From 6381b7ec87b5f70f9dc1d3b7a618285a9cb43113 Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Thu, 29 Apr 2021 17:13:43 +0200 Subject: [PATCH 235/485] tsc Signed-off-by: Erik Larsson --- plugins/techdocs/src/plugin.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/plugins/techdocs/src/plugin.ts b/plugins/techdocs/src/plugin.ts index 202d49373c..e25f245fb4 100644 --- a/plugins/techdocs/src/plugin.ts +++ b/plugins/techdocs/src/plugin.ts @@ -24,10 +24,6 @@ import { discoveryApiRef, identityApiRef, } from '@backstage/core'; -import { - ScmIntegrationsApi, - scmIntegrationsApiRef, -} from '@backstage/integration-react'; import { techdocsApiRef, techdocsStorageApiRef } from './api'; import { TechDocsClient, TechDocsStorageClient } from './client'; From 4e6168da41070c0f58d2f7bf95ed7a433a6e5f52 Mon Sep 17 00:00:00 2001 From: Will Sewell Date: Thu, 29 Apr 2021 16:16:24 +0100 Subject: [PATCH 236/485] Update public API docs Result of running `yarn build:api-reports`. Signed-off-by: Will Sewell --- packages/catalog-client/api-report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/catalog-client/api-report.md b/packages/catalog-client/api-report.md index a17a6cdc10..4b489ff2e4 100644 --- a/packages/catalog-client/api-report.md +++ b/packages/catalog-client/api-report.md @@ -67,7 +67,7 @@ export class CatalogClient implements CatalogApi { // @public (undocumented) export type CatalogEntitiesRequest = { - filter?: Record | undefined; + filter?: Record[] | Record | undefined; fields?: string[] | undefined; }; From 37dc8d6e9c5dcdbe1b08b358b862e89fb84cddda Mon Sep 17 00:00:00 2001 From: Juan Lulkin Date: Thu, 29 Apr 2021 14:26:11 +0200 Subject: [PATCH 237/485] kubernetes-backend: Adds skipTLSVerify to ClusterDetails Signed-off-by: Juan Lulkin --- plugins/kubernetes-backend/src/types/types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/kubernetes-backend/src/types/types.ts b/plugins/kubernetes-backend/src/types/types.ts index 344e265426..d61c35e167 100644 --- a/plugins/kubernetes-backend/src/types/types.ts +++ b/plugins/kubernetes-backend/src/types/types.ts @@ -127,4 +127,5 @@ export interface ClusterDetails { url: string; authProvider: string; serviceAccountToken?: string | undefined; + skipTLSVerify?: boolean; } From e6715553b305fff00497be9e72c0aeb66c97d67a Mon Sep 17 00:00:00 2001 From: Juan Lulkin Date: Thu, 29 Apr 2021 17:32:59 +0200 Subject: [PATCH 238/485] kubernetes-backend: Use imports directly from common Signed-off-by: Juan Lulkin --- .../GoogleKubernetesAuthTranslator.ts | 3 ++- .../ServiceAccountKubernetesAuthTranslator.ts | 3 ++- .../src/kubernetes-auth-translator/types.ts | 3 ++- .../src/service/KubernetesFanOutHandler.ts | 2 +- .../src/service/KubernetesFetcher.ts | 8 +++++--- plugins/kubernetes-backend/src/service/router.ts | 2 +- plugins/kubernetes-backend/src/types/types.ts | 12 ++---------- 7 files changed, 15 insertions(+), 18 deletions(-) diff --git a/plugins/kubernetes-backend/src/kubernetes-auth-translator/GoogleKubernetesAuthTranslator.ts b/plugins/kubernetes-backend/src/kubernetes-auth-translator/GoogleKubernetesAuthTranslator.ts index 0dd2a4bcc2..9dc4519966 100644 --- a/plugins/kubernetes-backend/src/kubernetes-auth-translator/GoogleKubernetesAuthTranslator.ts +++ b/plugins/kubernetes-backend/src/kubernetes-auth-translator/GoogleKubernetesAuthTranslator.ts @@ -15,7 +15,8 @@ */ import { KubernetesAuthTranslator } from './types'; -import { KubernetesRequestBody, ClusterDetails } from '../types/types'; +import { ClusterDetails } from '../types/types'; +import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common'; export class GoogleKubernetesAuthTranslator implements KubernetesAuthTranslator { diff --git a/plugins/kubernetes-backend/src/kubernetes-auth-translator/ServiceAccountKubernetesAuthTranslator.ts b/plugins/kubernetes-backend/src/kubernetes-auth-translator/ServiceAccountKubernetesAuthTranslator.ts index 6433e41546..3610bd4d9f 100644 --- a/plugins/kubernetes-backend/src/kubernetes-auth-translator/ServiceAccountKubernetesAuthTranslator.ts +++ b/plugins/kubernetes-backend/src/kubernetes-auth-translator/ServiceAccountKubernetesAuthTranslator.ts @@ -15,7 +15,8 @@ */ import { KubernetesAuthTranslator } from './types'; -import { KubernetesRequestBody, ClusterDetails } from '../types/types'; +import { ClusterDetails } from '../types/types'; +import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common'; export class ServiceAccountKubernetesAuthTranslator implements KubernetesAuthTranslator { diff --git a/plugins/kubernetes-backend/src/kubernetes-auth-translator/types.ts b/plugins/kubernetes-backend/src/kubernetes-auth-translator/types.ts index c01a57889c..7a04e230c6 100644 --- a/plugins/kubernetes-backend/src/kubernetes-auth-translator/types.ts +++ b/plugins/kubernetes-backend/src/kubernetes-auth-translator/types.ts @@ -14,7 +14,8 @@ * limitations under the License. */ -import { KubernetesRequestBody, ClusterDetails } from '../types/types'; +import { ClusterDetails } from '../types/types'; +import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common'; export interface KubernetesAuthTranslator { decorateClusterDetailsWithAuth( diff --git a/plugins/kubernetes-backend/src/service/KubernetesFanOutHandler.ts b/plugins/kubernetes-backend/src/service/KubernetesFanOutHandler.ts index 6db6e2ad4a..75e2f8233c 100644 --- a/plugins/kubernetes-backend/src/service/KubernetesFanOutHandler.ts +++ b/plugins/kubernetes-backend/src/service/KubernetesFanOutHandler.ts @@ -20,9 +20,9 @@ import { CustomResource, KubernetesFetcher, KubernetesObjectTypes, - KubernetesRequestBody, KubernetesServiceLocator, } from '../types/types'; +import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common'; import { KubernetesAuthTranslator } from '../kubernetes-auth-translator/types'; import { KubernetesAuthTranslatorGenerator } from '../kubernetes-auth-translator/KubernetesAuthTranslatorGenerator'; diff --git a/plugins/kubernetes-backend/src/service/KubernetesFetcher.ts b/plugins/kubernetes-backend/src/service/KubernetesFetcher.ts index 10e5640bab..6958bd3387 100644 --- a/plugins/kubernetes-backend/src/service/KubernetesFetcher.ts +++ b/plugins/kubernetes-backend/src/service/KubernetesFetcher.ts @@ -32,15 +32,17 @@ import lodash, { Dictionary } from 'lodash'; import { Logger } from 'winston'; import { ClusterDetails, - FetchResponse, FetchResponseWrapper, - KubernetesErrorTypes, KubernetesFetcher, - KubernetesFetchError, KubernetesObjectTypes, ObjectFetchParams, CustomResource, } from '../types/types'; +import { + FetchResponse, + KubernetesFetchError, + KubernetesErrorTypes, +} from '@backstage/plugin-kubernetes-common'; import { KubernetesClientProvider } from './KubernetesClientProvider'; export interface Clients { diff --git a/plugins/kubernetes-backend/src/service/router.ts b/plugins/kubernetes-backend/src/service/router.ts index 189f2eb9c5..ab7bb5befa 100644 --- a/plugins/kubernetes-backend/src/service/router.ts +++ b/plugins/kubernetes-backend/src/service/router.ts @@ -23,11 +23,11 @@ import { MultiTenantServiceLocator } from '../service-locator/MultiTenantService import { ClusterDetails, KubernetesClustersSupplier, - KubernetesRequestBody, KubernetesServiceLocator, ServiceLocatorMethod, CustomResource, } from '../types/types'; +import { KubernetesRequestBody } from '@backstage/plugin-kubernetes-common'; import { KubernetesClientProvider } from './KubernetesClientProvider'; import { KubernetesFanOutHandler } from './KubernetesFanOutHandler'; import { KubernetesClientBasedFetcher } from './KubernetesFetcher'; diff --git a/plugins/kubernetes-backend/src/types/types.ts b/plugins/kubernetes-backend/src/types/types.ts index d61c35e167..0be0b447af 100644 --- a/plugins/kubernetes-backend/src/types/types.ts +++ b/plugins/kubernetes-backend/src/types/types.ts @@ -15,18 +15,10 @@ */ import type { - FetchResponse as FetchResponseCommon, - KubernetesFetchError as KubernetesFetchErrorCommon, + FetchResponse, + KubernetesFetchError, } from '@backstage/plugin-kubernetes-common'; -export type { - KubernetesErrorTypes, - KubernetesRequestBody, -} from '@backstage/plugin-kubernetes-common'; - -export type KubernetesFetchError = KubernetesFetchErrorCommon; -export type FetchResponse = FetchResponseCommon; - export type ClusterLocatorMethod = | ConfigClusterLocatorMethod | GKEClusterLocatorMethod; From 5550c49028c945bd7320d6bc1ac3bf26c2ec4155 Mon Sep 17 00:00:00 2001 From: Juan Lulkin Date: Thu, 29 Apr 2021 17:33:42 +0200 Subject: [PATCH 239/485] plugin-kubernetes: Fixes common lib name Signed-off-by: Juan Lulkin --- .changeset/silly-tables-build.md | 2 +- plugins/kubernetes/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.changeset/silly-tables-build.md b/.changeset/silly-tables-build.md index 3f7b3182dd..cb2fd73950 100644 --- a/.changeset/silly-tables-build.md +++ b/.changeset/silly-tables-build.md @@ -3,4 +3,4 @@ '@backstage/plugin-kubernetes-backend': patch --- -Adds @backstage/kubernetes-common library to share types between kubernetes frontend and backend. +Adds @backstage/plugin-kubernetes-common library to share types between kubernetes frontend and backend. diff --git a/plugins/kubernetes/package.json b/plugins/kubernetes/package.json index c808678922..d305ea4b4b 100644 --- a/plugins/kubernetes/package.json +++ b/plugins/kubernetes/package.json @@ -33,7 +33,7 @@ "@backstage/catalog-model": "^0.7.4", "@backstage/config": "^0.1.4", "@backstage/core": "^0.7.6", - "@backstage/kubernetes-common": "^0.1.0", + "@backstage/plugin-kubernetes-common": "^0.1.0", "@backstage/plugin-catalog-react": "^0.1.3", "@backstage/theme": "^0.2.6", "@kubernetes/client-node": "^0.14.0", From e892b22c7c89f7d05e82dcb0145e438fc3d4c725 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 29 Apr 2021 17:55:08 +0200 Subject: [PATCH 240/485] Handle both tag and commit objects in Stats Signed-off-by: Erik Engervall --- .../src/api/GitReleaseApiClient.ts | 19 ++- .../helpers/getReleaseCommitPairs.test.tsx | 44 ++++-- .../Info/helpers/getReleaseCommitPairs.tsx | 21 +-- .../Stats/Info/hooks/useGetReleaseTimes.tsx | 38 +++-- .../Stats/Row/RowCollapsed/ReleaseTime.tsx | 58 ++++--- .../Stats/contexts/ReleaseStatsContext.tsx | 14 +- .../Stats/helpers/getReleaseStats.test.tsx | 33 ++-- .../src/features/Stats/helpers/getTagDate.ts | 40 ----- .../src/features/Stats/helpers/getTagDates.ts | 143 ++++++++++++++++++ .../src/features/Stats/hooks/useGetCommit.ts | 43 ------ .../src/features/Stats/hooks/useGetTagDate.ts | 46 ------ .../src/test-helpers/stats.ts | 21 ++- .../src/test-helpers/test-helpers.ts | 8 +- 13 files changed, 295 insertions(+), 233 deletions(-) delete mode 100644 plugins/git-release-manager/src/features/Stats/helpers/getTagDate.ts create mode 100644 plugins/git-release-manager/src/features/Stats/helpers/getTagDates.ts delete mode 100644 plugins/git-release-manager/src/features/Stats/hooks/useGetCommit.ts delete mode 100644 plugins/git-release-manager/src/features/Stats/hooks/useGetTagDate.ts diff --git a/plugins/git-release-manager/src/api/GitReleaseApiClient.ts b/plugins/git-release-manager/src/api/GitReleaseApiClient.ts index 44816e860b..0268ccf0fe 100644 --- a/plugins/git-release-manager/src/api/GitReleaseApiClient.ts +++ b/plugins/git-release-manager/src/api/GitReleaseApiClient.ts @@ -492,17 +492,21 @@ ${selectedPatchCommit.commit.message}`, getAllTags: async ({ owner, repo }) => { const { octokit } = await this.getOctokit(); - const tags = await octokit.paginate(octokit.repos.listTags, { + const tags = await octokit.paginate(octokit.git.listMatchingRefs, { owner, repo, + ref: 'tags', per_page: 100, ...DISABLE_CACHE, }); - return tags.map(tag => ({ - tagName: tag.name, - sha: tag.commit.sha, - })); + return tags + .map(tag => ({ + tagName: tag.ref.replace('refs/tags/', ''), + tagSha: tag.object.sha, + tagType: tag.object.type as 'tag' | 'commit', + })) + .reverse(); }, getAllReleases: async ({ owner, repo }) => { @@ -536,6 +540,7 @@ ${selectedPatchCommit.commit.message}`, date: singleTag.data.tagger.date, username: singleTag.data.tagger.name, userEmail: singleTag.data.tagger.email, + objectSha: singleTag.data.object.sha, }; }, }; @@ -780,7 +785,8 @@ export interface GitReleaseApi { ) => Promise< Array<{ tagName: string; - sha: string; + tagSha: string; + tagType: 'tag' | 'commit'; }> >; @@ -804,6 +810,7 @@ export interface GitReleaseApi { date: string; username: string; userEmail: string; + objectSha: string; }>; }; } diff --git a/plugins/git-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.test.tsx b/plugins/git-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.test.tsx index 3d9fb9449c..2e7f24c194 100644 --- a/plugins/git-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.test.tsx +++ b/plugins/git-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.test.tsx @@ -25,11 +25,13 @@ describe('getReleaseCommitPairs', () => { candidates: [ { tagName: 'rc-1.0.0', - sha: 'sha-1.0.0', + tagSha: 'sha-1.0.0', + tagType: 'tag' as const, }, { tagName: 'rc-1.0.1', - sha: 'sha-1.0.1', + tagSha: 'sha-1.0.1', + tagType: 'tag' as const, }, ], versions: [], @@ -42,13 +44,15 @@ describe('getReleaseCommitPairs', () => { candidates: [ { tagName: 'rc-2.0.0', - sha: 'sha-2.0.0', + tagSha: 'sha-2.0.0', + tagType: 'tag' as const, }, ], versions: [ { tagName: 'version-2.0.0', - sha: 'sha-2.0.0', + tagSha: 'sha-2.0.0', + tagType: 'tag' as const, }, ], }; @@ -60,17 +64,20 @@ describe('getReleaseCommitPairs', () => { candidates: [ { tagName: 'rc-3.0.1', - sha: 'sha-3.0.1', + tagSha: 'sha-3.0.1', + tagType: 'tag' as const, }, { tagName: 'rc-3.0.0', - sha: 'sha-3.0.0', + tagSha: 'sha-3.0.0', + tagType: 'tag' as const, }, ], versions: [ { tagName: 'version-3.0.1', - sha: 'sha-3.0.1', + tagSha: 'sha-3.0.1', + tagType: 'tag' as const, }, ], }; @@ -92,14 +99,29 @@ describe('getReleaseCommitPairs', () => { Object { "releaseCommitPairs": Array [ Object { - "baseVersion": "3.0", + "baseVersion": "2.0", "endCommit": Object { - "sha": "sha-3.0.1", - "tagName": "version-3.0.1", + "tagName": "version-2.0.0", + "tagSha": "sha-2.0.0", + "tagType": "tag", + }, + "startCommit": Object { + "tagName": "rc-2.0.0", + "tagSha": "sha-2.0.0", + "tagType": "tag", + }, + }, + Object { + "baseVersion": "3.0", + "endCommit": Object { + "tagName": "version-3.0.1", + "tagSha": "sha-3.0.1", + "tagType": "tag", }, "startCommit": Object { - "sha": "sha-3.0.0", "tagName": "rc-3.0.0", + "tagSha": "sha-3.0.0", + "tagType": "tag", }, }, ], diff --git a/plugins/git-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.tsx b/plugins/git-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.tsx index e55d97078e..ae54a678d3 100644 --- a/plugins/git-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.tsx +++ b/plugins/git-release-manager/src/features/Stats/Info/helpers/getReleaseCommitPairs.tsx @@ -28,32 +28,19 @@ export function getReleaseCommitPairs({ const endTag = release.versions[0]; // Missing Release Candidate for unknown reason - if (!startTag?.sha) { + if (!startTag) { return acc; } // Missing Release Version (likely prerelease) - if (!endTag?.sha) { - return acc; - } - - // First RC tag is pointing towards the same commit as the most - // recent Version tag, meaning there haven't been any patches - // and we thus cannot determine and difference in time - if (startTag?.sha === endTag?.sha) { + if (!endTag) { return acc; } return acc.concat({ baseVersion: release.baseVersion, - startCommit: { - tagName: startTag.tagName, - sha: startTag.sha, - }, - endCommit: { - tagName: endTag.tagName, - sha: endTag.sha, - }, + startCommit: { ...startTag }, + endCommit: { ...endTag }, }); }, [], diff --git a/plugins/git-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx b/plugins/git-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx index 59ae036405..3d1d5c5bb4 100644 --- a/plugins/git-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx +++ b/plugins/git-release-manager/src/features/Stats/Info/hooks/useGetReleaseTimes.tsx @@ -20,20 +20,22 @@ import { DateTime } from 'luxon'; import { useApi } from '@backstage/core'; import { getReleaseCommitPairs } from '../helpers/getReleaseCommitPairs'; -import { getTagDate } from '../../helpers/getTagDate'; import { gitReleaseManagerApiRef } from '../../../../api/serviceApiRef'; import { useProjectContext } from '../../../../contexts/ProjectContext'; import { useReleaseStatsContext } from '../../contexts/ReleaseStatsContext'; +import { getTagDates } from '../../helpers/getTagDates'; export type ReleaseCommitPairs = Array<{ baseVersion: string; startCommit: { tagName: string; - sha: string; + tagSha: string; + tagType: 'tag' | 'commit'; }; endCommit: { tagName: string; - sha: string; + tagSha: string; + tagType: 'tag' | 'commit'; }; }>; @@ -56,17 +58,17 @@ export function useGetReleaseTimes() { const [progress, setProgress] = useState(0); const { releaseCommitPairs } = getReleaseCommitPairs({ releaseStats }); - const [fnRes, run] = useAsyncFn(() => { + const [releaseTimeResult, run] = useAsyncFn(() => { setProgress(0); - return getAndSetReleaseTime(0); + return getAndSetReleaseTime({ pairIndex: 0 }); }); useAsync(async () => { if (averageReleaseTime.length === 0) return; if (releaseCommitPairs.length === averageReleaseTime.length) return; - await getAndSetReleaseTime(averageReleaseTime.length); - }, [fnRes.value, averageReleaseTime]); + await getAndSetReleaseTime({ pairIndex: averageReleaseTime.length }); + }, [releaseTimeResult.value, averageReleaseTime]); useEffect(() => { const unboundedProgress = Math.round( @@ -77,16 +79,20 @@ export function useGetReleaseTimes() { setProgress(boundedProgress); }, [averageReleaseTime.length, releaseCommitPairs.length]); - async function getAndSetReleaseTime(index: number) { - const { baseVersion, startCommit, endCommit } = releaseCommitPairs[index]; + async function getAndSetReleaseTime({ pairIndex }: { pairIndex: number }) { + const { baseVersion, startCommit, endCommit } = releaseCommitPairs[ + pairIndex + ]; - const [ - { tagDate: startCommitCreatedAt }, - { tagDate: endCommitCreatedAt }, - ] = await Promise.all([ - getTagDate({ pluginApiClient, project, tagSha: startCommit.sha }), - getTagDate({ pluginApiClient, project, tagSha: endCommit.sha }), - ]); + const { + startDate: startCommitCreatedAt, + endDate: endCommitCreatedAt, + } = await getTagDates({ + pluginApiClient, + project, + startTag: startCommit, + endTag: endCommit, + }); const releaseTime: ReleaseTime = { version: baseVersion, diff --git a/plugins/git-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx b/plugins/git-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx index 7f19ec1df9..9094831b32 100644 --- a/plugins/git-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx +++ b/plugins/git-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx @@ -21,22 +21,31 @@ import { Alert } from '@material-ui/lab'; import { CenteredCircularProgress } from '../../../../components/CenteredCircularProgress'; import { ReleaseStats } from '../../contexts/ReleaseStatsContext'; -import { useGetCommit } from '../../hooks/useGetCommit'; +import { useAsync } from 'react-use'; +import { getTagDates } from '../../helpers/getTagDates'; +import { useProjectContext } from '../../../../contexts/ProjectContext'; +import { useApi } from '@backstage/core'; +import { gitReleaseManagerApiRef } from '../../../../api/serviceApiRef'; +import { getDecimalNumber } from '../../helpers/getDecimalNumber'; interface ReleaseTimeProps { releaseStat: ReleaseStats['releases']['0']; } export function ReleaseTime({ releaseStat }: ReleaseTimeProps) { - const firstCandidateSha = [...releaseStat.candidates].reverse()[0]?.sha; - const { commit: releaseCut } = useGetCommit({ ref: firstCandidateSha }); + const pluginApiClient = useApi(gitReleaseManagerApiRef); + const { project } = useProjectContext(); - const mostRecentVersionSha = releaseStat.versions[0]?.sha; - const { commit: releaseComplete } = useGetCommit({ - ref: mostRecentVersionSha, - }); + const releaseTimes = useAsync(() => + getTagDates({ + pluginApiClient, + project, + startTag: [...releaseStat.candidates].reverse()[0], + endTag: releaseStat.versions[0], + }), + ); - if (releaseCut.loading || releaseComplete.loading) { + if (releaseTimes.loading || releaseTimes.loading) { return ( @@ -44,19 +53,22 @@ export function ReleaseTime({ releaseStat }: ReleaseTimeProps) { ); } - if (releaseCut.error) { + if (releaseTimes.error) { return ( Failed to fetch the first Release Candidate commit ( - {releaseCut.error.message}) + {releaseTimes.error.message}) ); } - const diff = - releaseCut.value?.createdAt && releaseComplete.value?.createdAt - ? DateTime.fromISO(releaseComplete.value.createdAt) - .diff(DateTime.fromISO(releaseCut.value.createdAt), ['days', 'hours']) + const { days = 0, hours = 0 } = + releaseTimes.value?.startDate && releaseTimes.value?.endDate + ? DateTime.fromISO(releaseTimes.value.endDate) + .diff(DateTime.fromISO(releaseTimes.value.startDate), [ + 'days', + 'hours', + ]) .toObject() : { days: -1 }; @@ -71,8 +83,8 @@ export function ReleaseTime({ releaseStat }: ReleaseTimeProps) { > {releaseStat.versions.length === 0 ? '-' : 'Release completed '} - {releaseComplete.value?.createdAt && - DateTime.fromISO(releaseComplete.value.createdAt) + {releaseTimes.value?.endDate && + DateTime.fromISO(releaseTimes.value.endDate) .setLocale('sv-SE') .toFormat('yyyy-MM-dd')} @@ -85,11 +97,13 @@ export function ReleaseTime({ releaseStat }: ReleaseTimeProps) { alignItems: 'center', }} > - - {diff.days === -1 ? ( - <>Ongoing: {diff.days} days + + {days === -1 ? ( + <>Ongoing ) : ( - <>Completed in: {diff.days} days + <> + Completed in: {days} days {getDecimalNumber(hours, 1)} hours + )} @@ -103,8 +117,8 @@ export function ReleaseTime({ releaseStat }: ReleaseTimeProps) { > Release Candidate created{' '} - {releaseCut.value?.createdAt && - DateTime.fromISO(releaseCut.value.createdAt) + {releaseTimes.value?.startDate && + DateTime.fromISO(releaseTimes.value.startDate) .setLocale('sv-SE') .toFormat('yyyy-MM-dd')} diff --git a/plugins/git-release-manager/src/features/Stats/contexts/ReleaseStatsContext.tsx b/plugins/git-release-manager/src/features/Stats/contexts/ReleaseStatsContext.tsx index 452adbb87b..85f526b72e 100644 --- a/plugins/git-release-manager/src/features/Stats/contexts/ReleaseStatsContext.tsx +++ b/plugins/git-release-manager/src/features/Stats/contexts/ReleaseStatsContext.tsx @@ -27,21 +27,15 @@ export interface ReleaseStats { baseVersion: string; createdAt: string | null; htmlUrl: string; - - /** - * Ordered from new to old - */ candidates: { tagName: string; - sha: string; + tagSha: string; + tagType: 'tag' | 'commit'; }[]; - - /** - * Ordered from new to old - */ versions: { tagName: string; - sha: string; + tagSha: string; + tagType: 'tag' | 'commit'; }[]; }; }; diff --git a/plugins/git-release-manager/src/features/Stats/helpers/getReleaseStats.test.tsx b/plugins/git-release-manager/src/features/Stats/helpers/getReleaseStats.test.tsx index 6d0cb1ca3d..77e4fe8dc0 100644 --- a/plugins/git-release-manager/src/features/Stats/helpers/getReleaseStats.test.tsx +++ b/plugins/git-release-manager/src/features/Stats/helpers/getReleaseStats.test.tsx @@ -44,14 +44,18 @@ describe('getReleaseStats', () => { unmatchedTags: [], }, allTags: [ - { sha: 'sha', tagName: 'rc-1.0.0' }, - { sha: 'sha', tagName: 'rc-1.0.1' }, - { sha: 'sha', tagName: 'rc-1.0.2' }, - { sha: 'sha', tagName: 'version-1.0.2' }, - { sha: 'sha', tagName: 'rc-1.1.1' }, + { tagType: 'tag' as const, tagSha: 'sha', tagName: 'rc-1.0.0' }, + { tagType: 'tag' as const, tagSha: 'sha', tagName: 'rc-1.0.1' }, + { tagType: 'tag' as const, tagSha: 'sha', tagName: 'rc-1.0.2' }, + { tagType: 'tag' as const, tagSha: 'sha', tagName: 'version-1.0.2' }, + { tagType: 'tag' as const, tagSha: 'sha', tagName: 'rc-1.1.1' }, - { sha: 'unmatchable', tagName: 'rc-1/2/3' }, - { sha: 'unmappable', tagName: 'rc-123.123.123' }, + { tagType: 'tag' as const, tagSha: 'unmatchable', tagName: 'rc-1/2/3' }, + { + tagType: 'tag' as const, + tagSha: 'unmappable', + tagName: 'rc-123.123.123', + }, ], }); @@ -63,24 +67,28 @@ describe('getReleaseStats', () => { "baseVersion": "1.0", "candidates": Array [ Object { - "sha": "sha", "tagName": "rc-1.0.0", + "tagSha": "sha", + "tagType": "tag", }, Object { - "sha": "sha", "tagName": "rc-1.0.1", + "tagSha": "sha", + "tagType": "tag", }, Object { - "sha": "sha", "tagName": "rc-1.0.2", + "tagSha": "sha", + "tagType": "tag", }, ], "createdAt": "2021-01-01T10:11:12Z", "htmlUrl": "html_url", "versions": Array [ Object { - "sha": "sha", "tagName": "version-1.0.2", + "tagSha": "sha", + "tagType": "tag", }, ], }, @@ -88,8 +96,9 @@ describe('getReleaseStats', () => { "baseVersion": "1.1", "candidates": Array [ Object { - "sha": "sha", "tagName": "rc-1.1.1", + "tagSha": "sha", + "tagType": "tag", }, ], "createdAt": "2021-01-01T10:11:12Z", diff --git a/plugins/git-release-manager/src/features/Stats/helpers/getTagDate.ts b/plugins/git-release-manager/src/features/Stats/helpers/getTagDate.ts deleted file mode 100644 index 8c389e879c..0000000000 --- a/plugins/git-release-manager/src/features/Stats/helpers/getTagDate.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 { GitReleaseApi } from '../../../api/GitReleaseApiClient'; -import { Project } from '../../../contexts/ProjectContext'; - -interface GetTagDate { - pluginApiClient: GitReleaseApi; - project: Project; - tagSha: string; -} - -export const getTagDate = async ({ - pluginApiClient, - project, - tagSha, -}: GetTagDate) => { - const commitRes = await pluginApiClient.getCommit({ - owner: project.owner, - repo: project.repo, - ref: tagSha, - }); - - return { - tagDate: commitRes.createdAt, - }; -}; diff --git a/plugins/git-release-manager/src/features/Stats/helpers/getTagDates.ts b/plugins/git-release-manager/src/features/Stats/helpers/getTagDates.ts new file mode 100644 index 0000000000..08e10efafe --- /dev/null +++ b/plugins/git-release-manager/src/features/Stats/helpers/getTagDates.ts @@ -0,0 +1,143 @@ +/* + * 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 { GitReleaseApi } from '../../../api/GitReleaseApiClient'; +import { GitReleaseManagerError } from '../../../errors/GitReleaseManagerError'; +import { Project } from '../../../contexts/ProjectContext'; + +interface GetTagDates { + pluginApiClient: GitReleaseApi; + project: Project; + startTag: { + tagSha: string; + tagType: 'tag' | 'commit'; + }; + endTag: { + tagSha: string; + tagType: 'tag' | 'commit'; + }; +} + +export const getTagDates = async ({ + pluginApiClient, + project, + startTag, + endTag, +}: GetTagDates) => { + if (startTag.tagType === 'tag' && endTag.tagType === 'tag') { + const [{ date: startDate }, { date: endDate }] = await Promise.all([ + pluginApiClient.stats.getSingleTag({ + owner: project.owner, + repo: project.repo, + tagSha: startTag.tagSha, + }), + pluginApiClient.stats.getSingleTag({ + owner: project.owner, + repo: project.repo, + tagSha: endTag.tagSha, + }), + ]); + + return { + startDate, + endDate, + }; + } + + if (startTag.tagType === 'commit' && endTag.tagType === 'commit') { + const [ + { createdAt: startDate }, + { createdAt: endDate }, + ] = await Promise.all([ + pluginApiClient.getCommit({ + owner: project.owner, + repo: project.repo, + ref: startTag.tagSha, + }), + pluginApiClient.getCommit({ + owner: project.owner, + repo: project.repo, + ref: endTag.tagSha, + }), + ]); + + return { + startDate, + endDate, + }; + } + + if (startTag.tagType === 'tag' && endTag.tagType === 'commit') { + const [{ date: startDate }, { createdAt: endDate }] = await Promise.all([ + getCommitFromTag({ pluginApiClient, project, tag: startTag }), + pluginApiClient.getCommit({ + owner: project.owner, + repo: project.repo, + ref: endTag.tagSha, + }), + ]); + + return { + startDate, + endDate, + }; + } + + if (startTag.tagType === 'commit' && endTag.tagType === 'tag') { + const [{ createdAt: startDate }, { date: endDate }] = await Promise.all([ + pluginApiClient.getCommit({ + owner: project.owner, + repo: project.repo, + ref: startTag.tagSha, + }), + getCommitFromTag({ pluginApiClient, project, tag: endTag }), + ]); + + return { + startDate, + endDate, + }; + } + + throw new GitReleaseManagerError( + `Failed to get tag dates for tags with type "${startTag.tagType}" and "${endTag.tagType}"`, + ); +}; + +async function getCommitFromTag({ + pluginApiClient, + project, + tag, +}: { + pluginApiClient: GetTagDates['pluginApiClient']; + project: GetTagDates['project']; + tag: GetTagDates['startTag'] | GetTagDates['endTag']; +}) { + const singleTag = await pluginApiClient.stats.getSingleTag({ + owner: project.owner, + repo: project.repo, + tagSha: tag.tagSha, + }); + const startCommit = await pluginApiClient.getCommit({ + owner: project.owner, + repo: project.repo, + ref: singleTag.objectSha, + }); + + return { + date: startCommit.createdAt, + }; +} diff --git a/plugins/git-release-manager/src/features/Stats/hooks/useGetCommit.ts b/plugins/git-release-manager/src/features/Stats/hooks/useGetCommit.ts deleted file mode 100644 index 83c5324615..0000000000 --- a/plugins/git-release-manager/src/features/Stats/hooks/useGetCommit.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 { useAsync } from 'react-use'; -import { useApi } from '@backstage/core'; - -import { gitReleaseManagerApiRef } from '../../../api/serviceApiRef'; -import { GitReleaseManagerError } from '../../../errors/GitReleaseManagerError'; -import { useProjectContext } from '../../../contexts/ProjectContext'; - -export const useGetCommit = ({ ref }: { ref?: string }) => { - const pluginApiClient = useApi(gitReleaseManagerApiRef); - const { project } = useProjectContext(); - - const commit = useAsync(async () => { - if (!ref) { - throw new GitReleaseManagerError('Missing ref to get commit'); - } - - return pluginApiClient.getCommit({ - owner: project.owner, - repo: project.repo, - ref, - }); - }); - - return { - commit, - }; -}; diff --git a/plugins/git-release-manager/src/features/Stats/hooks/useGetTagDate.ts b/plugins/git-release-manager/src/features/Stats/hooks/useGetTagDate.ts deleted file mode 100644 index 028b3a1929..0000000000 --- a/plugins/git-release-manager/src/features/Stats/hooks/useGetTagDate.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 { useAsync } from 'react-use'; -import { useApi } from '@backstage/core'; - -import { getTagDate } from '../helpers/getTagDate'; -import { gitReleaseManagerApiRef } from '../../../api/serviceApiRef'; -import { GitReleaseManagerError } from '../../../errors/GitReleaseManagerError'; -import { ReleaseStats } from '../contexts/ReleaseStatsContext'; -import { UnboxArray } from '../../../types/helpers'; -import { useProjectContext } from '../../../contexts/ProjectContext'; - -export const useGetTagDate = ({ - tag, -}: { - tag: UnboxArray; -}) => { - const pluginApiClient = useApi(gitReleaseManagerApiRef); - const { project } = useProjectContext(); - - const tagDate = useAsync(async () => { - if (!tag) { - throw new GitReleaseManagerError('Missing tag details to get tag date'); - } - - return await getTagDate({ pluginApiClient, project, tagSha: tag.sha }); - }); - - return { - tagDate, - }; -}; diff --git a/plugins/git-release-manager/src/test-helpers/stats.ts b/plugins/git-release-manager/src/test-helpers/stats.ts index 22b3b83d1e..bd1a33f95a 100644 --- a/plugins/git-release-manager/src/test-helpers/stats.ts +++ b/plugins/git-release-manager/src/test-helpers/stats.ts @@ -25,11 +25,13 @@ export const mockReleaseStats: ReleaseStats = { candidates: [ { tagName: 'rc-1.0.1', - sha: 'sha-1.0.1', + tagSha: 'sha-1.0.1', + tagType: 'tag', }, { tagName: 'rc-1.0.0', - sha: 'sha-1.0.0', + tagSha: 'sha-1.0.0', + tagType: 'tag', }, ], versions: [], @@ -41,25 +43,30 @@ export const mockReleaseStats: ReleaseStats = { candidates: [ { tagName: 'rc-1.1.2', - sha: 'sha-1.1.2', + tagSha: 'sha-1.1.2', + tagType: 'tag', }, { tagName: 'rc-1.1.1', - sha: 'sha-1.1.1', + tagSha: 'sha-1.1.1', + tagType: 'tag', }, { tagName: 'rc-1.1.0', - sha: 'sha-1.1.0', + tagSha: 'sha-1.1.0', + tagType: 'tag', }, ], versions: [ { tagName: 'version-1.1.3', - sha: 'sha-1.1.3', + tagSha: 'sha-1.1.3', + tagType: 'tag', }, { tagName: 'version-1.1.2', - sha: 'sha-1.1.2', + tagSha: 'sha-1.1.2', + tagType: 'tag', }, ], }, diff --git a/plugins/git-release-manager/src/test-helpers/test-helpers.ts b/plugins/git-release-manager/src/test-helpers/test-helpers.ts index 458ffff9a1..2f921c2013 100644 --- a/plugins/git-release-manager/src/test-helpers/test-helpers.ts +++ b/plugins/git-release-manager/src/test-helpers/test-helpers.ts @@ -292,7 +292,8 @@ export const mockApiClient: GitReleaseApi = { getAllTags: jest.fn(async () => [ { tagName: MOCK_RELEASE_CANDIDATE_TAG_NAME_CALVER, - sha: 'mock_sha', + tagSha: 'mock_sha', + tagType: 'tag' as const, }, ]), @@ -308,8 +309,9 @@ export const mockApiClient: GitReleaseApi = { getSingleTag: jest.fn(async () => ({ date: '2021-04-29T12:48:30.120Z', - username: 'mock_usersingle_tag_name', - userEmail: 'mock_userEsingle_tag_mail', + username: 'mock_user_single_tag_name', + userEmail: 'mock_user_single_tag_email', + objectSha: 'mock_single_tag_object_sha', })), }, }; From 802fec55c114ae628e4ee5f1d29d9ea81124d87e Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 29 Apr 2021 21:57:40 +0200 Subject: [PATCH 241/485] Replace styles/styles with Box stylings Signed-off-by: Erik Engervall --- .../src/GitReleaseManager.tsx | 7 +-- .../src/components/NoLatestRelease.test.tsx | 40 +++++++------ .../src/components/NoLatestRelease.tsx | 19 +++---- .../CreateReleaseCandidate.tsx | 39 +++++++------ .../src/features/Features.test.tsx | 2 +- .../src/features/Info/Info.tsx | 20 +++---- .../src/features/Patch/Patch.tsx | 13 ++--- .../src/features/Patch/PatchBody.tsx | 57 +++++++++---------- .../src/features/PromoteRc/PromoteRc.tsx | 30 +++++----- .../src/features/PromoteRc/PromoteRcBody.tsx | 24 +++++--- .../git-release-manager/src/styles/styles.ts | 26 --------- 11 files changed, 127 insertions(+), 150 deletions(-) delete mode 100644 plugins/git-release-manager/src/styles/styles.ts diff --git a/plugins/git-release-manager/src/GitReleaseManager.tsx b/plugins/git-release-manager/src/GitReleaseManager.tsx index 9b10d5d16d..2a2adf3e12 100644 --- a/plugins/git-release-manager/src/GitReleaseManager.tsx +++ b/plugins/git-release-manager/src/GitReleaseManager.tsx @@ -18,6 +18,7 @@ import React from 'react'; import { useAsync } from 'react-use'; import { Alert } from '@material-ui/lab'; import { useApi, ContentHeader } from '@backstage/core'; +import { Box } from '@material-ui/core'; import { ComponentConfig, @@ -34,7 +35,6 @@ import { ProjectContext, Project } from './contexts/ProjectContext'; import { RepoDetailsForm } from './features/RepoDetailsForm/RepoDetailsForm'; import { useQueryHandler } from './hooks/useQueryHandler'; import { UserContext } from './contexts/UserContext'; -import { useStyles } from './styles/styles'; interface GitReleaseManagerProps { project?: Omit; @@ -49,7 +49,6 @@ interface GitReleaseManagerProps { export function GitReleaseManager(props: GitReleaseManagerProps) { const pluginApiClient = useApi(gitReleaseManagerApiRef); - const classes = useStyles(); const { getParsedQuery } = useQueryHandler(); const { parsedQuery } = getParsedQuery(); @@ -89,7 +88,7 @@ export function GitReleaseManager(props: GitReleaseManagerProps) { return ( -
+ @@ -97,7 +96,7 @@ export function GitReleaseManager(props: GitReleaseManagerProps) { {isProjectValid(project) && } -
+
); diff --git a/plugins/git-release-manager/src/components/NoLatestRelease.test.tsx b/plugins/git-release-manager/src/components/NoLatestRelease.test.tsx index 1c2ea3ffa3..6863109448 100644 --- a/plugins/git-release-manager/src/components/NoLatestRelease.test.tsx +++ b/plugins/git-release-manager/src/components/NoLatestRelease.test.tsx @@ -26,28 +26,32 @@ describe('NoLatestRelease', () => { expect(container).toMatchInlineSnapshot(`
diff --git a/plugins/git-release-manager/src/components/NoLatestRelease.tsx b/plugins/git-release-manager/src/components/NoLatestRelease.tsx index b9cf2f6df9..e4121b1f4c 100644 --- a/plugins/git-release-manager/src/components/NoLatestRelease.tsx +++ b/plugins/git-release-manager/src/components/NoLatestRelease.tsx @@ -16,20 +16,19 @@ import React from 'react'; import { Alert } from '@material-ui/lab'; +import { Box } from '@material-ui/core'; -import { useStyles } from '../styles/styles'; import { TEST_IDS } from '../test-helpers/test-ids'; export const NoLatestRelease = () => { - const classes = useStyles(); - return ( - - Unable to find any Release - + + + Unable to find any Release + + ); }; diff --git a/plugins/git-release-manager/src/features/CreateReleaseCandidate/CreateReleaseCandidate.tsx b/plugins/git-release-manager/src/features/CreateReleaseCandidate/CreateReleaseCandidate.tsx index cdbd79382e..177e9f1195 100644 --- a/plugins/git-release-manager/src/features/CreateReleaseCandidate/CreateReleaseCandidate.tsx +++ b/plugins/git-release-manager/src/features/CreateReleaseCandidate/CreateReleaseCandidate.tsx @@ -17,6 +17,7 @@ import React, { useState, useEffect } from 'react'; import { Alert, AlertTitle } from '@material-ui/lab'; import { + Box, Button, FormControl, InputLabel, @@ -39,7 +40,6 @@ import { SEMVER_PARTS } from '../../constants/constants'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { useCreateReleaseCandidate } from './hooks/useCreateReleaseCandidate'; import { useProjectContext } from '../../contexts/ProjectContext'; -import { useStyles } from '../../styles/styles'; interface CreateReleaseCandidateProps { defaultBranch: GetRepositoryResult['defaultBranch']; @@ -49,12 +49,11 @@ interface CreateReleaseCandidateProps { } const InfoCardPlusWrapper = ({ children }: { children: React.ReactNode }) => { - const classes = useStyles(); return ( - - Create Release Candidate - + + Create Release Candidate + {children} ); @@ -67,7 +66,6 @@ export const CreateReleaseCandidate = ({ successCb, }: CreateReleaseCandidateProps) => { const { project } = useProjectContext(); - const classes = useStyles(); const [semverBumpLevel, setSemverBumpLevel] = useState<'major' | 'minor'>( SEMVER_PARTS.minor, @@ -129,10 +127,7 @@ export const CreateReleaseCandidate = ({ {project.versioningStrategy === 'semver' && latestRelease && !conflictingPreRelease && ( -
+ Select bump severity @@ -150,26 +145,30 @@ export const CreateReleaseCandidate = ({ -
+ )} {conflictingPreRelease || tagAlreadyExists ? ( <> {conflictingPreRelease && ( - - The most recent release is already a Release Candidate - + + + The most recent release is already a Release Candidate + + )} {tagAlreadyExists && ( - - There's already a tag named{' '} - {releaseCandidateGitInfo.rcReleaseTag} - + + + There's already a tag named{' '} + {releaseCandidateGitInfo.rcReleaseTag} + + )} ) : ( -
+ -
+ )} - ); - } - - return ( -
- - - - - -
+ ); }; diff --git a/plugins/git-release-manager/src/features/PromoteRc/PromoteRc.tsx b/plugins/git-release-manager/src/features/PromoteRc/PromoteRc.tsx index 915330aaf4..efee800969 100644 --- a/plugins/git-release-manager/src/features/PromoteRc/PromoteRc.tsx +++ b/plugins/git-release-manager/src/features/PromoteRc/PromoteRc.tsx @@ -16,7 +16,7 @@ import React from 'react'; import { Alert, AlertTitle } from '@material-ui/lab'; -import { Typography } from '@material-ui/core'; +import { Box, Typography } from '@material-ui/core'; import { ComponentConfigPromoteRc } from '../../types/types'; import { GetLatestReleaseResult } from '../../api/GitReleaseApiClient'; @@ -24,7 +24,6 @@ import { InfoCardPlus } from '../../components/InfoCardPlus'; import { NoLatestRelease } from '../../components/NoLatestRelease'; import { PromoteRcBody } from './PromoteRcBody'; import { TEST_IDS } from '../../test-helpers/test-ids'; -import { useStyles } from '../../styles/styles'; interface PromoteRcProps { latestRelease: GetLatestReleaseResult; @@ -32,8 +31,6 @@ interface PromoteRcProps { } export const PromoteRc = ({ latestRelease, successCb }: PromoteRcProps) => { - const classes = useStyles(); - function Body() { if (latestRelease === null) { return ; @@ -41,14 +38,17 @@ export const PromoteRc = ({ latestRelease, successCb }: PromoteRcProps) => { if (!latestRelease.prerelease) { return ( - - Latest Git release is not a Release Candidate - One can only promote Release Candidates to Release Versions - + + + + Latest Git release is not a Release Candidate + + One can only promote Release Candidates to Release Versions + + ); } @@ -57,9 +57,9 @@ export const PromoteRc = ({ latestRelease, successCb }: PromoteRcProps) => { return ( - - Promote Release Candidate - + + Promote Release Candidate + diff --git a/plugins/git-release-manager/src/features/PromoteRc/PromoteRcBody.tsx b/plugins/git-release-manager/src/features/PromoteRc/PromoteRcBody.tsx index 6841c21d86..5cc8def9e2 100644 --- a/plugins/git-release-manager/src/features/PromoteRc/PromoteRcBody.tsx +++ b/plugins/git-release-manager/src/features/PromoteRc/PromoteRcBody.tsx @@ -15,7 +15,7 @@ */ import React from 'react'; -import { Button, Typography } from '@material-ui/core'; +import { Button, Typography, Box } from '@material-ui/core'; import { ComponentConfigPromoteRc } from '../../types/types'; import { Differ } from '../../components/Differ'; @@ -23,7 +23,6 @@ import { GetLatestReleaseResult } from '../../api/GitReleaseApiClient'; import { ResponseStepDialog } from '../../components/ResponseStepDialog/ResponseStepDialog'; import { TEST_IDS } from '../../test-helpers/test-ids'; import { usePromoteRc } from './hooks/usePromoteRc'; -import { useStyles } from '../../styles/styles'; interface PromoteRcBodyProps { rcRelease: NonNullable; @@ -31,7 +30,6 @@ interface PromoteRcBodyProps { } export const PromoteRcBody = ({ rcRelease, successCb }: PromoteRcBodyProps) => { - const classes = useStyles(); const releaseVersion = rcRelease.tagName.replace('rc-', 'version-'); const { progress, responseSteps, run, runInvoked } = usePromoteRc({ @@ -52,13 +50,21 @@ export const PromoteRcBody = ({ rcRelease, successCb }: PromoteRcBodyProps) => { return ( <> - - Promotes the current Release Candidate to a Release Version. - + + + Promotes the current Release Candidate to a Release Version. + + - - - + + + + +
- + ); @@ -444,7 +468,7 @@ export function Table({ return ; }, - [data, emptyContent, columns], + [hasNoRows, emptyContent, columnCount], ); return ( @@ -458,9 +482,7 @@ export function Table({ )} components={{ - Header: headerProps => ( - - ), + Header: StyledMTableHeader, Toolbar, Body, }} From 2d81438b4b7dc92f9c96eedfaf004de6ba39dafc Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 6 May 2021 13:53:11 +0200 Subject: [PATCH 369/485] Replace KeyboardArrowUpIcon with ChevronRightIcon Signed-off-by: Erik Engervall --- plugins/git-release-manager/src/features/Stats/Row/Row.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/git-release-manager/src/features/Stats/Row/Row.tsx b/plugins/git-release-manager/src/features/Stats/Row/Row.tsx index 95ec244e78..d8478d07fe 100644 --- a/plugins/git-release-manager/src/features/Stats/Row/Row.tsx +++ b/plugins/git-release-manager/src/features/Stats/Row/Row.tsx @@ -25,7 +25,7 @@ import { TableRow, } from '@material-ui/core'; import KeyboardArrowDownIcon from '@material-ui/icons/KeyboardArrowDown'; -import KeyboardArrowUpIcon from '@material-ui/icons/KeyboardArrowUp'; +import ChevronRightIcon from '@material-ui/icons/ChevronRight'; import { ReleaseStats } from '../contexts/ReleaseStatsContext'; import { RowCollapsed } from './RowCollapsed/RowCollapsed'; @@ -56,7 +56,7 @@ export function Row({ baseVersion, releaseStat }: RowProps) { size="small" onClick={() => setOpen(!open)} > - {open ? : } + {open ? : } From 570dcd2782f34529f8cf77900b42f11b1960078b Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 6 May 2021 13:53:45 +0200 Subject: [PATCH 370/485] Add condition in getTagDates for when endTag is undefined Signed-off-by: Erik Engervall --- .../Stats/helpers/getTagDates.test.ts | 49 ++++++++++++++++++- .../src/features/Stats/helpers/getTagDates.ts | 31 +++++++++++- 2 files changed, 77 insertions(+), 3 deletions(-) diff --git a/plugins/git-release-manager/src/features/Stats/helpers/getTagDates.test.ts b/plugins/git-release-manager/src/features/Stats/helpers/getTagDates.test.ts index e02aac9551..3274ecc31f 100644 --- a/plugins/git-release-manager/src/features/Stats/helpers/getTagDates.test.ts +++ b/plugins/git-release-manager/src/features/Stats/helpers/getTagDates.test.ts @@ -23,7 +23,54 @@ import { import { getTagDates } from './getTagDates'; describe('getTagDates', () => { - beforeEach(jest.clearAllMocks); + beforeEach(() => { + jest.clearAllMocks(); + jest.resetAllMocks(); + }); + + it('should get tag dates for startTag when is tag and endTag is undefined', async () => { + (mockApiClient.getTag as jest.Mock).mockResolvedValueOnce( + createMockTag({ date: 'TAG-START' }), + ); + + const result = await getTagDates({ + pluginApiClient: mockApiClient, + project: mockSemverProject, + startTag: { + tagSha: 'sha-start', + tagType: 'tag', + }, + }); + + expect(result).toMatchInlineSnapshot(` + Object { + "endDate": undefined, + "startDate": "TAG-START", + } + `); + }); + + it('should get tag dates for startTag when startTag is commit and endTag is undefined', async () => { + (mockApiClient.getCommit as jest.Mock).mockResolvedValueOnce( + createMockCommit({ createdAt: 'COMMIT_START' }), + ); + + const result = await getTagDates({ + pluginApiClient: mockApiClient, + project: mockSemverProject, + startTag: { + tagSha: 'sha-start', + tagType: 'commit', + }, + }); + + expect(result).toMatchInlineSnapshot(` + Object { + "endDate": undefined, + "startDate": "COMMIT_START", + } + `); + }); it('should get tag dates when startTag & endTag both are of type tag', async () => { (mockApiClient.getTag as jest.Mock) diff --git a/plugins/git-release-manager/src/features/Stats/helpers/getTagDates.ts b/plugins/git-release-manager/src/features/Stats/helpers/getTagDates.ts index d4803be4be..d79d7489fd 100644 --- a/plugins/git-release-manager/src/features/Stats/helpers/getTagDates.ts +++ b/plugins/git-release-manager/src/features/Stats/helpers/getTagDates.ts @@ -25,7 +25,7 @@ interface GetTagDates { tagSha: string; tagType: 'tag' | 'commit'; }; - endTag: { + endTag?: { tagSha: string; tagType: 'tag' | 'commit'; }; @@ -37,6 +37,33 @@ export const getTagDates = async ({ startTag, endTag, }: GetTagDates) => { + if (!endTag) { + if (startTag.tagType === 'tag') { + const { tag: startTagResponse } = await pluginApiClient.getTag({ + owner: project.owner, + repo: project.repo, + tagSha: startTag.tagSha, + }); + + return { + startDate: startTagResponse.date, + endDate: undefined, + }; + } + + // If tagType is not a 'tag', it has to be a commit + const { commit: startCommit } = await pluginApiClient.getCommit({ + owner: project.owner, + repo: project.repo, + ref: startTag.tagSha, + }); + + return { + startDate: startCommit.createdAt, + endDate: undefined, + }; + } + if (startTag.tagType === 'tag' && endTag.tagType === 'tag') { const [ { tag: startTagResponse }, @@ -124,7 +151,7 @@ async function getCommitFromTag({ }: { pluginApiClient: GetTagDates['pluginApiClient']; project: GetTagDates['project']; - tag: GetTagDates['startTag'] | GetTagDates['endTag']; + tag: GetTagDates['startTag'] | NonNullable; }) { const { tag: tagResponse } = await pluginApiClient.getTag({ owner: project.owner, From 2d69bfe745a437cb82f7df3ecbb01ac2b2f2c04c Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 6 May 2021 14:04:35 +0200 Subject: [PATCH 371/485] Remove setLocale from DateTime invokations Signed-off-by: Erik Engervall --- .../git-release-manager/src/features/Stats/Row/Row.tsx | 4 +--- .../features/Stats/Row/RowCollapsed/ReleaseTime.tsx | 10 ++++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/plugins/git-release-manager/src/features/Stats/Row/Row.tsx b/plugins/git-release-manager/src/features/Stats/Row/Row.tsx index d8478d07fe..23ce55a898 100644 --- a/plugins/git-release-manager/src/features/Stats/Row/Row.tsx +++ b/plugins/git-release-manager/src/features/Stats/Row/Row.tsx @@ -69,9 +69,7 @@ export function Row({ baseVersion, releaseStat }: RowProps) { {releaseStat.createdAt - ? DateTime.fromISO(releaseStat.createdAt) - .setLocale('sv-SE') - .toFormat('yyyy-MM-dd') + ? DateTime.fromISO(releaseStat.createdAt).toFormat('yyyy-MM-dd') : '-'} diff --git a/plugins/git-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx b/plugins/git-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx index cc964c51b4..0a499f5cf6 100644 --- a/plugins/git-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx +++ b/plugins/git-release-manager/src/features/Stats/Row/RowCollapsed/ReleaseTime.tsx @@ -83,9 +83,7 @@ export function ReleaseTime({ releaseStat }: ReleaseTimeProps) { {releaseStat.versions.length === 0 ? '-' : 'Release completed '} {releaseTimes.value?.endDate && - DateTime.fromISO(releaseTimes.value.endDate) - .setLocale('sv-SE') - .toFormat('yyyy-MM-dd')} + DateTime.fromISO(releaseTimes.value.endDate).toFormat('yyyy-MM-dd')} @@ -117,9 +115,9 @@ export function ReleaseTime({ releaseStat }: ReleaseTimeProps) { Release Candidate created{' '} {releaseTimes.value?.startDate && - DateTime.fromISO(releaseTimes.value.startDate) - .setLocale('sv-SE') - .toFormat('yyyy-MM-dd')} + DateTime.fromISO(releaseTimes.value.startDate).toFormat( + 'yyyy-MM-dd', + )} From d02e5ee76197c4a818ebf29e847f698cd0a41745 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 6 May 2021 14:10:08 +0200 Subject: [PATCH 372/485] Add X.error to onSuccess useAsyncs Signed-off-by: Erik Engervall --- .../CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts | 2 +- .../git-release-manager/src/features/Patch/hooks/usePatch.ts | 2 +- .../src/features/PromoteRc/hooks/usePromoteRc.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts b/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts index 5ab4fe2338..477e404d78 100644 --- a/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts +++ b/plugins/git-release-manager/src/features/CreateReleaseCandidate/hooks/useCreateReleaseCandidate.ts @@ -281,7 +281,7 @@ export function useCreateReleaseCandidate({ icon: 'success', }); } - }, [createReleaseRes.value]); + }, [createReleaseRes.value, createReleaseRes.error]); const TOTAL_STEPS = 6 + (!!onSuccess ? 1 : 0); const [progress, setProgress] = useState(0); diff --git a/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts b/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts index 7f1dc35667..506f218842 100644 --- a/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts +++ b/plugins/git-release-manager/src/features/Patch/hooks/usePatch.ts @@ -353,7 +353,7 @@ ${selectedPatchCommit.commit.message}`, message: 'Success callback successfully called 🚀', icon: 'success', }); - }, [updatedReleaseRes.value]); + }, [updatedReleaseRes.value, updatedReleaseRes.error]); const TOTAL_STEPS = 9 + (!!onSuccess ? 1 : 0); const [progress, setProgress] = useState(0); diff --git a/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts b/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts index 318c928479..8b1ffa089b 100644 --- a/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts +++ b/plugins/git-release-manager/src/features/PromoteRc/hooks/usePromoteRc.ts @@ -186,7 +186,7 @@ export function usePromoteRc({ icon: 'success', }); } - }, [promotedReleaseRes.value]); + }, [promotedReleaseRes.value, promotedReleaseRes.error]); const TOTAL_STEPS = 4 + (!!onSuccess ? 1 : 0); const [progress, setProgress] = useState(0); From 73a2c649cbc53dfad6781c514ed0ed823f7fba1d Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Thu, 6 May 2021 14:16:59 +0200 Subject: [PATCH 373/485] Replace hacky refetchTrigger with useAsyncFn Signed-off-by: Erik Engervall --- .../ResponseStepDialog/ResponseStepDialog.tsx | 4 ++-- .../src/contexts/RefetchContext.ts | 8 ++------ .../git-release-manager/src/features/Features.tsx | 6 ++---- .../src/hooks/useGetGitBatchInfo.ts | 14 +++++++++----- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/plugins/git-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.tsx b/plugins/git-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.tsx index d504ffec70..52ae3e68c0 100644 --- a/plugins/git-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.tsx +++ b/plugins/git-release-manager/src/components/ResponseStepDialog/ResponseStepDialog.tsx @@ -40,7 +40,7 @@ export const ResponseStepDialog = ({ responseSteps, title, }: DialogProps) => { - const { setRefetchTrigger } = useRefetchContext(); + const { fetchGitBatchInfo } = useRefetchContext(); return (
{emptyContent}{emptyContent}
- {shouldWarn && } + {(releaseStats.unmappableTags.length > 0 || + releaseStats.unmatchedTags.length > 0 || + releaseStats.unmatchedReleases.length > 0) && } ); diff --git a/plugins/git-release-manager/src/features/Stats/Warn.tsx b/plugins/git-release-manager/src/features/Stats/Warn.tsx index 93c2cc4154..24997cc9b3 100644 --- a/plugins/git-release-manager/src/features/Stats/Warn.tsx +++ b/plugins/git-release-manager/src/features/Stats/Warn.tsx @@ -16,6 +16,7 @@ import React from 'react'; import { Alert } from '@material-ui/lab'; +import { Box, Button } from '@material-ui/core'; import { useProjectContext } from '../../contexts/ProjectContext'; import { useReleaseStatsContext } from './contexts/ReleaseStatsContext'; @@ -25,30 +26,48 @@ export const Warn = () => { const { project } = useProjectContext(); return ( - - {releaseStats.unmappableTags.length > 0 && ( -
- Failed to map {releaseStats.unmappableTags.length}{' '} - tags to releases -
- )} + + + {releaseStats.unmappableTags.length > 0 && ( +
+ Failed to map {releaseStats.unmappableTags.length}{' '} + tags to releases +
+ )} - {releaseStats.unmatchedTags.length > 0 && ( -
- Failed to match {releaseStats.unmatchedTags.length}{' '} - tags to {project.versioningStrategy} -
- )} + {releaseStats.unmatchedTags.length > 0 && ( +
+ Failed to match {releaseStats.unmatchedTags.length}{' '} + tags to {project.versioningStrategy} +
+ )} - {releaseStats.unmatchedReleases.length > 0 && ( -
- Failed to match{' '} - {releaseStats.unmatchedReleases.length} releases to{' '} - {project.versioningStrategy} -
- )} + {releaseStats.unmatchedReleases.length > 0 && ( +
+ Failed to match{' '} + {releaseStats.unmatchedReleases.length} releases to{' '} + {project.versioningStrategy} +
+ )} -
See full output in the console
-
+ + + +
+
); }; From 9a207f052fa25b74ce4719f079b9ecbe8097ceeb Mon Sep 17 00:00:00 2001 From: Oliver Sand Date: Thu, 6 May 2021 15:55:26 +0200 Subject: [PATCH 378/485] Support integrations in `GithubOrgReaderProcessor` Signed-off-by: Oliver Sand --- .changeset/polite-plants-exercise.md | 28 ++++++ plugins/catalog-backend/config.d.ts | 2 + .../GithubOrgReaderProcessor.test.ts | 40 +++++++- .../processors/GithubOrgReaderProcessor.ts | 94 +++++++++++++++---- .../processors/github/config.test.ts | 10 -- .../src/ingestion/processors/github/config.ts | 9 -- 6 files changed, 145 insertions(+), 38 deletions(-) create mode 100644 .changeset/polite-plants-exercise.md diff --git a/.changeset/polite-plants-exercise.md b/.changeset/polite-plants-exercise.md new file mode 100644 index 0000000000..42df6875e6 --- /dev/null +++ b/.changeset/polite-plants-exercise.md @@ -0,0 +1,28 @@ +--- +'@backstage/plugin-catalog-backend': minor +--- + +Port `GithubOrgReaderProcessor` to support configuration via +[`integrations`](https://backstage.io/docs/integrations/github/locations) in +addition to [`catalog.processors.githubOrg.providers`](https://backstage.io/docs/integrations/github/org#configuration). +The `integrations` package supports authentication with both personal access +tokens and GitHub apps. + +This deprecates the `catalog.processors.githubOrg.providers` configuration. If +you still have a configuration for providers the processor keeps working, but +consider moving the [`integrations` configuration](https://backstage.io/docs/integrations/github/locations) +as the providers will be removed in the future. You might need to allow +additional scopes for the credentials. + +If you want to stay with providers for now, this introduces a small breaking +change, previously if you had no provider configured, one for GitHub was automatically added. To keep the behavior, add a +default provider for GitHub: + +```yaml +catalog: + processors: + githubOrg: + providers: + - target: https://github.com + apiBaseUrl: https://api.github.com +``` diff --git a/plugins/catalog-backend/config.d.ts b/plugins/catalog-backend/config.d.ts index 564dd7511e..a913473ff8 100644 --- a/plugins/catalog-backend/config.d.ts +++ b/plugins/catalog-backend/config.d.ts @@ -114,6 +114,8 @@ export interface Config { processors?: { /** * GithubOrgReaderProcessor configuration + * + * @deprecated Configure an GitHub integration instead. */ githubOrg?: { /** diff --git a/plugins/catalog-backend/src/ingestion/processors/GithubOrgReaderProcessor.test.ts b/plugins/catalog-backend/src/ingestion/processors/GithubOrgReaderProcessor.test.ts index 19a08d219f..9b724def28 100644 --- a/plugins/catalog-backend/src/ingestion/processors/GithubOrgReaderProcessor.test.ts +++ b/plugins/catalog-backend/src/ingestion/processors/GithubOrgReaderProcessor.test.ts @@ -16,6 +16,11 @@ import { getVoidLogger } from '@backstage/backend-common'; import { LocationSpec } from '@backstage/catalog-model'; +import { + GitHubIntegration, + ScmIntegrations, + ScmIntegrationsGroup, +} from '@backstage/integration'; import { GithubOrgReaderProcessor, parseUrl } from './GithubOrgReaderProcessor'; describe('GithubOrgReaderProcessor', () => { @@ -29,6 +34,20 @@ describe('GithubOrgReaderProcessor', () => { }); describe('implementation', () => { + let integrations: ScmIntegrations; + let github: jest.Mocked>; + + beforeEach(() => { + github = { + byHost: jest.fn(), + byUrl: jest.fn(), + list: jest.fn(), + }; + integrations = ({ + github, + } as Partial) as ScmIntegrations; + }); + it('rejects unknown types', async () => { const processor = new GithubOrgReaderProcessor({ providers: [ @@ -37,6 +56,7 @@ describe('GithubOrgReaderProcessor', () => { apiBaseUrl: 'https://api.github.com', }, ], + integrations, logger: getVoidLogger(), }); const location: LocationSpec = { @@ -48,7 +68,7 @@ describe('GithubOrgReaderProcessor', () => { ).resolves.toBeFalsy(); }); - it('rejects unknown targets', async () => { + it('rejects unknown targets from providers', async () => { const processor = new GithubOrgReaderProcessor({ providers: [ { @@ -56,6 +76,24 @@ describe('GithubOrgReaderProcessor', () => { apiBaseUrl: 'https://api.github.com', }, ], + integrations, + logger: getVoidLogger(), + }); + const location: LocationSpec = { + type: 'github-org', + target: 'https://not.github.com/apa', + }; + await expect( + processor.readLocation(location, false, () => {}), + ).rejects.toThrow( + /There is no GitHub Org provider that matches https:\/\/not.github.com\/apa/, + ); + }); + + it('rejects unknown targets from integrations', async () => { + const processor = new GithubOrgReaderProcessor({ + providers: [], + integrations, logger: getVoidLogger(), }); const location: LocationSpec = { diff --git a/plugins/catalog-backend/src/ingestion/processors/GithubOrgReaderProcessor.ts b/plugins/catalog-backend/src/ingestion/processors/GithubOrgReaderProcessor.ts index 6a83d705f6..db61886b89 100644 --- a/plugins/catalog-backend/src/ingestion/processors/GithubOrgReaderProcessor.ts +++ b/plugins/catalog-backend/src/ingestion/processors/GithubOrgReaderProcessor.ts @@ -16,6 +16,10 @@ import { LocationSpec } from '@backstage/catalog-model'; import { Config } from '@backstage/config'; +import { + GithubCredentialsProvider, + ScmIntegrations, +} from '@backstage/integration'; import { graphql } from '@octokit/graphql'; import { Logger } from 'winston'; import { @@ -28,22 +32,33 @@ import * as results from './results'; import { CatalogProcessor, CatalogProcessorEmit } from './types'; import { buildOrgHierarchy } from './util/org'; +type GraphQL = typeof graphql; + /** * Extracts teams and users out of a GitHub org. */ export class GithubOrgReaderProcessor implements CatalogProcessor { private readonly providers: ProviderConfig[]; + private readonly integrations: ScmIntegrations; private readonly logger: Logger; static fromConfig(config: Config, options: { logger: Logger }) { + const integrations = ScmIntegrations.fromConfig(config); + return new GithubOrgReaderProcessor({ ...options, providers: readGithubConfig(config), + integrations, }); } - constructor(options: { providers: ProviderConfig[]; logger: Logger }) { + constructor(options: { + providers: ProviderConfig[]; + integrations: ScmIntegrations; + logger: Logger; + }) { this.providers = options.providers; + this.integrations = options.integrations; this.logger = options.logger; } @@ -56,24 +71,8 @@ export class GithubOrgReaderProcessor implements CatalogProcessor { return false; } - const provider = this.providers.find(p => - location.target.startsWith(`${p.target}/`), - ); - if (!provider) { - throw new Error( - `There is no GitHub Org provider that matches ${location.target}. Please add a configuration entry for it under catalog.processors.githubOrg.providers.`, - ); - } - + const client = await this.createClient(location.target); const { org } = parseUrl(location.target); - const client = !provider.token - ? graphql - : graphql.defaults({ - baseUrl: provider.apiBaseUrl, - headers: { - authorization: `token ${provider.token}`, - }, - }); // Read out all of the raw data const startTimestamp = Date.now(); @@ -112,6 +111,65 @@ export class GithubOrgReaderProcessor implements CatalogProcessor { return true; } + + private async createClient(orgUrl: string): Promise { + let client = this.createClientFromProvider(orgUrl); + + if (!client) { + client = await this.createClientFromIntegrations(orgUrl); + } + + if (!client) { + throw new Error( + `There is no GitHub Org provider that matches ${orgUrl}. Please add a configuration for an integration or add an entry for it under catalog.processors.githubOrg.providers.`, + ); + } + + return client; + } + + private createClientFromProvider(orgUrl: string): GraphQL | undefined { + const provider = this.providers.find(p => + orgUrl.startsWith(`${p.target}/`), + ); + + if (!provider) { + return undefined; + } + + this.logger.warn( + 'GithubOrgReaderProcessor uses provider defined in catalog.processors.githubOrg.providers, migrate to integrations instead.', + ); + + return !provider.token + ? graphql + : graphql.defaults({ + baseUrl: provider.apiBaseUrl, + headers: { + authorization: `token ${provider.token}`, + }, + }); + } + + private async createClientFromIntegrations( + orgUrl: string, + ): Promise { + const gitHubConfig = this.integrations.github.byUrl(orgUrl)?.config; + if (!gitHubConfig) { + return undefined; + } + + const credentialsProvider = GithubCredentialsProvider.create(gitHubConfig); + + const { headers } = await credentialsProvider.getCredentials({ + url: orgUrl, + }); + + return graphql.defaults({ + baseUrl: gitHubConfig.apiBaseUrl, + headers, + }); + } } /* diff --git a/plugins/catalog-backend/src/ingestion/processors/github/config.test.ts b/plugins/catalog-backend/src/ingestion/processors/github/config.test.ts index 14f3caa42c..b39a7a7ff9 100644 --- a/plugins/catalog-backend/src/ingestion/processors/github/config.test.ts +++ b/plugins/catalog-backend/src/ingestion/processors/github/config.test.ts @@ -27,16 +27,6 @@ describe('config', () => { }); } - it('adds a default GitHub entry when missing', () => { - const output = readGithubConfig(config([])); - expect(output).toEqual([ - { - target: 'https://github.com', - apiBaseUrl: 'https://api.github.com', - }, - ]); - }); - it('injects the correct GitHub API base URL when missing', () => { const output = readGithubConfig( config([{ target: 'https://github.com' }]), diff --git a/plugins/catalog-backend/src/ingestion/processors/github/config.ts b/plugins/catalog-backend/src/ingestion/processors/github/config.ts index 88f2f96218..7b16448b9e 100644 --- a/plugins/catalog-backend/src/ingestion/processors/github/config.ts +++ b/plugins/catalog-backend/src/ingestion/processors/github/config.ts @@ -71,14 +71,5 @@ export function readGithubConfig(config: Config): ProviderConfig[] { providers.push({ target, apiBaseUrl, token }); } - // If no explicit github.com provider was added, put one in the list as - // a convenience - if (!providers.some(p => p.target === 'https://github.com')) { - providers.push({ - target: 'https://github.com', - apiBaseUrl: 'https://api.github.com', - }); - } - return providers; } From 0988c34a39d0475bbfa794c1432350b2896500bd Mon Sep 17 00:00:00 2001 From: GregoireW <24318548+GregoireW@users.noreply.github.com> Date: Thu, 25 Mar 2021 17:01:19 +0100 Subject: [PATCH 379/485] Limit to display first 50 user on groups Signed-off-by: GregoireW <24318548+GregoireW@users.noreply.github.com> --- .../components/Cards/Group/MembersList/MembersListCard.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx b/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx index d68328ef1a..a5aa073b3d 100644 --- a/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx +++ b/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx @@ -147,7 +147,9 @@ export const MembersListCard = (_props: { return ( 50 ? ' (only first 50 displayed)' : '' + }`} subheader={`of ${displayName}`} > From f59a945b7b034ae2526474011797b314ee06fd0e Mon Sep 17 00:00:00 2001 From: GregoireW <24318548+GregoireW@users.noreply.github.com> Date: Thu, 25 Mar 2021 18:50:43 +0100 Subject: [PATCH 380/485] Changeset Signed-off-by: GregoireW <24318548+GregoireW@users.noreply.github.com> --- .changeset/shaggy-drinks-hammer.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/shaggy-drinks-hammer.md diff --git a/.changeset/shaggy-drinks-hammer.md b/.changeset/shaggy-drinks-hammer.md new file mode 100644 index 0000000000..f068ce4267 --- /dev/null +++ b/.changeset/shaggy-drinks-hammer.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-org': patch +--- + +Display only first 50 group members From 18c0ec2a42bc01b403a4ebaa6097574d52225203 Mon Sep 17 00:00:00 2001 From: GregoireW <24318548+GregoireW@users.noreply.github.com> Date: Thu, 6 May 2021 17:19:41 +0200 Subject: [PATCH 381/485] Limit to display first 50 user on groups Signed-off-by: GregoireW <24318548+GregoireW@users.noreply.github.com> --- .../Cards/Group/MembersList/MembersListCard.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx b/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx index a5aa073b3d..89e9f14c4c 100644 --- a/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx +++ b/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx @@ -154,9 +154,11 @@ export const MembersListCard = (_props: { > {members && members.length > 0 ? ( - members.map(member => ( - - )) + members + .slice(0, 49) + .map(member => ( + + )) ) : ( This group has no members. From 81ef1d57bf5a23103fed4160c767e52f3e13c55d Mon Sep 17 00:00:00 2001 From: Oliver Sand Date: Thu, 6 May 2021 17:50:30 +0200 Subject: [PATCH 382/485] Show error on task page if task does not exist Signed-off-by: Oliver Sand --- .changeset/grumpy-goats-refuse.md | 5 +++++ plugins/scaffolder/package.json | 1 + plugins/scaffolder/src/api.ts | 11 +++++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 .changeset/grumpy-goats-refuse.md diff --git a/.changeset/grumpy-goats-refuse.md b/.changeset/grumpy-goats-refuse.md new file mode 100644 index 0000000000..8dc2e390fc --- /dev/null +++ b/.changeset/grumpy-goats-refuse.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder': patch +--- + +Show error on task page if task does not exist. diff --git a/plugins/scaffolder/package.json b/plugins/scaffolder/package.json index f2f69c029b..9cf7c01d02 100644 --- a/plugins/scaffolder/package.json +++ b/plugins/scaffolder/package.json @@ -33,6 +33,7 @@ "@backstage/catalog-client": "^0.3.11", "@backstage/catalog-model": "^0.7.8", "@backstage/config": "^0.1.5", + "@backstage/errors": "^0.1.1", "@backstage/core": "^0.7.8", "@backstage/integration": "^0.5.2", "@backstage/integration-react": "^0.1.1", diff --git a/plugins/scaffolder/src/api.ts b/plugins/scaffolder/src/api.ts index 0c5eb2b268..6add205bb6 100644 --- a/plugins/scaffolder/src/api.ts +++ b/plugins/scaffolder/src/api.ts @@ -22,6 +22,7 @@ import { IdentityApi, Observable, } from '@backstage/core'; +import { ResponseError } from '@backstage/errors'; import { ScmIntegrationRegistry } from '@backstage/integration'; import ObservableImpl from 'zen-observable'; import { ListActionsResponse, ScaffolderTask, Status } from './types'; @@ -173,9 +174,15 @@ export class ScaffolderClient implements ScaffolderApi { const token = await this.identityApi.getIdToken(); const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder'); const url = `${baseUrl}/v2/tasks/${encodeURIComponent(taskId)}`; - return fetch(url, { + const response = await fetch(url, { headers: token ? { Authorization: `Bearer ${token}` } : {}, - }).then(x => x.json()); + }); + + if (!response.ok) { + throw ResponseError.fromResponse(response); + } + + return await response.json(); } streamLogs({ From 15e248a107d9c7de2f88a6b8363785c8f65707c5 Mon Sep 17 00:00:00 2001 From: Oliver Sand Date: Thu, 6 May 2021 18:22:26 +0200 Subject: [PATCH 383/485] Migrate all scaffolder API calls to `ResponseError` Signed-off-by: Oliver Sand --- plugins/scaffolder/src/api.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/plugins/scaffolder/src/api.ts b/plugins/scaffolder/src/api.ts index 6add205bb6..a603df5fc6 100644 --- a/plugins/scaffolder/src/api.ts +++ b/plugins/scaffolder/src/api.ts @@ -129,9 +129,7 @@ export class ScaffolderClient implements ScaffolderApi { }); if (!response.ok) { - throw new Error( - `Failed to fetch template parameter schema, ${await response.text()}`, - ); + throw ResponseError.fromResponse(response); } const schema: TemplateParameterSchema = await response.json(); @@ -161,9 +159,7 @@ export class ScaffolderClient implements ScaffolderApi { }); if (response.status !== 201) { - const status = `${response.status} ${response.statusText}`; - const body = await response.text(); - throw new Error(`Backend request failed, ${status} ${body.trim()}`); + throw ResponseError.fromResponse(response); } const { id } = (await response.json()) as { id: string }; @@ -241,6 +237,11 @@ export class ScaffolderClient implements ScaffolderApi { async listActions(): Promise { const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder'); const response = await fetch(`${baseUrl}/v2/actions`); + + if (!response.ok) { + throw ResponseError.fromResponse(response); + } + return await response.json(); } } From d6ee1830543304d339583ce73f895d75f3ce8e11 Mon Sep 17 00:00:00 2001 From: Oliver Sand Date: Thu, 6 May 2021 18:28:41 +0200 Subject: [PATCH 384/485] Restore for `scaffold()` Signed-off-by: Oliver Sand --- plugins/scaffolder/src/api.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/scaffolder/src/api.ts b/plugins/scaffolder/src/api.ts index a603df5fc6..c7b1594071 100644 --- a/plugins/scaffolder/src/api.ts +++ b/plugins/scaffolder/src/api.ts @@ -159,7 +159,9 @@ export class ScaffolderClient implements ScaffolderApi { }); if (response.status !== 201) { - throw ResponseError.fromResponse(response); + const status = `${response.status} ${response.statusText}`; + const body = await response.text(); + throw new Error(`Backend request failed, ${status} ${body.trim()}`); } const { id } = (await response.json()) as { id: string }; From bc2cab231f43fd4e8d6cba2d56652dfb67da7914 Mon Sep 17 00:00:00 2001 From: GregoireW <24318548+GregoireW@users.noreply.github.com> Date: Thu, 6 May 2021 20:39:34 +0200 Subject: [PATCH 385/485] Limit to display first 50 user on groups Signed-off-by: GregoireW <24318548+GregoireW@users.noreply.github.com> --- .../Group/MembersList/MembersListCard.tsx | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx b/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx index 89e9f14c4c..e3ab4e5193 100644 --- a/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx +++ b/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx @@ -40,6 +40,7 @@ import { Theme, Typography, } from '@material-ui/core'; +import Pagination from '@material-ui/lab/Pagination'; import React from 'react'; import { generatePath, Link as RouterLink } from 'react-router-dom'; import { useAsync } from 'react-use'; @@ -120,6 +121,12 @@ export const MembersListCard = (_props: { const groupNamespace = grpNamespace || ENTITY_DEFAULT_NAMESPACE; + const [page, setPage] = React.useState(1); + const pageChange = (_: React.ChangeEvent, pageIndex: number) => { + setPage(pageIndex); + }; + const pageSize = 50; + const { loading, error, value: members } = useAsync(async () => { const membersList = await catalogApi.getEntities({ filter: { kind: 'User' }, @@ -148,14 +155,18 @@ export const MembersListCard = (_props: { 50 ? ' (only first 50 displayed)' : '' + members && members.length > pageSize + ? ` (page ${page} of ${Math.ceil( + (members?.length || 0) / pageSize, + )})` + : '' }`} subheader={`of ${displayName}`} > {members && members.length > 0 ? ( members - .slice(0, 49) + .slice(pageSize * (page - 1), pageSize * page) .map(member => ( )) @@ -165,6 +176,13 @@ export const MembersListCard = (_props: { )} + ); From dd3b98138fe637d5b42d0a00c8f0e1ec6cfb5330 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 May 2021 18:50:26 +0000 Subject: [PATCH 386/485] chore(deps): bump property-expr from 2.0.2 to 2.0.4 Bumps [property-expr](https://github.com/jquense/expr) from 2.0.2 to 2.0.4. - [Release notes](https://github.com/jquense/expr/releases) - [Changelog](https://github.com/jquense/expr/blob/master/CHANGELOG.md) - [Commits](https://github.com/jquense/expr/compare/v2.0.2...v2.0.4) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index a471cbb1e2..8cdd10db6e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -21585,9 +21585,9 @@ prop-types@^15.5.10, prop-types@^15.5.7, prop-types@^15.5.8, prop-types@^15.6.0, react-is "^16.8.1" property-expr@^2.0.2: - version "2.0.2" - resolved "https://registry.npmjs.org/property-expr/-/property-expr-2.0.2.tgz#fff2a43919135553a3bc2fdd94bdb841965b2330" - integrity sha512-bc/5ggaYZxNkFKj374aLbEDqVADdYaLcFo8XBkishUWbaAdjlphaBFns9TvRA2pUseVL/wMFmui9X3IdNDU37g== + version "2.0.4" + resolved "https://registry.yarnpkg.com/property-expr/-/property-expr-2.0.4.tgz#37b925478e58965031bb612ec5b3260f8241e910" + integrity sha512-sFPkHQjVKheDNnPvotjQmm3KD3uk1fWKUN7CrpdbwmUx3CrG3QiM8QpTSimvig5vTXmTvjz7+TDvXOI9+4rkcg== property-information@^5.0.0: version "5.4.0" From e9458540de82885d0a2e0e5bb5983dc100b8c6a0 Mon Sep 17 00:00:00 2001 From: Bret Hubbard Date: Thu, 6 May 2021 16:07:27 -0600 Subject: [PATCH 387/485] Improve error messages when schema validation fails Signed-off-by: Bret Hubbard --- .../src/kinds/ApiEntityV1alpha1.test.ts | 12 ++++++++++++ packages/catalog-model/src/kinds/util.ts | 8 +++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/catalog-model/src/kinds/ApiEntityV1alpha1.test.ts b/packages/catalog-model/src/kinds/ApiEntityV1alpha1.test.ts index a4d7d904cd..249243bed3 100644 --- a/packages/catalog-model/src/kinds/ApiEntityV1alpha1.test.ts +++ b/packages/catalog-model/src/kinds/ApiEntityV1alpha1.test.ts @@ -168,4 +168,16 @@ components: (entity as any).spec.system = ''; await expect(validator.check(entity)).rejects.toThrow(/system/); }); + + it('rejects additional properties', async () => { + (entity as any).annotations = 'Test'; + await expect(validator.check(entity)).rejects.toThrow( + /additional properties/, + ); + }); + + it('rejects with useful error message', async () => { + (entity as any).annotations = 'Test'; + await expect(validator.check(entity)).rejects.toThrow(/annotations/); + }); }); diff --git a/packages/catalog-model/src/kinds/util.ts b/packages/catalog-model/src/kinds/util.ts index 4002f2806c..1e9e7b7521 100644 --- a/packages/catalog-model/src/kinds/util.ts +++ b/packages/catalog-model/src/kinds/util.ts @@ -66,7 +66,13 @@ export function ajvCompiledJsonSchemaValidator( } throw new TypeError( - `Malformed ${kind}, ${error.dataPath || ''} ${error.message}`, + `Malformed ${kind}, ${error.dataPath || ''} ${error.message}${ + error.params + ? ` - ${Object.entries(error.params) + .map(([key, val]) => `${key}: ${val}`) + .join(', ')}` + : '' + }`, ); }, }; From 10c008a3a68c810d382cff06349d6d753a44cc04 Mon Sep 17 00:00:00 2001 From: Julian Pearce Date: Fri, 7 May 2021 03:24:00 +0100 Subject: [PATCH 388/485] resolves #5586 Signed-off-by: Julian Pearce --- .changeset/cyan-beans-marry.md | 5 +++++ .../catalog-model/src/kinds/TemplateEntityV1beta2.test.ts | 2 +- packages/catalog-model/src/kinds/TemplateEntityV1beta2.ts | 2 +- .../src/schema/kinds/Template.v1beta2.schema.json | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/cyan-beans-marry.md diff --git a/.changeset/cyan-beans-marry.md b/.changeset/cyan-beans-marry.md new file mode 100644 index 0000000000..99d7ad47ce --- /dev/null +++ b/.changeset/cyan-beans-marry.md @@ -0,0 +1,5 @@ +--- +'@backstage/catalog-model': patch +--- + +Renamed parameters to input in template schema diff --git a/packages/catalog-model/src/kinds/TemplateEntityV1beta2.test.ts b/packages/catalog-model/src/kinds/TemplateEntityV1beta2.test.ts index 60f3de9e59..958a486687 100644 --- a/packages/catalog-model/src/kinds/TemplateEntityV1beta2.test.ts +++ b/packages/catalog-model/src/kinds/TemplateEntityV1beta2.test.ts @@ -51,7 +51,7 @@ describe('templateEntityV1beta2Validator', () => { id: 'fetch', name: 'Fetch', action: 'fetch:plan', - parameters: { + input: { url: './template', }, }, diff --git a/packages/catalog-model/src/kinds/TemplateEntityV1beta2.ts b/packages/catalog-model/src/kinds/TemplateEntityV1beta2.ts index c78e7f85d5..1f4e3bcd90 100644 --- a/packages/catalog-model/src/kinds/TemplateEntityV1beta2.ts +++ b/packages/catalog-model/src/kinds/TemplateEntityV1beta2.ts @@ -38,7 +38,7 @@ export interface TemplateEntityV1beta2 extends Entity { id?: string; name?: string; action: string; - parameters?: JsonObject; + input?: JsonObject; }>; output?: { [name: string]: string }; }; diff --git a/packages/catalog-model/src/schema/kinds/Template.v1beta2.schema.json b/packages/catalog-model/src/schema/kinds/Template.v1beta2.schema.json index 1e0b7d0ded..b88b344626 100644 --- a/packages/catalog-model/src/schema/kinds/Template.v1beta2.schema.json +++ b/packages/catalog-model/src/schema/kinds/Template.v1beta2.schema.json @@ -125,7 +125,7 @@ "type": "string", "description": "The name of the action to execute." }, - "parameters": { + "input": { "type": "object", "description": "A templated object describing the inputs to the action." } From e38d2c73e1a07bcd4a9abc3e57c0362aa60dd8c4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 May 2021 04:12:08 +0000 Subject: [PATCH 389/485] chore(deps-dev): bump @graphql-codegen/typescript-resolvers Bumps [@graphql-codegen/typescript-resolvers](https://github.com/dotansimha/graphql-code-generator/tree/HEAD/packages/plugins/typescript/resolvers) from 1.18.2 to 1.19.1. - [Release notes](https://github.com/dotansimha/graphql-code-generator/releases) - [Changelog](https://github.com/dotansimha/graphql-code-generator/blob/master/packages/plugins/typescript/resolvers/CHANGELOG.md) - [Commits](https://github.com/dotansimha/graphql-code-generator/commits/@graphql-codegen/typescript-resolvers@1.19.1/packages/plugins/typescript/resolvers) Signed-off-by: dependabot[bot] --- yarn.lock | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/yarn.lock b/yarn.lock index 8cdd10db6e..a435ee5769 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2351,18 +2351,18 @@ tslib "~2.2.0" "@graphql-codegen/typescript-resolvers@^1.17.7": - version "1.18.2" - resolved "https://registry.npmjs.org/@graphql-codegen/typescript-resolvers/-/typescript-resolvers-1.18.2.tgz#7513b92df7c5a0d3c27342c591ada7340696cf8f" - integrity sha512-aWfRR5y1gXCPUNK7zaUiSbmceqidvZ38mNHIBvXmZArRigyz1QZgN26kKpXjJjtFbPvROPnlGsYcZBReybvZXA== + version "1.19.1" + resolved "https://registry.npmjs.org/@graphql-codegen/typescript-resolvers/-/typescript-resolvers-1.19.1.tgz#56677ec56c1ca7174d22a2f236e3fb7f6503e708" + integrity sha512-KdCVfg2u2RMbHu7eV9SOh5rmfnEQaMsQ0k8741bMbBmCESLnrWltujF2RT1OPN7WCn7xJejBtrFg/3UgT0fNug== dependencies: - "@graphql-codegen/plugin-helpers" "^1.18.2" - "@graphql-codegen/typescript" "^1.21.0" - "@graphql-codegen/visitor-plugin-common" "^1.18.3" + "@graphql-codegen/plugin-helpers" "^1.18.5" + "@graphql-codegen/typescript" "^1.22.0" + "@graphql-codegen/visitor-plugin-common" "^1.20.0" "@graphql-tools/utils" "^7.0.0" auto-bind "~4.0.0" - tslib "~2.1.0" + tslib "~2.2.0" -"@graphql-codegen/typescript@^1.17.7", "@graphql-codegen/typescript@^1.21.0": +"@graphql-codegen/typescript@^1.17.7", "@graphql-codegen/typescript@^1.22.0": version "1.22.0" resolved "https://registry.npmjs.org/@graphql-codegen/typescript/-/typescript-1.22.0.tgz#d05be3a971e5d75a076a43e123b6330f4366a6ab" integrity sha512-YzN/3MBYHrP110m8JgUWQIHt7Ivi3JXiq0RT5XNx/F9mVOSbZz6Ezbaji8YJA3y04Gl2f6ZgtdGazWANUvcOcg== @@ -2372,7 +2372,7 @@ auto-bind "~4.0.0" tslib "~2.2.0" -"@graphql-codegen/visitor-plugin-common@^1.18.3", "@graphql-codegen/visitor-plugin-common@^1.20.0": +"@graphql-codegen/visitor-plugin-common@^1.20.0": version "1.20.0" resolved "https://registry.npmjs.org/@graphql-codegen/visitor-plugin-common/-/visitor-plugin-common-1.20.0.tgz#38d829eab7370c79aa5229190788f94adcae8f76" integrity sha512-AYrpy8NA3DpvhDLqYGerQRv44S+YAMPKtwT8x9GNVjzP0gVfmqi3gG1bDWbP5sm6kOZKvDC0kTxGePuBSZerxw== @@ -2664,16 +2664,7 @@ camel-case "4.1.1" tslib "~2.0.1" -"@graphql-tools/utils@^7.0.0", "@graphql-tools/utils@^7.1.0": - version "7.2.6" - resolved "https://registry.npmjs.org/@graphql-tools/utils/-/utils-7.2.6.tgz#5d974cbdec5ddf4d7fdc593816335512ee5fe4de" - integrity sha512-/kY7Nb+cCHi/MvU3tjz3KrXzuJNWMlnn7EoWazLmpDvl6b2Qt69hlVoPd5zQtKlGib35zZw9NZ5zs5qTAw8Y9g== - dependencies: - "@ardatan/aggregate-error" "0.0.6" - camel-case "4.1.2" - tslib "~2.1.0" - -"@graphql-tools/utils@^7.1.2", "@graphql-tools/utils@^7.7.0": +"@graphql-tools/utils@^7.0.0", "@graphql-tools/utils@^7.1.0", "@graphql-tools/utils@^7.1.2", "@graphql-tools/utils@^7.7.0": version "7.7.1" resolved "https://registry.npmjs.org/@graphql-tools/utils/-/utils-7.7.1.tgz#81f32cb4819b34b3a378d51ab2cd60935977f0b4" integrity sha512-SFT4/dTfrwWer1wSOLU+jqgv3oa/xTR8q+MiNbE9nCH2FXyMsqIOaXKm9wHfKIWFWHozqBdcnwFkQZrdD7H2TQ== From ca1e981945926e370e9c8488a18e3e79f05b5a61 Mon Sep 17 00:00:00 2001 From: Oliver Sand Date: Fri, 7 May 2021 09:42:45 +0200 Subject: [PATCH 390/485] Fix typos Signed-off-by: Oliver Sand --- .changeset/polite-plants-exercise.md | 2 +- plugins/catalog-backend/config.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.changeset/polite-plants-exercise.md b/.changeset/polite-plants-exercise.md index 42df6875e6..ac4a8d1403 100644 --- a/.changeset/polite-plants-exercise.md +++ b/.changeset/polite-plants-exercise.md @@ -10,7 +10,7 @@ tokens and GitHub apps. This deprecates the `catalog.processors.githubOrg.providers` configuration. If you still have a configuration for providers the processor keeps working, but -consider moving the [`integrations` configuration](https://backstage.io/docs/integrations/github/locations) +consider moving to the [`integrations` configuration](https://backstage.io/docs/integrations/github/locations) as the providers will be removed in the future. You might need to allow additional scopes for the credentials. diff --git a/plugins/catalog-backend/config.d.ts b/plugins/catalog-backend/config.d.ts index a913473ff8..20fcd975cf 100644 --- a/plugins/catalog-backend/config.d.ts +++ b/plugins/catalog-backend/config.d.ts @@ -115,7 +115,7 @@ export interface Config { /** * GithubOrgReaderProcessor configuration * - * @deprecated Configure an GitHub integration instead. + * @deprecated Configure a GitHub integration instead. */ githubOrg?: { /** From 751bd6d3e8540580165661b43f72e357137c039e Mon Sep 17 00:00:00 2001 From: Oliver Sand Date: Fri, 7 May 2021 09:44:27 +0200 Subject: [PATCH 391/485] Add link in warn message Signed-off-by: Oliver Sand --- .../src/ingestion/processors/GithubOrgReaderProcessor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/catalog-backend/src/ingestion/processors/GithubOrgReaderProcessor.ts b/plugins/catalog-backend/src/ingestion/processors/GithubOrgReaderProcessor.ts index db61886b89..5840daed74 100644 --- a/plugins/catalog-backend/src/ingestion/processors/GithubOrgReaderProcessor.ts +++ b/plugins/catalog-backend/src/ingestion/processors/GithubOrgReaderProcessor.ts @@ -138,7 +138,7 @@ export class GithubOrgReaderProcessor implements CatalogProcessor { } this.logger.warn( - 'GithubOrgReaderProcessor uses provider defined in catalog.processors.githubOrg.providers, migrate to integrations instead.', + 'GithubOrgReaderProcessor uses provider defined in catalog.processors.githubOrg.providers, migrate to integrations instead. See https://backstage.io/docs/integrations/github/locations', ); return !provider.token From 3be844496c9c267cd57d8c26687a0c72dcfac6a1 Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 7 May 2021 10:09:22 +0200 Subject: [PATCH 392/485] chore(deps): add changeset for ts-node bump Signed-off-by: blam --- .changeset/calm-insects-melt.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/calm-insects-melt.md diff --git a/.changeset/calm-insects-melt.md b/.changeset/calm-insects-melt.md new file mode 100644 index 0000000000..4b17764c33 --- /dev/null +++ b/.changeset/calm-insects-melt.md @@ -0,0 +1,7 @@ +--- +'@backstage/cli': patch +'@backstage/create-app': patch +'@backstage/plugin-catalog-graphql': patch +--- + +chore: bump `ts-node` versions to 9.1.1 From bcf4c2f91d6c65505d961f4830c3952a42d74929 Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Fri, 7 May 2021 11:20:29 +0200 Subject: [PATCH 393/485] More package versions Signed-off-by: Marcus Eide --- plugins/shortcuts/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/shortcuts/package.json b/plugins/shortcuts/package.json index c65d51143f..7c60f54485 100644 --- a/plugins/shortcuts/package.json +++ b/plugins/shortcuts/package.json @@ -20,8 +20,8 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.7.6", - "@backstage/theme": "^0.2.6", + "@backstage/core": "^0.7.8", + "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.45", @@ -35,7 +35,7 @@ "zen-observable": "^0.8.15" }, "devDependencies": { - "@backstage/cli": "^0.6.9", + "@backstage/cli": "^0.6.10", "@backstage/dev-utils": "^0.1.13", "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", From 0b51bcb0084ff6566e96ceb96ad7562ce1a90bff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 May 2021 09:20:46 +0000 Subject: [PATCH 394/485] chore(deps): bump react-use from 15.3.8 to 17.2.4 Bumps [react-use](https://github.com/streamich/react-use) from 15.3.8 to 17.2.4. - [Release notes](https://github.com/streamich/react-use/releases) - [Changelog](https://github.com/streamich/react-use/blob/master/CHANGELOG.md) - [Commits](https://github.com/streamich/react-use/compare/v15.3.8...v17.2.4) Signed-off-by: dependabot[bot] --- packages/app/package.json | 2 +- packages/core-api/package.json | 2 +- packages/core/package.json | 2 +- packages/integration-react/package.json | 2 +- plugins/api-docs/package.json | 2 +- plugins/badges/package.json | 2 +- plugins/bitrise/package.json | 2 +- plugins/catalog-import/package.json | 2 +- plugins/catalog-react/package.json | 2 +- plugins/catalog/package.json | 2 +- plugins/circleci/package.json | 2 +- plugins/cloudbuild/package.json | 2 +- plugins/code-coverage/package.json | 2 +- plugins/config-schema/package.json | 2 +- plugins/cost-insights/package.json | 2 +- plugins/explore/package.json | 2 +- plugins/fossa/package.json | 2 +- plugins/gcp-projects/package.json | 2 +- plugins/github-actions/package.json | 2 +- plugins/github-deployments/package.json | 2 +- plugins/gitops-profiles/package.json | 2 +- plugins/graphiql/package.json | 2 +- plugins/jenkins/package.json | 2 +- plugins/kafka/package.json | 2 +- plugins/kubernetes/package.json | 2 +- plugins/lighthouse/package.json | 2 +- plugins/newrelic/package.json | 2 +- plugins/org/package.json | 2 +- plugins/pagerduty/package.json | 2 +- plugins/register-component/package.json | 2 +- plugins/rollbar/package.json | 2 +- plugins/scaffolder/package.json | 2 +- plugins/search/package.json | 2 +- plugins/sentry/package.json | 2 +- plugins/sonarqube/package.json | 2 +- plugins/splunk-on-call/package.json | 2 +- plugins/tech-radar/package.json | 2 +- plugins/techdocs/package.json | 2 +- plugins/todo/package.json | 2 +- plugins/user-settings/package.json | 2 +- plugins/welcome/package.json | 2 +- yarn.lock | 75 ++++--------------------- 42 files changed, 51 insertions(+), 106 deletions(-) diff --git a/packages/app/package.json b/packages/app/package.json index 8ddf249366..e05e520ab5 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -51,7 +51,7 @@ "react-hot-loader": "^4.12.21", "react-router": "6.0.0-beta.0", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3", + "react-use": "^17.2.4", "zen-observable": "^0.8.15" }, "devDependencies": { diff --git a/packages/core-api/package.json b/packages/core-api/package.json index a55df67343..13d7efe77b 100644 --- a/packages/core-api/package.json +++ b/packages/core-api/package.json @@ -38,7 +38,7 @@ "prop-types": "^15.7.2", "react": "^16.12.0", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3", + "react-use": "^17.2.4", "zen-observable": "^0.8.15" }, "devDependencies": { diff --git a/packages/core/package.json b/packages/core/package.json index 4da981d064..f8425c3289 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -65,7 +65,7 @@ "react-sparklines": "^1.7.0", "react-syntax-highlighter": "^15.4.3", "react-text-truncate": "^0.16.0", - "react-use": "^15.3.3", + "react-use": "^17.2.4", "remark-gfm": "^1.0.0", "zen-observable": "^0.8.15" }, diff --git a/packages/integration-react/package.json b/packages/integration-react/package.json index 9f33a25ac8..7833952e8e 100644 --- a/packages/integration-react/package.json +++ b/packages/integration-react/package.json @@ -29,7 +29,7 @@ "@material-ui/lab": "4.0.0-alpha.45", "react": "^16.13.1", "react-dom": "^16.13.1", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.3", diff --git a/plugins/api-docs/package.json b/plugins/api-docs/package.json index e8e8bb8774..9cccb07d56 100644 --- a/plugins/api-docs/package.json +++ b/plugins/api-docs/package.json @@ -45,7 +45,7 @@ "react-dom": "^16.13.1", "react-router": "6.0.0-beta.0", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3", + "react-use": "^17.2.4", "swagger-ui-react": "^3.37.2" }, "devDependencies": { diff --git a/plugins/badges/package.json b/plugins/badges/package.json index 7078b9627e..24660899e2 100644 --- a/plugins/badges/package.json +++ b/plugins/badges/package.json @@ -31,7 +31,7 @@ "react": "^16.13.1", "react-dom": "^16.13.1", "react-router": "6.0.0-beta.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/bitrise/package.json b/plugins/bitrise/package.json index cd0564dc41..45b32a11d1 100644 --- a/plugins/bitrise/package.json +++ b/plugins/bitrise/package.json @@ -33,7 +33,7 @@ "qs": "^6.9.6", "react": "^16.13.1", "react-dom": "^16.13.1", - "react-use": "^15.3.3", + "react-use": "^17.2.4", "recharts": "^1.8.5" }, "devDependencies": { diff --git a/plugins/catalog-import/package.json b/plugins/catalog-import/package.json index 2277604dc2..c5fcdd4d37 100644 --- a/plugins/catalog-import/package.json +++ b/plugins/catalog-import/package.json @@ -49,7 +49,7 @@ "react-hook-form": "^6.15.4", "react-router": "6.0.0-beta.0", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3", + "react-use": "^17.2.4", "yaml": "^1.10.0" }, "devDependencies": { diff --git a/plugins/catalog-react/package.json b/plugins/catalog-react/package.json index 1d886478b8..a9092ef75a 100644 --- a/plugins/catalog-react/package.json +++ b/plugins/catalog-react/package.json @@ -37,7 +37,7 @@ "react": "^16.13.1", "react-router": "6.0.0-beta.0", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/catalog/package.json b/plugins/catalog/package.json index 8277c2dcbc..f1a0e6979d 100644 --- a/plugins/catalog/package.json +++ b/plugins/catalog/package.json @@ -49,7 +49,7 @@ "react-helmet": "6.1.0", "react-router": "6.0.0-beta.0", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/circleci/package.json b/plugins/circleci/package.json index b87fb4bbbf..98af012a49 100644 --- a/plugins/circleci/package.json +++ b/plugins/circleci/package.json @@ -47,7 +47,7 @@ "react-lazylog": "^4.5.2", "react-router": "6.0.0-beta.0", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/cloudbuild/package.json b/plugins/cloudbuild/package.json index 98735f1c42..325dfb4e06 100644 --- a/plugins/cloudbuild/package.json +++ b/plugins/cloudbuild/package.json @@ -44,7 +44,7 @@ "react-lazylog": "^4.5.3", "react-router": "6.0.0-beta.0", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/code-coverage/package.json b/plugins/code-coverage/package.json index 241b61b296..9b227c1df1 100644 --- a/plugins/code-coverage/package.json +++ b/plugins/code-coverage/package.json @@ -35,7 +35,7 @@ "react-dom": "^16.13.1", "react-router": "6.0.0-beta.0", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3", + "react-use": "^17.2.4", "recharts": "^1.8.5" }, "devDependencies": { diff --git a/plugins/config-schema/package.json b/plugins/config-schema/package.json index 7877668065..caa03b9ffb 100644 --- a/plugins/config-schema/package.json +++ b/plugins/config-schema/package.json @@ -31,7 +31,7 @@ "zen-observable": "^0.8.15", "react": "^16.13.1", "react-dom": "^16.13.1", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/cost-insights/package.json b/plugins/cost-insights/package.json index 5d780080d1..3a5601041c 100644 --- a/plugins/cost-insights/package.json +++ b/plugins/cost-insights/package.json @@ -49,7 +49,7 @@ "react": "^16.13.1", "react-dom": "^16.13.1", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3", + "react-use": "^17.2.4", "recharts": "^1.8.5", "regression": "^2.0.1", "yup": "^0.29.3" diff --git a/plugins/explore/package.json b/plugins/explore/package.json index 35a4a97349..2a25a9db41 100644 --- a/plugins/explore/package.json +++ b/plugins/explore/package.json @@ -42,7 +42,7 @@ "react": "^16.13.1", "react-dom": "^16.13.1", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/fossa/package.json b/plugins/fossa/package.json index ee35b94c0b..95762e52d7 100644 --- a/plugins/fossa/package.json +++ b/plugins/fossa/package.json @@ -44,7 +44,7 @@ "p-limit": "^3.0.2", "react": "^16.13.1", "react-dom": "^16.13.1", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/gcp-projects/package.json b/plugins/gcp-projects/package.json index 96102332d9..fd6048ab2a 100644 --- a/plugins/gcp-projects/package.json +++ b/plugins/gcp-projects/package.json @@ -38,7 +38,7 @@ "react": "^16.13.1", "react-dom": "^16.13.1", "react-router-dom": "^6.0.0-beta.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/github-actions/package.json b/plugins/github-actions/package.json index 61de1a1f7d..95608c3c49 100644 --- a/plugins/github-actions/package.json +++ b/plugins/github-actions/package.json @@ -47,7 +47,7 @@ "react-lazylog": "^4.5.3", "react-router": "6.0.0-beta.0", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/github-deployments/package.json b/plugins/github-deployments/package.json index e67df926ea..84a0fe1660 100644 --- a/plugins/github-deployments/package.json +++ b/plugins/github-deployments/package.json @@ -31,7 +31,7 @@ "luxon": "^1.26.0", "react": "^16.13.1", "react-dom": "^16.13.1", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/gitops-profiles/package.json b/plugins/gitops-profiles/package.json index 866ee571c0..c00dbde482 100644 --- a/plugins/gitops-profiles/package.json +++ b/plugins/gitops-profiles/package.json @@ -39,7 +39,7 @@ "react": "^16.13.1", "react-dom": "^16.13.1", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/graphiql/package.json b/plugins/graphiql/package.json index d03a5f39e9..ae3c0dfe8f 100644 --- a/plugins/graphiql/package.json +++ b/plugins/graphiql/package.json @@ -40,7 +40,7 @@ "graphql": "15.5.0", "react": "^16.13.1", "react-dom": "^16.13.1", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/jenkins/package.json b/plugins/jenkins/package.json index 45bd3c4bf8..c4ba600d7e 100644 --- a/plugins/jenkins/package.json +++ b/plugins/jenkins/package.json @@ -44,7 +44,7 @@ "react-dom": "^16.13.1", "react-router": "6.0.0-beta.0", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/kafka/package.json b/plugins/kafka/package.json index ce3e7561b1..e405460262 100644 --- a/plugins/kafka/package.json +++ b/plugins/kafka/package.json @@ -30,7 +30,7 @@ "react": "^16.13.1", "react-dom": "^16.13.1", "react-router": "6.0.0-beta.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/kubernetes/package.json b/plugins/kubernetes/package.json index 8028c3a339..19865a6fcc 100644 --- a/plugins/kubernetes/package.json +++ b/plugins/kubernetes/package.json @@ -46,7 +46,7 @@ "react": "^16.13.1", "react-dom": "^16.13.1", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/lighthouse/package.json b/plugins/lighthouse/package.json index a6ae0102bf..f70e29f69b 100644 --- a/plugins/lighthouse/package.json +++ b/plugins/lighthouse/package.json @@ -43,7 +43,7 @@ "react": "^16.13.1", "react-dom": "^16.13.1", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/newrelic/package.json b/plugins/newrelic/package.json index dfe5217f9d..20ee5521f4 100644 --- a/plugins/newrelic/package.json +++ b/plugins/newrelic/package.json @@ -38,7 +38,7 @@ "@material-ui/lab": "4.0.0-alpha.45", "react": "^16.13.1", "react-dom": "^16.13.1", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/org/package.json b/plugins/org/package.json index 2b802510f4..012514f1c4 100644 --- a/plugins/org/package.json +++ b/plugins/org/package.json @@ -32,7 +32,7 @@ "react-dom": "^16.13.1", "react-router": "6.0.0-beta.0", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/pagerduty/package.json b/plugins/pagerduty/package.json index 0005b9aa3b..53f0ddbb23 100644 --- a/plugins/pagerduty/package.json +++ b/plugins/pagerduty/package.json @@ -43,7 +43,7 @@ "react": "^16.13.1", "react-dom": "^16.13.1", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/register-component/package.json b/plugins/register-component/package.json index 5052fd3342..3efb61b982 100644 --- a/plugins/register-component/package.json +++ b/plugins/register-component/package.json @@ -42,7 +42,7 @@ "react-hook-form": "^6.15.4", "react-router": "6.0.0-beta.0", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/rollbar/package.json b/plugins/rollbar/package.json index 5563ad0e40..8b559e0bf1 100644 --- a/plugins/rollbar/package.json +++ b/plugins/rollbar/package.json @@ -44,7 +44,7 @@ "react-router": "6.0.0-beta.0", "react-router-dom": "6.0.0-beta.0", "react-sparklines": "^1.7.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/scaffolder/package.json b/plugins/scaffolder/package.json index 9cf7c01d02..1992028157 100644 --- a/plugins/scaffolder/package.json +++ b/plugins/scaffolder/package.json @@ -55,7 +55,7 @@ "react-lazylog": "^4.5.2", "react-router": "6.0.0-beta.0", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3", + "react-use": "^17.2.4", "use-immer": "^0.5.1", "zen-observable": "^0.8.15" }, diff --git a/plugins/search/package.json b/plugins/search/package.json index b135d184f6..f503b9a78e 100644 --- a/plugins/search/package.json +++ b/plugins/search/package.json @@ -41,7 +41,7 @@ "react": "^16.13.1", "react-dom": "^16.13.1", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/sentry/package.json b/plugins/sentry/package.json index a5b1ac7d68..6784debcf9 100644 --- a/plugins/sentry/package.json +++ b/plugins/sentry/package.json @@ -42,7 +42,7 @@ "react-dom": "^16.13.1", "react-router": "6.0.0-beta.0", "react-sparklines": "^1.7.0", - "react-use": "^15.3.3", + "react-use": "^17.2.4", "timeago.js": "^4.0.2" }, "devDependencies": { diff --git a/plugins/sonarqube/package.json b/plugins/sonarqube/package.json index 648f945e03..df5304d746 100644 --- a/plugins/sonarqube/package.json +++ b/plugins/sonarqube/package.json @@ -44,7 +44,7 @@ "rc-progress": "^3.0.0", "react": "^16.13.1", "react-dom": "^16.13.1", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/splunk-on-call/package.json b/plugins/splunk-on-call/package.json index 63fb68c0b2..020fbc37cd 100644 --- a/plugins/splunk-on-call/package.json +++ b/plugins/splunk-on-call/package.json @@ -42,7 +42,7 @@ "react": "^16.13.1", "react-dom": "^16.13.1", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/tech-radar/package.json b/plugins/tech-radar/package.json index 2a2619bbc4..5e33024f87 100644 --- a/plugins/tech-radar/package.json +++ b/plugins/tech-radar/package.json @@ -40,7 +40,7 @@ "prop-types": "^15.7.2", "react": "^16.13.1", "react-dom": "^16.13.1", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/techdocs/package.json b/plugins/techdocs/package.json index 380eae2737..20fca364da 100644 --- a/plugins/techdocs/package.json +++ b/plugins/techdocs/package.json @@ -47,7 +47,7 @@ "react-dom": "^16.13.1", "react-router": "6.0.0-beta.0", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3", + "react-use": "^17.2.4", "sanitize-html": "^2.3.2" }, "devDependencies": { diff --git a/plugins/todo/package.json b/plugins/todo/package.json index aac15e9ad6..b7564f7080 100644 --- a/plugins/todo/package.json +++ b/plugins/todo/package.json @@ -36,7 +36,7 @@ "@material-ui/lab": "4.0.0-alpha.45", "react": "^16.13.1", "react-dom": "^16.13.1", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/user-settings/package.json b/plugins/user-settings/package.json index 3349319442..32e232cad4 100644 --- a/plugins/user-settings/package.json +++ b/plugins/user-settings/package.json @@ -38,7 +38,7 @@ "react": "^16.13.1", "react-dom": "^16.13.1", "react-router": "6.0.0-beta.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/plugins/welcome/package.json b/plugins/welcome/package.json index 90cdb3dc0f..72ec24bf71 100644 --- a/plugins/welcome/package.json +++ b/plugins/welcome/package.json @@ -38,7 +38,7 @@ "react": "^16.13.1", "react-dom": "^16.13.1", "react-router-dom": "6.0.0-beta.0", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.6.10", diff --git a/yarn.lock b/yarn.lock index a435ee5769..2cf1551fed 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8874,11 +8874,6 @@ boolbase@^1.0.0, boolbase@~1.0.0: resolved "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24= -bowser@^1.7.3: - version "1.9.4" - resolved "https://registry.npmjs.org/bowser/-/bowser-1.9.4.tgz#890c58a2813a9d3243704334fa81b96a5c150c9a" - integrity sha512-9IdMmj2KjigRq6oWhmwv1W36pDuA4STQZ8q6YO9um+x07xgYNCD3Oou+WP/3L1HNz7iqythGet3/p4wvc8AAwQ== - boxen@^1.3.0: version "1.3.0" resolved "https://registry.npmjs.org/boxen/-/boxen-1.3.0.tgz#55c6c39a8ba58d9c61ad22cd877532deb665a20b" @@ -10811,14 +10806,6 @@ css-tree@1.0.0-alpha.37: mdn-data "2.0.4" source-map "^0.6.1" -css-tree@^1.0.0-alpha.28: - version "1.0.0-alpha.39" - resolved "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.39.tgz#2bff3ffe1bb3f776cf7eefd91ee5cba77a149eeb" - integrity sha512-7UvkEYgBAHRG9Nt980lYxjsTrCyHFN53ky3wVsDkiMdVqylqRt+Zc+jm5qw7/qyOvN2dHSYtX0e4MbCCExSvnA== - dependencies: - mdn-data "2.0.6" - source-map "^0.6.1" - css-tree@^1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/css-tree/-/css-tree-1.1.2.tgz#9ae393b5dafd7dae8a622475caec78d3d8fbd7b5" @@ -10973,7 +10960,7 @@ cssstyle@^2.2.0: dependencies: cssom "~0.3.6" -csstype@^2.2.0, csstype@^2.5.2, csstype@^2.5.5, csstype@^2.5.7, csstype@^2.6.7: +csstype@^2.2.0, csstype@^2.5.2, csstype@^2.5.7, csstype@^2.6.7: version "2.6.9" resolved "https://registry.npmjs.org/csstype/-/csstype-2.6.9.tgz#05141d0cd557a56b8891394c1911c40c8a98d098" integrity sha512-xz39Sb4+OaTsULgUERcCk+TJj8ylkL4aSVDQiX/ksxbELSqwkgt4d4RD7fovIdgJGSuNYqwZEiVjYY5l0ask+Q== @@ -13195,11 +13182,6 @@ fast-text-encoding@^1.0.0, fast-text-encoding@^1.0.3: resolved "https://registry.npmjs.org/fast-text-encoding/-/fast-text-encoding-1.0.3.tgz#ec02ac8e01ab8a319af182dae2681213cfe9ce53" integrity sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig== -fastest-stable-stringify@^1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/fastest-stable-stringify/-/fastest-stable-stringify-1.0.1.tgz#9122d406d4c9d98bea644a6b6853d5874b87b028" - integrity sha1-kSLUBtTJ2YvqZEpraFPVh0uHsCg= - fastest-stable-stringify@^2.0.2: version "2.0.2" resolved "https://registry.npmjs.org/fastest-stable-stringify/-/fastest-stable-stringify-2.0.2.tgz#3757a6774f6ec8de40c4e86ec28ea02417214c76" @@ -15427,14 +15409,6 @@ init-package-json@^2.0.2: validate-npm-package-license "^3.0.4" validate-npm-package-name "^3.0.0" -inline-style-prefixer@^4.0.0: - version "4.0.2" - resolved "https://registry.npmjs.org/inline-style-prefixer/-/inline-style-prefixer-4.0.2.tgz#d390957d26f281255fe101da863158ac6eb60911" - integrity sha512-N8nVhwfYga9MiV9jWlwfdj1UDIaZlBFu4cJSJkIr7tZX7sHpHhGR5su1qdpW+7KPL8ISTvCIkcaFi/JdBknvPg== - dependencies: - bowser "^1.7.3" - css-in-js-utils "^2.0.0" - inline-style-prefixer@^6.0.0: version "6.0.0" resolved "https://registry.npmjs.org/inline-style-prefixer/-/inline-style-prefixer-6.0.0.tgz#f73d5dbf2855733d6b153a4d24b7b47a73e9770b" @@ -18352,11 +18326,6 @@ mdn-data@2.0.4: resolved "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.4.tgz#699b3c38ac6f1d728091a64650b65d388502fd5b" integrity sha512-iV3XNKw06j5Q7mi6h+9vbx23Tv7JkjEVgKHW4pimwyDGWm0OIQntJJ+u1C6mg6mK1EaTv42XQ7w76yuzH7M2cA== -mdn-data@2.0.6: - version "2.0.6" - resolved "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.6.tgz#852dc60fcaa5daa2e8cf6c9189c440ed3e042978" - integrity sha512-rQvjv71olwNHgiTbfPZFkJtjNMciWgswYeciZhtvWLO8bmX3TnhyA62I6sTWOyZssWHJJjY6/KiWwqQsWWsqOA== - mdurl@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" @@ -19064,21 +19033,7 @@ nan@2.14.1, nan@^2.12.1, nan@^2.14.0: resolved "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz#d7be34dfa3105b91494c3147089315eff8874b01" integrity sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw== -nano-css@^5.1.0, nano-css@^5.2.1: - version "5.3.0" - resolved "https://registry.npmjs.org/nano-css/-/nano-css-5.3.0.tgz#9d3cd29788d48b6a07f52aa4aec7cf4da427b6b5" - integrity sha512-uM/9NGK9/E9/sTpbIZ/bQ9xOLOIHZwrrb/CRlbDHBU/GFS7Gshl24v/WJhwsVViWkpOXUmiZ66XO7fSB4Wd92Q== - dependencies: - css-tree "^1.0.0-alpha.28" - csstype "^2.5.5" - fastest-stable-stringify "^1.0.1" - inline-style-prefixer "^4.0.0" - rtl-css-js "^1.9.0" - sourcemap-codec "^1.4.1" - stacktrace-js "^2.0.0" - stylis "3.5.0" - -nano-css@^5.3.1: +nano-css@^5.1.0, nano-css@^5.2.1, nano-css@^5.3.1: version "5.3.1" resolved "https://registry.npmjs.org/nano-css/-/nano-css-5.3.1.tgz#b709383e07ad3be61f64edffacb9d98250b87a1f" integrity sha512-ENPIyNzANQRyYVvb62ajDd7PAyIgS2LIUnT9ewih4yrXSZX4hKoUwssy8WjUH++kEOA5wUTMgNnV7ko5n34kUA== @@ -22426,10 +22381,10 @@ react-use@^15.3.3, react-use@^15.3.6: ts-easing "^0.2.0" tslib "^2.0.0" -react-use@^17.2.1: - version "17.2.1" - resolved "https://registry.npmjs.org/react-use/-/react-use-17.2.1.tgz#c81e12544115ed049c7deba1e3bb3d977dfee9b8" - integrity sha512-9r51/at7/Nr/nEP4CsHz+pl800EAqhIY9R6O68m68kaWc8slDAfx1UrIedQqpsb4ImddFYb+6hF1i5Vj4u4Cnw== +react-use@^17.2.1, react-use@^17.2.4: + version "17.2.4" + resolved "https://registry.npmjs.org/react-use/-/react-use-17.2.4.tgz#1f89be3db0a8237c79253db0a15e12bbe3cfeff1" + integrity sha512-vQGpsAM0F5UIlshw5UI8ULGPS4yn5rm7/qvn3T1Gnkrz7YRMEEMh+ynKcmRloOyiIeLvKWiQjMiwRGtdbgs5qQ== dependencies: "@types/js-cookie" "^2.2.6" "@xobotyi/scrollbar-width" "^1.9.5" @@ -23337,7 +23292,7 @@ rsvp@^4.8.4: resolved "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" integrity sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA== -rtl-css-js@^1.14.0, rtl-css-js@^1.9.0: +rtl-css-js@^1.14.0: version "1.14.0" resolved "https://registry.npmjs.org/rtl-css-js/-/rtl-css-js-1.14.0.tgz#daa4f192a92509e292a0519f4b255e6e3c076b7d" integrity sha512-Dl5xDTeN3e7scU1cWX8c9b6/Nqz3u/HgR4gePc1kWXYiQWVQbKCEyK6+Hxve9LbcJ5EieHy1J9nJCN3grTtGwg== @@ -23494,12 +23449,7 @@ schema-utils@^3.0.0: ajv "^6.12.5" ajv-keywords "^3.5.2" -screenfull@^5.0.0: - version "5.0.2" - resolved "https://registry.npmjs.org/screenfull/-/screenfull-5.0.2.tgz#b9acdcf1ec676a948674df5cd0ff66b902b0bed7" - integrity sha512-cCF2b+L/mnEiORLN5xSAz6H3t18i2oHh9BA8+CQlAh5DRw2+NFAGQJOSYbcGw8B2k04g/lVvFcfZ83b3ysH5UQ== - -screenfull@^5.1.0: +screenfull@^5.0.0, screenfull@^5.1.0: version "5.1.0" resolved "https://registry.npmjs.org/screenfull/-/screenfull-5.1.0.tgz#85c13c70f4ead4c1b8a935c70010dfdcd2c0e5c8" integrity sha512-dYaNuOdzr+kc6J6CFcBrzkLCfyGcMg+gWkJ8us93IQ7y1cevhQAugFsaCdMHb6lw8KV3xPzSxzH7zM1dQap9mA== @@ -24069,7 +24019,7 @@ source-map@^0.7.3: resolved "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== -sourcemap-codec@^1.4.1, sourcemap-codec@^1.4.4, sourcemap-codec@^1.4.8: +sourcemap-codec@^1.4.4, sourcemap-codec@^1.4.8: version "1.4.8" resolved "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== @@ -24302,7 +24252,7 @@ stacktrace-gps@^3.0.4: source-map "0.5.6" stackframe "^1.1.1" -stacktrace-js@^2.0.0, stacktrace-js@^2.0.2: +stacktrace-js@^2.0.2: version "2.0.2" resolved "https://registry.npmjs.org/stacktrace-js/-/stacktrace-js-2.0.2.tgz#4ca93ea9f494752d55709a081d400fdaebee897b" integrity sha512-Je5vBeY4S1r/RnLydLl0TBTi3F2qdfWmYsGvtfZgEI+SCprPppaIhQf5nGcal4gI4cGpCV/duLcAzT1np6sQqg== @@ -24722,11 +24672,6 @@ stylehacks@^4.0.0: postcss "^7.0.0" postcss-selector-parser "^3.0.0" -stylis@3.5.0: - version "3.5.0" - resolved "https://registry.npmjs.org/stylis/-/stylis-3.5.0.tgz#016fa239663d77f868fef5b67cf201c4b7c701e1" - integrity sha512-pP7yXN6dwMzAR29Q0mBrabPCe0/mNO1MSr93bhay+hcZondvMMTpeGyd8nbhYJdyperNT2DRxONQuUGcJr5iPw== - stylis@^4.0.6: version "4.0.7" resolved "https://registry.npmjs.org/stylis/-/stylis-4.0.7.tgz#412a90c28079417f3d27c028035095e4232d2904" From 4d9a337a4a4d7a35f7673f17afd8174abc291241 Mon Sep 17 00:00:00 2001 From: Oliver Sand Date: Fri, 7 May 2021 11:54:12 +0200 Subject: [PATCH 395/485] Restore `debounceTime` and mark it as deprecated Signed-off-by: Oliver Sand --- packages/core/src/hooks/useQueryParamState.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/src/hooks/useQueryParamState.ts b/packages/core/src/hooks/useQueryParamState.ts index 023d69bf4f..944e73bf39 100644 --- a/packages/core/src/hooks/useQueryParamState.ts +++ b/packages/core/src/hooks/useQueryParamState.ts @@ -58,6 +58,8 @@ type SetQueryParams = (params: T) => void; export function useQueryParamState( stateName: string, + /** @depracated Don't configure a custom debouceTime */ + debounceTime: number = 250, ): [T | undefined, SetQueryParams] { const [searchParams, setSearchParams] = useSearchParams(); const searchParamsString = searchParams.toString(); @@ -85,7 +87,7 @@ export function useQueryParamState( setSearchParams(queryString, { replace: true }); } }, - 100, + debounceTime, [setSearchParams, queryParamState, searchParamsString, stateName], ); From add75e7a5b074b1af1063bdacf369d64ee4e697f Mon Sep 17 00:00:00 2001 From: Julian Pearce Date: Fri, 7 May 2021 11:42:03 +0100 Subject: [PATCH 396/485] generate API report Signed-off-by: Julian Pearce --- packages/catalog-model/api-report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/catalog-model/api-report.md b/packages/catalog-model/api-report.md index c37c86b01f..2b56879f48 100644 --- a/packages/catalog-model/api-report.md +++ b/packages/catalog-model/api-report.md @@ -514,7 +514,7 @@ export interface TemplateEntityV1beta2 extends Entity { id?: string; name?: string; action: string; - parameters?: JsonObject; + input?: JsonObject; }>; output?: { [name: string]: string; From fb30cfad11b35ef6af50a81204aa204f46f9f26c Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Fri, 7 May 2021 13:09:24 +0200 Subject: [PATCH 397/485] Replace readGitHubIntegrationConfigs with ScmIntegrations.fromConfig Signed-off-by: Erik Engervall --- .../src/api/GitReleaseClient.test.ts | 2 +- .../src/api/GitReleaseClient.ts | 53 +++++++++++++------ 2 files changed, 37 insertions(+), 18 deletions(-) diff --git a/plugins/git-release-manager/src/api/GitReleaseClient.test.ts b/plugins/git-release-manager/src/api/GitReleaseClient.test.ts index c5b03b3c13..1b7cc7876a 100644 --- a/plugins/git-release-manager/src/api/GitReleaseClient.test.ts +++ b/plugins/git-release-manager/src/api/GitReleaseClient.test.ts @@ -31,7 +31,7 @@ describe('GitReleaseClient', () => { expect(gitReleaseClient).toMatchInlineSnapshot(` GitReleaseClient { - "baseUrl": "https://api.github.com", + "apiBaseUrl": "https://api.github.com", "createCommit": [Function], "createRef": [Function], "createRelease": [Function], diff --git a/plugins/git-release-manager/src/api/GitReleaseClient.ts b/plugins/git-release-manager/src/api/GitReleaseClient.ts index 602fb99a5c..9de3ce51f7 100644 --- a/plugins/git-release-manager/src/api/GitReleaseClient.ts +++ b/plugins/git-release-manager/src/api/GitReleaseClient.ts @@ -16,15 +16,16 @@ import { ConfigApi, OAuthApi } from '@backstage/core'; import { Octokit } from '@octokit/rest'; -import { readGitHubIntegrationConfigs } from '@backstage/integration'; +import { ScmIntegrations } from '@backstage/integration'; import { DISABLE_CACHE } from '../constants/constants'; import { Project } from '../contexts/ProjectContext'; import { UnboxArray, UnboxReturnedPromise } from '../types/helpers'; +import { GitReleaseManagerError } from '../errors/GitReleaseManagerError'; export class GitReleaseClient implements GitReleaseApi { private readonly githubAuthApi: OAuthApi; - private readonly baseUrl: string; + private readonly apiBaseUrl: string; readonly host: string; constructor({ @@ -36,27 +37,45 @@ export class GitReleaseClient implements GitReleaseApi { }) { this.githubAuthApi = githubAuthApi; - const githubIntegrationConfig = this.getGithubIntegrationConfig({ - configApi, - }); + const { host, apiBaseUrl } = this.getGithubIntegrationConfig({ configApi }); - this.host = githubIntegrationConfig?.host ?? 'github.com'; - this.baseUrl = - githubIntegrationConfig?.apiBaseUrl ?? 'https://api.github.com'; + this.host = host; + this.apiBaseUrl = apiBaseUrl; } private getGithubIntegrationConfig({ configApi }: { configApi: ConfigApi }) { - const configs = readGitHubIntegrationConfigs( - configApi.getOptionalConfigArray('integrations.github') ?? [], + const integrations = ScmIntegrations.fromConfig(configApi); + const githubIntegrations = integrations.github.list(); + + const defaultIntegration = githubIntegrations.find( + ({ config: { host } }) => host === 'github.com', + ); + const enterpriseIntegration = githubIntegrations.find( + ({ config: { host } }) => host !== 'github.com', ); - const githubIntegrationEnterpriseConfig = configs.find(v => - v.host.startsWith('ghe.'), - ); - const githubIntegrationConfig = configs.find(v => v.host === 'github.com'); + const host = + enterpriseIntegration?.config.host ?? defaultIntegration?.config.host; + const apiBaseUrl = + enterpriseIntegration?.config.apiBaseUrl ?? + defaultIntegration?.config.apiBaseUrl; - // Prioritize enterprise configs if available - return githubIntegrationEnterpriseConfig ?? githubIntegrationConfig; + if (!host) { + throw new GitReleaseManagerError( + 'Invalid API configuration: missing host', + ); + } + + if (!apiBaseUrl) { + throw new GitReleaseManagerError( + 'Invalid API configuration: missing apiBaseUrl', + ); + } + + return { + host, + apiBaseUrl, + }; } private async getOctokit() { @@ -65,7 +84,7 @@ export class GitReleaseClient implements GitReleaseApi { return { octokit: new Octokit({ auth: token, - baseUrl: this.baseUrl, + baseUrl: this.apiBaseUrl, }), }; } From 9eabe20696e1c824616501df35fc7c5a4b63280b Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 7 May 2021 13:27:05 +0200 Subject: [PATCH 398/485] chore: new plugins should use later versions of react-use Signed-off-by: blam --- packages/cli/templates/default-plugin/package.json.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/templates/default-plugin/package.json.hbs b/packages/cli/templates/default-plugin/package.json.hbs index 49eda9e0eb..1b4f8ea6ab 100644 --- a/packages/cli/templates/default-plugin/package.json.hbs +++ b/packages/cli/templates/default-plugin/package.json.hbs @@ -31,7 +31,7 @@ "@material-ui/lab": "4.0.0-alpha.45", "react": "^16.13.1", "react-dom": "^16.13.1", - "react-use": "^15.3.3" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^{{version '@backstage/cli'}}", From 675a569a99fffcf313e3d08148a754ec51027276 Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 7 May 2021 13:27:29 +0200 Subject: [PATCH 399/485] chore(deps): added changeset for dep bump Signed-off-by: blam --- .changeset/ten-paws-ring.md | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .changeset/ten-paws-ring.md diff --git a/.changeset/ten-paws-ring.md b/.changeset/ten-paws-ring.md new file mode 100644 index 0000000000..8ed2158f6c --- /dev/null +++ b/.changeset/ten-paws-ring.md @@ -0,0 +1,44 @@ +--- +'@backstage/core': patch +'@backstage/core-api': patch +'@backstage/integration-react': patch +'@backstage/plugin-api-docs': patch +'@backstage/plugin-badges': patch +'@backstage/plugin-bitrise': patch +'@backstage/plugin-catalog': patch +'@backstage/plugin-catalog-import': patch +'@backstage/plugin-catalog-react': patch +'@backstage/plugin-circleci': patch +'@backstage/plugin-cloudbuild': patch +'@backstage/plugin-code-coverage': patch +'@backstage/plugin-config-schema': patch +'@backstage/plugin-cost-insights': patch +'@backstage/plugin-explore': patch +'@backstage/plugin-fossa': patch +'@backstage/plugin-gcp-projects': patch +'@backstage/plugin-github-actions': patch +'@backstage/plugin-github-deployments': patch +'@backstage/plugin-gitops-profiles': patch +'@backstage/plugin-graphiql': patch +'@backstage/plugin-jenkins': patch +'@backstage/plugin-kafka': patch +'@backstage/plugin-kubernetes': patch +'@backstage/plugin-lighthouse': patch +'@backstage/plugin-newrelic': patch +'@backstage/plugin-org': patch +'@backstage/plugin-pagerduty': patch +'@backstage/plugin-register-component': patch +'@backstage/plugin-rollbar': patch +'@backstage/plugin-scaffolder': patch +'@backstage/plugin-search': patch +'@backstage/plugin-sentry': patch +'@backstage/plugin-sonarqube': patch +'@backstage/plugin-splunk-on-call': patch +'@backstage/plugin-tech-radar': patch +'@backstage/plugin-techdocs': patch +'@backstage/plugin-todo': patch +'@backstage/plugin-user-settings': patch +'@backstage/plugin-welcome': patch +--- + +chore: bump `react-use` dependency in all packages From e3fc89df6edc43c8b2f7094a6fb6846c24ba65fc Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 7 May 2021 13:28:41 +0200 Subject: [PATCH 400/485] chore: added changeset for cli changes Signed-off-by: blam --- .changeset/ninety-pots-guess.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/ninety-pots-guess.md diff --git a/.changeset/ninety-pots-guess.md b/.changeset/ninety-pots-guess.md new file mode 100644 index 0000000000..4b9a770c29 --- /dev/null +++ b/.changeset/ninety-pots-guess.md @@ -0,0 +1,5 @@ +--- +'@backstage/cli': patch +--- + +update plugins created to use react-use 17.2.4 From 3e3d5572fe3062c9592670321d1d79deffd989a0 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Fri, 7 May 2021 13:36:59 +0200 Subject: [PATCH 401/485] catalog/next: Fix postgres type error when deleting entries Signed-off-by: Johan Haals --- .../src/next/database/DefaultProcessingDatabase.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts index dc5e6036f5..140c93929d 100644 --- a/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts +++ b/plugins/catalog-backend/src/next/database/DefaultProcessingDatabase.ts @@ -185,7 +185,7 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { ), -- All the nodes that can be reached upwards from the descendants ancestors(root_id, via_entity_ref, to_entity_ref) AS ( - SELECT NULL, entity_ref, entity_ref + SELECT CAST(NULL as INT), entity_ref, entity_ref FROM descendants UNION SELECT @@ -235,7 +235,7 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { .withRecursive('ancestors', function ancestors(outer) { return outer .select({ - root_id: tx.raw('NULL', []), + root_id: tx.raw('CAST(NULL as INT)', []), via_entity_ref: 'entity_ref', to_entity_ref: 'entity_ref', }) From 6f57e2df67494f596dcdaed3f401a2e5487ae4c0 Mon Sep 17 00:00:00 2001 From: Oliver Sand Date: Fri, 7 May 2021 15:09:12 +0200 Subject: [PATCH 402/485] Fix typo Signed-off-by: Oliver Sand --- packages/core/src/hooks/useQueryParamState.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/hooks/useQueryParamState.ts b/packages/core/src/hooks/useQueryParamState.ts index 944e73bf39..173993a466 100644 --- a/packages/core/src/hooks/useQueryParamState.ts +++ b/packages/core/src/hooks/useQueryParamState.ts @@ -58,7 +58,7 @@ type SetQueryParams = (params: T) => void; export function useQueryParamState( stateName: string, - /** @depracated Don't configure a custom debouceTime */ + /** @deprecated Don't configure a custom debouceTime */ debounceTime: number = 250, ): [T | undefined, SetQueryParams] { const [searchParams, setSearchParams] = useSearchParams(); From 1abb1d1e7baf0fbb3cb2c09d8b8a1655037ed4d8 Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Fri, 7 May 2021 15:24:13 +0200 Subject: [PATCH 403/485] Add support for skipTLSVerify when using the GkeClusterLocator Signed-off-by: Marcus Eide --- .../src/cluster-locator/GkeClusterLocator.ts | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/plugins/kubernetes-backend/src/cluster-locator/GkeClusterLocator.ts b/plugins/kubernetes-backend/src/cluster-locator/GkeClusterLocator.ts index 7bfd62ef8d..b2bdc3bca8 100644 --- a/plugins/kubernetes-backend/src/cluster-locator/GkeClusterLocator.ts +++ b/plugins/kubernetes-backend/src/cluster-locator/GkeClusterLocator.ts @@ -18,28 +18,28 @@ import { Config } from '@backstage/config'; import * as container from '@google-cloud/container'; import { ClusterDetails, KubernetesClustersSupplier } from '../types/types'; -export class GkeClusterLocator implements KubernetesClustersSupplier { - private readonly projectId: string; - private readonly region: string | undefined; - private readonly client: container.v1.ClusterManagerClient; +type GkeClusterLocatorOptions = { + projectId: string; + region?: string; + skipTLSVerify?: boolean; +}; +export class GkeClusterLocator implements KubernetesClustersSupplier { constructor( - projectId: string, - client: container.v1.ClusterManagerClient, - region?: string, - ) { - this.projectId = projectId; - this.region = region; - this.client = client; - } + private readonly options: GkeClusterLocatorOptions, + private readonly client: container.v1.ClusterManagerClient, + ) {} static fromConfigWithClient( config: Config, client: container.v1.ClusterManagerClient, ): GkeClusterLocator { - const projectId = config.getString('projectId'); - const region = config.getOptionalString('region'); - return new GkeClusterLocator(projectId, client, region); + const options = { + projectId: config.getString('projectId'), + region: config.getOptionalString('region') ?? '-', + skipTLSVerify: config.getOptionalBoolean('skipTLSVerify') ?? false, + }; + return new GkeClusterLocator(options, client); } static fromConfig(config: Config): GkeClusterLocator { @@ -50,9 +50,9 @@ export class GkeClusterLocator implements KubernetesClustersSupplier { } async getClusters(): Promise { - const region = this.region ?? '-'; + const { projectId, region, skipTLSVerify } = this.options; const request = { - parent: `projects/${this.projectId}/locations/${region}`, + parent: `projects/${projectId}/locations/${region}`, }; try { @@ -62,10 +62,11 @@ export class GkeClusterLocator implements KubernetesClustersSupplier { name: r.name ?? 'unknown', url: `https://${r.endpoint ?? ''}`, authProvider: 'google', + skipTLSVerify, })); } catch (e) { throw new Error( - `There was an error retrieving clusters from GKE for projectId=${this.projectId} region=${region} : [${e.message}]`, + `There was an error retrieving clusters from GKE for projectId=${projectId} region=${region} : [${e.message}]`, ); } } From 2723253d7e0e35cfe01ebc648f1bf84edc239b26 Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Fri, 7 May 2021 15:24:52 +0200 Subject: [PATCH 404/485] Update documentation Signed-off-by: Marcus Eide --- docs/features/kubernetes/configuration.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/features/kubernetes/configuration.md b/docs/features/kubernetes/configuration.md index 5dbad9cf4a..45ef28ea2f 100644 --- a/docs/features/kubernetes/configuration.md +++ b/docs/features/kubernetes/configuration.md @@ -33,6 +33,7 @@ kubernetes: - type: 'gke' projectId: 'gke-clusters' region: 'europe-west1' + skipTLSVerify: true ``` ### `serviceLocatorMethod` @@ -129,6 +130,11 @@ The Google Cloud project to look for Kubernetes clusters in. The Google Cloud region to look for Kubernetes clusters in. Defaults to all regions. +##### `skipTLSVerify` + +This determines whether or not the Kubernetes client verifies the TLS +certificate presented by the API server. Defaults to `false`. + ### `customResources` (optional) Configures which [custom resources][3] to look for when returning an entity's From 7ee8ad08fd2e503b5444083505bf1eb0cb9fe329 Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Fri, 7 May 2021 15:25:25 +0200 Subject: [PATCH 405/485] Fix tests Signed-off-by: Marcus Eide --- .../src/cluster-locator/GkeClusterLocator.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/kubernetes-backend/src/cluster-locator/GkeClusterLocator.test.ts b/plugins/kubernetes-backend/src/cluster-locator/GkeClusterLocator.test.ts index cf555bd8c9..f45368479c 100644 --- a/plugins/kubernetes-backend/src/cluster-locator/GkeClusterLocator.test.ts +++ b/plugins/kubernetes-backend/src/cluster-locator/GkeClusterLocator.test.ts @@ -106,6 +106,7 @@ describe('GkeClusterLocator', () => { authProvider: 'google', name: 'some-cluster', url: 'https://1.2.3.4', + skipTLSVerify: false, }, ]); expect(mockedListClusters).toBeCalledTimes(1); @@ -141,6 +142,7 @@ describe('GkeClusterLocator', () => { authProvider: 'google', name: 'some-cluster', url: 'https://1.2.3.4', + skipTLSVerify: false, }, ]); expect(mockedListClusters).toBeCalledTimes(1); @@ -181,11 +183,13 @@ describe('GkeClusterLocator', () => { authProvider: 'google', name: 'some-cluster', url: 'https://1.2.3.4', + skipTLSVerify: false, }, { authProvider: 'google', name: 'some-other-cluster', url: 'https://6.7.8.9', + skipTLSVerify: false, }, ]); expect(mockedListClusters).toBeCalledTimes(1); From bc551b5f465585558042d40b9c6db6fb60cb2cb9 Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Fri, 7 May 2021 15:39:39 +0200 Subject: [PATCH 406/485] Use config schema inline instead Signed-off-by: Marcus Eide --- plugins/kubernetes-backend/schema.d.ts | 37 ++++++++++++++-- plugins/kubernetes-backend/src/types/types.ts | 44 ------------------- 2 files changed, 33 insertions(+), 48 deletions(-) diff --git a/plugins/kubernetes-backend/schema.d.ts b/plugins/kubernetes-backend/schema.d.ts index fa5bc52abf..71dbace6c7 100644 --- a/plugins/kubernetes-backend/schema.d.ts +++ b/plugins/kubernetes-backend/schema.d.ts @@ -14,14 +14,43 @@ * limitations under the License. */ -import { ClusterLocatorMethod, CustomResource } from './src/types'; - export interface Config { kubernetes?: { serviceLocatorMethod: { type: 'multiTenant'; }; - clusterLocatorMethods: ClusterLocatorMethod[]; - customResources?: CustomResource[]; + clusterLocatorMethods: Array< + | { + /** @visibility frontend */ + type: 'gke'; + /** @visibility frontend */ + projectId: string; + /** @visibility frontend */ + region?: string; + /** @visibility frontend */ + skipTLSVerify?: boolean; + } + | { + /** @visibility frontend */ + type: 'config'; + clusters: Array<{ + /** @visibility frontend */ + url: string; + /** @visibility frontend */ + name: string; + /** @visibility secret */ + serviceAccountToken?: string; + /** @visibility frontend */ + authProvider: 'aws' | 'google' | 'serviceAccount'; + /** @visibility frontend */ + skipTLSVerify?: boolean; + }>; + } + >; + customResources?: Array<{ + group: string; + apiVersion: string; + plural: string; + }>; }; } diff --git a/plugins/kubernetes-backend/src/types/types.ts b/plugins/kubernetes-backend/src/types/types.ts index 0be0b447af..ae254dfdae 100644 --- a/plugins/kubernetes-backend/src/types/types.ts +++ b/plugins/kubernetes-backend/src/types/types.ts @@ -19,50 +19,6 @@ import type { KubernetesFetchError, } from '@backstage/plugin-kubernetes-common'; -export type ClusterLocatorMethod = - | ConfigClusterLocatorMethod - | GKEClusterLocatorMethod; - -export interface ConfigClusterLocatorMethod { - /** - * @visibility frontend - */ - type: 'config'; - clusters: { - /** - * @visibility frontend - */ - url: string; - /** - * @visibility frontend - */ - name: string; - /** - * @visibility secret - */ - serviceAccountToken: string | undefined; - /** - * @visibility frontend - */ - authProvider: 'aws' | 'google' | 'serviceAccount'; - }[]; -} - -export interface GKEClusterLocatorMethod { - /** - * @visibility frontend - */ - type: 'gke'; - /** - * @visibility frontend - */ - projectId: string; - /** - * @visibility frontend - */ - region?: string; -} - export interface CustomResource { group: string; apiVersion: string; From f9f9d633d206c719c7cdfeb263bc365279aeb209 Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Fri, 7 May 2021 15:41:25 +0200 Subject: [PATCH 407/485] Add changeset Signed-off-by: Marcus Eide --- .changeset/wild-moles-care.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/wild-moles-care.md diff --git a/.changeset/wild-moles-care.md b/.changeset/wild-moles-care.md new file mode 100644 index 0000000000..35b886c2c1 --- /dev/null +++ b/.changeset/wild-moles-care.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-kubernetes-backend': patch +--- + +Add possibility to configure TLS verification for `gke` type clusters From 3b269181b68625f283269cdca9200da3a3937b3b Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Fri, 7 May 2021 16:01:34 +0200 Subject: [PATCH 408/485] Update README with tsx code block Signed-off-by: Marcus Eide --- plugins/shortcuts/README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/shortcuts/README.md b/plugins/shortcuts/README.md index 36bd9e62f8..162afe009b 100644 --- a/plugins/shortcuts/README.md +++ b/plugins/shortcuts/README.md @@ -19,16 +19,18 @@ export { shortcutsPlugin } from '@backstage/plugin-shortcuts'; Add the `` component within your ``: -```ts +```tsx import { Sidebar, SidebarDivider, SidebarSpace } from '@backstage/core'; import { Shortcuts } from '@backstage/plugin-shortcuts'; - - {/* ... */} - - - -; +export const SidebarComponent = () => ( + + {/* ... */} + + + + +); ``` The plugin exports a `shortcutApiRef` but the plugin includes a default implementation of the `ShortcutApi` that uses `localStorage` to store each user's shortcuts. From cb7a25f778687fef1a77949d6faccfe51abbd9a1 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 7 May 2021 15:32:16 +0100 Subject: [PATCH 409/485] as per comments Signed-off-by: Andrew Johnson --- .changeset/smooth-vans-travel.md | 2 +- plugins/github-deployments/src/api/index.ts | 38 +++++++------------ .../components/GithubDeploymentsCard.test.tsx | 15 +++----- .../src/components/GithubDeploymentsCard.tsx | 12 +++--- 4 files changed, 27 insertions(+), 40 deletions(-) diff --git a/.changeset/smooth-vans-travel.md b/.changeset/smooth-vans-travel.md index eb074c8ecf..0038c35e8e 100644 --- a/.changeset/smooth-vans-travel.md +++ b/.changeset/smooth-vans-travel.md @@ -1,5 +1,5 @@ --- -'@backstage/plugin-github-deployments': minor +'@backstage/plugin-github-deployments': patch --- Support for GitHub Enterprise with GithubDeploymentsPlugin diff --git a/plugins/github-deployments/src/api/index.ts b/plugins/github-deployments/src/api/index.ts index 3a348f2b56..23a381f771 100644 --- a/plugins/github-deployments/src/api/index.ts +++ b/plugins/github-deployments/src/api/index.ts @@ -21,29 +21,28 @@ import { graphql } from '@octokit/graphql'; const getBaseUrl = ( scmIntegrationsApi: ScmIntegrationRegistry, - locations: string[], + host: string | undefined, ): string => { - const targets = locations - .map(parseLocationReference) - .filter(location => location.type === 'url') - .map(location => location.target); - - if (targets.length === 0) { + if (host === undefined) { return 'https://api.github.com'; } - const location = targets[0]; - const config = scmIntegrationsApi.github.byUrl(location); + const location = parseLocationReference(host); + if (location.type !== 'github') { + return 'https://api.github.com'; + } + + const config = scmIntegrationsApi.github.byHost(location.target); if (!config) { throw new InputError( - `No matching GitHub integration configuration for location ${location}, please check your integrations config`, + `No matching GitHub integration configuration for host ${host}, please check your integrations config`, ); } if (!config.config.apiBaseUrl) { throw new InputError( - `No apiBaseUrl available for location ${location}, please check your integrations config`, + `No apiBaseUrl available for host ${host}, please check your integrations config`, ); } @@ -65,20 +64,14 @@ export type GithubDeployment = { }; type QueryParams = { + host: string | undefined; owner: string; repo: string; last: number; }; -type QueryOptions = { - locations: string[]; -}; - export interface GithubDeploymentsApi { - listDeployments( - params: QueryParams, - options: QueryOptions, - ): Promise; + listDeployments(params: QueryParams): Promise; } export const githubDeploymentsApiRef = createApiRef({ @@ -130,11 +123,8 @@ export class GithubDeploymentsApiClient implements GithubDeploymentsApi { this.scmIntegrationsApi = options.scmIntegrationsApi; } - async listDeployments( - params: QueryParams, - options: QueryOptions, - ): Promise { - const baseUrl = getBaseUrl(this.scmIntegrationsApi, options.locations); + async listDeployments(params: QueryParams): Promise { + const baseUrl = getBaseUrl(this.scmIntegrationsApi, params.host); const token = await this.githubAuthApi.getAccessToken(['repo']); const graphQLWithAuth = graphql.defaults({ diff --git a/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx b/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx index cae8313422..5914e4b422 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx +++ b/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx @@ -250,8 +250,7 @@ describe('github-deployments', () => { entity = entityStub; entity.entity.metadata.annotations = { 'github.com/project-slug': 'org/repo', - 'backstage.io/source-location': - 'url:https://my-github-1.com/org/repo', + 'backstage.io/source-location': 'github:my-github-1.com', }; }); @@ -272,8 +271,7 @@ describe('github-deployments', () => { entity = entityStub; entity.entity.metadata.annotations = { 'github.com/project-slug': 'org/repo', - 'backstage.io/managed-by-location': - 'url:https://my-github-2.com/org/repo', + 'backstage.io/managed-by-location': 'github:my-github-2.com', }; }); @@ -294,8 +292,7 @@ describe('github-deployments', () => { entity = entityStub; entity.entity.metadata.annotations = { 'github.com/project-slug': 'org/repo', - 'backstage.io/managed-by-location': - 'url:https://my-github-3.com/org/repo', + 'backstage.io/managed-by-location': 'github:my-github-3.com', }; }); @@ -308,7 +305,7 @@ describe('github-deployments', () => { expect( await rendered.findByText( - 'Warning: No apiBaseUrl available for location https://my-github-3.com/org/repo, please check your integrations config', + 'Warning: No apiBaseUrl available for host github:my-github-3.com, please check your integrations config', ), ).toBeInTheDocument(); }); @@ -320,7 +317,7 @@ describe('github-deployments', () => { entity.entity.metadata.annotations = { 'github.com/project-slug': 'org/repo', 'backstage.io/managed-by-location': - 'url:https://my-github-unknown.com/org/repo', + 'github:my-github-unknown.com/org/repo', }; }); @@ -333,7 +330,7 @@ describe('github-deployments', () => { expect( await rendered.findByText( - 'Warning: No matching GitHub integration configuration for location https://my-github-unknown.com/org/repo, please check your integrations config', + 'Warning: No matching GitHub integration configuration for host github:my-github-unknown.com/org/repo, please check your integrations config', ), ).toBeInTheDocument(); }); diff --git a/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx b/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx index 959926683f..b7f2e7b1ba 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx +++ b/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx @@ -37,18 +37,18 @@ const GithubDeploymentsComponent = ({ projectSlug, last, columns, - locations, + host, }: { projectSlug: string; last: number; - locations: string[]; columns: TableColumn[]; + host: string | undefined; }) => { const api = useApi(githubDeploymentsApiRef); const [owner, repo] = projectSlug.split('/'); const { loading, value, error, retry: reload } = useAsyncRetry( - async () => await api.listDeployments({ owner, repo, last }, { locations }), + async () => await api.listDeployments({ host, owner, repo, last }), ); if (error) { @@ -73,10 +73,10 @@ export const GithubDeploymentsCard = ({ columns?: TableColumn[]; }) => { const { entity } = useEntity(); - const locations = [ + const host: string | undefined = [ entity?.metadata.annotations?.[SOURCE_LOCATION_ANNOTATION], entity?.metadata.annotations?.[LOCATION_ANNOTATION], - ].filter(location => location !== undefined) as string[]; + ].filter(Boolean)[0]; return !isGithubDeploymentsAvailable(entity) ? ( @@ -86,7 +86,7 @@ export const GithubDeploymentsCard = ({ entity?.metadata.annotations?.[GITHUB_PROJECT_SLUG_ANNOTATION] || '' } last={last || 10} - locations={locations} + host={host} columns={columns || GithubDeploymentsTable.defaultDeploymentColumns} /> ); From 85978cb28a1be07a760f8ca8c510182c44cee5d4 Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 7 May 2021 16:38:00 +0200 Subject: [PATCH 410/485] chore: trying to fix the version packages PR as there's some horrible formatting in there somehow Signed-off-by: blam --- packages/create-app/CHANGELOG.md | 37 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/packages/create-app/CHANGELOG.md b/packages/create-app/CHANGELOG.md index 968c798625..8c3dc14245 100644 --- a/packages/create-app/CHANGELOG.md +++ b/packages/create-app/CHANGELOG.md @@ -933,26 +933,25 @@ Update imports and remove the usage of the deprecated `app.getRoutes()`. - ```diff - -import { Router as DocsRouter } from '@backstage/plugin-techdocs'; - +import { TechdocsPage } from '@backstage/plugin-techdocs'; - import { CatalogImportPage } from '@backstage/plugin-catalog-import'; - -import { Router as TechRadarRouter } from '@backstage/plugin-tech-radar'; - -import { SearchPage as SearchRouter } from '@backstage/plugin-search'; - -import { Router as SettingsRouter } from '@backstage/plugin-user-settings'; - +import { TechRadarPage } from '@backstage/plugin-tech-radar'; - +import { SearchPage } from '@backstage/plugin-search'; - +import { UserSettingsPage } from '@backstage/plugin-user-settings'; - +import { ApiExplorerPage } from '@backstage/plugin-api-docs'; - import { EntityPage } from './components/catalog/EntityPage'; - import { scaffolderPlugin, ScaffolderPage } from '@backstage/plugin-scaffolder'; - ``` +```diff +- import { Router as DocsRouter } from '@backstage/plugin-techdocs'; ++ import { TechdocsPage } from '@backstage/plugin-techdocs'; + import { CatalogImportPage } from '@backstage/plugin-catalog-import'; +- import { Router as TechRadarRouter } from '@backstage/plugin-tech-radar'; +- import { SearchPage as SearchRouter } from '@backstage/plugin-search'; +- import { Router as SettingsRouter } from '@backstage/plugin-user-settings'; ++ import { TechRadarPage } from '@backstage/plugin-tech-radar'; ++ import { SearchPage } from '@backstage/plugin-search'; ++ import { UserSettingsPage } from '@backstage/plugin-user-settings'; ++ import { ApiExplorerPage } from '@backstage/plugin-api-docs'; + import { EntityPage } from './components/catalog/EntityPage'; + import { scaffolderPlugin, ScaffolderPage } from '@backstage/plugin-scaffolder'; -const AppProvider = app.getProvider(); -const AppRouter = app.getRouter(); --const deprecatedAppRoutes = app.getRoutes(); -```` + const AppProvider = app.getProvider(); + const AppRouter = app.getRouter(); +- const deprecatedAppRoutes = app.getRoutes(); +``` As well as update or add the following routes: @@ -975,7 +974,7 @@ As well as update or add the following routes: - {deprecatedAppRoutes} + } /> + } /> -```` +``` If you have added additional plugins with registered routes or are using `Router` components from other plugins, these should be migrated to use the `*Page` components as well. See [this commit](https://github.com/backstage/backstage/commit/abd655e42d4ed416b70848ffdb1c4b99d189f13b) for more examples of how to migrate. From 16be1d093f0637a07f7dceee080e68b2dc28317b Mon Sep 17 00:00:00 2001 From: Bret Hubbard Date: Thu, 6 May 2021 17:29:32 -0600 Subject: [PATCH 411/485] Add changeset Signed-off-by: Bret Hubbard --- .changeset/smart-sheep-itch.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/smart-sheep-itch.md diff --git a/.changeset/smart-sheep-itch.md b/.changeset/smart-sheep-itch.md new file mode 100644 index 0000000000..12a0ff5ad0 --- /dev/null +++ b/.changeset/smart-sheep-itch.md @@ -0,0 +1,5 @@ +--- +'@backstage/catalog-model': patch +--- + +Improve error messages when schema validation fails From afb968c02170669d05d1a8b55f9d86436770c113 Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Fri, 7 May 2021 17:09:41 +0200 Subject: [PATCH 412/485] Update react-use version Signed-off-by: Marcus Eide --- plugins/shortcuts/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/shortcuts/package.json b/plugins/shortcuts/package.json index 7c60f54485..f87fe0e683 100644 --- a/plugins/shortcuts/package.json +++ b/plugins/shortcuts/package.json @@ -30,7 +30,7 @@ "react-dom": "^16.13.1", "react-hook-form": "^7.1.1", "react-router": "6.0.0-beta.0", - "react-use": "^15.3.3", + "react-use": "^17.2.4", "uuid": "^8.3.2", "zen-observable": "^0.8.15" }, From fd39d4662704e43866c26aae20247799a08bbaa8 Mon Sep 17 00:00:00 2001 From: Dominik Henneke Date: Fri, 7 May 2021 17:19:28 +0200 Subject: [PATCH 413/485] Move jest-when to the dev dependencies Signed-off-by: Dominik Henneke --- .changeset/sour-kids-compete.md | 5 +++++ plugins/scaffolder-backend/package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/sour-kids-compete.md diff --git a/.changeset/sour-kids-compete.md b/.changeset/sour-kids-compete.md new file mode 100644 index 0000000000..ce94305c48 --- /dev/null +++ b/.changeset/sour-kids-compete.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder-backend': patch +--- + +Move `jest-when` to the dev dependencies diff --git a/plugins/scaffolder-backend/package.json b/plugins/scaffolder-backend/package.json index 9cd951f7d8..7452d94c63 100644 --- a/plugins/scaffolder-backend/package.json +++ b/plugins/scaffolder-backend/package.json @@ -53,7 +53,6 @@ "handlebars": "^4.7.6", "helmet": "^4.0.0", "isomorphic-git": "^1.8.0", - "jest-when": "^3.1.0", "jsonschema": "^1.2.6", "knex": "^0.95.1", "lodash": "^4.17.21", @@ -70,6 +69,7 @@ "@types/fs-extra": "^9.0.1", "@types/mock-fs": "^4.13.0", "@types/supertest": "^2.0.8", + "jest-when": "^3.1.0", "mock-fs": "^4.13.0", "msw": "^0.21.2", "supertest": "^6.1.3", From 5542de095aaefa0d103413f220fcd317652a68ab Mon Sep 17 00:00:00 2001 From: Heather Lee Date: Fri, 7 May 2021 08:32:50 -0700 Subject: [PATCH 414/485] Add changeset Signed-off-by: Heather Lee --- .changeset/clean-starfishes-drop.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/clean-starfishes-drop.md diff --git a/.changeset/clean-starfishes-drop.md b/.changeset/clean-starfishes-drop.md new file mode 100644 index 0000000000..884bb8de9f --- /dev/null +++ b/.changeset/clean-starfishes-drop.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog': patch +--- + +This makes the CatalogTable configurable with custom columns, passed through the CatalogPage component rendered on the home page. From 6b1cf60c5952fc15def88517021adc94db9549c1 Mon Sep 17 00:00:00 2001 From: GregoireW <24318548+GregoireW@users.noreply.github.com> Date: Fri, 7 May 2021 19:23:09 +0200 Subject: [PATCH 415/485] Pagination label is now cleaner Signed-off-by: GregoireW <24318548+GregoireW@users.noreply.github.com> --- .changeset/shaggy-drinks-hammer.md | 2 +- .../Cards/Group/MembersList/MembersListCard.tsx | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.changeset/shaggy-drinks-hammer.md b/.changeset/shaggy-drinks-hammer.md index f068ce4267..67f284ea3f 100644 --- a/.changeset/shaggy-drinks-hammer.md +++ b/.changeset/shaggy-drinks-hammer.md @@ -2,4 +2,4 @@ '@backstage/plugin-org': patch --- -Display only first 50 group members +Paginate group members to only display 50 members maximum. diff --git a/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx b/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx index e3ab4e5193..dbe35c3057 100644 --- a/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx +++ b/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx @@ -151,16 +151,13 @@ export const MembersListCard = (_props: { return ; } + const nbPages = Math.ceil((members?.length || 0) / pageSize); + const paginationLabel = nbPages < 2 ? '' : `, page ${page} of ${nbPages}`; + return ( pageSize - ? ` (page ${page} of ${Math.ceil( - (members?.length || 0) / pageSize, - )})` - : '' - }`} + title={`Members (${members?.length || 0}${paginationLabel})`} subheader={`of ${displayName}`} > @@ -177,7 +174,7 @@ export const MembersListCard = (_props: { )} Date: Fri, 7 May 2021 21:08:39 +0000 Subject: [PATCH 416/485] chore(deps): bump ua-parser-js from 0.7.21 to 0.7.28 Bumps [ua-parser-js](https://github.com/faisalman/ua-parser-js) from 0.7.21 to 0.7.28. - [Release notes](https://github.com/faisalman/ua-parser-js/releases) - [Commits](https://github.com/faisalman/ua-parser-js/compare/0.7.21...0.7.28) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 8bf1bc1ca5..77607f0637 100644 --- a/yarn.lock +++ b/yarn.lock @@ -25727,9 +25727,9 @@ typescript@^4.0.3, typescript@^4.1.3, typescript@~4.1.3: integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw== ua-parser-js@^0.7.18: - version "0.7.21" - resolved "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.21.tgz#853cf9ce93f642f67174273cc34565ae6f308777" - integrity sha512-+O8/qh/Qj8CgC6eYBVBykMrNtp5Gebn4dlGD/kKXVkJNDwyrAwSIqwz8CDf+tsAIWVycKcku6gIXJ0qwx/ZXaQ== + version "0.7.28" + resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.28.tgz#8ba04e653f35ce210239c64661685bf9121dec31" + integrity sha512-6Gurc1n//gjp9eQNXjD9O3M/sMwVtN5S8Lv9bvOYBfKfDNiIIhqiyi01vMBO45u4zkDE420w/e0se7Vs+sIg+g== uc.micro@^1.0.1, uc.micro@^1.0.5: version "1.0.6" From 80f07624cd20976cc0ba3802c9213ac02a7873dd Mon Sep 17 00:00:00 2001 From: Shashank Bairy R Date: Sun, 9 May 2021 00:02:50 +0530 Subject: [PATCH 417/485] Add context for versions:bump about version change and update tests Signed-off-by: Shashank Bairy R --- packages/cli/src/commands/versions/bump.test.ts | 2 +- packages/cli/src/commands/versions/bump.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/commands/versions/bump.test.ts b/packages/cli/src/commands/versions/bump.test.ts index 31803d4827..e5128fc995 100644 --- a/packages/cli/src/commands/versions/bump.test.ts +++ b/packages/cli/src/commands/versions/bump.test.ts @@ -136,7 +136,7 @@ describe('bump', () => { 'bumping @backstage/theme in b to ^2.0.0', 'Running yarn install to install new versions', '⚠️ The following packages may have breaking changes:', - ' @backstage/theme', + ' @backstage/theme : 1.0.0 ~> 2.0.0', ' https://github.com/backstage/backstage/blob/master/packages/theme/CHANGELOG.md', 'Version bump complete!', ]); diff --git a/packages/cli/src/commands/versions/bump.ts b/packages/cli/src/commands/versions/bump.ts index ceb2f7f988..642b93f242 100644 --- a/packages/cli/src/commands/versions/bump.ts +++ b/packages/cli/src/commands/versions/bump.ts @@ -195,8 +195,14 @@ export default async () => { ); console.log(); - for (const name of Array.from(breakingUpdates.keys()).sort()) { - console.log(` ${chalk.yellow(name)}`); + for (const [name, { from, to }] of [ + ...breakingUpdates.entries(), + ].sort()) { + console.log( + ` ${chalk.yellow(name)} : ${chalk.yellow(from)} ~> ${chalk.yellow( + to, + )}`, + ); let path; if (name.startsWith('@backstage/plugin-')) { From 2cd70e1646109d9a42f5de8f42bc691fc975873e Mon Sep 17 00:00:00 2001 From: Shashank Bairy R Date: Sun, 9 May 2021 00:08:36 +0530 Subject: [PATCH 418/485] Add changeset Signed-off-by: Shashank Bairy R --- .changeset/beige-cheetahs-jog.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/beige-cheetahs-jog.md diff --git a/.changeset/beige-cheetahs-jog.md b/.changeset/beige-cheetahs-jog.md new file mode 100644 index 0000000000..87ef3ef44c --- /dev/null +++ b/.changeset/beige-cheetahs-jog.md @@ -0,0 +1,5 @@ +--- +'@backstage/cli': patch +--- + +Add context for versions:bump on what version it was bumped to. Updated tests for the same. From d40316a7fd4a44d929b8a868eaa6e35c8ac0b458 Mon Sep 17 00:00:00 2001 From: Shashank Bairy R Date: Sun, 9 May 2021 11:58:40 +0530 Subject: [PATCH 419/485] use Array.from instead of spread operator Signed-off-by: Shashank Bairy R --- packages/cli/src/commands/versions/bump.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/commands/versions/bump.ts b/packages/cli/src/commands/versions/bump.ts index 642b93f242..d046283aab 100644 --- a/packages/cli/src/commands/versions/bump.ts +++ b/packages/cli/src/commands/versions/bump.ts @@ -195,9 +195,9 @@ export default async () => { ); console.log(); - for (const [name, { from, to }] of [ - ...breakingUpdates.entries(), - ].sort()) { + for (const [name, { from, to }] of Array.from( + breakingUpdates.entries(), + ).sort()) { console.log( ` ${chalk.yellow(name)} : ${chalk.yellow(from)} ~> ${chalk.yellow( to, From 4916a6e23d8b4f8549134320995129f809bd1a86 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Fri, 7 May 2021 14:51:09 +0200 Subject: [PATCH 420/485] Decode req.path before loading object from GCS Signed-off-by: Eric Peterson --- .../__mocks__/@google-cloud/storage.ts | 14 ++++--- packages/techdocs-common/package.json | 4 +- .../src/stages/publish/googleStorage.test.ts | 41 +++++++++++++++++++ .../src/stages/publish/googleStorage.ts | 4 +- 4 files changed, 54 insertions(+), 9 deletions(-) diff --git a/packages/techdocs-common/__mocks__/@google-cloud/storage.ts b/packages/techdocs-common/__mocks__/@google-cloud/storage.ts index f8d0368f27..11fbc32de2 100644 --- a/packages/techdocs-common/__mocks__/@google-cloud/storage.ts +++ b/packages/techdocs-common/__mocks__/@google-cloud/storage.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { EventEmitter } from 'events'; +import { Readable, Writable } from 'stream'; import fs from 'fs-extra'; import os from 'os'; import path from 'path'; @@ -58,19 +58,21 @@ class GCSFile { } createReadStream() { - const emitter = new EventEmitter(); + const readable = new Readable(); + readable._read = () => {}; + process.nextTick(() => { if (fs.existsSync(this.localFilePath)) { - emitter.emit('data', Buffer.from(fs.readFileSync(this.localFilePath))); - emitter.emit('end'); + readable.emit('data', fs.readFileSync(this.localFilePath)); + readable.emit('end'); } else { - emitter.emit( + readable.emit( 'error', new Error(`The file ${this.localFilePath} does not exist !`), ); } }); - return emitter; + return readable; } } diff --git a/packages/techdocs-common/package.json b/packages/techdocs-common/package.json index f2d19ba8c5..7c12f6f675 100644 --- a/packages/techdocs-common/package.json +++ b/packages/techdocs-common/package.json @@ -67,7 +67,9 @@ "@types/mime-types": "^2.1.0", "@types/mock-fs": "^4.13.0", "@types/pkgcloud": "^1.7.4", - "@types/recursive-readdir": "^2.2.0" + "@types/recursive-readdir": "^2.2.0", + "@types/supertest": "^2.0.8", + "supertest": "^6.1.3" }, "jest": { "roots": [ diff --git a/packages/techdocs-common/src/stages/publish/googleStorage.test.ts b/packages/techdocs-common/src/stages/publish/googleStorage.test.ts index 19e4938763..9a966e6a60 100644 --- a/packages/techdocs-common/src/stages/publish/googleStorage.test.ts +++ b/packages/techdocs-common/src/stages/publish/googleStorage.test.ts @@ -21,6 +21,8 @@ import { EntityName, } from '@backstage/catalog-model'; import { ConfigReader } from '@backstage/config'; +import express from 'express'; +import request from 'supertest'; import mockFs from 'mock-fs'; import os from 'os'; import path from 'path'; @@ -271,4 +273,43 @@ describe('GoogleGCSPublish', () => { }); }); }); + + describe('docsRouter', () => { + let app: express.Express; + const entity = createMockEntity(); + const entityRootDir = getEntityRootDir(entity); + + beforeEach(() => { + app = express().use(publisher.docsRouter()); + + mockFs.restore(); + mockFs({ + [entityRootDir]: { + img: { + 'with spaces.png': 'found it', + }, + 'some folder': { + 'also with spaces.js': 'found it too', + }, + }, + }); + }); + + it('should pass expected object path to bucket', async () => { + const { + kind, + metadata: { namespace, name }, + } = entity; + + // Ensures leading slash is trimmed and encoded path is decoded. + const pngResponse = await request(app).get( + `/${namespace}/${kind}/${name}/img/with%20spaces.png`, + ); + expect(pngResponse.text).toEqual('found it'); + const jsResponse = await request(app).get( + `/${namespace}/${kind}/${name}/some%20folder/also%20with%20spaces.js`, + ); + expect(jsResponse.text).toEqual('found it too'); + }); + }); }); diff --git a/packages/techdocs-common/src/stages/publish/googleStorage.ts b/packages/techdocs-common/src/stages/publish/googleStorage.ts index 8adafc361a..e5e3d6c25a 100644 --- a/packages/techdocs-common/src/stages/publish/googleStorage.ts +++ b/packages/techdocs-common/src/stages/publish/googleStorage.ts @@ -187,9 +187,9 @@ export class GoogleGCSPublish implements PublisherBase { */ docsRouter(): express.Handler { return (req, res) => { - // Trim the leading forward slash + // Decode and trim the leading forward slash // filePath example - /default/Component/documented-component/index.html - const filePath = req.path.replace(/^\//, ''); + const filePath = decodeURI(req.path.replace(/^\//, '')); // Files with different extensions (CSS, HTML) need to be served with different headers const fileExtension = path.extname(filePath); From 3ebfa8f189e7a029f4743e6e5ed923b24a8bdd16 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Fri, 7 May 2021 14:57:19 +0200 Subject: [PATCH 421/485] Decode req.path before loading object from S3 bucket. Signed-off-by: Eric Peterson --- .../src/stages/publish/awsS3.test.ts | 43 +++++++++++++++++++ .../src/stages/publish/awsS3.ts | 4 +- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/packages/techdocs-common/src/stages/publish/awsS3.test.ts b/packages/techdocs-common/src/stages/publish/awsS3.test.ts index f094457346..fe0fbd556a 100644 --- a/packages/techdocs-common/src/stages/publish/awsS3.test.ts +++ b/packages/techdocs-common/src/stages/publish/awsS3.test.ts @@ -21,6 +21,8 @@ import { ENTITY_DEFAULT_NAMESPACE, } from '@backstage/catalog-model'; import { ConfigReader } from '@backstage/config'; +import express from 'express'; +import request from 'supertest'; import mockFs from 'mock-fs'; import os from 'os'; import path from 'path'; @@ -272,4 +274,45 @@ describe('AwsS3Publish', () => { }); }); }); + + describe('docsRouter', () => { + let app: express.Express; + const entity = createMockEntity(); + const entityRootDir = getEntityRootDir(entity); + + beforeEach(() => { + app = express().use(publisher.docsRouter()); + + mockFs.restore(); + mockFs({ + [entityRootDir]: { + img: { + 'with spaces.png': 'found it', + }, + 'some folder': { + 'also with spaces.js': 'found it too', + }, + }, + }); + }); + + it('should pass expected object path to bucket', async () => { + const { + kind, + metadata: { namespace, name }, + } = entity; + + // Ensures leading slash is trimmed and encoded path is decoded. + const pngResponse = await request(app).get( + `/${namespace}/${kind}/${name}/img/with%20spaces.png`, + ); + expect(Buffer.from(pngResponse.body).toString('utf8')).toEqual( + 'found it', + ); + const jsResponse = await request(app).get( + `/${namespace}/${kind}/${name}/some%20folder/also%20with%20spaces.js`, + ); + expect(jsResponse.text).toEqual('found it too'); + }); + }); }); diff --git a/packages/techdocs-common/src/stages/publish/awsS3.ts b/packages/techdocs-common/src/stages/publish/awsS3.ts index d628c860fd..e1ffb107cc 100644 --- a/packages/techdocs-common/src/stages/publish/awsS3.ts +++ b/packages/techdocs-common/src/stages/publish/awsS3.ts @@ -263,9 +263,9 @@ export class AwsS3Publish implements PublisherBase { */ docsRouter(): express.Handler { return async (req, res) => { - // Trim the leading forward slash + // Decode and trim the leading forward slash // filePath example - /default/Component/documented-component/index.html - const filePath = req.path.replace(/^\//, ''); + const filePath = decodeURI(req.path.replace(/^\//, '')); // Files with different extensions (CSS, HTML) need to be served with different headers const fileExtension = path.extname(filePath); From 9570335f241d88b4bb826f68867a01d9d74aa4c6 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Fri, 7 May 2021 15:18:05 +0200 Subject: [PATCH 422/485] Decode req.path before loading object from Azure Signed-off-by: Eric Peterson --- .../__mocks__/@azure/storage-blob.ts | 6 +-- .../stages/publish/azureBlobStorage.test.ts | 43 +++++++++++++++++++ .../src/stages/publish/azureBlobStorage.ts | 4 +- 3 files changed, 48 insertions(+), 5 deletions(-) diff --git a/packages/techdocs-common/__mocks__/@azure/storage-blob.ts b/packages/techdocs-common/__mocks__/@azure/storage-blob.ts index 0d480a7fa9..2fad447788 100644 --- a/packages/techdocs-common/__mocks__/@azure/storage-blob.ts +++ b/packages/techdocs-common/__mocks__/@azure/storage-blob.ts @@ -71,9 +71,9 @@ export class BlockBlobClient { download() { const filePath = path.join(rootDir, this.blobName); const emitter = new EventEmitter(); - process.nextTick(() => { + setTimeout(() => { if (fs.existsSync(filePath)) { - emitter.emit('data', Buffer.from(fs.readFileSync(filePath))); + emitter.emit('data', fs.readFileSync(filePath)); emitter.emit('end'); } else { emitter.emit( @@ -81,7 +81,7 @@ export class BlockBlobClient { new Error(`The file ${filePath} does not exist !`), ); } - }); + }, 0); return Promise.resolve({ readableStreamBody: emitter, }); diff --git a/packages/techdocs-common/src/stages/publish/azureBlobStorage.test.ts b/packages/techdocs-common/src/stages/publish/azureBlobStorage.test.ts index 1160ffe49d..797ab5435c 100644 --- a/packages/techdocs-common/src/stages/publish/azureBlobStorage.test.ts +++ b/packages/techdocs-common/src/stages/publish/azureBlobStorage.test.ts @@ -21,6 +21,8 @@ import { ENTITY_DEFAULT_NAMESPACE, } from '@backstage/catalog-model'; import { ConfigReader } from '@backstage/config'; +import express from 'express'; +import request from 'supertest'; import mockFs from 'mock-fs'; import os from 'os'; import path from 'path'; @@ -329,4 +331,45 @@ describe('publishing with valid credentials', () => { ); }); }); + + describe('docsRouter', () => { + let app: express.Express; + const entity = createMockEntity(); + const entityRootDir = getEntityRootDir(entity); + + beforeEach(() => { + app = express().use(publisher.docsRouter()); + + mockFs.restore(); + mockFs({ + [entityRootDir]: { + img: { + 'with spaces.png': 'found it', + }, + 'some folder': { + 'also with spaces.js': 'found it too', + }, + }, + }); + }); + + it('should pass expected object path to bucket', async () => { + const { + kind, + metadata: { namespace, name }, + } = entity; + + // Ensures leading slash is trimmed and encoded path is decoded. + const pngResponse = await request(app).get( + `/${namespace}/${kind}/${name}/img/with%20spaces.png`, + ); + expect(Buffer.from(pngResponse.body).toString('utf8')).toEqual( + 'found it', + ); + const jsResponse = await request(app).get( + `/${namespace}/${kind}/${name}/some%20folder/also%20with%20spaces.js`, + ); + expect(jsResponse.text).toEqual('found it too'); + }); + }); }); diff --git a/packages/techdocs-common/src/stages/publish/azureBlobStorage.ts b/packages/techdocs-common/src/stages/publish/azureBlobStorage.ts index f6567abe49..60640c374d 100644 --- a/packages/techdocs-common/src/stages/publish/azureBlobStorage.ts +++ b/packages/techdocs-common/src/stages/publish/azureBlobStorage.ts @@ -254,9 +254,9 @@ export class AzureBlobStoragePublish implements PublisherBase { */ docsRouter(): express.Handler { return (req, res) => { - // Trim the leading forward slash + // Decode and trim the leading forward slash // filePath example - /default/Component/documented-component/index.html - const filePath = req.path.replace(/^\//, ''); + const filePath = decodeURI(req.path.replace(/^\//, '')); // Files with different extensions (CSS, HTML) need to be served with different headers const fileExtension = platformPath.extname(filePath); const responseHeaders = getHeadersForFileExtension(fileExtension); From 4042b6e140fe74f56e939fbfeeff534afa59d96e Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Fri, 7 May 2021 15:20:55 +0200 Subject: [PATCH 423/485] Decode req.path before loading object from OpenStack Swift Signed-off-by: Eric Peterson --- .../src/stages/publish/openStackSwift.test.ts | 43 +++++++++++++++++++ .../src/stages/publish/openStackSwift.ts | 5 +-- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/packages/techdocs-common/src/stages/publish/openStackSwift.test.ts b/packages/techdocs-common/src/stages/publish/openStackSwift.test.ts index e179aeb9a7..a75c8b75ec 100644 --- a/packages/techdocs-common/src/stages/publish/openStackSwift.test.ts +++ b/packages/techdocs-common/src/stages/publish/openStackSwift.test.ts @@ -21,6 +21,8 @@ import { ENTITY_DEFAULT_NAMESPACE, } from '@backstage/catalog-model'; import { ConfigReader } from '@backstage/config'; +import express from 'express'; +import request from 'supertest'; import mockFs from 'mock-fs'; import os from 'os'; import path from 'path'; @@ -277,4 +279,45 @@ describe('OpenStackSwiftPublish', () => { }); }); }); + + describe('docsRouter', () => { + let app: express.Express; + const entity = createMockEntity(); + const entityRootDir = getEntityRootDir(entity); + + beforeEach(() => { + app = express().use(publisher.docsRouter()); + + mockFs.restore(); + mockFs({ + [entityRootDir]: { + img: { + 'with spaces.png': 'found it', + }, + 'some folder': { + 'also with spaces.js': 'found it too', + }, + }, + }); + }); + + it('should pass expected object path to bucket', async () => { + const { + kind, + metadata: { namespace, name }, + } = entity; + + // Ensures leading slash is trimmed and encoded path is decoded. + const pngResponse = await request(app).get( + `/${namespace}/${kind}/${name}/img/with%20spaces.png`, + ); + expect(Buffer.from(pngResponse.body).toString('utf8')).toEqual( + 'found it', + ); + const jsResponse = await request(app).get( + `/${namespace}/${kind}/${name}/some%20folder/also%20with%20spaces.js`, + ); + expect(jsResponse.text).toEqual('found it too'); + }); + }); }); diff --git a/packages/techdocs-common/src/stages/publish/openStackSwift.ts b/packages/techdocs-common/src/stages/publish/openStackSwift.ts index bff0055402..2321aa33bd 100644 --- a/packages/techdocs-common/src/stages/publish/openStackSwift.ts +++ b/packages/techdocs-common/src/stages/publish/openStackSwift.ts @@ -221,10 +221,9 @@ export class OpenStackSwiftPublish implements PublisherBase { */ docsRouter(): express.Handler { return async (req, res) => { - // Trim the leading forward slash + // Decode and trim the leading forward slash // filePath example - /default/Component/documented-component/index.html - - const filePath = req.path.replace(/^\//, ''); + const filePath = decodeURI(req.path.replace(/^\//, '')); // Files with different extensions (CSS, HTML) need to be served with different headers const fileExtension = path.extname(filePath); From e04f1ccfbebcd4636dc79b31c2fa18b62b7001bd Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Fri, 7 May 2021 16:43:28 +0200 Subject: [PATCH 424/485] Changeset Signed-off-by: Eric Peterson --- .changeset/techdocs-spaces-in-objects.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/techdocs-spaces-in-objects.md diff --git a/.changeset/techdocs-spaces-in-objects.md b/.changeset/techdocs-spaces-in-objects.md new file mode 100644 index 0000000000..7bbac5d2a8 --- /dev/null +++ b/.changeset/techdocs-spaces-in-objects.md @@ -0,0 +1,5 @@ +--- +'@backstage/techdocs-common': patch +--- + +Fixed a bug that prevented loading static assets from GCS, S3, Azure, and OpenStackSwift whose keys contain spaces or other special characters. From 93ff8275dd050834972dda609723f2a9bf5b33c7 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Sat, 1 May 2021 21:23:50 +0200 Subject: [PATCH 425/485] WIP store-agnostic cache manager. Signed-off-by: Eric Peterson --- packages/backend-common/config.d.ts | 22 +++++ packages/backend-common/package.json | 4 + .../backend-common/src/cache/CacheManager.ts | 87 +++++++++++++++++++ packages/backend-common/src/cache/index.ts | 17 ++++ packages/backend-common/src/index.ts | 1 + packages/backend/src/index.ts | 4 +- packages/backend/src/types.ts | 2 + yarn.lock | 74 ++++++++++++++-- 8 files changed, 202 insertions(+), 9 deletions(-) create mode 100644 packages/backend-common/src/cache/CacheManager.ts create mode 100644 packages/backend-common/src/cache/index.ts diff --git a/packages/backend-common/config.d.ts b/packages/backend-common/config.d.ts index 41845f952e..b4cf8580d9 100644 --- a/packages/backend-common/config.d.ts +++ b/packages/backend-common/config.d.ts @@ -68,6 +68,28 @@ export interface Config { connection: string | object; }; + /** Cache connection configuration, select cache type using the `store` field */ + cache?: + | { + store: 'memory'; + } + | { + store: 'memcache'; + connection: { + /** + * An array of memcache hosts, optionally including a port number. + * e.g. 127.0.0.1:11211 + */ + hosts: string[]; + + /** + * Number of milliseconds to wait before assuming there is a + * network timeout. Defaults to 500ms. + */ + netTimeout?: number; + }; + }; + cors?: { origin?: string | string[]; methods?: string | string[]; diff --git a/packages/backend-common/package.json b/packages/backend-common/package.json index a144f1c23f..513fe2f985 100644 --- a/packages/backend-common/package.json +++ b/packages/backend-common/package.json @@ -36,10 +36,13 @@ "@backstage/integration": "^0.5.2", "@google-cloud/storage": "^5.8.0", "@octokit/rest": "^18.5.3", + "@types/cache-manager": "^3.4.0", "@types/cors": "^2.8.6", "@types/dockerode": "^3.2.1", "@types/express": "^4.17.6", "archiver": "^5.0.2", + "cache-manager": "^3.4.3", + "cache-manager-memcached-store": "^4.0.0", "compression": "^1.7.4", "concat-stream": "^2.0.0", "cors": "^2.8.5", @@ -54,6 +57,7 @@ "knex": "^0.95.1", "lodash": "^4.17.15", "logform": "^2.1.1", + "memcache-pp": "^0.3.3", "minimatch": "^3.0.4", "minimist": "^1.2.5", "morgan": "^1.10.0", diff --git a/packages/backend-common/src/cache/CacheManager.ts b/packages/backend-common/src/cache/CacheManager.ts new file mode 100644 index 0000000000..83e902a743 --- /dev/null +++ b/packages/backend-common/src/cache/CacheManager.ts @@ -0,0 +1,87 @@ +/* + * 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 { Config } from '@backstage/config'; +import cacheManager from 'cache-manager'; +// @ts-expect-error +import Memcache from 'memcache-pp'; +// @ts-expect-error +import memcachedStore from 'cache-manager-memcached-store'; + +/** + * A Cache Manager, which is able to retrieve a `node-cache-manager`-compliant + * cache client, configured according to app configuration. If no cache is + * configured, or an unknown store is provided, a no-op cache instance will be + * returned. + */ +export class CacheManager { + private readonly storeGetterMap = { + memcache: this.getMemcacheClient, + memory: this.getMemoryClient, + none: this.getNoneClient, + }; + + /** + * Creates a new CacheManager instance by reading from the `backend` config + * section, specifically the `.cache` key. + * + * @param config The loaded application configuration. + */ + static fromConfig(config: Config): CacheManager { + return new CacheManager(config.getConfig('backend.cache')); + } + + private constructor(private readonly config: Config) {} + + getClientWithTtl(ttl: number): cacheManager.Cache { + const store = this.config.getOptionalString( + 'store', + ) as keyof CacheManager['storeGetterMap']; + + if (this.storeGetterMap.hasOwnProperty(store)) { + return this.storeGetterMap[store].call(this, ttl); + } + return this.storeGetterMap.none.call(this, ttl); + } + + private getMemcacheClient(ttl: number): cacheManager.Cache { + const hosts = this.config.getStringArray('connection.hosts'); + const netTimeout = this.config.getOptionalNumber('connection.netTimeout'); + return cacheManager.caching({ + store: memcachedStore, + driver: Memcache, + options: { + hosts, + ...(netTimeout && { netTimeout }), + }, + ttl, + }); + } + + private getMemoryClient(ttl: number): cacheManager.Cache { + return cacheManager.caching({ + store: 'memory', + ttl, + }); + } + + private getNoneClient(ttl: number): cacheManager.Cache { + return cacheManager.caching({ + store: 'none', + ttl, + }); + } +} diff --git a/packages/backend-common/src/cache/index.ts b/packages/backend-common/src/cache/index.ts new file mode 100644 index 0000000000..d405f02f46 --- /dev/null +++ b/packages/backend-common/src/cache/index.ts @@ -0,0 +1,17 @@ +/* + * 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. + */ + +export * from './CacheManager'; diff --git a/packages/backend-common/src/index.ts b/packages/backend-common/src/index.ts index 29b1062750..dab981a824 100644 --- a/packages/backend-common/src/index.ts +++ b/packages/backend-common/src/index.ts @@ -14,6 +14,7 @@ * limitations under the License. */ +export * from './cache'; export * from './config'; export * from './database'; export * from './discovery'; diff --git a/packages/backend/src/index.ts b/packages/backend/src/index.ts index 00ed248df5..82b8e1cb7b 100644 --- a/packages/backend/src/index.ts +++ b/packages/backend/src/index.ts @@ -24,6 +24,7 @@ import Router from 'express-promise-router'; import { + CacheManager, createServiceBuilder, getRootLogger, loadBackendConfig, @@ -59,11 +60,12 @@ function makeCreateEnv(config: Config) { root.info(`Created UrlReader ${reader}`); const databaseManager = SingleConnectionDatabaseManager.fromConfig(config); + const cache = CacheManager.fromConfig(config); return (plugin: string): PluginEnvironment => { const logger = root.child({ type: 'plugin', plugin }); const database = databaseManager.forPlugin(plugin); - return { logger, database, config, reader, discovery }; + return { logger, cache, database, config, reader, discovery }; }; } diff --git a/packages/backend/src/types.ts b/packages/backend/src/types.ts index f63b9dd780..a951562553 100644 --- a/packages/backend/src/types.ts +++ b/packages/backend/src/types.ts @@ -17,6 +17,7 @@ import { Logger } from 'winston'; import { Config } from '@backstage/config'; import { + CacheManager, PluginDatabaseManager, PluginEndpointDiscovery, UrlReader, @@ -24,6 +25,7 @@ import { export type PluginEnvironment = { logger: Logger; + cache: CacheManager; database: PluginDatabaseManager; config: Config; reader: UrlReader; diff --git a/yarn.lock b/yarn.lock index 77607f0637..4b1ebed024 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5737,6 +5737,11 @@ resolved "https://registry.npmjs.org/@types/btoa-lite/-/btoa-lite-1.0.0.tgz#e190a5a548e0b348adb0df9ac7fa5f1151c7cca4" integrity sha512-wJsiX1tosQ+J5+bY5LrSahHxr2wT+uME5UDwdN1kg4frt40euqA+wzECkmq4t5QbveHiJepfdThgQrPw6KiSlg== +"@types/cache-manager@^3.4.0": + version "3.4.0" + resolved "https://registry.npmjs.org/@types/cache-manager/-/cache-manager-3.4.0.tgz#414136ea3807a8cd071b8f20370c5df5dbffd382" + integrity sha512-XVbn2HS+O+Mk2SKRCjr01/8oD5p2Tv1fxxdBqJ0+Cl+UBNiz0WVY5rusHpMGx+qF6Vc2pnRwPVwSKbGaDApCpw== + "@types/cacheable-request@^6.0.1": version "6.0.1" resolved "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.1.tgz#5d22f3dded1fd3a84c0bbeb5039a7419c2c91976" @@ -8152,6 +8157,11 @@ async@0.9.x: resolved "https://registry.npmjs.org/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d" integrity sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0= +async@3.2.0, async@^3.2.0: + version "3.2.0" + resolved "https://registry.npmjs.org/async/-/async-3.2.0.tgz#b3a2685c5ebb641d3de02d161002c60fc9f85720" + integrity sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw== + async@^2.0.1, async@^2.6.1, async@^2.6.2: version "2.6.3" resolved "https://registry.npmjs.org/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff" @@ -8826,7 +8836,7 @@ block-stream@*: dependencies: inherits "~2.0.0" -bluebird@3.7.2, bluebird@^3.3.5, bluebird@^3.5.1, bluebird@^3.5.5, bluebird@^3.7.2: +bluebird@3.7.2, bluebird@^3.3.5, bluebird@^3.4.1, bluebird@^3.5.1, bluebird@^3.5.5, bluebird@^3.7.2: version "3.7.2" resolved "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== @@ -9251,6 +9261,20 @@ cache-base@^1.0.1: union-value "^1.0.0" unset-value "^1.0.0" +cache-manager-memcached-store@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/cache-manager-memcached-store/-/cache-manager-memcached-store-4.0.0.tgz#f68d00cdfaa73696d13137b7b0f39397167d9220" + integrity sha512-Lv1WMaRC1FQHHqxE8Xbi7YWInhgfxjOmLEE6u1K0A3Rwmq+XRLyekKDM7aW9WIzF+PuII/RDKqBK/Ezo5H2QVw== + +cache-manager@^3.4.3: + version "3.4.3" + resolved "https://registry.npmjs.org/cache-manager/-/cache-manager-3.4.3.tgz#c978d58f82b414ade08903d4d72b56a80a4978be" + integrity sha512-6+Hfzy1SNs/thUwo+07pV0ozgxc4sadrAN0eFVGvXl/X9nz3J0BqEnnEoyxEn8jnF+UkEo0MKpyk9BO80hMeiQ== + dependencies: + async "3.2.0" + lodash "^4.17.21" + lru-cache "6.0.0" + cacheable-lookup@^5.0.3: version "5.0.3" resolved "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.3.tgz#049fdc59dffdd4fc285e8f4f82936591bd59fec3" @@ -9457,6 +9481,11 @@ capture-exit@^2.0.0: dependencies: rsvp "^4.8.4" +carrier@^0.3.0: + version "0.3.0" + resolved "https://registry.npmjs.org/carrier/-/carrier-0.3.0.tgz#bd295d1d3a7524cac63dd779b929ee22a362bad4" + integrity sha1-vSldHTp1JMrGPdd5uSnuIqNiutQ= + case-sensitive-paths-webpack-plugin@^2.2.0: version "2.3.0" resolved "https://registry.npmjs.org/case-sensitive-paths-webpack-plugin/-/case-sensitive-paths-webpack-plugin-2.3.0.tgz#23ac613cc9a856e4f88ff8bb73bbb5e989825cf7" @@ -10273,6 +10302,11 @@ connect-history-api-fallback@^1.6.0: resolved "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz#8b32089359308d111115d81cad3fceab888f97bc" integrity sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg== +connection-parse@0.0.x: + version "0.0.7" + resolved "https://registry.npmjs.org/connection-parse/-/connection-parse-0.0.7.tgz#18e7318aab06a699267372b10c5226d25a1c9a69" + integrity sha1-GOcxiqsGppkmc3KxDFIm0locmmk= + console-browserify@^1.1.0: version "1.2.0" resolved "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz#67063cef57ceb6cf4993a2ab3a55840ae8c49336" @@ -14746,6 +14780,14 @@ hash.js@^1.0.0, hash.js@^1.0.3: inherits "^2.0.3" minimalistic-assert "^1.0.1" +hashring@^3.2.0: + version "3.2.0" + resolved "https://registry.npmjs.org/hashring/-/hashring-3.2.0.tgz#fda4efde8aa22cdb97fb1d2a65e88401e1c144ce" + integrity sha1-/aTv3oqiLNuX+x0qZeiEAeHBRM4= + dependencies: + connection-parse "0.0.x" + simple-lru-cache "0.0.x" + hast-util-parse-selector@^2.0.0: version "2.2.4" resolved "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-2.2.4.tgz#60c99d0b519e12ab4ed32e58f150ec3f61ed1974" @@ -18023,6 +18065,13 @@ lru-cache@2: resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz#6d4524e8b955f95d4f5b58851ce21dd72fb4e952" integrity sha1-bUUk6LlV+V1PW1iFHOId1y+06VI= +lru-cache@6.0.0, lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + lru-cache@^4.0.1: version "4.1.5" resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" @@ -18038,13 +18087,6 @@ lru-cache@^5.0.0, lru-cache@^5.1.1: dependencies: yallist "^3.0.2" -lru-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" - integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== - dependencies: - yallist "^4.0.0" - lru-queue@^0.1.0: version "0.1.0" resolved "https://registry.npmjs.org/lru-queue/-/lru-queue-0.1.0.tgz#2738bd9f0d3cf4f84490c5736c48699ac632cda3" @@ -18336,6 +18378,17 @@ media-typer@0.3.0: resolved "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= +memcache-pp@^0.3.3: + version "0.3.3" + resolved "https://registry.npmjs.org/memcache-pp/-/memcache-pp-0.3.3.tgz#3124830e27d55a252499726510841590ac130c99" + integrity sha512-fMitetT5ulUs4DnFaoVqWHrTBiddLG/l8rMHXbV+ibuL7uWjBulaEf8koTBEweyrjmflqhbH4Uy9V709LadXSA== + dependencies: + bluebird "^3.4.1" + carrier "^0.3.0" + debug "^2.6.9" + hashring "^3.2.0" + immutable "^3.8.1" + memoize-one@^5.1.1: version "5.1.1" resolved "https://registry.npmjs.org/memoize-one/-/memoize-one-5.1.1.tgz#047b6e3199b508eaec03504de71229b8eb1d75c0" @@ -23780,6 +23833,11 @@ simple-get@^3.0.2, simple-get@^3.0.3: once "^1.3.1" simple-concat "^1.0.0" +simple-lru-cache@0.0.x: + version "0.0.2" + resolved "https://registry.npmjs.org/simple-lru-cache/-/simple-lru-cache-0.0.2.tgz#d59cc3a193c1a5d0320f84ee732f6e4713e511dd" + integrity sha1-1ZzDoZPBpdAyD4Tucy9uRxPlEd0= + simple-swizzle@^0.2.2: version "0.2.2" resolved "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" From 6e0be00e1d1a4a27bf314983f9dbc74c7557682c Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Sun, 2 May 2021 15:18:06 +0200 Subject: [PATCH 426/485] Wrap cache clients in a Backstage-specific CacheClient to handle key normalization and error handling + allow us the freedom to move away from cache-manager in the future if necessary. Signed-off-by: Eric Peterson --- app-config.yaml | 2 + .../backend-common/src/cache/CacheClient.ts | 94 +++++++++++++++++++ .../backend-common/src/cache/CacheManager.ts | 43 +++++++-- packages/backend-common/src/cache/index.ts | 1 + packages/backend/src/index.ts | 3 +- packages/backend/src/types.ts | 4 +- 6 files changed, 137 insertions(+), 10 deletions(-) create mode 100644 packages/backend-common/src/cache/CacheClient.ts diff --git a/app-config.yaml b/app-config.yaml index 3c4f2d7ea5..8224b2fb6a 100644 --- a/app-config.yaml +++ b/app-config.yaml @@ -26,6 +26,8 @@ backend: baseUrl: http://localhost:7000 listen: port: 7000 + cache: + store: memory database: client: sqlite3 connection: ':memory:' diff --git a/packages/backend-common/src/cache/CacheClient.ts b/packages/backend-common/src/cache/CacheClient.ts new file mode 100644 index 0000000000..9146131a10 --- /dev/null +++ b/packages/backend-common/src/cache/CacheClient.ts @@ -0,0 +1,94 @@ +/* + * 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 { JsonValue } from '@backstage/config'; +import cacheManager from 'cache-manager'; +import { createHash } from 'crypto'; + +type CacheClientArgs = { + client: cacheManager.Cache; + pluginId: string; +}; + +export interface CacheClient { + get(key: string): Promise; + set(key: string, value: JsonValue, ttl?: number): Promise; + delete(key: string): Promise; +} + +export class ConcreteCacheClient implements CacheClient { + private readonly client: cacheManager.Cache; + private readonly pluginId: string; + + constructor({ client, pluginId }: CacheClientArgs) { + this.client = client; + this.pluginId = pluginId; + } + + async get(key: string): Promise { + const k = this.getNormalizedKey(key); + try { + const data = (await this.client.get(k)) as string | undefined; + return this.unserializeData(data); + } catch (_e) { + return null; + } + } + + async set(key: string, value: JsonValue, ttl?: number): Promise { + const k = this.getNormalizedKey(key); + try { + const data = this.serializeData(value); + await this.client.set(k, data, ttl ? { ttl } : undefined); + } catch (_e) { + return; + } + } + + async delete(key: string): Promise { + const k = this.getNormalizedKey(key); + try { + await this.client.del(k); + } catch (_e) { + return; + } + } + + /** + * Namespaces key by plugin to discourage cross-plugin integration via the + * cache store. + */ + private getNormalizedKey(key: string): string { + // Namespace key by plugin ID and remove potentially invalid characters. + const candidateKey = `${this.pluginId}:${key}`; + const wellFormedKey = Buffer.from(candidateKey).toString('base64'); + + // Memcache in particular doesn't do well with keys > 250 bytes. + if (wellFormedKey.length < 250) { + return wellFormedKey; + } + + return createHash('md5').update(candidateKey).digest('hex'); + } + + private serializeData(data: JsonValue): string { + return JSON.stringify(data); + } + + private unserializeData(data: string | undefined): JsonValue { + return data ? JSON.parse(data) : null; + } +} diff --git a/packages/backend-common/src/cache/CacheManager.ts b/packages/backend-common/src/cache/CacheManager.ts index 83e902a743..f1c3b279fd 100644 --- a/packages/backend-common/src/cache/CacheManager.ts +++ b/packages/backend-common/src/cache/CacheManager.ts @@ -14,20 +14,28 @@ * limitations under the License. */ -import { Config } from '@backstage/config'; +import { Config, ConfigReader } from '@backstage/config'; import cacheManager from 'cache-manager'; // @ts-expect-error import Memcache from 'memcache-pp'; // @ts-expect-error import memcachedStore from 'cache-manager-memcached-store'; +import { ConcreteCacheClient, CacheClient } from './CacheClient'; + +export type PluginCacheManager = { + getClient: (ttl: number) => CacheClient; +}; /** - * A Cache Manager, which is able to retrieve a `node-cache-manager`-compliant - * cache client, configured according to app configuration. If no cache is - * configured, or an unknown store is provided, a no-op cache instance will be - * returned. + * Implements a Cache Manager which will automatically create new cache clients + * for plugins when requested. All requested cacheclients are created with the + * credentials provided. */ export class CacheManager { + /** + * Keys represented supported `backend.cache.store` values, mapped to getters + * that return cacheManager.Cache instances appropriate to the store. + */ private readonly storeGetterMap = { memcache: this.getMemcacheClient, memory: this.getMemoryClient, @@ -41,12 +49,33 @@ export class CacheManager { * @param config The loaded application configuration. */ static fromConfig(config: Config): CacheManager { - return new CacheManager(config.getConfig('backend.cache')); + // If no `backend.cache` config is provided, instantiate the CacheManager + // with empty config; allowing a "none" cache client will be returned. + return new CacheManager( + config.getOptionalConfig('backend.cache') || new ConfigReader(undefined), + ); } private constructor(private readonly config: Config) {} - getClientWithTtl(ttl: number): cacheManager.Cache { + /** + * Generates a CacheManagerInstance for consumption by plugins. + * + * @param pluginId The plugin that the cache manager should be created for. Plugin names should be unique. + */ + forPlugin(pluginId: string): PluginCacheManager { + return { + getClient: (ttl: number): CacheClient => { + const concreteClient = this.getClientWithTtl(ttl); + return new ConcreteCacheClient({ + client: concreteClient, + pluginId: pluginId, + }); + }, + }; + } + + private getClientWithTtl(ttl: number): cacheManager.Cache { const store = this.config.getOptionalString( 'store', ) as keyof CacheManager['storeGetterMap']; diff --git a/packages/backend-common/src/cache/index.ts b/packages/backend-common/src/cache/index.ts index d405f02f46..ba1625d043 100644 --- a/packages/backend-common/src/cache/index.ts +++ b/packages/backend-common/src/cache/index.ts @@ -14,4 +14,5 @@ * limitations under the License. */ +export * from './CacheClient'; export * from './CacheManager'; diff --git a/packages/backend/src/index.ts b/packages/backend/src/index.ts index 82b8e1cb7b..d43c8f0101 100644 --- a/packages/backend/src/index.ts +++ b/packages/backend/src/index.ts @@ -60,11 +60,12 @@ function makeCreateEnv(config: Config) { root.info(`Created UrlReader ${reader}`); const databaseManager = SingleConnectionDatabaseManager.fromConfig(config); - const cache = CacheManager.fromConfig(config); + const cacheManager = CacheManager.fromConfig(config); return (plugin: string): PluginEnvironment => { const logger = root.child({ type: 'plugin', plugin }); const database = databaseManager.forPlugin(plugin); + const cache = cacheManager.forPlugin(plugin); return { logger, cache, database, config, reader, discovery }; }; } diff --git a/packages/backend/src/types.ts b/packages/backend/src/types.ts index a951562553..356dd08d5f 100644 --- a/packages/backend/src/types.ts +++ b/packages/backend/src/types.ts @@ -17,7 +17,7 @@ import { Logger } from 'winston'; import { Config } from '@backstage/config'; import { - CacheManager, + PluginCacheManager, PluginDatabaseManager, PluginEndpointDiscovery, UrlReader, @@ -25,7 +25,7 @@ import { export type PluginEnvironment = { logger: Logger; - cache: CacheManager; + cache: PluginCacheManager; database: PluginDatabaseManager; config: Config; reader: UrlReader; From c7fa03cd760c03021b0b2f4e6fedfb83e1572832 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Sun, 2 May 2021 16:30:06 +0200 Subject: [PATCH 427/485] Test coverage for CacheManager and CacheClient Signed-off-by: Eric Peterson --- .../src/cache/CacheClient.test.ts | 141 ++++++++++++++++ .../src/cache/CacheManager.test.ts | 154 ++++++++++++++++++ 2 files changed, 295 insertions(+) create mode 100644 packages/backend-common/src/cache/CacheClient.test.ts create mode 100644 packages/backend-common/src/cache/CacheManager.test.ts diff --git a/packages/backend-common/src/cache/CacheClient.test.ts b/packages/backend-common/src/cache/CacheClient.test.ts new file mode 100644 index 0000000000..aadcee7386 --- /dev/null +++ b/packages/backend-common/src/cache/CacheClient.test.ts @@ -0,0 +1,141 @@ +/* + * 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 { ConcreteCacheClient } from './CacheClient'; +import cacheManager from 'cache-manager'; + +describe('CacheClient', () => { + const pluginId = 'test'; + let client: cacheManager.Cache; + const b64 = (k: string) => Buffer.from(k).toString('base64'); + + beforeEach(() => { + client = cacheManager.caching({ store: 'none', ttl: 0 }); + client.get = jest.fn(); + client.set = jest.fn(); + client.del = jest.fn(); + }); + + afterEach(() => jest.resetAllMocks()); + + describe('CacheClient.get', () => { + it('calls client with normalized key', async () => { + const sut = new ConcreteCacheClient({ client, pluginId }); + const keyPartial = 'somekey'; + + await sut.get(keyPartial); + + expect(client.get).toHaveBeenCalledWith(b64(`${pluginId}:${keyPartial}`)); + }); + + it('calls client with normalized key (very long key)', async () => { + const sut = new ConcreteCacheClient({ client, pluginId }); + const keyPartial = 'x'.repeat(251); + + await sut.get(keyPartial); + + const spy = client.get as jest.Mock; + const actualKey = spy.mock.calls[0][0]; + expect(actualKey).not.toEqual(b64(`${pluginId}:${keyPartial}`)); + expect(actualKey.length).toBeLessThan(250); + }); + + it('performs deserialization on returned data', async () => { + const expectedValue = { some: 'value' }; + const sut = new ConcreteCacheClient({ client, pluginId }); + client.get = jest.fn().mockResolvedValue(JSON.stringify(expectedValue)); + + const actualValue = await sut.get('someKey'); + + expect(actualValue).toMatchObject(expectedValue); + }); + + it('returns null on any underlying error', async () => { + const sut = new ConcreteCacheClient({ client, pluginId }); + client.get = jest.fn().mockRejectedValue(undefined); + + const actualValue = await sut.get('someKey'); + + expect(actualValue).toStrictEqual(null); + }); + }); + + describe('CacheClient.set', () => { + it('calls client with normalized key', async () => { + const sut = new ConcreteCacheClient({ client, pluginId }); + const keyPartial = 'somekey'; + + await sut.set(keyPartial, {}); + + const spy = client.set as jest.Mock; + const actualKey = spy.mock.calls[0][0]; + expect(actualKey).toEqual(b64(`${pluginId}:${keyPartial}`)); + }); + + it('performs serialization on given data', async () => { + const sut = new ConcreteCacheClient({ client, pluginId }); + const expectedData = { some: 'value' }; + + await sut.set('someKey', expectedData); + + const spy = client.set as jest.Mock; + const actualData = spy.mock.calls[0][1]; + expect(actualData).toEqual(JSON.stringify(expectedData)); + }); + + it('passes ttl to client when given', async () => { + const sut = new ConcreteCacheClient({ client, pluginId }); + const expectedTtl = 3600; + + await sut.set('someKey', {}, expectedTtl); + + const spy = client.set as jest.Mock; + const actualOptions = spy.mock.calls[0][2]; + expect(actualOptions.ttl).toEqual(expectedTtl); + }); + + it('does not throw errors on any client error', async () => { + const sut = new ConcreteCacheClient({ client, pluginId }); + client.set = jest.fn().mockRejectedValue(undefined); + + expect(async () => { + await sut.set('someKey', {}); + }).not.toThrow(); + }); + }); + + describe('CacheClient.delete', () => { + it('calls client with normalized key', async () => { + const sut = new ConcreteCacheClient({ client, pluginId }); + const keyPartial = 'somekey'; + + await sut.delete(keyPartial); + + const spy = client.del as jest.Mock; + const actualKey = spy.mock.calls[0][0]; + expect(actualKey).toEqual(b64(`${pluginId}:${keyPartial}`)); + }); + + it('does not throw errors on any client error', async () => { + const sut = new ConcreteCacheClient({ client, pluginId }); + client.del = jest.fn().mockRejectedValue(undefined); + + expect(async () => { + await sut.delete('someKey'); + }).not.toThrow(); + }); + }); +}); diff --git a/packages/backend-common/src/cache/CacheManager.test.ts b/packages/backend-common/src/cache/CacheManager.test.ts new file mode 100644 index 0000000000..af8450975a --- /dev/null +++ b/packages/backend-common/src/cache/CacheManager.test.ts @@ -0,0 +1,154 @@ +/* + * 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 { ConfigReader } from '@backstage/config'; +import cacheManager from 'cache-manager'; +import { ConcreteCacheClient } from './CacheClient'; +import { CacheManager } from './CacheManager'; + +cacheManager.caching = jest.fn() as jest.Mock; +jest.mock('./CacheClient', () => { + return { + ConcreteCacheClient: jest.fn(), + }; +}); + +describe('CacheManager', () => { + const defaultConfigOptions = { + backend: { + cache: { + store: 'memory', + }, + }, + }; + const defaultConfig = () => new ConfigReader(defaultConfigOptions); + + afterEach(() => jest.resetAllMocks()); + + describe('CacheManager.fromConfig', () => { + it('accesses the backend.cache key', () => { + const getOptionalConfig = jest.fn(); + const config = defaultConfig(); + config.getOptionalConfig = getOptionalConfig; + + CacheManager.fromConfig(config); + + expect(getOptionalConfig.mock.calls[0][0]).toEqual('backend.cache'); + }); + + it('does not require the backend.cache key', () => { + const config = new ConfigReader({ backend: {} }); + expect(() => { + CacheManager.fromConfig(config); + }).not.toThrowError(); + }); + }); + + describe('CacheManager.forPlugin', () => { + const manager = CacheManager.fromConfig(defaultConfig()); + + it('connects to a cache store scoped to the plugin', async () => { + const pluginId = 'test1'; + const expectedTtl = 3600; + manager.forPlugin(pluginId).getClient(expectedTtl); + + const client = ConcreteCacheClient as jest.Mock; + expect(client).toHaveBeenCalledTimes(1); + }); + + it('provides different plugins different cache clients', async () => { + const plugin1Id = 'test1'; + const plugin2Id = 'test2'; + const expectedTtl = 3600; + manager.forPlugin(plugin1Id).getClient(expectedTtl); + manager.forPlugin(plugin2Id).getClient(expectedTtl); + + const cache = cacheManager.caching as jest.Mock; + const client = ConcreteCacheClient as jest.Mock; + expect(cache).toHaveBeenCalledTimes(2); + expect(client).toHaveBeenCalledTimes(2); + + const plugin1CallArgs = client.mock.calls[0]; + const plugin2CallArgs = client.mock.calls[1]; + expect(plugin1CallArgs[0].pluginId).not.toEqual( + plugin2CallArgs[0].pluginId, + ); + }); + }); + + describe('CacheManager.forPlugin stores', () => { + it('returns none client when no cache is configured', () => { + const manager = CacheManager.fromConfig( + new ConfigReader({ backend: {} }), + ); + const expectedTtl = 3600; + manager.forPlugin('test').getClient(expectedTtl); + + const cache = cacheManager.caching as jest.Mock; + const mockCalls = cache.mock.calls.splice(-1); + const callArgs = mockCalls[0]; + expect(callArgs[0]).toMatchObject({ + store: 'none', + ttl: expectedTtl, + }); + }); + + it('returns memory client when configured', () => { + const manager = CacheManager.fromConfig(defaultConfig()); + const expectedTtl = 3600; + manager.forPlugin('test').getClient(expectedTtl); + + const cache = cacheManager.caching as jest.Mock; + const mockCalls = cache.mock.calls.splice(-1); + const callArgs = mockCalls[0]; + expect(callArgs[0]).toMatchObject({ + store: 'memory', + ttl: expectedTtl, + }); + }); + + it('returns a memcache client when configured', () => { + const expectedHost = '127.0.0.1:11211'; + const expectedTimeout = 1000; + const manager = CacheManager.fromConfig( + new ConfigReader({ + backend: { + cache: { + store: 'memcache', + connection: { + hosts: [expectedHost], + netTimeout: expectedTimeout, + }, + }, + }, + }), + ); + const expectedTtl = 3600; + manager.forPlugin('test').getClient(expectedTtl); + + const cache = cacheManager.caching as jest.Mock; + const mockCalls = cache.mock.calls.splice(-1); + const callArgs = mockCalls[0]; + expect(callArgs[0]).toMatchObject({ + options: { + hosts: [expectedHost], + netTimeout: expectedTimeout, + }, + ttl: expectedTtl, + }); + }); + }); +}); From b57fa279c5885e89ff25e757048c28a34724c6df Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Sun, 2 May 2021 16:45:47 +0200 Subject: [PATCH 428/485] Clean up and document exported types Signed-off-by: Eric Peterson --- .../backend-common/src/cache/CacheClient.ts | 21 +++++++++++++ .../backend-common/src/cache/CacheManager.ts | 5 +-- packages/backend-common/src/cache/index.ts | 3 +- packages/backend-common/src/cache/types.ts | 31 +++++++++++++++++++ 4 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 packages/backend-common/src/cache/types.ts diff --git a/packages/backend-common/src/cache/CacheClient.ts b/packages/backend-common/src/cache/CacheClient.ts index 9146131a10..0716b159cb 100644 --- a/packages/backend-common/src/cache/CacheClient.ts +++ b/packages/backend-common/src/cache/CacheClient.ts @@ -23,12 +23,33 @@ type CacheClientArgs = { pluginId: string; }; +/** + * A pre-configured, storage agnostic cache client suitable for use by + * Backstage plugins. + */ export interface CacheClient { + /** + * Reads data from a cache store for the given key. + */ get(key: string): Promise; + + /** + * Writes the given data to a cache store, associated with the given key. An + * optional TTL may also be provided, otherwise it defaults to the TTL that + * was provided when the client was instantiated. + */ set(key: string, value: JsonValue, ttl?: number): Promise; + + /** + * Removes the given key from the cache store. + */ delete(key: string): Promise; } +/** + * A simple, concrete implementation of the CacheClient, suitable for almost + * all uses in Backstage. + */ export class ConcreteCacheClient implements CacheClient { private readonly client: cacheManager.Cache; private readonly pluginId: string; diff --git a/packages/backend-common/src/cache/CacheManager.ts b/packages/backend-common/src/cache/CacheManager.ts index f1c3b279fd..de27bb0e3d 100644 --- a/packages/backend-common/src/cache/CacheManager.ts +++ b/packages/backend-common/src/cache/CacheManager.ts @@ -21,10 +21,7 @@ import Memcache from 'memcache-pp'; // @ts-expect-error import memcachedStore from 'cache-manager-memcached-store'; import { ConcreteCacheClient, CacheClient } from './CacheClient'; - -export type PluginCacheManager = { - getClient: (ttl: number) => CacheClient; -}; +import { PluginCacheManager } from './types'; /** * Implements a Cache Manager which will automatically create new cache clients diff --git a/packages/backend-common/src/cache/index.ts b/packages/backend-common/src/cache/index.ts index ba1625d043..c233621bd4 100644 --- a/packages/backend-common/src/cache/index.ts +++ b/packages/backend-common/src/cache/index.ts @@ -14,5 +14,6 @@ * limitations under the License. */ -export * from './CacheClient'; +export type { CacheClient } from './CacheClient'; export * from './CacheManager'; +export * from './types'; diff --git a/packages/backend-common/src/cache/types.ts b/packages/backend-common/src/cache/types.ts new file mode 100644 index 0000000000..f1b9e96709 --- /dev/null +++ b/packages/backend-common/src/cache/types.ts @@ -0,0 +1,31 @@ +/* + * Copyright 2020 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 { CacheClient } from './CacheClient'; + +/** + * The PluginCacheManager manages access to cache stores that Plugins get. + */ +export type PluginCacheManager = { + /** + * getClient provides backend plugins cache connections for itself. + * + * The purpose of this method is to allow plugins to get isolated data + * stores so that plugins are discouraged from cache-level integration + * and/or cache key collisions. + */ + getClient: (ttl: number) => CacheClient; +}; From 669ff5ee2ecca049c25008db86d2b93221831355 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Sun, 2 May 2021 16:46:12 +0200 Subject: [PATCH 429/485] Declare new public API Signed-off-by: Eric Peterson --- packages/backend-common/api-report.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/backend-common/api-report.md b/packages/backend-common/api-report.md index f0cb066dc0..339a291ff3 100644 --- a/packages/backend-common/api-report.md +++ b/packages/backend-common/api-report.md @@ -16,6 +16,7 @@ import { GithubCredentialsProvider } from '@backstage/integration'; import { GitHubIntegration } from '@backstage/integration'; import { GitLabIntegration } from '@backstage/integration'; import * as http from 'http'; +import { JsonValue } from '@backstage/config'; import { Knex } from 'knex'; import { Logger } from 'winston'; import { MergeResult } from 'isomorphic-git'; @@ -62,6 +63,19 @@ export class BitbucketUrlReader implements UrlReader { toString(): string; } +// @public +export interface CacheClient { + delete(key: string): Promise; + get(key: string): Promise; + set(key: string, value: JsonValue, ttl?: number): Promise; +} + +// @public +export class CacheManager { + forPlugin(pluginId: string): PluginCacheManager; + static fromConfig(config: Config): CacheManager; + } + // @public (undocumented) export const coloredFormat: winston.Logform.Format; @@ -238,6 +252,11 @@ export function loadBackendConfig(options: Options): Promise; // @public export function notFoundHandler(): RequestHandler; +// @public +export type PluginCacheManager = { + getClient: (ttl: number) => CacheClient; +}; + // @public export interface PluginDatabaseManager { getClient(): Promise; From 22fd8ce2ac4cfccef1aa8d1af30a8af6c0011e60 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Sun, 2 May 2021 17:10:10 +0200 Subject: [PATCH 430/485] Changeset Signed-off-by: Eric Peterson --- .changeset/cool-cache-bro.md | 44 ++++++++++++++++++++++++++++++++++++ .github/styles/vocab.txt | 1 + 2 files changed, 45 insertions(+) create mode 100644 .changeset/cool-cache-bro.md diff --git a/.changeset/cool-cache-bro.md b/.changeset/cool-cache-bro.md new file mode 100644 index 0000000000..f86dc39339 --- /dev/null +++ b/.changeset/cool-cache-bro.md @@ -0,0 +1,44 @@ +--- +'@backstage/backend-common': minor +--- + +Introducing: a standard API for App Integrators to configure cache stores and Plugin Developers to interact with them. + +Two cache stores are currently supported. + +- `memory`, which is a very simple in-memory LRU cache, intended for local development. +- `memcache`, which can be used to connect to one or more memcache hosts. + +Configuring and working with cache stores is very similar to the process for database connections. + +```yaml +backend: + cache: + store: memcache + connection: + hosts: + - cache-a.example.com:11211 + - cache-b.example.com:11211 +``` + +```typescript +import { CacheManager } from '@backstage/backend-common'; + +// Instantiating a cache client for a plugin. +const cacheManager = CacheManager.fromConfig(config); +const somePluginCache = cacheManager.forPlugin('somePlugin'); +const defaultTtl = 3600; +const cacheClient = somePluginCache.getClient(defaultTtl); + +// Using the cache client: +const cachedValue = await cacheClient.get('someKey'); +if (cachedValue) { + return cachedValue; +} else { + const someValue = await someExpensiveProcess(); + await cacheClient.set('someKey', someValue); +} +await cacheClient.delete('someKey'); +``` + +Configuring a cache store is optional. Even when no cache store is configured, the cache manager will dutifully pass plugins a manager that resolves a cache client that does not actually write or read any data. diff --git a/.github/styles/vocab.txt b/.github/styles/vocab.txt index 694226b8cc..ff856239bf 100644 --- a/.github/styles/vocab.txt +++ b/.github/styles/vocab.txt @@ -167,6 +167,7 @@ mailto maintainership makefile md +memcache microsite middleware minikube From ac8f7e4666c9c8e856e141d1ac0b060079e1a747 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Sun, 2 May 2021 17:27:01 +0200 Subject: [PATCH 431/485] Dev dependency. Signed-off-by: Eric Peterson --- packages/backend-common/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/backend-common/package.json b/packages/backend-common/package.json index 513fe2f985..0f331ccc6b 100644 --- a/packages/backend-common/package.json +++ b/packages/backend-common/package.json @@ -80,6 +80,7 @@ "@backstage/cli": "^0.6.10", "@backstage/test-utils": "^0.1.10", "@types/archiver": "^5.1.0", + "@types/cache-manager": "^3.4.0", "@types/compression": "^1.7.0", "@types/concat-stream": "^1.6.0", "@types/fs-extra": "^9.0.3", From b73dc5f46e19fcc45400279e25c0814d144f1850 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Mon, 3 May 2021 16:57:59 +0200 Subject: [PATCH 432/485] Clean up some types Signed-off-by: Eric Peterson --- .../src/cache/CacheClient.test.ts | 24 ++++++------- .../backend-common/src/cache/CacheClient.ts | 28 +++++++++------ .../src/cache/CacheManager.test.ts | 20 +++++------ .../backend-common/src/cache/CacheManager.ts | 35 ++++++++++--------- packages/backend-common/src/cache/index.ts | 4 +-- packages/backend-common/src/cache/types.ts | 6 +++- 6 files changed, 65 insertions(+), 52 deletions(-) diff --git a/packages/backend-common/src/cache/CacheClient.test.ts b/packages/backend-common/src/cache/CacheClient.test.ts index aadcee7386..5d56d84c61 100644 --- a/packages/backend-common/src/cache/CacheClient.test.ts +++ b/packages/backend-common/src/cache/CacheClient.test.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { ConcreteCacheClient } from './CacheClient'; +import { DefaultCacheClient } from './CacheClient'; import cacheManager from 'cache-manager'; describe('CacheClient', () => { @@ -33,7 +33,7 @@ describe('CacheClient', () => { describe('CacheClient.get', () => { it('calls client with normalized key', async () => { - const sut = new ConcreteCacheClient({ client, pluginId }); + const sut = new DefaultCacheClient({ client, pluginId }); const keyPartial = 'somekey'; await sut.get(keyPartial); @@ -42,7 +42,7 @@ describe('CacheClient', () => { }); it('calls client with normalized key (very long key)', async () => { - const sut = new ConcreteCacheClient({ client, pluginId }); + const sut = new DefaultCacheClient({ client, pluginId }); const keyPartial = 'x'.repeat(251); await sut.get(keyPartial); @@ -55,7 +55,7 @@ describe('CacheClient', () => { it('performs deserialization on returned data', async () => { const expectedValue = { some: 'value' }; - const sut = new ConcreteCacheClient({ client, pluginId }); + const sut = new DefaultCacheClient({ client, pluginId }); client.get = jest.fn().mockResolvedValue(JSON.stringify(expectedValue)); const actualValue = await sut.get('someKey'); @@ -64,7 +64,7 @@ describe('CacheClient', () => { }); it('returns null on any underlying error', async () => { - const sut = new ConcreteCacheClient({ client, pluginId }); + const sut = new DefaultCacheClient({ client, pluginId }); client.get = jest.fn().mockRejectedValue(undefined); const actualValue = await sut.get('someKey'); @@ -75,7 +75,7 @@ describe('CacheClient', () => { describe('CacheClient.set', () => { it('calls client with normalized key', async () => { - const sut = new ConcreteCacheClient({ client, pluginId }); + const sut = new DefaultCacheClient({ client, pluginId }); const keyPartial = 'somekey'; await sut.set(keyPartial, {}); @@ -86,7 +86,7 @@ describe('CacheClient', () => { }); it('performs serialization on given data', async () => { - const sut = new ConcreteCacheClient({ client, pluginId }); + const sut = new DefaultCacheClient({ client, pluginId }); const expectedData = { some: 'value' }; await sut.set('someKey', expectedData); @@ -97,10 +97,10 @@ describe('CacheClient', () => { }); it('passes ttl to client when given', async () => { - const sut = new ConcreteCacheClient({ client, pluginId }); + const sut = new DefaultCacheClient({ client, pluginId }); const expectedTtl = 3600; - await sut.set('someKey', {}, expectedTtl); + await sut.set('someKey', {}, { ttl: expectedTtl }); const spy = client.set as jest.Mock; const actualOptions = spy.mock.calls[0][2]; @@ -108,7 +108,7 @@ describe('CacheClient', () => { }); it('does not throw errors on any client error', async () => { - const sut = new ConcreteCacheClient({ client, pluginId }); + const sut = new DefaultCacheClient({ client, pluginId }); client.set = jest.fn().mockRejectedValue(undefined); expect(async () => { @@ -119,7 +119,7 @@ describe('CacheClient', () => { describe('CacheClient.delete', () => { it('calls client with normalized key', async () => { - const sut = new ConcreteCacheClient({ client, pluginId }); + const sut = new DefaultCacheClient({ client, pluginId }); const keyPartial = 'somekey'; await sut.delete(keyPartial); @@ -130,7 +130,7 @@ describe('CacheClient', () => { }); it('does not throw errors on any client error', async () => { - const sut = new ConcreteCacheClient({ client, pluginId }); + const sut = new DefaultCacheClient({ client, pluginId }); client.del = jest.fn().mockRejectedValue(undefined); expect(async () => { diff --git a/packages/backend-common/src/cache/CacheClient.ts b/packages/backend-common/src/cache/CacheClient.ts index 0716b159cb..68c762eb87 100644 --- a/packages/backend-common/src/cache/CacheClient.ts +++ b/packages/backend-common/src/cache/CacheClient.ts @@ -23,6 +23,10 @@ type CacheClientArgs = { pluginId: string; }; +type CacheSetOptions = { + ttl?: number; +}; + /** * A pre-configured, storage agnostic cache client suitable for use by * Backstage plugins. @@ -38,7 +42,7 @@ export interface CacheClient { * optional TTL may also be provided, otherwise it defaults to the TTL that * was provided when the client was instantiated. */ - set(key: string, value: JsonValue, ttl?: number): Promise; + set(key: string, value: JsonValue, options: CacheSetOptions): Promise; /** * Removes the given key from the cache store. @@ -50,7 +54,7 @@ export interface CacheClient { * A simple, concrete implementation of the CacheClient, suitable for almost * all uses in Backstage. */ -export class ConcreteCacheClient implements CacheClient { +export class DefaultCacheClient implements CacheClient { private readonly client: cacheManager.Cache; private readonly pluginId: string; @@ -63,18 +67,22 @@ export class ConcreteCacheClient implements CacheClient { const k = this.getNormalizedKey(key); try { const data = (await this.client.get(k)) as string | undefined; - return this.unserializeData(data); - } catch (_e) { + return this.deserializeData(data); + } catch { return null; } } - async set(key: string, value: JsonValue, ttl?: number): Promise { + async set( + key: string, + value: JsonValue, + opts: CacheSetOptions = {}, + ): Promise { const k = this.getNormalizedKey(key); try { const data = this.serializeData(value); - await this.client.set(k, data, ttl ? { ttl } : undefined); - } catch (_e) { + await this.client.set(k, data, opts.ttl ? { ttl: opts.ttl } : undefined); + } catch { return; } } @@ -83,7 +91,7 @@ export class ConcreteCacheClient implements CacheClient { const k = this.getNormalizedKey(key); try { await this.client.del(k); - } catch (_e) { + } catch { return; } } @@ -102,14 +110,14 @@ export class ConcreteCacheClient implements CacheClient { return wellFormedKey; } - return createHash('md5').update(candidateKey).digest('hex'); + return createHash('md5').update(candidateKey).digest('base64'); } private serializeData(data: JsonValue): string { return JSON.stringify(data); } - private unserializeData(data: string | undefined): JsonValue { + private deserializeData(data: string | undefined): JsonValue { return data ? JSON.parse(data) : null; } } diff --git a/packages/backend-common/src/cache/CacheManager.test.ts b/packages/backend-common/src/cache/CacheManager.test.ts index af8450975a..625c772dec 100644 --- a/packages/backend-common/src/cache/CacheManager.test.ts +++ b/packages/backend-common/src/cache/CacheManager.test.ts @@ -16,13 +16,13 @@ import { ConfigReader } from '@backstage/config'; import cacheManager from 'cache-manager'; -import { ConcreteCacheClient } from './CacheClient'; +import { DefaultCacheClient } from './CacheClient'; import { CacheManager } from './CacheManager'; cacheManager.caching = jest.fn() as jest.Mock; jest.mock('./CacheClient', () => { return { - ConcreteCacheClient: jest.fn(), + DefaultCacheClient: jest.fn(), }; }); @@ -63,9 +63,9 @@ describe('CacheManager', () => { it('connects to a cache store scoped to the plugin', async () => { const pluginId = 'test1'; const expectedTtl = 3600; - manager.forPlugin(pluginId).getClient(expectedTtl); + manager.forPlugin(pluginId).getClient({ defaultTtl: expectedTtl }); - const client = ConcreteCacheClient as jest.Mock; + const client = DefaultCacheClient as jest.Mock; expect(client).toHaveBeenCalledTimes(1); }); @@ -73,11 +73,11 @@ describe('CacheManager', () => { const plugin1Id = 'test1'; const plugin2Id = 'test2'; const expectedTtl = 3600; - manager.forPlugin(plugin1Id).getClient(expectedTtl); - manager.forPlugin(plugin2Id).getClient(expectedTtl); + manager.forPlugin(plugin1Id).getClient({ defaultTtl: expectedTtl }); + manager.forPlugin(plugin2Id).getClient({ defaultTtl: expectedTtl }); const cache = cacheManager.caching as jest.Mock; - const client = ConcreteCacheClient as jest.Mock; + const client = DefaultCacheClient as jest.Mock; expect(cache).toHaveBeenCalledTimes(2); expect(client).toHaveBeenCalledTimes(2); @@ -95,7 +95,7 @@ describe('CacheManager', () => { new ConfigReader({ backend: {} }), ); const expectedTtl = 3600; - manager.forPlugin('test').getClient(expectedTtl); + manager.forPlugin('test').getClient({ defaultTtl: expectedTtl }); const cache = cacheManager.caching as jest.Mock; const mockCalls = cache.mock.calls.splice(-1); @@ -109,7 +109,7 @@ describe('CacheManager', () => { it('returns memory client when configured', () => { const manager = CacheManager.fromConfig(defaultConfig()); const expectedTtl = 3600; - manager.forPlugin('test').getClient(expectedTtl); + manager.forPlugin('test').getClient({ defaultTtl: expectedTtl }); const cache = cacheManager.caching as jest.Mock; const mockCalls = cache.mock.calls.splice(-1); @@ -137,7 +137,7 @@ describe('CacheManager', () => { }), ); const expectedTtl = 3600; - manager.forPlugin('test').getClient(expectedTtl); + manager.forPlugin('test').getClient({ defaultTtl: expectedTtl }); const cache = cacheManager.caching as jest.Mock; const mockCalls = cache.mock.calls.splice(-1); diff --git a/packages/backend-common/src/cache/CacheManager.ts b/packages/backend-common/src/cache/CacheManager.ts index de27bb0e3d..065a0b1db5 100644 --- a/packages/backend-common/src/cache/CacheManager.ts +++ b/packages/backend-common/src/cache/CacheManager.ts @@ -20,7 +20,7 @@ import cacheManager from 'cache-manager'; import Memcache from 'memcache-pp'; // @ts-expect-error import memcachedStore from 'cache-manager-memcached-store'; -import { ConcreteCacheClient, CacheClient } from './CacheClient'; +import { DefaultCacheClient, CacheClient } from './CacheClient'; import { PluginCacheManager } from './types'; /** @@ -30,10 +30,11 @@ import { PluginCacheManager } from './types'; */ export class CacheManager { /** - * Keys represented supported `backend.cache.store` values, mapped to getters - * that return cacheManager.Cache instances appropriate to the store. + * Keys represented supported `backend.cache.store` values, mapped to + * factories that return cacheManager.Cache instances appropriate to the + * store. */ - private readonly storeGetterMap = { + private readonly storeFactories = { memcache: this.getMemcacheClient, memory: this.getMemoryClient, none: this.getNoneClient, @@ -62,9 +63,9 @@ export class CacheManager { */ forPlugin(pluginId: string): PluginCacheManager { return { - getClient: (ttl: number): CacheClient => { - const concreteClient = this.getClientWithTtl(ttl); - return new ConcreteCacheClient({ + getClient: ({ defaultTtl }): CacheClient => { + const concreteClient = this.getClientWithTtl(defaultTtl); + return new DefaultCacheClient({ client: concreteClient, pluginId: pluginId, }); @@ -75,15 +76,15 @@ export class CacheManager { private getClientWithTtl(ttl: number): cacheManager.Cache { const store = this.config.getOptionalString( 'store', - ) as keyof CacheManager['storeGetterMap']; + ) as keyof CacheManager['storeFactories']; - if (this.storeGetterMap.hasOwnProperty(store)) { - return this.storeGetterMap[store].call(this, ttl); + if (this.storeFactories.hasOwnProperty(store)) { + return this.storeFactories[store].call(this, ttl); } - return this.storeGetterMap.none.call(this, ttl); + return this.storeFactories.none.call(this, ttl); } - private getMemcacheClient(ttl: number): cacheManager.Cache { + private getMemcacheClient(defaultTtl: number): cacheManager.Cache { const hosts = this.config.getStringArray('connection.hosts'); const netTimeout = this.config.getOptionalNumber('connection.netTimeout'); return cacheManager.caching({ @@ -93,21 +94,21 @@ export class CacheManager { hosts, ...(netTimeout && { netTimeout }), }, - ttl, + ttl: defaultTtl, }); } - private getMemoryClient(ttl: number): cacheManager.Cache { + private getMemoryClient(defaultTtl: number): cacheManager.Cache { return cacheManager.caching({ store: 'memory', - ttl, + ttl: defaultTtl, }); } - private getNoneClient(ttl: number): cacheManager.Cache { + private getNoneClient(defaultTtl: number): cacheManager.Cache { return cacheManager.caching({ store: 'none', - ttl, + ttl: defaultTtl, }); } } diff --git a/packages/backend-common/src/cache/index.ts b/packages/backend-common/src/cache/index.ts index c233621bd4..0cc8178b1a 100644 --- a/packages/backend-common/src/cache/index.ts +++ b/packages/backend-common/src/cache/index.ts @@ -15,5 +15,5 @@ */ export type { CacheClient } from './CacheClient'; -export * from './CacheManager'; -export * from './types'; +export { CacheManager } from './CacheManager'; +export type { PluginCacheManager } from './types'; diff --git a/packages/backend-common/src/cache/types.ts b/packages/backend-common/src/cache/types.ts index f1b9e96709..c93455e6b2 100644 --- a/packages/backend-common/src/cache/types.ts +++ b/packages/backend-common/src/cache/types.ts @@ -16,6 +16,10 @@ import { CacheClient } from './CacheClient'; +type ClientOptions = { + defaultTtl: number; +}; + /** * The PluginCacheManager manages access to cache stores that Plugins get. */ @@ -27,5 +31,5 @@ export type PluginCacheManager = { * stores so that plugins are discouraged from cache-level integration * and/or cache key collisions. */ - getClient: (ttl: number) => CacheClient; + getClient: (options: ClientOptions) => CacheClient; }; From cc6047512793026b842d678a9d57e81dd247b846 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Mon, 3 May 2021 17:09:20 +0200 Subject: [PATCH 433/485] Clarify default TTL behavior. Signed-off-by: Eric Peterson --- .../src/cache/CacheClient.test.ts | 31 +++++++++++++------ .../backend-common/src/cache/CacheClient.ts | 9 ++++-- .../backend-common/src/cache/CacheManager.ts | 1 + 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/packages/backend-common/src/cache/CacheClient.test.ts b/packages/backend-common/src/cache/CacheClient.test.ts index 5d56d84c61..2e14fdbea1 100644 --- a/packages/backend-common/src/cache/CacheClient.test.ts +++ b/packages/backend-common/src/cache/CacheClient.test.ts @@ -19,6 +19,7 @@ import cacheManager from 'cache-manager'; describe('CacheClient', () => { const pluginId = 'test'; + const defaultTtl = 60; let client: cacheManager.Cache; const b64 = (k: string) => Buffer.from(k).toString('base64'); @@ -33,7 +34,7 @@ describe('CacheClient', () => { describe('CacheClient.get', () => { it('calls client with normalized key', async () => { - const sut = new DefaultCacheClient({ client, pluginId }); + const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); const keyPartial = 'somekey'; await sut.get(keyPartial); @@ -42,7 +43,7 @@ describe('CacheClient', () => { }); it('calls client with normalized key (very long key)', async () => { - const sut = new DefaultCacheClient({ client, pluginId }); + const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); const keyPartial = 'x'.repeat(251); await sut.get(keyPartial); @@ -55,7 +56,7 @@ describe('CacheClient', () => { it('performs deserialization on returned data', async () => { const expectedValue = { some: 'value' }; - const sut = new DefaultCacheClient({ client, pluginId }); + const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); client.get = jest.fn().mockResolvedValue(JSON.stringify(expectedValue)); const actualValue = await sut.get('someKey'); @@ -64,7 +65,7 @@ describe('CacheClient', () => { }); it('returns null on any underlying error', async () => { - const sut = new DefaultCacheClient({ client, pluginId }); + const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); client.get = jest.fn().mockRejectedValue(undefined); const actualValue = await sut.get('someKey'); @@ -75,7 +76,7 @@ describe('CacheClient', () => { describe('CacheClient.set', () => { it('calls client with normalized key', async () => { - const sut = new DefaultCacheClient({ client, pluginId }); + const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); const keyPartial = 'somekey'; await sut.set(keyPartial, {}); @@ -86,7 +87,7 @@ describe('CacheClient', () => { }); it('performs serialization on given data', async () => { - const sut = new DefaultCacheClient({ client, pluginId }); + const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); const expectedData = { some: 'value' }; await sut.set('someKey', expectedData); @@ -97,7 +98,7 @@ describe('CacheClient', () => { }); it('passes ttl to client when given', async () => { - const sut = new DefaultCacheClient({ client, pluginId }); + const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); const expectedTtl = 3600; await sut.set('someKey', {}, { ttl: expectedTtl }); @@ -107,8 +108,18 @@ describe('CacheClient', () => { expect(actualOptions.ttl).toEqual(expectedTtl); }); + it('passes defaultTtl to client when not', async () => { + const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); + + await sut.set('someKey', {}); + + const spy = client.set as jest.Mock; + const actualOptions = spy.mock.calls[0][2]; + expect(actualOptions.ttl).toEqual(defaultTtl); + }); + it('does not throw errors on any client error', async () => { - const sut = new DefaultCacheClient({ client, pluginId }); + const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); client.set = jest.fn().mockRejectedValue(undefined); expect(async () => { @@ -119,7 +130,7 @@ describe('CacheClient', () => { describe('CacheClient.delete', () => { it('calls client with normalized key', async () => { - const sut = new DefaultCacheClient({ client, pluginId }); + const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); const keyPartial = 'somekey'; await sut.delete(keyPartial); @@ -130,7 +141,7 @@ describe('CacheClient', () => { }); it('does not throw errors on any client error', async () => { - const sut = new DefaultCacheClient({ client, pluginId }); + const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); client.del = jest.fn().mockRejectedValue(undefined); expect(async () => { diff --git a/packages/backend-common/src/cache/CacheClient.ts b/packages/backend-common/src/cache/CacheClient.ts index 68c762eb87..52703a28d4 100644 --- a/packages/backend-common/src/cache/CacheClient.ts +++ b/packages/backend-common/src/cache/CacheClient.ts @@ -21,6 +21,7 @@ import { createHash } from 'crypto'; type CacheClientArgs = { client: cacheManager.Cache; pluginId: string; + defaultTtl: number; }; type CacheSetOptions = { @@ -56,10 +57,12 @@ export interface CacheClient { */ export class DefaultCacheClient implements CacheClient { private readonly client: cacheManager.Cache; + private readonly defaultTtl: number; private readonly pluginId: string; - constructor({ client, pluginId }: CacheClientArgs) { + constructor({ client, defaultTtl, pluginId }: CacheClientArgs) { this.client = client; + this.defaultTtl = defaultTtl; this.pluginId = pluginId; } @@ -81,7 +84,9 @@ export class DefaultCacheClient implements CacheClient { const k = this.getNormalizedKey(key); try { const data = this.serializeData(value); - await this.client.set(k, data, opts.ttl ? { ttl: opts.ttl } : undefined); + await this.client.set(k, data, { + ttl: opts.ttl || this.defaultTtl, + }); } catch { return; } diff --git a/packages/backend-common/src/cache/CacheManager.ts b/packages/backend-common/src/cache/CacheManager.ts index 065a0b1db5..ecccbcf712 100644 --- a/packages/backend-common/src/cache/CacheManager.ts +++ b/packages/backend-common/src/cache/CacheManager.ts @@ -67,6 +67,7 @@ export class CacheManager { const concreteClient = this.getClientWithTtl(defaultTtl); return new DefaultCacheClient({ client: concreteClient, + defaultTtl, pluginId: pluginId, }); }, From b71c230beb1f5985eebe8deb78cfd88ce38e6134 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Mon, 3 May 2021 17:37:28 +0200 Subject: [PATCH 434/485] Refactor CacheManager.fromConfig Signed-off-by: Eric Peterson --- .../src/cache/CacheManager.test.ts | 16 ++++++++- .../backend-common/src/cache/CacheManager.ts | 35 +++++++++++-------- 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/packages/backend-common/src/cache/CacheManager.test.ts b/packages/backend-common/src/cache/CacheManager.test.ts index 625c772dec..08fa06e311 100644 --- a/packages/backend-common/src/cache/CacheManager.test.ts +++ b/packages/backend-common/src/cache/CacheManager.test.ts @@ -41,12 +41,17 @@ describe('CacheManager', () => { describe('CacheManager.fromConfig', () => { it('accesses the backend.cache key', () => { const getOptionalConfig = jest.fn(); + const getOptionalString = jest.fn(); const config = defaultConfig(); config.getOptionalConfig = getOptionalConfig; + config.getOptionalString = getOptionalString; CacheManager.fromConfig(config); - expect(getOptionalConfig.mock.calls[0][0]).toEqual('backend.cache'); + expect(getOptionalString.mock.calls[0][0]).toEqual('backend.cache.store'); + expect(getOptionalConfig.mock.calls[0][0]).toEqual( + 'backend.cache.connection', + ); }); it('does not require the backend.cache key', () => { @@ -55,6 +60,15 @@ describe('CacheManager', () => { CacheManager.fromConfig(config); }).not.toThrowError(); }); + + it('throws on unknown cache store', () => { + const config = new ConfigReader({ + backend: { cache: { store: 'notreal' } }, + }); + expect(() => { + CacheManager.fromConfig(config); + }).toThrowError(); + }); }); describe('CacheManager.forPlugin', () => { diff --git a/packages/backend-common/src/cache/CacheManager.ts b/packages/backend-common/src/cache/CacheManager.ts index ecccbcf712..1c2c003b39 100644 --- a/packages/backend-common/src/cache/CacheManager.ts +++ b/packages/backend-common/src/cache/CacheManager.ts @@ -30,7 +30,7 @@ import { PluginCacheManager } from './types'; */ export class CacheManager { /** - * Keys represented supported `backend.cache.store` values, mapped to + * Keys represents supported `backend.cache.store` values, mapped to * factories that return cacheManager.Cache instances appropriate to the * store. */ @@ -40,6 +40,9 @@ export class CacheManager { none: this.getNoneClient, }; + private readonly store: keyof CacheManager['storeFactories']; + private readonly connection: Config; + /** * Creates a new CacheManager instance by reading from the `backend` config * section, specifically the `.cache` key. @@ -49,12 +52,21 @@ export class CacheManager { static fromConfig(config: Config): CacheManager { // If no `backend.cache` config is provided, instantiate the CacheManager // with empty config; allowing a "none" cache client will be returned. - return new CacheManager( - config.getOptionalConfig('backend.cache') || new ConfigReader(undefined), - ); + const store = config.getOptionalString('backend.cache.store') || 'none'; + const connectionConfig = + config.getOptionalConfig('backend.cache.connection') || + new ConfigReader(undefined); + + return new CacheManager(store, connectionConfig); } - private constructor(private readonly config: Config) {} + private constructor(store: string, connectionConfig: Config) { + if (!this.storeFactories.hasOwnProperty(store)) { + throw new Error(`Unknown cache store: ${store}`); + } + this.store = store as keyof CacheManager['storeFactories']; + this.connection = connectionConfig; + } /** * Generates a CacheManagerInstance for consumption by plugins. @@ -75,19 +87,12 @@ export class CacheManager { } private getClientWithTtl(ttl: number): cacheManager.Cache { - const store = this.config.getOptionalString( - 'store', - ) as keyof CacheManager['storeFactories']; - - if (this.storeFactories.hasOwnProperty(store)) { - return this.storeFactories[store].call(this, ttl); - } - return this.storeFactories.none.call(this, ttl); + return this.storeFactories[this.store].call(this, ttl); } private getMemcacheClient(defaultTtl: number): cacheManager.Cache { - const hosts = this.config.getStringArray('connection.hosts'); - const netTimeout = this.config.getOptionalNumber('connection.netTimeout'); + const hosts = this.connection.getStringArray('hosts'); + const netTimeout = this.connection.getOptionalNumber('netTimeout'); return cacheManager.caching({ store: memcachedStore, driver: Memcache, From 368a5158cc5ebaea6c21b2a8c6428307713e04f3 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Mon, 3 May 2021 18:13:12 +0200 Subject: [PATCH 435/485] Return an explicit undefined on no data. Signed-off-by: Eric Peterson --- .../backend-common/src/cache/CacheClient.test.ts | 4 ++-- packages/backend-common/src/cache/CacheClient.ts | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/backend-common/src/cache/CacheClient.test.ts b/packages/backend-common/src/cache/CacheClient.test.ts index 2e14fdbea1..2ae7cee494 100644 --- a/packages/backend-common/src/cache/CacheClient.test.ts +++ b/packages/backend-common/src/cache/CacheClient.test.ts @@ -64,13 +64,13 @@ describe('CacheClient', () => { expect(actualValue).toMatchObject(expectedValue); }); - it('returns null on any underlying error', async () => { + it('returns undefined on any underlying error', async () => { const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); client.get = jest.fn().mockRejectedValue(undefined); const actualValue = await sut.get('someKey'); - expect(actualValue).toStrictEqual(null); + expect(actualValue).toStrictEqual(undefined); }); }); diff --git a/packages/backend-common/src/cache/CacheClient.ts b/packages/backend-common/src/cache/CacheClient.ts index 52703a28d4..523dae6fed 100644 --- a/packages/backend-common/src/cache/CacheClient.ts +++ b/packages/backend-common/src/cache/CacheClient.ts @@ -34,9 +34,10 @@ type CacheSetOptions = { */ export interface CacheClient { /** - * Reads data from a cache store for the given key. + * Reads data from a cache store for the given key. If no data was found, + * returns undefined. */ - get(key: string): Promise; + get(key: string): Promise; /** * Writes the given data to a cache store, associated with the given key. An @@ -66,13 +67,13 @@ export class DefaultCacheClient implements CacheClient { this.pluginId = pluginId; } - async get(key: string): Promise { + async get(key: string): Promise { const k = this.getNormalizedKey(key); try { const data = (await this.client.get(k)) as string | undefined; return this.deserializeData(data); } catch { - return null; + return undefined; } } @@ -122,7 +123,7 @@ export class DefaultCacheClient implements CacheClient { return JSON.stringify(data); } - private deserializeData(data: string | undefined): JsonValue { - return data ? JSON.parse(data) : null; + private deserializeData(data: string | undefined): JsonValue | undefined { + return data ? JSON.parse(data) : undefined; } } From 7ff6a755752725bd855d5ccdfcff5e8076a2f04a Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Mon, 3 May 2021 18:50:07 +0200 Subject: [PATCH 436/485] Add an onError config to enable plugin devs to catch and handle underlying client errors Signed-off-by: Eric Peterson --- .../src/cache/CacheClient.test.ts | 129 +++++++++++++++--- .../backend-common/src/cache/CacheClient.ts | 22 ++- .../backend-common/src/cache/CacheManager.ts | 3 +- packages/backend-common/src/cache/types.ts | 1 + 4 files changed, 129 insertions(+), 26 deletions(-) diff --git a/packages/backend-common/src/cache/CacheClient.test.ts b/packages/backend-common/src/cache/CacheClient.test.ts index 2ae7cee494..a08bb245f8 100644 --- a/packages/backend-common/src/cache/CacheClient.test.ts +++ b/packages/backend-common/src/cache/CacheClient.test.ts @@ -20,6 +20,7 @@ import cacheManager from 'cache-manager'; describe('CacheClient', () => { const pluginId = 'test'; const defaultTtl = 60; + const onError = 'returnEmpty'; let client: cacheManager.Cache; const b64 = (k: string) => Buffer.from(k).toString('base64'); @@ -34,7 +35,12 @@ describe('CacheClient', () => { describe('CacheClient.get', () => { it('calls client with normalized key', async () => { - const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); + const sut = new DefaultCacheClient({ + client, + defaultTtl, + pluginId, + onError, + }); const keyPartial = 'somekey'; await sut.get(keyPartial); @@ -43,7 +49,12 @@ describe('CacheClient', () => { }); it('calls client with normalized key (very long key)', async () => { - const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); + const sut = new DefaultCacheClient({ + client, + defaultTtl, + pluginId, + onError, + }); const keyPartial = 'x'.repeat(251); await sut.get(keyPartial); @@ -56,7 +67,12 @@ describe('CacheClient', () => { it('performs deserialization on returned data', async () => { const expectedValue = { some: 'value' }; - const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); + const sut = new DefaultCacheClient({ + client, + defaultTtl, + pluginId, + onError, + }); client.get = jest.fn().mockResolvedValue(JSON.stringify(expectedValue)); const actualValue = await sut.get('someKey'); @@ -65,18 +81,41 @@ describe('CacheClient', () => { }); it('returns undefined on any underlying error', async () => { - const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); + const sut = new DefaultCacheClient({ + client, + defaultTtl, + pluginId, + onError, + }); client.get = jest.fn().mockRejectedValue(undefined); const actualValue = await sut.get('someKey'); expect(actualValue).toStrictEqual(undefined); }); + + it('rejects on underlying error if configured', async () => { + const sut = new DefaultCacheClient({ + client, + defaultTtl, + pluginId, + onError: 'reject', + }); + const expectedError = new Error('Some runtime error'); + client.get = jest.fn().mockRejectedValue(expectedError); + + return expect(sut.get('someKey')).rejects.toEqual(expectedError); + }); }); describe('CacheClient.set', () => { it('calls client with normalized key', async () => { - const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); + const sut = new DefaultCacheClient({ + client, + defaultTtl, + pluginId, + onError, + }); const keyPartial = 'somekey'; await sut.set(keyPartial, {}); @@ -87,7 +126,12 @@ describe('CacheClient', () => { }); it('performs serialization on given data', async () => { - const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); + const sut = new DefaultCacheClient({ + client, + defaultTtl, + pluginId, + onError, + }); const expectedData = { some: 'value' }; await sut.set('someKey', expectedData); @@ -98,7 +142,12 @@ describe('CacheClient', () => { }); it('passes ttl to client when given', async () => { - const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); + const sut = new DefaultCacheClient({ + client, + defaultTtl, + pluginId, + onError, + }); const expectedTtl = 3600; await sut.set('someKey', {}, { ttl: expectedTtl }); @@ -109,7 +158,12 @@ describe('CacheClient', () => { }); it('passes defaultTtl to client when not', async () => { - const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); + const sut = new DefaultCacheClient({ + client, + defaultTtl, + pluginId, + onError, + }); await sut.set('someKey', {}); @@ -118,19 +172,40 @@ describe('CacheClient', () => { expect(actualOptions.ttl).toEqual(defaultTtl); }); - it('does not throw errors on any client error', async () => { - const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); + it('does not reject on any client error by default', async () => { + const sut = new DefaultCacheClient({ + client, + defaultTtl, + pluginId, + onError, + }); client.set = jest.fn().mockRejectedValue(undefined); - expect(async () => { - await sut.set('someKey', {}); - }).not.toThrow(); + return expect(sut.set('someKey', {})).resolves.toBeUndefined(); + }); + + it('rejects on underlying error if configured', async () => { + const sut = new DefaultCacheClient({ + client, + defaultTtl, + pluginId, + onError: 'reject', + }); + const expectedError = new Error('Some runtime error'); + client.set = jest.fn().mockRejectedValue(expectedError); + + return expect(sut.set('someKey', {})).rejects.toEqual(expectedError); }); }); describe('CacheClient.delete', () => { it('calls client with normalized key', async () => { - const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); + const sut = new DefaultCacheClient({ + client, + defaultTtl, + pluginId, + onError, + }); const keyPartial = 'somekey'; await sut.delete(keyPartial); @@ -140,13 +215,29 @@ describe('CacheClient', () => { expect(actualKey).toEqual(b64(`${pluginId}:${keyPartial}`)); }); - it('does not throw errors on any client error', async () => { - const sut = new DefaultCacheClient({ client, defaultTtl, pluginId }); + it('does not reject on any client error by default', async () => { + const sut = new DefaultCacheClient({ + client, + defaultTtl, + pluginId, + onError, + }); client.del = jest.fn().mockRejectedValue(undefined); - expect(async () => { - await sut.delete('someKey'); - }).not.toThrow(); + return expect(sut.delete('someKey')).resolves.toBeUndefined(); + }); + + it('rejects on underlying error if configured', async () => { + const sut = new DefaultCacheClient({ + client, + defaultTtl, + pluginId, + onError: 'reject', + }); + const expectedError = new Error('Some runtime error'); + client.del = jest.fn().mockRejectedValue(expectedError); + + return expect(sut.delete('someKey')).rejects.toEqual(expectedError); }); }); }); diff --git a/packages/backend-common/src/cache/CacheClient.ts b/packages/backend-common/src/cache/CacheClient.ts index 523dae6fed..e1f849ccb7 100644 --- a/packages/backend-common/src/cache/CacheClient.ts +++ b/packages/backend-common/src/cache/CacheClient.ts @@ -22,6 +22,7 @@ type CacheClientArgs = { client: cacheManager.Cache; pluginId: string; defaultTtl: number; + onError: 'reject' | 'returnEmpty'; }; type CacheSetOptions = { @@ -60,11 +61,13 @@ export class DefaultCacheClient implements CacheClient { private readonly client: cacheManager.Cache; private readonly defaultTtl: number; private readonly pluginId: string; + private readonly onError: 'reject' | 'returnEmpty'; - constructor({ client, defaultTtl, pluginId }: CacheClientArgs) { + constructor({ client, defaultTtl, pluginId, onError }: CacheClientArgs) { this.client = client; this.defaultTtl = defaultTtl; this.pluginId = pluginId; + this.onError = onError; } async get(key: string): Promise { @@ -72,7 +75,10 @@ export class DefaultCacheClient implements CacheClient { try { const data = (await this.client.get(k)) as string | undefined; return this.deserializeData(data); - } catch { + } catch (e) { + if (this.onError === 'reject') { + throw e; + } return undefined; } } @@ -88,8 +94,10 @@ export class DefaultCacheClient implements CacheClient { await this.client.set(k, data, { ttl: opts.ttl || this.defaultTtl, }); - } catch { - return; + } catch (e) { + if (this.onError === 'reject') { + throw e; + } } } @@ -97,8 +105,10 @@ export class DefaultCacheClient implements CacheClient { const k = this.getNormalizedKey(key); try { await this.client.del(k); - } catch { - return; + } catch (e) { + if (this.onError === 'reject') { + throw e; + } } } diff --git a/packages/backend-common/src/cache/CacheManager.ts b/packages/backend-common/src/cache/CacheManager.ts index 1c2c003b39..13fb75e314 100644 --- a/packages/backend-common/src/cache/CacheManager.ts +++ b/packages/backend-common/src/cache/CacheManager.ts @@ -75,12 +75,13 @@ export class CacheManager { */ forPlugin(pluginId: string): PluginCacheManager { return { - getClient: ({ defaultTtl }): CacheClient => { + getClient: ({ defaultTtl, onError }): CacheClient => { const concreteClient = this.getClientWithTtl(defaultTtl); return new DefaultCacheClient({ client: concreteClient, defaultTtl, pluginId: pluginId, + onError: onError || 'returnEmpty', }); }, }; diff --git a/packages/backend-common/src/cache/types.ts b/packages/backend-common/src/cache/types.ts index c93455e6b2..5cc5782b18 100644 --- a/packages/backend-common/src/cache/types.ts +++ b/packages/backend-common/src/cache/types.ts @@ -18,6 +18,7 @@ import { CacheClient } from './CacheClient'; type ClientOptions = { defaultTtl: number; + onError?: 'reject' | 'returnEmpty'; }; /** From 884c2bd54f08b0d9e72eaee4fb81294ab2a92201 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Mon, 3 May 2021 18:54:28 +0200 Subject: [PATCH 437/485] Update docs to reflect changes Signed-off-by: Eric Peterson --- .changeset/cool-cache-bro.md | 17 ++++++++++++++++- packages/backend-common/api-report.md | 6 +++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.changeset/cool-cache-bro.md b/.changeset/cool-cache-bro.md index f86dc39339..f342f39e55 100644 --- a/.changeset/cool-cache-bro.md +++ b/.changeset/cool-cache-bro.md @@ -28,7 +28,7 @@ import { CacheManager } from '@backstage/backend-common'; const cacheManager = CacheManager.fromConfig(config); const somePluginCache = cacheManager.forPlugin('somePlugin'); const defaultTtl = 3600; -const cacheClient = somePluginCache.getClient(defaultTtl); +const cacheClient = somePluginCache.getClient({ defaultTtl }); // Using the cache client: const cachedValue = await cacheClient.get('someKey'); @@ -41,4 +41,19 @@ if (cachedValue) { await cacheClient.delete('someKey'); ``` +For simplicity of use, cache clients will swallow client errors by default. Plugin developers may optionally pass an `onError` argument to the `CacheManager.getClient()` method if they wish to capture and handle those errors in a custom way. + +```typescript +const cacheClient = somePluginCache.getClient({ + defaultTtl: 3600, + onError: 'reject', +}); + +try { + await cacheClient.delete('someKey'); +} catch (e) { + // Attempt again, log, alert, etc. +} +``` + Configuring a cache store is optional. Even when no cache store is configured, the cache manager will dutifully pass plugins a manager that resolves a cache client that does not actually write or read any data. diff --git a/packages/backend-common/api-report.md b/packages/backend-common/api-report.md index 339a291ff3..bd1b017574 100644 --- a/packages/backend-common/api-report.md +++ b/packages/backend-common/api-report.md @@ -66,8 +66,8 @@ export class BitbucketUrlReader implements UrlReader { // @public export interface CacheClient { delete(key: string): Promise; - get(key: string): Promise; - set(key: string, value: JsonValue, ttl?: number): Promise; + get(key: string): Promise; + set(key: string, value: JsonValue, options: CacheSetOptions): Promise; } // @public @@ -254,7 +254,7 @@ export function notFoundHandler(): RequestHandler; // @public export type PluginCacheManager = { - getClient: (ttl: number) => CacheClient; + getClient: (options: ClientOptions) => CacheClient; }; // @public From d6936dcbde0d4f0b7e542ab15a0be90d31a7d443 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Sun, 9 May 2021 17:00:59 +0200 Subject: [PATCH 438/485] Swap out cache-manager for Keyv implementation. Signed-off-by: Eric Peterson --- packages/backend-common/config.d.ts | 18 +- packages/backend-common/package.json | 7 +- .../src/cache/CacheClient.test.ts | 215 +++++------------- .../backend-common/src/cache/CacheClient.ts | 78 ++----- .../src/cache/CacheManager.test.ts | 66 +++--- .../backend-common/src/cache/CacheManager.ts | 79 +++---- packages/backend-common/src/cache/types.ts | 10 +- yarn.lock | 109 ++++----- 8 files changed, 192 insertions(+), 390 deletions(-) diff --git a/packages/backend-common/config.d.ts b/packages/backend-common/config.d.ts index b4cf8580d9..875660a594 100644 --- a/packages/backend-common/config.d.ts +++ b/packages/backend-common/config.d.ts @@ -75,19 +75,11 @@ export interface Config { } | { store: 'memcache'; - connection: { - /** - * An array of memcache hosts, optionally including a port number. - * e.g. 127.0.0.1:11211 - */ - hosts: string[]; - - /** - * Number of milliseconds to wait before assuming there is a - * network timeout. Defaults to 500ms. - */ - netTimeout?: number; - }; + /** + * A memcache connection string in the form `user:pass@host:port`. + * @secret + */ + connection: string; }; cors?: { diff --git a/packages/backend-common/package.json b/packages/backend-common/package.json index 0f331ccc6b..9bd7de1227 100644 --- a/packages/backend-common/package.json +++ b/packages/backend-common/package.json @@ -36,13 +36,10 @@ "@backstage/integration": "^0.5.2", "@google-cloud/storage": "^5.8.0", "@octokit/rest": "^18.5.3", - "@types/cache-manager": "^3.4.0", "@types/cors": "^2.8.6", "@types/dockerode": "^3.2.1", "@types/express": "^4.17.6", "archiver": "^5.0.2", - "cache-manager": "^3.4.3", - "cache-manager-memcached-store": "^4.0.0", "compression": "^1.7.4", "concat-stream": "^2.0.0", "cors": "^2.8.5", @@ -54,10 +51,11 @@ "git-url-parse": "^11.4.4", "helmet": "^4.0.0", "isomorphic-git": "^1.8.0", + "keyv": "^4.0.3", + "keyv-memcache": "^1.2.5", "knex": "^0.95.1", "lodash": "^4.17.15", "logform": "^2.1.1", - "memcache-pp": "^0.3.3", "minimatch": "^3.0.4", "minimist": "^1.2.5", "morgan": "^1.10.0", @@ -80,7 +78,6 @@ "@backstage/cli": "^0.6.10", "@backstage/test-utils": "^0.1.10", "@types/archiver": "^5.1.0", - "@types/cache-manager": "^3.4.0", "@types/compression": "^1.7.0", "@types/concat-stream": "^1.6.0", "@types/fs-extra": "^9.0.3", diff --git a/packages/backend-common/src/cache/CacheClient.test.ts b/packages/backend-common/src/cache/CacheClient.test.ts index a08bb245f8..eb32d4a28f 100644 --- a/packages/backend-common/src/cache/CacheClient.test.ts +++ b/packages/backend-common/src/cache/CacheClient.test.ts @@ -15,229 +15,132 @@ */ import { DefaultCacheClient } from './CacheClient'; -import cacheManager from 'cache-manager'; +import Keyv from 'keyv'; describe('CacheClient', () => { - const pluginId = 'test'; - const defaultTtl = 60; - const onError = 'returnEmpty'; - let client: cacheManager.Cache; + let client: Keyv; const b64 = (k: string) => Buffer.from(k).toString('base64'); beforeEach(() => { - client = cacheManager.caching({ store: 'none', ttl: 0 }); + client = new Keyv(); client.get = jest.fn(); client.set = jest.fn(); - client.del = jest.fn(); + client.delete = jest.fn(); }); afterEach(() => jest.resetAllMocks()); describe('CacheClient.get', () => { it('calls client with normalized key', async () => { - const sut = new DefaultCacheClient({ - client, - defaultTtl, - pluginId, - onError, - }); - const keyPartial = 'somekey'; + const sut = new DefaultCacheClient({ client }); + const key = 'somekey'; - await sut.get(keyPartial); + await sut.get(key); - expect(client.get).toHaveBeenCalledWith(b64(`${pluginId}:${keyPartial}`)); + expect(client.get).toHaveBeenCalledWith(b64(key)); }); it('calls client with normalized key (very long key)', async () => { - const sut = new DefaultCacheClient({ - client, - defaultTtl, - pluginId, - onError, - }); - const keyPartial = 'x'.repeat(251); + const sut = new DefaultCacheClient({ client }); + const key = 'x'.repeat(251); - await sut.get(keyPartial); + await sut.get(key); const spy = client.get as jest.Mock; const actualKey = spy.mock.calls[0][0]; - expect(actualKey).not.toEqual(b64(`${pluginId}:${keyPartial}`)); + expect(actualKey).not.toEqual(b64(key)); expect(actualKey.length).toBeLessThan(250); }); - it('performs deserialization on returned data', async () => { - const expectedValue = { some: 'value' }; - const sut = new DefaultCacheClient({ - client, - defaultTtl, - pluginId, - onError, - }); - client.get = jest.fn().mockResolvedValue(JSON.stringify(expectedValue)); - - const actualValue = await sut.get('someKey'); - - expect(actualValue).toMatchObject(expectedValue); - }); - - it('returns undefined on any underlying error', async () => { - const sut = new DefaultCacheClient({ - client, - defaultTtl, - pluginId, - onError, - }); - client.get = jest.fn().mockRejectedValue(undefined); - - const actualValue = await sut.get('someKey'); - - expect(actualValue).toStrictEqual(undefined); - }); - - it('rejects on underlying error if configured', async () => { - const sut = new DefaultCacheClient({ - client, - defaultTtl, - pluginId, - onError: 'reject', - }); + it('rejects on underlying error', async () => { + const sut = new DefaultCacheClient({ client }); const expectedError = new Error('Some runtime error'); client.get = jest.fn().mockRejectedValue(expectedError); return expect(sut.get('someKey')).rejects.toEqual(expectedError); }); + + it('resolves what underlying client resolves', async () => { + const sut = new DefaultCacheClient({ client }); + const expectedValue = 'some value'; + client.get = jest.fn().mockResolvedValue(expectedValue); + + const actualValue = await sut.get('someKey'); + + return expect(actualValue).toEqual(expectedValue); + }); }); describe('CacheClient.set', () => { it('calls client with normalized key', async () => { - const sut = new DefaultCacheClient({ - client, - defaultTtl, - pluginId, - onError, - }); - const keyPartial = 'somekey'; + const sut = new DefaultCacheClient({ client }); + const key = 'somekey'; - await sut.set(keyPartial, {}); + await sut.set(key, {}); const spy = client.set as jest.Mock; const actualKey = spy.mock.calls[0][0]; - expect(actualKey).toEqual(b64(`${pluginId}:${keyPartial}`)); - }); - - it('performs serialization on given data', async () => { - const sut = new DefaultCacheClient({ - client, - defaultTtl, - pluginId, - onError, - }); - const expectedData = { some: 'value' }; - - await sut.set('someKey', expectedData); - - const spy = client.set as jest.Mock; - const actualData = spy.mock.calls[0][1]; - expect(actualData).toEqual(JSON.stringify(expectedData)); + expect(actualKey).toEqual(b64(key)); }); it('passes ttl to client when given', async () => { - const sut = new DefaultCacheClient({ - client, - defaultTtl, - pluginId, - onError, - }); + const sut = new DefaultCacheClient({ client }); const expectedTtl = 3600; await sut.set('someKey', {}, { ttl: expectedTtl }); const spy = client.set as jest.Mock; - const actualOptions = spy.mock.calls[0][2]; - expect(actualOptions.ttl).toEqual(expectedTtl); - }); - - it('passes defaultTtl to client when not', async () => { - const sut = new DefaultCacheClient({ - client, - defaultTtl, - pluginId, - onError, - }); - - await sut.set('someKey', {}); - - const spy = client.set as jest.Mock; - const actualOptions = spy.mock.calls[0][2]; - expect(actualOptions.ttl).toEqual(defaultTtl); - }); - - it('does not reject on any client error by default', async () => { - const sut = new DefaultCacheClient({ - client, - defaultTtl, - pluginId, - onError, - }); - client.set = jest.fn().mockRejectedValue(undefined); - - return expect(sut.set('someKey', {})).resolves.toBeUndefined(); + const actualTtl = spy.mock.calls[0][2]; + expect(actualTtl).toEqual(expectedTtl); }); it('rejects on underlying error if configured', async () => { - const sut = new DefaultCacheClient({ - client, - defaultTtl, - pluginId, - onError: 'reject', - }); + const sut = new DefaultCacheClient({ client }); const expectedError = new Error('Some runtime error'); client.set = jest.fn().mockRejectedValue(expectedError); return expect(sut.set('someKey', {})).rejects.toEqual(expectedError); }); + + it('resolves what underlying client resolves', async () => { + const sut = new DefaultCacheClient({ client }); + const expectedResponse = true; + client.set = jest.fn().mockReturnValue(expectedResponse); + + const actualResponse = await sut.set('someKey', {}); + + return expect(actualResponse).toEqual(expectedResponse); + }); }); describe('CacheClient.delete', () => { it('calls client with normalized key', async () => { - const sut = new DefaultCacheClient({ - client, - defaultTtl, - pluginId, - onError, - }); - const keyPartial = 'somekey'; + const sut = new DefaultCacheClient({ client }); + const key = 'somekey'; - await sut.delete(keyPartial); + await sut.delete(key); - const spy = client.del as jest.Mock; + const spy = client.delete as jest.Mock; const actualKey = spy.mock.calls[0][0]; - expect(actualKey).toEqual(b64(`${pluginId}:${keyPartial}`)); - }); - - it('does not reject on any client error by default', async () => { - const sut = new DefaultCacheClient({ - client, - defaultTtl, - pluginId, - onError, - }); - client.del = jest.fn().mockRejectedValue(undefined); - - return expect(sut.delete('someKey')).resolves.toBeUndefined(); + expect(actualKey).toEqual(b64(key)); }); it('rejects on underlying error if configured', async () => { - const sut = new DefaultCacheClient({ - client, - defaultTtl, - pluginId, - onError: 'reject', - }); + const sut = new DefaultCacheClient({ client }); const expectedError = new Error('Some runtime error'); - client.del = jest.fn().mockRejectedValue(expectedError); + client.delete = jest.fn().mockRejectedValue(expectedError); return expect(sut.delete('someKey')).rejects.toEqual(expectedError); }); + + it('resolves what underlying client resolves', async () => { + const sut = new DefaultCacheClient({ client }); + const expectedResponse = false; + client.delete = jest.fn().mockResolvedValue(expectedResponse); + + const actualResponse = await sut.delete('someKey'); + + return expect(actualResponse).toEqual(expectedResponse); + }); }); }); diff --git a/packages/backend-common/src/cache/CacheClient.ts b/packages/backend-common/src/cache/CacheClient.ts index e1f849ccb7..943de055ae 100644 --- a/packages/backend-common/src/cache/CacheClient.ts +++ b/packages/backend-common/src/cache/CacheClient.ts @@ -15,17 +15,18 @@ */ import { JsonValue } from '@backstage/config'; -import cacheManager from 'cache-manager'; import { createHash } from 'crypto'; +import Keyv from 'keyv'; type CacheClientArgs = { - client: cacheManager.Cache; - pluginId: string; - defaultTtl: number; - onError: 'reject' | 'returnEmpty'; + client: Keyv; }; type CacheSetOptions = { + /** + * Optional TTL in milliseconds. Defaults to the TTL provided when the client + * was set up (or no TTL if none are provided). + */ ttl?: number; }; @@ -45,80 +46,50 @@ export interface CacheClient { * optional TTL may also be provided, otherwise it defaults to the TTL that * was provided when the client was instantiated. */ - set(key: string, value: JsonValue, options: CacheSetOptions): Promise; + set(key: string, value: JsonValue, options?: CacheSetOptions): Promise; /** - * Removes the given key from the cache store. + * Removes the given key from the cache store. Resolves true if the key + * existed, or false if not. */ - delete(key: string): Promise; + delete(key: string): Promise; } /** - * A simple, concrete implementation of the CacheClient, suitable for almost + * A basic, concrete implementation of the CacheClient, suitable for almost * all uses in Backstage. */ export class DefaultCacheClient implements CacheClient { - private readonly client: cacheManager.Cache; - private readonly defaultTtl: number; - private readonly pluginId: string; - private readonly onError: 'reject' | 'returnEmpty'; + private readonly client: Keyv; - constructor({ client, defaultTtl, pluginId, onError }: CacheClientArgs) { + constructor({ client }: CacheClientArgs) { this.client = client; - this.defaultTtl = defaultTtl; - this.pluginId = pluginId; - this.onError = onError; } async get(key: string): Promise { const k = this.getNormalizedKey(key); - try { - const data = (await this.client.get(k)) as string | undefined; - return this.deserializeData(data); - } catch (e) { - if (this.onError === 'reject') { - throw e; - } - return undefined; - } + return await this.client.get(k); } async set( key: string, value: JsonValue, opts: CacheSetOptions = {}, - ): Promise { + ): Promise { const k = this.getNormalizedKey(key); - try { - const data = this.serializeData(value); - await this.client.set(k, data, { - ttl: opts.ttl || this.defaultTtl, - }); - } catch (e) { - if (this.onError === 'reject') { - throw e; - } - } + return await this.client.set(k, value, opts.ttl) } - async delete(key: string): Promise { + async delete(key: string): Promise { const k = this.getNormalizedKey(key); - try { - await this.client.del(k); - } catch (e) { - if (this.onError === 'reject') { - throw e; - } - } + return await this.client.delete(k); } /** - * Namespaces key by plugin to discourage cross-plugin integration via the - * cache store. + * Ensures keys are well-formed for any/all cache stores. */ - private getNormalizedKey(key: string): string { - // Namespace key by plugin ID and remove potentially invalid characters. - const candidateKey = `${this.pluginId}:${key}`; + private getNormalizedKey(candidateKey: string): string { + // Remove potentially invalid characters. const wellFormedKey = Buffer.from(candidateKey).toString('base64'); // Memcache in particular doesn't do well with keys > 250 bytes. @@ -129,11 +100,4 @@ export class DefaultCacheClient implements CacheClient { return createHash('md5').update(candidateKey).digest('base64'); } - private serializeData(data: JsonValue): string { - return JSON.stringify(data); - } - - private deserializeData(data: string | undefined): JsonValue | undefined { - return data ? JSON.parse(data) : undefined; - } } diff --git a/packages/backend-common/src/cache/CacheManager.test.ts b/packages/backend-common/src/cache/CacheManager.test.ts index 08fa06e311..558964b55c 100644 --- a/packages/backend-common/src/cache/CacheManager.test.ts +++ b/packages/backend-common/src/cache/CacheManager.test.ts @@ -15,11 +15,16 @@ */ import { ConfigReader } from '@backstage/config'; -import cacheManager from 'cache-manager'; +import Keyv from 'keyv'; +/* @ts-expect-error */ +import KeyvMemcache from 'keyv-memcache'; import { DefaultCacheClient } from './CacheClient'; import { CacheManager } from './CacheManager'; -cacheManager.caching = jest.fn() as jest.Mock; +jest.createMockFromModule('keyv'); +jest.mock('keyv'); +jest.createMockFromModule('keyv-memcache'); +jest.mock('keyv-memcache'); jest.mock('./CacheClient', () => { return { DefaultCacheClient: jest.fn(), @@ -40,18 +45,14 @@ describe('CacheManager', () => { describe('CacheManager.fromConfig', () => { it('accesses the backend.cache key', () => { - const getOptionalConfig = jest.fn(); const getOptionalString = jest.fn(); const config = defaultConfig(); - config.getOptionalConfig = getOptionalConfig; config.getOptionalString = getOptionalString; CacheManager.fromConfig(config); expect(getOptionalString.mock.calls[0][0]).toEqual('backend.cache.store'); - expect(getOptionalConfig.mock.calls[0][0]).toEqual( - 'backend.cache.connection', - ); + expect(getOptionalString.mock.calls[1][0]).toEqual('backend.cache.connection'); }); it('does not require the backend.cache key', () => { @@ -76,8 +77,7 @@ describe('CacheManager', () => { it('connects to a cache store scoped to the plugin', async () => { const pluginId = 'test1'; - const expectedTtl = 3600; - manager.forPlugin(pluginId).getClient({ defaultTtl: expectedTtl }); + manager.forPlugin(pluginId).getClient(); const client = DefaultCacheClient as jest.Mock; expect(client).toHaveBeenCalledTimes(1); @@ -90,62 +90,60 @@ describe('CacheManager', () => { manager.forPlugin(plugin1Id).getClient({ defaultTtl: expectedTtl }); manager.forPlugin(plugin2Id).getClient({ defaultTtl: expectedTtl }); - const cache = cacheManager.caching as jest.Mock; const client = DefaultCacheClient as jest.Mock; + const cache = Keyv as unknown as jest.Mock; expect(cache).toHaveBeenCalledTimes(2); expect(client).toHaveBeenCalledTimes(2); - const plugin1CallArgs = client.mock.calls[0]; - const plugin2CallArgs = client.mock.calls[1]; - expect(plugin1CallArgs[0].pluginId).not.toEqual( - plugin2CallArgs[0].pluginId, + const plugin1CallArgs = cache.mock.calls[0]; + const plugin2CallArgs = cache.mock.calls[1]; + expect(plugin1CallArgs[0].namespace).not.toEqual( + plugin2CallArgs[0].namespace, ); }); }); describe('CacheManager.forPlugin stores', () => { - it('returns none client when no cache is configured', () => { + it('returns memory client when no cache is configured', () => { const manager = CacheManager.fromConfig( new ConfigReader({ backend: {} }), ); const expectedTtl = 3600; - manager.forPlugin('test').getClient({ defaultTtl: expectedTtl }); + const expectedNamespace = 'test-plugin'; + manager.forPlugin(expectedNamespace).getClient({ defaultTtl: expectedTtl }); - const cache = cacheManager.caching as jest.Mock; + const cache = Keyv as unknown as jest.Mock; const mockCalls = cache.mock.calls.splice(-1); const callArgs = mockCalls[0]; expect(callArgs[0]).toMatchObject({ - store: 'none', ttl: expectedTtl, + namespace: expectedNamespace, }); }); - it('returns memory client when configured', () => { + it('returns memory client when explicitly configured', () => { const manager = CacheManager.fromConfig(defaultConfig()); const expectedTtl = 3600; - manager.forPlugin('test').getClient({ defaultTtl: expectedTtl }); + const expectedNamespace = 'test-plugin'; + manager.forPlugin(expectedNamespace).getClient({ defaultTtl: expectedTtl }); - const cache = cacheManager.caching as jest.Mock; + const cache = Keyv as unknown as jest.Mock; const mockCalls = cache.mock.calls.splice(-1); const callArgs = mockCalls[0]; expect(callArgs[0]).toMatchObject({ - store: 'memory', ttl: expectedTtl, + namespace: expectedNamespace, }); }); it('returns a memcache client when configured', () => { const expectedHost = '127.0.0.1:11211'; - const expectedTimeout = 1000; const manager = CacheManager.fromConfig( new ConfigReader({ backend: { cache: { store: 'memcache', - connection: { - hosts: [expectedHost], - netTimeout: expectedTimeout, - }, + connection: expectedHost, }, }, }), @@ -153,16 +151,14 @@ describe('CacheManager', () => { const expectedTtl = 3600; manager.forPlugin('test').getClient({ defaultTtl: expectedTtl }); - const cache = cacheManager.caching as jest.Mock; - const mockCalls = cache.mock.calls.splice(-1); - const callArgs = mockCalls[0]; - expect(callArgs[0]).toMatchObject({ - options: { - hosts: [expectedHost], - netTimeout: expectedTimeout, - }, + const cache = Keyv as unknown as jest.Mock; + const mockCacheCalls = cache.mock.calls.splice(-1); + expect(mockCacheCalls[0][0]).toMatchObject({ ttl: expectedTtl, }); + const memcache = KeyvMemcache as jest.Mock; + const mockMemcacheCalls = memcache.mock.calls.splice(-1); + expect(mockMemcacheCalls[0][0]).toEqual(expectedHost); }); }); }); diff --git a/packages/backend-common/src/cache/CacheManager.ts b/packages/backend-common/src/cache/CacheManager.ts index 13fb75e314..00c4cebf18 100644 --- a/packages/backend-common/src/cache/CacheManager.ts +++ b/packages/backend-common/src/cache/CacheManager.ts @@ -14,34 +14,30 @@ * limitations under the License. */ -import { Config, ConfigReader } from '@backstage/config'; -import cacheManager from 'cache-manager'; +import { Config } from '@backstage/config'; +import Keyv from 'keyv'; // @ts-expect-error -import Memcache from 'memcache-pp'; -// @ts-expect-error -import memcachedStore from 'cache-manager-memcached-store'; +import KeyvMemcache from 'keyv-memcache'; import { DefaultCacheClient, CacheClient } from './CacheClient'; import { PluginCacheManager } from './types'; /** * Implements a Cache Manager which will automatically create new cache clients * for plugins when requested. All requested cacheclients are created with the - * credentials provided. + * connection details provided. */ export class CacheManager { /** - * Keys represents supported `backend.cache.store` values, mapped to - * factories that return cacheManager.Cache instances appropriate to the - * store. + * Keys represent supported `backend.cache.store` values, mapped to factories + * that return Keyv instances appropriate to the store. */ private readonly storeFactories = { memcache: this.getMemcacheClient, memory: this.getMemoryClient, - none: this.getNoneClient, }; private readonly store: keyof CacheManager['storeFactories']; - private readonly connection: Config; + private readonly connection: string; /** * Creates a new CacheManager instance by reading from the `backend` config @@ -51,21 +47,18 @@ export class CacheManager { */ static fromConfig(config: Config): CacheManager { // If no `backend.cache` config is provided, instantiate the CacheManager - // with empty config; allowing a "none" cache client will be returned. - const store = config.getOptionalString('backend.cache.store') || 'none'; - const connectionConfig = - config.getOptionalConfig('backend.cache.connection') || - new ConfigReader(undefined); - - return new CacheManager(store, connectionConfig); + // with a "memory" cache client. + const store = config.getOptionalString('backend.cache.store') || 'memory'; + const connectionString = config.getOptionalString('backend.cache.connection') || ''; + return new CacheManager(store, connectionString); } - private constructor(store: string, connectionConfig: Config) { + private constructor(store: string, connectionString: string) { if (!this.storeFactories.hasOwnProperty(store)) { throw new Error(`Unknown cache store: ${store}`); } this.store = store as keyof CacheManager['storeFactories']; - this.connection = connectionConfig; + this.connection = connectionString; } /** @@ -75,47 +68,33 @@ export class CacheManager { */ forPlugin(pluginId: string): PluginCacheManager { return { - getClient: ({ defaultTtl, onError }): CacheClient => { - const concreteClient = this.getClientWithTtl(defaultTtl); + getClient: (opts = {}): CacheClient => { + const concreteClient = this.getClientWithTtl(pluginId, opts.defaultTtl); return new DefaultCacheClient({ client: concreteClient, - defaultTtl, - pluginId: pluginId, - onError: onError || 'returnEmpty', }); }, }; } - private getClientWithTtl(ttl: number): cacheManager.Cache { - return this.storeFactories[this.store].call(this, ttl); + private getClientWithTtl(pluginId: string, ttl: number | undefined): Keyv { + return this.storeFactories[this.store].call(this, pluginId, ttl); } - private getMemcacheClient(defaultTtl: number): cacheManager.Cache { - const hosts = this.connection.getStringArray('hosts'); - const netTimeout = this.connection.getOptionalNumber('netTimeout'); - return cacheManager.caching({ - store: memcachedStore, - driver: Memcache, - options: { - hosts, - ...(netTimeout && { netTimeout }), - }, + private getMemcacheClient(pluginId: string, defaultTtl: number | undefined): Keyv { + const memcache = new KeyvMemcache(this.connection); + return new Keyv({ + namespace: pluginId, + ttl: defaultTtl, + store: memcache, + }); + } + + private getMemoryClient(pluginId: string, defaultTtl: number | undefined): Keyv { + return new Keyv({ + namespace: pluginId, ttl: defaultTtl, }); } - private getMemoryClient(defaultTtl: number): cacheManager.Cache { - return cacheManager.caching({ - store: 'memory', - ttl: defaultTtl, - }); - } - - private getNoneClient(defaultTtl: number): cacheManager.Cache { - return cacheManager.caching({ - store: 'none', - ttl: defaultTtl, - }); - } } diff --git a/packages/backend-common/src/cache/types.ts b/packages/backend-common/src/cache/types.ts index 5cc5782b18..4dd3cf7d1b 100644 --- a/packages/backend-common/src/cache/types.ts +++ b/packages/backend-common/src/cache/types.ts @@ -17,8 +17,12 @@ import { CacheClient } from './CacheClient'; type ClientOptions = { - defaultTtl: number; - onError?: 'reject' | 'returnEmpty'; + /** + * An optional default TTL (in milliseconds) to be set when getting a client + * instance. If not provided, data will persist indefinitely by default (or + * can be configured per entry at set-time). + */ + defaultTtl?: number; }; /** @@ -32,5 +36,5 @@ export type PluginCacheManager = { * stores so that plugins are discouraged from cache-level integration * and/or cache key collisions. */ - getClient: (options: ClientOptions) => CacheClient; + getClient: (options?: ClientOptions) => CacheClient; }; diff --git a/yarn.lock b/yarn.lock index 4b1ebed024..e792f84bfb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5737,11 +5737,6 @@ resolved "https://registry.npmjs.org/@types/btoa-lite/-/btoa-lite-1.0.0.tgz#e190a5a548e0b348adb0df9ac7fa5f1151c7cca4" integrity sha512-wJsiX1tosQ+J5+bY5LrSahHxr2wT+uME5UDwdN1kg4frt40euqA+wzECkmq4t5QbveHiJepfdThgQrPw6KiSlg== -"@types/cache-manager@^3.4.0": - version "3.4.0" - resolved "https://registry.npmjs.org/@types/cache-manager/-/cache-manager-3.4.0.tgz#414136ea3807a8cd071b8f20370c5df5dbffd382" - integrity sha512-XVbn2HS+O+Mk2SKRCjr01/8oD5p2Tv1fxxdBqJ0+Cl+UBNiz0WVY5rusHpMGx+qF6Vc2pnRwPVwSKbGaDApCpw== - "@types/cacheable-request@^6.0.1": version "6.0.1" resolved "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.1.tgz#5d22f3dded1fd3a84c0bbeb5039a7419c2c91976" @@ -8157,11 +8152,6 @@ async@0.9.x: resolved "https://registry.npmjs.org/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d" integrity sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0= -async@3.2.0, async@^3.2.0: - version "3.2.0" - resolved "https://registry.npmjs.org/async/-/async-3.2.0.tgz#b3a2685c5ebb641d3de02d161002c60fc9f85720" - integrity sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw== - async@^2.0.1, async@^2.6.1, async@^2.6.2: version "2.6.3" resolved "https://registry.npmjs.org/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff" @@ -8836,7 +8826,7 @@ block-stream@*: dependencies: inherits "~2.0.0" -bluebird@3.7.2, bluebird@^3.3.5, bluebird@^3.4.1, bluebird@^3.5.1, bluebird@^3.5.5, bluebird@^3.7.2: +bluebird@3.7.2, bluebird@^3.3.5, bluebird@^3.5.1, bluebird@^3.5.5, bluebird@^3.7.2: version "3.7.2" resolved "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== @@ -9261,20 +9251,6 @@ cache-base@^1.0.1: union-value "^1.0.0" unset-value "^1.0.0" -cache-manager-memcached-store@^4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/cache-manager-memcached-store/-/cache-manager-memcached-store-4.0.0.tgz#f68d00cdfaa73696d13137b7b0f39397167d9220" - integrity sha512-Lv1WMaRC1FQHHqxE8Xbi7YWInhgfxjOmLEE6u1K0A3Rwmq+XRLyekKDM7aW9WIzF+PuII/RDKqBK/Ezo5H2QVw== - -cache-manager@^3.4.3: - version "3.4.3" - resolved "https://registry.npmjs.org/cache-manager/-/cache-manager-3.4.3.tgz#c978d58f82b414ade08903d4d72b56a80a4978be" - integrity sha512-6+Hfzy1SNs/thUwo+07pV0ozgxc4sadrAN0eFVGvXl/X9nz3J0BqEnnEoyxEn8jnF+UkEo0MKpyk9BO80hMeiQ== - dependencies: - async "3.2.0" - lodash "^4.17.21" - lru-cache "6.0.0" - cacheable-lookup@^5.0.3: version "5.0.3" resolved "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.3.tgz#049fdc59dffdd4fc285e8f4f82936591bd59fec3" @@ -9481,11 +9457,6 @@ capture-exit@^2.0.0: dependencies: rsvp "^4.8.4" -carrier@^0.3.0: - version "0.3.0" - resolved "https://registry.npmjs.org/carrier/-/carrier-0.3.0.tgz#bd295d1d3a7524cac63dd779b929ee22a362bad4" - integrity sha1-vSldHTp1JMrGPdd5uSnuIqNiutQ= - case-sensitive-paths-webpack-plugin@^2.2.0: version "2.3.0" resolved "https://registry.npmjs.org/case-sensitive-paths-webpack-plugin/-/case-sensitive-paths-webpack-plugin-2.3.0.tgz#23ac613cc9a856e4f88ff8bb73bbb5e989825cf7" @@ -10302,11 +10273,6 @@ connect-history-api-fallback@^1.6.0: resolved "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz#8b32089359308d111115d81cad3fceab888f97bc" integrity sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg== -connection-parse@0.0.x: - version "0.0.7" - resolved "https://registry.npmjs.org/connection-parse/-/connection-parse-0.0.7.tgz#18e7318aab06a699267372b10c5226d25a1c9a69" - integrity sha1-GOcxiqsGppkmc3KxDFIm0locmmk= - console-browserify@^1.1.0: version "1.2.0" resolved "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz#67063cef57ceb6cf4993a2ab3a55840ae8c49336" @@ -14489,9 +14455,9 @@ graphql-extensions@^0.12.8: apollo-server-env "^3.0.0" apollo-server-types "^0.6.3" -graphql-language-service-interface@2.8.2, graphql-language-service-interface@^2.8.2: +graphql-language-service-interface@^2.8.2: version "2.8.2" - resolved "https://registry.npmjs.org/graphql-language-service-interface/-/graphql-language-service-interface-2.8.2.tgz#b3bb2aef7eaf0dff0b4ea419fa412c5f66fa268b" + resolved "https://registry.yarnpkg.com/graphql-language-service-interface/-/graphql-language-service-interface-2.8.2.tgz#b3bb2aef7eaf0dff0b4ea419fa412c5f66fa268b" integrity sha512-otbOQmhgkAJU1QJgQkMztNku6SbJLu/uodoFOYOOtJsizTjrMs93vkYaHCcYnLA3oi1Goj27XcHjMnRCYQOZXQ== dependencies: graphql-language-service-parser "^1.9.0" @@ -14499,9 +14465,9 @@ graphql-language-service-interface@2.8.2, graphql-language-service-interface@^2. graphql-language-service-utils "^2.5.1" vscode-languageserver-types "^3.15.1" -graphql-language-service-parser@1.9.0, graphql-language-service-parser@^1.9.0: +graphql-language-service-parser@^1.9.0: version "1.9.0" - resolved "https://registry.npmjs.org/graphql-language-service-parser/-/graphql-language-service-parser-1.9.0.tgz#79af21294119a0a7e81b6b994a1af36833bab724" + resolved "https://registry.yarnpkg.com/graphql-language-service-parser/-/graphql-language-service-parser-1.9.0.tgz#79af21294119a0a7e81b6b994a1af36833bab724" integrity sha512-B5xPZLbBmIp0kHvpY1Z35I5DtPoDK9wGxQVRDIzcBaiIvAmlTrDvjo3bu7vKREdjFbYKvWNgrEWENuprMbF17Q== dependencies: graphql-language-service-types "^1.8.0" @@ -14780,14 +14746,6 @@ hash.js@^1.0.0, hash.js@^1.0.3: inherits "^2.0.3" minimalistic-assert "^1.0.1" -hashring@^3.2.0: - version "3.2.0" - resolved "https://registry.npmjs.org/hashring/-/hashring-3.2.0.tgz#fda4efde8aa22cdb97fb1d2a65e88401e1c144ce" - integrity sha1-/aTv3oqiLNuX+x0qZeiEAeHBRM4= - dependencies: - connection-parse "0.0.x" - simple-lru-cache "0.0.x" - hast-util-parse-selector@^2.0.0: version "2.2.4" resolved "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-2.2.4.tgz#60c99d0b519e12ab4ed32e58f150ec3f61ed1974" @@ -16939,7 +16897,7 @@ json-buffer@3.0.0: resolved "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz#5b1f397afc75d677bde8bcfc0e47e1f9a3d9a898" integrity sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg= -json-buffer@3.0.1: +json-buffer@3.0.1, json-buffer@^3.0.1: version "3.0.1" resolved "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== @@ -17291,6 +17249,14 @@ keytar@^5.4.0: nan "2.14.1" prebuild-install "5.3.3" +keyv-memcache@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/keyv-memcache/-/keyv-memcache-1.2.5.tgz#9097af5c617dc740e7300ebfd4a2efb8917429e3" + integrity sha512-iG+GHlhXyV83gmlCtMFIqNYVvv0i0towAy42NvziUR7D+k9jp81fAq0lu66H4gooOnW+ojkdigRvRpL40j1f7w== + dependencies: + json-buffer "^3.0.1" + memjs "^1.3.0" + keyv@^3.0.0: version "3.1.0" resolved "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz#ecc228486f69991e49e9476485a5be1e8fc5c4d9" @@ -17305,6 +17271,13 @@ keyv@^4.0.0: dependencies: json-buffer "3.0.1" +keyv@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.0.3.tgz#4f3aa98de254803cafcd2896734108daa35e4254" + integrity sha512-zdGa2TOpSZPq5mU6iowDARnMBZgtCqJ11dJROFi6tg6kTn4nuUdU09lFyLFSaHrWqpIJ+EBq4E8/Dc0Vx5vLdA== + dependencies: + json-buffer "3.0.1" + killable@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz#4c8ce441187a061c7474fb87ca08e2a638194892" @@ -18065,13 +18038,6 @@ lru-cache@2: resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz#6d4524e8b955f95d4f5b58851ce21dd72fb4e952" integrity sha1-bUUk6LlV+V1PW1iFHOId1y+06VI= -lru-cache@6.0.0, lru-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" - integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== - dependencies: - yallist "^4.0.0" - lru-cache@^4.0.1: version "4.1.5" resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" @@ -18087,6 +18053,13 @@ lru-cache@^5.0.0, lru-cache@^5.1.1: dependencies: yallist "^3.0.2" +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + lru-queue@^0.1.0: version "0.1.0" resolved "https://registry.npmjs.org/lru-queue/-/lru-queue-0.1.0.tgz#2738bd9f0d3cf4f84490c5736c48699ac632cda3" @@ -18378,16 +18351,10 @@ media-typer@0.3.0: resolved "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= -memcache-pp@^0.3.3: - version "0.3.3" - resolved "https://registry.npmjs.org/memcache-pp/-/memcache-pp-0.3.3.tgz#3124830e27d55a252499726510841590ac130c99" - integrity sha512-fMitetT5ulUs4DnFaoVqWHrTBiddLG/l8rMHXbV+ibuL7uWjBulaEf8koTBEweyrjmflqhbH4Uy9V709LadXSA== - dependencies: - bluebird "^3.4.1" - carrier "^0.3.0" - debug "^2.6.9" - hashring "^3.2.0" - immutable "^3.8.1" +memjs@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/memjs/-/memjs-1.3.0.tgz#b7959b4ff3770e4c785463fd147f1e4fafd47a24" + integrity sha512-y/V9a0auepA9Lgyr4QieK6K2FczjHucEdTpSS+hHVNmVEkYxruXhkHu8n6DSRQ4HXHEE3cc6Sf9f88WCJXGXsQ== memoize-one@^5.1.1: version "5.1.1" @@ -23833,11 +23800,6 @@ simple-get@^3.0.2, simple-get@^3.0.3: once "^1.3.1" simple-concat "^1.0.0" -simple-lru-cache@0.0.x: - version "0.0.2" - resolved "https://registry.npmjs.org/simple-lru-cache/-/simple-lru-cache-0.0.2.tgz#d59cc3a193c1a5d0320f84ee732f6e4713e511dd" - integrity sha1-1ZzDoZPBpdAyD4Tucy9uRxPlEd0= - simple-swizzle@^0.2.2: version "0.2.2" resolved "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" @@ -25779,11 +25741,16 @@ typescript-json-schema@^0.49.0: typescript "^4.1.3" yargs "^16.2.0" -typescript@^4.0.3, typescript@^4.1.3, typescript@~4.1.3: +typescript@^4.0.3, typescript@^4.1.3: version "4.2.3" resolved "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3" integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw== +typescript@~4.1.3: + version "4.1.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.5.tgz#123a3b214aaff3be32926f0d8f1f6e704eb89a72" + integrity sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA== + ua-parser-js@^0.7.18: version "0.7.28" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.28.tgz#8ba04e653f35ce210239c64661685bf9121dec31" From 59fdb9dce20127460bf37f8078dc5323005364ac Mon Sep 17 00:00:00 2001 From: Alexander Kaserbacher Date: Sun, 9 May 2021 17:37:09 +0200 Subject: [PATCH 439/485] Use apiBaseUrl for Bitbucket server if it is set default to host otherwise Signed-off-by: Alexander Kaserbacher --- .../stages/publish/bitbucket.test.ts | 55 +++++++++++++++++++ .../scaffolder/stages/publish/bitbucket.ts | 11 ++-- 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/publish/bitbucket.test.ts b/plugins/scaffolder-backend/src/scaffolder/stages/publish/bitbucket.test.ts index 33fa51af1b..25ba11d7fb 100644 --- a/plugins/scaffolder-backend/src/scaffolder/stages/publish/bitbucket.test.ts +++ b/plugins/scaffolder-backend/src/scaffolder/stages/publish/bitbucket.test.ts @@ -170,4 +170,59 @@ describe('Bitbucket Publisher', () => { }); }); }); + + it('should use apiBaseUrl to create the repository if it is set', async () => { + server.use( + rest.post( + 'https://bitbucket.mycompany.com/bitbucket/rest/api/1.0/projects/project/repos', + (_, res, ctx) => + res( + ctx.status(201), + ctx.set('Content-Type', 'application/json'), + ctx.json({ + links: { + self: [ + { + href: + 'https://bitbucket.mycompany.com/bitbucket/projects/project/repos/repo', + }, + ], + clone: [ + { + name: 'http', + href: + 'https://bitbucket.mycompany.com/bitbucket/scm/project/repo', + }, + ], + }, + }), + ), + ), + ); + + const publisher = await BitbucketPublisher.fromConfig( + { + host: 'bitbucket.mycompany.com', + username: 'foo', + token: 'fake-token', + apiBaseUrl: 'https://bitbucket.mycompany.com/bitbucket/rest/api/1.0', + }, + { repoVisibility: 'private' }, + ); + + const result = await publisher.publish({ + values: { + storePath: 'https://bitbucket.mycompany.com/project/repo', + owner: 'bob', + }, + workspacePath, + logger: logger, + }); + + expect(result).toEqual({ + remoteUrl: 'https://bitbucket.mycompany.com/bitbucket/scm/project/repo', + catalogInfoUrl: + 'https://bitbucket.mycompany.com/bitbucket/projects/project/repos/repo/catalog-info.yaml', + }); + }); }); diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/publish/bitbucket.ts b/plugins/scaffolder-backend/src/scaffolder/stages/publish/bitbucket.ts index aef0625c79..922662ebe3 100644 --- a/plugins/scaffolder-backend/src/scaffolder/stages/publish/bitbucket.ts +++ b/plugins/scaffolder-backend/src/scaffolder/stages/publish/bitbucket.ts @@ -42,6 +42,7 @@ export class BitbucketPublisher implements PublisherBase { token: config.token, appPassword: config.appPassword, username: config.username, + apiBaseUrl: config.apiBaseUrl, repoVisibility, }); } @@ -52,6 +53,7 @@ export class BitbucketPublisher implements PublisherBase { token?: string; appPassword?: string; username?: string; + apiBaseUrl?: string; repoVisibility: RepoVisibilityOptions; }, ) {} @@ -181,10 +183,11 @@ export class BitbucketPublisher implements PublisherBase { }; try { - response = await fetch( - `https://${this.config.host}/rest/api/1.0/projects/${project}/repos`, - options, - ); + const baseUrl = this.config.apiBaseUrl + ? this.config.apiBaseUrl + : `https://${this.config.host}/rest/api/1.0`; + + response = await fetch(`${baseUrl}/projects/${project}/repos`, options); } catch (e) { throw new Error(`Unable to create repository, ${e}`); } From 82ca1ac228db1cb40c79c84bab8ceb1ac4d8688e Mon Sep 17 00:00:00 2001 From: Alexander Kaserbacher Date: Sun, 9 May 2021 17:45:36 +0200 Subject: [PATCH 440/485] Add changeset Signed-off-by: Alexander Kaserbacher --- .changeset/forty-pumpkins-agree.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/forty-pumpkins-agree.md diff --git a/.changeset/forty-pumpkins-agree.md b/.changeset/forty-pumpkins-agree.md new file mode 100644 index 0000000000..2d8892c862 --- /dev/null +++ b/.changeset/forty-pumpkins-agree.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder-backend': patch +--- + +The apiBaseUrl setting for Bitbucket Server integrations will now be used when it is set. Otherwise, it will default back to the host setting. From 38e943da0ccec78bb36a506b40ba9d9b0e5e496c Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Sun, 9 May 2021 17:52:06 +0200 Subject: [PATCH 441/485] Implement a NoStore cache backend, and do not provide a cache backend by default. Signed-off-by: Eric Peterson --- app-config.yaml | 2 - .../src/cache/CacheManager.test.ts | 12 +++--- .../backend-common/src/cache/CacheManager.ts | 17 +++++--- packages/backend-common/src/cache/NoStore.ts | 43 +++++++++++++++++++ 4 files changed, 60 insertions(+), 14 deletions(-) create mode 100644 packages/backend-common/src/cache/NoStore.ts diff --git a/app-config.yaml b/app-config.yaml index 8224b2fb6a..3c4f2d7ea5 100644 --- a/app-config.yaml +++ b/app-config.yaml @@ -26,8 +26,6 @@ backend: baseUrl: http://localhost:7000 listen: port: 7000 - cache: - store: memory database: client: sqlite3 connection: ':memory:' diff --git a/packages/backend-common/src/cache/CacheManager.test.ts b/packages/backend-common/src/cache/CacheManager.test.ts index 558964b55c..153ccfd7ac 100644 --- a/packages/backend-common/src/cache/CacheManager.test.ts +++ b/packages/backend-common/src/cache/CacheManager.test.ts @@ -20,6 +20,7 @@ import Keyv from 'keyv'; import KeyvMemcache from 'keyv-memcache'; import { DefaultCacheClient } from './CacheClient'; import { CacheManager } from './CacheManager'; +import { NoStore } from './NoStore'; jest.createMockFromModule('keyv'); jest.mock('keyv'); @@ -104,21 +105,17 @@ describe('CacheManager', () => { }); describe('CacheManager.forPlugin stores', () => { - it('returns memory client when no cache is configured', () => { + it('returns none client when no cache is configured', () => { const manager = CacheManager.fromConfig( new ConfigReader({ backend: {} }), ); - const expectedTtl = 3600; const expectedNamespace = 'test-plugin'; - manager.forPlugin(expectedNamespace).getClient({ defaultTtl: expectedTtl }); + manager.forPlugin(expectedNamespace).getClient(); const cache = Keyv as unknown as jest.Mock; const mockCalls = cache.mock.calls.splice(-1); const callArgs = mockCalls[0]; - expect(callArgs[0]).toMatchObject({ - ttl: expectedTtl, - namespace: expectedNamespace, - }); + expect(callArgs[0].store).toBeInstanceOf(NoStore); }); it('returns memory client when explicitly configured', () => { @@ -156,6 +153,7 @@ describe('CacheManager', () => { expect(mockCacheCalls[0][0]).toMatchObject({ ttl: expectedTtl, }); + expect(mockCacheCalls[0][0].store).toBeInstanceOf(KeyvMemcache); const memcache = KeyvMemcache as jest.Mock; const mockMemcacheCalls = memcache.mock.calls.splice(-1); expect(mockMemcacheCalls[0][0]).toEqual(expectedHost); diff --git a/packages/backend-common/src/cache/CacheManager.ts b/packages/backend-common/src/cache/CacheManager.ts index 00c4cebf18..967ff4224b 100644 --- a/packages/backend-common/src/cache/CacheManager.ts +++ b/packages/backend-common/src/cache/CacheManager.ts @@ -19,11 +19,12 @@ import Keyv from 'keyv'; // @ts-expect-error import KeyvMemcache from 'keyv-memcache'; import { DefaultCacheClient, CacheClient } from './CacheClient'; +import { NoStore } from './NoStore'; import { PluginCacheManager } from './types'; /** * Implements a Cache Manager which will automatically create new cache clients - * for plugins when requested. All requested cacheclients are created with the + * for plugins when requested. All requested cache clients are created with the * connection details provided. */ export class CacheManager { @@ -34,6 +35,7 @@ export class CacheManager { private readonly storeFactories = { memcache: this.getMemcacheClient, memory: this.getMemoryClient, + none: this.getNoneClient, }; private readonly store: keyof CacheManager['storeFactories']; @@ -47,8 +49,8 @@ export class CacheManager { */ static fromConfig(config: Config): CacheManager { // If no `backend.cache` config is provided, instantiate the CacheManager - // with a "memory" cache client. - const store = config.getOptionalString('backend.cache.store') || 'memory'; + // with a "NoStore" cache client. + const store = config.getOptionalString('backend.cache.store') || 'none'; const connectionString = config.getOptionalString('backend.cache.connection') || ''; return new CacheManager(store, connectionString); } @@ -82,11 +84,10 @@ export class CacheManager { } private getMemcacheClient(pluginId: string, defaultTtl: number | undefined): Keyv { - const memcache = new KeyvMemcache(this.connection); return new Keyv({ namespace: pluginId, ttl: defaultTtl, - store: memcache, + store: new KeyvMemcache(this.connection), }); } @@ -97,4 +98,10 @@ export class CacheManager { }); } + private getNoneClient(pluginId: string): Keyv { + return new Keyv({ + namespace: pluginId, + store: new NoStore(), + }) + } } diff --git a/packages/backend-common/src/cache/NoStore.ts b/packages/backend-common/src/cache/NoStore.ts new file mode 100644 index 0000000000..6acb7c0309 --- /dev/null +++ b/packages/backend-common/src/cache/NoStore.ts @@ -0,0 +1,43 @@ +/* + * 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. + */ + +/** + * Storage class compatible with Keyv which always results in a no-op. This is + * used when no cache store is configured in a Backstage backend instance. + */ +export class NoStore extends Map { + + clear(): void { + return; + } + + delete(_key: string): boolean { + return false; + } + + get(_key: string) { + return; + } + + has(_key: string): boolean { + return false; + } + + set(_key: string, _value: any): this { + return this; + } + +} From d48b375a81718c9a2b9da7d5c19631a8c754b80d Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Sun, 9 May 2021 17:52:38 +0200 Subject: [PATCH 442/485] Update changeset to reflect most recent changes. Signed-off-by: Eric Peterson --- .changeset/cool-cache-bro.md | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/.changeset/cool-cache-bro.md b/.changeset/cool-cache-bro.md index f342f39e55..9d5f998897 100644 --- a/.changeset/cool-cache-bro.md +++ b/.changeset/cool-cache-bro.md @@ -6,8 +6,8 @@ Introducing: a standard API for App Integrators to configure cache stores and Pl Two cache stores are currently supported. -- `memory`, which is a very simple in-memory LRU cache, intended for local development. -- `memcache`, which can be used to connect to one or more memcache hosts. +- `memory`, which is a very simple in-memory key/value store, intended for local development. +- `memcache`, which can be used to connect to a memcache host. Configuring and working with cache stores is very similar to the process for database connections. @@ -15,10 +15,7 @@ Configuring and working with cache stores is very similar to the process for dat backend: cache: store: memcache - connection: - hosts: - - cache-a.example.com:11211 - - cache-b.example.com:11211 + connection: user:pass@cache.example.com:11211 ``` ```typescript @@ -27,8 +24,7 @@ import { CacheManager } from '@backstage/backend-common'; // Instantiating a cache client for a plugin. const cacheManager = CacheManager.fromConfig(config); const somePluginCache = cacheManager.forPlugin('somePlugin'); -const defaultTtl = 3600; -const cacheClient = somePluginCache.getClient({ defaultTtl }); +const cacheClient = somePluginCache.getClient(); // Using the cache client: const cachedValue = await cacheClient.get('someKey'); @@ -41,19 +37,16 @@ if (cachedValue) { await cacheClient.delete('someKey'); ``` -For simplicity of use, cache clients will swallow client errors by default. Plugin developers may optionally pass an `onError` argument to the `CacheManager.getClient()` method if they wish to capture and handle those errors in a custom way. +Cache clients deal with TTLs in milliseconds. A TTL can be provided as a defaultTtl when getting a client, or may be passed when setting specific objects. If no TTL is provided, data will be persisted indefinitely. ```typescript +// Getting a client with a default TTL const cacheClient = somePluginCache.getClient({ - defaultTtl: 3600, - onError: 'reject', + defaultTtl: 3600000, }); -try { - await cacheClient.delete('someKey'); -} catch (e) { - // Attempt again, log, alert, etc. -} +// Setting a TTL on a per-object basis. +cacheClient.set('someKey', data, { ttl: 3600000 }); ``` Configuring a cache store is optional. Even when no cache store is configured, the cache manager will dutifully pass plugins a manager that resolves a cache client that does not actually write or read any data. From 03ae33c064aa194b45b7ba5c6a756cb7438bd633 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Sun, 9 May 2021 18:08:57 +0200 Subject: [PATCH 443/485] Prettier Signed-off-by: Eric Peterson --- packages/backend-common/src/cache/CacheClient.ts | 9 ++++++--- .../src/cache/CacheManager.test.ts | 16 ++++++++++------ .../backend-common/src/cache/CacheManager.ts | 15 +++++++++++---- packages/backend-common/src/cache/NoStore.ts | 2 -- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/packages/backend-common/src/cache/CacheClient.ts b/packages/backend-common/src/cache/CacheClient.ts index 943de055ae..a2c048c265 100644 --- a/packages/backend-common/src/cache/CacheClient.ts +++ b/packages/backend-common/src/cache/CacheClient.ts @@ -46,7 +46,11 @@ export interface CacheClient { * optional TTL may also be provided, otherwise it defaults to the TTL that * was provided when the client was instantiated. */ - set(key: string, value: JsonValue, options?: CacheSetOptions): Promise; + set( + key: string, + value: JsonValue, + options?: CacheSetOptions, + ): Promise; /** * Removes the given key from the cache store. Resolves true if the key @@ -77,7 +81,7 @@ export class DefaultCacheClient implements CacheClient { opts: CacheSetOptions = {}, ): Promise { const k = this.getNormalizedKey(key); - return await this.client.set(k, value, opts.ttl) + return await this.client.set(k, value, opts.ttl); } async delete(key: string): Promise { @@ -99,5 +103,4 @@ export class DefaultCacheClient implements CacheClient { return createHash('md5').update(candidateKey).digest('base64'); } - } diff --git a/packages/backend-common/src/cache/CacheManager.test.ts b/packages/backend-common/src/cache/CacheManager.test.ts index 153ccfd7ac..ece4687ee6 100644 --- a/packages/backend-common/src/cache/CacheManager.test.ts +++ b/packages/backend-common/src/cache/CacheManager.test.ts @@ -53,7 +53,9 @@ describe('CacheManager', () => { CacheManager.fromConfig(config); expect(getOptionalString.mock.calls[0][0]).toEqual('backend.cache.store'); - expect(getOptionalString.mock.calls[1][0]).toEqual('backend.cache.connection'); + expect(getOptionalString.mock.calls[1][0]).toEqual( + 'backend.cache.connection', + ); }); it('does not require the backend.cache key', () => { @@ -92,7 +94,7 @@ describe('CacheManager', () => { manager.forPlugin(plugin2Id).getClient({ defaultTtl: expectedTtl }); const client = DefaultCacheClient as jest.Mock; - const cache = Keyv as unknown as jest.Mock; + const cache = (Keyv as unknown) as jest.Mock; expect(cache).toHaveBeenCalledTimes(2); expect(client).toHaveBeenCalledTimes(2); @@ -112,7 +114,7 @@ describe('CacheManager', () => { const expectedNamespace = 'test-plugin'; manager.forPlugin(expectedNamespace).getClient(); - const cache = Keyv as unknown as jest.Mock; + const cache = (Keyv as unknown) as jest.Mock; const mockCalls = cache.mock.calls.splice(-1); const callArgs = mockCalls[0]; expect(callArgs[0].store).toBeInstanceOf(NoStore); @@ -122,9 +124,11 @@ describe('CacheManager', () => { const manager = CacheManager.fromConfig(defaultConfig()); const expectedTtl = 3600; const expectedNamespace = 'test-plugin'; - manager.forPlugin(expectedNamespace).getClient({ defaultTtl: expectedTtl }); + manager + .forPlugin(expectedNamespace) + .getClient({ defaultTtl: expectedTtl }); - const cache = Keyv as unknown as jest.Mock; + const cache = (Keyv as unknown) as jest.Mock; const mockCalls = cache.mock.calls.splice(-1); const callArgs = mockCalls[0]; expect(callArgs[0]).toMatchObject({ @@ -148,7 +152,7 @@ describe('CacheManager', () => { const expectedTtl = 3600; manager.forPlugin('test').getClient({ defaultTtl: expectedTtl }); - const cache = Keyv as unknown as jest.Mock; + const cache = (Keyv as unknown) as jest.Mock; const mockCacheCalls = cache.mock.calls.splice(-1); expect(mockCacheCalls[0][0]).toMatchObject({ ttl: expectedTtl, diff --git a/packages/backend-common/src/cache/CacheManager.ts b/packages/backend-common/src/cache/CacheManager.ts index 967ff4224b..fbd7e3ba0a 100644 --- a/packages/backend-common/src/cache/CacheManager.ts +++ b/packages/backend-common/src/cache/CacheManager.ts @@ -51,7 +51,8 @@ export class CacheManager { // If no `backend.cache` config is provided, instantiate the CacheManager // with a "NoStore" cache client. const store = config.getOptionalString('backend.cache.store') || 'none'; - const connectionString = config.getOptionalString('backend.cache.connection') || ''; + const connectionString = + config.getOptionalString('backend.cache.connection') || ''; return new CacheManager(store, connectionString); } @@ -83,7 +84,10 @@ export class CacheManager { return this.storeFactories[this.store].call(this, pluginId, ttl); } - private getMemcacheClient(pluginId: string, defaultTtl: number | undefined): Keyv { + private getMemcacheClient( + pluginId: string, + defaultTtl: number | undefined, + ): Keyv { return new Keyv({ namespace: pluginId, ttl: defaultTtl, @@ -91,7 +95,10 @@ export class CacheManager { }); } - private getMemoryClient(pluginId: string, defaultTtl: number | undefined): Keyv { + private getMemoryClient( + pluginId: string, + defaultTtl: number | undefined, + ): Keyv { return new Keyv({ namespace: pluginId, ttl: defaultTtl, @@ -102,6 +109,6 @@ export class CacheManager { return new Keyv({ namespace: pluginId, store: new NoStore(), - }) + }); } } diff --git a/packages/backend-common/src/cache/NoStore.ts b/packages/backend-common/src/cache/NoStore.ts index 6acb7c0309..c89e814c93 100644 --- a/packages/backend-common/src/cache/NoStore.ts +++ b/packages/backend-common/src/cache/NoStore.ts @@ -19,7 +19,6 @@ * used when no cache store is configured in a Backstage backend instance. */ export class NoStore extends Map { - clear(): void { return; } @@ -39,5 +38,4 @@ export class NoStore extends Map { set(_key: string, _value: any): this { return this; } - } From 6e2b9a92d655d0cd7faa34bb9854b9fec7e959fc Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Sun, 9 May 2021 18:16:24 +0200 Subject: [PATCH 444/485] Updating backend-common API Signed-off-by: Eric Peterson --- packages/backend-common/api-report.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/backend-common/api-report.md b/packages/backend-common/api-report.md index bd1b017574..5a9b61dd20 100644 --- a/packages/backend-common/api-report.md +++ b/packages/backend-common/api-report.md @@ -65,9 +65,9 @@ export class BitbucketUrlReader implements UrlReader { // @public export interface CacheClient { - delete(key: string): Promise; + delete(key: string): Promise; get(key: string): Promise; - set(key: string, value: JsonValue, options: CacheSetOptions): Promise; + set(key: string, value: JsonValue, options?: CacheSetOptions): Promise; } // @public @@ -254,7 +254,7 @@ export function notFoundHandler(): RequestHandler; // @public export type PluginCacheManager = { - getClient: (options: ClientOptions) => CacheClient; + getClient: (options?: ClientOptions) => CacheClient; }; // @public From eeb6e5ddaa53b6a628a0bb7f75d6f91eedd722e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 04:09:18 +0000 Subject: [PATCH 445/485] chore(deps-dev): bump prettier from 2.2.1 to 2.3.0 in /microsite Bumps [prettier](https://github.com/prettier/prettier) from 2.2.1 to 2.3.0. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.2.1...2.3.0) Signed-off-by: dependabot[bot] --- microsite/package.json | 2 +- microsite/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/microsite/package.json b/microsite/package.json index 07899fa703..595debcc65 100644 --- a/microsite/package.json +++ b/microsite/package.json @@ -18,7 +18,7 @@ "@spotify/prettier-config": "^10.0.0", "docusaurus": "^2.0.0-alpha.70", "js-yaml": "^4.1.0", - "prettier": "^2.2.1" + "prettier": "^2.3.0" }, "prettier": "@spotify/prettier-config" } diff --git a/microsite/yarn.lock b/microsite/yarn.lock index bed7897abc..4033968a2e 100644 --- a/microsite/yarn.lock +++ b/microsite/yarn.lock @@ -5197,10 +5197,10 @@ prepend-http@^2.0.0: resolved "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc= -prettier@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" - integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== +prettier@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.0.tgz#b6a5bf1284026ae640f17f7ff5658a7567fc0d18" + integrity sha512-kXtO4s0Lz/DW/IJ9QdWhAf7/NmPWQXkFr/r/WkR3vyI+0v8amTDxiaQSLzs8NBlytfLWX/7uQUMIW677yLKl4w== prismjs@^1.22.0: version "1.23.0" From 5f343551dc490e80a7ed5575d52d4b35f348f16a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 04:14:03 +0000 Subject: [PATCH 446/485] chore(deps): bump sanitize-html from 2.3.2 to 2.3.3 Bumps [sanitize-html](https://github.com/apostrophecms/sanitize-html) from 2.3.2 to 2.3.3. - [Release notes](https://github.com/apostrophecms/sanitize-html/releases) - [Changelog](https://github.com/apostrophecms/sanitize-html/blob/main/CHANGELOG.md) - [Commits](https://github.com/apostrophecms/sanitize-html/compare/2.3.2...2.3.3) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 77607f0637..da32525e2b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -23385,9 +23385,9 @@ sane@^4.0.3: walker "~1.0.5" sanitize-html@^2.3.2: - version "2.3.2" - resolved "https://registry.npmjs.org/sanitize-html/-/sanitize-html-2.3.2.tgz#a1954aea877a096c408aca7b0c260bef6e4fc402" - integrity sha512-p7neuskvC8pSurUjdVmbWPXmc9A4+QpOXIL+4gwFC+av5h+lYCXFT8uEneqsFQg/wEA1IH+cKQA60AaQI6p3cg== + version "2.3.3" + resolved "https://registry.npmjs.org/sanitize-html/-/sanitize-html-2.3.3.tgz#3db382c9a621cce4c46d90f10c64f1e9da9e8353" + integrity sha512-DCFXPt7Di0c6JUnlT90eIgrjs6TsJl/8HYU3KLdmrVclFN4O0heTcVbJiMa23OKVr6aR051XYtsgd8EWwEBwUA== dependencies: deepmerge "^4.2.2" escape-string-regexp "^4.0.0" From f39dbc7403ecb0b0fd1e64a788f91735ba8a874b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 04:20:29 +0000 Subject: [PATCH 447/485] chore(deps): bump @google-cloud/storage from 5.8.0 to 5.8.5 Bumps [@google-cloud/storage](https://github.com/googleapis/nodejs-storage) from 5.8.0 to 5.8.5. - [Release notes](https://github.com/googleapis/nodejs-storage/releases) - [Changelog](https://github.com/googleapis/nodejs-storage/blob/master/CHANGELOG.md) - [Commits](https://github.com/googleapis/nodejs-storage/compare/v5.8.0...v5.8.5) Signed-off-by: dependabot[bot] --- yarn.lock | 57 +++++++++++++++---------------------------------------- 1 file changed, 15 insertions(+), 42 deletions(-) diff --git a/yarn.lock b/yarn.lock index 77607f0637..edc9287a9e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2219,10 +2219,10 @@ through2 "^3.0.0" xdg-basedir "^3.0.0" -"@google-cloud/storage@^5.6.0": - version "5.8.1" - resolved "https://registry.npmjs.org/@google-cloud/storage/-/storage-5.8.1.tgz#00e627723614bcf97e6e29f9a59ec39339171847" - integrity sha512-qP8gCJ2myyMN3JMJN12d82Oo8VBSDO8vO4/x56dtQZX9+WISqcagurntnJVyFX885tIOtS97bsyv8qR1xv6HMg== +"@google-cloud/storage@^5.6.0", "@google-cloud/storage@^5.8.0": + version "5.8.5" + resolved "https://registry.npmjs.org/@google-cloud/storage/-/storage-5.8.5.tgz#2cf1e2e0ef8ca552abc4450301fef3fea4900ef6" + integrity sha512-i0gB9CRwQeOBYP7xuvn14M40LhHCwMjceBjxE4CTvsqL519sVY5yVKxLiAedHWGwUZHJNRa7Q2CmNfkdRwVNPg== dependencies: "@google-cloud/common" "^3.6.0" "@google-cloud/paginator" "^3.0.0" @@ -2230,38 +2230,11 @@ arrify "^2.0.0" async-retry "^1.3.1" compressible "^2.0.12" - date-and-time "^0.14.2" + date-and-time "^1.0.0" duplexify "^4.0.0" extend "^3.0.2" gaxios "^4.0.0" - gcs-resumable-upload "^3.1.3" - get-stream "^6.0.0" - hash-stream-validation "^0.2.2" - mime "^2.2.0" - mime-types "^2.0.8" - onetime "^5.1.0" - p-limit "^3.0.1" - pumpify "^2.0.0" - snakeize "^0.1.0" - stream-events "^1.0.1" - xdg-basedir "^4.0.0" - -"@google-cloud/storage@^5.8.0": - version "5.8.0" - resolved "https://registry.npmjs.org/@google-cloud/storage/-/storage-5.8.0.tgz#1f580e276f1d453790b382156421d1bcc4bd3f4b" - integrity sha512-WOShvBPOfkDXUzXMO+3j8Bzus+PFI9r1Ey9dLG2Zf458/PVuFTtaRWntd9ZiDG8g90zl2LmnA1JkDCreGUKr5g== - dependencies: - "@google-cloud/common" "^3.6.0" - "@google-cloud/paginator" "^3.0.0" - "@google-cloud/promisify" "^2.0.0" - arrify "^2.0.0" - async-retry "^1.3.1" - compressible "^2.0.12" - date-and-time "^0.14.2" - duplexify "^4.0.0" - extend "^3.0.2" - gaxios "^4.0.0" - gcs-resumable-upload "^3.1.3" + gcs-resumable-upload "^3.1.4" get-stream "^6.0.0" hash-stream-validation "^0.2.2" mime "^2.2.0" @@ -11262,16 +11235,16 @@ dataloader@2.0.0: resolved "https://registry.npmjs.org/dataloader/-/dataloader-2.0.0.tgz#41eaf123db115987e21ca93c005cd7753c55fe6f" integrity sha512-YzhyDAwA4TaQIhM5go+vCLmU0UikghC/t9DTQYZR2M/UvZ1MdOhPezSDZcjj9uqQJOMqjLcpWtyW2iNINdlatQ== -date-and-time@^0.14.2: - version "0.14.2" - resolved "https://registry.npmjs.org/date-and-time/-/date-and-time-0.14.2.tgz#a4266c3dead460f6c231fe9674e585908dac354e" - integrity sha512-EFTCh9zRSEpGPmJaexg7HTuzZHh6cnJj1ui7IGCFNXzd2QdpsNh05Db5TF3xzJm30YN+A8/6xHSuRcQqoc3kFA== - date-and-time@^0.6.3: version "0.6.3" resolved "https://registry.npmjs.org/date-and-time/-/date-and-time-0.6.3.tgz#2daee52df67c28bd93bce862756ac86b68cf4237" integrity sha512-lcWy3AXDRJOD7MplwZMmNSRM//kZtJaLz4n6D1P5z9wEmZGBKhJRBIr1Xs9KNQJmdXPblvgffynYji4iylUTcA== +date-and-time@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/date-and-time/-/date-and-time-1.0.0.tgz#0062394bdf6f44e961f0db00511cb19cdf3cc0a5" + integrity sha512-477D7ypIiqlXBkxhU7YtG9wWZJEQ+RUpujt2quTfgf4+E8g5fNUkB0QIL0bVyP5/TKBg8y55Hfa1R/c4bt3dEw== + date-fns@^1.27.2: version "1.30.1" resolved "https://registry.npmjs.org/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c" @@ -13836,10 +13809,10 @@ gcs-resumable-upload@^1.0.0: pumpify "^1.5.1" stream-events "^1.0.4" -gcs-resumable-upload@^3.1.3: - version "3.1.3" - resolved "https://registry.npmjs.org/gcs-resumable-upload/-/gcs-resumable-upload-3.1.3.tgz#1e38e1339600b85812e6430a5ab455453c64cce3" - integrity sha512-LjVrv6YVH0XqBr/iBW0JgRA1ndxhK6zfEFFJR4im51QVTj/4sInOXimY2evDZuSZ75D3bHxTaQAdXRukMc1y+w== +gcs-resumable-upload@^3.1.4: + version "3.1.4" + resolved "https://registry.npmjs.org/gcs-resumable-upload/-/gcs-resumable-upload-3.1.4.tgz#2e591889efb02247af26868de300b398346b17b5" + integrity sha512-5dyDfHrrVcIskiw/cPssVD4HRiwoHjhk1Nd6h5W3pQ/qffDvhfy4oNCr1f3ZXFPwTnxkCbibsB+73oOM+NvmJQ== dependencies: abort-controller "^3.0.0" configstore "^5.0.0" From 3e3c3659a02cea0a2b7bfa588a6cdf9fdec3e876 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 04:21:58 +0000 Subject: [PATCH 448/485] chore(deps-dev): bump storybook-dark-mode from 1.0.3 to 1.0.8 Bumps [storybook-dark-mode](https://github.com/hipstersmoothie/storybook-dark-mode) from 1.0.3 to 1.0.8. - [Release notes](https://github.com/hipstersmoothie/storybook-dark-mode/releases) - [Changelog](https://github.com/hipstersmoothie/storybook-dark-mode/blob/master/CHANGELOG.md) - [Commits](https://github.com/hipstersmoothie/storybook-dark-mode/compare/v1.0.3...v1.0.8) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 77607f0637..ba7d945c4c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -24313,9 +24313,9 @@ store2@^2.7.1: integrity sha512-tWEpK0snS2RPUq1i3R6OahfJNjWCQYNxq0+by1amCSuw0mXtymJpzmZIeYpA1UAa+7B0grCpNYIbDcd7AgTbFg== storybook-dark-mode@^1.0.3: - version "1.0.3" - resolved "https://registry.npmjs.org/storybook-dark-mode/-/storybook-dark-mode-1.0.3.tgz#8d58a874b6107ff1a7f29ebb0e6726b8036eee08" - integrity sha512-mjHLrv/dwtqKmbOoQ2CMtGKDttWSnUybutujsIPxLcEC77EujjWiRBFv46LtXAZEyZLm8sGFUz0s6HJJfJ3tSw== + version "1.0.8" + resolved "https://registry.npmjs.org/storybook-dark-mode/-/storybook-dark-mode-1.0.8.tgz#bbd64b382fd62d38685fdd769e2cac4e32ec293d" + integrity sha512-uY6yTSd1vYE0YwlON50u+iIoNF/fmMj59ww1cpd/naUcmOmCjwawViKFG5YjichwdR/yJ5ybWRUF0tnRQfaSiw== dependencies: fast-deep-equal "^3.0.0" memoizerific "^1.11.3" From b0d711e7184bbd9e2c6608ea6930c9be8c7637bf Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Thu, 6 May 2021 15:42:49 +0200 Subject: [PATCH 449/485] Catalog/next: Add support for dryRun which is used by the catalog-import plugin. Co-authored-by: Ben Lambert Signed-off-by: Johan Haals --- packages/catalog-client/src/CatalogClient.ts | 1 + .../src/next/DefaultLocationService.test.ts | 159 ++++++++++++++++++ .../src/next/DefaultLocationService.ts | 42 +++-- plugins/catalog-backend/src/next/types.ts | 1 - 4 files changed, 189 insertions(+), 14 deletions(-) create mode 100644 plugins/catalog-backend/src/next/DefaultLocationService.test.ts diff --git a/packages/catalog-client/src/CatalogClient.ts b/packages/catalog-client/src/CatalogClient.ts index a246b3abab..063db5a6a3 100644 --- a/packages/catalog-client/src/CatalogClient.ts +++ b/packages/catalog-client/src/CatalogClient.ts @@ -134,6 +134,7 @@ export class CatalogClient implements CatalogApi { throw new Error(`Location wasn't added: ${target}`); } + // TODO(jhaals): This will throw using the experimental catalog since all discovered entities are deferred. if (entities.length === 0) { throw new Error( `Location was added but has no entities specified yet: ${target}`, diff --git a/plugins/catalog-backend/src/next/DefaultLocationService.test.ts b/plugins/catalog-backend/src/next/DefaultLocationService.test.ts new file mode 100644 index 0000000000..662be5d3a6 --- /dev/null +++ b/plugins/catalog-backend/src/next/DefaultLocationService.test.ts @@ -0,0 +1,159 @@ +/* + * 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 { DefaultLocationService } from './DefaultLocationService'; +import { CatalogProcessingOrchestrator, LocationStore } from './types'; + +describe('DefaultLocationServiceTest', () => { + const orchestrator: jest.Mocked = { + process: jest.fn(), + }; + const store: jest.Mocked = { + deleteLocation: jest.fn(), + createLocation: jest.fn(), + listLocations: jest.fn(), + getLocation: jest.fn(), + }; + + beforeEach(() => jest.resetAllMocks()); + const locationService = new DefaultLocationService(store, orchestrator); + describe('createLocation', () => { + it('should support dry run', async () => { + orchestrator.process.mockResolvedValueOnce({ + ok: true, + state: new Map(), + completedEntity: { + apiVersion: 'backstage.io/v1alpha1', + kind: 'Location', + metadata: { + name: 'foo', + }, + }, + deferredEntities: [ + { + apiVersion: 'backstage.io/v1alpha1', + kind: 'Component', + metadata: { + name: 'bar', + }, + }, + ], + relations: [], + errors: [], + }); + + orchestrator.process.mockResolvedValueOnce({ + ok: true, + state: new Map(), + completedEntity: { + apiVersion: 'backstage.io/v1alpha1', + kind: 'Component', + metadata: { + name: 'bar', + }, + }, + deferredEntities: [], + relations: [], + errors: [], + }); + + await locationService.createLocation( + { type: 'url', target: 'https://backstage.io/catalog-info.yaml' }, + true, + ); + + expect(orchestrator.process).toBeCalledWith({ + entity: { + apiVersion: 'backstage.io/v1alpha1', + kind: 'Location', + metadata: { + annotations: { + 'backstage.io/managed-by-location': + 'url:https://backstage.io/catalog-info.yaml', + 'backstage.io/managed-by-origin-location': + 'url:https://backstage.io/catalog-info.yaml', + }, + name: 'generated-bbad4f61e08f24e25d5c5e68e13e164f760aff06', + namespace: 'default', + }, + spec: { + target: 'https://backstage.io/catalog-info.yaml', + type: 'url', + }, + }, + state: expect.anything(), + }); + + expect(orchestrator.process).toBeCalledWith({ + entity: { + apiVersion: 'backstage.io/v1alpha1', + kind: 'Component', + metadata: { name: 'bar' }, + }, + state: expect.anything(), + }); + expect(orchestrator.process).toBeCalledTimes(2); + expect(store.createLocation).not.toBeCalled(); + }); + + it('should create location', async () => { + const locationSpec = { + type: 'url', + target: 'https://backstage.io/catalog-info.yaml', + }; + + store.createLocation.mockResolvedValue({ + ...locationSpec, + id: '123', + }); + + await expect( + locationService.createLocation(locationSpec, false), + ).resolves.toEqual({ + entities: [], + location: { + id: '123', + target: 'https://backstage.io/catalog-info.yaml', + type: 'url', + }, + }); + expect(store.createLocation).toBeCalledWith({ + target: 'https://backstage.io/catalog-info.yaml', + type: 'url', + }); + }); + }); + describe('listLocations', () => { + it('should call locationStore.deleteLocation', async () => { + await locationService.listLocations(); + expect(store.listLocations).toBeCalled(); + }); + }); + + describe('deleteLocation', () => { + it('should call locationStore.deleteLocation', async () => { + await locationService.deleteLocation('123'); + expect(store.deleteLocation).toBeCalledWith('123'); + }); + }); + + describe('getLocation', () => { + it('should call locationStore.getLocation', async () => { + await locationService.getLocation('123'); + expect(store.getLocation).toBeCalledWith('123'); + }); + }); +}); diff --git a/plugins/catalog-backend/src/next/DefaultLocationService.ts b/plugins/catalog-backend/src/next/DefaultLocationService.ts index 3935f6e4d0..884410c2f0 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationService.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationService.ts @@ -25,6 +25,7 @@ import { LocationStore, CatalogProcessingOrchestrator, } from './types'; +import { locationSpecToMetadataName } from './util'; export class DefaultLocationService implements LocationService { constructor( @@ -41,7 +42,10 @@ export class DefaultLocationService implements LocationService { apiVersion: 'backstage.io/v1alpha1', kind: 'Location', metadata: { - name: `${spec.type}:${spec.target}`, + name: locationSpecToMetadataName({ + type: spec.type, + target: spec.target, + }), namespace: 'default', annotations: { [LOCATION_ANNOTATION]: `${spec.type}:${spec.target}`, @@ -49,22 +53,34 @@ export class DefaultLocationService implements LocationService { }, }, spec: { - location: { type: spec.type, target: spec.target }, + type: spec.type, + target: spec.target, }, }; - const processed = await this.orchestrator.process({ - entity, - eager: true, - state: new Map(), - }); - if (processed.ok) { - return { - location: { ...spec, id: `${spec.type}:${spec.target}` }, - entities: [processed.completedEntity], - }; + const unprocessedEntities: Entity[] = [entity]; + const entities: Entity[] = []; + const state = new Map(); // ignored + while (unprocessedEntities.length) { + const currentEntity = unprocessedEntities.pop(); + if (!currentEntity) { + continue; + } + const processed = await this.orchestrator.process({ + entity: currentEntity, + state, + }); + if (processed.ok) { + unprocessedEntities.push(...processed.deferredEntities); + entities.push(processed.completedEntity); + } else { + throw Error(processed.errors.join(', ')); + } } - throw Error('error handling not implemented.'); + return { + location: { ...spec, id: `${spec.type}:${spec.target}` }, + entities, + }; } const location = await this.store.createLocation(spec); diff --git a/plugins/catalog-backend/src/next/types.ts b/plugins/catalog-backend/src/next/types.ts index 410066eafd..fbc243ce69 100644 --- a/plugins/catalog-backend/src/next/types.ts +++ b/plugins/catalog-backend/src/next/types.ts @@ -59,7 +59,6 @@ export interface EntityProvider { export type EntityProcessingRequest = { entity: Entity; - eager?: boolean; state: Map; // Versions for multiple deployments etc }; From e53223f15c5f8730c916779952ea7aa2c975fabe Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Fri, 7 May 2021 15:01:17 +0200 Subject: [PATCH 450/485] Make listLocations conform with current API Signed-off-by: Johan Haals --- .../src/next/DefaultLocationService.test.ts | 19 +++++++++++++++++-- .../src/next/DefaultLocationService.ts | 7 +++++-- plugins/catalog-backend/src/next/types.ts | 6 +++++- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/plugins/catalog-backend/src/next/DefaultLocationService.test.ts b/plugins/catalog-backend/src/next/DefaultLocationService.test.ts index 662be5d3a6..bf2bee147a 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationService.test.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationService.test.ts @@ -137,8 +137,23 @@ describe('DefaultLocationServiceTest', () => { }); }); describe('listLocations', () => { - it('should call locationStore.deleteLocation', async () => { - await locationService.listLocations(); + it('should call locationStore.listLocations', async () => { + store.listLocations.mockResolvedValue([ + { + id: '123', + target: 'https://backstage.io/catalog-info.yaml', + type: 'url', + }, + ]); + await expect(locationService.listLocations()).resolves.toEqual([ + { + data: { + id: '123', + target: 'https://backstage.io/catalog-info.yaml', + type: 'url', + }, + }, + ]); expect(store.listLocations).toBeCalled(); }); }); diff --git a/plugins/catalog-backend/src/next/DefaultLocationService.ts b/plugins/catalog-backend/src/next/DefaultLocationService.ts index 884410c2f0..460ba61ec8 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationService.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationService.ts @@ -24,6 +24,7 @@ import { LocationService, LocationStore, CatalogProcessingOrchestrator, + LocationResponse, } from './types'; import { locationSpecToMetadataName } from './util'; @@ -87,9 +88,11 @@ export class DefaultLocationService implements LocationService { return { location, entities: [] }; } - listLocations(): Promise { - return this.store.listLocations(); + async listLocations(): Promise { + const locations = await this.store.listLocations(); + return locations.map(location => ({ data: location })); } + getLocation(id: string): Promise { return this.store.getLocation(id); } diff --git a/plugins/catalog-backend/src/next/types.ts b/plugins/catalog-backend/src/next/types.ts index fbc243ce69..05fd75522a 100644 --- a/plugins/catalog-backend/src/next/types.ts +++ b/plugins/catalog-backend/src/next/types.ts @@ -27,11 +27,15 @@ export interface LocationService { spec: LocationSpec, dryRun: boolean, ): Promise<{ location: Location; entities: Entity[] }>; - listLocations(): Promise; + listLocations(): Promise; getLocation(id: string): Promise; deleteLocation(id: string): Promise; } +export type LocationResponse = { + data: Location; +}; + export interface LocationStore { createLocation(spec: LocationSpec): Promise; listLocations(): Promise; From b23de0aeb671f02e81fa503fae974c81e377725f Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 10 May 2021 10:02:34 +0200 Subject: [PATCH 451/485] Revert "Make listLocations conform with current API" This reverts commit 449972081db302c6c2a2938a45f90beb82e117c8. Signed-off-by: Johan Haals --- .../src/next/DefaultLocationService.test.ts | 19 ++----------------- .../src/next/DefaultLocationService.ts | 7 ++----- plugins/catalog-backend/src/next/types.ts | 6 +----- 3 files changed, 5 insertions(+), 27 deletions(-) diff --git a/plugins/catalog-backend/src/next/DefaultLocationService.test.ts b/plugins/catalog-backend/src/next/DefaultLocationService.test.ts index bf2bee147a..662be5d3a6 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationService.test.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationService.test.ts @@ -137,23 +137,8 @@ describe('DefaultLocationServiceTest', () => { }); }); describe('listLocations', () => { - it('should call locationStore.listLocations', async () => { - store.listLocations.mockResolvedValue([ - { - id: '123', - target: 'https://backstage.io/catalog-info.yaml', - type: 'url', - }, - ]); - await expect(locationService.listLocations()).resolves.toEqual([ - { - data: { - id: '123', - target: 'https://backstage.io/catalog-info.yaml', - type: 'url', - }, - }, - ]); + it('should call locationStore.deleteLocation', async () => { + await locationService.listLocations(); expect(store.listLocations).toBeCalled(); }); }); diff --git a/plugins/catalog-backend/src/next/DefaultLocationService.ts b/plugins/catalog-backend/src/next/DefaultLocationService.ts index 460ba61ec8..884410c2f0 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationService.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationService.ts @@ -24,7 +24,6 @@ import { LocationService, LocationStore, CatalogProcessingOrchestrator, - LocationResponse, } from './types'; import { locationSpecToMetadataName } from './util'; @@ -88,11 +87,9 @@ export class DefaultLocationService implements LocationService { return { location, entities: [] }; } - async listLocations(): Promise { - const locations = await this.store.listLocations(); - return locations.map(location => ({ data: location })); + listLocations(): Promise { + return this.store.listLocations(); } - getLocation(id: string): Promise { return this.store.getLocation(id); } diff --git a/plugins/catalog-backend/src/next/types.ts b/plugins/catalog-backend/src/next/types.ts index 05fd75522a..fbc243ce69 100644 --- a/plugins/catalog-backend/src/next/types.ts +++ b/plugins/catalog-backend/src/next/types.ts @@ -27,15 +27,11 @@ export interface LocationService { spec: LocationSpec, dryRun: boolean, ): Promise<{ location: Location; entities: Entity[] }>; - listLocations(): Promise; + listLocations(): Promise; getLocation(id: string): Promise; deleteLocation(id: string): Promise; } -export type LocationResponse = { - data: Location; -}; - export interface LocationStore { createLocation(spec: LocationSpec): Promise; listLocations(): Promise; From 6185b62e385b700460e341246cce73fd0935bc18 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 10 May 2021 10:06:30 +0200 Subject: [PATCH 452/485] Wrap location in data to conform with current API Signed-off-by: Johan Haals --- plugins/catalog-backend/src/next/NextRouter.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/catalog-backend/src/next/NextRouter.ts b/plugins/catalog-backend/src/next/NextRouter.ts index 433abd97e9..b4660edea0 100644 --- a/plugins/catalog-backend/src/next/NextRouter.ts +++ b/plugins/catalog-backend/src/next/NextRouter.ts @@ -133,8 +133,8 @@ export async function createNextRouter( res.status(201).json(output); }) .get('/locations', async (_req, res) => { - const output = await locationService.listLocations(); - res.status(200).json(output); + const locations = await locationService.listLocations(); + res.status(200).json(locations.map(l => ({ data: l }))); }) .get('/locations/:id', async (req, res) => { From 0494d0a9461541ec78e2155ff79182dfac612967 Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Mon, 10 May 2021 09:13:04 +0100 Subject: [PATCH 453/485] Remove unnecessary message prop from Snackbar When the Snackbar has children, the message prop is ignored, so we can remove it from here to simplify the component. cf. https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Snackbar/Snackbar.js#L247 Signed-off-by: Mike Lewis --- packages/core/src/components/AlertDisplay/AlertDisplay.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/core/src/components/AlertDisplay/AlertDisplay.tsx b/packages/core/src/components/AlertDisplay/AlertDisplay.tsx index 6d6646fa18..af98b09083 100644 --- a/packages/core/src/components/AlertDisplay/AlertDisplay.tsx +++ b/packages/core/src/components/AlertDisplay/AlertDisplay.tsx @@ -46,11 +46,7 @@ export const AlertDisplay = () => { }; return ( - + Date: Mon, 10 May 2021 09:36:54 +0100 Subject: [PATCH 454/485] Add count of older messages in Snackbar alert Adds "(n older messages)" suffix to the message contents in the core AlertDisplay when there are multiple messages to show. Some considerations that led to this: * It seems like if we're going to show only one message, it should be the most recent message (which is the current behavior). * Just showing a message count (e.g. '1/4', '4/4') seems open to interpretation about whether the count starts at the oldest or newest. Signed-off-by: Mike Lewis --- .changeset/stale-gifts-push.md | 5 +++ packages/core/package.json | 1 + .../AlertDisplay/AlertDisplay.test.tsx | 42 +++++++++++++++++++ .../components/AlertDisplay/AlertDisplay.tsx | 11 ++++- 4 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 .changeset/stale-gifts-push.md diff --git a/.changeset/stale-gifts-push.md b/.changeset/stale-gifts-push.md new file mode 100644 index 0000000000..f1e13ba14d --- /dev/null +++ b/.changeset/stale-gifts-push.md @@ -0,0 +1,5 @@ +--- +'@backstage/core': patch +--- + +Add count of older messages when multiple messages exist in AlertDisplay diff --git a/packages/core/package.json b/packages/core/package.json index f8425c3289..315441a87c 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -52,6 +52,7 @@ "immer": "^9.0.1", "lodash": "^4.17.15", "material-table": "^1.69.1", + "pluralize": "^8.0.0", "prop-types": "^15.7.2", "qs": "^6.9.4", "rc-progress": "^3.0.0", diff --git a/packages/core/src/components/AlertDisplay/AlertDisplay.test.tsx b/packages/core/src/components/AlertDisplay/AlertDisplay.test.tsx index 3f85dab9f3..d9e264bb32 100644 --- a/packages/core/src/components/AlertDisplay/AlertDisplay.test.tsx +++ b/packages/core/src/components/AlertDisplay/AlertDisplay.test.tsx @@ -62,4 +62,46 @@ describe('', () => { expect(queryByText(TEST_MESSAGE)).toBeInTheDocument(); }); + + describe('with multiple messages', () => { + let apiRegistry: ApiRegistry; + + beforeEach(() => { + apiRegistry = ApiRegistry.from([ + [ + alertApiRef, + { + post() {}, + alert$() { + return Observable.of( + { message: 'message one' }, + { message: 'message two' }, + { message: 'message three' }, + ); + }, + }, + ], + ]); + }); + + it('renders first message', async () => { + const { queryByText } = await renderInTestApp( + + + , + ); + + expect(queryByText('message one')).toBeInTheDocument(); + }); + + it('renders a count of remaining messages', async () => { + const { queryByText } = await renderInTestApp( + + + , + ); + + expect(queryByText('(2 older messages)')).toBeInTheDocument(); + }); + }); }); diff --git a/packages/core/src/components/AlertDisplay/AlertDisplay.tsx b/packages/core/src/components/AlertDisplay/AlertDisplay.tsx index af98b09083..76e21f909c 100644 --- a/packages/core/src/components/AlertDisplay/AlertDisplay.tsx +++ b/packages/core/src/components/AlertDisplay/AlertDisplay.tsx @@ -19,6 +19,7 @@ import { Snackbar, IconButton } from '@material-ui/core'; import CloseIcon from '@material-ui/icons/Close'; import { Alert } from '@material-ui/lab'; import { AlertMessage, useApi, alertApiRef } from '@backstage/core-api'; +import pluralize from 'pluralize'; // TODO: improve on this and promote to a shared component for use by all apps. export const AlertDisplay = () => { @@ -60,7 +61,15 @@ export const AlertDisplay = () => { } severity={firstMessage.severity} > - {firstMessage.message.toString()} + + {firstMessage.message.toString()} + {messages.length > 1 && ( + {` (${messages.length - 1} older ${pluralize( + 'message', + messages.length - 1, + )})`} + )} + ); From 0c491a1c5ed6123ecdc49f753fc6353478e8f1fb Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Mon, 10 May 2021 11:25:11 +0200 Subject: [PATCH 455/485] Clean up tests and imports Signed-off-by: Eric Peterson --- packages/techdocs-common/__mocks__/@google-cloud/storage.ts | 2 +- packages/techdocs-common/src/stages/publish/awsS3.test.ts | 4 ++++ .../src/stages/publish/azureBlobStorage.test.ts | 4 ++++ .../techdocs-common/src/stages/publish/googleStorage.test.ts | 4 ++++ .../techdocs-common/src/stages/publish/openStackSwift.test.ts | 4 ++++ 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/techdocs-common/__mocks__/@google-cloud/storage.ts b/packages/techdocs-common/__mocks__/@google-cloud/storage.ts index 11fbc32de2..5e9890cd98 100644 --- a/packages/techdocs-common/__mocks__/@google-cloud/storage.ts +++ b/packages/techdocs-common/__mocks__/@google-cloud/storage.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Readable, Writable } from 'stream'; +import { Readable } from 'stream'; import fs from 'fs-extra'; import os from 'os'; import path from 'path'; diff --git a/packages/techdocs-common/src/stages/publish/awsS3.test.ts b/packages/techdocs-common/src/stages/publish/awsS3.test.ts index fe0fbd556a..b2954f7b2e 100644 --- a/packages/techdocs-common/src/stages/publish/awsS3.test.ts +++ b/packages/techdocs-common/src/stages/publish/awsS3.test.ts @@ -296,6 +296,10 @@ describe('AwsS3Publish', () => { }); }); + afterEach(() => { + mockFs.restore(); + }); + it('should pass expected object path to bucket', async () => { const { kind, diff --git a/packages/techdocs-common/src/stages/publish/azureBlobStorage.test.ts b/packages/techdocs-common/src/stages/publish/azureBlobStorage.test.ts index 797ab5435c..568393662b 100644 --- a/packages/techdocs-common/src/stages/publish/azureBlobStorage.test.ts +++ b/packages/techdocs-common/src/stages/publish/azureBlobStorage.test.ts @@ -353,6 +353,10 @@ describe('publishing with valid credentials', () => { }); }); + afterEach(() => { + mockFs.restore(); + }); + it('should pass expected object path to bucket', async () => { const { kind, diff --git a/packages/techdocs-common/src/stages/publish/googleStorage.test.ts b/packages/techdocs-common/src/stages/publish/googleStorage.test.ts index 9a966e6a60..f29e1f10be 100644 --- a/packages/techdocs-common/src/stages/publish/googleStorage.test.ts +++ b/packages/techdocs-common/src/stages/publish/googleStorage.test.ts @@ -295,6 +295,10 @@ describe('GoogleGCSPublish', () => { }); }); + afterEach(() => { + mockFs.restore(); + }); + it('should pass expected object path to bucket', async () => { const { kind, diff --git a/packages/techdocs-common/src/stages/publish/openStackSwift.test.ts b/packages/techdocs-common/src/stages/publish/openStackSwift.test.ts index a75c8b75ec..aeaceeaaa6 100644 --- a/packages/techdocs-common/src/stages/publish/openStackSwift.test.ts +++ b/packages/techdocs-common/src/stages/publish/openStackSwift.test.ts @@ -301,6 +301,10 @@ describe('OpenStackSwiftPublish', () => { }); }); + afterEach(() => { + mockFs.restore(); + }); + it('should pass expected object path to bucket', async () => { const { kind, From f9fb4a205e206a678a00f6cfcba4a6ebf226a46d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Sun, 9 May 2021 22:42:56 +0200 Subject: [PATCH 456/485] Prep work for mysql support in backend-common MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .changeset/mighty-poets-cheer.md | 5 + .github/styles/vocab.txt | 1 + packages/backend-common/package.json | 4 +- .../src/database/connection.test.ts | 6 +- .../backend-common/src/database/connection.ts | 7 +- .../backend-common/src/database/mysql.test.ts | 188 ++++++++++++++++++ packages/backend-common/src/database/mysql.ts | 161 +++++++++++++++ yarn.lock | 51 ++++- 8 files changed, 416 insertions(+), 7 deletions(-) create mode 100644 .changeset/mighty-poets-cheer.md create mode 100644 packages/backend-common/src/database/mysql.test.ts create mode 100644 packages/backend-common/src/database/mysql.ts diff --git a/.changeset/mighty-poets-cheer.md b/.changeset/mighty-poets-cheer.md new file mode 100644 index 0000000000..47538489e4 --- /dev/null +++ b/.changeset/mighty-poets-cheer.md @@ -0,0 +1,5 @@ +--- +'@backstage/backend-common': patch +--- + +Prep work for mysql support in backend-common diff --git a/.github/styles/vocab.txt b/.github/styles/vocab.txt index 694226b8cc..f95eeb6f89 100644 --- a/.github/styles/vocab.txt +++ b/.github/styles/vocab.txt @@ -177,6 +177,7 @@ mkdocs monorepo monorepos msw +mysql namespace namespaced namespaces diff --git a/packages/backend-common/package.json b/packages/backend-common/package.json index a144f1c23f..6b47cd9599 100644 --- a/packages/backend-common/package.json +++ b/packages/backend-common/package.json @@ -62,7 +62,8 @@ "stoppable": "^1.1.0", "tar": "^6.0.5", "unzipper": "^0.10.11", - "winston": "^3.2.1" + "winston": "^3.2.1", + "yn": "^4.0.0" }, "peerDependencies": { "pg-connection-string": "^2.3.0" @@ -94,6 +95,7 @@ "jest": "^26.0.1", "mock-fs": "^4.13.0", "msw": "^0.21.2", + "mysql2": "^2.2.5", "recursive-readdir": "^2.2.2", "supertest": "^6.1.3" }, diff --git a/packages/backend-common/src/database/connection.test.ts b/packages/backend-common/src/database/connection.test.ts index 9810ff9bef..6ab163ff7f 100644 --- a/packages/backend-common/src/database/connection.test.ts +++ b/packages/backend-common/src/database/connection.test.ts @@ -46,11 +46,11 @@ describe('database connection', () => { ).toBeTruthy(); }); - it('tries to create a mysql connection as a passthrough', () => { + it('returns a mysql connection', () => { expect(() => createDatabaseClient( new ConfigReader({ - client: 'mysql', + client: 'mysql2', connection: { host: '127.0.0.1', user: 'foo', @@ -59,7 +59,7 @@ describe('database connection', () => { }, }), ), - ).toThrowError(/Cannot find module 'mysql'/); + ).toBeTruthy(); }); it('accepts overrides', () => { diff --git a/packages/backend-common/src/database/connection.ts b/packages/backend-common/src/database/connection.ts index 3502e21674..fb16915cf4 100644 --- a/packages/backend-common/src/database/connection.ts +++ b/packages/backend-common/src/database/connection.ts @@ -14,9 +14,10 @@ * limitations under the License. */ -import knexFactory, { Knex } from 'knex'; import { Config } from '@backstage/config'; +import knexFactory, { Knex } from 'knex'; import { mergeDatabaseConfig } from './config'; +import { createMysqlDatabaseClient, ensureMysqlDatabaseExists } from './mysql'; import { createPgDatabaseClient, ensurePgDatabaseExists } from './postgres'; import { createSqliteDatabaseClient } from './sqlite3'; @@ -36,6 +37,8 @@ export function createDatabaseClient( if (client === 'pg') { return createPgDatabaseClient(dbConfig, overrides); + } else if (client === 'mysql' || client === 'mysql2') { + return createMysqlDatabaseClient(dbConfig, overrides); } else if (client === 'sqlite3') { return createSqliteDatabaseClient(dbConfig, overrides); } @@ -60,6 +63,8 @@ export async function ensureDatabaseExists( if (client === 'pg') { return ensurePgDatabaseExists(dbConfig, ...databases); + } else if (client === 'mysql' || client === 'mysql2') { + return ensureMysqlDatabaseExists(dbConfig, ...databases); } return undefined; diff --git a/packages/backend-common/src/database/mysql.test.ts b/packages/backend-common/src/database/mysql.test.ts new file mode 100644 index 0000000000..9e23585d5b --- /dev/null +++ b/packages/backend-common/src/database/mysql.test.ts @@ -0,0 +1,188 @@ +/* + * Copyright 2020 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 { Config, ConfigReader } from '@backstage/config'; +import { + buildMysqlDatabaseConfig, + createMysqlDatabaseClient, + getMysqlConnectionConfig, + parseMysqlConnectionString, +} from './mysql'; + +describe('mysql', () => { + const createMockConnection = () => ({ + host: 'acme', + user: 'foo', + password: 'bar', + database: 'foodb', + }); + + const createMockConnectionString = () => 'mysql://foo:bar@acme:3306/foodb'; + + const createConfig = (connection: any): Config => + new ConfigReader({ client: 'mysql2', connection }); + + describe('buildMysqlDatabaseConfig', () => { + it('builds a mysql config', () => { + const mockConnection = createMockConnection(); + + expect(buildMysqlDatabaseConfig(createConfig(mockConnection))).toEqual({ + client: 'mysql2', + connection: mockConnection, + useNullAsDefault: true, + }); + }); + + it('builds a connection string config', () => { + const mockConnectionString = createMockConnectionString(); + + expect( + buildMysqlDatabaseConfig(createConfig(mockConnectionString)), + ).toEqual({ + client: 'mysql2', + connection: mockConnectionString, + useNullAsDefault: true, + }); + }); + + it('overrides the database name', () => { + const mockConnection = createMockConnection(); + + expect( + buildMysqlDatabaseConfig(createConfig(mockConnection), { + connection: { database: 'other_db' }, + }), + ).toEqual({ + client: 'mysql2', + connection: { + ...mockConnection, + database: 'other_db', + }, + useNullAsDefault: true, + }); + }); + + it('adds additional config settings', () => { + const mockConnection = createMockConnection(); + + expect( + buildMysqlDatabaseConfig(createConfig(mockConnection), { + connection: { database: 'other_db' }, + pool: { min: 0, max: 7 }, + debug: true, + }), + ).toEqual({ + client: 'mysql2', + connection: { + ...mockConnection, + database: 'other_db', + }, + useNullAsDefault: true, + pool: { min: 0, max: 7 }, + debug: true, + }); + }); + + it('overrides the database from connection string', () => { + const mockConnectionString = createMockConnectionString(); + const mockConnection = createMockConnection(); + + expect( + buildMysqlDatabaseConfig(createConfig(mockConnectionString), { + connection: { database: 'other_db' }, + }), + ).toEqual({ + client: 'mysql2', + connection: { + ...mockConnection, + port: 3306, + database: 'other_db', + }, + useNullAsDefault: true, + }); + }); + }); + + describe('getMysqlConnectionConfig', () => { + it('returns the connection object back', () => { + const mockConnection = createMockConnection(); + const config = createConfig(mockConnection); + + expect(getMysqlConnectionConfig(config)).toEqual(mockConnection); + }); + + it('does not parse the connection string', () => { + const mockConnection = createMockConnection(); + const config = createConfig(mockConnection); + + expect(getMysqlConnectionConfig(config, true)).toEqual(mockConnection); + }); + + it('automatically parses the connection string', () => { + const mockConnection = createMockConnection(); + const mockConnectionString = createMockConnectionString(); + const config = createConfig(mockConnectionString); + + expect(getMysqlConnectionConfig(config)).toEqual({ + ...mockConnection, + port: 3306, + }); + }); + + it('parses the connection string', () => { + const mockConnection = createMockConnection(); + const mockConnectionString = createMockConnectionString(); + const config = createConfig(mockConnectionString); + + expect(getMysqlConnectionConfig(config, true)).toEqual({ + ...mockConnection, + port: 3306, + }); + }); + }); + + describe('createMysqlDatabaseClient', () => { + it('creates a mysql knex instance', () => { + expect( + createMysqlDatabaseClient( + createConfig({ + host: 'acme', + user: 'foo', + password: 'bar', + database: 'foodb', + }), + ), + ).toBeTruthy(); + }); + }); + + describe('parseMysqlConnectionString', () => { + it('parses a connection string uri', () => { + expect( + parseMysqlConnectionString( + 'mysql://u:pass@foobar:3307/dbname?ssl=require', + ), + ).toEqual({ + host: 'foobar', + user: 'u', + password: 'pass', + port: 3307, + database: 'dbname', + ssl: 'require', + }); + }); + }); +}); diff --git a/packages/backend-common/src/database/mysql.ts b/packages/backend-common/src/database/mysql.ts new file mode 100644 index 0000000000..be4632baf6 --- /dev/null +++ b/packages/backend-common/src/database/mysql.ts @@ -0,0 +1,161 @@ +/* + * Copyright 2020 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 { Config } from '@backstage/config'; +import { InputError } from '@backstage/errors'; +import knexFactory, { Knex } from 'knex'; +import { mergeDatabaseConfig } from './config'; +import yn from 'yn'; + +/** + * Creates a knex mysql database connection + * + * @param dbConfig The database config + * @param overrides Additional options to merge with the config + */ +export function createMysqlDatabaseClient( + dbConfig: Config, + overrides?: Knex.Config, +) { + const knexConfig = buildMysqlDatabaseConfig(dbConfig, overrides); + const database = knexFactory(knexConfig); + return database; +} + +/** + * Builds a knex mysql database connection + * + * @param dbConfig The database config + * @param overrides Additional options to merge with the config + */ +export function buildMysqlDatabaseConfig( + dbConfig: Config, + overrides?: Knex.Config, +) { + return mergeDatabaseConfig( + dbConfig.get(), + { + connection: getMysqlConnectionConfig(dbConfig, !!overrides), + useNullAsDefault: true, + }, + overrides, + ); +} + +/** + * Gets the mysql connection config + * + * @param dbConfig The database config + * @param parseConnectionString Flag to explicitly control connection string parsing + */ +export function getMysqlConnectionConfig( + dbConfig: Config, + parseConnectionString?: boolean, +): Knex.MySqlConnectionConfig | string { + const connection = dbConfig.get('connection') as any; + const isConnectionString = + typeof connection === 'string' || connection instanceof String; + const autoParse = typeof parseConnectionString !== 'boolean'; + + const shouldParseConnectionString = autoParse + ? isConnectionString + : parseConnectionString && isConnectionString; + + return shouldParseConnectionString + ? parseMysqlConnectionString(connection as string) + : connection; +} + +/** + * Parses a mysql connection string. + * + * e.g. mysql://examplename:somepassword@examplehost:3306/dbname + * @param connectionString The mysql connection string + */ +export function parseMysqlConnectionString( + connectionString: string, +): Knex.MySqlConnectionConfig { + try { + const { + protocol, + username, + password, + port, + hostname, + pathname, + searchParams, + } = new URL(connectionString); + + if (protocol !== 'mysql:') { + throw new Error(`Unknown protocol ${protocol}`); + } else if (!username || !password) { + throw new Error(`Missing username/password`); + } else if (!pathname.match(/^\/[^/]+$/)) { + throw new Error(`Expected single path segment`); + } + + const result: Knex.MySqlConnectionConfig = { + user: username, + password, + host: hostname, + port: Number(port || 3306), + database: decodeURIComponent(pathname.substr(1)), + }; + + const ssl = searchParams.get('ssl'); + if (ssl) { + result.ssl = ssl; + } + + const debug = searchParams.get('debug'); + if (debug) { + result.debug = yn(debug); + } + + return result; + } catch (e) { + throw new InputError( + `Error while parsing MySQL connection string, ${e}`, + e, + ); + } +} + +/** + * Creates the missing mysql database if it does not exist + * + * @param dbConfig The database config + * @param databases The names of the databases to create + */ +export async function ensureMysqlDatabaseExists( + dbConfig: Config, + ...databases: Array +) { + const admin = createMysqlDatabaseClient(dbConfig, { + connection: { + database: (null as unknown) as string, + }, + }); + + try { + const ensureDatabase = async (database: string) => { + await admin.raw(`CREATE DATABASE IF NOT EXISTS ??`, [database]); + }; + await Promise.all(databases.map(ensureDatabase)); + } finally { + await admin.destroy(); + } +} diff --git a/yarn.lock b/yarn.lock index 23c8118e7e..a21c6ef0f1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11495,6 +11495,11 @@ delegates@^1.0.0: resolved "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= +denque@^1.4.1: + version "1.5.0" + resolved "https://registry.npmjs.org/denque/-/denque-1.5.0.tgz#773de0686ff2d8ec2ff92914316a47b73b1c73de" + integrity sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ== + depd@^1.1.2, depd@~1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" @@ -13822,6 +13827,13 @@ gcs-resumable-upload@^3.1.4: pumpify "^2.0.0" stream-events "^1.0.4" +generate-function@^2.3.1: + version "2.3.1" + resolved "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz#f069617690c10c868e73b8465746764f97c3479f" + integrity sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ== + dependencies: + is-property "^1.0.2" + generic-names@^2.0.1: version "2.0.1" resolved "https://registry.npmjs.org/generic-names/-/generic-names-2.0.1.tgz#f8a378ead2ccaa7a34f0317b05554832ae41b872" @@ -15920,6 +15932,11 @@ is-promise@^2.1.0, is-promise@^2.2.2: resolved "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz#39ab959ccbf9a774cf079f7b40c7a26f763135f1" integrity sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ== +is-property@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" + integrity sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ= + is-reference@^1.2.1: version "1.2.1" resolved "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz#8b2dac0b371f4bc994fdeaba9eb542d03002d0b7" @@ -17996,7 +18013,7 @@ lru-cache@2: resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz#6d4524e8b955f95d4f5b58851ce21dd72fb4e952" integrity sha1-bUUk6LlV+V1PW1iFHOId1y+06VI= -lru-cache@^4.0.1: +lru-cache@^4.0.1, lru-cache@^4.1.3: version "4.1.5" resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== @@ -18668,7 +18685,6 @@ minipass-fetch@^1.3.0, minipass-fetch@^1.3.2: resolved "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-1.3.3.tgz#34c7cea038c817a8658461bf35174551dce17a0a" integrity sha512-akCrLDWfbdAWkMLBxJEeWTdNsjML+dt5YgOI4gJ53vuO0vrmYQkUPxa6j6V65s9CcePIr2SSWqjT2EcrNseryQ== dependencies: - encoding "^0.1.12" minipass "^3.1.0" minipass-sized "^1.0.3" minizlib "^2.0.0" @@ -18993,6 +19009,20 @@ mv@~2: ncp "~2.0.0" rimraf "~2.4.0" +mysql2@^2.2.5: + version "2.2.5" + resolved "https://registry.npmjs.org/mysql2/-/mysql2-2.2.5.tgz#72624ffb4816f80f96b9c97fedd8c00935f9f340" + integrity sha512-XRqPNxcZTpmFdXbJqb+/CtYVLCx14x1RTeNMD4954L331APu75IC74GDqnZMEt1kwaXy6TySo55rF2F3YJS78g== + dependencies: + denque "^1.4.1" + generate-function "^2.3.1" + iconv-lite "^0.6.2" + long "^4.0.0" + lru-cache "^6.0.0" + named-placeholders "^1.1.2" + seq-queue "^0.0.5" + sqlstring "^2.3.2" + mz@^2.7.0: version "2.7.0" resolved "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" @@ -19002,6 +19032,13 @@ mz@^2.7.0: object-assign "^4.0.1" thenify-all "^1.0.0" +named-placeholders@^1.1.2: + version "1.1.2" + resolved "https://registry.npmjs.org/named-placeholders/-/named-placeholders-1.1.2.tgz#ceb1fbff50b6b33492b5cf214ccf5e39cef3d0e8" + integrity sha512-wiFWqxoLL3PGVReSZpjLVxyJ1bRqe+KKJVbr4hGs1KWfTZTQyezHFBbuKj9hsizHyGV2ne7EMjHdxEGAybD5SA== + dependencies: + lru-cache "^4.1.3" + nan@2.14.1, nan@^2.12.1, nan@^2.14.0: version "2.14.1" resolved "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz#d7be34dfa3105b91494c3147089315eff8874b01" @@ -23532,6 +23569,11 @@ sentence-case@^3.0.4: tslib "^2.0.3" upper-case-first "^2.0.2" +seq-queue@^0.0.5: + version "0.0.5" + resolved "https://registry.npmjs.org/seq-queue/-/seq-queue-0.0.5.tgz#d56812e1c017a6e4e7c3e3a37a1da6d78dd3c93e" + integrity sha1-1WgS4cAXpuTnw+Ojeh2m143TyT4= + serialize-error@^8.0.1, serialize-error@^8.1.0: version "8.1.0" resolved "https://registry.npmjs.org/serialize-error/-/serialize-error-8.1.0.tgz#3a069970c712f78634942ddd50fbbc0eaebe2f67" @@ -24137,6 +24179,11 @@ sqlite3@^5.0.0: optionalDependencies: node-gyp "3.x" +sqlstring@^2.3.2: + version "2.3.2" + resolved "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.2.tgz#cdae7169389a1375b18e885f2e60b3e460809514" + integrity sha512-vF4ZbYdKS8OnoJAWBmMxCQDkiEBkGQYU7UZPtL8flbDRSNkhaXvRJ279ZtI6M+zDaQovVU4tuRgzK5fVhvFAhg== + ssh2-streams@~0.4.10: version "0.4.10" resolved "https://registry.npmjs.org/ssh2-streams/-/ssh2-streams-0.4.10.tgz#48ef7e8a0e39d8f2921c30521d56dacb31d23a34" From 50d1fecad8b2144559c93d535703b2ea66109eb0 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Mon, 10 May 2021 13:49:23 +0200 Subject: [PATCH 457/485] Pass gitHubIntegrations as param to simplify future tests Signed-off-by: Erik Engervall --- .../src/api/GitReleaseClient.ts | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/plugins/git-release-manager/src/api/GitReleaseClient.ts b/plugins/git-release-manager/src/api/GitReleaseClient.ts index 9de3ce51f7..cd178f292a 100644 --- a/plugins/git-release-manager/src/api/GitReleaseClient.ts +++ b/plugins/git-release-manager/src/api/GitReleaseClient.ts @@ -16,7 +16,7 @@ import { ConfigApi, OAuthApi } from '@backstage/core'; import { Octokit } from '@octokit/rest'; -import { ScmIntegrations } from '@backstage/integration'; +import { GitHubIntegration, ScmIntegrations } from '@backstage/integration'; import { DISABLE_CACHE } from '../constants/constants'; import { Project } from '../contexts/ProjectContext'; @@ -37,20 +37,26 @@ export class GitReleaseClient implements GitReleaseApi { }) { this.githubAuthApi = githubAuthApi; - const { host, apiBaseUrl } = this.getGithubIntegrationConfig({ configApi }); + const gitHubIntegrations = ScmIntegrations.fromConfig( + configApi, + ).github.list(); + const { host, apiBaseUrl } = this.getGithubIntegrationConfig({ + gitHubIntegrations, + }); this.host = host; this.apiBaseUrl = apiBaseUrl; } - private getGithubIntegrationConfig({ configApi }: { configApi: ConfigApi }) { - const integrations = ScmIntegrations.fromConfig(configApi); - const githubIntegrations = integrations.github.list(); - - const defaultIntegration = githubIntegrations.find( + private getGithubIntegrationConfig({ + gitHubIntegrations, + }: { + gitHubIntegrations: GitHubIntegration[]; + }) { + const defaultIntegration = gitHubIntegrations.find( ({ config: { host } }) => host === 'github.com', ); - const enterpriseIntegration = githubIntegrations.find( + const enterpriseIntegration = gitHubIntegrations.find( ({ config: { host } }) => host !== 'github.com', ); From abbb9d53fc1d62739520c4b9fecc2229e9912dd6 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Mon, 10 May 2021 13:52:34 +0200 Subject: [PATCH 458/485] Bump dependencies Signed-off-by: Erik Engervall --- plugins/git-release-manager/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/git-release-manager/package.json b/plugins/git-release-manager/package.json index 16487f721e..9aca27d1a9 100644 --- a/plugins/git-release-manager/package.json +++ b/plugins/git-release-manager/package.json @@ -20,9 +20,9 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.7.5", + "@backstage/core": "^0.7.8", "@backstage/integration": "^0.5.1", - "@backstage/theme": "^0.2.5", + "@backstage/theme": "^0.2.7", "recharts": "^1.8.5", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -32,11 +32,11 @@ "qs": "^6.10.1", "react-dom": "^16.13.1", "react-router": "6.0.0-beta.0", - "react-use": "^15.3.3", + "react-use": "^17.2.4", "react": "^16.13.1" }, "devDependencies": { - "@backstage/cli": "^0.6.8", + "@backstage/cli": "^0.6.10", "@backstage/dev-utils": "^0.1.13", "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", From 55480c31765d370b1b4eaf5f7927615e53ed26d1 Mon Sep 17 00:00:00 2001 From: GregoireW <24318548+GregoireW@users.noreply.github.com> Date: Mon, 10 May 2021 14:01:48 +0200 Subject: [PATCH 459/485] Pagination is set on the 'action' bar Signed-off-by: GregoireW <24318548+GregoireW@users.noreply.github.com> --- .../Group/MembersList/MembersListCard.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx b/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx index dbe35c3057..58dcefaaa4 100644 --- a/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx +++ b/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx @@ -154,11 +154,22 @@ export const MembersListCard = (_props: { const nbPages = Math.ceil((members?.length || 0) / pageSize); const paginationLabel = nbPages < 2 ? '' : `, page ${page} of ${nbPages}`; + const pagination = ( + + ); + return ( {members && members.length > 0 ? ( @@ -173,13 +184,6 @@ export const MembersListCard = (_props: { )} - ); From 60a6090f2403095296162b41876541fa83a08407 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 10 May 2021 14:32:18 +0200 Subject: [PATCH 460/485] Split dryRun to separate method, map errors. Signed-off-by: Johan Haals --- .../src/next/DefaultLocationService.ts | 94 ++++++++++--------- 1 file changed, 50 insertions(+), 44 deletions(-) diff --git a/plugins/catalog-backend/src/next/DefaultLocationService.ts b/plugins/catalog-backend/src/next/DefaultLocationService.ts index 884410c2f0..e628b1d77d 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationService.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationService.ts @@ -38,51 +38,8 @@ export class DefaultLocationService implements LocationService { dryRun: boolean, ): Promise<{ location: Location; entities: Entity[] }> { if (dryRun) { - const entity = { - apiVersion: 'backstage.io/v1alpha1', - kind: 'Location', - metadata: { - name: locationSpecToMetadataName({ - type: spec.type, - target: spec.target, - }), - namespace: 'default', - annotations: { - [LOCATION_ANNOTATION]: `${spec.type}:${spec.target}`, - [ORIGIN_LOCATION_ANNOTATION]: `${spec.type}:${spec.target}`, - }, - }, - spec: { - type: spec.type, - target: spec.target, - }, - }; - const unprocessedEntities: Entity[] = [entity]; - const entities: Entity[] = []; - const state = new Map(); // ignored - while (unprocessedEntities.length) { - const currentEntity = unprocessedEntities.pop(); - if (!currentEntity) { - continue; - } - const processed = await this.orchestrator.process({ - entity: currentEntity, - state, - }); - if (processed.ok) { - unprocessedEntities.push(...processed.deferredEntities); - entities.push(processed.completedEntity); - } else { - throw Error(processed.errors.join(', ')); - } - } - - return { - location: { ...spec, id: `${spec.type}:${spec.target}` }, - entities, - }; + return this.dryRunCreateLocation(spec); } - const location = await this.store.createLocation(spec); return { location, entities: [] }; } @@ -96,4 +53,53 @@ export class DefaultLocationService implements LocationService { deleteLocation(id: string): Promise { return this.store.deleteLocation(id); } + + private async dryRunCreateLocation( + spec: LocationSpec, + ): Promise<{ location: Location; entities: Entity[] }> { + const entity = { + apiVersion: 'backstage.io/v1alpha1', + kind: 'Location', + metadata: { + name: locationSpecToMetadataName({ + type: spec.type, + target: spec.target, + }), + namespace: 'default', + annotations: { + [LOCATION_ANNOTATION]: `${spec.type}:${spec.target}`, + [ORIGIN_LOCATION_ANNOTATION]: `${spec.type}:${spec.target}`, + }, + }, + spec: { + type: spec.type, + target: spec.target, + }, + }; + const unprocessedEntities: Entity[] = [entity]; + const entities: Entity[] = []; + const state = new Map(); // ignored + while (unprocessedEntities.length) { + const currentEntity = unprocessedEntities.pop(); + if (!currentEntity) { + continue; + } + const processed = await this.orchestrator.process({ + entity: currentEntity, + state, + }); + + if (processed.ok) { + unprocessedEntities.push(...processed.deferredEntities); + entities.push(processed.completedEntity); + } else { + throw Error(processed.errors.map(String).join(', ')); + } + } + + return { + location: { ...spec, id: `${spec.type}:${spec.target}` }, + entities, + }; + } } From b6cb9dcc28547f888fc7aac4b848bece18e0ec7e Mon Sep 17 00:00:00 2001 From: Himanshu Mishra Date: Mon, 10 May 2021 15:36:52 +0200 Subject: [PATCH 461/485] dco/docs: email in angular braces Signed-off-by: Himanshu Mishra --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1b7433888c..2caa8c9c9c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -93,7 +93,7 @@ Which will look something like the following in the repo; ``` Awesome commit message -Signed-off-by: Jane Smith jane.smith@example.com +Signed-off-by: Jane Smith ``` - In case you forgot to add it to the most recent commit, use `git commit --amend --signoff` From 7578f4017562682de1d62fdd0b556998ae247d3a Mon Sep 17 00:00:00 2001 From: Himanshu Mishra Date: Mon, 10 May 2021 15:40:43 +0200 Subject: [PATCH 462/485] microsite: fix typo provider Signed-off-by: Himanshu Mishra --- microsite/pages/en/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/microsite/pages/en/index.js b/microsite/pages/en/index.js index a761d6b6e2..45d87daa1d 100644 --- a/microsite/pages/en/index.js +++ b/microsite/pages/en/index.js @@ -431,7 +431,7 @@ class Index extends React.Component { Pick a cloud, any cloud Since Backstage uses the Kubernetes API, it's cloud agnostic — - so it works no matter which cloud provide or managed Kubernetes + so it works no matter which cloud provider or managed Kubernetes service you use, and even works in multi-cloud orgs From a8c70b3ae45d133d47d42ef82de30590788d81e1 Mon Sep 17 00:00:00 2001 From: Eric Peterson Date: Mon, 10 May 2021 18:21:27 +0200 Subject: [PATCH 463/485] Maybe not THAT transparent. Signed-off-by: Eric Peterson --- packages/backend-common/api-report.md | 4 ++-- .../src/cache/CacheClient.test.ts | 20 ------------------- .../backend-common/src/cache/CacheClient.ts | 19 +++++++----------- 3 files changed, 9 insertions(+), 34 deletions(-) diff --git a/packages/backend-common/api-report.md b/packages/backend-common/api-report.md index 5a9b61dd20..23e22fe34b 100644 --- a/packages/backend-common/api-report.md +++ b/packages/backend-common/api-report.md @@ -65,9 +65,9 @@ export class BitbucketUrlReader implements UrlReader { // @public export interface CacheClient { - delete(key: string): Promise; + delete(key: string): Promise; get(key: string): Promise; - set(key: string, value: JsonValue, options?: CacheSetOptions): Promise; + set(key: string, value: JsonValue, options?: CacheSetOptions): Promise; } // @public diff --git a/packages/backend-common/src/cache/CacheClient.test.ts b/packages/backend-common/src/cache/CacheClient.test.ts index eb32d4a28f..81e8351b58 100644 --- a/packages/backend-common/src/cache/CacheClient.test.ts +++ b/packages/backend-common/src/cache/CacheClient.test.ts @@ -101,16 +101,6 @@ describe('CacheClient', () => { return expect(sut.set('someKey', {})).rejects.toEqual(expectedError); }); - - it('resolves what underlying client resolves', async () => { - const sut = new DefaultCacheClient({ client }); - const expectedResponse = true; - client.set = jest.fn().mockReturnValue(expectedResponse); - - const actualResponse = await sut.set('someKey', {}); - - return expect(actualResponse).toEqual(expectedResponse); - }); }); describe('CacheClient.delete', () => { @@ -132,15 +122,5 @@ describe('CacheClient', () => { return expect(sut.delete('someKey')).rejects.toEqual(expectedError); }); - - it('resolves what underlying client resolves', async () => { - const sut = new DefaultCacheClient({ client }); - const expectedResponse = false; - client.delete = jest.fn().mockResolvedValue(expectedResponse); - - const actualResponse = await sut.delete('someKey'); - - return expect(actualResponse).toEqual(expectedResponse); - }); }); }); diff --git a/packages/backend-common/src/cache/CacheClient.ts b/packages/backend-common/src/cache/CacheClient.ts index a2c048c265..49b5c367dd 100644 --- a/packages/backend-common/src/cache/CacheClient.ts +++ b/packages/backend-common/src/cache/CacheClient.ts @@ -46,17 +46,12 @@ export interface CacheClient { * optional TTL may also be provided, otherwise it defaults to the TTL that * was provided when the client was instantiated. */ - set( - key: string, - value: JsonValue, - options?: CacheSetOptions, - ): Promise; + set(key: string, value: JsonValue, options?: CacheSetOptions): Promise; /** - * Removes the given key from the cache store. Resolves true if the key - * existed, or false if not. + * Removes the given key from the cache store. */ - delete(key: string): Promise; + delete(key: string): Promise; } /** @@ -79,14 +74,14 @@ export class DefaultCacheClient implements CacheClient { key: string, value: JsonValue, opts: CacheSetOptions = {}, - ): Promise { + ): Promise { const k = this.getNormalizedKey(key); - return await this.client.set(k, value, opts.ttl); + await this.client.set(k, value, opts.ttl); } - async delete(key: string): Promise { + async delete(key: string): Promise { const k = this.getNormalizedKey(key); - return await this.client.delete(k); + await this.client.delete(k); } /** From 69ad4e630fd3afe00bff8e540381ea5d6471ba7f Mon Sep 17 00:00:00 2001 From: Samira Mokaram Date: Tue, 11 May 2021 13:14:51 +0200 Subject: [PATCH 464/485] address comments Signed-off-by: Samira Mokaram --- .changeset/large-penguins-yell.md | 6 ------ plugins/kubernetes/src/index.ts | 3 +-- plugins/kubernetes/src/kubernetes-auth-provider/index.ts | 2 ++ 3 files changed, 3 insertions(+), 8 deletions(-) delete mode 100644 .changeset/large-penguins-yell.md create mode 100644 plugins/kubernetes/src/kubernetes-auth-provider/index.ts diff --git a/.changeset/large-penguins-yell.md b/.changeset/large-penguins-yell.md deleted file mode 100644 index 9446374f47..0000000000 --- a/.changeset/large-penguins-yell.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@backstage/plugin-kubernetes': patch -'@backstage/plugin-kubernetes-backend': patch ---- - -Export types diff --git a/plugins/kubernetes/src/index.ts b/plugins/kubernetes/src/index.ts index a8dd556b48..aabf36f1dc 100644 --- a/plugins/kubernetes/src/index.ts +++ b/plugins/kubernetes/src/index.ts @@ -19,5 +19,4 @@ export { EntityKubernetesContent, } from './plugin'; export { Router } from './Router'; -export { kubernetesAuthProvidersApiRef } from './kubernetes-auth-provider/types'; -export { KubernetesAuthProviders } from './kubernetes-auth-provider/KubernetesAuthProviders'; +export * from './kubernetes-auth-provider'; diff --git a/plugins/kubernetes/src/kubernetes-auth-provider/index.ts b/plugins/kubernetes/src/kubernetes-auth-provider/index.ts new file mode 100644 index 0000000000..0718d074b5 --- /dev/null +++ b/plugins/kubernetes/src/kubernetes-auth-provider/index.ts @@ -0,0 +1,2 @@ +export { kubernetesAuthProvidersApiRef } from './types'; +export { KubernetesAuthProviders } from './KubernetesAuthProviders'; From 2dca7ecaa5462c0f66edebeeb316187a6a928e16 Mon Sep 17 00:00:00 2001 From: Samira Mokaram Date: Tue, 11 May 2021 13:28:12 +0200 Subject: [PATCH 465/485] add notice header Signed-off-by: Samira Mokaram --- .../src/kubernetes-auth-provider/index.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/plugins/kubernetes/src/kubernetes-auth-provider/index.ts b/plugins/kubernetes/src/kubernetes-auth-provider/index.ts index 0718d074b5..8f54913903 100644 --- a/plugins/kubernetes/src/kubernetes-auth-provider/index.ts +++ b/plugins/kubernetes/src/kubernetes-auth-provider/index.ts @@ -1,2 +1,18 @@ +/* + * Copyright 2020 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. + */ + export { kubernetesAuthProvidersApiRef } from './types'; export { KubernetesAuthProviders } from './KubernetesAuthProviders'; From ee103bc710285ff5d06248346b70d1aecc0c2bb6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 May 2021 12:39:58 +0000 Subject: [PATCH 466/485] chore(deps): bump @testing-library/user-event from 12.8.3 to 13.1.8 Bumps [@testing-library/user-event](https://github.com/testing-library/user-event) from 12.8.3 to 13.1.8. - [Release notes](https://github.com/testing-library/user-event/releases) - [Changelog](https://github.com/testing-library/user-event/blob/master/CHANGELOG.md) - [Commits](https://github.com/testing-library/user-event/compare/v12.8.3...v13.1.8) Signed-off-by: dependabot[bot] --- packages/app/package.json | 2 +- packages/core-api/package.json | 2 +- packages/core/package.json | 2 +- packages/dev-utils/package.json | 2 +- packages/integration-react/package.json | 2 +- packages/test-utils/package.json | 2 +- plugins/api-docs/package.json | 2 +- plugins/badges/package.json | 2 +- plugins/bitrise/package.json | 2 +- plugins/catalog-import/package.json | 2 +- plugins/catalog-react/package.json | 2 +- plugins/catalog/package.json | 2 +- plugins/circleci/package.json | 2 +- plugins/cloudbuild/package.json | 2 +- plugins/code-coverage/package.json | 2 +- plugins/config-schema/package.json | 2 +- plugins/cost-insights/package.json | 2 +- plugins/explore-react/package.json | 2 +- plugins/explore/package.json | 2 +- plugins/fossa/package.json | 2 +- plugins/gcp-projects/package.json | 2 +- plugins/github-actions/package.json | 2 +- plugins/github-deployments/package.json | 2 +- plugins/gitops-profiles/package.json | 2 +- plugins/graphiql/package.json | 2 +- plugins/jenkins/package.json | 2 +- plugins/kafka/package.json | 2 +- plugins/kubernetes/package.json | 2 +- plugins/lighthouse/package.json | 2 +- plugins/newrelic/package.json | 2 +- plugins/org/package.json | 2 +- plugins/pagerduty/package.json | 2 +- plugins/register-component/package.json | 2 +- plugins/rollbar/package.json | 2 +- plugins/scaffolder/package.json | 2 +- plugins/search/package.json | 2 +- plugins/sentry/package.json | 2 +- plugins/shortcuts/package.json | 2 +- plugins/sonarqube/package.json | 2 +- plugins/splunk-on-call/package.json | 2 +- plugins/tech-radar/package.json | 2 +- plugins/techdocs/package.json | 2 +- plugins/todo/package.json | 2 +- plugins/user-settings/package.json | 2 +- plugins/welcome/package.json | 2 +- yarn.lock | 9 ++++----- 46 files changed, 49 insertions(+), 50 deletions(-) diff --git a/packages/app/package.json b/packages/app/package.json index cbc8c5f1a3..714d420744 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -60,7 +60,7 @@ "@testing-library/cypress": "^7.0.1", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/jquery": "^3.3.34", "@types/node": "^14.14.32", diff --git a/packages/core-api/package.json b/packages/core-api/package.json index 13d7efe77b..f9fd3d29a6 100644 --- a/packages/core-api/package.json +++ b/packages/core-api/package.json @@ -48,7 +48,7 @@ "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/react-hooks": "^3.3.0", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "@types/zen-observable": "^0.8.0", diff --git a/packages/core/package.json b/packages/core/package.json index 315441a87c..16928d63ca 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -75,7 +75,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/classnames": "^2.2.9", "@types/d3-selection": "^2.0.0", "@types/d3-shape": "^2.0.0", diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 3845da7e9b..421cd0a2b8 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -39,7 +39,7 @@ "@material-ui/icons": "^4.9.1", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/react": "^16.9", "react": "^16.12.0", "react-dom": "^16.12.0", diff --git a/packages/integration-react/package.json b/packages/integration-react/package.json index 7833952e8e..8df1eef096 100644 --- a/packages/integration-react/package.json +++ b/packages/integration-react/package.json @@ -37,7 +37,7 @@ "@backstage/test-utils": "^0.1.8", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "msw": "^0.21.2", diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index a81455df01..74716f7a16 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -35,7 +35,7 @@ "@material-ui/core": "^4.11.0", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/react": "^16.9", "msw": "^0.21.3", "react": "^16.12.0", diff --git a/plugins/api-docs/package.json b/plugins/api-docs/package.json index 9cccb07d56..c94680de9b 100644 --- a/plugins/api-docs/package.json +++ b/plugins/api-docs/package.json @@ -54,7 +54,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "@types/swagger-ui-react": "^3.23.3", diff --git a/plugins/badges/package.json b/plugins/badges/package.json index 24660899e2..e757567401 100644 --- a/plugins/badges/package.json +++ b/plugins/badges/package.json @@ -39,7 +39,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/bitrise/package.json b/plugins/bitrise/package.json index 45b32a11d1..f37d08f725 100644 --- a/plugins/bitrise/package.json +++ b/plugins/bitrise/package.json @@ -42,7 +42,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "@types/recharts": "^1.8.15", diff --git a/plugins/catalog-import/package.json b/plugins/catalog-import/package.json index c5fcdd4d37..0558be18ec 100644 --- a/plugins/catalog-import/package.json +++ b/plugins/catalog-import/package.json @@ -59,7 +59,7 @@ "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/react-hooks": "^3.3.0", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/catalog-react/package.json b/plugins/catalog-react/package.json index a9092ef75a..491df00c08 100644 --- a/plugins/catalog-react/package.json +++ b/plugins/catalog-react/package.json @@ -46,7 +46,7 @@ "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/react-hooks": "^3.3.0", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/catalog/package.json b/plugins/catalog/package.json index f1a0e6979d..140c42cfdb 100644 --- a/plugins/catalog/package.json +++ b/plugins/catalog/package.json @@ -59,7 +59,7 @@ "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/react-hooks": "^3.3.0", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/circleci/package.json b/plugins/circleci/package.json index 98af012a49..4503f59636 100644 --- a/plugins/circleci/package.json +++ b/plugins/circleci/package.json @@ -55,7 +55,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "@types/react-lazylog": "^4.5.0", diff --git a/plugins/cloudbuild/package.json b/plugins/cloudbuild/package.json index 325dfb4e06..59fbda33f6 100644 --- a/plugins/cloudbuild/package.json +++ b/plugins/cloudbuild/package.json @@ -52,7 +52,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/code-coverage/package.json b/plugins/code-coverage/package.json index 9b227c1df1..837c3d4794 100644 --- a/plugins/code-coverage/package.json +++ b/plugins/code-coverage/package.json @@ -44,7 +44,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/highlightjs": "^10.1.0", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", diff --git a/plugins/config-schema/package.json b/plugins/config-schema/package.json index caa03b9ffb..43c6e67f1a 100644 --- a/plugins/config-schema/package.json +++ b/plugins/config-schema/package.json @@ -39,7 +39,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "msw": "^0.21.2", diff --git a/plugins/cost-insights/package.json b/plugins/cost-insights/package.json index 3a5601041c..3fd057aa4a 100644 --- a/plugins/cost-insights/package.json +++ b/plugins/cost-insights/package.json @@ -60,7 +60,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "@types/pluralize": "^0.0.29", diff --git a/plugins/explore-react/package.json b/plugins/explore-react/package.json index b6852ea0f0..cf8c944433 100644 --- a/plugins/explore-react/package.json +++ b/plugins/explore-react/package.json @@ -36,7 +36,7 @@ "@backstage/test-utils": "^0.1.6", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/explore/package.json b/plugins/explore/package.json index 2a25a9db41..3069b719f0 100644 --- a/plugins/explore/package.json +++ b/plugins/explore/package.json @@ -50,7 +50,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/fossa/package.json b/plugins/fossa/package.json index 95762e52d7..e6fa50f7da 100644 --- a/plugins/fossa/package.json +++ b/plugins/fossa/package.json @@ -52,7 +52,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/gcp-projects/package.json b/plugins/gcp-projects/package.json index fd6048ab2a..d50e63725e 100644 --- a/plugins/gcp-projects/package.json +++ b/plugins/gcp-projects/package.json @@ -46,7 +46,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/github-actions/package.json b/plugins/github-actions/package.json index 95608c3c49..9bdbaf3c4b 100644 --- a/plugins/github-actions/package.json +++ b/plugins/github-actions/package.json @@ -55,7 +55,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/github-deployments/package.json b/plugins/github-deployments/package.json index 84a0fe1660..1086fc0d17 100644 --- a/plugins/github-deployments/package.json +++ b/plugins/github-deployments/package.json @@ -39,7 +39,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/gitops-profiles/package.json b/plugins/gitops-profiles/package.json index c00dbde482..21744a6f54 100644 --- a/plugins/gitops-profiles/package.json +++ b/plugins/gitops-profiles/package.json @@ -47,7 +47,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/graphiql/package.json b/plugins/graphiql/package.json index ae3c0dfe8f..053fbc066a 100644 --- a/plugins/graphiql/package.json +++ b/plugins/graphiql/package.json @@ -48,7 +48,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/codemirror": "^0.0.108", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", diff --git a/plugins/jenkins/package.json b/plugins/jenkins/package.json index c4ba600d7e..aa57fa1d1a 100644 --- a/plugins/jenkins/package.json +++ b/plugins/jenkins/package.json @@ -52,7 +52,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "@types/testing-library__jest-dom": "^5.9.1", diff --git a/plugins/kafka/package.json b/plugins/kafka/package.json index e405460262..e18d5188d0 100644 --- a/plugins/kafka/package.json +++ b/plugins/kafka/package.json @@ -39,7 +39,7 @@ "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/react-hooks": "^3.4.2", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/kubernetes/package.json b/plugins/kubernetes/package.json index 19865a6fcc..aaa55fef13 100644 --- a/plugins/kubernetes/package.json +++ b/plugins/kubernetes/package.json @@ -55,7 +55,7 @@ "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/react-hooks": "^3.4.2", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/lighthouse/package.json b/plugins/lighthouse/package.json index f70e29f69b..039f8b6dce 100644 --- a/plugins/lighthouse/package.json +++ b/plugins/lighthouse/package.json @@ -51,7 +51,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "@types/react": "^16.9", diff --git a/plugins/newrelic/package.json b/plugins/newrelic/package.json index 20ee5521f4..96ef75b532 100644 --- a/plugins/newrelic/package.json +++ b/plugins/newrelic/package.json @@ -46,7 +46,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/org/package.json b/plugins/org/package.json index 012514f1c4..a0bb1ba06e 100644 --- a/plugins/org/package.json +++ b/plugins/org/package.json @@ -40,7 +40,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/pagerduty/package.json b/plugins/pagerduty/package.json index 53f0ddbb23..7cbb0a21b7 100644 --- a/plugins/pagerduty/package.json +++ b/plugins/pagerduty/package.json @@ -51,7 +51,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/register-component/package.json b/plugins/register-component/package.json index 3efb61b982..376526a059 100644 --- a/plugins/register-component/package.json +++ b/plugins/register-component/package.json @@ -50,7 +50,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/rollbar/package.json b/plugins/rollbar/package.json index 8b559e0bf1..3e1f7e4964 100644 --- a/plugins/rollbar/package.json +++ b/plugins/rollbar/package.json @@ -53,7 +53,7 @@ "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/react-hooks": "^3.3.0", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "@types/react": "^16.9", diff --git a/plugins/scaffolder/package.json b/plugins/scaffolder/package.json index 1992028157..e21e457c6c 100644 --- a/plugins/scaffolder/package.json +++ b/plugins/scaffolder/package.json @@ -65,7 +65,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/humanize-duration": "^3.18.1", "@testing-library/react-hooks": "^3.3.0", "@types/jest": "^26.0.7", diff --git a/plugins/search/package.json b/plugins/search/package.json index f503b9a78e..ee7d15ddc3 100644 --- a/plugins/search/package.json +++ b/plugins/search/package.json @@ -49,7 +49,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/sentry/package.json b/plugins/sentry/package.json index 6784debcf9..d33b57e975 100644 --- a/plugins/sentry/package.json +++ b/plugins/sentry/package.json @@ -51,7 +51,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "@types/react": "^16.9", diff --git a/plugins/shortcuts/package.json b/plugins/shortcuts/package.json index f87fe0e683..a0f8a0c498 100644 --- a/plugins/shortcuts/package.json +++ b/plugins/shortcuts/package.json @@ -40,7 +40,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/sonarqube/package.json b/plugins/sonarqube/package.json index df5304d746..6b7e5ff4d9 100644 --- a/plugins/sonarqube/package.json +++ b/plugins/sonarqube/package.json @@ -52,7 +52,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/splunk-on-call/package.json b/plugins/splunk-on-call/package.json index 020fbc37cd..4ec6e6a0f4 100644 --- a/plugins/splunk-on-call/package.json +++ b/plugins/splunk-on-call/package.json @@ -50,7 +50,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/luxon": "^1.25.0", "@types/node": "^14.14.32", diff --git a/plugins/tech-radar/package.json b/plugins/tech-radar/package.json index 5e33024f87..538511565b 100644 --- a/plugins/tech-radar/package.json +++ b/plugins/tech-radar/package.json @@ -48,7 +48,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/color": "^3.0.1", "@types/d3-force": "^2.1.1", "@types/jest": "^26.0.7", diff --git a/plugins/techdocs/package.json b/plugins/techdocs/package.json index 20fca364da..87cb1185a0 100644 --- a/plugins/techdocs/package.json +++ b/plugins/techdocs/package.json @@ -56,7 +56,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/react": "^16.9", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", diff --git a/plugins/todo/package.json b/plugins/todo/package.json index b7564f7080..8a3d327929 100644 --- a/plugins/todo/package.json +++ b/plugins/todo/package.json @@ -44,7 +44,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "msw": "^0.21.2", diff --git a/plugins/user-settings/package.json b/plugins/user-settings/package.json index 32e232cad4..b52584267c 100644 --- a/plugins/user-settings/package.json +++ b/plugins/user-settings/package.json @@ -46,7 +46,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/plugins/welcome/package.json b/plugins/welcome/package.json index 72ec24bf71..5f557f00b1 100644 --- a/plugins/welcome/package.json +++ b/plugins/welcome/package.json @@ -46,7 +46,7 @@ "@backstage/test-utils": "^0.1.10", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", diff --git a/yarn.lock b/yarn.lock index 437a9be678..8aaf6d3761 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5606,10 +5606,10 @@ "@babel/runtime" "^7.12.5" "@testing-library/dom" "^7.28.1" -"@testing-library/user-event@^12.0.7": - version "12.8.3" - resolved "https://registry.npmjs.org/@testing-library/user-event/-/user-event-12.8.3.tgz#1aa3ed4b9f79340a1e1836bc7f57c501e838704a" - integrity sha512-IR0iWbFkgd56Bu5ZI/ej8yQwrkCv8Qydx6RzwbKz9faXazR/+5tvYKsZQgyXJiwgpcva127YO6JcWy7YlCfofQ== +"@testing-library/user-event@^13.1.8": + version "13.1.8" + resolved "https://registry.npmjs.org/@testing-library/user-event/-/user-event-13.1.8.tgz#9cbf342b88d837ee188f9f9f4df6d1beaaf179c2" + integrity sha512-M04HgOlJvxILf5xyrkJaEQfFOtcvhy3usLldQIEg9zgFIYQofSmFGVfFlS7BWowqlBGLrItwGMlPXCoBgoHSiw== dependencies: "@babel/runtime" "^7.12.5" @@ -18668,7 +18668,6 @@ minipass-fetch@^1.3.0, minipass-fetch@^1.3.2: resolved "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-1.3.3.tgz#34c7cea038c817a8658461bf35174551dce17a0a" integrity sha512-akCrLDWfbdAWkMLBxJEeWTdNsjML+dt5YgOI4gJ53vuO0vrmYQkUPxa6j6V65s9CcePIr2SSWqjT2EcrNseryQ== dependencies: - encoding "^0.1.12" minipass "^3.1.0" minipass-sized "^1.0.3" minizlib "^2.0.0" From f6706308e1dbabfc237f7eb304644c5e6ecf6e74 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 11 May 2021 10:24:11 +0200 Subject: [PATCH 467/485] chore: fix failing test, it was failing in a good way. Signed-off-by: blam --- .../StepInitAnalyzeUrl/StepInitAnalyzeUrl.test.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/catalog-import/src/components/StepInitAnalyzeUrl/StepInitAnalyzeUrl.test.tsx b/plugins/catalog-import/src/components/StepInitAnalyzeUrl/StepInitAnalyzeUrl.test.tsx index 3e918db419..03882d48ce 100644 --- a/plugins/catalog-import/src/components/StepInitAnalyzeUrl/StepInitAnalyzeUrl.test.tsx +++ b/plugins/catalog-import/src/components/StepInitAnalyzeUrl/StepInitAnalyzeUrl.test.tsx @@ -98,7 +98,11 @@ describe('', () => { ); await act(async () => { - userEvent.click(getByRole('button', { name: /Analyze/i })); + try { + userEvent.click(getByRole('button', { name: /Analyze/i })); + } catch { + return; + } }); expect(catalogImportApi.analyzeUrl).toBeCalledTimes(0); From 062bbf90f89b67ce9aa61d7074b524e94dc6a051 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 11 May 2021 10:32:43 +0200 Subject: [PATCH 468/485] chore: add changeset Signed-off-by: blam --- .changeset/afraid-waves-remember.md | 49 +++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .changeset/afraid-waves-remember.md diff --git a/.changeset/afraid-waves-remember.md b/.changeset/afraid-waves-remember.md new file mode 100644 index 0000000000..13df956acc --- /dev/null +++ b/.changeset/afraid-waves-remember.md @@ -0,0 +1,49 @@ +--- +'@backstage/core': patch +'@backstage/core-api': patch +'@backstage/dev-utils': patch +'@backstage/integration-react': patch +'@backstage/test-utils': patch +'@backstage/plugin-api-docs': patch +'@backstage/plugin-badges': patch +'@backstage/plugin-bitrise': patch +'@backstage/plugin-catalog': patch +'@backstage/plugin-catalog-import': patch +'@backstage/plugin-catalog-react': patch +'@backstage/plugin-circleci': patch +'@backstage/plugin-cloudbuild': patch +'@backstage/plugin-code-coverage': patch +'@backstage/plugin-config-schema': patch +'@backstage/plugin-cost-insights': patch +'@backstage/plugin-explore': patch +'@backstage/plugin-explore-react': patch +'@backstage/plugin-fossa': patch +'@backstage/plugin-gcp-projects': patch +'@backstage/plugin-github-actions': patch +'@backstage/plugin-github-deployments': patch +'@backstage/plugin-gitops-profiles': patch +'@backstage/plugin-graphiql': patch +'@backstage/plugin-jenkins': patch +'@backstage/plugin-kafka': patch +'@backstage/plugin-kubernetes': patch +'@backstage/plugin-lighthouse': patch +'@backstage/plugin-newrelic': patch +'@backstage/plugin-org': patch +'@backstage/plugin-pagerduty': patch +'@backstage/plugin-register-component': patch +'@backstage/plugin-rollbar': patch +'@backstage/plugin-scaffolder': patch +'@backstage/plugin-scaffolder-backend': patch +'@backstage/plugin-search': patch +'@backstage/plugin-sentry': patch +'@backstage/plugin-shortcuts': patch +'@backstage/plugin-sonarqube': patch +'@backstage/plugin-splunk-on-call': patch +'@backstage/plugin-tech-radar': patch +'@backstage/plugin-techdocs': patch +'@backstage/plugin-todo': patch +'@backstage/plugin-user-settings': patch +'@backstage/plugin-welcome': patch +--- + +chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 From 90385750c981010e144e789513028c8130725d45 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 11 May 2021 13:18:33 +0200 Subject: [PATCH 469/485] chore: fixing user-event versioning for create-plugin templates Signed-off-by: blam --- packages/cli/templates/default-plugin/package.json.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/templates/default-plugin/package.json.hbs b/packages/cli/templates/default-plugin/package.json.hbs index 1b4f8ea6ab..1d2766eab4 100644 --- a/packages/cli/templates/default-plugin/package.json.hbs +++ b/packages/cli/templates/default-plugin/package.json.hbs @@ -39,7 +39,7 @@ "@backstage/test-utils": "^{{version '@backstage/test-utils'}}", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "msw": "^0.21.2", From 1917a19ad90cb0bfb7c82733d423c65a01ea0e12 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 11 May 2021 14:31:25 +0200 Subject: [PATCH 470/485] chore: fixing user-events version for new package Signed-off-by: blam --- plugins/git-release-manager/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git-release-manager/package.json b/plugins/git-release-manager/package.json index 9aca27d1a9..cae3bcdb70 100644 --- a/plugins/git-release-manager/package.json +++ b/plugins/git-release-manager/package.json @@ -43,7 +43,7 @@ "@types/recharts": "^1.8.15", "@testing-library/react-hooks": "^3.4.2", "@testing-library/react": "^11.2.5", - "@testing-library/user-event": "^12.0.7", + "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", "@types/node": "^14.14.32", "cross-fetch": "^3.0.6", From 52e6a73fe17475364d1ccbbbd3c5d84b3c18b1a5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 May 2021 13:34:25 +0000 Subject: [PATCH 471/485] chore(deps): bump hosted-git-info from 2.8.8 to 2.8.9 Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9. - [Release notes](https://github.com/npm/hosted-git-info/releases) - [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md) - [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9) Signed-off-by: dependabot[bot] --- yarn.lock | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/yarn.lock b/yarn.lock index 437a9be678..f4353b9a6a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14802,9 +14802,9 @@ hoopy@^0.1.4: integrity sha512-HRcs+2mr52W0K+x8RzcLzuPPmVIKMSv97RGHy0Ea9y/mpcaK+xTrjICA04KAHi4GRzxliNqNJEFYWHghy3rSfQ== hosted-git-info@^2.1.4: - version "2.8.8" - resolved "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz#7539bd4bc1e0e0a895815a2e0262420b12858488" - integrity sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg== + version "2.8.9" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" + integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== hosted-git-info@^3.0.6: version "3.0.8" @@ -18668,7 +18668,6 @@ minipass-fetch@^1.3.0, minipass-fetch@^1.3.2: resolved "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-1.3.3.tgz#34c7cea038c817a8658461bf35174551dce17a0a" integrity sha512-akCrLDWfbdAWkMLBxJEeWTdNsjML+dt5YgOI4gJ53vuO0vrmYQkUPxa6j6V65s9CcePIr2SSWqjT2EcrNseryQ== dependencies: - encoding "^0.1.12" minipass "^3.1.0" minipass-sized "^1.0.3" minizlib "^2.0.0" From 01a9ebf6a531e001fd0b8099b997d482da16cba2 Mon Sep 17 00:00:00 2001 From: Oliver Sand Date: Tue, 11 May 2021 18:01:27 +0200 Subject: [PATCH 472/485] Make integrations take precedence over providers Signed-off-by: Oliver Sand --- .changeset/polite-plants-exercise.md | 22 ++++--------------- .../processors/GithubOrgReaderProcessor.ts | 8 ++++--- .../processors/github/config.test.ts | 10 +++++++++ .../src/ingestion/processors/github/config.ts | 9 ++++++++ 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/.changeset/polite-plants-exercise.md b/.changeset/polite-plants-exercise.md index ac4a8d1403..2cfa38697a 100644 --- a/.changeset/polite-plants-exercise.md +++ b/.changeset/polite-plants-exercise.md @@ -8,21 +8,7 @@ addition to [`catalog.processors.githubOrg.providers`](https://backstage.io/docs The `integrations` package supports authentication with both personal access tokens and GitHub apps. -This deprecates the `catalog.processors.githubOrg.providers` configuration. If -you still have a configuration for providers the processor keeps working, but -consider moving to the [`integrations` configuration](https://backstage.io/docs/integrations/github/locations) -as the providers will be removed in the future. You might need to allow -additional scopes for the credentials. - -If you want to stay with providers for now, this introduces a small breaking -change, previously if you had no provider configured, one for GitHub was automatically added. To keep the behavior, add a -default provider for GitHub: - -```yaml -catalog: - processors: - githubOrg: - providers: - - target: https://github.com - apiBaseUrl: https://api.github.com -``` +This deprecates the `catalog.processors.githubOrg.providers` configuration. +A [`integrations` configuration](https://backstage.io/docs/integrations/github/locations) +for the same host takes precedence over the provider configuration. +You might need to add additional scopes for the credentials. diff --git a/plugins/catalog-backend/src/ingestion/processors/GithubOrgReaderProcessor.ts b/plugins/catalog-backend/src/ingestion/processors/GithubOrgReaderProcessor.ts index 5840daed74..14204adde7 100644 --- a/plugins/catalog-backend/src/ingestion/processors/GithubOrgReaderProcessor.ts +++ b/plugins/catalog-backend/src/ingestion/processors/GithubOrgReaderProcessor.ts @@ -113,10 +113,10 @@ export class GithubOrgReaderProcessor implements CatalogProcessor { } private async createClient(orgUrl: string): Promise { - let client = this.createClientFromProvider(orgUrl); + let client = await this.createClientFromIntegrations(orgUrl); if (!client) { - client = await this.createClientFromIntegrations(orgUrl); + client = await this.createClientFromProvider(orgUrl); } if (!client) { @@ -128,7 +128,9 @@ export class GithubOrgReaderProcessor implements CatalogProcessor { return client; } - private createClientFromProvider(orgUrl: string): GraphQL | undefined { + private async createClientFromProvider( + orgUrl: string, + ): Promise { const provider = this.providers.find(p => orgUrl.startsWith(`${p.target}/`), ); diff --git a/plugins/catalog-backend/src/ingestion/processors/github/config.test.ts b/plugins/catalog-backend/src/ingestion/processors/github/config.test.ts index b39a7a7ff9..14f3caa42c 100644 --- a/plugins/catalog-backend/src/ingestion/processors/github/config.test.ts +++ b/plugins/catalog-backend/src/ingestion/processors/github/config.test.ts @@ -27,6 +27,16 @@ describe('config', () => { }); } + it('adds a default GitHub entry when missing', () => { + const output = readGithubConfig(config([])); + expect(output).toEqual([ + { + target: 'https://github.com', + apiBaseUrl: 'https://api.github.com', + }, + ]); + }); + it('injects the correct GitHub API base URL when missing', () => { const output = readGithubConfig( config([{ target: 'https://github.com' }]), diff --git a/plugins/catalog-backend/src/ingestion/processors/github/config.ts b/plugins/catalog-backend/src/ingestion/processors/github/config.ts index 7b16448b9e..88f2f96218 100644 --- a/plugins/catalog-backend/src/ingestion/processors/github/config.ts +++ b/plugins/catalog-backend/src/ingestion/processors/github/config.ts @@ -71,5 +71,14 @@ export function readGithubConfig(config: Config): ProviderConfig[] { providers.push({ target, apiBaseUrl, token }); } + // If no explicit github.com provider was added, put one in the list as + // a convenience + if (!providers.some(p => p.target === 'https://github.com')) { + providers.push({ + target: 'https://github.com', + apiBaseUrl: 'https://api.github.com', + }); + } + return providers; } From a7e5c54f80702528ff866d7d895912b327662493 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 May 2021 00:35:14 +0000 Subject: [PATCH 473/485] chore(deps): bump json-pointer from 0.6.0 to 0.6.1 Bumps [json-pointer](https://github.com/manuelstofer/json-pointer) from 0.6.0 to 0.6.1. - [Release notes](https://github.com/manuelstofer/json-pointer/releases) - [Commits](https://github.com/manuelstofer/json-pointer/commits) Signed-off-by: dependabot[bot] --- yarn.lock | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/yarn.lock b/yarn.lock index 27a778fd03..16d48d6252 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13490,7 +13490,7 @@ for-own@^0.1.3: foreach@^2.0.4: version "2.0.5" - resolved "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" + resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" integrity sha1-C+4AUBiusmDQo6865ljdATbsG5k= forever-agent@~0.6.1: @@ -14428,9 +14428,9 @@ graphql-extensions@^0.12.8: apollo-server-env "^3.0.0" apollo-server-types "^0.6.3" -graphql-language-service-interface@^2.8.2: +graphql-language-service-interface@2.8.2, graphql-language-service-interface@^2.8.2: version "2.8.2" - resolved "https://registry.yarnpkg.com/graphql-language-service-interface/-/graphql-language-service-interface-2.8.2.tgz#b3bb2aef7eaf0dff0b4ea419fa412c5f66fa268b" + resolved "https://registry.npmjs.org/graphql-language-service-interface/-/graphql-language-service-interface-2.8.2.tgz#b3bb2aef7eaf0dff0b4ea419fa412c5f66fa268b" integrity sha512-otbOQmhgkAJU1QJgQkMztNku6SbJLu/uodoFOYOOtJsizTjrMs93vkYaHCcYnLA3oi1Goj27XcHjMnRCYQOZXQ== dependencies: graphql-language-service-parser "^1.9.0" @@ -14438,9 +14438,9 @@ graphql-language-service-interface@^2.8.2: graphql-language-service-utils "^2.5.1" vscode-languageserver-types "^3.15.1" -graphql-language-service-parser@^1.9.0: +graphql-language-service-parser@1.9.0, graphql-language-service-parser@^1.9.0: version "1.9.0" - resolved "https://registry.yarnpkg.com/graphql-language-service-parser/-/graphql-language-service-parser-1.9.0.tgz#79af21294119a0a7e81b6b994a1af36833bab724" + resolved "https://registry.npmjs.org/graphql-language-service-parser/-/graphql-language-service-parser-1.9.0.tgz#79af21294119a0a7e81b6b994a1af36833bab724" integrity sha512-B5xPZLbBmIp0kHvpY1Z35I5DtPoDK9wGxQVRDIzcBaiIvAmlTrDvjo3bu7vKREdjFbYKvWNgrEWENuprMbF17Q== dependencies: graphql-language-service-types "^1.8.0" @@ -16886,9 +16886,9 @@ json-parse-even-better-errors@^2.3.0: integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== json-pointer@^0.6.0: - version "0.6.0" - resolved "https://registry.npmjs.org/json-pointer/-/json-pointer-0.6.0.tgz#8e500550a6aac5464a473377da57aa6cc22828d7" - integrity sha1-jlAFUKaqxUZKRzN32leqbMIoKNc= + version "0.6.1" + resolved "https://registry.yarnpkg.com/json-pointer/-/json-pointer-0.6.1.tgz#3c6caa6ac139e2599f5a1659d39852154015054d" + integrity sha512-3OvjqKdCBvH41DLpV4iSt6v2XhZXV1bPB4OROuknvUXI7ZQNofieCPkmE26stEJ9zdQuvIxDHCuYhfgxFAAs+Q== dependencies: foreach "^2.0.4" @@ -25719,16 +25719,11 @@ typescript-json-schema@^0.49.0: typescript "^4.1.3" yargs "^16.2.0" -typescript@^4.0.3, typescript@^4.1.3: +typescript@^4.0.3, typescript@^4.1.3, typescript@~4.1.3: version "4.2.3" resolved "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3" integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw== -typescript@~4.1.3: - version "4.1.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.5.tgz#123a3b214aaff3be32926f0d8f1f6e704eb89a72" - integrity sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA== - ua-parser-js@^0.7.18: version "0.7.28" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.28.tgz#8ba04e653f35ce210239c64661685bf9121dec31" From bd389ae394a9659b358bb0e232bee0f642df5ca5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 May 2021 02:57:53 +0000 Subject: [PATCH 474/485] chore(deps): bump merge from 2.1.0 to 2.1.1 Bumps [merge](https://github.com/yeikos/js.merge) from 2.1.0 to 2.1.1. - [Release notes](https://github.com/yeikos/js.merge/releases) - [Commits](https://github.com/yeikos/js.merge/compare/v2.1.0...v2.1.1) Signed-off-by: dependabot[bot] --- yarn.lock | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/yarn.lock b/yarn.lock index 27a778fd03..8f52b5cf6c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14428,9 +14428,9 @@ graphql-extensions@^0.12.8: apollo-server-env "^3.0.0" apollo-server-types "^0.6.3" -graphql-language-service-interface@^2.8.2: +graphql-language-service-interface@2.8.2, graphql-language-service-interface@^2.8.2: version "2.8.2" - resolved "https://registry.yarnpkg.com/graphql-language-service-interface/-/graphql-language-service-interface-2.8.2.tgz#b3bb2aef7eaf0dff0b4ea419fa412c5f66fa268b" + resolved "https://registry.npmjs.org/graphql-language-service-interface/-/graphql-language-service-interface-2.8.2.tgz#b3bb2aef7eaf0dff0b4ea419fa412c5f66fa268b" integrity sha512-otbOQmhgkAJU1QJgQkMztNku6SbJLu/uodoFOYOOtJsizTjrMs93vkYaHCcYnLA3oi1Goj27XcHjMnRCYQOZXQ== dependencies: graphql-language-service-parser "^1.9.0" @@ -14438,9 +14438,9 @@ graphql-language-service-interface@^2.8.2: graphql-language-service-utils "^2.5.1" vscode-languageserver-types "^3.15.1" -graphql-language-service-parser@^1.9.0: +graphql-language-service-parser@1.9.0, graphql-language-service-parser@^1.9.0: version "1.9.0" - resolved "https://registry.yarnpkg.com/graphql-language-service-parser/-/graphql-language-service-parser-1.9.0.tgz#79af21294119a0a7e81b6b994a1af36833bab724" + resolved "https://registry.npmjs.org/graphql-language-service-parser/-/graphql-language-service-parser-1.9.0.tgz#79af21294119a0a7e81b6b994a1af36833bab724" integrity sha512-B5xPZLbBmIp0kHvpY1Z35I5DtPoDK9wGxQVRDIzcBaiIvAmlTrDvjo3bu7vKREdjFbYKvWNgrEWENuprMbF17Q== dependencies: graphql-language-service-types "^1.8.0" @@ -18446,9 +18446,9 @@ merge2@^1.2.3, merge2@^1.3.0: integrity sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw== merge@^2.1.0: - version "2.1.0" - resolved "https://registry.npmjs.org/merge/-/merge-2.1.0.tgz#91fff62458ba2eca378dd395fa85f1690bf87f60" - integrity sha512-TcuhVDV+e6X457MQAm7xIb19rWhZuEDEho7RrwxMpQ/3GhD5sDlnP188gjQQuweXHy9igdke5oUtVOXX1X8Sxg== + version "2.1.1" + resolved "https://registry.yarnpkg.com/merge/-/merge-2.1.1.tgz#59ef4bf7e0b3e879186436e8481c06a6c162ca98" + integrity sha512-jz+Cfrg9GWOZbQAnDQ4hlVnQky+341Yk5ru8bZSe6sIDTCIg8n9i/u7hSQGSVOF3C7lH6mGtqjkiT9G4wFLL0w== meros@^1.1.2: version "1.1.4" @@ -25719,16 +25719,11 @@ typescript-json-schema@^0.49.0: typescript "^4.1.3" yargs "^16.2.0" -typescript@^4.0.3, typescript@^4.1.3: +typescript@^4.0.3, typescript@^4.1.3, typescript@~4.1.3: version "4.2.3" resolved "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3" integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw== -typescript@~4.1.3: - version "4.1.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.5.tgz#123a3b214aaff3be32926f0d8f1f6e704eb89a72" - integrity sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA== - ua-parser-js@^0.7.18: version "0.7.28" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.28.tgz#8ba04e653f35ce210239c64661685bf9121dec31" From 2aed43c43554f103ffbcf2f00b43d1740964237c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 May 2021 04:38:01 +0000 Subject: [PATCH 475/485] chore(deps): bump cross-fetch from 3.0.6 to 3.1.4 Bumps [cross-fetch](https://github.com/lquixada/cross-fetch) from 3.0.6 to 3.1.4. - [Release notes](https://github.com/lquixada/cross-fetch/releases) - [Commits](https://github.com/lquixada/cross-fetch/compare/v3.0.6...v3.1.4) Signed-off-by: dependabot[bot] --- yarn.lock | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/yarn.lock b/yarn.lock index 27a778fd03..cc98fe4fff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10611,13 +10611,20 @@ cross-env@^7.0.0: dependencies: cross-spawn "^7.0.1" -cross-fetch@3.0.6, cross-fetch@^3.0.4, cross-fetch@^3.0.5, cross-fetch@^3.0.6: +cross-fetch@3.0.6: version "3.0.6" resolved "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.0.6.tgz#3a4040bc8941e653e0e9cf17f29ebcd177d3365c" integrity sha512-KBPUbqgFjzWlVcURG+Svp9TlhA5uliYtiNx/0r8nv0pdypeQCRJ9IaSIc3q/x3q8t3F75cHuwxVql1HFGHCNJQ== dependencies: node-fetch "2.6.1" +cross-fetch@^3.0.4, cross-fetch@^3.0.5, cross-fetch@^3.0.6: + version "3.1.4" + resolved "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.4.tgz#9723f3a3a247bf8b89039f3a380a9244e8fa2f39" + integrity sha512-1eAtFWdIubi6T4XPy6ei9iUFoKpUkIF971QLN8lIvvvwueI65+Nw5haMNKUwfJxabqlIIDODJKGrQ66gxC0PbQ== + dependencies: + node-fetch "2.6.1" + cross-spawn@7.0.1: version "7.0.1" resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.1.tgz#0ab56286e0f7c24e153d04cc2aa027e43a9a5d14" @@ -14428,9 +14435,9 @@ graphql-extensions@^0.12.8: apollo-server-env "^3.0.0" apollo-server-types "^0.6.3" -graphql-language-service-interface@^2.8.2: +graphql-language-service-interface@2.8.2, graphql-language-service-interface@^2.8.2: version "2.8.2" - resolved "https://registry.yarnpkg.com/graphql-language-service-interface/-/graphql-language-service-interface-2.8.2.tgz#b3bb2aef7eaf0dff0b4ea419fa412c5f66fa268b" + resolved "https://registry.npmjs.org/graphql-language-service-interface/-/graphql-language-service-interface-2.8.2.tgz#b3bb2aef7eaf0dff0b4ea419fa412c5f66fa268b" integrity sha512-otbOQmhgkAJU1QJgQkMztNku6SbJLu/uodoFOYOOtJsizTjrMs93vkYaHCcYnLA3oi1Goj27XcHjMnRCYQOZXQ== dependencies: graphql-language-service-parser "^1.9.0" @@ -14438,9 +14445,9 @@ graphql-language-service-interface@^2.8.2: graphql-language-service-utils "^2.5.1" vscode-languageserver-types "^3.15.1" -graphql-language-service-parser@^1.9.0: +graphql-language-service-parser@1.9.0, graphql-language-service-parser@^1.9.0: version "1.9.0" - resolved "https://registry.yarnpkg.com/graphql-language-service-parser/-/graphql-language-service-parser-1.9.0.tgz#79af21294119a0a7e81b6b994a1af36833bab724" + resolved "https://registry.npmjs.org/graphql-language-service-parser/-/graphql-language-service-parser-1.9.0.tgz#79af21294119a0a7e81b6b994a1af36833bab724" integrity sha512-B5xPZLbBmIp0kHvpY1Z35I5DtPoDK9wGxQVRDIzcBaiIvAmlTrDvjo3bu7vKREdjFbYKvWNgrEWENuprMbF17Q== dependencies: graphql-language-service-types "^1.8.0" @@ -25719,16 +25726,11 @@ typescript-json-schema@^0.49.0: typescript "^4.1.3" yargs "^16.2.0" -typescript@^4.0.3, typescript@^4.1.3: +typescript@^4.0.3, typescript@^4.1.3, typescript@~4.1.3: version "4.2.3" resolved "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3" integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw== -typescript@~4.1.3: - version "4.1.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.5.tgz#123a3b214aaff3be32926f0d8f1f6e704eb89a72" - integrity sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA== - ua-parser-js@^0.7.18: version "0.7.28" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.28.tgz#8ba04e653f35ce210239c64661685bf9121dec31" From 5c6bcebe2dece5fd592dcaeafc2909377e558976 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 May 2021 04:39:44 +0000 Subject: [PATCH 476/485] chore(deps): bump graphql-tag from 2.11.0 to 2.12.4 Bumps [graphql-tag](https://github.com/apollographql/graphql-tag) from 2.11.0 to 2.12.4. - [Release notes](https://github.com/apollographql/graphql-tag/releases) - [Changelog](https://github.com/apollographql/graphql-tag/blob/main/CHANGELOG.md) - [Commits](https://github.com/apollographql/graphql-tag/compare/v2.11.0...v2.12.4) Signed-off-by: dependabot[bot] --- yarn.lock | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/yarn.lock b/yarn.lock index 27a778fd03..f838037050 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14428,9 +14428,9 @@ graphql-extensions@^0.12.8: apollo-server-env "^3.0.0" apollo-server-types "^0.6.3" -graphql-language-service-interface@^2.8.2: +graphql-language-service-interface@2.8.2, graphql-language-service-interface@^2.8.2: version "2.8.2" - resolved "https://registry.yarnpkg.com/graphql-language-service-interface/-/graphql-language-service-interface-2.8.2.tgz#b3bb2aef7eaf0dff0b4ea419fa412c5f66fa268b" + resolved "https://registry.npmjs.org/graphql-language-service-interface/-/graphql-language-service-interface-2.8.2.tgz#b3bb2aef7eaf0dff0b4ea419fa412c5f66fa268b" integrity sha512-otbOQmhgkAJU1QJgQkMztNku6SbJLu/uodoFOYOOtJsizTjrMs93vkYaHCcYnLA3oi1Goj27XcHjMnRCYQOZXQ== dependencies: graphql-language-service-parser "^1.9.0" @@ -14438,9 +14438,9 @@ graphql-language-service-interface@^2.8.2: graphql-language-service-utils "^2.5.1" vscode-languageserver-types "^3.15.1" -graphql-language-service-parser@^1.9.0: +graphql-language-service-parser@1.9.0, graphql-language-service-parser@^1.9.0: version "1.9.0" - resolved "https://registry.yarnpkg.com/graphql-language-service-parser/-/graphql-language-service-parser-1.9.0.tgz#79af21294119a0a7e81b6b994a1af36833bab724" + resolved "https://registry.npmjs.org/graphql-language-service-parser/-/graphql-language-service-parser-1.9.0.tgz#79af21294119a0a7e81b6b994a1af36833bab724" integrity sha512-B5xPZLbBmIp0kHvpY1Z35I5DtPoDK9wGxQVRDIzcBaiIvAmlTrDvjo3bu7vKREdjFbYKvWNgrEWENuprMbF17Q== dependencies: graphql-language-service-types "^1.8.0" @@ -14483,9 +14483,11 @@ graphql-subscriptions@^1.0.0: iterall "^1.2.1" graphql-tag@^2.11.0: - version "2.11.0" - resolved "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.11.0.tgz#1deb53a01c46a7eb401d6cb59dec86fa1cccbffd" - integrity sha512-VmsD5pJqWJnQZMUeRwrDhfgoyqcfwEkvtpANqcoUG8/tOLkwNgU9mzub/Mc78OJMhHjx7gfAMTxzdG43VGg3bA== + version "2.12.4" + resolved "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.12.4.tgz#d34066688a4f09e72d6f4663c74211e9b4b7c4bf" + integrity sha512-VV1U4O+9x99EkNpNmCUV5RZwq6MnK4+pGbRYWG+lA/m3uo7TSqJF81OkcOP148gFP6fzdl7JWYBrwWVTS9jXww== + dependencies: + tslib "^2.1.0" graphql-tools@5.0.0: version "5.0.0" @@ -25719,16 +25721,11 @@ typescript-json-schema@^0.49.0: typescript "^4.1.3" yargs "^16.2.0" -typescript@^4.0.3, typescript@^4.1.3: +typescript@^4.0.3, typescript@^4.1.3, typescript@~4.1.3: version "4.2.3" resolved "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3" integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw== -typescript@~4.1.3: - version "4.1.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.5.tgz#123a3b214aaff3be32926f0d8f1f6e704eb89a72" - integrity sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA== - ua-parser-js@^0.7.18: version "0.7.28" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.28.tgz#8ba04e653f35ce210239c64661685bf9121dec31" From babe473dd10f9ef59c734a0f301f2ba3762c41e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Mon, 10 May 2021 10:31:50 +0200 Subject: [PATCH 477/485] Introduce `@backstage/backend-testing`, with `TestDatabases` to start off MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .changeset/wise-pens-count.md | 5 + packages/backend-testing/.eslintrc.js | 3 + packages/backend-testing/README.md | 18 + packages/backend-testing/api-report.md | 21 ++ packages/backend-testing/package.json | 50 +++ .../src/database/TestDatabases.test.ts | 154 ++++++++ .../src/database/TestDatabases.ts | 278 ++++++++++++++ .../backend-testing/src/database/index.ts | 18 + packages/backend-testing/src/index.ts | 17 + packages/backend-testing/src/setupTests.ts | 17 + plugins/catalog-backend/package.json | 1 + .../catalog-backend/src/next/Stitcher.test.ts | 341 +++++++++--------- scripts/api-extractor.ts | 1 + yarn.lock | 107 +++++- 14 files changed, 866 insertions(+), 165 deletions(-) create mode 100644 .changeset/wise-pens-count.md create mode 100644 packages/backend-testing/.eslintrc.js create mode 100644 packages/backend-testing/README.md create mode 100644 packages/backend-testing/api-report.md create mode 100644 packages/backend-testing/package.json create mode 100644 packages/backend-testing/src/database/TestDatabases.test.ts create mode 100644 packages/backend-testing/src/database/TestDatabases.ts create mode 100644 packages/backend-testing/src/database/index.ts create mode 100644 packages/backend-testing/src/index.ts create mode 100644 packages/backend-testing/src/setupTests.ts diff --git a/.changeset/wise-pens-count.md b/.changeset/wise-pens-count.md new file mode 100644 index 0000000000..26eda866bc --- /dev/null +++ b/.changeset/wise-pens-count.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-backend': patch +--- + +Use `TestDatabases` from `@backstage/backend-testing` diff --git a/packages/backend-testing/.eslintrc.js b/packages/backend-testing/.eslintrc.js new file mode 100644 index 0000000000..16a033dbc6 --- /dev/null +++ b/packages/backend-testing/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + extends: [require.resolve('@backstage/cli/config/eslint.backend')], +}; diff --git a/packages/backend-testing/README.md b/packages/backend-testing/README.md new file mode 100644 index 0000000000..f12e94ac25 --- /dev/null +++ b/packages/backend-testing/README.md @@ -0,0 +1,18 @@ +# @backstage/backend-testing + +Test helpers library for Backstage backends. + +## Usage + +Add the library as a `devDependency` to your backend package: + +```sh +# From the Backstage root directory, go to your backend package, or to a backend plugin +cd plugins/my-plugin-backend +yarn add --dev @backstage/backend-testing +``` + +## Documentation + +- [Backstage Readme](https://github.com/backstage/backstage/blob/master/README.md) +- [Backstage Documentation](https://github.com/backstage/backstage/blob/master/docs/README.md) diff --git a/packages/backend-testing/api-report.md b/packages/backend-testing/api-report.md new file mode 100644 index 0000000000..c4c78408ec --- /dev/null +++ b/packages/backend-testing/api-report.md @@ -0,0 +1,21 @@ +## API Report File for "@backstage/backend-testing" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Knex } from 'knex'; + +// @public +export type TestDatabaseId = 'POSTGRES_13' | 'POSTGRES_9' | 'MYSQL_8' | 'SQLITE_3'; + +// @public +export class TestDatabases { + static create(): TestDatabases; + init(id: TestDatabaseId): Promise; + } + + +// (No @packageDocumentation comment for this package) + +``` diff --git a/packages/backend-testing/package.json b/packages/backend-testing/package.json new file mode 100644 index 0000000000..345d294a6c --- /dev/null +++ b/packages/backend-testing/package.json @@ -0,0 +1,50 @@ +{ + "name": "@backstage/backend-testing", + "description": "Test helpers library for Backstage backends", + "version": "0.1.0", + "main": "src/index.ts", + "types": "src/index.ts", + "private": false, + "publishConfig": { + "access": "public", + "main": "dist/index.cjs.js", + "types": "dist/index.d.ts" + }, + "homepage": "https://backstage.io", + "repository": { + "type": "git", + "url": "https://github.com/backstage/backstage", + "directory": "packages/backend-testing" + }, + "keywords": [ + "backstage", + "test" + ], + "license": "Apache-2.0", + "scripts": { + "build": "backstage-cli build --outputs cjs,types", + "lint": "backstage-cli lint", + "test": "backstage-cli test", + "prepack": "backstage-cli prepack", + "postpack": "backstage-cli postpack", + "clean": "backstage-cli clean" + }, + "dependencies": { + "@backstage/backend-common": "^0.7.0", + "@backstage/cli": "^0.6.10", + "@backstage/config": "^0.1.5", + "knex": "^0.95.1", + "mysql2": "^2.2.5", + "pg": "^8.3.0", + "sqlite3": "^5.0.0", + "testcontainers": "^7.10.0", + "uuid": "^8.0.0" + }, + "devDependencies": { + "@backstage/cli": "^0.6.10", + "jest": "^26.0.1" + }, + "files": [ + "dist" + ] +} diff --git a/packages/backend-testing/src/database/TestDatabases.test.ts b/packages/backend-testing/src/database/TestDatabases.test.ts new file mode 100644 index 0000000000..61220e3090 --- /dev/null +++ b/packages/backend-testing/src/database/TestDatabases.test.ts @@ -0,0 +1,154 @@ +/* + * 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 knexFactory from 'knex'; +import { GenericContainer } from 'testcontainers'; +import { TestDatabases } from './TestDatabases'; + +describe('TestDatabases', () => { + const OLD_ENV = process.env; + beforeEach(() => { + jest.resetModules(); + process.env = { ...OLD_ENV }; + }); + afterAll(() => { + process.env = OLD_ENV; + }); + + it.each([ + ['POSTGRES_13'], + ['POSTGRES_9'], + ['MYSQL_8'], + ['SQLITE_3'], + ] as const)( + 'creates distinct %p databases', + async databaseId => { + const dbs = TestDatabases.create(); + const db1 = await dbs.init(databaseId); + const db2 = await dbs.init(databaseId); + await db1.schema.createTable('a', table => table.string('x').primary()); + await db2.schema.createTable('a', table => table.string('y').primary()); + await expect(db1.select({ a: db1.raw('1') })).resolves.toEqual([ + { a: 1 }, + ]); + }, + 60_000, + ); + + it('obeys a provided connection string for postgres 13', async () => { + const dbs = TestDatabases.create(); + const container = await new GenericContainer('postgres:13') + .withExposedPorts(5432) + .withEnv('POSTGRES_USER', 'user') + .withEnv('POSTGRES_PASSWORD', 'pass') + .withTmpFs({ '/var/lib/postgresql/data': 'rw' }) + .start(); + const host = container.getHost(); + const port = container.getMappedPort(5432); + + try { + // Leave a mark + process.env.BACKSTAGE_TEST_DATABASE_POSTGRES13_CONNECTION_STRING = `postgresql://user:pass@${host}:${port}`; + const input = await dbs.init('POSTGRES_13'); + await input.schema.createTable('a', table => table.string('x').primary()); + await input.insert({ x: 'y' }).into('a'); + + // Look for the mark + const output = knexFactory({ + client: 'pg', + connection: { + host, + port, + user: 'user', + password: 'pass', + database: 'backstage_plugin_0', + }, + }); + await expect(output.select('x').from('a')).resolves.toEqual([{ x: 'y' }]); + } finally { + await container.stop({ timeout: 10_000 }); + } + }, 60_000); + + it('obeys a provided connection string for postgres 9', async () => { + const dbs = TestDatabases.create(); + const container = await new GenericContainer('postgres:9') + .withExposedPorts(5432) + .withEnv('POSTGRES_USER', 'user') + .withEnv('POSTGRES_PASSWORD', 'pass') + .withTmpFs({ '/var/lib/postgresql/data': 'rw' }) + .start(); + const host = container.getHost(); + const port = container.getMappedPort(5432); + + try { + // Leave a mark + process.env.BACKSTAGE_TEST_DATABASE_POSTGRES9_CONNECTION_STRING = `postgresql://user:pass@${host}:${port}`; + const input = await dbs.init('POSTGRES_9'); + await input.schema.createTable('a', table => table.string('x').primary()); + await input.insert({ x: 'y' }).into('a'); + + // Look for the mark + const output = knexFactory({ + client: 'pg', + connection: { + host, + port, + user: 'user', + password: 'pass', + database: 'backstage_plugin_0', + }, + }); + await expect(output.select('x').from('a')).resolves.toEqual([{ x: 'y' }]); + } finally { + await container.stop({ timeout: 10_000 }); + } + }, 60_000); + + it('obeys a provided connection string for mysql 8', async () => { + const dbs = TestDatabases.create(); + const container = await new GenericContainer('mysql:8') + .withExposedPorts(3306) + .withEnv('MYSQL_ROOT_PASSWORD', 'pass') + .withTmpFs({ '/var/lib/mysql': 'rw' }) + .start(); + const host = container.getHost(); + const port = container.getMappedPort(3306); + + try { + // Leave a mark + process.env.BACKSTAGE_TEST_DATABASE_MYSQL8_CONNECTION_STRING = `mysql://root:pass@${host}:${port}/ignored`; + const input = await dbs.init('MYSQL_8'); + await input.schema.createTable('a', table => table.string('x').primary()); + await input.insert({ x: 'y' }).into('a'); + + // Look for the mark + const output = knexFactory({ + client: 'mysql2', + connection: { + host, + port, + user: 'root', + password: 'pass', + database: 'backstage_plugin_0', + }, + }); + await expect(output.select('x').from('a')).resolves.toEqual([{ x: 'y' }]); + } finally { + await container.stop({ timeout: 10_000 }); + } + }, 60_000); +}); diff --git a/packages/backend-testing/src/database/TestDatabases.ts b/packages/backend-testing/src/database/TestDatabases.ts new file mode 100644 index 0000000000..927ff2632c --- /dev/null +++ b/packages/backend-testing/src/database/TestDatabases.ts @@ -0,0 +1,278 @@ +/* + * 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 { SingleConnectionDatabaseManager } from '@backstage/backend-common'; +import { ConfigReader } from '@backstage/config'; +import { Knex } from 'knex'; +import { GenericContainer, StartedTestContainer } from 'testcontainers'; +import { v4 as uuid } from 'uuid'; + +type TestDatabaseProperties = { + name: string; + driver: string; + dockerImageName?: string; + connectionStringEnvironmentVariableName?: string; +}; + +type Instance = { + container?: StartedTestContainer; + databaseManager: SingleConnectionDatabaseManager; + connections: Array; +}; + +const supportedDatabases = Object.freeze({ + POSTGRES_13: { + name: 'Postgres 13.x', + driver: 'pg', + dockerImageName: 'postgres:13', + connectionStringEnvironmentVariableName: + 'BACKSTAGE_TEST_DATABASE_POSTGRES13_CONNECTION_STRING', + }, + POSTGRES_9: { + name: 'Postgres 9.x', + driver: 'pg', + dockerImageName: 'postgres:9', + connectionStringEnvironmentVariableName: + 'BACKSTAGE_TEST_DATABASE_POSTGRES9_CONNECTION_STRING', + }, + MYSQL_8: { + name: 'MySQL 8.x', + driver: 'mysql2', + dockerImageName: 'mysql:8', + connectionStringEnvironmentVariableName: + 'BACKSTAGE_TEST_DATABASE_MYSQL8_CONNECTION_STRING', + }, + SQLITE_3: { + name: 'SQLite 3.x', + driver: 'sqlite3', + }, +} as const); + +/** + * The possible databases to test against. + */ +export type TestDatabaseId = + | 'POSTGRES_13' + | 'POSTGRES_9' + | 'MYSQL_8' + | 'SQLITE_3'; + +/** + * Encapsulates the creation of ephemeral test database instances for use + * inside unit or integration tests. + */ +export class TestDatabases { + private instanceById: Map = new Map(); + private lastDatabaseId = 0; + + /** + * Creates an empty `TestDatabases` instance, and sets up Jest to clean up + * all of its acquired resources after all tests finish. + * + * You typically want to create just a single instance like this at the top + * of your test file or `describe` block, and then call `init` many times on + * that instance inside the individual tests. Spinning up a "physical" + * database instance takes a considerable amount of time, slowing down tests. + * But initializing a new logical database inside that instance using `init` + * is very fast. + */ + static create() { + const databases = new TestDatabases(); + + afterAll(async () => { + await databases.shutdown(); + }); + + return databases; + } + + private constructor() {} + + /** + * Returns a fresh, unique, empty logical database on an instance of the + * given database ID platform. + * + * @param id The ID of the database platform to use, e.g. 'POSTGRES_13' + * @returns A `Knex` connection object + */ + async init(id: TestDatabaseId): Promise { + const properties = supportedDatabases[id]; + if (!properties) { + const candidates = Object.keys(supportedDatabases).join(', '); + throw new Error( + `Unsupported test database ${id}, possible values are ${candidates}`, + ); + } + + let instance: Instance | undefined = this.instanceById.get(id); + + // Ensure that a testcontainers instance is up for this ID + if (!instance) { + instance = await this.initAny(properties); + this.instanceById.set(id, instance); + } + + // Ensure that a unique logical database is created in the instance + const connection = await instance.databaseManager + .forPlugin(String(this.lastDatabaseId++)) + .getClient(); + + instance.connections.push(connection); + + return connection; + } + + private async initAny(properties: TestDatabaseProperties): Promise { + // Use the connection string if provided + if (properties.driver === 'pg' || properties.driver === 'mysql2') { + const envVarName = properties.connectionStringEnvironmentVariableName; + if (envVarName) { + const connectionString = process.env[envVarName]; + if (connectionString) { + const databaseManager = SingleConnectionDatabaseManager.fromConfig( + new ConfigReader({ + backend: { + database: { + client: properties.driver, + connection: connectionString, + }, + }, + }), + ); + return { + databaseManager, + connections: [], + }; + } + } + } + + // Otherwise start a container for the purpose + switch (properties.driver) { + case 'pg': + return this.initPostgres(properties); + case 'mysql2': + return this.initMysql(properties); + case 'sqlite3': + return this.initSqlite(properties); + default: + throw new Error(`Unknown database driver ${properties.driver}`); + } + } + + private async initPostgres( + properties: TestDatabaseProperties, + ): Promise { + const password = uuid(); + + const container = await new GenericContainer(properties.dockerImageName!) + .withExposedPorts(5432) + .withEnv('POSTGRES_PASSWORD', password) + .withTmpFs({ '/var/lib/postgresql/data': 'rw' }) + .start(); + + const databaseManager = SingleConnectionDatabaseManager.fromConfig( + new ConfigReader({ + backend: { + database: { + client: 'pg', + connection: { + host: container.getHost(), + port: container.getMappedPort(5432), + user: 'postgres', + password, + }, + }, + }, + }), + ); + + return { + container, + databaseManager, + connections: [], + }; + } + + private async initMysql( + properties: TestDatabaseProperties, + ): Promise { + const password = uuid(); + + const container = await new GenericContainer(properties.dockerImageName!) + .withExposedPorts(3306) + .withEnv('MYSQL_ROOT_PASSWORD', password) + .withTmpFs({ '/var/lib/mysql': 'rw' }) + .start(); + + const databaseManager = SingleConnectionDatabaseManager.fromConfig( + new ConfigReader({ + backend: { + database: { + client: 'mysql2', + connection: { + host: container.getHost(), + port: container.getMappedPort(3306), + user: 'root', + password, + }, + }, + }, + }), + ); + + return { + container, + databaseManager, + connections: [], + }; + } + + private async initSqlite( + _properties: TestDatabaseProperties, + ): Promise { + const databaseManager = SingleConnectionDatabaseManager.fromConfig( + new ConfigReader({ + backend: { + database: { + client: 'sqlite3', + connection: ':memory:', + }, + }, + }), + ); + + return { + databaseManager, + connections: [], + }; + } + + private async shutdown() { + for (const { container, connections } of this.instanceById.values()) { + try { + await Promise.all(connections.map(c => c.destroy())); + } catch { + // ignore + } + try { + await container?.stop({ timeout: 10_000 }); + } catch { + // ignore + } + } + } +} diff --git a/packages/backend-testing/src/database/index.ts b/packages/backend-testing/src/database/index.ts new file mode 100644 index 0000000000..b88ba38010 --- /dev/null +++ b/packages/backend-testing/src/database/index.ts @@ -0,0 +1,18 @@ +/* + * 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. + */ + +export { TestDatabases } from './TestDatabases'; +export type { TestDatabaseId } from './TestDatabases'; diff --git a/packages/backend-testing/src/index.ts b/packages/backend-testing/src/index.ts new file mode 100644 index 0000000000..3febc35a77 --- /dev/null +++ b/packages/backend-testing/src/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2020 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. + */ + +export * from './database'; diff --git a/packages/backend-testing/src/setupTests.ts b/packages/backend-testing/src/setupTests.ts new file mode 100644 index 0000000000..ba33cf996b --- /dev/null +++ b/packages/backend-testing/src/setupTests.ts @@ -0,0 +1,17 @@ +/* + * Copyright 2020 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. + */ + +export {}; diff --git a/plugins/catalog-backend/package.json b/plugins/catalog-backend/package.json index c8e17bb943..e6fa30882c 100644 --- a/plugins/catalog-backend/package.json +++ b/plugins/catalog-backend/package.json @@ -63,6 +63,7 @@ "yup": "^0.29.3" }, "devDependencies": { + "@backstage/backend-testing": "^0.1.0", "@backstage/cli": "^0.6.10", "@backstage/test-utils": "^0.1.9", "@types/core-js": "^2.5.4", diff --git a/plugins/catalog-backend/src/next/Stitcher.test.ts b/plugins/catalog-backend/src/next/Stitcher.test.ts index f38af384fa..e4ff41039d 100644 --- a/plugins/catalog-backend/src/next/Stitcher.test.ts +++ b/plugins/catalog-backend/src/next/Stitcher.test.ts @@ -15,7 +15,7 @@ */ import { getVoidLogger } from '@backstage/backend-common'; -import { Knex } from 'knex'; +import { TestDatabases } from '@backstage/backend-testing'; import { DatabaseManager } from './database/DatabaseManager'; import { DbRefreshStateReferencesRow, @@ -26,181 +26,200 @@ import { DbSearchRow } from './search'; import { DbFinalEntitiesRow, Stitcher } from './Stitcher'; describe('Stitcher', () => { - let db: Knex; + const databases = TestDatabases.create(); const logger = getVoidLogger(); - beforeEach(async () => { - db = await DatabaseManager.createTestDatabaseConnection(); - await DatabaseManager.createDatabase(db); - }); + it.each([ + ['POSTGRES_13'], + ['POSTGRES_9'], + ['SQLITE_3'], + // TODO(freben): mysql:8 is not ready to use yet + ] as const)( + 'runs the happy path for %p', + async databaseId => { + const db = await databases.init(databaseId); + await DatabaseManager.createDatabase(db); - it('runs the happy path', async () => { - const stitcher = new Stitcher(db, logger); + const stitcher = new Stitcher(db, logger); - await db.transaction(async tx => { - await tx('refresh_state').insert([ - { - entity_id: 'my-id', - entity_ref: 'k:ns/n', - unprocessed_entity: JSON.stringify({}), - processed_entity: JSON.stringify({ - apiVersion: 'a', - kind: 'k', - metadata: { - name: 'n', - namespace: 'ns', - }, - spec: { - k: 'v', - }, - }), - errors: '[]', - next_update_at: tx.fn.now(), - last_discovery_at: tx.fn.now(), - }, - ]); - await tx('refresh_state_references').insert([ - { source_key: 'a', target_entity_ref: 'k:ns/n' }, - ]); - await tx('relations').insert([ - { - originating_entity_id: 'my-id', - source_entity_ref: 'k:ns/n', - type: 'looksAt', - target_entity_ref: 'k:ns/other', - }, - ]); - }); - - await stitcher.stitch(new Set(['k:ns/n'])); - - let firstHash: string; - await db.transaction(async tx => { - const entities = await tx('final_entities'); - - expect(entities.length).toBe(1); - const entity = JSON.parse(entities[0].final_entity); - expect(entity).toEqual({ - relations: [ + await db.transaction(async tx => { + await tx('refresh_state').insert([ { - type: 'looksAt', - target: { + entity_id: 'my-id', + entity_ref: 'k:ns/n', + unprocessed_entity: JSON.stringify({}), + processed_entity: JSON.stringify({ + apiVersion: 'a', kind: 'k', - namespace: 'ns', - name: 'other', - }, + metadata: { + name: 'n', + namespace: 'ns', + }, + spec: { + k: 'v', + }, + }), + errors: '[]', + next_update_at: tx.fn.now(), + last_discovery_at: tx.fn.now(), }, - ], - apiVersion: 'a', - kind: 'k', - metadata: { - name: 'n', - namespace: 'ns', - etag: expect.any(String), - generation: 1, - uid: 'my-id', - }, - spec: { - k: 'v', - }, + ]); + await tx( + 'refresh_state_references', + ).insert([{ source_key: 'a', target_entity_ref: 'k:ns/n' }]); + await tx('relations').insert([ + { + originating_entity_id: 'my-id', + source_entity_ref: 'k:ns/n', + type: 'looksAt', + target_entity_ref: 'k:ns/other', + }, + ]); }); - expect(entity.metadata.etag).toEqual(entities[0].hash); - firstHash = entities[0].hash; + await stitcher.stitch(new Set(['k:ns/n'])); - const search = await tx('search'); - expect(search).toEqual( - expect.arrayContaining([ - { entity_id: 'my-id', key: 'relations.looksat', value: 'k:ns/other' }, - { entity_id: 'my-id', key: 'apiversion', value: 'a' }, - { entity_id: 'my-id', key: 'kind', value: 'k' }, - { entity_id: 'my-id', key: 'metadata.name', value: 'n' }, - { entity_id: 'my-id', key: 'metadata.namespace', value: 'ns' }, - { entity_id: 'my-id', key: 'metadata.uid', value: 'my-id' }, - { entity_id: 'my-id', key: 'spec.k', value: 'v' }, - ]), - ); - }); + let firstHash: string; + await db.transaction(async tx => { + const entities = await tx('final_entities'); - // Re-stitch without any changes - await stitcher.stitch(new Set(['k:ns/n'])); - - await db.transaction(async tx => { - const entities = await tx('final_entities'); - expect(entities.length).toBe(1); - const entity = JSON.parse(entities[0].final_entity); - expect(entities[0].hash).toEqual(firstHash); - expect(entity.metadata.etag).toEqual(firstHash); - }); - - // Now add one more relation and re-stitch - await db.transaction(async tx => { - await tx('relations').insert([ - { - originating_entity_id: 'my-id', - source_entity_ref: 'k:ns/n', - type: 'looksAt', - target_entity_ref: 'k:ns/third', - }, - ]); - }); - - await stitcher.stitch(new Set(['k:ns/n'])); - - await db.transaction(async tx => { - const entities = await tx('final_entities'); - - expect(entities.length).toBe(1); - const entity = JSON.parse(entities[0].final_entity); - expect(entity).toEqual({ - relations: expect.arrayContaining([ - { - type: 'looksAt', - target: { - kind: 'k', - namespace: 'ns', - name: 'other', + expect(entities.length).toBe(1); + const entity = JSON.parse(entities[0].final_entity); + expect(entity).toEqual({ + relations: [ + { + type: 'looksAt', + target: { + kind: 'k', + namespace: 'ns', + name: 'other', + }, }, + ], + apiVersion: 'a', + kind: 'k', + metadata: { + name: 'n', + namespace: 'ns', + etag: expect.any(String), + generation: 1, + uid: 'my-id', }, - { - type: 'looksAt', - target: { - kind: 'k', - namespace: 'ns', - name: 'third', + spec: { + k: 'v', + }, + }); + + expect(entity.metadata.etag).toEqual(entities[0].hash); + firstHash = entities[0].hash; + + const search = await tx('search'); + expect(search).toEqual( + expect.arrayContaining([ + { + entity_id: 'my-id', + key: 'relations.looksat', + value: 'k:ns/other', }, - }, - ]), - apiVersion: 'a', - kind: 'k', - metadata: { - name: 'n', - namespace: 'ns', - etag: expect.any(String), - generation: 1, - uid: 'my-id', - }, - spec: { - k: 'v', - }, + { entity_id: 'my-id', key: 'apiversion', value: 'a' }, + { entity_id: 'my-id', key: 'kind', value: 'k' }, + { entity_id: 'my-id', key: 'metadata.name', value: 'n' }, + { entity_id: 'my-id', key: 'metadata.namespace', value: 'ns' }, + { entity_id: 'my-id', key: 'metadata.uid', value: 'my-id' }, + { entity_id: 'my-id', key: 'spec.k', value: 'v' }, + ]), + ); }); - expect(entities[0].hash).not.toEqual(firstHash); - expect(entities[0].hash).toEqual(entity.metadata.etag); + // Re-stitch without any changes + await stitcher.stitch(new Set(['k:ns/n'])); - const search = await tx('search'); - expect(search).toEqual( - expect.arrayContaining([ - { entity_id: 'my-id', key: 'relations.looksat', value: 'k:ns/other' }, - { entity_id: 'my-id', key: 'relations.looksat', value: 'k:ns/third' }, - { entity_id: 'my-id', key: 'apiversion', value: 'a' }, - { entity_id: 'my-id', key: 'kind', value: 'k' }, - { entity_id: 'my-id', key: 'metadata.name', value: 'n' }, - { entity_id: 'my-id', key: 'metadata.namespace', value: 'ns' }, - { entity_id: 'my-id', key: 'metadata.uid', value: 'my-id' }, - { entity_id: 'my-id', key: 'spec.k', value: 'v' }, - ]), - ); - }); - }); + await db.transaction(async tx => { + const entities = await tx('final_entities'); + expect(entities.length).toBe(1); + const entity = JSON.parse(entities[0].final_entity); + expect(entities[0].hash).toEqual(firstHash); + expect(entity.metadata.etag).toEqual(firstHash); + }); + + // Now add one more relation and re-stitch + await db.transaction(async tx => { + await tx('relations').insert([ + { + originating_entity_id: 'my-id', + source_entity_ref: 'k:ns/n', + type: 'looksAt', + target_entity_ref: 'k:ns/third', + }, + ]); + }); + + await stitcher.stitch(new Set(['k:ns/n'])); + + await db.transaction(async tx => { + const entities = await tx('final_entities'); + + expect(entities.length).toBe(1); + const entity = JSON.parse(entities[0].final_entity); + expect(entity).toEqual({ + relations: expect.arrayContaining([ + { + type: 'looksAt', + target: { + kind: 'k', + namespace: 'ns', + name: 'other', + }, + }, + { + type: 'looksAt', + target: { + kind: 'k', + namespace: 'ns', + name: 'third', + }, + }, + ]), + apiVersion: 'a', + kind: 'k', + metadata: { + name: 'n', + namespace: 'ns', + etag: expect.any(String), + generation: 1, + uid: 'my-id', + }, + spec: { + k: 'v', + }, + }); + + expect(entities[0].hash).not.toEqual(firstHash); + expect(entities[0].hash).toEqual(entity.metadata.etag); + + const search = await tx('search'); + expect(search).toEqual( + expect.arrayContaining([ + { + entity_id: 'my-id', + key: 'relations.looksat', + value: 'k:ns/other', + }, + { + entity_id: 'my-id', + key: 'relations.looksat', + value: 'k:ns/third', + }, + { entity_id: 'my-id', key: 'apiversion', value: 'a' }, + { entity_id: 'my-id', key: 'kind', value: 'k' }, + { entity_id: 'my-id', key: 'metadata.name', value: 'n' }, + { entity_id: 'my-id', key: 'metadata.namespace', value: 'ns' }, + { entity_id: 'my-id', key: 'metadata.uid', value: 'my-id' }, + { entity_id: 'my-id', key: 'spec.k', value: 'v' }, + ]), + ); + }); + }, + 30000, + ); }); diff --git a/scripts/api-extractor.ts b/scripts/api-extractor.ts index 37dc4769fd..4fe76cb38d 100644 --- a/scripts/api-extractor.ts +++ b/scripts/api-extractor.ts @@ -62,6 +62,7 @@ PackageJsonLookup.prototype.tryGetPackageJsonFilePathFor = function tryGetPackag const DOCUMENTED_PACKAGES = [ 'packages/backend-common', + 'packages/backend-testing', 'packages/catalog-client', 'packages/catalog-model', 'packages/cli-common', diff --git a/yarn.lock b/yarn.lock index a21c6ef0f1..ae7b15a344 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6763,6 +6763,21 @@ resolved "https://registry.npmjs.org/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9" integrity sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA== +"@types/ssh2-streams@*": + version "0.1.8" + resolved "https://registry.npmjs.org/@types/ssh2-streams/-/ssh2-streams-0.1.8.tgz#142af404dae059931aea7fcd1511b5478964feb6" + integrity sha512-I7gixRPUvVIyJuCEvnmhr3KvA2dC0639kKswqD4H5b4/FOcnPtNU+qWLiXdKIqqX9twUvi5j0U1mwKE5CUsrfA== + dependencies: + "@types/node" "*" + +"@types/ssh2@^0.5.45": + version "0.5.46" + resolved "https://registry.npmjs.org/@types/ssh2/-/ssh2-0.5.46.tgz#e12341a242aea0e98ac2dec89e039bf421fd3584" + integrity sha512-1pC8FHrMPYdkLoUOwTYYifnSEPzAFZRsp3JFC/vokQ+dRrVI+hDBwz0SNmQ3pL6h39OSZlPs0uCG7wKJkftnaA== + dependencies: + "@types/node" "*" + "@types/ssh2-streams" "*" + "@types/stack-utils@^1.0.1": version "1.0.1" resolved "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" @@ -7606,7 +7621,7 @@ any-observable@^0.3.0: resolved "https://registry.npmjs.org/any-observable/-/any-observable-0.3.0.tgz#af933475e5806a67d0d7df090dd5e8bef65d119b" integrity sha512-/FQM1EDkTsf63Ub2C6O7GuYFDsSXUwsaZDurV0np41ocwq0jthUAYCmhBX9f+KwlaCgIuWyr/4WlUQUBfKfZog== -any-promise@^1.0.0: +any-promise@^1.0.0, any-promise@^1.1.0: version "1.3.0" resolved "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" integrity sha1-q8av7tzqUugJzcA3au0845Y10X8= @@ -7883,6 +7898,19 @@ archiver@^5.0.2: tar-stream "^2.1.4" zip-stream "^4.0.4" +archiver@^5.2.0: + version "5.3.0" + resolved "https://registry.npmjs.org/archiver/-/archiver-5.3.0.tgz#dd3e097624481741df626267564f7dd8640a45ba" + integrity sha512-iUw+oDwK0fgNpvveEsdQ0Ase6IIKztBJU2U0E9MzszMfmVVUyv1QJhS2ITW9ZCqx8dktAxVAjWWkKehuZE8OPg== + dependencies: + archiver-utils "^2.1.0" + async "^3.2.0" + buffer-crc32 "^0.2.1" + readable-stream "^3.6.0" + readdir-glob "^1.0.0" + tar-stream "^2.2.0" + zip-stream "^4.1.0" + are-we-there-yet@~1.1.2: version "1.1.5" resolved "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" @@ -10118,6 +10146,16 @@ compress-commons@^4.0.2: normalize-path "^3.0.0" readable-stream "^3.6.0" +compress-commons@^4.1.0: + version "4.1.0" + resolved "https://registry.npmjs.org/compress-commons/-/compress-commons-4.1.0.tgz#25ec7a4528852ccd1d441a7d4353cd0ece11371b" + integrity sha512-ofaaLqfraD1YRTkrRKPCrGJ1pFeDG/MVCkVVV2FNGeWquSlqw5wOrwOfPQ1xF2u+blpeWASie5EubHz+vsNIgA== + dependencies: + buffer-crc32 "^0.2.13" + crc32-stream "^4.0.1" + normalize-path "^3.0.0" + readable-stream "^3.6.0" + compressible@^2.0.12, compressible@~2.0.16: version "2.0.18" resolved "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz#af53cca6b070d4c3c0750fbd77286a6d7cc46fba" @@ -11675,6 +11713,13 @@ dns-txt@^2.0.2: dependencies: buffer-indexof "^1.0.0" +docker-compose@^0.23.5: + version "0.23.9" + resolved "https://registry.npmjs.org/docker-compose/-/docker-compose-0.23.9.tgz#d24343397792562f72a53eb895e76f5c7c751ee8" + integrity sha512-ucDcqBoavyQMuxPOpc8y0LqtALc5Y7h/Ga/FEiZ8m+ZqaVf3WuCh5HODtqvGO8HZMGrcH7HPyBqJ+gRJG+dBvg== + dependencies: + yaml "^1.10.2" + docker-modem@^2.1.0: version "2.1.3" resolved "https://registry.npmjs.org/docker-modem/-/docker-modem-2.1.3.tgz#15432225f63db02eb5de4bb9a621b7293e5f264d" @@ -24184,6 +24229,14 @@ sqlstring@^2.3.2: resolved "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.2.tgz#cdae7169389a1375b18e885f2e60b3e460809514" integrity sha512-vF4ZbYdKS8OnoJAWBmMxCQDkiEBkGQYU7UZPtL8flbDRSNkhaXvRJ279ZtI6M+zDaQovVU4tuRgzK5fVhvFAhg== +ssh-remote-port-forward@^1.0.3: + version "1.0.3" + resolved "https://registry.npmjs.org/ssh-remote-port-forward/-/ssh-remote-port-forward-1.0.3.tgz#074cebed6d54a42ce4659d6aa24987e433ff5fef" + integrity sha512-PJ6qGFmB6n0iMCQIp+qzx8qVUE5cgacopvEh63t3NJjEQHOaza/JT9zywmmVlaol/eGtCmpvBXx2A03ih1Y+xg== + dependencies: + "@types/ssh2" "^0.5.45" + ssh2 "^0.8.9" + ssh2-streams@~0.4.10: version "0.4.10" resolved "https://registry.npmjs.org/ssh2-streams/-/ssh2-streams-0.4.10.tgz#48ef7e8a0e39d8f2921c30521d56dacb31d23a34" @@ -24193,7 +24246,7 @@ ssh2-streams@~0.4.10: bcrypt-pbkdf "^1.0.2" streamsearch "~0.1.2" -ssh2@^0.8.7: +ssh2@^0.8.7, ssh2@^0.8.9: version "0.8.9" resolved "https://registry.npmjs.org/ssh2/-/ssh2-0.8.9.tgz#54da3a6c4ba3daf0d8477a538a481326091815f3" integrity sha512-GmoNPxWDMkVpMFa9LVVzQZHF6EW3WKmBwL+4/GeILf2hFmix5Isxm7Amamo8o7bHiU0tC+wXsGcUXOxp8ChPaw== @@ -24397,6 +24450,13 @@ stream-shift@^1.0.0: resolved "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz#d7088281559ab2778424279b0877da3c392d5a3d" integrity sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ== +stream-to-array@^2.3.0: + version "2.3.0" + resolved "https://registry.npmjs.org/stream-to-array/-/stream-to-array-2.3.0.tgz#bbf6b39f5f43ec30bc71babcb37557acecf34353" + integrity sha1-u/azn19D7DC8cbq8s3VXrOzzQ1M= + dependencies: + any-promise "^1.1.0" + stream-transform@^2.0.1: version "2.0.2" resolved "https://registry.npmjs.org/stream-transform/-/stream-transform-2.0.2.tgz#3cb7a14c802eb39bc40caaab0535e584f3a65caf" @@ -24951,7 +25011,7 @@ tapable@^1.0.0, tapable@^1.1.3: resolved "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2" integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA== -tar-fs@^2.0.0: +tar-fs@^2.0.0, tar-fs@^2.1.1: version "2.1.1" resolved "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz#489a15ab85f1f0befabb370b7de4f9eb5cbe8784" integrity sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng== @@ -24982,6 +25042,17 @@ tar-stream@^2.0.0, tar-stream@^2.1.4: inherits "^2.0.3" readable-stream "^3.1.1" +tar-stream@^2.2.0: + version "2.2.0" + resolved "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287" + integrity sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ== + dependencies: + bl "^4.0.3" + end-of-stream "^1.4.1" + fs-constants "^1.0.0" + inherits "^2.0.3" + readable-stream "^3.1.1" + tar@^2.0.0: version "2.2.2" resolved "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz#0ca8848562c7299b8b446ff6a4d60cdbb23edc40" @@ -25139,6 +25210,25 @@ test-exclude@^6.0.0: glob "^7.1.4" minimatch "^3.0.4" +testcontainers@^7.10.0: + version "7.10.0" + resolved "https://registry.npmjs.org/testcontainers/-/testcontainers-7.10.0.tgz#d0306ac9e54c24006e0de0e4505ca7d4a5a0db9e" + integrity sha512-xwz1dzRUmaYTNL4qH8//YlJzSGfVmooGtJNc0ynFm0mtUTyYu4HJLpPZB9e7+/ZiQlWp73LSTH/gSwuNtl8FXw== + dependencies: + "@types/archiver" "^5.1.0" + "@types/dockerode" "^3.2.1" + archiver "^5.2.0" + byline "^5.0.0" + debug "^4.3.1" + docker-compose "^0.23.5" + dockerode "^3.2.1" + get-port "^5.1.1" + glob "^7.1.6" + slash "^3.0.0" + ssh-remote-port-forward "^1.0.3" + stream-to-array "^2.3.0" + tar-fs "^2.1.1" + text-encoding-utf-8@^1.0.1: version "1.0.2" resolved "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz#585b62197b0ae437e3c7b5d0af27ac1021e10d13" @@ -27093,7 +27183,7 @@ yaml-ast-parser@0.0.43, yaml-ast-parser@^0.0.43: resolved "https://registry.npmjs.org/yaml-ast-parser/-/yaml-ast-parser-0.0.43.tgz#e8a23e6fb4c38076ab92995c5dca33f3d3d7c9bb" integrity sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A== -yaml@^1.10.0, yaml@^1.7.2, yaml@^1.9.2: +yaml@^1.10.0, yaml@^1.10.2, yaml@^1.7.2, yaml@^1.9.2: version "1.10.2" resolved "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== @@ -27275,6 +27365,15 @@ zip-stream@^4.0.4: compress-commons "^4.0.2" readable-stream "^3.6.0" +zip-stream@^4.1.0: + version "4.1.0" + resolved "https://registry.npmjs.org/zip-stream/-/zip-stream-4.1.0.tgz#51dd326571544e36aa3f756430b313576dc8fc79" + integrity sha512-zshzwQW7gG7hjpBlgeQP9RuyPGNxvJdzR8SUM3QhxCnLjWN2E7j3dOvpeDcQoETfHx0urRS7EtmVToql7YpU4A== + dependencies: + archiver-utils "^2.1.0" + compress-commons "^4.1.0" + readable-stream "^3.6.0" + zombie@^6.1.4: version "6.1.4" resolved "https://registry.npmjs.org/zombie/-/zombie-6.1.4.tgz#9f0f53f3d9a032beb7f3fe5b382146a3475a4d47" From ea21d46f0722a86688429540a81625d127a7d62f Mon Sep 17 00:00:00 2001 From: Samira Mokaram Date: Wed, 12 May 2021 09:56:00 +0200 Subject: [PATCH 478/485] add changeset Signed-off-by: Samira Mokaram --- .changeset/khaki-waves-dream.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/khaki-waves-dream.md diff --git a/.changeset/khaki-waves-dream.md b/.changeset/khaki-waves-dream.md new file mode 100644 index 0000000000..38254c21be --- /dev/null +++ b/.changeset/khaki-waves-dream.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-kubernetes': patch +--- + +Export types From a66c6f986c2b72bf4a03bdf7a6bc4641996b6497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 12 May 2021 10:29:16 +0200 Subject: [PATCH 479/485] Revert "Introduce `@backstage/backend-testing`, with `TestDatabases` to start off" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .changeset/wise-pens-count.md | 5 - packages/backend-testing/.eslintrc.js | 3 - packages/backend-testing/README.md | 18 - packages/backend-testing/api-report.md | 21 -- packages/backend-testing/package.json | 50 --- .../src/database/TestDatabases.test.ts | 154 -------- .../src/database/TestDatabases.ts | 278 -------------- .../backend-testing/src/database/index.ts | 18 - packages/backend-testing/src/index.ts | 17 - packages/backend-testing/src/setupTests.ts | 17 - plugins/catalog-backend/package.json | 1 - .../catalog-backend/src/next/Stitcher.test.ts | 341 +++++++++--------- scripts/api-extractor.ts | 1 - yarn.lock | 107 +----- 14 files changed, 165 insertions(+), 866 deletions(-) delete mode 100644 .changeset/wise-pens-count.md delete mode 100644 packages/backend-testing/.eslintrc.js delete mode 100644 packages/backend-testing/README.md delete mode 100644 packages/backend-testing/api-report.md delete mode 100644 packages/backend-testing/package.json delete mode 100644 packages/backend-testing/src/database/TestDatabases.test.ts delete mode 100644 packages/backend-testing/src/database/TestDatabases.ts delete mode 100644 packages/backend-testing/src/database/index.ts delete mode 100644 packages/backend-testing/src/index.ts delete mode 100644 packages/backend-testing/src/setupTests.ts diff --git a/.changeset/wise-pens-count.md b/.changeset/wise-pens-count.md deleted file mode 100644 index 26eda866bc..0000000000 --- a/.changeset/wise-pens-count.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-catalog-backend': patch ---- - -Use `TestDatabases` from `@backstage/backend-testing` diff --git a/packages/backend-testing/.eslintrc.js b/packages/backend-testing/.eslintrc.js deleted file mode 100644 index 16a033dbc6..0000000000 --- a/packages/backend-testing/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - extends: [require.resolve('@backstage/cli/config/eslint.backend')], -}; diff --git a/packages/backend-testing/README.md b/packages/backend-testing/README.md deleted file mode 100644 index f12e94ac25..0000000000 --- a/packages/backend-testing/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# @backstage/backend-testing - -Test helpers library for Backstage backends. - -## Usage - -Add the library as a `devDependency` to your backend package: - -```sh -# From the Backstage root directory, go to your backend package, or to a backend plugin -cd plugins/my-plugin-backend -yarn add --dev @backstage/backend-testing -``` - -## Documentation - -- [Backstage Readme](https://github.com/backstage/backstage/blob/master/README.md) -- [Backstage Documentation](https://github.com/backstage/backstage/blob/master/docs/README.md) diff --git a/packages/backend-testing/api-report.md b/packages/backend-testing/api-report.md deleted file mode 100644 index c4c78408ec..0000000000 --- a/packages/backend-testing/api-report.md +++ /dev/null @@ -1,21 +0,0 @@ -## API Report File for "@backstage/backend-testing" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { Knex } from 'knex'; - -// @public -export type TestDatabaseId = 'POSTGRES_13' | 'POSTGRES_9' | 'MYSQL_8' | 'SQLITE_3'; - -// @public -export class TestDatabases { - static create(): TestDatabases; - init(id: TestDatabaseId): Promise; - } - - -// (No @packageDocumentation comment for this package) - -``` diff --git a/packages/backend-testing/package.json b/packages/backend-testing/package.json deleted file mode 100644 index 345d294a6c..0000000000 --- a/packages/backend-testing/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "@backstage/backend-testing", - "description": "Test helpers library for Backstage backends", - "version": "0.1.0", - "main": "src/index.ts", - "types": "src/index.ts", - "private": false, - "publishConfig": { - "access": "public", - "main": "dist/index.cjs.js", - "types": "dist/index.d.ts" - }, - "homepage": "https://backstage.io", - "repository": { - "type": "git", - "url": "https://github.com/backstage/backstage", - "directory": "packages/backend-testing" - }, - "keywords": [ - "backstage", - "test" - ], - "license": "Apache-2.0", - "scripts": { - "build": "backstage-cli build --outputs cjs,types", - "lint": "backstage-cli lint", - "test": "backstage-cli test", - "prepack": "backstage-cli prepack", - "postpack": "backstage-cli postpack", - "clean": "backstage-cli clean" - }, - "dependencies": { - "@backstage/backend-common": "^0.7.0", - "@backstage/cli": "^0.6.10", - "@backstage/config": "^0.1.5", - "knex": "^0.95.1", - "mysql2": "^2.2.5", - "pg": "^8.3.0", - "sqlite3": "^5.0.0", - "testcontainers": "^7.10.0", - "uuid": "^8.0.0" - }, - "devDependencies": { - "@backstage/cli": "^0.6.10", - "jest": "^26.0.1" - }, - "files": [ - "dist" - ] -} diff --git a/packages/backend-testing/src/database/TestDatabases.test.ts b/packages/backend-testing/src/database/TestDatabases.test.ts deleted file mode 100644 index 61220e3090..0000000000 --- a/packages/backend-testing/src/database/TestDatabases.test.ts +++ /dev/null @@ -1,154 +0,0 @@ -/* - * 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 knexFactory from 'knex'; -import { GenericContainer } from 'testcontainers'; -import { TestDatabases } from './TestDatabases'; - -describe('TestDatabases', () => { - const OLD_ENV = process.env; - beforeEach(() => { - jest.resetModules(); - process.env = { ...OLD_ENV }; - }); - afterAll(() => { - process.env = OLD_ENV; - }); - - it.each([ - ['POSTGRES_13'], - ['POSTGRES_9'], - ['MYSQL_8'], - ['SQLITE_3'], - ] as const)( - 'creates distinct %p databases', - async databaseId => { - const dbs = TestDatabases.create(); - const db1 = await dbs.init(databaseId); - const db2 = await dbs.init(databaseId); - await db1.schema.createTable('a', table => table.string('x').primary()); - await db2.schema.createTable('a', table => table.string('y').primary()); - await expect(db1.select({ a: db1.raw('1') })).resolves.toEqual([ - { a: 1 }, - ]); - }, - 60_000, - ); - - it('obeys a provided connection string for postgres 13', async () => { - const dbs = TestDatabases.create(); - const container = await new GenericContainer('postgres:13') - .withExposedPorts(5432) - .withEnv('POSTGRES_USER', 'user') - .withEnv('POSTGRES_PASSWORD', 'pass') - .withTmpFs({ '/var/lib/postgresql/data': 'rw' }) - .start(); - const host = container.getHost(); - const port = container.getMappedPort(5432); - - try { - // Leave a mark - process.env.BACKSTAGE_TEST_DATABASE_POSTGRES13_CONNECTION_STRING = `postgresql://user:pass@${host}:${port}`; - const input = await dbs.init('POSTGRES_13'); - await input.schema.createTable('a', table => table.string('x').primary()); - await input.insert({ x: 'y' }).into('a'); - - // Look for the mark - const output = knexFactory({ - client: 'pg', - connection: { - host, - port, - user: 'user', - password: 'pass', - database: 'backstage_plugin_0', - }, - }); - await expect(output.select('x').from('a')).resolves.toEqual([{ x: 'y' }]); - } finally { - await container.stop({ timeout: 10_000 }); - } - }, 60_000); - - it('obeys a provided connection string for postgres 9', async () => { - const dbs = TestDatabases.create(); - const container = await new GenericContainer('postgres:9') - .withExposedPorts(5432) - .withEnv('POSTGRES_USER', 'user') - .withEnv('POSTGRES_PASSWORD', 'pass') - .withTmpFs({ '/var/lib/postgresql/data': 'rw' }) - .start(); - const host = container.getHost(); - const port = container.getMappedPort(5432); - - try { - // Leave a mark - process.env.BACKSTAGE_TEST_DATABASE_POSTGRES9_CONNECTION_STRING = `postgresql://user:pass@${host}:${port}`; - const input = await dbs.init('POSTGRES_9'); - await input.schema.createTable('a', table => table.string('x').primary()); - await input.insert({ x: 'y' }).into('a'); - - // Look for the mark - const output = knexFactory({ - client: 'pg', - connection: { - host, - port, - user: 'user', - password: 'pass', - database: 'backstage_plugin_0', - }, - }); - await expect(output.select('x').from('a')).resolves.toEqual([{ x: 'y' }]); - } finally { - await container.stop({ timeout: 10_000 }); - } - }, 60_000); - - it('obeys a provided connection string for mysql 8', async () => { - const dbs = TestDatabases.create(); - const container = await new GenericContainer('mysql:8') - .withExposedPorts(3306) - .withEnv('MYSQL_ROOT_PASSWORD', 'pass') - .withTmpFs({ '/var/lib/mysql': 'rw' }) - .start(); - const host = container.getHost(); - const port = container.getMappedPort(3306); - - try { - // Leave a mark - process.env.BACKSTAGE_TEST_DATABASE_MYSQL8_CONNECTION_STRING = `mysql://root:pass@${host}:${port}/ignored`; - const input = await dbs.init('MYSQL_8'); - await input.schema.createTable('a', table => table.string('x').primary()); - await input.insert({ x: 'y' }).into('a'); - - // Look for the mark - const output = knexFactory({ - client: 'mysql2', - connection: { - host, - port, - user: 'root', - password: 'pass', - database: 'backstage_plugin_0', - }, - }); - await expect(output.select('x').from('a')).resolves.toEqual([{ x: 'y' }]); - } finally { - await container.stop({ timeout: 10_000 }); - } - }, 60_000); -}); diff --git a/packages/backend-testing/src/database/TestDatabases.ts b/packages/backend-testing/src/database/TestDatabases.ts deleted file mode 100644 index 927ff2632c..0000000000 --- a/packages/backend-testing/src/database/TestDatabases.ts +++ /dev/null @@ -1,278 +0,0 @@ -/* - * 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 { SingleConnectionDatabaseManager } from '@backstage/backend-common'; -import { ConfigReader } from '@backstage/config'; -import { Knex } from 'knex'; -import { GenericContainer, StartedTestContainer } from 'testcontainers'; -import { v4 as uuid } from 'uuid'; - -type TestDatabaseProperties = { - name: string; - driver: string; - dockerImageName?: string; - connectionStringEnvironmentVariableName?: string; -}; - -type Instance = { - container?: StartedTestContainer; - databaseManager: SingleConnectionDatabaseManager; - connections: Array; -}; - -const supportedDatabases = Object.freeze({ - POSTGRES_13: { - name: 'Postgres 13.x', - driver: 'pg', - dockerImageName: 'postgres:13', - connectionStringEnvironmentVariableName: - 'BACKSTAGE_TEST_DATABASE_POSTGRES13_CONNECTION_STRING', - }, - POSTGRES_9: { - name: 'Postgres 9.x', - driver: 'pg', - dockerImageName: 'postgres:9', - connectionStringEnvironmentVariableName: - 'BACKSTAGE_TEST_DATABASE_POSTGRES9_CONNECTION_STRING', - }, - MYSQL_8: { - name: 'MySQL 8.x', - driver: 'mysql2', - dockerImageName: 'mysql:8', - connectionStringEnvironmentVariableName: - 'BACKSTAGE_TEST_DATABASE_MYSQL8_CONNECTION_STRING', - }, - SQLITE_3: { - name: 'SQLite 3.x', - driver: 'sqlite3', - }, -} as const); - -/** - * The possible databases to test against. - */ -export type TestDatabaseId = - | 'POSTGRES_13' - | 'POSTGRES_9' - | 'MYSQL_8' - | 'SQLITE_3'; - -/** - * Encapsulates the creation of ephemeral test database instances for use - * inside unit or integration tests. - */ -export class TestDatabases { - private instanceById: Map = new Map(); - private lastDatabaseId = 0; - - /** - * Creates an empty `TestDatabases` instance, and sets up Jest to clean up - * all of its acquired resources after all tests finish. - * - * You typically want to create just a single instance like this at the top - * of your test file or `describe` block, and then call `init` many times on - * that instance inside the individual tests. Spinning up a "physical" - * database instance takes a considerable amount of time, slowing down tests. - * But initializing a new logical database inside that instance using `init` - * is very fast. - */ - static create() { - const databases = new TestDatabases(); - - afterAll(async () => { - await databases.shutdown(); - }); - - return databases; - } - - private constructor() {} - - /** - * Returns a fresh, unique, empty logical database on an instance of the - * given database ID platform. - * - * @param id The ID of the database platform to use, e.g. 'POSTGRES_13' - * @returns A `Knex` connection object - */ - async init(id: TestDatabaseId): Promise { - const properties = supportedDatabases[id]; - if (!properties) { - const candidates = Object.keys(supportedDatabases).join(', '); - throw new Error( - `Unsupported test database ${id}, possible values are ${candidates}`, - ); - } - - let instance: Instance | undefined = this.instanceById.get(id); - - // Ensure that a testcontainers instance is up for this ID - if (!instance) { - instance = await this.initAny(properties); - this.instanceById.set(id, instance); - } - - // Ensure that a unique logical database is created in the instance - const connection = await instance.databaseManager - .forPlugin(String(this.lastDatabaseId++)) - .getClient(); - - instance.connections.push(connection); - - return connection; - } - - private async initAny(properties: TestDatabaseProperties): Promise { - // Use the connection string if provided - if (properties.driver === 'pg' || properties.driver === 'mysql2') { - const envVarName = properties.connectionStringEnvironmentVariableName; - if (envVarName) { - const connectionString = process.env[envVarName]; - if (connectionString) { - const databaseManager = SingleConnectionDatabaseManager.fromConfig( - new ConfigReader({ - backend: { - database: { - client: properties.driver, - connection: connectionString, - }, - }, - }), - ); - return { - databaseManager, - connections: [], - }; - } - } - } - - // Otherwise start a container for the purpose - switch (properties.driver) { - case 'pg': - return this.initPostgres(properties); - case 'mysql2': - return this.initMysql(properties); - case 'sqlite3': - return this.initSqlite(properties); - default: - throw new Error(`Unknown database driver ${properties.driver}`); - } - } - - private async initPostgres( - properties: TestDatabaseProperties, - ): Promise { - const password = uuid(); - - const container = await new GenericContainer(properties.dockerImageName!) - .withExposedPorts(5432) - .withEnv('POSTGRES_PASSWORD', password) - .withTmpFs({ '/var/lib/postgresql/data': 'rw' }) - .start(); - - const databaseManager = SingleConnectionDatabaseManager.fromConfig( - new ConfigReader({ - backend: { - database: { - client: 'pg', - connection: { - host: container.getHost(), - port: container.getMappedPort(5432), - user: 'postgres', - password, - }, - }, - }, - }), - ); - - return { - container, - databaseManager, - connections: [], - }; - } - - private async initMysql( - properties: TestDatabaseProperties, - ): Promise { - const password = uuid(); - - const container = await new GenericContainer(properties.dockerImageName!) - .withExposedPorts(3306) - .withEnv('MYSQL_ROOT_PASSWORD', password) - .withTmpFs({ '/var/lib/mysql': 'rw' }) - .start(); - - const databaseManager = SingleConnectionDatabaseManager.fromConfig( - new ConfigReader({ - backend: { - database: { - client: 'mysql2', - connection: { - host: container.getHost(), - port: container.getMappedPort(3306), - user: 'root', - password, - }, - }, - }, - }), - ); - - return { - container, - databaseManager, - connections: [], - }; - } - - private async initSqlite( - _properties: TestDatabaseProperties, - ): Promise { - const databaseManager = SingleConnectionDatabaseManager.fromConfig( - new ConfigReader({ - backend: { - database: { - client: 'sqlite3', - connection: ':memory:', - }, - }, - }), - ); - - return { - databaseManager, - connections: [], - }; - } - - private async shutdown() { - for (const { container, connections } of this.instanceById.values()) { - try { - await Promise.all(connections.map(c => c.destroy())); - } catch { - // ignore - } - try { - await container?.stop({ timeout: 10_000 }); - } catch { - // ignore - } - } - } -} diff --git a/packages/backend-testing/src/database/index.ts b/packages/backend-testing/src/database/index.ts deleted file mode 100644 index b88ba38010..0000000000 --- a/packages/backend-testing/src/database/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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. - */ - -export { TestDatabases } from './TestDatabases'; -export type { TestDatabaseId } from './TestDatabases'; diff --git a/packages/backend-testing/src/index.ts b/packages/backend-testing/src/index.ts deleted file mode 100644 index 3febc35a77..0000000000 --- a/packages/backend-testing/src/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2020 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. - */ - -export * from './database'; diff --git a/packages/backend-testing/src/setupTests.ts b/packages/backend-testing/src/setupTests.ts deleted file mode 100644 index ba33cf996b..0000000000 --- a/packages/backend-testing/src/setupTests.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2020 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. - */ - -export {}; diff --git a/plugins/catalog-backend/package.json b/plugins/catalog-backend/package.json index e6fa30882c..c8e17bb943 100644 --- a/plugins/catalog-backend/package.json +++ b/plugins/catalog-backend/package.json @@ -63,7 +63,6 @@ "yup": "^0.29.3" }, "devDependencies": { - "@backstage/backend-testing": "^0.1.0", "@backstage/cli": "^0.6.10", "@backstage/test-utils": "^0.1.9", "@types/core-js": "^2.5.4", diff --git a/plugins/catalog-backend/src/next/Stitcher.test.ts b/plugins/catalog-backend/src/next/Stitcher.test.ts index e4ff41039d..f38af384fa 100644 --- a/plugins/catalog-backend/src/next/Stitcher.test.ts +++ b/plugins/catalog-backend/src/next/Stitcher.test.ts @@ -15,7 +15,7 @@ */ import { getVoidLogger } from '@backstage/backend-common'; -import { TestDatabases } from '@backstage/backend-testing'; +import { Knex } from 'knex'; import { DatabaseManager } from './database/DatabaseManager'; import { DbRefreshStateReferencesRow, @@ -26,200 +26,181 @@ import { DbSearchRow } from './search'; import { DbFinalEntitiesRow, Stitcher } from './Stitcher'; describe('Stitcher', () => { - const databases = TestDatabases.create(); + let db: Knex; const logger = getVoidLogger(); - it.each([ - ['POSTGRES_13'], - ['POSTGRES_9'], - ['SQLITE_3'], - // TODO(freben): mysql:8 is not ready to use yet - ] as const)( - 'runs the happy path for %p', - async databaseId => { - const db = await databases.init(databaseId); - await DatabaseManager.createDatabase(db); + beforeEach(async () => { + db = await DatabaseManager.createTestDatabaseConnection(); + await DatabaseManager.createDatabase(db); + }); - const stitcher = new Stitcher(db, logger); + it('runs the happy path', async () => { + const stitcher = new Stitcher(db, logger); - await db.transaction(async tx => { - await tx('refresh_state').insert([ + await db.transaction(async tx => { + await tx('refresh_state').insert([ + { + entity_id: 'my-id', + entity_ref: 'k:ns/n', + unprocessed_entity: JSON.stringify({}), + processed_entity: JSON.stringify({ + apiVersion: 'a', + kind: 'k', + metadata: { + name: 'n', + namespace: 'ns', + }, + spec: { + k: 'v', + }, + }), + errors: '[]', + next_update_at: tx.fn.now(), + last_discovery_at: tx.fn.now(), + }, + ]); + await tx('refresh_state_references').insert([ + { source_key: 'a', target_entity_ref: 'k:ns/n' }, + ]); + await tx('relations').insert([ + { + originating_entity_id: 'my-id', + source_entity_ref: 'k:ns/n', + type: 'looksAt', + target_entity_ref: 'k:ns/other', + }, + ]); + }); + + await stitcher.stitch(new Set(['k:ns/n'])); + + let firstHash: string; + await db.transaction(async tx => { + const entities = await tx('final_entities'); + + expect(entities.length).toBe(1); + const entity = JSON.parse(entities[0].final_entity); + expect(entity).toEqual({ + relations: [ { - entity_id: 'my-id', - entity_ref: 'k:ns/n', - unprocessed_entity: JSON.stringify({}), - processed_entity: JSON.stringify({ - apiVersion: 'a', + type: 'looksAt', + target: { kind: 'k', - metadata: { - name: 'n', - namespace: 'ns', - }, - spec: { - k: 'v', - }, - }), - errors: '[]', - next_update_at: tx.fn.now(), - last_discovery_at: tx.fn.now(), + namespace: 'ns', + name: 'other', + }, }, - ]); - await tx( - 'refresh_state_references', - ).insert([{ source_key: 'a', target_entity_ref: 'k:ns/n' }]); - await tx('relations').insert([ + ], + apiVersion: 'a', + kind: 'k', + metadata: { + name: 'n', + namespace: 'ns', + etag: expect.any(String), + generation: 1, + uid: 'my-id', + }, + spec: { + k: 'v', + }, + }); + + expect(entity.metadata.etag).toEqual(entities[0].hash); + firstHash = entities[0].hash; + + const search = await tx('search'); + expect(search).toEqual( + expect.arrayContaining([ + { entity_id: 'my-id', key: 'relations.looksat', value: 'k:ns/other' }, + { entity_id: 'my-id', key: 'apiversion', value: 'a' }, + { entity_id: 'my-id', key: 'kind', value: 'k' }, + { entity_id: 'my-id', key: 'metadata.name', value: 'n' }, + { entity_id: 'my-id', key: 'metadata.namespace', value: 'ns' }, + { entity_id: 'my-id', key: 'metadata.uid', value: 'my-id' }, + { entity_id: 'my-id', key: 'spec.k', value: 'v' }, + ]), + ); + }); + + // Re-stitch without any changes + await stitcher.stitch(new Set(['k:ns/n'])); + + await db.transaction(async tx => { + const entities = await tx('final_entities'); + expect(entities.length).toBe(1); + const entity = JSON.parse(entities[0].final_entity); + expect(entities[0].hash).toEqual(firstHash); + expect(entity.metadata.etag).toEqual(firstHash); + }); + + // Now add one more relation and re-stitch + await db.transaction(async tx => { + await tx('relations').insert([ + { + originating_entity_id: 'my-id', + source_entity_ref: 'k:ns/n', + type: 'looksAt', + target_entity_ref: 'k:ns/third', + }, + ]); + }); + + await stitcher.stitch(new Set(['k:ns/n'])); + + await db.transaction(async tx => { + const entities = await tx('final_entities'); + + expect(entities.length).toBe(1); + const entity = JSON.parse(entities[0].final_entity); + expect(entity).toEqual({ + relations: expect.arrayContaining([ { - originating_entity_id: 'my-id', - source_entity_ref: 'k:ns/n', type: 'looksAt', - target_entity_ref: 'k:ns/other', - }, - ]); - }); - - await stitcher.stitch(new Set(['k:ns/n'])); - - let firstHash: string; - await db.transaction(async tx => { - const entities = await tx('final_entities'); - - expect(entities.length).toBe(1); - const entity = JSON.parse(entities[0].final_entity); - expect(entity).toEqual({ - relations: [ - { - type: 'looksAt', - target: { - kind: 'k', - namespace: 'ns', - name: 'other', - }, + target: { + kind: 'k', + namespace: 'ns', + name: 'other', }, - ], - apiVersion: 'a', - kind: 'k', - metadata: { - name: 'n', - namespace: 'ns', - etag: expect.any(String), - generation: 1, - uid: 'my-id', }, - spec: { - k: 'v', - }, - }); - - expect(entity.metadata.etag).toEqual(entities[0].hash); - firstHash = entities[0].hash; - - const search = await tx('search'); - expect(search).toEqual( - expect.arrayContaining([ - { - entity_id: 'my-id', - key: 'relations.looksat', - value: 'k:ns/other', - }, - { entity_id: 'my-id', key: 'apiversion', value: 'a' }, - { entity_id: 'my-id', key: 'kind', value: 'k' }, - { entity_id: 'my-id', key: 'metadata.name', value: 'n' }, - { entity_id: 'my-id', key: 'metadata.namespace', value: 'ns' }, - { entity_id: 'my-id', key: 'metadata.uid', value: 'my-id' }, - { entity_id: 'my-id', key: 'spec.k', value: 'v' }, - ]), - ); - }); - - // Re-stitch without any changes - await stitcher.stitch(new Set(['k:ns/n'])); - - await db.transaction(async tx => { - const entities = await tx('final_entities'); - expect(entities.length).toBe(1); - const entity = JSON.parse(entities[0].final_entity); - expect(entities[0].hash).toEqual(firstHash); - expect(entity.metadata.etag).toEqual(firstHash); - }); - - // Now add one more relation and re-stitch - await db.transaction(async tx => { - await tx('relations').insert([ { - originating_entity_id: 'my-id', - source_entity_ref: 'k:ns/n', type: 'looksAt', - target_entity_ref: 'k:ns/third', + target: { + kind: 'k', + namespace: 'ns', + name: 'third', + }, }, - ]); + ]), + apiVersion: 'a', + kind: 'k', + metadata: { + name: 'n', + namespace: 'ns', + etag: expect.any(String), + generation: 1, + uid: 'my-id', + }, + spec: { + k: 'v', + }, }); - await stitcher.stitch(new Set(['k:ns/n'])); + expect(entities[0].hash).not.toEqual(firstHash); + expect(entities[0].hash).toEqual(entity.metadata.etag); - await db.transaction(async tx => { - const entities = await tx('final_entities'); - - expect(entities.length).toBe(1); - const entity = JSON.parse(entities[0].final_entity); - expect(entity).toEqual({ - relations: expect.arrayContaining([ - { - type: 'looksAt', - target: { - kind: 'k', - namespace: 'ns', - name: 'other', - }, - }, - { - type: 'looksAt', - target: { - kind: 'k', - namespace: 'ns', - name: 'third', - }, - }, - ]), - apiVersion: 'a', - kind: 'k', - metadata: { - name: 'n', - namespace: 'ns', - etag: expect.any(String), - generation: 1, - uid: 'my-id', - }, - spec: { - k: 'v', - }, - }); - - expect(entities[0].hash).not.toEqual(firstHash); - expect(entities[0].hash).toEqual(entity.metadata.etag); - - const search = await tx('search'); - expect(search).toEqual( - expect.arrayContaining([ - { - entity_id: 'my-id', - key: 'relations.looksat', - value: 'k:ns/other', - }, - { - entity_id: 'my-id', - key: 'relations.looksat', - value: 'k:ns/third', - }, - { entity_id: 'my-id', key: 'apiversion', value: 'a' }, - { entity_id: 'my-id', key: 'kind', value: 'k' }, - { entity_id: 'my-id', key: 'metadata.name', value: 'n' }, - { entity_id: 'my-id', key: 'metadata.namespace', value: 'ns' }, - { entity_id: 'my-id', key: 'metadata.uid', value: 'my-id' }, - { entity_id: 'my-id', key: 'spec.k', value: 'v' }, - ]), - ); - }); - }, - 30000, - ); + const search = await tx('search'); + expect(search).toEqual( + expect.arrayContaining([ + { entity_id: 'my-id', key: 'relations.looksat', value: 'k:ns/other' }, + { entity_id: 'my-id', key: 'relations.looksat', value: 'k:ns/third' }, + { entity_id: 'my-id', key: 'apiversion', value: 'a' }, + { entity_id: 'my-id', key: 'kind', value: 'k' }, + { entity_id: 'my-id', key: 'metadata.name', value: 'n' }, + { entity_id: 'my-id', key: 'metadata.namespace', value: 'ns' }, + { entity_id: 'my-id', key: 'metadata.uid', value: 'my-id' }, + { entity_id: 'my-id', key: 'spec.k', value: 'v' }, + ]), + ); + }); + }); }); diff --git a/scripts/api-extractor.ts b/scripts/api-extractor.ts index 4fe76cb38d..37dc4769fd 100644 --- a/scripts/api-extractor.ts +++ b/scripts/api-extractor.ts @@ -62,7 +62,6 @@ PackageJsonLookup.prototype.tryGetPackageJsonFilePathFor = function tryGetPackag const DOCUMENTED_PACKAGES = [ 'packages/backend-common', - 'packages/backend-testing', 'packages/catalog-client', 'packages/catalog-model', 'packages/cli-common', diff --git a/yarn.lock b/yarn.lock index 366a903446..330463a73a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6763,21 +6763,6 @@ resolved "https://registry.npmjs.org/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9" integrity sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA== -"@types/ssh2-streams@*": - version "0.1.8" - resolved "https://registry.npmjs.org/@types/ssh2-streams/-/ssh2-streams-0.1.8.tgz#142af404dae059931aea7fcd1511b5478964feb6" - integrity sha512-I7gixRPUvVIyJuCEvnmhr3KvA2dC0639kKswqD4H5b4/FOcnPtNU+qWLiXdKIqqX9twUvi5j0U1mwKE5CUsrfA== - dependencies: - "@types/node" "*" - -"@types/ssh2@^0.5.45": - version "0.5.46" - resolved "https://registry.npmjs.org/@types/ssh2/-/ssh2-0.5.46.tgz#e12341a242aea0e98ac2dec89e039bf421fd3584" - integrity sha512-1pC8FHrMPYdkLoUOwTYYifnSEPzAFZRsp3JFC/vokQ+dRrVI+hDBwz0SNmQ3pL6h39OSZlPs0uCG7wKJkftnaA== - dependencies: - "@types/node" "*" - "@types/ssh2-streams" "*" - "@types/stack-utils@^1.0.1": version "1.0.1" resolved "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" @@ -7621,7 +7606,7 @@ any-observable@^0.3.0: resolved "https://registry.npmjs.org/any-observable/-/any-observable-0.3.0.tgz#af933475e5806a67d0d7df090dd5e8bef65d119b" integrity sha512-/FQM1EDkTsf63Ub2C6O7GuYFDsSXUwsaZDurV0np41ocwq0jthUAYCmhBX9f+KwlaCgIuWyr/4WlUQUBfKfZog== -any-promise@^1.0.0, any-promise@^1.1.0: +any-promise@^1.0.0: version "1.3.0" resolved "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" integrity sha1-q8av7tzqUugJzcA3au0845Y10X8= @@ -7898,19 +7883,6 @@ archiver@^5.0.2: tar-stream "^2.1.4" zip-stream "^4.0.4" -archiver@^5.2.0: - version "5.3.0" - resolved "https://registry.npmjs.org/archiver/-/archiver-5.3.0.tgz#dd3e097624481741df626267564f7dd8640a45ba" - integrity sha512-iUw+oDwK0fgNpvveEsdQ0Ase6IIKztBJU2U0E9MzszMfmVVUyv1QJhS2ITW9ZCqx8dktAxVAjWWkKehuZE8OPg== - dependencies: - archiver-utils "^2.1.0" - async "^3.2.0" - buffer-crc32 "^0.2.1" - readable-stream "^3.6.0" - readdir-glob "^1.0.0" - tar-stream "^2.2.0" - zip-stream "^4.1.0" - are-we-there-yet@~1.1.2: version "1.1.5" resolved "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" @@ -10146,16 +10118,6 @@ compress-commons@^4.0.2: normalize-path "^3.0.0" readable-stream "^3.6.0" -compress-commons@^4.1.0: - version "4.1.0" - resolved "https://registry.npmjs.org/compress-commons/-/compress-commons-4.1.0.tgz#25ec7a4528852ccd1d441a7d4353cd0ece11371b" - integrity sha512-ofaaLqfraD1YRTkrRKPCrGJ1pFeDG/MVCkVVV2FNGeWquSlqw5wOrwOfPQ1xF2u+blpeWASie5EubHz+vsNIgA== - dependencies: - buffer-crc32 "^0.2.13" - crc32-stream "^4.0.1" - normalize-path "^3.0.0" - readable-stream "^3.6.0" - compressible@^2.0.12, compressible@~2.0.16: version "2.0.18" resolved "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz#af53cca6b070d4c3c0750fbd77286a6d7cc46fba" @@ -11720,13 +11682,6 @@ dns-txt@^2.0.2: dependencies: buffer-indexof "^1.0.0" -docker-compose@^0.23.5: - version "0.23.9" - resolved "https://registry.npmjs.org/docker-compose/-/docker-compose-0.23.9.tgz#d24343397792562f72a53eb895e76f5c7c751ee8" - integrity sha512-ucDcqBoavyQMuxPOpc8y0LqtALc5Y7h/Ga/FEiZ8m+ZqaVf3WuCh5HODtqvGO8HZMGrcH7HPyBqJ+gRJG+dBvg== - dependencies: - yaml "^1.10.2" - docker-modem@^2.1.0: version "2.1.3" resolved "https://registry.npmjs.org/docker-modem/-/docker-modem-2.1.3.tgz#15432225f63db02eb5de4bb9a621b7293e5f264d" @@ -24258,14 +24213,6 @@ sqlstring@^2.3.2: resolved "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.2.tgz#cdae7169389a1375b18e885f2e60b3e460809514" integrity sha512-vF4ZbYdKS8OnoJAWBmMxCQDkiEBkGQYU7UZPtL8flbDRSNkhaXvRJ279ZtI6M+zDaQovVU4tuRgzK5fVhvFAhg== -ssh-remote-port-forward@^1.0.3: - version "1.0.3" - resolved "https://registry.npmjs.org/ssh-remote-port-forward/-/ssh-remote-port-forward-1.0.3.tgz#074cebed6d54a42ce4659d6aa24987e433ff5fef" - integrity sha512-PJ6qGFmB6n0iMCQIp+qzx8qVUE5cgacopvEh63t3NJjEQHOaza/JT9zywmmVlaol/eGtCmpvBXx2A03ih1Y+xg== - dependencies: - "@types/ssh2" "^0.5.45" - ssh2 "^0.8.9" - ssh2-streams@~0.4.10: version "0.4.10" resolved "https://registry.npmjs.org/ssh2-streams/-/ssh2-streams-0.4.10.tgz#48ef7e8a0e39d8f2921c30521d56dacb31d23a34" @@ -24275,7 +24222,7 @@ ssh2-streams@~0.4.10: bcrypt-pbkdf "^1.0.2" streamsearch "~0.1.2" -ssh2@^0.8.7, ssh2@^0.8.9: +ssh2@^0.8.7: version "0.8.9" resolved "https://registry.npmjs.org/ssh2/-/ssh2-0.8.9.tgz#54da3a6c4ba3daf0d8477a538a481326091815f3" integrity sha512-GmoNPxWDMkVpMFa9LVVzQZHF6EW3WKmBwL+4/GeILf2hFmix5Isxm7Amamo8o7bHiU0tC+wXsGcUXOxp8ChPaw== @@ -24479,13 +24426,6 @@ stream-shift@^1.0.0: resolved "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz#d7088281559ab2778424279b0877da3c392d5a3d" integrity sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ== -stream-to-array@^2.3.0: - version "2.3.0" - resolved "https://registry.npmjs.org/stream-to-array/-/stream-to-array-2.3.0.tgz#bbf6b39f5f43ec30bc71babcb37557acecf34353" - integrity sha1-u/azn19D7DC8cbq8s3VXrOzzQ1M= - dependencies: - any-promise "^1.1.0" - stream-transform@^2.0.1: version "2.0.2" resolved "https://registry.npmjs.org/stream-transform/-/stream-transform-2.0.2.tgz#3cb7a14c802eb39bc40caaab0535e584f3a65caf" @@ -25040,7 +24980,7 @@ tapable@^1.0.0, tapable@^1.1.3: resolved "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2" integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA== -tar-fs@^2.0.0, tar-fs@^2.1.1: +tar-fs@^2.0.0: version "2.1.1" resolved "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz#489a15ab85f1f0befabb370b7de4f9eb5cbe8784" integrity sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng== @@ -25071,17 +25011,6 @@ tar-stream@^2.0.0, tar-stream@^2.1.4: inherits "^2.0.3" readable-stream "^3.1.1" -tar-stream@^2.2.0: - version "2.2.0" - resolved "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287" - integrity sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ== - dependencies: - bl "^4.0.3" - end-of-stream "^1.4.1" - fs-constants "^1.0.0" - inherits "^2.0.3" - readable-stream "^3.1.1" - tar@^2.0.0: version "2.2.2" resolved "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz#0ca8848562c7299b8b446ff6a4d60cdbb23edc40" @@ -25239,25 +25168,6 @@ test-exclude@^6.0.0: glob "^7.1.4" minimatch "^3.0.4" -testcontainers@^7.10.0: - version "7.10.0" - resolved "https://registry.npmjs.org/testcontainers/-/testcontainers-7.10.0.tgz#d0306ac9e54c24006e0de0e4505ca7d4a5a0db9e" - integrity sha512-xwz1dzRUmaYTNL4qH8//YlJzSGfVmooGtJNc0ynFm0mtUTyYu4HJLpPZB9e7+/ZiQlWp73LSTH/gSwuNtl8FXw== - dependencies: - "@types/archiver" "^5.1.0" - "@types/dockerode" "^3.2.1" - archiver "^5.2.0" - byline "^5.0.0" - debug "^4.3.1" - docker-compose "^0.23.5" - dockerode "^3.2.1" - get-port "^5.1.1" - glob "^7.1.6" - slash "^3.0.0" - ssh-remote-port-forward "^1.0.3" - stream-to-array "^2.3.0" - tar-fs "^2.1.1" - text-encoding-utf-8@^1.0.1: version "1.0.2" resolved "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz#585b62197b0ae437e3c7b5d0af27ac1021e10d13" @@ -27212,7 +27122,7 @@ yaml-ast-parser@0.0.43, yaml-ast-parser@^0.0.43: resolved "https://registry.npmjs.org/yaml-ast-parser/-/yaml-ast-parser-0.0.43.tgz#e8a23e6fb4c38076ab92995c5dca33f3d3d7c9bb" integrity sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A== -yaml@^1.10.0, yaml@^1.10.2, yaml@^1.7.2, yaml@^1.9.2: +yaml@^1.10.0, yaml@^1.7.2, yaml@^1.9.2: version "1.10.2" resolved "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== @@ -27394,15 +27304,6 @@ zip-stream@^4.0.4: compress-commons "^4.0.2" readable-stream "^3.6.0" -zip-stream@^4.1.0: - version "4.1.0" - resolved "https://registry.npmjs.org/zip-stream/-/zip-stream-4.1.0.tgz#51dd326571544e36aa3f756430b313576dc8fc79" - integrity sha512-zshzwQW7gG7hjpBlgeQP9RuyPGNxvJdzR8SUM3QhxCnLjWN2E7j3dOvpeDcQoETfHx0urRS7EtmVToql7YpU4A== - dependencies: - archiver-utils "^2.1.0" - compress-commons "^4.1.0" - readable-stream "^3.6.0" - zombie@^6.1.4: version "6.1.4" resolved "https://registry.npmjs.org/zombie/-/zombie-6.1.4.tgz#9f0f53f3d9a032beb7f3fe5b382146a3475a4d47" From aee7212366ade4b8fb6371e2ff3de30706906b36 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 12 May 2021 10:54:54 +0200 Subject: [PATCH 480/485] Updating changelogs Signed-off-by: blam --- packages/create-app/CHANGELOG.md | 3 --- plugins/scaffolder-backend/CHANGELOG.md | 1 - 2 files changed, 4 deletions(-) diff --git a/packages/create-app/CHANGELOG.md b/packages/create-app/CHANGELOG.md index 8c3dc14245..f714e44fa7 100644 --- a/packages/create-app/CHANGELOG.md +++ b/packages/create-app/CHANGELOG.md @@ -15,8 +15,6 @@ + import { DockerContainerRunner } from '@backstage/backend-common'; - // ... - export default async function createPlugin({ logger, config, @@ -76,7 +74,6 @@ + SingleHostDiscovery, + } from '@backstage/backend-common'; - export default async function createPlugin({ logger, config, diff --git a/plugins/scaffolder-backend/CHANGELOG.md b/plugins/scaffolder-backend/CHANGELOG.md index b4aa856606..987109e62f 100644 --- a/plugins/scaffolder-backend/CHANGELOG.md +++ b/plugins/scaffolder-backend/CHANGELOG.md @@ -16,7 +16,6 @@ + SingleHostDiscovery, + } from '@backstage/backend-common'; - export default async function createPlugin({ logger, config, From e7e9e93f5730ccbda905d388b382f3a7fe16c1a6 Mon Sep 17 00:00:00 2001 From: Andrew Johnson <57673895+anderoo@users.noreply.github.com> Date: Wed, 12 May 2021 09:41:25 +0100 Subject: [PATCH 481/485] Update GithubDeploymentsCard.tsx Signed-off-by: anderoo --- .../src/components/GithubDeploymentsCard.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx b/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx index b7f2e7b1ba..4cb01f04a8 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx +++ b/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx @@ -73,10 +73,8 @@ export const GithubDeploymentsCard = ({ columns?: TableColumn[]; }) => { const { entity } = useEntity(); - const host: string | undefined = [ - entity?.metadata.annotations?.[SOURCE_LOCATION_ANNOTATION], - entity?.metadata.annotations?.[LOCATION_ANNOTATION], - ].filter(Boolean)[0]; + const [host] = [entity?.metadata.annotations?.[SOURCE_LOCATION_ANNOTATION], + entity?.metadata.annotations?.[LOCATION_ANNOTATION]].filter(Boolean); return !isGithubDeploymentsAvailable(entity) ? ( From d8e24a7ae30f5a7bf1d9b7aa3b50cb78d490302b Mon Sep 17 00:00:00 2001 From: Andrew Johnson <57673895+anderoo@users.noreply.github.com> Date: Wed, 12 May 2021 09:46:29 +0100 Subject: [PATCH 482/485] Update GithubDeploymentsCard.test.tsx Signed-off-by: anderoo --- .../components/GithubDeploymentsCard.test.tsx | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx b/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx index 5914e4b422..4af0c0096e 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx +++ b/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx @@ -336,7 +336,31 @@ describe('github-deployments', () => { }); }); - describe('entity with non url location', () => { + describe('entity with url location type', () => { + beforeEach(() => { + entity = entityStub; + entity.entity.metadata.annotations = { + 'github.com/project-slug': 'org/repo', + 'backstage.io/source-location': + 'url:my-favourite-url-location/org/repo', + 'backstage.io/managed-by-location': + 'url:my-favourite-url-location/org/repo', + }; + }); + + it('displays fetched data using default github api', async () => { + worker.use( + GRAPHQL_GITHUB_API.query('deployments', (_, res, ctx) => + res(ctx.data(responseStub)), + ), + ); + + await assertFetchedData(); + expect.assertions(7); + }); + }); + + describe('entity with other location types', () => { beforeEach(() => { entity = entityStub; entity.entity.metadata.annotations = { From b23260677a7000355bfc849a5c2781554713e947 Mon Sep 17 00:00:00 2001 From: anderoo Date: Wed, 12 May 2021 10:09:56 +0100 Subject: [PATCH 483/485] prettier Signed-off-by: anderoo --- .../src/components/GithubDeploymentsCard.test.tsx | 2 +- .../src/components/GithubDeploymentsCard.tsx | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx b/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx index 4af0c0096e..bec60c47bc 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx +++ b/plugins/github-deployments/src/components/GithubDeploymentsCard.test.tsx @@ -359,7 +359,7 @@ describe('github-deployments', () => { expect.assertions(7); }); }); - + describe('entity with other location types', () => { beforeEach(() => { entity = entityStub; diff --git a/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx b/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx index 4cb01f04a8..a13c205084 100644 --- a/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx +++ b/plugins/github-deployments/src/components/GithubDeploymentsCard.tsx @@ -73,8 +73,10 @@ export const GithubDeploymentsCard = ({ columns?: TableColumn[]; }) => { const { entity } = useEntity(); - const [host] = [entity?.metadata.annotations?.[SOURCE_LOCATION_ANNOTATION], - entity?.metadata.annotations?.[LOCATION_ANNOTATION]].filter(Boolean); + const [host] = [ + entity?.metadata.annotations?.[SOURCE_LOCATION_ANNOTATION], + entity?.metadata.annotations?.[LOCATION_ANNOTATION], + ].filter(Boolean); return !isGithubDeploymentsAvailable(entity) ? ( From df31bdca8f71664190d3ff285dc8c72698866dab Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 12 May 2021 09:39:51 +0000 Subject: [PATCH 484/485] Version Packages --- .changeset/afraid-waves-remember.md | 49 --------------- .changeset/beige-cheetahs-jog.md | 5 -- .changeset/breezy-carrots-hunt.md | 5 -- .changeset/calm-insects-melt.md | 7 --- .changeset/clean-starfishes-drop.md | 5 -- .changeset/cool-cache-bro.md | 52 ---------------- .changeset/cyan-beans-marry.md | 5 -- .changeset/forty-pumpkins-agree.md | 5 -- .changeset/grumpy-goats-refuse.md | 5 -- .changeset/khaki-waves-dream.md | 5 -- .changeset/mighty-poets-cheer.md | 5 -- .changeset/ninety-pots-guess.md | 5 -- .changeset/polite-plants-exercise.md | 14 ----- .changeset/shaggy-drinks-hammer.md | 5 -- .changeset/short-bobcats-mate.md | 7 --- .changeset/smart-sheep-itch.md | 5 -- .changeset/smooth-vans-travel.md | 5 -- .changeset/sour-kids-compete.md | 5 -- .changeset/stale-gifts-push.md | 5 -- .changeset/techdocs-spaces-in-objects.md | 5 -- .changeset/ten-paws-ring.md | 44 -------------- .changeset/wild-moles-care.md | 5 -- packages/app/CHANGELOG.md | 52 ++++++++++++++++ packages/app/package.json | 70 +++++++++++----------- packages/backend-common/CHANGELOG.md | 57 ++++++++++++++++++ packages/backend-common/package.json | 6 +- packages/backend/CHANGELOG.md | 31 ++++++++++ packages/backend/package.json | 38 ++++++------ packages/catalog-model/CHANGELOG.md | 7 +++ packages/catalog-model/package.json | 4 +- packages/cli/CHANGELOG.md | 8 +++ packages/cli/package.json | 10 ++-- packages/core-api/CHANGELOG.md | 7 +++ packages/core-api/package.json | 6 +- packages/core/CHANGELOG.md | 13 ++++ packages/core/package.json | 8 +-- packages/create-app/CHANGELOG.md | 47 +++++++++++++++ packages/create-app/package.json | 2 +- packages/dev-utils/CHANGELOG.md | 17 ++++++ packages/dev-utils/package.json | 14 ++--- packages/integration-react/CHANGELOG.md | 13 ++++ packages/integration-react/package.json | 10 ++-- packages/techdocs-common/CHANGELOG.md | 12 ++++ packages/techdocs-common/package.json | 8 +-- packages/test-utils/CHANGELOG.md | 9 +++ packages/test-utils/package.json | 6 +- plugins/api-docs/CHANGELOG.md | 18 ++++++ plugins/api-docs/package.json | 14 ++--- plugins/app-backend/CHANGELOG.md | 8 +++ plugins/app-backend/package.json | 6 +- plugins/auth-backend/CHANGELOG.md | 13 ++++ plugins/auth-backend/package.json | 10 ++-- plugins/badges-backend/CHANGELOG.md | 11 ++++ plugins/badges-backend/package.json | 8 +-- plugins/badges/CHANGELOG.md | 16 +++++ plugins/badges/package.json | 14 ++--- plugins/bitrise/CHANGELOG.md | 16 +++++ plugins/bitrise/package.json | 14 ++--- plugins/catalog-backend/CHANGELOG.md | 24 ++++++++ plugins/catalog-backend/package.json | 10 ++-- plugins/catalog-graphql/CHANGELOG.md | 12 ++++ plugins/catalog-graphql/package.json | 10 ++-- plugins/catalog-import/CHANGELOG.md | 17 ++++++ plugins/catalog-import/package.json | 16 ++--- plugins/catalog-react/CHANGELOG.md | 15 +++++ plugins/catalog-react/package.json | 12 ++-- plugins/catalog/CHANGELOG.md | 18 ++++++ plugins/catalog/package.json | 16 ++--- plugins/circleci/CHANGELOG.md | 16 +++++ plugins/circleci/package.json | 14 ++--- plugins/cloudbuild/CHANGELOG.md | 16 +++++ plugins/cloudbuild/package.json | 14 ++--- plugins/code-coverage-backend/CHANGELOG.md | 11 ++++ plugins/code-coverage-backend/package.json | 8 +-- plugins/code-coverage/CHANGELOG.md | 16 +++++ plugins/code-coverage/package.json | 14 ++--- plugins/config-schema/CHANGELOG.md | 13 ++++ plugins/config-schema/package.json | 10 ++-- plugins/cost-insights/CHANGELOG.md | 12 ++++ plugins/cost-insights/package.json | 10 ++-- plugins/explore-react/CHANGELOG.md | 11 ++++ plugins/explore-react/package.json | 10 ++-- plugins/explore/CHANGELOG.md | 18 ++++++ plugins/explore/package.json | 16 ++--- plugins/fossa/CHANGELOG.md | 16 +++++ plugins/fossa/package.json | 14 ++--- plugins/gcp-projects/CHANGELOG.md | 12 ++++ plugins/gcp-projects/package.json | 10 ++-- plugins/git-release-manager/package.json | 8 +-- plugins/github-actions/CHANGELOG.md | 16 +++++ plugins/github-actions/package.json | 14 ++--- plugins/github-deployments/CHANGELOG.md | 18 ++++++ plugins/github-deployments/package.json | 16 ++--- plugins/gitops-profiles/CHANGELOG.md | 12 ++++ plugins/gitops-profiles/package.json | 10 ++-- plugins/graphiql/CHANGELOG.md | 12 ++++ plugins/graphiql/package.json | 10 ++-- plugins/graphql/CHANGELOG.md | 10 ++++ plugins/graphql/package.json | 8 +-- plugins/jenkins/CHANGELOG.md | 16 +++++ plugins/jenkins/package.json | 14 ++--- plugins/kafka-backend/CHANGELOG.md | 11 ++++ plugins/kafka-backend/package.json | 8 +-- plugins/kafka/CHANGELOG.md | 16 +++++ plugins/kafka/package.json | 14 ++--- plugins/kubernetes-backend/CHANGELOG.md | 12 ++++ plugins/kubernetes-backend/package.json | 8 +-- plugins/kubernetes/CHANGELOG.md | 17 ++++++ plugins/kubernetes/package.json | 14 ++--- plugins/lighthouse/CHANGELOG.md | 16 +++++ plugins/lighthouse/package.json | 14 ++--- plugins/newrelic/CHANGELOG.md | 12 ++++ plugins/newrelic/package.json | 10 ++-- plugins/org/CHANGELOG.md | 18 ++++++ plugins/org/package.json | 16 ++--- plugins/pagerduty/CHANGELOG.md | 16 +++++ plugins/pagerduty/package.json | 14 ++--- plugins/proxy-backend/CHANGELOG.md | 8 +++ plugins/proxy-backend/package.json | 6 +- plugins/register-component/CHANGELOG.md | 16 +++++ plugins/register-component/package.json | 14 ++--- plugins/rollbar-backend/CHANGELOG.md | 8 +++ plugins/rollbar-backend/package.json | 6 +- plugins/rollbar/CHANGELOG.md | 16 +++++ plugins/rollbar/package.json | 14 ++--- plugins/scaffolder-backend/CHANGELOG.md | 14 +++++ plugins/scaffolder-backend/package.json | 10 ++-- plugins/scaffolder/CHANGELOG.md | 18 ++++++ plugins/scaffolder/package.json | 16 ++--- plugins/search-backend-node/package.json | 4 +- plugins/search-backend/CHANGELOG.md | 8 +++ plugins/search-backend/package.json | 6 +- plugins/search/CHANGELOG.md | 16 +++++ plugins/search/package.json | 14 ++--- plugins/sentry/CHANGELOG.md | 16 +++++ plugins/sentry/package.json | 14 ++--- plugins/shortcuts/CHANGELOG.md | 12 ++++ plugins/shortcuts/package.json | 10 ++-- plugins/sonarqube/CHANGELOG.md | 16 +++++ plugins/sonarqube/package.json | 14 ++--- plugins/splunk-on-call/CHANGELOG.md | 16 +++++ plugins/splunk-on-call/package.json | 14 ++--- plugins/tech-radar/CHANGELOG.md | 12 ++++ plugins/tech-radar/package.json | 10 ++-- plugins/techdocs-backend/CHANGELOG.md | 13 ++++ plugins/techdocs-backend/package.json | 10 ++-- plugins/techdocs/CHANGELOG.md | 17 ++++++ plugins/techdocs/package.json | 16 ++--- plugins/todo-backend/CHANGELOG.md | 11 ++++ plugins/todo-backend/package.json | 8 +-- plugins/todo/CHANGELOG.md | 17 ++++++ plugins/todo/package.json | 14 ++--- plugins/user-settings/CHANGELOG.md | 12 ++++ plugins/user-settings/package.json | 10 ++-- plugins/welcome/CHANGELOG.md | 12 ++++ plugins/welcome/package.json | 10 ++-- 156 files changed, 1457 insertions(+), 668 deletions(-) delete mode 100644 .changeset/afraid-waves-remember.md delete mode 100644 .changeset/beige-cheetahs-jog.md delete mode 100644 .changeset/breezy-carrots-hunt.md delete mode 100644 .changeset/calm-insects-melt.md delete mode 100644 .changeset/clean-starfishes-drop.md delete mode 100644 .changeset/cool-cache-bro.md delete mode 100644 .changeset/cyan-beans-marry.md delete mode 100644 .changeset/forty-pumpkins-agree.md delete mode 100644 .changeset/grumpy-goats-refuse.md delete mode 100644 .changeset/khaki-waves-dream.md delete mode 100644 .changeset/mighty-poets-cheer.md delete mode 100644 .changeset/ninety-pots-guess.md delete mode 100644 .changeset/polite-plants-exercise.md delete mode 100644 .changeset/shaggy-drinks-hammer.md delete mode 100644 .changeset/short-bobcats-mate.md delete mode 100644 .changeset/smart-sheep-itch.md delete mode 100644 .changeset/smooth-vans-travel.md delete mode 100644 .changeset/sour-kids-compete.md delete mode 100644 .changeset/stale-gifts-push.md delete mode 100644 .changeset/techdocs-spaces-in-objects.md delete mode 100644 .changeset/ten-paws-ring.md delete mode 100644 .changeset/wild-moles-care.md create mode 100644 packages/integration-react/CHANGELOG.md create mode 100644 plugins/config-schema/CHANGELOG.md create mode 100644 plugins/shortcuts/CHANGELOG.md create mode 100644 plugins/todo/CHANGELOG.md diff --git a/.changeset/afraid-waves-remember.md b/.changeset/afraid-waves-remember.md deleted file mode 100644 index 13df956acc..0000000000 --- a/.changeset/afraid-waves-remember.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -'@backstage/core': patch -'@backstage/core-api': patch -'@backstage/dev-utils': patch -'@backstage/integration-react': patch -'@backstage/test-utils': patch -'@backstage/plugin-api-docs': patch -'@backstage/plugin-badges': patch -'@backstage/plugin-bitrise': patch -'@backstage/plugin-catalog': patch -'@backstage/plugin-catalog-import': patch -'@backstage/plugin-catalog-react': patch -'@backstage/plugin-circleci': patch -'@backstage/plugin-cloudbuild': patch -'@backstage/plugin-code-coverage': patch -'@backstage/plugin-config-schema': patch -'@backstage/plugin-cost-insights': patch -'@backstage/plugin-explore': patch -'@backstage/plugin-explore-react': patch -'@backstage/plugin-fossa': patch -'@backstage/plugin-gcp-projects': patch -'@backstage/plugin-github-actions': patch -'@backstage/plugin-github-deployments': patch -'@backstage/plugin-gitops-profiles': patch -'@backstage/plugin-graphiql': patch -'@backstage/plugin-jenkins': patch -'@backstage/plugin-kafka': patch -'@backstage/plugin-kubernetes': patch -'@backstage/plugin-lighthouse': patch -'@backstage/plugin-newrelic': patch -'@backstage/plugin-org': patch -'@backstage/plugin-pagerduty': patch -'@backstage/plugin-register-component': patch -'@backstage/plugin-rollbar': patch -'@backstage/plugin-scaffolder': patch -'@backstage/plugin-scaffolder-backend': patch -'@backstage/plugin-search': patch -'@backstage/plugin-sentry': patch -'@backstage/plugin-shortcuts': patch -'@backstage/plugin-sonarqube': patch -'@backstage/plugin-splunk-on-call': patch -'@backstage/plugin-tech-radar': patch -'@backstage/plugin-techdocs': patch -'@backstage/plugin-todo': patch -'@backstage/plugin-user-settings': patch -'@backstage/plugin-welcome': patch ---- - -chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 diff --git a/.changeset/beige-cheetahs-jog.md b/.changeset/beige-cheetahs-jog.md deleted file mode 100644 index 87ef3ef44c..0000000000 --- a/.changeset/beige-cheetahs-jog.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/cli': patch ---- - -Add context for versions:bump on what version it was bumped to. Updated tests for the same. diff --git a/.changeset/breezy-carrots-hunt.md b/.changeset/breezy-carrots-hunt.md deleted file mode 100644 index 0075009a2d..0000000000 --- a/.changeset/breezy-carrots-hunt.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-explore': patch ---- - -Add "Organization" tab with a diagram diff --git a/.changeset/calm-insects-melt.md b/.changeset/calm-insects-melt.md deleted file mode 100644 index 4b17764c33..0000000000 --- a/.changeset/calm-insects-melt.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@backstage/cli': patch -'@backstage/create-app': patch -'@backstage/plugin-catalog-graphql': patch ---- - -chore: bump `ts-node` versions to 9.1.1 diff --git a/.changeset/clean-starfishes-drop.md b/.changeset/clean-starfishes-drop.md deleted file mode 100644 index 884bb8de9f..0000000000 --- a/.changeset/clean-starfishes-drop.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-catalog': patch ---- - -This makes the CatalogTable configurable with custom columns, passed through the CatalogPage component rendered on the home page. diff --git a/.changeset/cool-cache-bro.md b/.changeset/cool-cache-bro.md deleted file mode 100644 index 9d5f998897..0000000000 --- a/.changeset/cool-cache-bro.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -'@backstage/backend-common': minor ---- - -Introducing: a standard API for App Integrators to configure cache stores and Plugin Developers to interact with them. - -Two cache stores are currently supported. - -- `memory`, which is a very simple in-memory key/value store, intended for local development. -- `memcache`, which can be used to connect to a memcache host. - -Configuring and working with cache stores is very similar to the process for database connections. - -```yaml -backend: - cache: - store: memcache - connection: user:pass@cache.example.com:11211 -``` - -```typescript -import { CacheManager } from '@backstage/backend-common'; - -// Instantiating a cache client for a plugin. -const cacheManager = CacheManager.fromConfig(config); -const somePluginCache = cacheManager.forPlugin('somePlugin'); -const cacheClient = somePluginCache.getClient(); - -// Using the cache client: -const cachedValue = await cacheClient.get('someKey'); -if (cachedValue) { - return cachedValue; -} else { - const someValue = await someExpensiveProcess(); - await cacheClient.set('someKey', someValue); -} -await cacheClient.delete('someKey'); -``` - -Cache clients deal with TTLs in milliseconds. A TTL can be provided as a defaultTtl when getting a client, or may be passed when setting specific objects. If no TTL is provided, data will be persisted indefinitely. - -```typescript -// Getting a client with a default TTL -const cacheClient = somePluginCache.getClient({ - defaultTtl: 3600000, -}); - -// Setting a TTL on a per-object basis. -cacheClient.set('someKey', data, { ttl: 3600000 }); -``` - -Configuring a cache store is optional. Even when no cache store is configured, the cache manager will dutifully pass plugins a manager that resolves a cache client that does not actually write or read any data. diff --git a/.changeset/cyan-beans-marry.md b/.changeset/cyan-beans-marry.md deleted file mode 100644 index 99d7ad47ce..0000000000 --- a/.changeset/cyan-beans-marry.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/catalog-model': patch ---- - -Renamed parameters to input in template schema diff --git a/.changeset/forty-pumpkins-agree.md b/.changeset/forty-pumpkins-agree.md deleted file mode 100644 index 2d8892c862..0000000000 --- a/.changeset/forty-pumpkins-agree.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-scaffolder-backend': patch ---- - -The apiBaseUrl setting for Bitbucket Server integrations will now be used when it is set. Otherwise, it will default back to the host setting. diff --git a/.changeset/grumpy-goats-refuse.md b/.changeset/grumpy-goats-refuse.md deleted file mode 100644 index 8dc2e390fc..0000000000 --- a/.changeset/grumpy-goats-refuse.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-scaffolder': patch ---- - -Show error on task page if task does not exist. diff --git a/.changeset/khaki-waves-dream.md b/.changeset/khaki-waves-dream.md deleted file mode 100644 index 38254c21be..0000000000 --- a/.changeset/khaki-waves-dream.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-kubernetes': patch ---- - -Export types diff --git a/.changeset/mighty-poets-cheer.md b/.changeset/mighty-poets-cheer.md deleted file mode 100644 index 47538489e4..0000000000 --- a/.changeset/mighty-poets-cheer.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/backend-common': patch ---- - -Prep work for mysql support in backend-common diff --git a/.changeset/ninety-pots-guess.md b/.changeset/ninety-pots-guess.md deleted file mode 100644 index 4b9a770c29..0000000000 --- a/.changeset/ninety-pots-guess.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/cli': patch ---- - -update plugins created to use react-use 17.2.4 diff --git a/.changeset/polite-plants-exercise.md b/.changeset/polite-plants-exercise.md deleted file mode 100644 index 2cfa38697a..0000000000 --- a/.changeset/polite-plants-exercise.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -'@backstage/plugin-catalog-backend': minor ---- - -Port `GithubOrgReaderProcessor` to support configuration via -[`integrations`](https://backstage.io/docs/integrations/github/locations) in -addition to [`catalog.processors.githubOrg.providers`](https://backstage.io/docs/integrations/github/org#configuration). -The `integrations` package supports authentication with both personal access -tokens and GitHub apps. - -This deprecates the `catalog.processors.githubOrg.providers` configuration. -A [`integrations` configuration](https://backstage.io/docs/integrations/github/locations) -for the same host takes precedence over the provider configuration. -You might need to add additional scopes for the credentials. diff --git a/.changeset/shaggy-drinks-hammer.md b/.changeset/shaggy-drinks-hammer.md deleted file mode 100644 index 67f284ea3f..0000000000 --- a/.changeset/shaggy-drinks-hammer.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-org': patch ---- - -Paginate group members to only display 50 members maximum. diff --git a/.changeset/short-bobcats-mate.md b/.changeset/short-bobcats-mate.md deleted file mode 100644 index d63e7058a9..0000000000 --- a/.changeset/short-bobcats-mate.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@backstage/core': patch -'@backstage/plugin-api-docs': patch ---- - -Fix state persisted in the URL make search input in the table toolbar lose their -focus. diff --git a/.changeset/smart-sheep-itch.md b/.changeset/smart-sheep-itch.md deleted file mode 100644 index 12a0ff5ad0..0000000000 --- a/.changeset/smart-sheep-itch.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/catalog-model': patch ---- - -Improve error messages when schema validation fails diff --git a/.changeset/smooth-vans-travel.md b/.changeset/smooth-vans-travel.md deleted file mode 100644 index 0038c35e8e..0000000000 --- a/.changeset/smooth-vans-travel.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-github-deployments': patch ---- - -Support for GitHub Enterprise with GithubDeploymentsPlugin diff --git a/.changeset/sour-kids-compete.md b/.changeset/sour-kids-compete.md deleted file mode 100644 index ce94305c48..0000000000 --- a/.changeset/sour-kids-compete.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-scaffolder-backend': patch ---- - -Move `jest-when` to the dev dependencies diff --git a/.changeset/stale-gifts-push.md b/.changeset/stale-gifts-push.md deleted file mode 100644 index f1e13ba14d..0000000000 --- a/.changeset/stale-gifts-push.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/core': patch ---- - -Add count of older messages when multiple messages exist in AlertDisplay diff --git a/.changeset/techdocs-spaces-in-objects.md b/.changeset/techdocs-spaces-in-objects.md deleted file mode 100644 index 7bbac5d2a8..0000000000 --- a/.changeset/techdocs-spaces-in-objects.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/techdocs-common': patch ---- - -Fixed a bug that prevented loading static assets from GCS, S3, Azure, and OpenStackSwift whose keys contain spaces or other special characters. diff --git a/.changeset/ten-paws-ring.md b/.changeset/ten-paws-ring.md deleted file mode 100644 index 8ed2158f6c..0000000000 --- a/.changeset/ten-paws-ring.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -'@backstage/core': patch -'@backstage/core-api': patch -'@backstage/integration-react': patch -'@backstage/plugin-api-docs': patch -'@backstage/plugin-badges': patch -'@backstage/plugin-bitrise': patch -'@backstage/plugin-catalog': patch -'@backstage/plugin-catalog-import': patch -'@backstage/plugin-catalog-react': patch -'@backstage/plugin-circleci': patch -'@backstage/plugin-cloudbuild': patch -'@backstage/plugin-code-coverage': patch -'@backstage/plugin-config-schema': patch -'@backstage/plugin-cost-insights': patch -'@backstage/plugin-explore': patch -'@backstage/plugin-fossa': patch -'@backstage/plugin-gcp-projects': patch -'@backstage/plugin-github-actions': patch -'@backstage/plugin-github-deployments': patch -'@backstage/plugin-gitops-profiles': patch -'@backstage/plugin-graphiql': patch -'@backstage/plugin-jenkins': patch -'@backstage/plugin-kafka': patch -'@backstage/plugin-kubernetes': patch -'@backstage/plugin-lighthouse': patch -'@backstage/plugin-newrelic': patch -'@backstage/plugin-org': patch -'@backstage/plugin-pagerduty': patch -'@backstage/plugin-register-component': patch -'@backstage/plugin-rollbar': patch -'@backstage/plugin-scaffolder': patch -'@backstage/plugin-search': patch -'@backstage/plugin-sentry': patch -'@backstage/plugin-sonarqube': patch -'@backstage/plugin-splunk-on-call': patch -'@backstage/plugin-tech-radar': patch -'@backstage/plugin-techdocs': patch -'@backstage/plugin-todo': patch -'@backstage/plugin-user-settings': patch -'@backstage/plugin-welcome': patch ---- - -chore: bump `react-use` dependency in all packages diff --git a/.changeset/wild-moles-care.md b/.changeset/wild-moles-care.md deleted file mode 100644 index 35b886c2c1..0000000000 --- a/.changeset/wild-moles-care.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/plugin-kubernetes-backend': patch ---- - -Add possibility to configure TLS verification for `gke` type clusters diff --git a/packages/app/CHANGELOG.md b/packages/app/CHANGELOG.md index 33ef204f63..1cc00e5ff9 100644 --- a/packages/app/CHANGELOG.md +++ b/packages/app/CHANGELOG.md @@ -1,5 +1,57 @@ # example-app +## 0.2.28 + +### Patch Changes + +- Updated dependencies [062bbf90f] +- Updated dependencies [2cd70e164] +- Updated dependencies [0b033d07b] +- Updated dependencies [3be844496] +- Updated dependencies [5542de095] +- Updated dependencies [10c008a3a] +- Updated dependencies [81ef1d57b] +- Updated dependencies [ea21d46f0] +- Updated dependencies [e3fc89df6] +- Updated dependencies [f59a945b7] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/integration-react@0.1.2 + - @backstage/plugin-api-docs@0.4.13 + - @backstage/plugin-badges@0.2.1 + - @backstage/plugin-catalog@0.5.7 + - @backstage/plugin-catalog-import@0.5.6 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/plugin-circleci@0.2.14 + - @backstage/plugin-cloudbuild@0.2.14 + - @backstage/plugin-code-coverage@0.1.3 + - @backstage/plugin-cost-insights@0.9.1 + - @backstage/plugin-explore@0.3.5 + - @backstage/plugin-gcp-projects@0.2.6 + - @backstage/plugin-github-actions@0.4.6 + - @backstage/plugin-graphiql@0.2.11 + - @backstage/plugin-jenkins@0.4.3 + - @backstage/plugin-kafka@0.2.7 + - @backstage/plugin-kubernetes@0.4.4 + - @backstage/plugin-lighthouse@0.2.16 + - @backstage/plugin-newrelic@0.2.7 + - @backstage/plugin-org@0.3.13 + - @backstage/plugin-pagerduty@0.3.4 + - @backstage/plugin-rollbar@0.3.5 + - @backstage/plugin-scaffolder@0.9.4 + - @backstage/plugin-search@0.3.6 + - @backstage/plugin-sentry@0.3.10 + - @backstage/plugin-shortcuts@0.1.2 + - @backstage/plugin-tech-radar@0.3.11 + - @backstage/plugin-techdocs@0.9.2 + - @backstage/plugin-todo@0.1.1 + - @backstage/plugin-user-settings@0.2.10 + - @backstage/cli@0.6.11 + - @backstage/catalog-model@0.7.9 + ## 0.2.27 ### Patch Changes diff --git a/packages/app/package.json b/packages/app/package.json index 714d420744..6acba6f4cc 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -1,42 +1,42 @@ { "name": "example-app", - "version": "0.2.27", + "version": "0.2.28", "private": true, "bundled": true, "dependencies": { - "@backstage/catalog-model": "^0.7.8", - "@backstage/cli": "^0.6.10", - "@backstage/core": "^0.7.8", - "@backstage/integration-react": "^0.1.1", - "@backstage/plugin-api-docs": "^0.4.12", - "@backstage/plugin-badges": "^0.2.0", - "@backstage/plugin-catalog": "^0.5.6", - "@backstage/plugin-catalog-import": "^0.5.5", - "@backstage/plugin-catalog-react": "^0.1.5", - "@backstage/plugin-circleci": "^0.2.13", - "@backstage/plugin-cloudbuild": "^0.2.13", - "@backstage/plugin-code-coverage": "^0.1.2", - "@backstage/plugin-cost-insights": "^0.9.0", - "@backstage/plugin-explore": "^0.3.4", - "@backstage/plugin-gcp-projects": "^0.2.5", - "@backstage/plugin-github-actions": "^0.4.5", - "@backstage/plugin-graphiql": "^0.2.10", - "@backstage/plugin-jenkins": "^0.4.2", - "@backstage/plugin-kafka": "^0.2.6", - "@backstage/plugin-kubernetes": "^0.4.3", - "@backstage/plugin-lighthouse": "^0.2.15", - "@backstage/plugin-newrelic": "^0.2.6", - "@backstage/plugin-org": "^0.3.12", - "@backstage/plugin-pagerduty": "0.3.3", - "@backstage/plugin-rollbar": "^0.3.4", - "@backstage/plugin-scaffolder": "^0.9.3", - "@backstage/plugin-search": "^0.3.5", - "@backstage/plugin-sentry": "^0.3.9", - "@backstage/plugin-shortcuts": "^0.1.1", - "@backstage/plugin-tech-radar": "^0.3.10", - "@backstage/plugin-techdocs": "^0.9.1", - "@backstage/plugin-todo": "^0.1.0", - "@backstage/plugin-user-settings": "^0.2.8", + "@backstage/catalog-model": "^0.7.9", + "@backstage/cli": "^0.6.11", + "@backstage/core": "^0.7.9", + "@backstage/integration-react": "^0.1.2", + "@backstage/plugin-api-docs": "^0.4.13", + "@backstage/plugin-badges": "^0.2.1", + "@backstage/plugin-catalog": "^0.5.7", + "@backstage/plugin-catalog-import": "^0.5.6", + "@backstage/plugin-catalog-react": "^0.1.6", + "@backstage/plugin-circleci": "^0.2.14", + "@backstage/plugin-cloudbuild": "^0.2.14", + "@backstage/plugin-code-coverage": "^0.1.3", + "@backstage/plugin-cost-insights": "^0.9.1", + "@backstage/plugin-explore": "^0.3.5", + "@backstage/plugin-gcp-projects": "^0.2.6", + "@backstage/plugin-github-actions": "^0.4.6", + "@backstage/plugin-graphiql": "^0.2.11", + "@backstage/plugin-jenkins": "^0.4.3", + "@backstage/plugin-kafka": "^0.2.7", + "@backstage/plugin-kubernetes": "^0.4.4", + "@backstage/plugin-lighthouse": "^0.2.16", + "@backstage/plugin-newrelic": "^0.2.7", + "@backstage/plugin-org": "^0.3.13", + "@backstage/plugin-pagerduty": "0.3.4", + "@backstage/plugin-rollbar": "^0.3.5", + "@backstage/plugin-scaffolder": "^0.9.4", + "@backstage/plugin-search": "^0.3.6", + "@backstage/plugin-sentry": "^0.3.10", + "@backstage/plugin-shortcuts": "^0.1.2", + "@backstage/plugin-tech-radar": "^0.3.11", + "@backstage/plugin-techdocs": "^0.9.2", + "@backstage/plugin-todo": "^0.1.1", + "@backstage/plugin-user-settings": "^0.2.10", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -56,7 +56,7 @@ "zen-observable": "^0.8.15" }, "devDependencies": { - "@backstage/test-utils": "^0.1.10", + "@backstage/test-utils": "^0.1.11", "@testing-library/cypress": "^7.0.1", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/packages/backend-common/CHANGELOG.md b/packages/backend-common/CHANGELOG.md index 3568adf099..9c66f387d9 100644 --- a/packages/backend-common/CHANGELOG.md +++ b/packages/backend-common/CHANGELOG.md @@ -1,5 +1,62 @@ # @backstage/backend-common +## 0.8.0 + +### Minor Changes + +- 22fd8ce2a: Introducing: a standard API for App Integrators to configure cache stores and Plugin Developers to interact with them. + + Two cache stores are currently supported. + + - `memory`, which is a very simple in-memory key/value store, intended for local development. + - `memcache`, which can be used to connect to a memcache host. + + Configuring and working with cache stores is very similar to the process for database connections. + + ```yaml + backend: + cache: + store: memcache + connection: user:pass@cache.example.com:11211 + ``` + + ```typescript + import { CacheManager } from '@backstage/backend-common'; + + // Instantiating a cache client for a plugin. + const cacheManager = CacheManager.fromConfig(config); + const somePluginCache = cacheManager.forPlugin('somePlugin'); + const cacheClient = somePluginCache.getClient(); + + // Using the cache client: + const cachedValue = await cacheClient.get('someKey'); + if (cachedValue) { + return cachedValue; + } else { + const someValue = await someExpensiveProcess(); + await cacheClient.set('someKey', someValue); + } + await cacheClient.delete('someKey'); + ``` + + Cache clients deal with TTLs in milliseconds. A TTL can be provided as a defaultTtl when getting a client, or may be passed when setting specific objects. If no TTL is provided, data will be persisted indefinitely. + + ```typescript + // Getting a client with a default TTL + const cacheClient = somePluginCache.getClient({ + defaultTtl: 3600000, + }); + + // Setting a TTL on a per-object basis. + cacheClient.set('someKey', data, { ttl: 3600000 }); + ``` + + Configuring a cache store is optional. Even when no cache store is configured, the cache manager will dutifully pass plugins a manager that resolves a cache client that does not actually write or read any data. + +### Patch Changes + +- f9fb4a205: Prep work for mysql support in backend-common + ## 0.7.0 ### Minor Changes diff --git a/packages/backend-common/package.json b/packages/backend-common/package.json index 46caa82e1d..7e647e57d0 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.7.0", + "version": "0.8.0", "main": "src/index.ts", "types": "src/index.ts", "private": false, @@ -76,8 +76,8 @@ } }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/test-utils": "^0.1.11", "@types/archiver": "^5.1.0", "@types/compression": "^1.7.0", "@types/concat-stream": "^1.6.0", diff --git a/packages/backend/CHANGELOG.md b/packages/backend/CHANGELOG.md index ac65632142..977588b555 100644 --- a/packages/backend/CHANGELOG.md +++ b/packages/backend/CHANGELOG.md @@ -1,5 +1,36 @@ # example-backend +## 0.2.28 + +### Patch Changes + +- Updated dependencies [062bbf90f] +- Updated dependencies [22fd8ce2a] +- Updated dependencies [10c008a3a] +- Updated dependencies [82ca1ac22] +- Updated dependencies [f9fb4a205] +- Updated dependencies [9a207f052] +- Updated dependencies [16be1d093] +- Updated dependencies [fd39d4662] +- Updated dependencies [f9f9d633d] + - @backstage/plugin-scaffolder-backend@0.11.1 + - @backstage/backend-common@0.8.0 + - @backstage/catalog-model@0.7.9 + - @backstage/plugin-catalog-backend@0.9.0 + - @backstage/plugin-kubernetes-backend@0.3.7 + - example-app@0.2.28 + - @backstage/plugin-app-backend@0.3.13 + - @backstage/plugin-auth-backend@0.3.10 + - @backstage/plugin-badges-backend@0.1.4 + - @backstage/plugin-code-coverage-backend@0.1.5 + - @backstage/plugin-graphql-backend@0.1.8 + - @backstage/plugin-kafka-backend@0.2.5 + - @backstage/plugin-proxy-backend@0.2.8 + - @backstage/plugin-rollbar-backend@0.1.11 + - @backstage/plugin-search-backend@0.1.5 + - @backstage/plugin-techdocs-backend@0.8.1 + - @backstage/plugin-todo-backend@0.1.5 + ## 0.2.27 ### Patch Changes diff --git a/packages/backend/package.json b/packages/backend/package.json index 6f70db7b19..4044a6632f 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -1,6 +1,6 @@ { "name": "example-backend", - "version": "0.2.27", + "version": "0.2.28", "main": "dist/index.cjs.js", "types": "src/index.ts", "license": "Apache-2.0", @@ -27,30 +27,30 @@ "migrate:create": "knex migrate:make -x ts" }, "dependencies": { - "@backstage/backend-common": "^0.7.0", + "@backstage/backend-common": "^0.8.0", "@backstage/catalog-client": "^0.3.11", - "@backstage/catalog-model": "^0.7.8", + "@backstage/catalog-model": "^0.7.9", "@backstage/config": "^0.1.5", - "@backstage/plugin-app-backend": "^0.3.12", - "@backstage/plugin-auth-backend": "^0.3.9", - "@backstage/plugin-badges-backend": "^0.1.3", - "@backstage/plugin-catalog-backend": "^0.8.2", - "@backstage/plugin-code-coverage-backend": "^0.1.4", - "@backstage/plugin-graphql-backend": "^0.1.7", - "@backstage/plugin-kubernetes-backend": "^0.3.6", - "@backstage/plugin-kafka-backend": "^0.2.4", - "@backstage/plugin-proxy-backend": "^0.2.7", - "@backstage/plugin-rollbar-backend": "^0.1.10", - "@backstage/plugin-scaffolder-backend": "^0.11.0", - "@backstage/plugin-search-backend": "^0.1.4", + "@backstage/plugin-app-backend": "^0.3.13", + "@backstage/plugin-auth-backend": "^0.3.10", + "@backstage/plugin-badges-backend": "^0.1.4", + "@backstage/plugin-catalog-backend": "^0.9.0", + "@backstage/plugin-code-coverage-backend": "^0.1.5", + "@backstage/plugin-graphql-backend": "^0.1.8", + "@backstage/plugin-kubernetes-backend": "^0.3.7", + "@backstage/plugin-kafka-backend": "^0.2.5", + "@backstage/plugin-proxy-backend": "^0.2.8", + "@backstage/plugin-rollbar-backend": "^0.1.11", + "@backstage/plugin-scaffolder-backend": "^0.11.1", + "@backstage/plugin-search-backend": "^0.1.5", "@backstage/plugin-search-backend-node": "^0.1.3", - "@backstage/plugin-techdocs-backend": "^0.8.0", - "@backstage/plugin-todo-backend": "^0.1.4", + "@backstage/plugin-techdocs-backend": "^0.8.1", + "@backstage/plugin-todo-backend": "^0.1.5", "@gitbeaker/node": "^28.0.2", "@octokit/rest": "^18.5.3", "azure-devops-node-api": "^10.1.1", "dockerode": "^3.2.1", - "example-app": "^0.2.27", + "example-app": "^0.2.28", "express": "^4.17.1", "express-promise-router": "^4.1.0", "knex": "^0.95.1", @@ -60,7 +60,7 @@ "winston": "^3.2.1" }, "devDependencies": { - "@backstage/cli": "^0.6.10", + "@backstage/cli": "^0.6.11", "@types/dockerode": "^3.2.1", "@types/express": "^4.17.6", "@types/express-serve-static-core": "^4.17.5" diff --git a/packages/catalog-model/CHANGELOG.md b/packages/catalog-model/CHANGELOG.md index e289c5a0b3..312a329649 100644 --- a/packages/catalog-model/CHANGELOG.md +++ b/packages/catalog-model/CHANGELOG.md @@ -1,5 +1,12 @@ # @backstage/catalog-model +## 0.7.9 + +### Patch Changes + +- 10c008a3a: Renamed parameters to input in template schema +- 16be1d093: Improve error messages when schema validation fails + ## 0.7.8 ### Patch Changes diff --git a/packages/catalog-model/package.json b/packages/catalog-model/package.json index ac3b046a32..6b5b096cb6 100644 --- a/packages/catalog-model/package.json +++ b/packages/catalog-model/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/catalog-model", - "version": "0.7.8", + "version": "0.7.9", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -39,7 +39,7 @@ "yup": "^0.29.3" }, "devDependencies": { - "@backstage/cli": "^0.6.10", + "@backstage/cli": "^0.6.11", "@types/express": "^4.17.6", "@types/jest": "^26.0.7", "@types/lodash": "^4.14.151", diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 996513f60e..cf28960f13 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,13 @@ # @backstage/cli +## 0.6.11 + +### Patch Changes + +- 2cd70e164: Add context for versions:bump on what version it was bumped to. Updated tests for the same. +- 3be844496: chore: bump `ts-node` versions to 9.1.1 +- e3fc89df6: update plugins created to use react-use 17.2.4 + ## 0.6.10 ### Patch Changes diff --git a/packages/cli/package.json b/packages/cli/package.json index cd0385196d..b17bc8cbda 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/cli", "description": "CLI for developing Backstage plugins and apps", - "version": "0.6.10", + "version": "0.6.11", "private": false, "publishConfig": { "access": "public" @@ -117,11 +117,11 @@ "yn": "^4.0.0" }, "devDependencies": { - "@backstage/backend-common": "^0.7.0", + "@backstage/backend-common": "^0.8.0", "@backstage/config": "^0.1.5", - "@backstage/core": "^0.7.8", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/core": "^0.7.9", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@backstage/theme": "^0.2.7", "@types/diff": "^5.0.0", "@types/express": "^4.17.6", diff --git a/packages/core-api/CHANGELOG.md b/packages/core-api/CHANGELOG.md index fab82a77e5..3652cf6bc0 100644 --- a/packages/core-api/CHANGELOG.md +++ b/packages/core-api/CHANGELOG.md @@ -1,5 +1,12 @@ # @backstage/core-api +## 0.2.18 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages + ## 0.2.17 ### Patch Changes diff --git a/packages/core-api/package.json b/packages/core-api/package.json index f9fd3d29a6..b5cd8cba69 100644 --- a/packages/core-api/package.json +++ b/packages/core-api/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/core-api", "description": "Internal Core API used by Backstage plugins and apps", - "version": "0.2.17", + "version": "0.2.18", "private": false, "publishConfig": { "access": "public", @@ -42,8 +42,8 @@ "zen-observable": "^0.8.15" }, "devDependencies": { - "@backstage/cli": "^0.6.9", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/test-utils": "^0.1.11", "@backstage/test-utils-core": "^0.1.1", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index a215c7cb8e..51c6b3f935 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -1,5 +1,18 @@ # @backstage/core +## 0.7.9 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 889d89b6e: Fix state persisted in the URL make search input in the table toolbar lose their + focus. +- 3f988cb63: Add count of older messages when multiple messages exist in AlertDisplay +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [675a569a9] + - @backstage/core-api@0.2.18 + ## 0.7.8 ### Patch Changes diff --git a/packages/core/package.json b/packages/core/package.json index 16928d63ca..e418a969ce 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/core", "description": "Core API used by Backstage plugins and apps", - "version": "0.7.8", + "version": "0.7.9", "private": false, "publishConfig": { "access": "public", @@ -30,7 +30,7 @@ }, "dependencies": { "@backstage/config": "^0.1.5", - "@backstage/core-api": "^0.2.17", + "@backstage/core-api": "^0.2.18", "@backstage/errors": "^0.1.1", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", @@ -71,8 +71,8 @@ "zen-observable": "^0.8.15" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/packages/create-app/CHANGELOG.md b/packages/create-app/CHANGELOG.md index f714e44fa7..5d4f176246 100644 --- a/packages/create-app/CHANGELOG.md +++ b/packages/create-app/CHANGELOG.md @@ -1,5 +1,52 @@ # @backstage/create-app +## 1.0.0 + +### Patch Changes + +- 3be844496: chore: bump `ts-node` versions to 9.1.1 +- Updated dependencies [062bbf90f] +- Updated dependencies [2cd70e164] +- Updated dependencies [0b033d07b] +- Updated dependencies [3be844496] +- Updated dependencies [5542de095] +- Updated dependencies [22fd8ce2a] +- Updated dependencies [10c008a3a] +- Updated dependencies [82ca1ac22] +- Updated dependencies [81ef1d57b] +- Updated dependencies [f9fb4a205] +- Updated dependencies [e3fc89df6] +- Updated dependencies [9a207f052] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [fd39d4662] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/integration-react@0.1.2 + - @backstage/test-utils@0.1.11 + - @backstage/plugin-api-docs@0.4.13 + - @backstage/plugin-catalog@0.5.7 + - @backstage/plugin-catalog-import@0.5.6 + - @backstage/plugin-explore@0.3.5 + - @backstage/plugin-github-actions@0.4.6 + - @backstage/plugin-lighthouse@0.2.16 + - @backstage/plugin-scaffolder@0.9.4 + - @backstage/plugin-scaffolder-backend@0.11.1 + - @backstage/plugin-search@0.3.6 + - @backstage/plugin-tech-radar@0.3.11 + - @backstage/plugin-techdocs@0.9.2 + - @backstage/plugin-user-settings@0.2.10 + - @backstage/cli@0.6.11 + - @backstage/backend-common@0.8.0 + - @backstage/catalog-model@0.7.9 + - @backstage/plugin-catalog-backend@0.9.0 + - @backstage/plugin-app-backend@0.3.13 + - @backstage/plugin-auth-backend@0.3.10 + - @backstage/plugin-proxy-backend@0.2.8 + - @backstage/plugin-rollbar-backend@0.1.11 + - @backstage/plugin-techdocs-backend@0.8.1 + ## 0.3.21 ### Patch Changes diff --git a/packages/create-app/package.json b/packages/create-app/package.json index b96b4e2065..d7dc99218e 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.21", + "version": "1.0.0", "private": false, "publishConfig": { "access": "public" diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md index 3e8b8a96a0..ac88847489 100644 --- a/packages/dev-utils/CHANGELOG.md +++ b/packages/dev-utils/CHANGELOG.md @@ -1,5 +1,22 @@ # @backstage/dev-utils +## 0.1.14 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/integration-react@0.1.2 + - @backstage/test-utils@0.1.11 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.1.13 ### Patch Changes diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 421cd0a2b8..fb1f8a26dc 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.1.13", + "version": "0.1.14", "private": false, "publishConfig": { "access": "public", @@ -29,11 +29,11 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.7.0", - "@backstage/catalog-model": "^0.7.3", - "@backstage/integration-react": "^0.1.1", - "@backstage/plugin-catalog-react": "^0.1.1", - "@backstage/test-utils": "^0.1.8", + "@backstage/core": "^0.7.9", + "@backstage/catalog-model": "^0.7.9", + "@backstage/integration-react": "^0.1.2", + "@backstage/plugin-catalog-react": "^0.1.6", + "@backstage/test-utils": "^0.1.11", "@backstage/theme": "^0.2.3", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -48,7 +48,7 @@ "react-router-dom": "6.0.0-beta.0" }, "devDependencies": { - "@backstage/cli": "^0.6.3", + "@backstage/cli": "^0.6.11", "@types/jest": "^26.0.7", "@types/node": "^14.14.32" }, diff --git a/packages/integration-react/CHANGELOG.md b/packages/integration-react/CHANGELOG.md new file mode 100644 index 0000000000..54aa3b3ab1 --- /dev/null +++ b/packages/integration-react/CHANGELOG.md @@ -0,0 +1,13 @@ +# @backstage/integration-react + +## 0.1.2 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [889d89b6e] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 diff --git a/packages/integration-react/package.json b/packages/integration-react/package.json index 8df1eef096..fe831ca24f 100644 --- a/packages/integration-react/package.json +++ b/packages/integration-react/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/integration-react", - "version": "0.1.1", + "version": "0.1.2", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -21,7 +21,7 @@ }, "dependencies": { "@backstage/config": "^0.1.2", - "@backstage/core": "^0.7.0", + "@backstage/core": "^0.7.9", "@backstage/integration": "^0.5.0", "@backstage/theme": "^0.2.3", "@material-ui/core": "^4.11.0", @@ -32,9 +32,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.3", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.8", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/packages/techdocs-common/CHANGELOG.md b/packages/techdocs-common/CHANGELOG.md index 644a3ebb5f..ec47f22475 100644 --- a/packages/techdocs-common/CHANGELOG.md +++ b/packages/techdocs-common/CHANGELOG.md @@ -1,5 +1,17 @@ # @backstage/techdocs-common +## 0.6.1 + +### Patch Changes + +- e04f1ccfb: Fixed a bug that prevented loading static assets from GCS, S3, Azure, and OpenStackSwift whose keys contain spaces or other special characters. +- Updated dependencies [22fd8ce2a] +- Updated dependencies [10c008a3a] +- Updated dependencies [f9fb4a205] +- Updated dependencies [16be1d093] + - @backstage/backend-common@0.8.0 + - @backstage/catalog-model@0.7.9 + ## 0.6.0 ### Minor Changes diff --git a/packages/techdocs-common/package.json b/packages/techdocs-common/package.json index 7c12f6f675..e6debbb817 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.0", + "version": "0.6.1", "main": "src/index.ts", "types": "src/index.ts", "private": false, @@ -38,8 +38,8 @@ "dependencies": { "@azure/identity": "^1.2.2", "@azure/storage-blob": "^12.4.0", - "@backstage/backend-common": "^0.7.0", - "@backstage/catalog-model": "^0.7.8", + "@backstage/backend-common": "^0.8.0", + "@backstage/catalog-model": "^0.7.9", "@backstage/config": "^0.1.5", "@backstage/errors": "^0.1.1", "@backstage/integration": "^0.5.2", @@ -60,7 +60,7 @@ "winston": "^3.2.1" }, "devDependencies": { - "@backstage/cli": "^0.6.10", + "@backstage/cli": "^0.6.11", "@types/fs-extra": "^9.0.5", "@types/git-url-parse": "^9.0.0", "@types/js-yaml": "^4.0.0", diff --git a/packages/test-utils/CHANGELOG.md b/packages/test-utils/CHANGELOG.md index d2c2748449..9a77665e28 100644 --- a/packages/test-utils/CHANGELOG.md +++ b/packages/test-utils/CHANGELOG.md @@ -1,5 +1,14 @@ # @backstage/test-utils +## 0.1.11 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- Updated dependencies [062bbf90f] +- Updated dependencies [675a569a9] + - @backstage/core-api@0.2.18 + ## 0.1.10 ### Patch Changes diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index 74716f7a16..7b7b73a64a 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/test-utils", "description": "Utilities to test Backstage plugins and apps.", - "version": "0.1.10", + "version": "0.1.11", "private": false, "publishConfig": { "access": "public", @@ -29,7 +29,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core-api": "^0.2.16", + "@backstage/core-api": "^0.2.18", "@backstage/test-utils-core": "^0.1.1", "@backstage/theme": "^0.2.3", "@material-ui/core": "^4.11.0", @@ -45,7 +45,7 @@ "zen-observable": "^0.8.15" }, "devDependencies": { - "@backstage/cli": "^0.6.7", + "@backstage/cli": "^0.6.11", "@types/jest": "^26.0.7", "@types/node": "^14.14.32" }, diff --git a/plugins/api-docs/CHANGELOG.md b/plugins/api-docs/CHANGELOG.md index f268ba1c4d..94fd3fe74a 100644 --- a/plugins/api-docs/CHANGELOG.md +++ b/plugins/api-docs/CHANGELOG.md @@ -1,5 +1,23 @@ # @backstage/plugin-api-docs +## 0.4.13 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 889d89b6e: Fix state persisted in the URL make search input in the table toolbar lose their + focus. +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.4.12 ### Patch Changes diff --git a/plugins/api-docs/package.json b/plugins/api-docs/package.json index c94680de9b..9610ae4e10 100644 --- a/plugins/api-docs/package.json +++ b/plugins/api-docs/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-api-docs", - "version": "0.4.12", + "version": "0.4.13", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,9 +30,9 @@ }, "dependencies": { "@asyncapi/react-component": "^0.23.0", - "@backstage/catalog-model": "^0.7.7", - "@backstage/core": "^0.7.8", - "@backstage/plugin-catalog-react": "^0.1.4", + "@backstage/catalog-model": "^0.7.9", + "@backstage/core": "^0.7.9", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@material-icons/font": "^1.0.2", "@material-ui/core": "^4.11.0", @@ -49,9 +49,9 @@ "swagger-ui-react": "^3.37.2" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/app-backend/CHANGELOG.md b/plugins/app-backend/CHANGELOG.md index 73fa9fc3b1..ede16b6a5e 100644 --- a/plugins/app-backend/CHANGELOG.md +++ b/plugins/app-backend/CHANGELOG.md @@ -1,5 +1,13 @@ # @backstage/plugin-app-backend +## 0.3.13 + +### Patch Changes + +- Updated dependencies [22fd8ce2a] +- Updated dependencies [f9fb4a205] + - @backstage/backend-common@0.8.0 + ## 0.3.12 ### Patch Changes diff --git a/plugins/app-backend/package.json b/plugins/app-backend/package.json index 84fe743550..60fa678dd0 100644 --- a/plugins/app-backend/package.json +++ b/plugins/app-backend/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-app-backend", - "version": "0.3.12", + "version": "0.3.13", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -29,7 +29,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.7.0", + "@backstage/backend-common": "^0.8.0", "@backstage/config-loader": "^0.6.1", "@backstage/config": "^0.1.5", "@types/express": "^4.17.6", @@ -40,7 +40,7 @@ "yn": "^4.0.0" }, "devDependencies": { - "@backstage/cli": "^0.6.10", + "@backstage/cli": "^0.6.11", "@types/supertest": "^2.0.8", "msw": "^0.20.5", "supertest": "^6.1.3" diff --git a/plugins/auth-backend/CHANGELOG.md b/plugins/auth-backend/CHANGELOG.md index e51942f742..1003140dec 100644 --- a/plugins/auth-backend/CHANGELOG.md +++ b/plugins/auth-backend/CHANGELOG.md @@ -1,5 +1,18 @@ # @backstage/plugin-auth-backend +## 0.3.10 + +### Patch Changes + +- Updated dependencies [062bbf90f] +- Updated dependencies [22fd8ce2a] +- Updated dependencies [10c008a3a] +- Updated dependencies [f9fb4a205] +- Updated dependencies [16be1d093] + - @backstage/test-utils@0.1.11 + - @backstage/backend-common@0.8.0 + - @backstage/catalog-model@0.7.9 + ## 0.3.9 ### Patch Changes diff --git a/plugins/auth-backend/package.json b/plugins/auth-backend/package.json index 41a47c7788..1b0ad25a84 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.9", + "version": "0.3.10", "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.7.0", + "@backstage/backend-common": "^0.8.0", "@backstage/catalog-client": "^0.3.11", - "@backstage/catalog-model": "^0.7.8", + "@backstage/catalog-model": "^0.7.9", "@backstage/config": "^0.1.5", "@backstage/errors": "^0.1.1", - "@backstage/test-utils": "^0.1.10", + "@backstage/test-utils": "^0.1.11", "@types/express": "^4.17.6", "@types/passport": "^1.0.3", "compression": "^1.7.4", @@ -68,7 +68,7 @@ "yn": "^4.0.0" }, "devDependencies": { - "@backstage/cli": "^0.6.10", + "@backstage/cli": "^0.6.11", "@types/body-parser": "^1.19.0", "@types/cookie-parser": "^1.4.2", "@types/express-session": "^1.17.2", diff --git a/plugins/badges-backend/CHANGELOG.md b/plugins/badges-backend/CHANGELOG.md index abbc4e70bd..d171d0d590 100644 --- a/plugins/badges-backend/CHANGELOG.md +++ b/plugins/badges-backend/CHANGELOG.md @@ -1,5 +1,16 @@ # @backstage/plugin-badges-backend +## 0.1.4 + +### Patch Changes + +- Updated dependencies [22fd8ce2a] +- Updated dependencies [10c008a3a] +- Updated dependencies [f9fb4a205] +- Updated dependencies [16be1d093] + - @backstage/backend-common@0.8.0 + - @backstage/catalog-model@0.7.9 + ## 0.1.3 ### Patch Changes diff --git a/plugins/badges-backend/package.json b/plugins/badges-backend/package.json index 347f8b9219..d7e0df88b5 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.3", + "version": "0.1.4", "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.7.0", + "@backstage/backend-common": "^0.8.0", "@backstage/catalog-client": "^0.3.11", - "@backstage/catalog-model": "^0.7.8", + "@backstage/catalog-model": "^0.7.9", "@backstage/config": "^0.1.5", "@backstage/errors": "^0.1.1", "@types/express": "^4.17.6", @@ -45,7 +45,7 @@ "yn": "^4.0.0" }, "devDependencies": { - "@backstage/cli": "^0.6.10", + "@backstage/cli": "^0.6.11", "@types/supertest": "^2.0.8", "supertest": "^6.1.3" }, diff --git a/plugins/badges/CHANGELOG.md b/plugins/badges/CHANGELOG.md index a0efd43ccc..c5ac19b4ed 100644 --- a/plugins/badges/CHANGELOG.md +++ b/plugins/badges/CHANGELOG.md @@ -1,5 +1,21 @@ # @backstage/plugin-badges +## 0.2.1 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.2.0 ### Minor Changes diff --git a/plugins/badges/package.json b/plugins/badges/package.json index e757567401..72aa2df787 100644 --- a/plugins/badges/package.json +++ b/plugins/badges/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-badges", - "version": "0.2.0", + "version": "0.2.1", "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.7.6", - "@backstage/core": "^0.7.8", + "@backstage/catalog-model": "^0.7.9", + "@backstage/core": "^0.7.9", "@backstage/errors": "^0.1.1", - "@backstage/plugin-catalog-react": "^0.1.3", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -34,9 +34,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/bitrise/CHANGELOG.md b/plugins/bitrise/CHANGELOG.md index ecb26efd50..61a0af36ed 100644 --- a/plugins/bitrise/CHANGELOG.md +++ b/plugins/bitrise/CHANGELOG.md @@ -1,5 +1,21 @@ # @backstage/plugin-bitrise +## 0.1.3 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.1.2 ### Patch Changes diff --git a/plugins/bitrise/package.json b/plugins/bitrise/package.json index f37d08f725..1414f729fd 100644 --- a/plugins/bitrise/package.json +++ b/plugins/bitrise/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-bitrise", - "version": "0.1.2", + "version": "0.1.3", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -20,9 +20,9 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.7.2", - "@backstage/core": "^0.7.8", - "@backstage/plugin-catalog-react": "^0.1.2", + "@backstage/catalog-model": "^0.7.9", + "@backstage/core": "^0.7.9", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -37,9 +37,9 @@ "recharts": "^1.8.5" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/catalog-backend/CHANGELOG.md b/plugins/catalog-backend/CHANGELOG.md index 8d40d7c4bb..0018d83399 100644 --- a/plugins/catalog-backend/CHANGELOG.md +++ b/plugins/catalog-backend/CHANGELOG.md @@ -1,5 +1,29 @@ # @backstage/plugin-catalog-backend +## 0.9.0 + +### Minor Changes + +- 9a207f052: Port `GithubOrgReaderProcessor` to support configuration via + [`integrations`](https://backstage.io/docs/integrations/github/locations) in + addition to [`catalog.processors.githubOrg.providers`](https://backstage.io/docs/integrations/github/org#configuration). + The `integrations` package supports authentication with both personal access + tokens and GitHub apps. + + This deprecates the `catalog.processors.githubOrg.providers` configuration. + A [`integrations` configuration](https://backstage.io/docs/integrations/github/locations) + for the same host takes precedence over the provider configuration. + You might need to add additional scopes for the credentials. + +### Patch Changes + +- Updated dependencies [22fd8ce2a] +- Updated dependencies [10c008a3a] +- Updated dependencies [f9fb4a205] +- Updated dependencies [16be1d093] + - @backstage/backend-common@0.8.0 + - @backstage/catalog-model@0.7.9 + ## 0.8.2 ### Patch Changes diff --git a/plugins/catalog-backend/package.json b/plugins/catalog-backend/package.json index c8e17bb943..dc9397de82 100644 --- a/plugins/catalog-backend/package.json +++ b/plugins/catalog-backend/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-catalog-backend", - "version": "0.8.2", + "version": "0.9.0", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,8 +30,8 @@ }, "dependencies": { "@azure/msal-node": "^1.0.0-beta.3", - "@backstage/backend-common": "^0.7.0", - "@backstage/catalog-model": "^0.7.8", + "@backstage/backend-common": "^0.8.0", + "@backstage/catalog-model": "^0.7.9", "@backstage/config": "^0.1.5", "@backstage/errors": "^0.1.1", "@backstage/integration": "^0.5.2", @@ -63,8 +63,8 @@ "yup": "^0.29.3" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/test-utils": "^0.1.9", + "@backstage/cli": "^0.6.11", + "@backstage/test-utils": "^0.1.11", "@types/core-js": "^2.5.4", "@types/git-url-parse": "^9.0.0", "@types/lodash": "^4.14.151", diff --git a/plugins/catalog-graphql/CHANGELOG.md b/plugins/catalog-graphql/CHANGELOG.md index 8140724840..c04cc8e3d2 100644 --- a/plugins/catalog-graphql/CHANGELOG.md +++ b/plugins/catalog-graphql/CHANGELOG.md @@ -1,5 +1,17 @@ # @backstage/plugin-catalog-graphql +## 0.2.9 + +### Patch Changes + +- 3be844496: chore: bump `ts-node` versions to 9.1.1 +- Updated dependencies [22fd8ce2a] +- Updated dependencies [10c008a3a] +- Updated dependencies [f9fb4a205] +- Updated dependencies [16be1d093] + - @backstage/backend-common@0.8.0 + - @backstage/catalog-model@0.7.9 + ## 0.2.8 ### Patch Changes diff --git a/plugins/catalog-graphql/package.json b/plugins/catalog-graphql/package.json index 983604ba03..5e0b8e49c2 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.8", + "version": "0.2.9", "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.7.0", - "@backstage/catalog-model": "^0.7.8", + "@backstage/backend-common": "^0.8.0", + "@backstage/catalog-model": "^0.7.9", "@backstage/config": "^0.1.5", "@graphql-modules/core": "^0.7.17", "apollo-server": "^2.16.1", @@ -42,8 +42,8 @@ "winston": "^3.2.1" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/test-utils": "^0.1.9", + "@backstage/cli": "^0.6.11", + "@backstage/test-utils": "^0.1.11", "@graphql-codegen/cli": "^1.21.3", "@graphql-codegen/typescript": "^1.17.7", "@graphql-codegen/typescript-resolvers": "^1.17.7", diff --git a/plugins/catalog-import/CHANGELOG.md b/plugins/catalog-import/CHANGELOG.md index 59baabfbc8..e41b135014 100644 --- a/plugins/catalog-import/CHANGELOG.md +++ b/plugins/catalog-import/CHANGELOG.md @@ -1,5 +1,22 @@ # @backstage/plugin-catalog-import +## 0.5.6 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/integration-react@0.1.2 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.5.5 ### Patch Changes diff --git a/plugins/catalog-import/package.json b/plugins/catalog-import/package.json index 0558be18ec..196b3d6e83 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.5", + "version": "0.5.6", "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.7.8", + "@backstage/catalog-model": "^0.7.9", "@backstage/catalog-client": "^0.3.11", - "@backstage/core": "^0.7.8", + "@backstage/core": "^0.7.9", "@backstage/integration": "^0.5.2", - "@backstage/integration-react": "^0.1.1", - "@backstage/plugin-catalog-react": "^0.1.5", + "@backstage/integration-react": "^0.1.2", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -53,9 +53,9 @@ "yaml": "^1.10.0" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/react-hooks": "^3.3.0", diff --git a/plugins/catalog-react/CHANGELOG.md b/plugins/catalog-react/CHANGELOG.md index e5a857eca0..c50b72d059 100644 --- a/plugins/catalog-react/CHANGELOG.md +++ b/plugins/catalog-react/CHANGELOG.md @@ -1,5 +1,20 @@ # @backstage/plugin-catalog-react +## 0.1.6 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/catalog-model@0.7.9 + ## 0.1.5 ### Patch Changes diff --git a/plugins/catalog-react/package.json b/plugins/catalog-react/package.json index 491df00c08..abce5a1996 100644 --- a/plugins/catalog-react/package.json +++ b/plugins/catalog-react/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-catalog-react", - "version": "0.1.5", + "version": "0.1.6", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -29,8 +29,8 @@ }, "dependencies": { "@backstage/catalog-client": "^0.3.11", - "@backstage/catalog-model": "^0.7.8", - "@backstage/core": "^0.7.8", + "@backstage/catalog-model": "^0.7.9", + "@backstage/core": "^0.7.9", "@material-ui/core": "^4.11.0", "@types/react": "^16.9", "lodash": "^4.17.15", @@ -40,9 +40,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.9", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/react-hooks": "^3.3.0", diff --git a/plugins/catalog/CHANGELOG.md b/plugins/catalog/CHANGELOG.md index d6254a347a..160440c69f 100644 --- a/plugins/catalog/CHANGELOG.md +++ b/plugins/catalog/CHANGELOG.md @@ -1,5 +1,23 @@ # @backstage/plugin-catalog +## 0.5.7 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 5542de095: This makes the CatalogTable configurable with custom columns, passed through the CatalogPage component rendered on the home page. +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/integration-react@0.1.2 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.5.6 ### Patch Changes diff --git a/plugins/catalog/package.json b/plugins/catalog/package.json index 140c42cfdb..6354f00c5d 100644 --- a/plugins/catalog/package.json +++ b/plugins/catalog/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-catalog", - "version": "0.5.6", + "version": "0.5.7", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,12 +31,12 @@ }, "dependencies": { "@backstage/catalog-client": "^0.3.10", - "@backstage/catalog-model": "^0.7.7", - "@backstage/core": "^0.7.8", + "@backstage/catalog-model": "^0.7.9", + "@backstage/core": "^0.7.9", "@backstage/errors": "^0.1.1", "@backstage/integration": "^0.5.1", - "@backstage/integration-react": "^0.1.1", - "@backstage/plugin-catalog-react": "^0.1.4", + "@backstage/integration-react": "^0.1.2", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -52,9 +52,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@microsoft/microsoft-graph-types": "^1.25.0", "@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 8c6d6e094d..d1347fde2a 100644 --- a/plugins/circleci/CHANGELOG.md +++ b/plugins/circleci/CHANGELOG.md @@ -1,5 +1,21 @@ # @backstage/plugin-circleci +## 0.2.14 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.2.13 ### Patch Changes diff --git a/plugins/circleci/package.json b/plugins/circleci/package.json index 4503f59636..e9b18c43d0 100644 --- a/plugins/circleci/package.json +++ b/plugins/circleci/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-circleci", - "version": "0.2.13", + "version": "0.2.14", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,9 +31,9 @@ "postpack": "backstage-cli postpack" }, "dependencies": { - "@backstage/catalog-model": "^0.7.3", - "@backstage/core": "^0.7.8", - "@backstage/plugin-catalog-react": "^0.1.2", + "@backstage/catalog-model": "^0.7.9", + "@backstage/core": "^0.7.9", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -50,9 +50,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/cloudbuild/CHANGELOG.md b/plugins/cloudbuild/CHANGELOG.md index dea818c97d..a7540f2e72 100644 --- a/plugins/cloudbuild/CHANGELOG.md +++ b/plugins/cloudbuild/CHANGELOG.md @@ -1,5 +1,21 @@ # @backstage/plugin-cloudbuild +## 0.2.14 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.2.13 ### Patch Changes diff --git a/plugins/cloudbuild/package.json b/plugins/cloudbuild/package.json index 59fbda33f6..510f417bc2 100644 --- a/plugins/cloudbuild/package.json +++ b/plugins/cloudbuild/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-cloudbuild", - "version": "0.2.13", + "version": "0.2.14", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,9 +30,9 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.7.3", - "@backstage/plugin-catalog-react": "^0.1.2", - "@backstage/core": "^0.7.8", + "@backstage/catalog-model": "^0.7.9", + "@backstage/plugin-catalog-react": "^0.1.6", + "@backstage/core": "^0.7.9", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -47,9 +47,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/code-coverage-backend/CHANGELOG.md b/plugins/code-coverage-backend/CHANGELOG.md index 18e78c7454..3322186cbe 100644 --- a/plugins/code-coverage-backend/CHANGELOG.md +++ b/plugins/code-coverage-backend/CHANGELOG.md @@ -1,5 +1,16 @@ # @backstage/plugin-code-coverage-backend +## 0.1.5 + +### Patch Changes + +- Updated dependencies [22fd8ce2a] +- Updated dependencies [10c008a3a] +- Updated dependencies [f9fb4a205] +- Updated dependencies [16be1d093] + - @backstage/backend-common@0.8.0 + - @backstage/catalog-model@0.7.9 + ## 0.1.4 ### Patch Changes diff --git a/plugins/code-coverage-backend/package.json b/plugins/code-coverage-backend/package.json index db53096932..5b73fe45f8 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.4", + "version": "0.1.5", "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.7.0", + "@backstage/backend-common": "^0.8.0", "@backstage/catalog-client": "^0.3.11", - "@backstage/catalog-model": "^0.7.8", + "@backstage/catalog-model": "^0.7.9", "@backstage/config": "^0.1.5", "@backstage/errors": "^0.1.1", "@backstage/integration": "^0.5.2", @@ -36,7 +36,7 @@ "yn": "^4.0.0" }, "devDependencies": { - "@backstage/cli": "^0.6.10", + "@backstage/cli": "^0.6.11", "@types/express-xml-bodyparser": "^0.3.2", "@types/supertest": "^2.0.8", "msw": "^0.21.2", diff --git a/plugins/code-coverage/CHANGELOG.md b/plugins/code-coverage/CHANGELOG.md index 4a55b7f0f5..6d1ea253a0 100644 --- a/plugins/code-coverage/CHANGELOG.md +++ b/plugins/code-coverage/CHANGELOG.md @@ -1,5 +1,21 @@ # @backstage/plugin-code-coverage +## 0.1.3 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.1.2 ### Patch Changes diff --git a/plugins/code-coverage/package.json b/plugins/code-coverage/package.json index 837c3d4794..f90985145f 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.2", + "version": "0.1.3", "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.7.7", + "@backstage/catalog-model": "^0.7.9", "@backstage/config": "^0.1.4", - "@backstage/core": "^0.7.8", + "@backstage/core": "^0.7.9", "@backstage/errors": "^0.1.1", - "@backstage/plugin-catalog-react": "^0.1.4", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -39,9 +39,9 @@ "recharts": "^1.8.5" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/config-schema/CHANGELOG.md b/plugins/config-schema/CHANGELOG.md new file mode 100644 index 0000000000..e54fc1a802 --- /dev/null +++ b/plugins/config-schema/CHANGELOG.md @@ -0,0 +1,13 @@ +# @backstage/plugin-config-schema + +## 0.1.2 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [889d89b6e] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 diff --git a/plugins/config-schema/package.json b/plugins/config-schema/package.json index 43c6e67f1a..c878f418d0 100644 --- a/plugins/config-schema/package.json +++ b/plugins/config-schema/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-config-schema", - "version": "0.1.1", + "version": "0.1.2", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -21,7 +21,7 @@ }, "dependencies": { "@backstage/config": "^0.1.4", - "@backstage/core": "^0.7.8", + "@backstage/core": "^0.7.9", "@backstage/errors": "^0.1.1", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", @@ -34,9 +34,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/cost-insights/CHANGELOG.md b/plugins/cost-insights/CHANGELOG.md index e6a351f2a4..a94910cfb2 100644 --- a/plugins/cost-insights/CHANGELOG.md +++ b/plugins/cost-insights/CHANGELOG.md @@ -1,5 +1,17 @@ # @backstage/plugin-cost-insights +## 0.9.1 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [889d89b6e] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + ## 0.9.0 ### Minor Changes diff --git a/plugins/cost-insights/package.json b/plugins/cost-insights/package.json index 3fd057aa4a..a467fc0542 100644 --- a/plugins/cost-insights/package.json +++ b/plugins/cost-insights/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-cost-insights", - "version": "0.9.0", + "version": "0.9.1", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,7 +31,7 @@ }, "dependencies": { "@backstage/config": "^0.1.5", - "@backstage/core": "^0.7.8", + "@backstage/core": "^0.7.9", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -55,9 +55,9 @@ "yup": "^0.29.3" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/explore-react/CHANGELOG.md b/plugins/explore-react/CHANGELOG.md index 4141daf2b6..17e3775c6d 100644 --- a/plugins/explore-react/CHANGELOG.md +++ b/plugins/explore-react/CHANGELOG.md @@ -1,5 +1,16 @@ # @backstage/plugin-explore-react +## 0.0.5 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- Updated dependencies [062bbf90f] +- Updated dependencies [889d89b6e] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + ## 0.0.4 ### Patch Changes diff --git a/plugins/explore-react/package.json b/plugins/explore-react/package.json index cf8c944433..5a8d082abe 100644 --- a/plugins/explore-react/package.json +++ b/plugins/explore-react/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-explore-react", - "version": "0.0.4", + "version": "0.0.5", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -28,12 +28,12 @@ "postpack": "backstage-cli postpack" }, "dependencies": { - "@backstage/core": "^0.7.1" + "@backstage/core": "^0.7.9" }, "devDependencies": { - "@backstage/cli": "^0.6.4", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.6", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/explore/CHANGELOG.md b/plugins/explore/CHANGELOG.md index 78275577f5..c3a756f928 100644 --- a/plugins/explore/CHANGELOG.md +++ b/plugins/explore/CHANGELOG.md @@ -1,5 +1,23 @@ # @backstage/plugin-explore +## 0.3.5 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 0b033d07b: Add "Organization" tab with a diagram +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/plugin-explore-react@0.0.5 + - @backstage/catalog-model@0.7.9 + ## 0.3.4 ### Patch Changes diff --git a/plugins/explore/package.json b/plugins/explore/package.json index 3069b719f0..d96c2f4d18 100644 --- a/plugins/explore/package.json +++ b/plugins/explore/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-explore", - "version": "0.3.4", + "version": "0.3.5", "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.7.5", - "@backstage/core": "^0.7.8", - "@backstage/plugin-catalog-react": "^0.1.4", - "@backstage/plugin-explore-react": "^0.0.4", + "@backstage/catalog-model": "^0.7.9", + "@backstage/core": "^0.7.9", + "@backstage/plugin-catalog-react": "^0.1.6", + "@backstage/plugin-explore-react": "^0.0.5", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -45,9 +45,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/fossa/CHANGELOG.md b/plugins/fossa/CHANGELOG.md index bd7af91dca..1c5de31c0c 100644 --- a/plugins/fossa/CHANGELOG.md +++ b/plugins/fossa/CHANGELOG.md @@ -1,5 +1,21 @@ # @backstage/plugin-fossa +## 0.2.7 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.2.6 ### Patch Changes diff --git a/plugins/fossa/package.json b/plugins/fossa/package.json index e6fa50f7da..51a6c5cf55 100644 --- a/plugins/fossa/package.json +++ b/plugins/fossa/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-fossa", - "version": "0.2.6", + "version": "0.2.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.7.3", - "@backstage/core": "^0.7.8", + "@backstage/catalog-model": "^0.7.9", + "@backstage/core": "^0.7.9", "@backstage/errors": "^0.1.1", - "@backstage/plugin-catalog-react": "^0.1.1", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -47,9 +47,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/gcp-projects/CHANGELOG.md b/plugins/gcp-projects/CHANGELOG.md index 8445cbb02b..3843a9519a 100644 --- a/plugins/gcp-projects/CHANGELOG.md +++ b/plugins/gcp-projects/CHANGELOG.md @@ -1,5 +1,17 @@ # @backstage/plugin-gcp-projects +## 0.2.6 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [889d89b6e] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + ## 0.2.5 ### Patch Changes diff --git a/plugins/gcp-projects/package.json b/plugins/gcp-projects/package.json index d50e63725e..6b0c625501 100644 --- a/plugins/gcp-projects/package.json +++ b/plugins/gcp-projects/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-gcp-projects", - "version": "0.2.5", + "version": "0.2.6", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,7 +30,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.7.8", + "@backstage/core": "^0.7.9", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -41,9 +41,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/git-release-manager/package.json b/plugins/git-release-manager/package.json index cae3bcdb70..cccb452b34 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": "^0.7.8", + "@backstage/core": "^0.7.9", "@backstage/integration": "^0.5.1", "@backstage/theme": "^0.2.7", "recharts": "^1.8.5", @@ -36,9 +36,9 @@ "react": "^16.13.1" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@types/recharts": "^1.8.15", "@testing-library/react-hooks": "^3.4.2", diff --git a/plugins/github-actions/CHANGELOG.md b/plugins/github-actions/CHANGELOG.md index aa2fec5512..f435ff31bc 100644 --- a/plugins/github-actions/CHANGELOG.md +++ b/plugins/github-actions/CHANGELOG.md @@ -1,5 +1,21 @@ # @backstage/plugin-github-actions +## 0.4.6 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.4.5 ### Patch Changes diff --git a/plugins/github-actions/package.json b/plugins/github-actions/package.json index 9bdbaf3c4b..841bb3ebc5 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.5", + "version": "0.4.6", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -32,9 +32,9 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.7.8", - "@backstage/plugin-catalog-react": "^0.1.5", - "@backstage/core": "^0.7.8", + "@backstage/catalog-model": "^0.7.9", + "@backstage/plugin-catalog-react": "^0.1.6", + "@backstage/core": "^0.7.9", "@backstage/integration": "^0.5.2", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", @@ -50,9 +50,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/github-deployments/CHANGELOG.md b/plugins/github-deployments/CHANGELOG.md index 23c8943349..3212382684 100644 --- a/plugins/github-deployments/CHANGELOG.md +++ b/plugins/github-deployments/CHANGELOG.md @@ -1,5 +1,23 @@ # @backstage/plugin-github-deployments +## 0.1.5 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- f5a916c49: Support for GitHub Enterprise with GithubDeploymentsPlugin +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/integration-react@0.1.2 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.1.4 ### Patch Changes diff --git a/plugins/github-deployments/package.json b/plugins/github-deployments/package.json index df85cb2a55..1058a30fed 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.4", + "version": "0.1.5", "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.7.6", - "@backstage/core": "^0.7.8", + "@backstage/catalog-model": "^0.7.9", + "@backstage/core": "^0.7.9", "@backstage/errors": "^0.1.1", "@backstage/integration": "^0.5.1", - "@backstage/integration-react": "^0.1.1", - "@backstage/plugin-catalog-react": "^0.1.3", + "@backstage/integration-react": "^0.1.2", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -37,9 +37,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/gitops-profiles/CHANGELOG.md b/plugins/gitops-profiles/CHANGELOG.md index b72e3c23c5..ae6672581f 100644 --- a/plugins/gitops-profiles/CHANGELOG.md +++ b/plugins/gitops-profiles/CHANGELOG.md @@ -1,5 +1,17 @@ # @backstage/plugin-gitops-profiles +## 0.2.7 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [889d89b6e] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + ## 0.2.6 ### Patch Changes diff --git a/plugins/gitops-profiles/package.json b/plugins/gitops-profiles/package.json index 21744a6f54..dbb84e4994 100644 --- a/plugins/gitops-profiles/package.json +++ b/plugins/gitops-profiles/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-gitops-profiles", - "version": "0.2.6", + "version": "0.2.7", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,7 +31,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.7.8", + "@backstage/core": "^0.7.9", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -42,9 +42,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/graphiql/CHANGELOG.md b/plugins/graphiql/CHANGELOG.md index 681005b13f..e0086af107 100644 --- a/plugins/graphiql/CHANGELOG.md +++ b/plugins/graphiql/CHANGELOG.md @@ -1,5 +1,17 @@ # @backstage/plugin-graphiql +## 0.2.11 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [889d89b6e] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + ## 0.2.10 ### Patch Changes diff --git a/plugins/graphiql/package.json b/plugins/graphiql/package.json index 053fbc066a..66c8790b8f 100644 --- a/plugins/graphiql/package.json +++ b/plugins/graphiql/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/plugin-graphiql", "description": "Backstage plugin for browsing GraphQL APIs", - "version": "0.2.10", + "version": "0.2.11", "private": false, "publishConfig": { "access": "public", @@ -31,7 +31,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.7.8", + "@backstage/core": "^0.7.9", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -43,9 +43,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/graphql/CHANGELOG.md b/plugins/graphql/CHANGELOG.md index fc31d831dc..2604a15230 100644 --- a/plugins/graphql/CHANGELOG.md +++ b/plugins/graphql/CHANGELOG.md @@ -1,5 +1,15 @@ # @backstage/plugin-graphql-backend +## 0.1.8 + +### Patch Changes + +- Updated dependencies [3be844496] +- Updated dependencies [22fd8ce2a] +- Updated dependencies [f9fb4a205] + - @backstage/plugin-catalog-graphql@0.2.9 + - @backstage/backend-common@0.8.0 + ## 0.1.7 ### Patch Changes diff --git a/plugins/graphql/package.json b/plugins/graphql/package.json index 0df78298d7..619df1d33b 100644 --- a/plugins/graphql/package.json +++ b/plugins/graphql/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-graphql-backend", - "version": "0.1.7", + "version": "0.1.8", "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.7.0", + "@backstage/backend-common": "^0.8.0", "@backstage/config": "^0.1.5", - "@backstage/plugin-catalog-graphql": "^0.2.8", + "@backstage/plugin-catalog-graphql": "^0.2.9", "@graphql-modules/core": "^0.7.17", "@types/express": "^4.17.6", "apollo-server": "^2.16.1", @@ -45,7 +45,7 @@ "yn": "^4.0.0" }, "devDependencies": { - "@backstage/cli": "^0.6.10", + "@backstage/cli": "^0.6.11", "@types/supertest": "^2.0.8", "eslint-plugin-graphql": "^4.0.0", "msw": "^0.20.5", diff --git a/plugins/jenkins/CHANGELOG.md b/plugins/jenkins/CHANGELOG.md index ac734e9a95..79e204b350 100644 --- a/plugins/jenkins/CHANGELOG.md +++ b/plugins/jenkins/CHANGELOG.md @@ -1,5 +1,21 @@ # @backstage/plugin-jenkins +## 0.4.3 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.4.2 ### Patch Changes diff --git a/plugins/jenkins/package.json b/plugins/jenkins/package.json index aa57fa1d1a..d14a18ffe7 100644 --- a/plugins/jenkins/package.json +++ b/plugins/jenkins/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-jenkins", - "version": "0.4.2", + "version": "0.4.3", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,9 +31,9 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.7.3", - "@backstage/core": "^0.7.8", - "@backstage/plugin-catalog-react": "^0.1.3", + "@backstage/catalog-model": "^0.7.9", + "@backstage/core": "^0.7.9", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -47,9 +47,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/kafka-backend/CHANGELOG.md b/plugins/kafka-backend/CHANGELOG.md index ef006a360f..b71ac92e5a 100644 --- a/plugins/kafka-backend/CHANGELOG.md +++ b/plugins/kafka-backend/CHANGELOG.md @@ -1,5 +1,16 @@ # @backstage/plugin-kafka-backend +## 0.2.5 + +### Patch Changes + +- Updated dependencies [22fd8ce2a] +- Updated dependencies [10c008a3a] +- Updated dependencies [f9fb4a205] +- Updated dependencies [16be1d093] + - @backstage/backend-common@0.8.0 + - @backstage/catalog-model@0.7.9 + ## 0.2.4 ### Patch Changes diff --git a/plugins/kafka-backend/package.json b/plugins/kafka-backend/package.json index 3e3f22654a..14bbfef486 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.4", + "version": "0.2.5", "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.7.0", - "@backstage/catalog-model": "^0.7.8", + "@backstage/backend-common": "^0.8.0", + "@backstage/catalog-model": "^0.7.9", "@backstage/config": "^0.1.5", "@types/express": "^4.17.6", "express": "^4.17.1", @@ -42,7 +42,7 @@ "winston": "^3.2.1" }, "devDependencies": { - "@backstage/cli": "^0.6.10", + "@backstage/cli": "^0.6.11", "@types/jest-when": "^2.7.2", "@types/lodash": "^4.14.151", "jest-when": "^3.1.0", diff --git a/plugins/kafka/CHANGELOG.md b/plugins/kafka/CHANGELOG.md index f1c4c215ed..67c70c321d 100644 --- a/plugins/kafka/CHANGELOG.md +++ b/plugins/kafka/CHANGELOG.md @@ -1,5 +1,21 @@ # @backstage/plugin-kafka +## 0.2.7 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.2.6 ### Patch Changes diff --git a/plugins/kafka/package.json b/plugins/kafka/package.json index e18d5188d0..b6c600a90c 100644 --- a/plugins/kafka/package.json +++ b/plugins/kafka/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-kafka", - "version": "0.2.6", + "version": "0.2.7", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -20,9 +20,9 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.7.4", - "@backstage/core": "^0.7.8", - "@backstage/plugin-catalog-react": "^0.1.1", + "@backstage/catalog-model": "^0.7.9", + "@backstage/core": "^0.7.9", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -33,9 +33,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/react-hooks": "^3.4.2", diff --git a/plugins/kubernetes-backend/CHANGELOG.md b/plugins/kubernetes-backend/CHANGELOG.md index a9893925e2..265b7eb414 100644 --- a/plugins/kubernetes-backend/CHANGELOG.md +++ b/plugins/kubernetes-backend/CHANGELOG.md @@ -1,5 +1,17 @@ # @backstage/plugin-kubernetes-backend +## 0.3.7 + +### Patch Changes + +- f9f9d633d: Add possibility to configure TLS verification for `gke` type clusters +- Updated dependencies [22fd8ce2a] +- Updated dependencies [10c008a3a] +- Updated dependencies [f9fb4a205] +- Updated dependencies [16be1d093] + - @backstage/backend-common@0.8.0 + - @backstage/catalog-model@0.7.9 + ## 0.3.6 ### Patch Changes diff --git a/plugins/kubernetes-backend/package.json b/plugins/kubernetes-backend/package.json index f73166d5fc..9e438ce788 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.6", + "version": "0.3.7", "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.7.0", - "@backstage/catalog-model": "^0.7.8", + "@backstage/backend-common": "^0.8.0", + "@backstage/catalog-model": "^0.7.9", "@backstage/config": "^0.1.5", "@backstage/plugin-kubernetes-common": "^0.1.0", "@google-cloud/container": "^2.2.0", @@ -53,7 +53,7 @@ "yn": "^4.0.0" }, "devDependencies": { - "@backstage/cli": "^0.6.10", + "@backstage/cli": "^0.6.11", "@types/aws4": "^1.5.1", "supertest": "^6.1.3" }, diff --git a/plugins/kubernetes/CHANGELOG.md b/plugins/kubernetes/CHANGELOG.md index d78842f351..cca63f6389 100644 --- a/plugins/kubernetes/CHANGELOG.md +++ b/plugins/kubernetes/CHANGELOG.md @@ -1,5 +1,22 @@ # @backstage/plugin-kubernetes +## 0.4.4 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- ea21d46f0: Export types +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.4.3 ### Patch Changes diff --git a/plugins/kubernetes/package.json b/plugins/kubernetes/package.json index aaa55fef13..5036e08852 100644 --- a/plugins/kubernetes/package.json +++ b/plugins/kubernetes/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-kubernetes", - "version": "0.4.3", + "version": "0.4.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.7.8", + "@backstage/catalog-model": "^0.7.9", "@backstage/config": "^0.1.5", - "@backstage/core": "^0.7.8", - "@backstage/plugin-catalog-react": "^0.1.5", + "@backstage/core": "^0.7.9", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/plugin-kubernetes-common": "^0.1.0", "@backstage/theme": "^0.2.7", "@kubernetes/client-node": "^0.14.0", @@ -49,9 +49,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/react-hooks": "^3.4.2", diff --git a/plugins/lighthouse/CHANGELOG.md b/plugins/lighthouse/CHANGELOG.md index cb2cb5b9d1..d9b9b541d0 100644 --- a/plugins/lighthouse/CHANGELOG.md +++ b/plugins/lighthouse/CHANGELOG.md @@ -1,5 +1,21 @@ # @backstage/plugin-lighthouse +## 0.2.16 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.2.15 ### Patch Changes diff --git a/plugins/lighthouse/package.json b/plugins/lighthouse/package.json index 039f8b6dce..68f4722157 100644 --- a/plugins/lighthouse/package.json +++ b/plugins/lighthouse/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-lighthouse", - "version": "0.2.15", + "version": "0.2.16", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,10 +31,10 @@ "start": "backstage-cli plugin:serve" }, "dependencies": { - "@backstage/catalog-model": "^0.7.3", + "@backstage/catalog-model": "^0.7.9", "@backstage/config": "^0.1.4", - "@backstage/core": "^0.7.8", - "@backstage/plugin-catalog-react": "^0.1.2", + "@backstage/core": "^0.7.9", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -46,9 +46,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/newrelic/CHANGELOG.md b/plugins/newrelic/CHANGELOG.md index f2745796d8..2091ef6a1d 100644 --- a/plugins/newrelic/CHANGELOG.md +++ b/plugins/newrelic/CHANGELOG.md @@ -1,5 +1,17 @@ # @backstage/plugin-newrelic +## 0.2.7 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [889d89b6e] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + ## 0.2.6 ### Patch Changes diff --git a/plugins/newrelic/package.json b/plugins/newrelic/package.json index 96ef75b532..7938f19100 100644 --- a/plugins/newrelic/package.json +++ b/plugins/newrelic/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-newrelic", - "version": "0.2.6", + "version": "0.2.7", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,7 +31,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.7.8", + "@backstage/core": "^0.7.9", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -41,9 +41,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/org/CHANGELOG.md b/plugins/org/CHANGELOG.md index c62c618ff4..33ef38a7c2 100644 --- a/plugins/org/CHANGELOG.md +++ b/plugins/org/CHANGELOG.md @@ -1,5 +1,23 @@ # @backstage/plugin-org +## 0.3.13 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- f59a945b7: Paginate group members to only display 50 members maximum. +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/core-api@0.2.18 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.3.12 ### Patch Changes diff --git a/plugins/org/package.json b/plugins/org/package.json index a0bb1ba06e..4f8e37fa99 100644 --- a/plugins/org/package.json +++ b/plugins/org/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-org", - "version": "0.3.12", + "version": "0.3.13", "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.7.6", - "@backstage/core": "^0.7.8", - "@backstage/core-api": "^0.2.16", - "@backstage/plugin-catalog-react": "^0.1.4", + "@backstage/catalog-model": "^0.7.9", + "@backstage/core": "^0.7.9", + "@backstage/core-api": "^0.2.18", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -35,9 +35,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/pagerduty/CHANGELOG.md b/plugins/pagerduty/CHANGELOG.md index b7fc7fec40..21e79445b0 100644 --- a/plugins/pagerduty/CHANGELOG.md +++ b/plugins/pagerduty/CHANGELOG.md @@ -1,5 +1,21 @@ # @backstage/plugin-pagerduty +## 0.3.4 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.3.3 ### Patch Changes diff --git a/plugins/pagerduty/package.json b/plugins/pagerduty/package.json index 7cbb0a21b7..b3fbc37569 100644 --- a/plugins/pagerduty/package.json +++ b/plugins/pagerduty/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-pagerduty", - "version": "0.3.3", + "version": "0.3.4", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,9 +30,9 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.7.3", - "@backstage/core": "^0.7.8", - "@backstage/plugin-catalog-react": "^0.1.1", + "@backstage/catalog-model": "^0.7.9", + "@backstage/core": "^0.7.9", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -46,9 +46,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/proxy-backend/CHANGELOG.md b/plugins/proxy-backend/CHANGELOG.md index 06a96576e6..2890039b96 100644 --- a/plugins/proxy-backend/CHANGELOG.md +++ b/plugins/proxy-backend/CHANGELOG.md @@ -1,5 +1,13 @@ # @backstage/plugin-proxy-backend +## 0.2.8 + +### Patch Changes + +- Updated dependencies [22fd8ce2a] +- Updated dependencies [f9fb4a205] + - @backstage/backend-common@0.8.0 + ## 0.2.7 ### Patch Changes diff --git a/plugins/proxy-backend/package.json b/plugins/proxy-backend/package.json index 2c6fc9e08d..d2b0d64678 100644 --- a/plugins/proxy-backend/package.json +++ b/plugins/proxy-backend/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-proxy-backend", - "version": "0.2.7", + "version": "0.2.8", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -28,7 +28,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.7.0", + "@backstage/backend-common": "^0.8.0", "@backstage/config": "^0.1.5", "@types/express": "^4.17.6", "express": "^4.17.1", @@ -42,7 +42,7 @@ "yup": "^0.29.3" }, "devDependencies": { - "@backstage/cli": "^0.6.10", + "@backstage/cli": "^0.6.11", "@types/http-proxy-middleware": "^0.19.3", "@types/supertest": "^2.0.8", "@types/uuid": "^8.0.0", diff --git a/plugins/register-component/CHANGELOG.md b/plugins/register-component/CHANGELOG.md index 3634972e9a..ae0ae6562b 100644 --- a/plugins/register-component/CHANGELOG.md +++ b/plugins/register-component/CHANGELOG.md @@ -1,5 +1,21 @@ # @backstage/plugin-register-component +## 0.2.15 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.2.14 ### Patch Changes diff --git a/plugins/register-component/package.json b/plugins/register-component/package.json index 376526a059..d10bdcfc38 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.14", + "version": "0.2.15", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,9 +30,9 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.7.5", - "@backstage/core": "^0.7.8", - "@backstage/plugin-catalog-react": "^0.1.4", + "@backstage/catalog-model": "^0.7.9", + "@backstage/core": "^0.7.9", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -45,9 +45,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/rollbar-backend/CHANGELOG.md b/plugins/rollbar-backend/CHANGELOG.md index 9aa0d77e69..0318d3a111 100644 --- a/plugins/rollbar-backend/CHANGELOG.md +++ b/plugins/rollbar-backend/CHANGELOG.md @@ -1,5 +1,13 @@ # @backstage/plugin-rollbar-backend +## 0.1.11 + +### Patch Changes + +- Updated dependencies [22fd8ce2a] +- Updated dependencies [f9fb4a205] + - @backstage/backend-common@0.8.0 + ## 0.1.10 ### Patch Changes diff --git a/plugins/rollbar-backend/package.json b/plugins/rollbar-backend/package.json index c7eb819dc1..03be93dbfa 100644 --- a/plugins/rollbar-backend/package.json +++ b/plugins/rollbar-backend/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-rollbar-backend", - "version": "0.1.10", + "version": "0.1.11", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,7 +30,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.7.0", + "@backstage/backend-common": "^0.8.0", "@backstage/config": "^0.1.5", "@types/express": "^4.17.6", "axios": "^0.21.1", @@ -47,7 +47,7 @@ "yn": "^4.0.0" }, "devDependencies": { - "@backstage/cli": "^0.6.10", + "@backstage/cli": "^0.6.11", "@types/supertest": "^2.0.8", "supertest": "^6.1.3" }, diff --git a/plugins/rollbar/CHANGELOG.md b/plugins/rollbar/CHANGELOG.md index 1d8c2c399e..26b9913df2 100644 --- a/plugins/rollbar/CHANGELOG.md +++ b/plugins/rollbar/CHANGELOG.md @@ -1,5 +1,21 @@ # @backstage/plugin-rollbar +## 0.3.5 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.3.4 ### Patch Changes diff --git a/plugins/rollbar/package.json b/plugins/rollbar/package.json index 3e1f7e4964..37ada55f5f 100644 --- a/plugins/rollbar/package.json +++ b/plugins/rollbar/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-rollbar", - "version": "0.3.4", + "version": "0.3.5", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,9 +31,9 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.7.3", - "@backstage/core": "^0.7.8", - "@backstage/plugin-catalog-react": "^0.1.1", + "@backstage/catalog-model": "^0.7.9", + "@backstage/core": "^0.7.9", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -47,9 +47,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/react-hooks": "^3.3.0", diff --git a/plugins/scaffolder-backend/CHANGELOG.md b/plugins/scaffolder-backend/CHANGELOG.md index 987109e62f..cdb8fd734b 100644 --- a/plugins/scaffolder-backend/CHANGELOG.md +++ b/plugins/scaffolder-backend/CHANGELOG.md @@ -1,5 +1,19 @@ # @backstage/plugin-scaffolder-backend +## 0.11.1 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 82ca1ac22: The apiBaseUrl setting for Bitbucket Server integrations will now be used when it is set. Otherwise, it will default back to the host setting. +- fd39d4662: Move `jest-when` to the dev dependencies +- Updated dependencies [22fd8ce2a] +- Updated dependencies [10c008a3a] +- Updated dependencies [f9fb4a205] +- Updated dependencies [16be1d093] + - @backstage/backend-common@0.8.0 + - @backstage/catalog-model@0.7.9 + ## 0.11.0 ### Minor Changes diff --git a/plugins/scaffolder-backend/package.json b/plugins/scaffolder-backend/package.json index 7452d94c63..2565a9d05a 100644 --- a/plugins/scaffolder-backend/package.json +++ b/plugins/scaffolder-backend/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-scaffolder-backend", - "version": "0.11.0", + "version": "0.11.1", "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.7.0", + "@backstage/backend-common": "^0.8.0", "@backstage/catalog-client": "^0.3.11", - "@backstage/catalog-model": "^0.7.8", + "@backstage/catalog-model": "^0.7.9", "@backstage/config": "^0.1.5", "@backstage/errors": "^0.1.1", "@backstage/integration": "^0.5.2", @@ -64,8 +64,8 @@ "yaml": "^1.10.0" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/test-utils": "^0.1.11", "@types/fs-extra": "^9.0.1", "@types/mock-fs": "^4.13.0", "@types/supertest": "^2.0.8", diff --git a/plugins/scaffolder/CHANGELOG.md b/plugins/scaffolder/CHANGELOG.md index b67740ecc1..7e55dabc55 100644 --- a/plugins/scaffolder/CHANGELOG.md +++ b/plugins/scaffolder/CHANGELOG.md @@ -1,5 +1,23 @@ # @backstage/plugin-scaffolder +## 0.9.4 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 81ef1d57b: Show error on task page if task does not exist. +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/integration-react@0.1.2 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.9.3 ### Patch Changes diff --git a/plugins/scaffolder/package.json b/plugins/scaffolder/package.json index e21e457c6c..a29251f705 100644 --- a/plugins/scaffolder/package.json +++ b/plugins/scaffolder/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-scaffolder", - "version": "0.9.3", + "version": "0.9.4", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,13 +31,13 @@ }, "dependencies": { "@backstage/catalog-client": "^0.3.11", - "@backstage/catalog-model": "^0.7.8", + "@backstage/catalog-model": "^0.7.9", "@backstage/config": "^0.1.5", "@backstage/errors": "^0.1.1", - "@backstage/core": "^0.7.8", + "@backstage/core": "^0.7.9", "@backstage/integration": "^0.5.2", - "@backstage/integration-react": "^0.1.1", - "@backstage/plugin-catalog-react": "^0.1.5", + "@backstage/integration-react": "^0.1.2", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -60,9 +60,9 @@ "zen-observable": "^0.8.15" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/search-backend-node/package.json b/plugins/search-backend-node/package.json index 99077b9b62..23234aca2f 100644 --- a/plugins/search-backend-node/package.json +++ b/plugins/search-backend-node/package.json @@ -25,8 +25,8 @@ "@types/lunr": "^2.3.3" }, "devDependencies": { - "@backstage/backend-common": "^0.7.0", - "@backstage/cli": "^0.6.10" + "@backstage/backend-common": "^0.8.0", + "@backstage/cli": "^0.6.11" }, "files": [ "dist" diff --git a/plugins/search-backend/CHANGELOG.md b/plugins/search-backend/CHANGELOG.md index fd429aae62..9d34d92575 100644 --- a/plugins/search-backend/CHANGELOG.md +++ b/plugins/search-backend/CHANGELOG.md @@ -1,5 +1,13 @@ # @backstage/plugin-search-backend +## 0.1.5 + +### Patch Changes + +- Updated dependencies [22fd8ce2a] +- Updated dependencies [f9fb4a205] + - @backstage/backend-common@0.8.0 + ## 0.1.4 ### Patch Changes diff --git a/plugins/search-backend/package.json b/plugins/search-backend/package.json index 4de8ada9bc..c06f54a266 100644 --- a/plugins/search-backend/package.json +++ b/plugins/search-backend/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-search-backend", - "version": "0.1.4", + "version": "0.1.5", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -19,7 +19,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.7.0", + "@backstage/backend-common": "^0.8.0", "@backstage/search-common": "^0.1.1", "@backstage/plugin-search-backend-node": "^0.1.3", "@types/express": "^4.17.6", @@ -29,7 +29,7 @@ "yn": "^4.0.0" }, "devDependencies": { - "@backstage/cli": "^0.6.10", + "@backstage/cli": "^0.6.11", "@types/supertest": "^2.0.8", "supertest": "^6.1.3" }, diff --git a/plugins/search/CHANGELOG.md b/plugins/search/CHANGELOG.md index b4bcd1f855..9c0ab2fa8c 100644 --- a/plugins/search/CHANGELOG.md +++ b/plugins/search/CHANGELOG.md @@ -1,5 +1,21 @@ # @backstage/plugin-search +## 0.3.6 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.3.5 ### Patch Changes diff --git a/plugins/search/package.json b/plugins/search/package.json index ee7d15ddc3..7593a2901d 100644 --- a/plugins/search/package.json +++ b/plugins/search/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-search", - "version": "0.3.5", + "version": "0.3.6", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -29,9 +29,9 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.7.8", - "@backstage/catalog-model": "^0.7.3", - "@backstage/plugin-catalog-react": "^0.1.2", + "@backstage/core": "^0.7.9", + "@backstage/catalog-model": "^0.7.9", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/search-common": "^0.1.1", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", @@ -44,9 +44,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/sentry/CHANGELOG.md b/plugins/sentry/CHANGELOG.md index 261972384a..b22b5539ef 100644 --- a/plugins/sentry/CHANGELOG.md +++ b/plugins/sentry/CHANGELOG.md @@ -1,5 +1,21 @@ # @backstage/plugin-sentry +## 0.3.10 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.3.9 ### Patch Changes diff --git a/plugins/sentry/package.json b/plugins/sentry/package.json index d33b57e975..7da547dd94 100644 --- a/plugins/sentry/package.json +++ b/plugins/sentry/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-sentry", - "version": "0.3.9", + "version": "0.3.10", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -31,9 +31,9 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.7.3", - "@backstage/core": "^0.7.8", - "@backstage/plugin-catalog-react": "^0.1.1", + "@backstage/catalog-model": "^0.7.9", + "@backstage/core": "^0.7.9", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -46,9 +46,9 @@ "timeago.js": "^4.0.2" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/shortcuts/CHANGELOG.md b/plugins/shortcuts/CHANGELOG.md new file mode 100644 index 0000000000..bdc4b3adba --- /dev/null +++ b/plugins/shortcuts/CHANGELOG.md @@ -0,0 +1,12 @@ +# @backstage/plugin-shortcuts + +## 0.1.2 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- Updated dependencies [062bbf90f] +- Updated dependencies [889d89b6e] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 diff --git a/plugins/shortcuts/package.json b/plugins/shortcuts/package.json index a0f8a0c498..aea2f8461e 100644 --- a/plugins/shortcuts/package.json +++ b/plugins/shortcuts/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-shortcuts", - "version": "0.1.1", + "version": "0.1.2", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -20,7 +20,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.7.8", + "@backstage/core": "^0.7.9", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -35,9 +35,9 @@ "zen-observable": "^0.8.15" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/sonarqube/CHANGELOG.md b/plugins/sonarqube/CHANGELOG.md index 48b9292791..e457d2bdf9 100644 --- a/plugins/sonarqube/CHANGELOG.md +++ b/plugins/sonarqube/CHANGELOG.md @@ -1,5 +1,21 @@ # @backstage/plugin-sonarqube +## 0.1.18 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.1.17 ### Patch Changes diff --git a/plugins/sonarqube/package.json b/plugins/sonarqube/package.json index 6b7e5ff4d9..9e3d6bf03b 100644 --- a/plugins/sonarqube/package.json +++ b/plugins/sonarqube/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-sonarqube", - "version": "0.1.17", + "version": "0.1.18", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -32,9 +32,9 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.7.7", - "@backstage/plugin-catalog-react": "^0.1.3", - "@backstage/core": "^0.7.8", + "@backstage/catalog-model": "^0.7.9", + "@backstage/plugin-catalog-react": "^0.1.6", + "@backstage/core": "^0.7.9", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -47,9 +47,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/splunk-on-call/CHANGELOG.md b/plugins/splunk-on-call/CHANGELOG.md index b3151c3e04..4f34ea3bcc 100644 --- a/plugins/splunk-on-call/CHANGELOG.md +++ b/plugins/splunk-on-call/CHANGELOG.md @@ -1,5 +1,21 @@ # @backstage/plugin-splunk-on-call +## 0.2.1 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.2.0 ### Minor Changes diff --git a/plugins/splunk-on-call/package.json b/plugins/splunk-on-call/package.json index 4ec6e6a0f4..ebb6fdb42e 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.2.0", + "version": "0.2.1", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,9 +30,9 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.7.4", - "@backstage/core": "^0.7.8", - "@backstage/plugin-catalog-react": "^0.1.1", + "@backstage/catalog-model": "^0.7.9", + "@backstage/core": "^0.7.9", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -45,9 +45,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/tech-radar/CHANGELOG.md b/plugins/tech-radar/CHANGELOG.md index 9f0a5b87c3..64f255adb1 100644 --- a/plugins/tech-radar/CHANGELOG.md +++ b/plugins/tech-radar/CHANGELOG.md @@ -1,5 +1,17 @@ # @backstage/plugin-tech-radar +## 0.3.11 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [889d89b6e] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + ## 0.3.10 ### Patch Changes diff --git a/plugins/tech-radar/package.json b/plugins/tech-radar/package.json index 538511565b..e65e3d27a7 100644 --- a/plugins/tech-radar/package.json +++ b/plugins/tech-radar/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-tech-radar", - "version": "0.3.10", + "version": "0.3.11", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,7 +30,7 @@ "start": "backstage-cli plugin:serve" }, "dependencies": { - "@backstage/core": "^0.7.8", + "@backstage/core": "^0.7.9", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -43,9 +43,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/techdocs-backend/CHANGELOG.md b/plugins/techdocs-backend/CHANGELOG.md index 59a116f653..4b348d49a4 100644 --- a/plugins/techdocs-backend/CHANGELOG.md +++ b/plugins/techdocs-backend/CHANGELOG.md @@ -1,5 +1,18 @@ # @backstage/plugin-techdocs-backend +## 0.8.1 + +### Patch Changes + +- Updated dependencies [22fd8ce2a] +- Updated dependencies [10c008a3a] +- Updated dependencies [f9fb4a205] +- Updated dependencies [16be1d093] +- Updated dependencies [e04f1ccfb] + - @backstage/backend-common@0.8.0 + - @backstage/catalog-model@0.7.9 + - @backstage/techdocs-common@0.6.1 + ## 0.8.0 ### Minor Changes diff --git a/plugins/techdocs-backend/package.json b/plugins/techdocs-backend/package.json index 1424381f30..a702f63622 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.0", + "version": "0.8.1", "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.7.0", - "@backstage/catalog-model": "^0.7.8", + "@backstage/backend-common": "^0.8.0", + "@backstage/catalog-model": "^0.7.9", "@backstage/config": "^0.1.5", "@backstage/errors": "^0.1.1", - "@backstage/techdocs-common": "^0.6.0", + "@backstage/techdocs-common": "^0.6.1", "@types/express": "^4.17.6", "cross-fetch": "^3.0.6", "dockerode": "^3.2.1", @@ -45,7 +45,7 @@ "winston": "^3.2.1" }, "devDependencies": { - "@backstage/cli": "^0.6.10", + "@backstage/cli": "^0.6.11", "@types/dockerode": "^3.2.1", "supertest": "^6.1.3" }, diff --git a/plugins/techdocs/CHANGELOG.md b/plugins/techdocs/CHANGELOG.md index 69e988a433..8382ef9419 100644 --- a/plugins/techdocs/CHANGELOG.md +++ b/plugins/techdocs/CHANGELOG.md @@ -1,5 +1,22 @@ # @backstage/plugin-techdocs +## 0.9.2 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/integration-react@0.1.2 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 + ## 0.9.1 ### Patch Changes diff --git a/plugins/techdocs/package.json b/plugins/techdocs/package.json index 87cb1185a0..ce748f836d 100644 --- a/plugins/techdocs/package.json +++ b/plugins/techdocs/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-techdocs", - "version": "0.9.1", + "version": "0.9.2", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -32,11 +32,11 @@ }, "dependencies": { "@backstage/config": "^0.1.5", - "@backstage/catalog-model": "^0.7.8", - "@backstage/core": "^0.7.8", + "@backstage/catalog-model": "^0.7.9", + "@backstage/core": "^0.7.9", "@backstage/integration": "^0.5.2", - "@backstage/integration-react": "^0.1.1", - "@backstage/plugin-catalog-react": "^0.1.5", + "@backstage/integration-react": "^0.1.2", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@backstage/errors": "^0.1.1", "@material-ui/core": "^4.11.0", @@ -51,9 +51,9 @@ "sanitize-html": "^2.3.2" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/todo-backend/CHANGELOG.md b/plugins/todo-backend/CHANGELOG.md index b42f631a98..ebe3c2003c 100644 --- a/plugins/todo-backend/CHANGELOG.md +++ b/plugins/todo-backend/CHANGELOG.md @@ -1,5 +1,16 @@ # @backstage/plugin-todo-backend +## 0.1.5 + +### Patch Changes + +- Updated dependencies [22fd8ce2a] +- Updated dependencies [10c008a3a] +- Updated dependencies [f9fb4a205] +- Updated dependencies [16be1d093] + - @backstage/backend-common@0.8.0 + - @backstage/catalog-model@0.7.9 + ## 0.1.4 ### Patch Changes diff --git a/plugins/todo-backend/package.json b/plugins/todo-backend/package.json index 1af9f9b40c..5225adb648 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.4", + "version": "0.1.5", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -24,9 +24,9 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.7.0", + "@backstage/backend-common": "^0.8.0", "@backstage/catalog-client": "^0.3.11", - "@backstage/catalog-model": "^0.7.8", + "@backstage/catalog-model": "^0.7.9", "@backstage/config": "^0.1.5", "@backstage/errors": "^0.1.1", "@backstage/integration": "^0.5.2", @@ -39,7 +39,7 @@ "yn": "^4.0.0" }, "devDependencies": { - "@backstage/cli": "^0.6.10", + "@backstage/cli": "^0.6.11", "@types/supertest": "^2.0.8", "msw": "^0.21.2", "supertest": "^6.1.3" diff --git a/plugins/todo/CHANGELOG.md b/plugins/todo/CHANGELOG.md new file mode 100644 index 0000000000..f3732c923e --- /dev/null +++ b/plugins/todo/CHANGELOG.md @@ -0,0 +1,17 @@ +# @backstage/plugin-todo + +## 0.1.1 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [10c008a3a] +- Updated dependencies [889d89b6e] +- Updated dependencies [16be1d093] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + - @backstage/plugin-catalog-react@0.1.6 + - @backstage/catalog-model@0.7.9 diff --git a/plugins/todo/package.json b/plugins/todo/package.json index 8a3d327929..c9a9f4bb51 100644 --- a/plugins/todo/package.json +++ b/plugins/todo/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-todo", - "version": "0.1.0", + "version": "0.1.1", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -26,10 +26,10 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.7.3", - "@backstage/core": "^0.7.8", + "@backstage/catalog-model": "^0.7.9", + "@backstage/core": "^0.7.9", "@backstage/errors": "^0.1.1", - "@backstage/plugin-catalog-react": "^0.1.1", + "@backstage/plugin-catalog-react": "^0.1.6", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -39,9 +39,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/user-settings/CHANGELOG.md b/plugins/user-settings/CHANGELOG.md index f6f3046bef..5b1706e0c7 100644 --- a/plugins/user-settings/CHANGELOG.md +++ b/plugins/user-settings/CHANGELOG.md @@ -1,5 +1,17 @@ # @backstage/plugin-user-settings +## 0.2.10 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [889d89b6e] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + ## 0.2.9 ### Patch Changes diff --git a/plugins/user-settings/package.json b/plugins/user-settings/package.json index b52584267c..f47f5b50af 100644 --- a/plugins/user-settings/package.json +++ b/plugins/user-settings/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-user-settings", - "version": "0.2.9", + "version": "0.2.10", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -30,7 +30,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.7.8", + "@backstage/core": "^0.7.9", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -41,9 +41,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", diff --git a/plugins/welcome/CHANGELOG.md b/plugins/welcome/CHANGELOG.md index cf907b5b4f..53ffd59264 100644 --- a/plugins/welcome/CHANGELOG.md +++ b/plugins/welcome/CHANGELOG.md @@ -1,5 +1,17 @@ # @backstage/plugin-welcome +## 0.2.8 + +### Patch Changes + +- 062bbf90f: chore: bump `@testing-library/user-event` from 12.8.3 to 13.1.8 +- 675a569a9: chore: bump `react-use` dependency in all packages +- Updated dependencies [062bbf90f] +- Updated dependencies [889d89b6e] +- Updated dependencies [3f988cb63] +- Updated dependencies [675a569a9] + - @backstage/core@0.7.9 + ## 0.2.7 ### Patch Changes diff --git a/plugins/welcome/package.json b/plugins/welcome/package.json index 5f557f00b1..df16ec7f4d 100644 --- a/plugins/welcome/package.json +++ b/plugins/welcome/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-welcome", - "version": "0.2.7", + "version": "0.2.8", "main": "src/index.ts", "types": "src/index.ts", "private": false, @@ -30,7 +30,7 @@ "start": "backstage-cli plugin:serve" }, "dependencies": { - "@backstage/core": "^0.7.8", + "@backstage/core": "^0.7.9", "@backstage/theme": "^0.2.7", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", @@ -41,9 +41,9 @@ "react-use": "^17.2.4" }, "devDependencies": { - "@backstage/cli": "^0.6.10", - "@backstage/dev-utils": "^0.1.13", - "@backstage/test-utils": "^0.1.10", + "@backstage/cli": "^0.6.11", + "@backstage/dev-utils": "^0.1.14", + "@backstage/test-utils": "^0.1.11", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", From 5b8638c15eb9e4bac91b3c36d1a0640dec70ae25 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 12 May 2021 11:30:32 +0200 Subject: [PATCH 485/485] chore: fix the create-app version Signed-off-by: blam --- packages/create-app/CHANGELOG.md | 2 +- packages/create-app/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/create-app/CHANGELOG.md b/packages/create-app/CHANGELOG.md index 5d4f176246..2e62d43436 100644 --- a/packages/create-app/CHANGELOG.md +++ b/packages/create-app/CHANGELOG.md @@ -1,6 +1,6 @@ # @backstage/create-app -## 1.0.0 +## 0.3.22 ### Patch Changes diff --git a/packages/create-app/package.json b/packages/create-app/package.json index d7dc99218e..b850893f9c 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": "1.0.0", + "version": "0.3.22", "private": false, "publishConfig": { "access": "public"