asciidoctor-kroki: asciidoctor-kroki breaks when using remote content repositories

we have various playbooks and remote content sources setup. we’ve recently introduced kroki as a way to not manually copy paste diagrams from MSPaint or lucid w/e. While this all works perfectly with local content sources, having them as remote content sources results in the following error;

Skipping diagramsnet block macro. The "path" argument must be of type string. Received undefined

During our builds we install all the required npm extensions;

npm i -g @antora/cli@3.0.0 @antora/site-generator@3.0.0 asciidoctor-kroki asciidoctor-external-callout

we call the extensions like so

.Context view diagram
diagramsnet::{partial-prefix}/context-view.drawio[format=png]

During our debugging we’ve figured out that local works but remote doesn’t. We’ve tried the following remediations;

  • setting the cache dir to see if we can look at the content it loads. this sadly didn’t work as the only thing in the cache dir are the ui-bundle and the bare repos.
  • setting the kroki attributes on the module.yaml (yes, they have always been in the playbook). this also didn’t work.
  • switching version. we’re currently on 3.0, either down- or upgrading didn’t work.
  • various different incantations of the diagramsnet block.

A remote playbook

site:
  title: SuperSecure Internal Documentation
  url: https://supersecure.acme.dope
  start_page: documentation-solution-overview::introduction-to-docs-as-code.adoc

content:
  sources:
 	.....more content sources
    - url: https://github.com/acme-dope/cloudops-docs.git
      branches: main
      start_path: documentation
   
asciidoc:
  attributes:
    kroki-server-url: https://kroki.acme.dope
    kroki-fetch-diagram: true
  extensions:
    - asciidoctor-kroki
    - asciidoctor-external-callout

	...ui bundle

A local playbook

site:
  title: Cloud Operations Documentation
  url: https://supersecure.acme.dope
  start_page: cloud-operations-documentation::index.adoc
content:
  sources:
    - url: ./../../
      start_path: documentation

asciidoc:
  attributes:
    kroki-server-url: https://kroki.acme.dope
    kroki-fetch-diagram: true
  extensions:
  - asciidoctor-kroki
  - asciidoctor-external-callout

  ...ui bundle

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 17 (14 by maintainers)

Commits related to this issue

Most upvoted comments

I think we need to rethink how to implement the preprocessor that resolves PlantUML !include directives and Vega datasets when running in an Antora context.

But before that I think we need to specify how it should work. Currently, we are trying to resolve them using Antora Resource IDs and/or using a relative paths. I’m not sure what is the best practice here. If the PlantUML or Vega file is part of an Antora documentation component, I think it makes sense to use resource IDs rather than relative paths.

Anyway, until we specify how it should work, my quick fix is to use ospath.dirname(target.src.abspath || target.src.path).

Regarding the logger, is it possible to use a message AND a data object. If not I think I will use an err object and try to format it. I might also add the name of the extension to make it clear that the error comes from Asciidoctor Kroki.

I guess I could also add the source_location, if I can get access to the reader.

Before I can investigate, I need a reproducible test case or example to work with. https://github.com/acme-dope/cloudops-docs.git is not a real git repository, so there’s no way for me to test this right now. I’m not going to spend the time to set up the scenario on my own since a) I may not reproduce the scenario correctly and b) it’s not fair for me to have to do that.