Merge branch 'master' into techdoc_title

This commit is contained in:
Aurelio Saraiva
2021-08-30 18:17:19 -03:00
582 changed files with 14919 additions and 4067 deletions
+87
View File
@@ -1,5 +1,92 @@
# @backstage/plugin-techdocs-backend
## 0.10.0
### Minor Changes
- 58452cdb7: OpenStack Swift Client changed with Trendyol's OpenStack Swift SDK.
## Migration from old OpenStack Swift Configuration
Let's assume we have the old OpenStack Swift configuration here.
```yaml
techdocs:
publisher:
type: 'openStackSwift'
openStackSwift:
containerName: 'name-of-techdocs-storage-bucket'
credentials:
username: ${OPENSTACK_SWIFT_STORAGE_USERNAME}
password: ${OPENSTACK_SWIFT_STORAGE_PASSWORD}
authUrl: ${OPENSTACK_SWIFT_STORAGE_AUTH_URL}
keystoneAuthVersion: ${OPENSTACK_SWIFT_STORAGE_AUTH_VERSION}
domainId: ${OPENSTACK_SWIFT_STORAGE_DOMAIN_ID}
domainName: ${OPENSTACK_SWIFT_STORAGE_DOMAIN_NAME}
region: ${OPENSTACK_SWIFT_STORAGE_REGION}
```
##### Step 1: Change the credential keys
Since the new SDK uses _Application Credentials_ to authenticate OpenStack, we
need to change the keys `credentials.username` to `credentials.id`,
`credentials.password` to `credentials.secret` and use Application Credential ID
and secret here. For more detail about credentials look
[here](https://docs.openstack.org/api-ref/identity/v3/?expanded=password-authentication-with-unscoped-authorization-detail,authenticating-with-an-application-credential-detail#authenticating-with-an-application-credential).
##### Step 2: Remove the unused keys
Since the new SDK doesn't use the old way authentication, we don't need the keys
`openStackSwift.keystoneAuthVersion`, `openStackSwift.domainId`,
`openStackSwift.domainName` and `openStackSwift.region`. So you can remove them.
##### Step 3: Add Swift URL
The new SDK needs the OpenStack Swift connection URL for connecting the Swift.
So you need to add a new key called `openStackSwift.swiftUrl` and give the
OpenStack Swift url here. Example url should look like that:
`https://example.com:6780/swift/v1`
##### That's it!
Your new configuration should look like that!
```yaml
techdocs:
publisher:
type: 'openStackSwift'
openStackSwift:
containerName: 'name-of-techdocs-storage-bucket'
credentials:
id: ${OPENSTACK_SWIFT_STORAGE_APPLICATION_CREDENTIALS_ID}
secret: ${OPENSTACK_SWIFT_STORAGE_APPLICATION_CREDENTIALS_SECRET}
authUrl: ${OPENSTACK_SWIFT_STORAGE_AUTH_URL}
swiftUrl: ${OPENSTACK_SWIFT_STORAGE_SWIFT_URL}
```
- c772d9a84: TechDocs sites can now be accessed using paths containing entity triplets of
any case (e.g. `/docs/namespace/KIND/name` or `/docs/namespace/kind/name`).
If you do not use an external storage provider for serving TechDocs, this is a
transparent change and no action is required from you.
If you _do_ use an external storage provider for serving TechDocs (one of\* GCS,
AWS S3, or Azure Blob Storage), you must run a migration command against your
storage provider before updating.
[A migration guide is available here](https://backstage.io/docs/features/techdocs/how-to-guides#how-to-migrate-from-techdocs-alpha-to-beta).
- (\*) We're seeking help from the community to bring OpenStack Swift support
[to feature parity](https://github.com/backstage/backstage/issues/6763) with the above.
### Patch Changes
- Updated dependencies
- @backstage/backend-common@0.9.0
- @backstage/integration@0.6.2
- @backstage/config@0.1.8
- @backstage/techdocs-common@0.9.0
## 0.9.2
### Patch Changes
+2 -16
View File
@@ -8,12 +8,12 @@ import { Config } from '@backstage/config';
import { DocumentCollator } from '@backstage/search-common';
import express from 'express';
import { GeneratorBuilder } from '@backstage/techdocs-common';
import { IndexableDocument } from '@backstage/search-common';
import { Knex } from 'knex';
import { Logger as Logger_2 } from 'winston';
import { PluginEndpointDiscovery } from '@backstage/backend-common';
import { PreparerBuilder } from '@backstage/techdocs-common';
import { PublisherBase } from '@backstage/techdocs-common';
import { TechDocsDocument } from '@backstage/techdocs-common';
// Warning: (ae-forgotten-export) The symbol "RouterOptions" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "createRouter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
@@ -53,21 +53,7 @@ export class DefaultTechDocsCollator implements DocumentCollator {
readonly type: string;
}
// Warning: (ae-missing-release-tag) "TechDocsDocument" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface TechDocsDocument extends IndexableDocument {
// (undocumented)
kind: string;
// (undocumented)
lifecycle: string;
// (undocumented)
name: string;
// (undocumented)
namespace: string;
// (undocumented)
owner: string;
}
export { TechDocsDocument };
export * from '@backstage/techdocs-common';
+16 -22
View File
@@ -137,15 +137,15 @@ export interface Config {
*/
credentials: {
/**
* (Required) Root user name
* (Required) Application Credential ID
* @visibility secret
*/
username: string;
id: string;
/**
* (Required) Root user password
* (Required) Application Credential Secret
* @visibility secret
*/
password: string; // required
secret: string; // required
};
/**
* (Required) Cloud Storage Container Name
@@ -158,26 +158,10 @@ export interface Config {
*/
authUrl: string;
/**
* (Optional) Auth version
* If not set, 'v2.0' will be used.
* (Required) Swift URL
* @visibility backend
*/
keystoneAuthVersion: string;
/**
* (Required) Domain Id
* @visibility backend
*/
domainId: string;
/**
* (Required) Domain Name
* @visibility backend
*/
domainName: string;
/**
* (Required) Region
* @visibility backend
*/
region: string;
swiftUrl: string;
};
}
| {
@@ -246,5 +230,15 @@ export interface Config {
* @deprecated
*/
storageUrl?: string;
/**
* (Optional and not recommended) Prior to version [0.x.y] of TechDocs, docs
* sites could only be accessed over paths with case-sensitive entity triplets
* e.g. (namespace/Kind/name). If you are upgrading from an older version of
* TechDocs and are unable to perform the necessary migration of files in your
* external storage, you can set this value to `true` to temporarily revert to
* the old, case-sensitive entity triplet behavior.
*/
legacyUseCaseSensitiveTripletPaths?: boolean;
};
}
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-techdocs-backend",
"version": "0.9.2",
"version": "0.10.0",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -30,14 +30,14 @@
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/backend-common": "^0.8.9",
"@backstage/backend-common": "^0.9.0",
"@backstage/catalog-client": "^0.3.17",
"@backstage/catalog-model": "^0.9.0",
"@backstage/config": "^0.1.6",
"@backstage/config": "^0.1.8",
"@backstage/errors": "^0.1.1",
"@backstage/integration": "^0.6.0",
"@backstage/integration": "^0.6.2",
"@backstage/search-common": "^0.1.3",
"@backstage/techdocs-common": "^0.8.1",
"@backstage/techdocs-common": "^0.9.0",
"@types/express": "^4.17.6",
"cross-fetch": "^3.0.6",
"dockerode": "^3.2.1",
@@ -16,12 +16,13 @@
import { PluginEndpointDiscovery } from '@backstage/backend-common';
import { Entity, RELATION_OWNED_BY } from '@backstage/catalog-model';
import { IndexableDocument, DocumentCollator } from '@backstage/search-common';
import { DocumentCollator } from '@backstage/search-common';
import fetch from 'cross-fetch';
import unescape from 'lodash/unescape';
import { Logger } from 'winston';
import pLimit from 'p-limit';
import { CatalogApi, CatalogClient } from '@backstage/catalog-client';
import { TechDocsDocument } from '@backstage/techdocs-common';
interface MkSearchIndexDoc {
title: string;
@@ -29,14 +30,6 @@ interface MkSearchIndexDoc {
location: string;
}
export interface TechDocsDocument extends IndexableDocument {
kind: string;
namespace: string;
name: string;
lifecycle: string;
owner: string;
}
export class DefaultTechDocsCollator implements DocumentCollator {
protected discovery: PluginEndpointDiscovery;
protected locationTemplate: string;
@@ -108,6 +101,7 @@ export class DefaultTechDocsCollator implements DocumentCollator {
...entityInfo,
path: doc.location,
}),
path: doc.location,
...entityInfo,
componentType: entity.spec?.type?.toString() || 'other',
lifecycle: (entity.spec?.lifecycle as string) || '',
+5 -1
View File
@@ -14,4 +14,8 @@
* limitations under the License.
*/
export { DefaultTechDocsCollator } from './DefaultTechDocsCollator';
export type { TechDocsDocument } from './DefaultTechDocsCollator';
/**
* @deprecated Use directly from @backstage/techdocs-common
*/
export type { TechDocsDocument } from '@backstage/techdocs-common';