diff --git a/.changeset/nine-comics-smash.md b/.changeset/nine-comics-smash.md new file mode 100644 index 0000000000..147944930d --- /dev/null +++ b/.changeset/nine-comics-smash.md @@ -0,0 +1,7 @@ +--- +'@backstage/techdocs-common': patch +'@backstage/plugin-techdocs-backend': patch +'@backstage/plugin-techdocs': patch +--- + +OpenStack Swift publisher added for tech-docs. diff --git a/.changeset/odd-mirrors-smell.md b/.changeset/odd-mirrors-smell.md deleted file mode 100644 index 7b6e0285ef..0000000000 --- a/.changeset/odd-mirrors-smell.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@backstage/techdocs-common': minor -'@backstage/plugin-techdocs': minor -'@backstage/plugin-techdocs-backend': minor ---- - -OpenStack Swift Publisher added to TechDocs diff --git a/docs/features/techdocs/README.md b/docs/features/techdocs/README.md index 2fa48f57b0..7025364f78 100644 --- a/docs/features/techdocs/README.md +++ b/docs/features/techdocs/README.md @@ -54,6 +54,7 @@ providers are used. | Google Cloud Storage (GCS) | Yes ✅ | | Amazon Web Services (AWS) S3 | Yes ✅ | | Azure Blob Storage | Yes ✅ | +| OpenStack Swift | Yes ✅ | [Reach out to us](#feedback) if you want to request more platforms. diff --git a/packages/techdocs-common/src/stages/publish/openStackSwift.ts b/packages/techdocs-common/src/stages/publish/openStackSwift.ts index 3987a36e17..0e60bc5796 100644 --- a/packages/techdocs-common/src/stages/publish/openStackSwift.ts +++ b/packages/techdocs-common/src/stages/publish/openStackSwift.ts @@ -130,8 +130,6 @@ export class OpenStackSwiftPublish implements PublisherBase { const entityRootDir = `${entity.metadata.namespace}/${entity.kind}/${entity.metadata.name}`; const destination = `${entityRootDir}/${relativeFilePathPosix}`; // Swift container file relative path - const readStream = fs.createReadStream(filePath, 'utf8'); - const params = { container: this.containerName, remote: destination, @@ -141,6 +139,8 @@ export class OpenStackSwiftPublish implements PublisherBase { const uploadFile = limiter( () => new Promise((res, rej) => { + const readStream = fs.createReadStream(filePath, 'utf8'); + const writeStream = this.storageClient.upload(params); writeStream.on('error', rej); @@ -246,10 +246,13 @@ export class OpenStackSwiftPublish implements PublisherBase { this.storageClient.getFile( this.containerName, `${entityRootDir}/index.html`, - (err: any, file: any) => { + (err, file) => { if (!err && file) { res(true); - } else res(false); + } else { + res(false); + this.logger.warn(err.message); + } }, ); }); diff --git a/plugins/techdocs/config.d.ts b/plugins/techdocs/config.d.ts index 5e12f7dbc7..54d2b8fb69 100644 --- a/plugins/techdocs/config.d.ts +++ b/plugins/techdocs/config.d.ts @@ -100,12 +100,12 @@ export interface Config { credentials: { /** * (Required) Root user name - * @visibility backend + * @visibility secret */ username: string; /** * (Required) Root user password - * @visibility backend + * @visibility secret */ password: string; // required };