Merge branch 'backstage:master' into topic/add-homepagetimer-to-new-homepage

This commit is contained in:
Andre Wanlin
2021-09-09 08:13:58 -05:00
committed by GitHub
8 changed files with 36 additions and 48 deletions
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/backend-common': patch
---
Fixing issue with `AzureUrlReader` that doesn't do `subpath` directories correctly
+16
View File
@@ -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
```
+10 -1
View File
@@ -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
@@ -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',
@@ -94,6 +94,8 @@ export class AzureUrlReader implements UrlReader {
url: string,
options?: ReadTreeOptions,
): Promise<ReadTreeResponse> {
// 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,
});
}
@@ -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<boolean> {
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;
}
@@ -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();
+6 -6
View File
@@ -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"