Commit Graph

91 Commits

Author SHA1 Message Date
Matei David a5e27d5c1d Introduce techdocs metadata in techdocs-common
* Add TechdocsMetadata type in backend plugin endpoint
 * Introduce TechDocsMetadata type in frontend
 * Add changeset
 * Remove old thennable metadata resp
 * Address PR feedback
  - Remove explicit type annotation on TechDocsMetadata
  - Reintroduce res.send instead of throwing an error
  - Change logger info to logger error
 * Add TechDocsMetadata type in frontend plugin
 * Commit yarn.lock
 * Introduce JSON5 and remove parsing in local pub
Signed-off-by: Matei David <matei.david.35@gmail.com>
2021-01-16 18:33:53 +00:00
Himanshu Mishra cb7af51e73 techdocs: cache docs site when built using urlReader for 30 minutes
This caching makes it usable experience, so that docs are not built on every load.
In future readTree will support a method to fetch the timestamp of the latest HEAD. And
it should be used to invalidate the cache.
2021-01-13 21:09:44 +01:00
Himanshu Mishra 2165901c00 TechDocs: Generator now requires input and output directory and does not create them
The creation of temporary directories and their clean up should be handled on its own. techdocs-cli already has a fixed input output dir requirement. It makes that generator accepts these values as requirements.
2021-01-11 22:33:10 +01:00
Remi b9e6d305e2 fix(techdocs): typos + add tests + requested changes 2020-12-30 10:25:57 +01:00
Remi c4fcd8b180 feat(techdocs-backend): add awsS3 2020-12-30 10:22:12 +01:00
Himanshu Mishra c91e4d6b04 techdocs: Use @backstage/integration for scm tokens and request options 2020-12-28 21:08:54 +01:00
Himanshu Mishra 2ac77aeec2 techdocs-backend: Remove individual preparers and generators from app backend, to use factory methods
When a new Backstage app is setup, the techdocs backend file contains all the preparers (dir, github, gitlab, etc.) and same for generators. While this providers added customizibility, it comes with a cost of complexity in setting up the app backend. New preparers' updates would need users to update their app's techdocs backend file.

Scaffolder backend has already moved to this proposed pattern.
2020-12-17 11:33:56 +01:00
Patrik Oldsberg 1da7d2c657 plugins,packages: replace usages of ConfigReader.from 2020-12-15 19:04:50 +01:00
Himanshu Mishra 24bcdd0829 techdocs: Use googleGcs for publisher type instead of google_gcs 2020-12-09 18:58:12 +01:00
Himanshu Mishra 9bd130a73a techdocs: Use 'local' and 'external' for alternatives for techdocs.builder config
Co-authored-by: freben <freben@gmail.com>
2020-12-09 12:31:40 +01:00
Himanshu Mishra 372160ede5 Update README of all three techdocs packages/plugins 2020-12-05 18:07:50 +01:00
Himanshu Mishra ff3dd9c02b create-app: Add new techdocs default configs 2020-12-05 11:13:27 +01:00
Himanshu Mishra a212e43142 techdocs: Add JSON Schema config
Show better error if techdocs.builder is set to 'ci' and if no docs are found.
Return 404 from googleStorage client when a file is not found.
2020-12-05 10:48:54 +01:00
Himanshu Mishra c91fd25a53 techdocs-backend: Fix logic to determine if docs have been published 2020-12-04 22:37:14 +01:00
Himanshu Mishra 07e7c201e8 techdocs-backend: Wait for some time before published files show up in storage 2020-12-04 22:01:45 +01:00
Himanshu Mishra 084670b37a Google Cloud Storage working with TechDocs (publish and fetch)
Plus
1. Introduce ncessary configs to connect with storage
2. Introduce config to prefer CI build of docs, or techdocs-backend to build and publish them.
3. Write guide how to use Google Cloud Storage with TechDocs
4. Add a TechDocs Configuration reference page in docucmentation
2020-12-03 22:40:15 +01:00
Himanshu Mishra e09cff1682 Abstract Publisher APIs from the router
1. Move fetchMetadata and serve static files to local publisher
2. Create factory class to create publishers based on app cofig
2020-12-02 13:05:44 +01:00
Himanshu Mishra 64737f447a App/Backend should import techdocs plugin only, not common package
If a backstage App wants to enable techdocs plugin, it should only have to care about installing @backstage/plugin-techdocs and @backstage/plugin-techdocs-backend.
@backstage/plugin-techdocs-backend should re-export necessary APIs from techdocs-common
2020-12-01 20:48:58 +01:00
Himanshu Mishra 7481601883 techdocs-backend: Add non-zero tests for the CI to pass 2020-12-01 20:48:58 +01:00
Himanshu Mishra ff348df9fe techdocs-common: Initialize package and move common code from techdocs-backend 2020-12-01 20:48:58 +01:00
Himanshu Mishra 9ebc897351 TechDocs: Refactor Publisher to pave way for external publishers 2020-12-01 20:48:58 +01:00
Himanshu Mishra 21f86aa478 Merge pull request #3337 from adrianke77/master 2020-12-01 09:48:02 +01:00
Chongyang Adrian, Ke ae95c7ff3e techdocs-backend: update Gitlab clone auth 2020-12-01 10:18:33 +08:00
Himanshu Mishra dbca620ff9 Use fs-extra and async file read method 2020-11-26 20:41:40 +01:00
Himanshu Mishra 4b53294a6c TechDocs: Update mkdocs.yml with repo_url when possible before building docs 2020-11-26 10:55:38 +01:00
Himanshu Mishra 266e93b478 TechDocs: Refactor metadata retrieval
1. Don't use mkdocs in name of APIs or variables. It is an implementation detail and liable to change in future.
2. techDocsApi.getMetadata('mkdocs') and techDocsAPI.getMetadata('entity') should be two separate functions just because their responses differ in structure. They should also be type checked.
3. Use either 'techdocs' or 'TechDocs' consistently. 'techDocs' seems like an unnecessary third way to write TechDocs, which can be avoided.
4. Remove unused /plugins/techdocs-backend/src/service/metadata.ts file
2020-11-25 19:39:48 +01:00
Fredrik Adelöw fae3fafcfa silence some new ts squigglies in the editor (#3435) 2020-11-25 09:57:16 +01:00
Himanshu Mishra 8fd5e64351 TechDocs: Tell users when index.md is missing (better error message) (#3429)
* TechDocs: Logger already prints the name of plugin

* TechDocs: Display a custom error message if provided

* TechDocs: throw custom error message if index.md is not present

* Language improvements. Thanks @freben

Co-authored-by: Fredrik Adelöw <freben@gmail.com>

Co-authored-by: Fredrik Adelöw <freben@gmail.com>
2020-11-25 09:52:19 +01:00
Himanshu Mishra f8877545c5 TechDocs: Reject promise if call to getBaseUrl fails 2020-11-18 20:35:22 +01:00
Himanshu Mishra 66daa47c6a 1. Remove DiscoveryApi (frontend) and use PluginEndpointDiscovery(SingleHostDiscovery) (backend)
2. Mock class for testing
2020-11-18 20:29:07 +01:00
Himanshu Mishra 3b314807c6 TechDocs: Use discovery instead of config to read base url 2020-11-17 21:03:56 +01:00
Himanshu Mishra c01bf361a4 Modify tests to include new config param in LocalPublish 2020-11-17 20:19:30 +01:00
Himanshu Mishra 65edcdee22 TechDocs: Remove hardcoded backend URL from techdocs-backend 2020-11-17 20:03:44 +01:00
Patrik Oldsberg bd1cef1847 backend-common: review comments for readTree + switch archive return type to a stream 2020-11-13 00:43:20 +01:00
Patrik Oldsberg b672492e21 backend-common: make .readTree required 2020-11-12 13:59:10 +01:00
Patrik Oldsberg 6417d966bb backend-common,techdocs-backend: refactor .readTree to accept options and implement GitHub reader with response utils 2020-11-12 13:53:22 +01:00
Patrik Oldsberg e74422b4d8 backend-common: make ReadTreeResponse.files async 2020-11-12 12:27:33 +01:00
Sebastian Qvarfordt f059eaf755 readTree method on UrlReader (#2925)
* Basic implementation of readTree on github and use it in techdocs

* Added a UrlPreparer and cleaned up some minor things

* Download entire archive and filter out the wanted files in readTree

* Added test for dir output of tree reader

* Fixed formatting

* Fixed formatting

* Some cleanups and fixes

* Fix typing issues

* Fix prettier

* Fix prettier

* Removed unused dependency

* Fixed comments on PR

* Prettier

* Moved @types/fs-extra to devDeps

* Fixed another PR comment

* Added a test for getDocFilesFromRepository

* Prettier
2020-11-09 16:28:51 +01:00
Patrik Oldsberg af141c0766 rewrite repo location urls 2020-11-03 11:03:49 +01:00
Iain Billett 65792dd070 Use discovery api to build URLs in techdocs
Use the discovery api to build catalog API URLs and URLs to locally published
metadata.
2020-11-02 10:59:51 +00:00
Patrik Oldsberg 24e5730200 techdocs-backend: remove duplicate log tagging 2020-10-27 10:14:47 +01:00
Patrik Oldsberg bc9f536545 Merge pull request #2994 from spotify/rugvip/conflagrate
config-loader: switch to using --config options to load in config
2020-10-22 18:01:21 +02:00
Sachin Tewari df94d7edda Fix GitHub OAuth format (#3036)
* Fix GitHub OAuth format

* Fix extraction of apiBaseUrl from config

* Add 'x-oauth-basic' as password
2020-10-22 16:44:53 +02:00
Patrik Oldsberg f495ba9c18 techdocs-backend: fix config loading in git-auth 2020-10-22 12:49:02 +02:00
blam 1bc1c3af06 Merge branch 'master' of github.com:spotify/backstage into migrate-to-msw
* 'master' of github.com:spotify/backstage:
  Read git auth token from backend config (#2992)
  chore(catalog-model): add the petstore into the default entities
  chore(deps-dev): bump @storybook/addon-actions from 6.0.21 to 6.0.26
  chore(deps): bump eslint-config-prettier from 6.10.0 to 6.14.0
  Add API docs link to About card
  adds a sample organization set of users and groups (#2963)
  Make sure hasCostsWithinTimeframe is a boolean
  fix(catalog-backend): fix codeowners processor to handle users
  feat(catalog): add simple client side paging
  default to last 30 days
  Removed default-branch library since it's no longer used (#3019)
  useRealTimers in  onCssReady test case
  move type dependecy
  remove unused import
  changeset
  simpler query params
2020-10-22 11:02:32 +02:00
Patrik Oldsberg 8c2b76e45f config-loader: switch to using --config options to load in config 2020-10-22 10:52:06 +02:00
Sachin Tewari 1d652bbb2f Read git auth token from backend config (#2992) 2020-10-22 09:31:32 +02:00
blam 681c861d25 Merge remote-tracking branch 'origin' into migrate-to-msw
* origin:
  fix: ts
  fix: forwardRef to SidebarItem
  fix(cli): one more await in the test
  backend-common: make loadBackendConfig return config directly and log all resolved app-configs
2020-10-21 13:57:40 +02:00
Patrik Oldsberg acb48c1876 Merge pull request #2976 from spotify/rugvip/logconf
backend-common: make loadBackendConfig return config directly and log all resolved app-configs
2020-10-21 13:00:52 +02:00
blam 06f410cc93 Merge branch 'master' of github.com:spotify/backstage into migrate-to-msw
* 'master' of github.com:spotify/backstage: (34 commits)
  TechDocs Backend: Replace hardcoded github api by configuration value (#3004)
  fix: accordion details design for job stage failure  (#3014)
  fix: responsive of page example in storybook (#3005)
  fix: update the ItemCard component and it's story (#3007)
  rename stories folder to Chip (#3009)
  feat: Display the plugins InfoCards on EntityPage Overwiev suitable full height (#2826)
  fix(cost-insights): More exports to help custom alerting
  chore(scaffolder): bump rjsf
  remove unused CSS (#2999)
  feat: update github pull requests package version
  fix(github-actions): fix crash when viewing ongoing workflows
  fix(cli): removePlugin forgotten await
  catalog-backend: relations db review comments and more tests
  Feat/add aws lambda plugin (#2985)
  chore(deps): bump object-path from 0.11.4 to 0.11.5 (#2983)
  add changeset
  fix CodeSnippet test case warnings
  fix CopyTextButton test case warnings
  fix the warning by wrapping in act
  fix(catalog): fix link to techdocs
  ...
2020-10-21 11:27:18 +02:00