diff --git a/.changeset/early-seahorses-stare.md b/.changeset/early-seahorses-stare.md deleted file mode 100644 index 963058a26f..0000000000 --- a/.changeset/early-seahorses-stare.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@backstage/backend-common': patch ---- - -Fixing issue with `AzureUrlReader` that doesn't do `subpath` directories correctly diff --git a/.changeset/strange-buckets-design.md b/.changeset/strange-buckets-design.md new file mode 100644 index 0000000000..3cdf858174 --- /dev/null +++ b/.changeset/strange-buckets-design.md @@ -0,0 +1,16 @@ +--- +'@backstage/plugin-catalog-backend': patch +--- + +This change drops support for deprecated location types which have all been replaced by the `url` type. +There has been a deprecation warning in place since the beginning of this year so most should already be migrated and received information at this point. + +The now removed location types are: + +``` +github +github/api +bitbucket/api +gitlab/api +azure/api +``` diff --git a/docs/conf/reading.md b/docs/conf/reading.md index 6ac10a8c8b..d492723e3d 100644 --- a/docs/conf/reading.md +++ b/docs/conf/reading.md @@ -112,7 +112,16 @@ example `getString`. These will throw an error if there is no value available. The [ConfigApi](../reference/utility-apis/Config.md) in the frontend is a [UtilityApi](../api/utility-apis.md). It's accessible as usual via the -`configApiRef` exported from `@backstage/core-plugin-api`. +`configApiRef` exported from `@backstage/core-plugin-api`: + +``` +import { useApi, configApiRef } from '@backstage/core-plugin-api'; +... +const MyReactComponent = (...) => { + const config = useApi(configApiRef); + ... +} +``` Depending on the config api in another API is slightly different though, as the `ConfigApi` implementation is supplied via the App itself and not instantiated diff --git a/packages/backend-common/src/reading/AzureUrlReader.test.ts b/packages/backend-common/src/reading/AzureUrlReader.test.ts index fc1f6a03f3..c7c8853929 100644 --- a/packages/backend-common/src/reading/AzureUrlReader.test.ts +++ b/packages/backend-common/src/reading/AzureUrlReader.test.ts @@ -220,21 +220,6 @@ describe('AzureUrlReader', () => { expect(indexMarkdownFile.toString()).toBe('# Test\n'); }); - it('returns the wanted files from an archive when a subpath is passed through', async () => { - const response = await processor.readTree( - 'https://dev.azure.com/organization/project/_git/repository?path=%2Fdocs', - ); - - expect(response.etag).toBe('123abc2'); - - const files = await response.files(); - - expect(files.length).toBe(1); - const indexMarkdownFile = await files[0].content(); - - expect(indexMarkdownFile.toString()).toBe('# Test\n'); - }); - it('creates a directory with the wanted files', async () => { const response = await processor.readTree( 'https://dev.azure.com/organization/project/_git/repository', diff --git a/packages/backend-common/src/reading/AzureUrlReader.ts b/packages/backend-common/src/reading/AzureUrlReader.ts index 2269393cbf..910e8e04a5 100644 --- a/packages/backend-common/src/reading/AzureUrlReader.ts +++ b/packages/backend-common/src/reading/AzureUrlReader.ts @@ -94,6 +94,8 @@ export class AzureUrlReader implements UrlReader { url: string, options?: ReadTreeOptions, ): Promise { + // TODO: Support filepath based reading tree feature like other providers + // Get latest commit SHA const commitsAzureResponse = await fetch( @@ -127,13 +129,10 @@ export class AzureUrlReader implements UrlReader { throw new Error(message); } - const { filepath } = parseGitUrl(url); - return await this.deps.treeResponseFactory.fromZipArchive({ stream: archiveAzureResponse.body as unknown as Readable, etag: commitSha, filter: options?.filter, - subpath: filepath, }); } diff --git a/plugins/catalog-backend/src/ingestion/processors/UrlReaderProcessor.ts b/plugins/catalog-backend/src/ingestion/processors/UrlReaderProcessor.ts index da7bee12d8..e3ec8c0480 100644 --- a/plugins/catalog-backend/src/ingestion/processors/UrlReaderProcessor.ts +++ b/plugins/catalog-backend/src/ingestion/processors/UrlReaderProcessor.ts @@ -26,16 +26,6 @@ import { CatalogProcessorParser, } from './types'; -// TODO(Rugvip): Added for backwards compatibility when moving to UrlReader, this -// can be removed in a bit -const deprecatedTypes = [ - 'github', - 'github/api', - 'bitbucket/api', - 'gitlab/api', - 'azure/api', -]; - type Options = { reader: UrlReader; logger: Logger; @@ -50,13 +40,7 @@ export class UrlReaderProcessor implements CatalogProcessor { emit: CatalogProcessorEmit, parser: CatalogProcessorParser, ): Promise { - if (deprecatedTypes.includes(location.type)) { - // TODO(Rugvip): Remove this warning a month or two into 2021, and remove support for the deprecated types. - this.options.logger.warn( - `Location '${location.target}' uses deprecated location type '${location.type}', use 'url' instead. ` + - 'Use "scripts/migrate-location-types.js" in the Backstage repo to migrate existing locations.', - ); - } else if (location.type !== 'url') { + if (location.type !== 'url') { return false; } diff --git a/plugins/catalog-backend/src/service/CatalogBuilder.test.ts b/plugins/catalog-backend/src/service/CatalogBuilder.test.ts index 579772dcce..87a26ed3aa 100644 --- a/plugins/catalog-backend/src/service/CatalogBuilder.test.ts +++ b/plugins/catalog-backend/src/service/CatalogBuilder.test.ts @@ -166,7 +166,7 @@ describe('CatalogBuilder', () => { const { entitiesCatalog, higherOrderOperation } = await builder.build(); await higherOrderOperation.addLocation({ - type: 'github', + type: 'url', target: 'https://github.com/a/b/x.yaml', }); const { entities } = await entitiesCatalog.entities(); diff --git a/yarn.lock b/yarn.lock index 5db9fd7589..e58e6fe0ac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7417,9 +7417,9 @@ integrity sha512-0VBprVqfgFD7Ehb2vd8Lh9TG3jP98gvr8rgehQqzztZNI7o8zS8Ad4jyZneKELphpuE212D8J70LnSNQSyO6bQ== "@types/tar@^4.0.3": - version "4.0.4" - resolved "https://registry.npmjs.org/@types/tar/-/tar-4.0.4.tgz#d680de60855e7778a51c672b755869a3b8d2889f" - integrity sha512-0Xv+xcmkTsOZdIF4yCnd7RkOOyfyqPaqJ7RZFKnwdxfDbkN3eAAE9sHl8zJFqBz4VhxolW9EErbjR1oyH7jK2A== + version "4.0.5" + resolved "https://registry.npmjs.org/@types/tar/-/tar-4.0.5.tgz#5f953f183e36a15c6ce3f336568f6051b7b183f3" + integrity sha512-cgwPhNEabHaZcYIy5xeMtux2EmYBitfqEceBUi2t5+ETy4dW6kswt6WX4+HqLeiiKOo42EXbGiDmVJ2x+vi37Q== dependencies: "@types/minipass" "*" "@types/node" "*" @@ -27589,9 +27589,9 @@ write-pkg@^4.0.0: write-json-file "^3.2.0" ws@7.4.5, ws@^7.4.6: - version "7.5.4" - resolved "https://registry.npmjs.org/ws/-/ws-7.5.4.tgz#56bfa20b167427e138a7795de68d134fe92e21f9" - integrity sha512-zP9z6GXm6zC27YtspwH99T3qTG7bBFv2VIkeHstMLrLlDJuzA7tQ5ls3OJ1hOGGCzTQPniNJoHXIAOS0Jljohg== + version "7.5.5" + resolved "https://registry.npmjs.org/ws/-/ws-7.5.5.tgz#8b4bc4af518cfabd0473ae4f99144287b33eb881" + integrity sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w== ws@^5.2.0: version "5.2.3"