Dagger
Search

techdocs

Builds a repository's TechDocs site in CI and publishes it to S3-compatible
storage (MinIO), so Backstage runs with `techdocs.builder: external` and
only reads the finished HTML instead of running mkdocs in its own pod.

The site is built with `techdocs-cli generate --no-docker` (mkdocs +
mkdocs-techdocs-core) and uploaded with `techdocs-cli publish
--publisher-type awsS3` to ////, the path
Backstage's awsS3 publisher reads.

Functions:
- Generate: builds the site of a source directory
- Entity: reads // from catalog-info.yaml
- Publish: uploads a generated site for an entity
- GenerateAndPublish: all of the above in one call

Installation

dagger install github.com/stuttgart-things/dagger/techdocs@v0.138.0

Entrypoint

Return Type
Techdocs
Example
dagger -m github.com/stuttgart-things/dagger/techdocs@92f91c00530505785285858f86af64e2fff02aff call \
func (m *MyModule) Example() *dagger.Techdocs  {
	return dag.
			Techdocs()
}
@function
def example() -> dagger.Techdocs:
	return (
		dag.techdocs()
	)
@func()
example(): Techdocs {
	return dag
		.techdocs()
}

Types

Techdocs 🔗

baseImage() 🔗

Return Type
String !
Example
dagger -m github.com/stuttgart-things/dagger/techdocs@92f91c00530505785285858f86af64e2fff02aff call \
 base-image
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			Techdocs().
			Baseimage(ctx)
}
@function
async def example() -> str:
	return await (
		dag.techdocs()
		.baseimage()
	)
@func()
async example(): Promise<string> {
	return dag
		.techdocs()
		.baseImage()
}

entity() 🔗

Entity returns // of the entity in catalogFile that carries the backstage.io/techdocs-ref annotation – the path Backstage looks up the docs under. The namespace defaults to “default”.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-

Repository directory containing catalogFile

catalogFileString "catalog-info.yaml"

Catalog file inside src to read the entity from

Example
dagger -m github.com/stuttgart-things/dagger/techdocs@92f91c00530505785285858f86af64e2fff02aff call \
 entity --src DIR_PATH
func (m *MyModule) Example(ctx context.Context, src *dagger.Directory) string  {
	return dag.
			Techdocs().
			Entity(ctx, src)
}
@function
async def example(src: dagger.Directory) -> str:
	return await (
		dag.techdocs()
		.entity(src)
	)
@func()
async example(src: Directory): Promise<string> {
	return dag
		.techdocs()
		.entity(src)
}

generate() 🔗

Generate builds the TechDocs site of src (the directory holding mkdocs.yml) and returns it.

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-

Repository (or docs) directory containing mkdocs.yml

sourceDirString "."

Directory of mkdocs.yml inside src

Example
dagger -m github.com/stuttgart-things/dagger/techdocs@92f91c00530505785285858f86af64e2fff02aff call \
 generate --src DIR_PATH
func (m *MyModule) Example(src *dagger.Directory) *dagger.Directory  {
	return dag.
			Techdocs().
			Generate(src)
}
@function
def example(src: dagger.Directory) -> dagger.Directory:
	return (
		dag.techdocs()
		.generate(src)
	)
@func()
example(src: Directory): Directory {
	return dag
		.techdocs()
		.generate(src)
}

generateAndPublish() 🔗

GenerateAndPublish builds the site of src and publishes it. The entity is read from catalog-info.yaml unless given.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-

Repository directory containing mkdocs.yml and catalog-info.yaml

bucketString !-

Bucket Backstage reads (techdocs.publisher.awsS3.bucketName)

endpointString !-

S3 endpoint, e.g. https://minio.example.com

accessKeySecret !-

S3 access key of a user that may write to bucket

secretKeySecret !-

S3 secret key

entityString -

Entity as //; read from catalogFile if empty

catalogFileString "catalog-info.yaml"

Catalog file inside src to read the entity from

sourceDirString "."

Directory of mkdocs.yml inside src

regionString "us-east-1"

Region; MinIO accepts any value

caCertFile -

PEM CA certificate for an endpoint signed by a private CA

Example
dagger -m github.com/stuttgart-things/dagger/techdocs@92f91c00530505785285858f86af64e2fff02aff call \
 generate-and-publish --src DIR_PATH --bucket string --endpoint string --access-key env:MYSECRET --secret-key env:MYSECRET
func (m *MyModule) Example(ctx context.Context, src *dagger.Directory, bucket string, endpoint string, accessKey *dagger.Secret, secretKey *dagger.Secret) string  {
	return dag.
			Techdocs().
			Generateandpublish(ctx, src, bucket, endpoint, accessKey, secretKey)
}
@function
async def example(src: dagger.Directory, bucket: str, endpoint: str, accesskey: dagger.Secret, secretkey: dagger.Secret) -> str:
	return await (
		dag.techdocs()
		.generateandpublish(src, bucket, endpoint, accesskey, secretkey)
	)
@func()
async example(src: Directory, bucket: string, endpoint: string, accessKey: Secret, secretKey: Secret): Promise<string> {
	return dag
		.techdocs()
		.generateAndPublish(src, bucket, endpoint, accessKey, secretKey)
}

publish() 🔗

Publish uploads a site built by Generate to an S3-compatible bucket, under the path Backstage reads for entity. Stale files of a previous publish of the same entity are removed.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
siteDirectory !-

Site directory returned by Generate

entityString !-

Entity as //, e.g. default/component/flux

bucketString !-

Bucket Backstage reads (techdocs.publisher.awsS3.bucketName)

endpointString !-

S3 endpoint, e.g. https://minio.example.com

accessKeySecret !-

S3 access key of a user that may write to bucket

secretKeySecret !-

S3 secret key

regionString "us-east-1"

Region; MinIO accepts any value

caCertFile -

PEM CA certificate for an endpoint signed by a private CA

Example
dagger -m github.com/stuttgart-things/dagger/techdocs@92f91c00530505785285858f86af64e2fff02aff call \
 publish --site DIR_PATH --entity string --bucket string --endpoint string --access-key env:MYSECRET --secret-key env:MYSECRET
func (m *MyModule) Example(ctx context.Context, site *dagger.Directory, entity string, bucket string, endpoint string, accessKey *dagger.Secret, secretKey *dagger.Secret) string  {
	return dag.
			Techdocs().
			Publish(ctx, site, entity, bucket, endpoint, accessKey, secretKey)
}
@function
async def example(site: dagger.Directory, entity: str, bucket: str, endpoint: str, accesskey: dagger.Secret, secretkey: dagger.Secret) -> str:
	return await (
		dag.techdocs()
		.publish(site, entity, bucket, endpoint, accesskey, secretkey)
	)
@func()
async example(site: Directory, entity: string, bucket: string, endpoint: string, accessKey: Secret, secretKey: Secret): Promise<string> {
	return dag
		.techdocs()
		.publish(site, entity, bucket, endpoint, accessKey, secretKey)
}