Skip to content

Commit

Permalink
techdocs: Use 'local' and 'external' for alternatives for techdocs.bu…
Browse files Browse the repository at this point in the history
…ilder config

Co-authored-by: freben <freben@gmail.com>
  • Loading branch information
OrkoHunter and freben committed Dec 9, 2020
1 parent fc697b8 commit 9bd130a
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .changeset/friendly-carpets-repeat.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ _Breaking changes_
Step-by-step guide to configure GCS is available here https://backstage.io/docs/features/techdocs/using-cloud-storage
Set `techdocs.publisher.type` to `'local'` if you want to continue using local filesystem to store TechDocs files.

2. `techdocs.builder` is now required and can be set to `'local'` or `'ci'`. (Set it to `'local'` for now, since CI/CD build
2. `techdocs.builder` is now required and can be set to `'local'` or `'external'`. (Set it to `'local'` for now, since CI/CD build
workflow for TechDocs will be available soon (in few weeks)).
If builder is set to 'local' and you open a TechDocs page, `techdocs-backend` will try to build the docs, publish to storage and
show the generated docs afterwords.
If builder is set to `'ci'`, `techdocs-backend` will only fetch the docs and will NOT try to build and publish. In this case of 'ci',
If builder is set to `'external'`, `techdocs-backend` will only fetch the docs and will NOT try to build and publish. In this case of `'external'`,
we assume that docs are being built in the CI/CD pipeline of the repository.
TechDocs will not assume a default value for `techdocs.builder`. It is better to explicitly define it in the `app-config.yaml`.

Expand Down
2 changes: 1 addition & 1 deletion .changeset/six-mugs-camp.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ instead of
An instance of `publisher` can either be a local filesystem publisher or a Google Cloud Storage publisher.

Read more about the configs here https://backstage.io/docs/features/techdocs/configuration
(You will also have to update `techdocs.storage.type` to `local` or `google_gcs`. And `techdocs.builder` to either `local` or `ci`.)
(You will also have to update `techdocs.storage.type` to `local` or `google_gcs`. And `techdocs.builder` to either `local` or `external`.)
2 changes: 1 addition & 1 deletion app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ organization:
techdocs:
requestUrl: http://localhost:7000/api/techdocs
storageUrl: http://localhost:7000/api/techdocs/static/docs
builder: 'local' # Alternatives - 'ci'
builder: 'local' # Alternatives - 'external'
generators:
techdocs: 'docker' # Alternatives - 'local'
publisher:
Expand Down
10 changes: 5 additions & 5 deletions docs/features/techdocs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ techdocs:

# generators.techdocs can have two values: 'docker' or 'local'. This is to determine how to run the generator - whether to
# spin up the techdocs-container docker image or to run mkdocs locally (assuming all the dependencies are taken care of).
# You want to change this to 'local' if you are running Backstage using your own customer Docker setup and want to avoid running
# You want to change this to 'local' if you are running Backstage using your own custom Docker setup and want to avoid running
# into Docker in Docker situation. Read more here
# https://backstage.io/docs/features/techdocs/getting-started#disable-docker-in-docker-situation-optional

generators:
techdocs: 'docker'


# techdocs.builder can be either 'local' or 'ci.
# techdocs.builder can be either 'local' or 'external.
# If builder is set to 'local' and you open a TechDocs page, techdocs-backend will try to build the docs, publish to storage
# and show the generated docs afterwords. This is the "Basic" setup of the TechDocs Architecture.
# If builder is set to 'ci', techdocs-backend will only fetch the docs and will NOT try to build and publish. In this case of 'ci',
# we assume that docs are being built in the CI/CD pipeline of the repository. This is the "Recommended" setup of the architecture.
# Read more here https://backstage.io/docs/features/techdocs/architecture
# If builder is set to 'external', techdocs-backend will only fetch the docs and will NOT try to build and publish. In this case of 'external',
# we assume that docs are being built by an external process (e.g. in the CI/CD pipeline of the repository). This is the "Recommended" setup of
# the architecture. Read more here https://backstage.io/docs/features/techdocs/architecture

builder: 'local'

Expand Down
4 changes: 2 additions & 2 deletions plugins/techdocs-backend/src/service/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ export async function createRouter({
}

// techdocs-backend will only try to build documentation for an entity if techdocs.builder is set to 'local'
// If set to 'ci', it will only try to fetch and assume that that CI/CD pipeline of the repository hosting the
// entity's documentation is responsible for building and publishing documentation to the storage provider.
// If set to 'external', it will only try to fetch and assume that an external process (e.g. CI/CD pipeline
// of the repository) is responsible for building and publishing documentation to the storage provider.
if (config.getString('techdocs.builder') === 'local') {
const docsBuilder = new DocsBuilder({
preparers,
Expand Down
9 changes: 5 additions & 4 deletions plugins/techdocs/src/reader/components/TechDocsNotFound.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ export const TechDocsNotFound = ({ errorMessage }: Props) => {
);

let additionalInfo = '';
if (techdocsBuilder === 'ci') {
if (techdocsBuilder !== 'local') {
additionalInfo =
"Note that you have set techdocs.builder to 'ci' in your config, which means this Backstage app will not " +
"build docs if they are not found. Make sure the project's CI/CD pipeline builds and publishes docs. Or " +
"change techdocs.builder to 'local' to build docs from this Backstage instance.";
"Note that techdocs.builder is not set to 'local' in your config, which means this Backstage app will not " +
"build docs if they are not found. Make sure the project's docs are generated and published by some external " +
"process (e.g. CI/CD pipeline). Or change techdocs.builder to 'local' to build docs from this Backstage " +
'instance.';
}

return (
Expand Down

0 comments on commit 9bd130a

Please sign in to comment.